Package java.nio.charset

Examples of java.nio.charset.IllegalCharsetNameException


    // After null check, this should be the first check to see that the
    // encoding is supported. It is possible that encodings which are listed
    // as being part of _cjkEncodings and singlByteEncodings might not be
    // supported by the JVM
    if ( !Charset.isSupported(encoding))
      throw new IllegalCharsetNameException(_LOG.getMessage(
        "ENCODING_UNSUPPORTED_BY_JVM", encoding));

    encoding = encoding.toLowerCase();

    if ("utf-8".equals(encoding))
View Full Code Here


            getLengthValidationFailureMessage(context, component, theValue));

      }
      catch (UnsupportedEncodingException uee)
      {
        throw new IllegalCharsetNameException(_LOG.getMessage(
          "ENCODING_NOT_SUPPORTED_BY_JVM", getEncoding()));
      }
    }
  }
View Full Code Here

            getLengthValidationFailureMessage(context, component, theValue));

      }
      catch (UnsupportedEncodingException uee)
      {
        throw new IllegalCharsetNameException("Encoding: " + getEncoding() +
                                         " is unsupported by JVM");
      }
    }
  }
View Full Code Here

    // After null check, this should be the first check to see that the
    // encoding is supported. It is possible that encodings which are listed
    // as being part of _cjkEncodings and singlByteEncodings might not be
    // supported by the JVM
    if ( !Charset.isSupported(encoding))
      throw new IllegalCharsetNameException("Encoding: " + encoding +
                                         " is unsupported by JVM");

    encoding = encoding.toLowerCase();

    if ("utf-8".equals(encoding))
View Full Code Here

            getLengthValidationFailureMessage(context, component, theValue));

      }
      catch (UnsupportedEncodingException uee)
      {
        throw new IllegalCharsetNameException(_LOG.getMessage(
          "ENCODING_NOT_SUPPORTED_BY_JVM", getEncoding()));
      }
    }
  }
View Full Code Here

    // After null check, this should be the first check to see that the
    // encoding is supported. It is possible that encodings which are listed
    // as being part of _cjkEncodings and singlByteEncodings might not be
    // supported by the JVM
    if ( !Charset.isSupported(encoding))
      throw new IllegalCharsetNameException(_LOG.getMessage(
        "ENCODING_UNSUPPORTED_BY_JVM", encoding));

    encoding = encoding.toLowerCase();

    if ("utf-8".equals(encoding))
View Full Code Here

            getLengthValidationFailureMessage(context, component, theValue));

      }
      catch (UnsupportedEncodingException uee)
      {
        throw new IllegalCharsetNameException(_LOG.getMessage(
          "ENCODING_NOT_SUPPORTED_BY_JVM", getEncoding()));
      }
    }
  }
View Full Code Here

    private void setEncoding(String name) {
      EncodingDB.Entry e = EncodingDB.getEncodings().get(Bytes.toBytes(name));
      if (e != null) {
        encoding = e.getEncoding();
      } else {
        throw new IllegalCharsetNameException(name);
      }   
    }
View Full Code Here

* Test class IllegalCharsetNameException.
*/
public class IllegalCharsetNameExceptionTest extends TestCase {

  public void testConstructor() {
    IllegalCharsetNameException ex = new IllegalCharsetNameException(
        "impossible");
    assertTrue(ex instanceof IllegalArgumentException);
    assertNull(ex.getCause());
    assertEquals(ex.getCharsetName(), "impossible");
    assertTrue(ex.getMessage().indexOf("impossible") != -1);

    ex = new IllegalCharsetNameException("ascii");
    assertNull(ex.getCause());
    assertEquals(ex.getCharsetName(), "ascii");
    assertTrue(ex.getMessage().indexOf("ascii") != -1);

    ex = new IllegalCharsetNameException("");
    assertNull(ex.getCause());
    assertEquals(ex.getCharsetName(), "");
    ex.getMessage();

    ex = new IllegalCharsetNameException(null);
    assertNull(ex.getCause());
    assertNull(ex.getCharsetName());
    assertTrue(ex.getMessage().indexOf("null") != -1);

  }
View Full Code Here

    /**
     * @tests serialization/deserialization compatibility.
     */
    public void testSerializationSelf() throws Exception {

        SerializationTest.verifySelf(new IllegalCharsetNameException(
                "charsetName"), COMPARATOR);
    }
View Full Code Here

TOP

Related Classes of java.nio.charset.IllegalCharsetNameException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.