harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r450032 [4/6] - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java: common/java/security/ common/java/security/cert/ common/java/security/spec/ common/javax/security/cert/ common/org/apache/harmony/security/ common...
Date Tue, 26 Sep 2006 12:46:21 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1BitString.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1BitString.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1BitString.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1BitString.java Tue Sep 26 05:46:11 2006
@@ -23,6 +23,8 @@
 
 import java.io.IOException;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 /**
  * This class represents ASN.1 Bitstring type.
  * 
@@ -161,7 +163,7 @@
             } else {
                 if (bitsNumber > maxBits) {
                     throw new ASN1Exception(
-                            "ASN.1 Named Bitstring: size contstrains"); //FIXME message
+                            Messages.getString("security.97")); //FIXME message //$NON-NLS-1$
                 }
                 value = new boolean[maxBits];
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java Tue Sep 26 05:46:11 2006
@@ -26,6 +26,8 @@
 import java.util.Iterator;
 import java.util.TreeMap;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 
 /**
  * This abstract class represents ASN.1 Choice type.
@@ -227,9 +229,8 @@
         super(TAG_CHOICE); // has not tag number
 
         if (type.length == 0) {
-            throw new IllegalArgumentException("ASN.1 choice type: "
-                    + getClass().getName()
-                    + " MUST have at least one alternative");
+            throw new IllegalArgumentException(Messages.getString("security.10E", //$NON-NLS-1$
+                    getClass().getName()));
         }
 
         // create map of all identifiers
@@ -241,9 +242,8 @@
             if (t instanceof ASN1Any) {
                 // ASN.1 ANY is not allowed,
                 // even it is a single component (not good for nested choices)
-                throw new IllegalArgumentException("ASN.1 choice type: "
-                        + getClass().getName() // FIXME name
-                        + " MUST have alternatives with distinct tags");
+                throw new IllegalArgumentException(Messages.getString("security.10F", //$NON-NLS-1$
+                        getClass().getName())); // FIXME name
             } else if (t instanceof ASN1Choice) {
 
                 // add all choice's identifiers
@@ -281,9 +281,8 @@
 
     private void addIdentifier(TreeMap map, int identifier, int index){
         if (map.put(BigInteger.valueOf(identifier), BigInteger.valueOf(index)) != null) {
-            throw new IllegalArgumentException("ASN.1 choice type: "
-                    + getClass().getName() // FIXME name
-                    + " MUST have alternatives with distinct tags");
+            throw new IllegalArgumentException(Messages.getString("security.10F", //$NON-NLS-1$
+                    getClass().getName())); // FIXME name
         }
     }
     
@@ -309,9 +308,8 @@
 
         int index = Arrays.binarySearch(identifiers[0], in.tag);
         if (index < 0) {
-            throw new ASN1Exception("Failed to decode ASN.1 choice type. " // FIXME
-                                                                            // message
-                    + " No alternatives were found for " + getClass().getName());
+            throw new ASN1Exception(Messages.getString("security.110", //$NON-NLS-1$
+                    getClass().getName()));// FIXME message
         }
 
         index = identifiers[1][index];

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Explicit.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Explicit.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Explicit.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Explicit.java Tue Sep 26 05:46:11 2006
@@ -23,6 +23,8 @@
 
 import java.io.IOException;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 
 /**
  * This class represents explicitly tagged ASN.1 type.
@@ -72,11 +74,9 @@
     public Object decode(BerInputStream in) throws IOException {
         if (constrId != in.tag) {
             throw new ASN1Exception(
-                    "ASN.1 explicitly tagged type is expected at ["
-                            + in.tagOffset + "]. Expected tag: "
-                            + Integer.toHexString(constrId)
-                            + ", but encountered tag "
-                            + Integer.toHexString(in.tag));
+                    Messages.getString("security.13F", //$NON-NLS-1$
+                    new Object[] { in.tagOffset, Integer.toHexString(constrId),
+                            Integer.toHexString(in.tag) }));
         }
         in.next();
 
@@ -104,6 +104,6 @@
 
     public String toString() {
         //FIXME fix performance
-        return super.toString() + " for type " + type;
+        return super.toString() + " for type " + type; //$NON-NLS-1$
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1GeneralizedTime.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1GeneralizedTime.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1GeneralizedTime.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1GeneralizedTime.java Tue Sep 26 05:46:11 2006
@@ -95,12 +95,12 @@
     // four digit year, seconds always presented
     // and fractional-secons elements without
     // trailing 0's (must be cut later from content)
-    private final static String GEN_PATTERN = "yyyyMMddHHmmss.S";
+    private final static String GEN_PATTERN = "yyyyMMddHHmmss.S"; //$NON-NLS-1$
 
     public void setEncodingContent(BerOutputStream out) {
 
         SimpleDateFormat sdf = new SimpleDateFormat(GEN_PATTERN);
-        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+        sdf.setTimeZone(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$
         String temp = sdf.format(out.content);
         // cut off trailing 0s
         int nullId;
@@ -113,7 +113,7 @@
         if (temp.charAt(currLength) == '.') {
             temp = temp.substring(0, currLength);
         }
-        out.content = (temp + "Z").getBytes();
+        out.content = (temp + "Z").getBytes(); //$NON-NLS-1$
         out.length = ((byte[]) out.content).length;
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Implicit.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Implicit.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Implicit.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Implicit.java Tue Sep 26 05:46:11 2006
@@ -23,6 +23,8 @@
 
 import java.io.IOException;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 
 /**
  * Implicitly tagged ASN.1 type.
@@ -78,7 +80,7 @@
             // defined by "Type" is an untagged choice type or an 
             // untagged open type'
             throw new IllegalArgumentException(
-                    "Implicit tagging can not be used for ASN.1 ANY or CHOICE type");
+                    Messages.getString("security.9F")); //$NON-NLS-1$
         }
 
         this.type = type;
@@ -124,12 +126,9 @@
     public Object decode(BerInputStream in) throws IOException {
         if (!checkTag(in.tag)) {
             // FIXME need look for tagging type
-            throw new ASN1Exception(
-                    "ASN.1 implicitly tagged type is expected at ["
-                            + in.tagOffset + "]. Expected tag: "
-                            + Integer.toHexString(id)
-                            + ", but encountered tag "
-                            + Integer.toHexString(in.tag));
+            throw new ASN1Exception(Messages.getString("security.100", //$NON-NLS-1$
+                    new Object[] { in.tagOffset, Integer.toHexString(id),
+                            Integer.toHexString(in.tag) }));
         }
 
         // substitute indentifier for further decoding

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1OpenType.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1OpenType.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1OpenType.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1OpenType.java Tue Sep 26 05:46:11 2006
@@ -48,7 +48,7 @@
 
         int[] oid = (int[]) in.get(key);
         if (oid == null) {
-            throw new RuntimeException("");//FIXME message & type
+            throw new RuntimeException("");//FIXME message & type //$NON-NLS-1$
         }
 
         AttributeType attr = (AttributeType) pool.get(oid);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java Tue Sep 26 05:46:11 2006
@@ -63,13 +63,13 @@
             TAG_UTF8STRING) {
 
         public Object getDecodedObject(BerInputStream in) throws IOException {
-            return new String(in.buffer, in.contentOffset, in.length, "UTF-8");
+            return new String(in.buffer, in.contentOffset, in.length, "UTF-8"); //$NON-NLS-1$
         }
 
         public void setEncodingContent(BerOutputStream out) {
 
             try {
-                byte[] bytes = ((String) out.content).getBytes("UTF-8");
+                byte[] bytes = ((String) out.content).getBytes("UTF-8"); //$NON-NLS-1$
                 out.content = bytes;
                 out.length = bytes.length;
             } catch (UnsupportedEncodingException e) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Time.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Time.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Time.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Time.java Tue Sep 26 05:46:11 2006
@@ -48,7 +48,7 @@
         
         // TODO optimize me:
         // It makes sense use calendar instance instead of times array
-        GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
+        GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
         
         c.set(Calendar.YEAR, in.times[0]);
         c.set(Calendar.MONTH, in.times[1]-1);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Type.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Type.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Type.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Type.java Tue Sep 26 05:46:11 2006
@@ -24,6 +24,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 
 /**
  * This abstract class is the super class for all ASN.1 types
@@ -65,13 +67,13 @@
     public ASN1Type(int tagClass, int tagNumber) {
 
         if (tagNumber < 0) {
-            throw new IllegalArgumentException("Negative tag number");
+            throw new IllegalArgumentException(Messages.getString("security.102")); //$NON-NLS-1$
         }
 
         if (tagClass != CLASS_UNIVERSAL && tagClass != CLASS_APPLICATION
                 && tagClass != CLASS_CONTEXTSPECIFIC
                 && tagClass != CLASS_PRIVATE) {
-            throw new IllegalArgumentException("Wrong tag class");
+            throw new IllegalArgumentException(Messages.getString("security.103")); //$NON-NLS-1$
         }
 
         if (tagNumber < 31) {
@@ -80,7 +82,7 @@
         } else {
             // long form
             throw new IllegalArgumentException(
-                    "Tag long form is not implemented");
+                    Messages.getString("security.104")); //$NON-NLS-1$
         }
         this.constrId = this.id + PC_CONSTRUCTED;
     }
@@ -205,7 +207,7 @@
     public String toString() {
         // TODO decide whether this method is necessary
         //FIXME fix performance
-        return this.getClass().getName() + "(tag: 0x"
-                + Integer.toHexString(0xff & this.id) + ")";
+        return this.getClass().getName() + "(tag: 0x" //$NON-NLS-1$
+                + Integer.toHexString(0xff & this.id) + ")"; //$NON-NLS-1$
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1TypeCollection.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1TypeCollection.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1TypeCollection.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1TypeCollection.java Tue Sep 26 05:46:11 2006
@@ -21,6 +21,8 @@
 
 package org.apache.harmony.security.asn1;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 
 /**
  * This abstract class represents ASN.1 type that is a collection of ASN.1 types.
@@ -90,7 +92,6 @@
      * @param values - an array to store an object's values to be encoded
      */
     protected void getValues(Object object, Object[] values) {
-        throw new RuntimeException("ASN.1 type:" + getClass().getName()
-                + " is not designed to be encoded");
+        throw new RuntimeException(Messages.getString("security.101", getClass().getName())); //$NON-NLS-1$
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1UTCTime.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1UTCTime.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1UTCTime.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1UTCTime.java Tue Sep 26 05:46:11 2006
@@ -112,11 +112,11 @@
     // According to X.680 coordinated universal time format:
     // two digit year, seconds always presented,
     // no fractional-secons elements, 'Z' at the end
-    private final static String UTC_PATTERN = "yyMMddHHmmss'Z'";
+    private final static String UTC_PATTERN = "yyMMddHHmmss'Z'"; //$NON-NLS-1$
 
     public void setEncodingContent(BerOutputStream out) {
         SimpleDateFormat sdf = new SimpleDateFormat(UTC_PATTERN);
-        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+        sdf.setTimeZone(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$
         out.content = sdf.format(out.content).getBytes();
         out.length = ((byte[]) out.content).length;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java Tue Sep 26 05:46:11 2006
@@ -26,6 +26,8 @@
 import java.util.ArrayList;
 import java.util.Calendar;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 
 /**
  * Decodes ASN.1 types encoded with BER (X.690)
@@ -96,7 +98,7 @@
         // compare expected and decoded length
         if (length != INDEFINIT_LENGTH
                 && (offset + expectedLength) != (this.offset + this.length)) {
-            throw new ASN1Exception("Wrong content length");
+            throw new ASN1Exception(Messages.getString("security.111")); //$NON-NLS-1$
         }
     }
 
@@ -136,8 +138,7 @@
             }
         } else {
             isIndefinedLength = true;
-            throw new ASN1Exception("Decoding indefined length encoding"
-                    + " is not provided");
+            throw new ASN1Exception(Messages.getString("security.112")); //$NON-NLS-1$
         }
     }
 
@@ -200,8 +201,8 @@
                 int numOctets = length & 0x7F;
 
                 if (numOctets > 5) {
-                    throw new ASN1Exception("Too long encoding at ["
-                            + tagOffset + "]"); //FIXME message
+                    throw new ASN1Exception(Messages.getString("security.113", //$NON-NLS-1$
+                            tagOffset)); //FIXME message
                 }
 
                 // collect this value length
@@ -212,8 +213,8 @@
                 }
 
                 if (length > 0xFFFFFF) {
-                    throw new ASN1Exception("Too long encoding at ["
-                            + tagOffset + "]"); //FIXME message
+                    throw new ASN1Exception(Messages.getString("security.113", //$NON-NLS-1$
+                            tagOffset)); //FIXME message
                 }
             }
         } else { //indefinite form
@@ -254,32 +255,28 @@
 
             if (length == 0) {
                 throw new ASN1Exception(
-                        "ASN.1 Bitstring: wrong length. Tag at [" + tagOffset
-                                + "]");
+                        Messages.getString("security.114", tagOffset)); //$NON-NLS-1$
             }
 
             readContent();
 
             // content: check unused bits
             if (buffer[contentOffset] > 7) {
-                throw new ASN1Exception("ASN.1 Bitstring: wrong content at ["
-                        + contentOffset
-                        + "]. A number of unused bits MUST be in range 0 to 7");
+                throw new ASN1Exception(Messages.getString("security.115", //$NON-NLS-1$
+                        contentOffset));
             }
 
             if (length == 1 && buffer[contentOffset] != 0) {
-                throw new ASN1Exception("ASN.1 Bitstring: wrong content at ["
-                        + contentOffset
-                        + "]. For empty string unused bits MUST be 0");
+                throw new ASN1Exception(Messages.getString("security.116", //$NON-NLS-1$
+                        contentOffset));
             }
 
         } else if (tag == ASN1Constants.TAG_C_BITSTRING) {
-            throw new ASN1Exception("Decoding constructed ASN.1 bitstring "
-                    + " type is not provided");
+            throw new ASN1Exception(Messages.getString("security.117")); //$NON-NLS-1$
         } else {
             throw new ASN1Exception(
-                    "ASN.1 bitstring identifier is expected at [" + tagOffset
-                            + "], but encountered: " + Integer.toHexString(tag));
+                    Messages.getString("security.118", tagOffset, //$NON-NLS-1$
+                            Integer.toHexString(tag)));
         }
     }
 
@@ -292,8 +289,8 @@
 
         if (tag != ASN1Constants.TAG_ENUM) {
             throw new ASN1Exception(
-                    "ASN.1 enumerated identifier is expected at [" + tagOffset
-                            + "], but encountered: " + Integer.toHexString(tag));
+                    Messages.getString("security.119", tagOffset, //$NON-NLS-1$
+                            Integer.toHexString(tag)));
         }
 
         //
@@ -302,9 +299,7 @@
 
         // check encoded length
         if (length == 0) {
-            throw new ASN1Exception(
-                    "ASN.1 enumerated: wrong length for identifier at ["
-                            + tagOffset + ']');
+            throw new ASN1Exception(Messages.getString("security.11A", tagOffset));//$NON-NLS-1$
         }
 
         readContent();
@@ -318,10 +313,7 @@
             }
 
             if (bits == 0 || bits == 0x1FF) {
-                throw new ASN1Exception(
-                        "ASN.1 enumerated: wrong content at ["
-                                + contentOffset
-                                + "]. An integer MUST be encoded in minimum number of octets");
+                throw new ASN1Exception(Messages.getString("security.11B", contentOffset)); //$NON-NLS-1$
             }
         }
     }
@@ -334,15 +326,13 @@
     public void readBoolean() throws IOException {
 
         if (tag != ASN1Constants.TAG_BOOLEAN) {
-            throw new ASN1Exception("ASN.1 boolean identifier is expected at ["
-                    + tagOffset + "], but encountered: "
-                    + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.11C", //$NON-NLS-1$
+                    tagOffset, Integer.toHexString(tag)));
         }
 
         // check encoded length
         if (length != 1) {
-            throw new ASN1Exception("Wrong length for ASN.1 boolean at ["
-                    + tagOffset + "]");
+            throw new ASN1Exception(Messages.getString("security.11D", tagOffset));//$NON-NLS-1$
         }
 
         readContent();
@@ -375,17 +365,15 @@
             // check syntax: the last char MUST be Z
             if (buffer[offset - 1] != 'Z') {
                 // FIXME support only format that is acceptable for DER
-                throw new ASN1Exception(
-                        "ASN.1 GeneralizedTime: encoded format is not implemented");
+                throw new ASN1Exception(Messages.getString("security.11E")); //$NON-NLS-1$
             }
 
             // check syntax: MUST be YYYYMMDDHHMMSS[(./,)DDD]'Z'
             if (length != 15 && (length < 17 || length > 19)) // invalid
                                                                 // length
             {
-                throw new ASN1Exception(
-                        "ASN.1 GeneralizedTime wrongly encoded at ["
-                                + contentOffset + ']');
+                throw new ASN1Exception(Messages.getString("security.11F", //$NON-NLS-1$
+                                contentOffset));
             }
 
             // check content: milliseconds
@@ -393,8 +381,8 @@
                 byte char14 = buffer[contentOffset + 14];
                 if (char14 != '.' && char14 != ',') {
                     throw new ASN1Exception(
-                            "ASN.1 GeneralizedTime wrongly encoded at ["
-                                    + contentOffset + ']');
+                            Messages.getString("security.11F", //$NON-NLS-1$
+                                    contentOffset));
                 }
             }
 
@@ -421,15 +409,11 @@
 
             // FIXME check all values for valid numbers!!!
         } else if (tag == ASN1Constants.TAG_C_GENERALIZEDTIME) {
-            throw new ASN1Exception(
-                    "Decoding constructed ASN.1 GeneralizedTime"
-                            + " type is not provided");
+            throw new ASN1Exception(Messages.getString("security.120")); //$NON-NLS-1$
 
         } else {
-            throw new ASN1Exception(
-                    "ASN.1 GeneralizedTime identifier is expected at ["
-                            + tagOffset + "], but encountered: "
-                            + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.121", //$NON-NLS-1$
+                            tagOffset, Integer.toHexString(tag)));
         }
     }
 
@@ -449,12 +433,10 @@
             case ASN1UTCTime.UTC_LOCAL_HM:
             case ASN1UTCTime.UTC_LOCAL_HMS:
                 // FIXME only coordinated universal time formats are supported
-                throw new ASN1Exception(
-                        "ASN.1 UTCTime: local time format is not supported.");
+                throw new ASN1Exception(Messages.getString("security.122")); //$NON-NLS-1$
             default:
-                throw new ASN1Exception(
-                        "ASN.1 UTCTime: wrong length, identifier at ["
-                                + tagOffset + ']');
+                throw new ASN1Exception(Messages.getString("security.123", //$NON-NLS-1$
+                                tagOffset));
             }
 
             // FIXME: any other optimizations?
@@ -465,7 +447,7 @@
 
             // check syntax: the last char MUST be Z
             if (buffer[offset - 1] != 'Z') {
-                throw new ASN1Exception("ASN.1 UTCTime wrongly encoded at ["
+                throw new ASN1Exception("ASN.1 UTCTime wrongly encoded at [" //$NON-NLS-1$
                         + contentOffset + ']');
             }
 
@@ -491,12 +473,10 @@
 
             // FIXME check all time values for valid numbers!!!
         } else if (tag == ASN1Constants.TAG_C_UTCTIME) {
-            throw new ASN1Exception("Decoding constructed ASN.1 UTCTime"
-                    + " type is not provided");
+            throw new ASN1Exception(Messages.getString("security.124")); //$NON-NLS-1$
         } else {
-            throw new ASN1Exception("ASN.1 UTCTime identifier is expected at ["
-                    + tagOffset + "], but encountered: "
-                    + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.125", //$NON-NLS-1$
+                    tagOffset, Integer.toHexString(tag)));
         }
     }
 
@@ -510,7 +490,7 @@
         for (int i = off, end = off + count; i < end; i++) {
             c = buffer[i] - 48;
             if (c < 0 || c > 9) {
-                throw new ASN1Exception("Time encoding has invalid char");
+                throw new ASN1Exception(Messages.getString("security.126")); //$NON-NLS-1$
             }
             result = result * 10 + c;
         }
@@ -525,15 +505,14 @@
     public void readInteger() throws IOException {
 
         if (tag != ASN1Constants.TAG_INTEGER) {
-            throw new ASN1Exception("ASN.1 integer identifier is expected at ["
-                    + tagOffset + "], but encountered: "
-                    + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.127", //$NON-NLS-1$
+                    tagOffset, Integer.toHexString(tag)));
         }
 
         // check encoded length
         if (length < 1) {
-            throw new ASN1Exception("Wrong length for ASN.1 integer at ["
-                    + tagOffset + "]");
+            throw new ASN1Exception(Messages.getString("security.128", //$NON-NLS-1$
+                    tagOffset)); //$NON-NLS-1$
         }
 
         readContent();
@@ -546,10 +525,8 @@
 
             if (firstByte == 0 && secondByte == 0 || firstByte == (byte) 0xFF
                     && secondByte == (byte) 0x80) {
-                throw new ASN1Exception(
-                        "Wrong content for ASN.1 integer at ["
-                                + (offset - length)
-                                + "]. An integer MUST be encoded in minimum number of octets");
+                throw new ASN1Exception(Messages.getString("security.129", //$NON-NLS-1$
+                                (offset - length)));
             }
         }
     }
@@ -564,12 +541,11 @@
         if (tag == ASN1Constants.TAG_OCTETSTRING) {
             readContent();
         } else if (tag == ASN1Constants.TAG_C_OCTETSTRING) {
-            throw new ASN1Exception("Decoding constructed ASN.1 octet string "
-                    + " type is not provided");
+            throw new ASN1Exception(Messages.getString("security.12A")); //$NON-NLS-1$
         } else {
             throw new ASN1Exception(
-                    "ASN.1 octetstring identifier is expected at [" + tagOffset
-                            + "], but encountered: " + Integer.toHexString(tag));
+                    Messages.getString("security.12B", tagOffset, //$NON-NLS-1$
+                            Integer.toHexString(tag)));
         }
     }
 
@@ -584,23 +560,20 @@
     public void readOID() throws IOException {
 
         if (tag != ASN1Constants.TAG_OID) {
-            throw new ASN1Exception("ASN.1 OID identifier is expected at ["
-                    + tagOffset + "], but encountered: "
-                    + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.12C", //$NON-NLS-1$
+                    tagOffset, Integer.toHexString(tag)));
         }
 
         // check encoded length
         if (length < 1) {
-            throw new ASN1Exception(
-                    "Wrong length for ASN.1 object identifier at [" + tagOffset
-                            + "]");
+            throw new ASN1Exception(Messages.getString("security.12D", tagOffset)); //$NON-NLS-1$
         }
 
         readContent();
 
         // check content: last encoded byte (8th bit MUST be zero)
         if ((buffer[offset - 1] & 0x80) != 0) {
-            throw new ASN1Exception("Wrong encoding at [" + (offset - 1) + "]");
+            throw new ASN1Exception(Messages.getString("security.12E", (offset - 1))); //$NON-NLS-1$
         }
 
         oidElement = 1;
@@ -633,8 +606,8 @@
 
         if (tag != ASN1Constants.TAG_C_SEQUENCE) {
             throw new ASN1Exception(
-                    "ASN.1 sequence identifier is expected at [" + tagOffset
-                            + "], but encountered: " + Integer.toHexString(tag));
+                    Messages.getString("security.12F", tagOffset, //$NON-NLS-1$
+                            Integer.toHexString(tag)));
         }
 
         int begOffset = offset;
@@ -652,9 +625,8 @@
                 while (!type[i].checkTag(tag)) {
                     // check whether it is optional component or not 
                     if (!sequence.OPTIONAL[i] || (i == type.length - 1)) {
-                        throw new ASN1Exception(
-                                "ASN.1 Sequence: mandatory value is missing at ["
-                                        + tagOffset + "]");
+                        throw new ASN1Exception(Messages.getString("security.130", //$NON-NLS-1$
+                                        tagOffset));
                     }
                     i++;
                 }
@@ -665,8 +637,8 @@
             // check the rest of components
             for (; i < type.length; i++) {
                 if (!sequence.OPTIONAL[i]) {
-                    throw new ASN1Exception("Mandatory value is missing at ["
-                            + tagOffset + "]");
+                    throw new ASN1Exception(Messages.getString("security.131", //$NON-NLS-1$
+                            tagOffset));
                 }
             }
 
@@ -681,9 +653,8 @@
                 while (!type[i].checkTag(tag)) {
                     // check whether it is optional component or not 
                     if (!sequence.OPTIONAL[i] || (i == type.length - 1)) {
-                        throw new ASN1Exception(
-                                "ASN.1 Sequence: mandatory value is missing at ["
-                                        + tagOffset + "]");
+                        throw new ASN1Exception(Messages.getString("security.132", //$NON-NLS-1$
+                                        tagOffset));
                     }
 
                     // sets default value
@@ -698,8 +669,8 @@
             // check the rest of components
             for (; i < type.length; i++) {
                 if (!sequence.OPTIONAL[i]) {
-                    throw new ASN1Exception("Mandatory value is missing at ["
-                            + tagOffset + "]");
+                    throw new ASN1Exception(Messages.getString("security.133", //$NON-NLS-1$
+                            tagOffset));
                 }
                 if (sequence.DEFAULT[i] != null) {
                     values[i] = sequence.DEFAULT[i];
@@ -711,8 +682,7 @@
         }
 
         if (offset != endOffset) {
-            throw new ASN1Exception("Wrong encoding at [" + begOffset
-                    + "]. Content's length and encoded length are not the same");
+            throw new ASN1Exception(Messages.getString("security.134", begOffset)); //$NON-NLS-1$
         }
     }
 
@@ -725,9 +695,8 @@
     public void readSequenceOf(ASN1SequenceOf sequenceOf) throws IOException {
         
         if (tag != ASN1Constants.TAG_C_SEQUENCEOF) {
-            throw new ASN1Exception(
-                    "ASN.1 sequenceOf identifier is expected at [" + tagOffset
-                            + "], but encountered: " + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.135", tagOffset, //$NON-NLS-1$
+                            Integer.toHexString(tag)));
         }
 
         decodeValueCollection(sequenceOf);
@@ -742,12 +711,11 @@
     public void readSet(ASN1Set set) throws IOException {
         
         if (tag != ASN1Constants.TAG_C_SET) {
-            throw new ASN1Exception("ASN.1 set identifier is expected at ["
-                    + tagOffset + "], but encountered: "
-                    + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.136", //$NON-NLS-1$
+                    tagOffset, Integer.toHexString(tag)));
         }
 
-        throw new ASN1Exception("Decoding ASN.1 Set type is not provided");
+        throw new ASN1Exception(Messages.getString("security.137")); //$NON-NLS-1$
     }
 
     /**
@@ -759,9 +727,8 @@
     public void readSetOf(ASN1SetOf setOf) throws IOException {
         
         if (tag != ASN1Constants.TAG_C_SETOF) {
-            throw new ASN1Exception("ASN.1 setOf identifier is expected at ["
-                    + tagOffset + "], but encountered: "
-                    + Integer.toHexString(tag));
+            throw new ASN1Exception(Messages.getString("security.138", //$NON-NLS-1$
+                    tagOffset, Integer.toHexString(tag)));
         }
 
         decodeValueCollection(setOf);
@@ -796,8 +763,7 @@
         }
 
         if (offset != endOffset) {
-            throw new ASN1Exception("Wrong encoding at [" + begOffset
-                    + "]. Content's length and encoded length are not the same");
+            throw new ASN1Exception(Messages.getString("security.134", begOffset)); //$NON-NLS-1$
         }
     }
 
@@ -812,12 +778,11 @@
         if (tag == type.id) {
             readContent();
         } else if (tag == type.constrId) {
-            throw new ASN1Exception("Decoding constructed ASN.1 string "
-                    + " type is not provided");
+            throw new ASN1Exception(Messages.getString("security.139")); //$NON-NLS-1$
         } else {
             throw new ASN1Exception(
-                    "ASN.1 string type identifier is expected at [" + tagOffset
-                            + "], but encountered: " + Integer.toHexString(tag));
+                    Messages.getString("security.13A", tagOffset, //$NON-NLS-1$
+                            Integer.toHexString(tag)));
         }
     }
 
@@ -919,7 +884,7 @@
     protected int read() throws IOException {
 
         if (offset == buffer.length) {
-            throw new ASN1Exception("Unexpected end of encoding");
+            throw new ASN1Exception(Messages.getString("security.13B")); //$NON-NLS-1$
         }
 
         if (in == null) {
@@ -927,7 +892,7 @@
         } else {
             int octet = in.read();
             if (octet == -1) {
-                throw new ASN1Exception("Unexpected end of encoding");
+                throw new ASN1Exception(Messages.getString("security.13B")); //$NON-NLS-1$
             }
             
             buffer[offset++] = (byte) octet;
@@ -944,14 +909,14 @@
      */
     public void readContent() throws IOException {
         if (offset + length > buffer.length) {
-            throw new ASN1Exception("Unexpected end of encoding");
+            throw new ASN1Exception(Messages.getString("security.13B")); //$NON-NLS-1$
         }
 
         if (in == null) {
             offset += length;
         } else {
             if (in.read(buffer, offset, length) != length) {
-                throw new ASN1Exception("Failed to read encoded content");
+                throw new ASN1Exception(Messages.getString("security.13C")); //$NON-NLS-1$
             }
             offset += length;
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BitString.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BitString.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BitString.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BitString.java Tue Sep 26 05:46:11 2006
@@ -21,6 +21,8 @@
 
 package org.apache.harmony.security.asn1;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 /**
  * Represents ASN.1 bit string value
  * 
@@ -58,12 +60,12 @@
         // constraints are set according X.690
         if (unusedBits < 0 || unusedBits > 7) {
             throw new IllegalArgumentException(
-                    "Number of unused bits MUST be in range 0-7");
+                    Messages.getString("security.13D")); //$NON-NLS-1$
         }
 
         if (bytes.length == 0 && unusedBits != 0) {
             throw new IllegalArgumentException(
-                    "For empty bit string unused bits MUST be 0");
+                    Messages.getString("security.13E")); //$NON-NLS-1$
         }
 
         this.bytes = bytes;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java Tue Sep 26 05:46:11 2006
@@ -24,6 +24,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 /**
  * Decodes ASN.1 types encoded with DER (X.690)
  * 
@@ -53,8 +55,7 @@
         int tag = super.next();
 
         if (length == INDEFINIT_LENGTH) {
-            throw new ASN1Exception(
-                    "DER: only definite length encoding MUST be used");
+            throw new ASN1Exception(Messages.getString("security.105")); //$NON-NLS-1$
         }
 
         // FIXME add check: length encoding uses minimum number of octets
@@ -73,9 +74,7 @@
     public void readBitString() throws IOException {
 
         if (tag == ASN1Constants.TAG_C_BITSTRING) {
-            throw new ASN1Exception(
-                    "ASN.1 bitstring: constructed identifier at [" + tagOffset
-                            + "]. Not valid for DER.");
+            throw new ASN1Exception(Messages.getString("security.106", tagOffset)); //$NON-NLS-1$
         }
 
         super.readBitString();
@@ -84,9 +83,7 @@
         if (length > 1
                 && buffer[contentOffset] != 0
                 && (buffer[offset - 1] & UNUSED_BITS_MASK[buffer[contentOffset] - 1]) != 0) {
-            throw new ASN1Exception("ASN.1 bitstring: wrong content at ["
-                    + contentOffset
-                    + "]. DER requires zero unused bits in final octet.");
+            throw new ASN1Exception(Messages.getString("security.107", contentOffset)); //$NON-NLS-1$
         }
     }
 
@@ -99,8 +96,7 @@
 
         // check encoded content
         if (buffer[contentOffset] != 0 && buffer[contentOffset] != (byte) 0xFF) {
-            throw new ASN1Exception("ASN.1 boolean: wrong content at ["
-                    + contentOffset + "]. DER allows only 0x00 or 0xFF values");
+            throw new ASN1Exception(Messages.getString("security.108", contentOffset)); //$NON-NLS-1$
         }
     }
 
@@ -111,8 +107,7 @@
 
         if (tag == ASN1Constants.TAG_C_OCTETSTRING) {
             throw new ASN1Exception(
-                    "ASN.1 octetstring: constructed identifier at ["
-                            + tagOffset + "]. Not valid for DER.");
+                    Messages.getString("security.109", tagOffset)); //$NON-NLS-1$
         }
         super.readOctetString();
     }
@@ -149,8 +144,7 @@
     public void readString(ASN1StringType type) throws IOException {
 
         if (tag == type.constrId) {
-            throw new ASN1Exception("ASN.1 string: constructed identifier at ["
-                    + tagOffset + "]. Not valid for DER.");
+            throw new ASN1Exception(Messages.getString("security.10A", tagOffset)); //$NON-NLS-1$
         }
         super.readString(type);
     }
@@ -162,16 +156,12 @@
 
         if (tag == ASN1Constants.TAG_C_UTCTIME) {
             // It is a string type and it can be encoded as primitive or constructed.
-            throw new ASN1Exception(
-                    "ASN.1 UTCTime: constructed identifier at [" + tagOffset
-                            + "]. Not valid for DER.");
+            throw new ASN1Exception(Messages.getString("security.10B", tagOffset)); //$NON-NLS-1$
         }
 
         // check format: DER uses YYMMDDHHMMSS'Z' only
         if (length != ASN1UTCTime.UTC_HMS) {
-            throw new ASN1Exception(
-                    "ASN.1 UTCTime: wrong format for DER, identifier at ["
-                            + tagOffset + ']');
+            throw new ASN1Exception(Messages.getString("security.10C", tagOffset)); //$NON-NLS-1$
         }
 
         super.readUTCTime();
@@ -184,9 +174,7 @@
 
         if (tag == ASN1Constants.TAG_C_GENERALIZEDTIME) {
             // It is a string type and it can be encoded as primitive or constructed.
-            throw new ASN1Exception(
-                    "ASN.1 GeneralizedTime: constructed identifier at ["
-                            + tagOffset + "]. Not valid for DER.");
+            throw new ASN1Exception(Messages.getString("security.10D", tagOffset)); //$NON-NLS-1$
         }
 
         super.readGeneralizedTime();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ObjectIdentifier.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ObjectIdentifier.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ObjectIdentifier.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ObjectIdentifier.java Tue Sep 26 05:46:11 2006
@@ -23,6 +23,8 @@
 
 import java.util.Arrays;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 /**
  * Instance of this class represents ObjectIdentifier (OID).
  * 
@@ -124,27 +126,26 @@
     public static void validate(int[] oid) {
 
         if (oid == null) {
-            throw new IllegalArgumentException("OID's array is null");
+            throw new IllegalArgumentException(Messages.getString("security.98")); //$NON-NLS-1$
         }
 
         if (oid.length < 2) {
             throw new IllegalArgumentException(
-                    "OID MUST have at least 2 subidentifiers");
+                    Messages.getString("security.99")); //$NON-NLS-1$
         }
 
         if (oid[0] > 2) {
             throw new IllegalArgumentException(
-                    "Valid values for first subidentifier are 0, 1 and 2");
+                    Messages.getString("security.9A")); //$NON-NLS-1$
         } else if (oid[0] != 2 && oid[1] > 39) {
             throw new IllegalArgumentException(
-                    "If the first subidentifier has 0 or 1 value the second "
-                            + "subidentifier value MUST be less then 40.");
+                    Messages.getString("security.9B")); //$NON-NLS-1$
         }
 
         for (int i = 0; i < oid.length; i++) {
             if (oid[i] < 0) {
                 throw new IllegalArgumentException(
-                        "Subidentifier MUST have positive value.");
+                        Messages.getString("security.9C")); //$NON-NLS-1$
             }
         }
     }
@@ -266,12 +267,12 @@
 
         if (str == null) {
             throw new IllegalArgumentException(
-                    "ObjectIdentifier string is null");
+                    Messages.getString("security.9D")); //$NON-NLS-1$
         }
 
         int length = str.length();
         if (length == 0) {
-            throw new IllegalArgumentException("Incorrect syntax");
+            throw new IllegalArgumentException(Messages.getString("security.9E")); //$NON-NLS-1$
         }
 
         int count = 1; // number of subidentifiers
@@ -281,25 +282,25 @@
             c = str.charAt(i);
             if (c == '.') {
                 if (wasDot) {
-                    throw new IllegalArgumentException("Incorrect syntax");
+                    throw new IllegalArgumentException(Messages.getString("security.9E")); //$NON-NLS-1$
                 }
                 wasDot = true;
                 count++;
             } else if (c >= '0' && c <= '9') {
                 wasDot = false;
             } else {
-                throw new IllegalArgumentException("Incorrect syntax");
+                throw new IllegalArgumentException(Messages.getString("security.9E")); //$NON-NLS-1$
             }
         }
 
         if (wasDot) {
             // the last char is dot
-            throw new IllegalArgumentException("Incorrect syntax");
+            throw new IllegalArgumentException(Messages.getString("security.9E")); //$NON-NLS-1$
         }
 
         if (count < 2) {
             throw new IllegalArgumentException(
-                    "OID MUST have at least 2 subidentifiers");
+                    Messages.getString("security.99")); //$NON-NLS-1$
         }
 
         int[] oid = new int[count];
@@ -314,11 +315,10 @@
 
         if (oid[0] > 2) {
             throw new IllegalArgumentException(
-                    "Valid values for first subidentifier are 0, 1 and 2");
+                    Messages.getString("security.9A")); //$NON-NLS-1$
         } else if (oid[0] != 2 && oid[1] > 39) {
             throw new IllegalArgumentException(
-                    "If the first subidentifier has 0 or 1 value the second "
-                            + "subidentifier value MUST be less then 40.");
+                    Messages.getString("security.9B")); //$NON-NLS-1$
         }
 
         return oid;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java Tue Sep 26 05:46:11 2006
@@ -141,12 +141,12 @@
     /**
      * System property for dynamically added policy location.
      */
-    public static final String JAVA_SECURITY_POLICY = "java.security.policy";
+    public static final String JAVA_SECURITY_POLICY = "java.security.policy"; //$NON-NLS-1$
 
     /**
      * Prefix for numbered Policy locations specified in security.properties.
      */
-    public static final String POLICY_URL_PREFIX = "policy.url.";
+    public static final String POLICY_URL_PREFIX = "policy.url."; //$NON-NLS-1$
 
     // A set of PolicyEntries constituting this Policy.
     private final Set<PolicyEntry> grants = new HashSet<PolicyEntry>();
@@ -273,7 +273,7 @@
         Set<PolicyEntry> fresh = new HashSet<PolicyEntry>();
         Properties system = new Properties(AccessController
                 .doPrivileged(new PolicyUtils.SystemKit()));
-        system.setProperty("/", File.separator);
+        system.setProperty("/", File.separator); //$NON-NLS-1$
         URL[] policyLocations = PolicyUtils.getPolicyURLs(system,
                                                           JAVA_SECURITY_POLICY,
                                                           POLICY_URL_PREFIX);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java Tue Sep 26 05:46:11 2006
@@ -52,6 +52,7 @@
 import org.apache.harmony.security.DefaultPolicyScanner.KeystoreEntry;
 import org.apache.harmony.security.DefaultPolicyScanner.PermissionEntry;
 import org.apache.harmony.security.DefaultPolicyScanner.PrincipalEntry;
+import org.apache.harmony.security.internal.nls.Messages;
 
 
 /**
@@ -322,7 +323,7 @@
         public String resolve(String protocol, String data)
                 throws PolicyUtils.ExpansionFailedException {
 
-            if ("self".equals(protocol)) {
+            if ("self".equals(protocol)) { //$NON-NLS-1$
                 //need expanding to list of principals in grant clause 
                 if (ge.principals != null && ge.principals.size() != 0) {
                     StringBuffer sb = new StringBuffer();
@@ -338,31 +339,30 @@
                             }
                             catch (Exception e) {
                                 throw new PolicyUtils.ExpansionFailedException(
-                                        "Error expanding alias : " + pr.name, e);
+                                        Messages.getString("security.143", pr.name), e); //$NON-NLS-1$
                             }
                         } else {
-                            sb.append(pr.klass).append(" \"").append(pr.name)
-                                    .append("\" ");
+                            sb.append(pr.klass).append(" \"").append(pr.name) //$NON-NLS-1$
+                                    .append("\" "); //$NON-NLS-1$
                         }
                     }
                     return sb.toString();
                 } else {
                     throw new PolicyUtils.ExpansionFailedException(
-                            "Self protocol is valid only in context of "
-                                    + "Principal-based grant entries");
+                            Messages.getString("security.144")); //$NON-NLS-1$
                 }
             }
-            if ("alias".equals(protocol)) {
+            if ("alias".equals(protocol)) { //$NON-NLS-1$
                 try {
                     return pc2str(getPrincipalByAlias(ks, data));
                 }
                 catch (Exception e) {
                     throw new PolicyUtils.ExpansionFailedException(
-                            "Error expanding alias : " + data, e);
+                            Messages.getString("security.143", data), e); //$NON-NLS-1$
                 }
             }
             throw new PolicyUtils.ExpansionFailedException(
-                    "Unknown expansion protocol : " + protocol);
+                    Messages.getString("security.145", protocol)); //$NON-NLS-1$
         }
 
         // Formats a string describing the passed Principal. 
@@ -371,7 +371,7 @@
             String name = pc.getName();
             StringBuffer sb = new StringBuffer(klass.length() + name.length()
                     + 5);
-            return sb.append(klass).append(" \"").append(name).append("\"")
+            return sb.append(klass).append(" \"").append(name).append("\"") //$NON-NLS-1$ //$NON-NLS-2$
                     .toString();
         }
     }
@@ -389,12 +389,12 @@
     protected Certificate[] resolveSigners(KeyStore ks, String signers)
             throws Exception {
         if (ks == null) {
-            throw new KeyStoreException("No KeyStore to resolve signers : \""
-                    + signers + "\"");
+            throw new KeyStoreException(Messages.getString("security.146", //$NON-NLS-1$
+                    signers));
         }
 
         Collection<Certificate> certs = new HashSet<Certificate>();
-        StringTokenizer snt = new StringTokenizer(signers, ",");
+        StringTokenizer snt = new StringTokenizer(signers, ","); //$NON-NLS-1$
         while (snt.hasMoreTokens()) {
             //XXX cache found certs ??
             certs.add(ks.getCertificate(snt.nextToken().trim()));
@@ -418,17 +418,15 @@
 
         if (ks == null) {
             throw new KeyStoreException(
-                    "No KeyStore to resolve principal by alias : \"" + alias
-                            + "\"");
+                    Messages.getString("security.147", alias)); //$NON-NLS-1$
         }
         //XXX cache found certs ??
         Certificate x509 = ks.getCertificate(alias);
         if (x509 instanceof X509Certificate) {
             return ((X509Certificate) x509).getSubjectX500Principal();
         } else {
-            throw new CertificateException("Invalid certificate for alias \""
-                    + alias + "\" : " + x509
-                    + ". Only X509Certificate should be aliased to principals.");
+            throw new CertificateException(Messages.getString("security.148", //$NON-NLS-1$
+                    alias, x509));
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java Tue Sep 26 05:46:11 2006
@@ -24,6 +24,8 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 
 /**
  * 
@@ -82,7 +84,7 @@
         Provider.Service serv;
 
         if (algorithm == null) {
-            throw new NoSuchAlgorithmException("Null algorithm name");
+            throw new NoSuchAlgorithmException(Messages.getString("security.149")); //$NON-NLS-1$
         }
         Services.refresh();
         if (returnedService != null
@@ -91,15 +93,15 @@
             serv = returnedService;
         } else {
             if (Services.isEmpty()) {
-                throw new NoSuchAlgorithmException(serviceName + " "
-                        + algorithm + " implementation not found");
+                throw new NoSuchAlgorithmException(Messages.getString("security.14A", //$NON-NLS-1$
+                        serviceName, algorithm));
             }
             serv = Services.getService(new StringBuffer(128)
-                    .append(serviceName).append(".").append(
+                    .append(serviceName).append(".").append( //$NON-NLS-1$
                             algorithm.toUpperCase()).toString());
             if (serv == null) {
-                throw new NoSuchAlgorithmException(serviceName + " "
-                        + algorithm + " implementation not found");
+                throw new NoSuchAlgorithmException(Messages.getString("security.14A", //$NON-NLS-1$
+                        serviceName, algorithm));
             }
             returnedService = serv;
             lastAlgorithm = algorithm;
@@ -124,13 +126,13 @@
 
         Provider.Service serv = null;
         if (algorithm == null) {
-            throw new NoSuchAlgorithmException(serviceName
-                    + " , algorithm is null");
+            throw new NoSuchAlgorithmException(
+                    Messages.getString("security.14B", serviceName)); //$NON-NLS-1$
         }
         serv = provider.getService(serviceName, algorithm);
         if (serv == null) {
-            throw new NoSuchAlgorithmException(serviceName + " " + algorithm
-                    + " implementation not found");
+            throw new NoSuchAlgorithmException(Messages.getString("security.14A", //$NON-NLS-1$
+                    serviceName, algorithm));
         }
         spi = serv.newInstance(param);
         this.provider = provider;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java Tue Sep 26 05:46:11 2006
@@ -38,6 +38,8 @@
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 /**
  * This class consist of a number of static methods, which provide a common functionality 
  * for various policy and configuration providers. 
@@ -182,18 +184,16 @@
         public T run() {
             String klassName = Security.getProperty(key);
             if (klassName == null || klassName.length() == 0) {
-                throw new SecurityException("Provider implementation should be specified via \""
-                                            + key + "\" security property");
+                throw new SecurityException(Messages.getString("security.14C", //$NON-NLS-1$
+                                            key));
             }
             // TODO accurate classloading
             try {
                 Class<?> klass = Class.forName(klassName, true,
                         Thread.currentThread().getContextClassLoader());
                 if (expectedType != null && klass.isAssignableFrom(expectedType)){
-                    throw new SecurityException("Provided class "
-                                              + klassName 
-                                              + " does not implement " 
-                                              + expectedType.getName());
+                    throw new SecurityException(Messages.getString("security.14D", //$NON-NLS-1$
+                                              klassName, expectedType.getName()));
                 }
                 //FIXME expectedType.cast(klass.newInstance());
                 return (T)klass.newInstance();
@@ -204,7 +204,7 @@
             catch (Exception e) {
                 // TODO log error ??
                 SecurityException se = new SecurityException(
-                        "Unable to instantiate provider : " + klassName);
+                        Messages.getString("security.14E", klassName)); //$NON-NLS-1$
                 se.initCause(e);
                 throw se;
             }
@@ -248,8 +248,8 @@
      */
     public static String expand(String str, Properties properties)
             throws ExpansionFailedException {
-        final String START_MARK = "${";
-        final String END_MARK = "}";
+        final String START_MARK = "${"; //$NON-NLS-1$
+        final String END_MARK = "}"; //$NON-NLS-1$
         final int START_OFFSET = START_MARK.length();
         final int END_OFFSET = END_MARK.length();
 
@@ -264,7 +264,7 @@
                     result.replace(start, end + END_OFFSET, value);
                     start += value.length();
                 } else {
-                    throw new ExpansionFailedException("Unknown key: " + key);
+                    throw new ExpansionFailedException(Messages.getString("security.14F", key)); //$NON-NLS-1$
                 }
             }
             start = result.indexOf(START_MARK, start);
@@ -314,8 +314,8 @@
      */
     public static String expandGeneral(String str,
             GeneralExpansionHandler handler) throws ExpansionFailedException {
-        final String START_MARK = "${{";
-        final String END_MARK = "}}";
+        final String START_MARK = "${{"; //$NON-NLS-1$
+        final String END_MARK = "}}"; //$NON-NLS-1$
         final int START_OFFSET = START_MARK.length();
         final int END_OFFSET = END_MARK.length();
 
@@ -344,7 +344,7 @@
      * dynamic policy location via system properties is allowed. 
      * @see #getPolicyURLs(Properties, String, String)
      */
-    public static final String POLICY_ALLOW_DYNAMIC = "policy.allowSystemProperty";
+    public static final String POLICY_ALLOW_DYNAMIC = "policy.allowSystemProperty"; //$NON-NLS-1$
 
     /** 
      * A key to security properties, deciding whether expansion of 
@@ -352,17 +352,17 @@
      * (in security properties values, policy files, etc).
      * @see #expand(String, Properties) 
      */
-    public static final String POLICY_EXPAND = "policy.expandProperties";
+    public static final String POLICY_EXPAND = "policy.expandProperties"; //$NON-NLS-1$
 
     /** 
      * Positive value of switching properties.
      */
-    public static final String TRUE = "true";
+    public static final String TRUE = "true"; //$NON-NLS-1$
 
     /** 
      * Negative value of switching properties.
      */
-    public static final String FALSE = "false";
+    public static final String FALSE = "false"; //$NON-NLS-1$
 
     /** 
      * Returns false if current security settings disable to perform 
@@ -420,7 +420,7 @@
                 .doPrivileged(security.key(POLICY_ALLOW_DYNAMIC)))) {
             String location = system.getProperty(systemUrlKey);
             if (location != null) {
-                if (location.startsWith("=")) {
+                if (location.startsWith("=")) { //$NON-NLS-1$
                     //overrides all other urls
                     dynamicOnly = true;
                     location = location.substring(1);
@@ -547,9 +547,7 @@
             catch (NoSuchMethodException ignore) {}
         }
         throw new IllegalArgumentException(
-                "No suitable constructors found in permission class : "
-                        + targetType
-                        + ". Zero, one or two-argument constructor is expected");
+                Messages.getString("security.150", targetType));//$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/SecurityUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/SecurityUtils.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/SecurityUtils.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/SecurityUtils.java Tue Sep 26 05:46:11 2006
@@ -24,6 +24,8 @@
 import java.security.AccessControlContext;
 import java.util.WeakHashMap;
 
+import org.apache.harmony.security.internal.nls.Messages;
+
 //FIXME: move this class under umbrella of protected packages -
 // see lib/java.security: property 'package.access',
 // so only trusted classes like Thread and AccessController will
@@ -70,16 +72,16 @@
     public static void putContext(Thread thread, AccessControlContext context)
             throws SecurityException {
         if (thread == null) {
-            throw new NullPointerException("thread can not be null");
+            throw new NullPointerException(Messages.getString("security.140")); //$NON-NLS-1$
         }
         synchronized (ACC_CACHE) {
             if (ACC_CACHE.containsKey(thread)) {
-                throw new SecurityException("You can not modify this map.");
+                throw new SecurityException(Messages.getString("security.141")); //$NON-NLS-1$
             }
             if (context == null) {
                 // this only allowed once - for the very first thread.
                 if (ACC_CACHE.containsValue(null)) {
-                    throw new Error("null context may be stored only once.");
+                    throw new Error(Messages.getString("security.142")); //$NON-NLS-1$
                 }
             }
             ACC_CACHE.put(thread, context);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java?view=diff&rev=450032&r1=450031&r2=450032
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java Tue Sep 26 05:46:11 2006
@@ -75,7 +75,7 @@
         ClassLoader cl = ClassLoader.getSystemClassLoader();
         Provider p;
 
-        while ((providerClassName = Security.getProperty("security.provider."
+        while ((providerClassName = Security.getProperty("security.provider." //$NON-NLS-1$
                 + i++)) != null) {
             try {
                 p = (Provider) Class
@@ -167,7 +167,7 @@
             serv = it1.next();
             type = serv.getType();
             sb.delete(0, sb.length());
-            key = sb.append(type).append(".").append(
+            key = sb.append(type).append(".").append( //$NON-NLS-1$
                     serv.getAlgorithm().toUpperCase()).toString();
             if (!services.containsKey(key)) {
                 services.put(key, serv);
@@ -175,7 +175,7 @@
             for (Iterator<String> it2 = Engine.door.getAliases(serv); it2.hasNext();) {
                 alias = it2.next();
                 sb.delete(0, sb.length());
-                key = sb.append(type).append(".").append(alias.toUpperCase())
+                key = sb.append(type).append(".").append(alias.toUpperCase()) //$NON-NLS-1$
                         .toString();
                 if (!services.containsKey(key)) {
                     services.put(key, serv);
@@ -226,7 +226,7 @@
         Set<String> s = services.keySet();
         for (Iterator<String> i = s.iterator(); i.hasNext();) {
             String key = i.next();
-            System.out.println(key + "=" + services.get(key));
+            System.out.println(key + "=" + services.get(key)); //$NON-NLS-1$
         }
     }
 



Mime
View raw message