Package java.nio.charset

Examples of java.nio.charset.IllegalCharsetNameException


    /**
     * @tests serialization/deserialization compatibility with RI.
     */
    public void testSerializationCompatibility() throws Exception {

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


        }

        // Get rid of cruft around names, like <>, trailing commas, etc.
        Matcher m = CHARSET_NAME_PATTERN.matcher(name);
        if (!m.matches()) {
            throw new IllegalCharsetNameException(name);
        }
        name = m.group(1);

        String lower = name.toLowerCase(Locale.ENGLISH);
        Charset charset = COMMON_CHARSETS.get(lower);
        if (charset != null) {
            return charset;
        } else if ("none".equals(lower) || "no".equals(lower)) {
            throw new IllegalCharsetNameException(name);
        } else {
            Matcher iso = ISO_NAME_PATTERN.matcher(lower);
            Matcher cp = CP_NAME_PATTERN.matcher(lower);
            Matcher win = WIN_NAME_PATTERN.matcher(lower);
            if (iso.matches()) {
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

        }

        // Get rid of cruft around names, like <>, trailing commas, etc.
        Matcher m = CHARSET_NAME_PATTERN.matcher(name);
        if (!m.matches()) {
            throw new IllegalCharsetNameException(name);
        }
        name = m.group(1);

        String lower = name.toLowerCase(Locale.ENGLISH);
        Charset charset = COMMON_CHARSETS.get(lower);
        if (charset != null) {
            return charset;
        } else if ("none".equals(lower) || "no".equals(lower)) {
            throw new IllegalCharsetNameException(name);
        } else {
            Matcher iso = ISO_NAME_PATTERN.matcher(lower);
            Matcher cp = CP_NAME_PATTERN.matcher(lower);
            Matcher win = WIN_NAME_PATTERN.matcher(lower);
            if (iso.matches()) {
View Full Code Here

      // UnsupportedEncodingException is thrown by 'getBytes' method. Declared
      // encoding is UTF-8 and since support of this type of encoding is mandatory
      // for any Java Runtime Environment implementation, this exception will
      // never be thrown. If so, it becomes runtime exception where recovery from
      // it is impossible. It's just JVM problem.
      throw new IllegalCharsetNameException(KEY_ENCODING);
    }
   
    return sResult;
  }
View Full Code Here

      // UnsupportedEncodingException is thrown by 'getBytes' method. Declared
      // encoding is UTF-8 and since support of this type of encoding is mandatory
      // for any Java Runtime Environment implementation, this exception will
      // never be thrown. If so, it becomes runtime exception where recovery from
      // it is impossible. It's just JVM problem.
      throw new IllegalCharsetNameException(KEY_ENCODING);
    }
   
    return sb.toString();
  }
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.