harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r412914 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501: AttributeTypeAndValue.java AttributeValue.java
Date Fri, 09 Jun 2006 03:48:33 GMT
Author: smishura
Date: Thu Jun  8 20:48:33 2006
New Revision: 412914

URL: http://svn.apache.org/viewvc?rev=412914&view=rev
Log:
Use DirectoryString decoder

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeValue.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java?rev=412914&r1=412913&r2=412914&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java
Thu Jun  8 20:48:33 2006
@@ -392,24 +392,11 @@
 
             // FIXME what about constr???
             String str = null;
-
-            switch (in.tag) {
-            case ASN1Constants.TAG_TELETEXSTRING:
-                str = (String) ASN1StringType.TELETEXSTRING.decode(in);
-                break;
-            case ASN1Constants.TAG_PRINTABLESTRING:
-                str = (String) ASN1StringType.PRINTABLESTRING.decode(in);
-                break;
-            case ASN1Constants.TAG_UNIVERSALSTRING:
-                str = (String) ASN1StringType.UNIVERSALSTRING.decode(in);
-                break;
-            case ASN1Constants.TAG_UTF8STRING:
-                str = (String) ASN1StringType.UTF8STRING.decode(in);
-                break;
-            case ASN1Constants.TAG_BMPSTRING:
-                str = (String) ASN1StringType.BMPSTRING.decode(in);
-                break;
-            default:
+            if (DirectoryString.ASN1.checkTag(in.tag)) {
+                // has string representation
+                str = (String) DirectoryString.ASN1.decode(in);
+            } else {
+                // gets octets only
                 in.readContent();
             }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeValue.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeValue.java?rev=412914&r1=412913&r2=412914&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeValue.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeValue.java
Thu Jun  8 20:48:33 2006
@@ -23,9 +23,7 @@
 
 import java.io.IOException;
 
-import org.apache.harmony.security.asn1.ASN1Constants;
 import org.apache.harmony.security.asn1.ASN1StringType;
-import org.apache.harmony.security.asn1.ASN1Type;
 import org.apache.harmony.security.asn1.DerInputStream;
 import org.apache.harmony.security.x509.Utils;
 
@@ -68,34 +66,12 @@
 
         try {
             DerInputStream in = new DerInputStream(encoded);
-            ASN1Type decoder = null;
-            switch (in.tag) {
-            case ASN1Constants.TAG_TELETEXSTRING:
-                decoder = ASN1StringType.TELETEXSTRING;
-                break;
-            case ASN1Constants.TAG_PRINTABLESTRING:
-                decoder = ASN1StringType.PRINTABLESTRING;
-                break;
-            case ASN1Constants.TAG_UNIVERSALSTRING:
-                decoder = ASN1StringType.UNIVERSALSTRING;
-                break;
-            case ASN1Constants.TAG_UTF8STRING:
-                decoder = ASN1StringType.UTF8STRING;
-                break;
-            case ASN1Constants.TAG_BMPSTRING:
-                decoder = ASN1StringType.BMPSTRING;
-                break;
-            }
-
-            if (in.getEndOffset() != encoded.length) {
-                // length of parsed hexString is greater than encoded length
-                throw new IllegalArgumentException();//FIXME message
-            }
 
             tag = in.tag;
 
-            if (decoder != null) {
-                this.rawString = (String) decoder.decode(in);
+            if (DirectoryString.ASN1.checkTag(tag)) {
+                // has string representation
+                this.rawString = (String) DirectoryString.ASN1.decode(in);
                 this.escapedString = makeEscaped(rawString);
             } else {
                 this.rawString = hexString;



Mime
View raw message