harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r500954 - in /harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common: javax/security/auth/kerberos/KerberosPrincipal.java org/apache/harmony/auth/internal/kerberos/v5/PrincipalName.java
Date Mon, 29 Jan 2007 07:13:48 GMT
Author: smishura
Date: Sun Jan 28 23:13:47 2007
New Revision: 500954

URL: http://svn.apache.org/viewvc?view=rev&rev=500954
Log:
PrincipalName: change encoder's access from public to package

Modified:
    harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosPrincipal.java
    harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/internal/kerberos/v5/PrincipalName.java

Modified: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosPrincipal.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosPrincipal.java?view=diff&rev=500954&r1=500953&r2=500954
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosPrincipal.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosPrincipal.java
Sun Jan 28 23:13:47 2007
@@ -145,7 +145,7 @@
 
         s.defaultReadObject();
 
-        PrincipalName principalName = (PrincipalName) PrincipalName.ASN1.decode((byte[])
s
+        PrincipalName principalName = PrincipalName.instanceOf((byte[]) s
                 .readObject());
         realm = (String) ASN1StringType.GENERALSTRING.decode((byte[]) s.readObject());
 
@@ -189,10 +189,7 @@
             }
         }
 
-        byte[] enc = PrincipalName.ASN1.encode(new PrincipalName(type, nameString));
-        s.writeObject(enc);
-
-        enc = ASN1StringType.GENERALSTRING.encode(realm);
-        s.writeObject(enc);
+        s.writeObject(new PrincipalName(type, nameString).getEncoded());
+        s.writeObject(ASN1StringType.GENERALSTRING.encode(realm));
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/internal/kerberos/v5/PrincipalName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/internal/kerberos/v5/PrincipalName.java?view=diff&rev=500954&r1=500953&r2=500954
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/internal/kerberos/v5/PrincipalName.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/internal/kerberos/v5/PrincipalName.java
Sun Jan 28 23:13:47 2007
@@ -72,6 +72,10 @@
         return name;
     }
 
+    public byte[] getEncoded() {
+        return ASN1.encode(this);
+    }
+
     @Override
     public boolean equals(Object obj) {
         if (this == obj) {
@@ -87,6 +91,10 @@
         return type == that.type && Arrays.equals(that.name, name);
     }
 
+    public static PrincipalName instanceOf(byte[] enc) throws IOException {
+        return (PrincipalName) ASN1.decode(enc);
+    }
+    
     @Override
     public int hashCode() {
         return type + Arrays.hashCode(name);
@@ -107,11 +115,11 @@
         return buf.toString();
     }
 
-    /**
-     * PrincipalName ::= SEQUENCE { name-type [0] Int32, name-string [1]
-     * SEQUENCE OF KerberosString }
-     */
-    public static final ASN1Sequence ASN1 = new ASN1Sequence(new ASN1Type[] {
+    // PrincipalName ::= SEQUENCE {
+    //     name-type   [0] Int32,
+    //     name-string [1] SEQUENCE OF KerberosString
+    // }
+    static final ASN1Sequence ASN1 = new ASN1Sequence(new ASN1Type[] {
             new ASN1Explicit(0, ASN1Integer.getInstance()),
             new ASN1Explicit(1, new ASN1SequenceOf(ASN1StringType.GENERALSTRING)), }) {
 



Mime
View raw message