title: URL decoding: UnsupportedEncodingException in Java
body: <p>What I understand from the documentation is that <a href="http://download.oracle.com/javase/6/docs/api/java/net/URLDecoder.html" rel="noreferrer">UnsupportedEncodingException</a> can only be thrown if I specify a wrong encoding as the second parameter to URLDecoder.decode(String, String) method. Is it so? I need to know cases where this exception can be thrown.</p>
  
  <p>Basically, I have this code segment in one of my functions:</p>
  
  <pre><code>if (keyVal.length == 2) {
      try {
          value = URLDecoder.decode(
              keyVal[1],
              "UTF-8");
      } catch (UnsupportedEncodingException e) {
            // Will it ever be thrown?
      }
  }
  </code></pre>
  
  <p>Since I am explicitly mentioning "UTF-8", is there any way this exception can be thrown? Do I need to do anything in the catch block? Or, if my understanding is completely wrong, please let me know.</p>