*/
package jp.bitmeister.asn1.type;
+import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.regex.Pattern;
import jp.bitmeister.asn1.exception.ASN1IllegalArgument;
+import jp.bitmeister.asn1.exception.ASN1RuntimeException;
import jp.bitmeister.asn1.processor.ASN1Visitor;
import jp.bitmeister.asn1.type.builtin.OCTET_STRING;
*/
public void set(String value) {
checkCharacters(value);
- set(value.getBytes(charset()));
+ try {
+ set(value.getBytes(charset().displayName()));
+ } catch (UnsupportedEncodingException e) {
+ ASN1RuntimeException ex = new ASN1RuntimeException();
+ ex.setMessage("Character set unsupported.", e, getClass(), null, this);
+ throw ex;
+ }
}
/**
* @return The string value assigned to this instance.
*/
public String stringValue() {
- return new String(value(), charset());
+ try {
+ return new String(value(), charset().displayName());
+ } catch (UnsupportedEncodingException e) {
+ ASN1RuntimeException ex = new ASN1RuntimeException();
+ ex.setMessage("Character set unsupported.", e, getClass(), null, this);
+ throw ex;
+ }
}
/**