harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r967044 - in /harmony/enhanced/java/trunk/classlib/modules/print: META-INF/ src/main/java/common/javax/print/ src/main/java/common/javax/print/attribute/ src/main/java/common/javax/print/attribute/standard/ src/main/java/common/org/apache/h...
Date Fri, 23 Jul 2010 11:11:29 GMT
Author: hindessm
Date: Fri Jul 23 11:11:29 2010
New Revision: 967044

URL: http://svn.apache.org/viewvc?rev=967044&view=rev
Log:
Applied patch from "[#HARMONY-6597] [classlib][print] added nls to print".

Added:
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/Messages.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/messages.properties   (with props)
Modified:
    harmony/enhanced/java/trunk/classlib/modules/print/META-INF/MANIFEST.MF
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/ServiceUI.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/SimpleDoc.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/HashAttributeSet.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/IntegerSyntax.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/ResolutionSyntax.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/SetOfIntegerSyntax.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/Size2DSyntax.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/CopiesSupported.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobImpressionsSupported.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobKOctetsSupported.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobMediaSheetsSupported.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PageRanges.java
    harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PrinterStateReasons.java

Modified: harmony/enhanced/java/trunk/classlib/modules/print/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/META-INF/MANIFEST.MF?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/META-INF/MANIFEST.MF Fri Jul 23 11:11:29 2010
@@ -35,7 +35,8 @@ Import-Package: java.awt,
  javax.swing.event,
  javax.swing.text,
  org.apache.harmony.awt.gl,
- org.apache.harmony.awt.gl.windows
+ org.apache.harmony.awt.gl.windows,
+ org.apache.harmony.kernel.vm
 Export-Package: javax.print,
  javax.print.attribute,
  javax.print.attribute.standard,

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/ServiceUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/ServiceUI.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/ServiceUI.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/ServiceUI.java Fri Jul 23 11:11:29 2010
@@ -25,6 +25,8 @@ import java.awt.HeadlessException;
 import java.awt.KeyboardFocusManager;
 import java.awt.Window;
 import javax.print.attribute.PrintRequestAttributeSet;
+
+import org.apache.harmony.print.internal.nls.Messages;
 import org.apache.harmony.x.print.ServiceUIDialog;
 
 public class ServiceUI {
@@ -65,12 +67,18 @@ public class ServiceUI {
      */
     static int checkServices(PrintService[] services, PrintService defaultService,
             PrintRequestAttributeSet attributes) {
-        if (services == null) {
-            throw new IllegalArgumentException("Services list is null!");
-        } else if (services.length == 0) {
-            throw new IllegalArgumentException("Services list is empty!");
-        } else if (attributes == null) {
-            throw new IllegalArgumentException("Attribute set is null!");
+       
+    if (services == null) {                 
+            //print.02= Services list is null
+            throw new IllegalArgumentException(Messages.getString("print.02")); //$NON-NLS-1$                   
+        }    
+    else if (services.length == 0) {                  
+            //print.03= Services list is empty
+            throw new IllegalArgumentException(Messages.getString("print.03")); //$NON-NLS-1$
+          }   
+    else if (attributes == null) {        
+            //print.04= Attribute set is null
+            throw new IllegalArgumentException(Messages.getString("print.04")); //$NON-NLS-1$            
         }
         int serviceIndex = 0;
         boolean defaultServiceFound = (defaultService == null);
@@ -81,9 +89,9 @@ public class ServiceUI {
                 break;
             }
         }
-        if (!defaultServiceFound) {
-            throw new IllegalArgumentException(
-                    "Default service is absent in the services list!");
+        if (!defaultServiceFound) {                    
+            //print.05= Default service is absent in the services list
+            throw new IllegalArgumentException(Messages.getString("print.05")); //$NON-NLS-1$
         }
         return serviceIndex;
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/SimpleDoc.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/SimpleDoc.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/SimpleDoc.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/SimpleDoc.java Fri Jul 23 11:11:29 2010
@@ -25,6 +25,8 @@ import java.io.Reader;
 import java.io.StringReader;
 import javax.print.attribute.DocAttributeSet;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class SimpleDoc implements Doc {
     private Object printdata;
 
@@ -44,16 +46,19 @@ public final class SimpleDoc implements 
          * in the DocFlavor.
          */
         if (docflavor == null || printData == null) {
-            throw new IllegalArgumentException("Argument is null");
+            
+            //print.00= Argument is null
+            throw new IllegalArgumentException(Messages.getString("print.00")); //$NON-NLS-1$
         }
         try {
             Class<?> clazz = Class.forName(docflavor.getRepresentationClassName());
             if (!clazz.isInstance(printData)) {
                 throw new IllegalArgumentException("");
             }
-        } catch (Exception e) {
-            throw new IllegalArgumentException("Wrong type of print data");
-        }
+        } catch (Exception e) {          
+            //print.01= Wrong type of print data
+            throw new IllegalArgumentException(Messages.getString("print.01")); //$NON-NLS-1$
+            }
         this.printdata = printData;
         this.flavor = docflavor;
         this.attributes = docattributes;

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java Fri Jul 23 11:11:29 2010
@@ -18,6 +18,8 @@ package javax.print.attribute;
 
 import java.io.Serializable;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class AttributeSetUtilities {
 
 
@@ -147,16 +149,19 @@ public final class AttributeSetUtilities
         }
 
 
-        public boolean add(Attribute attribute) {
-            throw new UnmodifiableSetException("Unmodifiable attribute set");
-        }
+        public boolean add(Attribute attribute) {                     
+            //print.06= Unmodifiable attribute set
+            throw new UnmodifiableSetException(Messages.getString("print.06")); //$NON-NLS-1$
+            }
 
-        public boolean addAll(AttributeSet attributeSet) {
-            throw new UnmodifiableSetException("Unmodifiable attribute set");
-        }
+        public boolean addAll(AttributeSet attributeSet) {             
+            //print.06= Unmodifiable attribute set
+            throw new UnmodifiableSetException(Messages.getString("print.06")); //$NON-NLS-1$        
+            }
 
-        public void clear() {
-            throw new UnmodifiableSetException("Unmodifiable attribute set");
+        public void clear() {            
+            //print.06= Unmodifiable attribute set
+            throw new UnmodifiableSetException(Messages.getString("print.06")); //$NON-NLS-1$
         }
 
         public boolean containsKey(Class attributeCategory) {
@@ -178,17 +183,19 @@ public final class AttributeSetUtilities
         public int hashCode() {
             return aset.hashCode();
         }
-
+        
         public boolean isEmpty() {
             return aset.isEmpty();
         }
-
-        public boolean remove(Attribute attribute) {
-            throw new UnmodifiableSetException("Unmodifiable attribute set");
+        
+        public boolean remove(Attribute attribute) {             
+            //print.06= Unmodifiable attribute set
+            throw new UnmodifiableSetException(Messages.getString("print.06")); //$NON-NLS-1$
         }
-
-        public synchronized boolean remove (Class attributeCategory) {
-            throw new UnmodifiableSetException("Unmodifiable attribute set");
+        
+        public synchronized boolean remove (Class attributeCategory) {             
+            //print.06= Unmodifiable attribute set
+            throw new UnmodifiableSetException(Messages.getString("print.06")); //$NON-NLS-1$
         }
 
         public int size() {
@@ -257,113 +264,124 @@ public final class AttributeSetUtilities
 
     public static AttributeSet 
         synchronizedView (AttributeSet attributeSet) {
-            if (attributeSet == null) {
-                throw new NullPointerException("Null attribute set");
+            if (attributeSet == null) {                           
+                //print.07= Null attribute set
+                throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$            
             }
             return new SynchronizedAttributeSet(attributeSet);
     }
   
     public static DocAttributeSet 
         synchronizedView (DocAttributeSet attributeSet) {
-            if (attributeSet == null) {
-                throw new NullPointerException("Null attribute set");
+            if (attributeSet == null) {                
+                //print.07= Null attribute set
+                throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$           
             }
             return new SynchronizedDocAttributeSet(attributeSet);
     }
     
     public static PrintRequestAttributeSet 
         synchronizedView(PrintRequestAttributeSet attributeSet) {
-            if (attributeSet == null) {
-                throw new NullPointerException("Null attribute set");
+        if (attributeSet == null) {                
+                //print.07= Null attribute set
+                throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$           
             }
             return new SynchronizedPrintRequestAttributeSet(attributeSet);
     }
 
     public static PrintJobAttributeSet
         synchronizedView(PrintJobAttributeSet attributeSet) {
-            if (attributeSet == null) {
-                throw new NullPointerException("Null attribute set");
+            if (attributeSet == null) {                
+                //print.07= Null attribute set
+                throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$           
             }
             return new SynchronizedPrintJobAttributeSet(attributeSet);
     }
 
     public static PrintServiceAttributeSet
         synchronizedView(PrintServiceAttributeSet attributeSet) {
-            if (attributeSet == null) {
-                throw new NullPointerException("Null attribute set");
+            if (attributeSet == null) {                
+                //print.07= Null attribute set
+                throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$           
             }
             return new SynchronizedPrintServiceAttributeSet(attributeSet);
     }
 
     
     public static AttributeSet unmodifiableView (AttributeSet attributeSet) {
-        if (attributeSet == null) {
-            throw new NullPointerException("Null attribute set");
+        if (attributeSet == null) {            
+            //print.07= Null attribute set
+            throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$       
         }
         return new UnmodifiableAttributeSet(attributeSet);
     }
     
     public static DocAttributeSet 
                     unmodifiableView (DocAttributeSet attributeSet) {
-        if (attributeSet == null) {
-            throw new NullPointerException("Null attribute set");
+        if (attributeSet == null) {            
+            //print.07= Null attribute set
+            throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$        
         }
         return new UnmodifiableDocAttributeSet(attributeSet);
     }
     
     public static PrintJobAttributeSet
                     unmodifiableView(PrintJobAttributeSet attributeSet) {
-        if (attributeSet == null) {
-            throw new NullPointerException("Null attribute set");
+        if (attributeSet == null) {            
+            //print.07= Null attribute set
+            throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$        
         }
         return new UnmodifiablePrintJobAttributeSet(attributeSet);
     }
     
     public static PrintRequestAttributeSet 
                     unmodifiableView(PrintRequestAttributeSet attributeSet) {
-        if (attributeSet == null) {
-            throw new NullPointerException("Null attribute set");
+        if (attributeSet == null) {            
+            //print.07= Null attribute set
+            throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$       
         }
         return new UnmodifiablePrintRequestAttributeSet(attributeSet);
     }
       
     public static PrintServiceAttributeSet
                         unmodifiableView(PrintServiceAttributeSet attributeSet) {
-        if (attributeSet == null) {
-            throw new NullPointerException("Null attribute set");
+        if (attributeSet == null) {            
+            //print.07= Null attribute set
+            throw new NullPointerException(Messages.getString("print.07")); //$NON-NLS-1$       
         }
         return new UnmodifiablePrintServiceAttributeSet (attributeSet);
     }
 
     
     public static Class<?> verifyAttributeCategory(Object object, Class<?> interfaceName) {
-        if (!(Attribute.class).isAssignableFrom(interfaceName)) {
-            throw new ClassCastException(interfaceName.getName() + " is not "
-                    + "interface Attribute or it's subinterface");
+        if (!(Attribute.class).isAssignableFrom(interfaceName)) {          
+            //print.08={0} is not interface Attribute or it's subinterface
+            throw new ClassCastException(Messages.getString("print.08",
+                                                            interfaceName.getName())); //$NON-NLs-1$            
         } else if (interfaceName.isAssignableFrom((Class<?>) object)) {
             return (Class<?>) object;
-        } else {
-            throw new ClassCastException(object.getClass().getName() + "doesn't implement"
-                    + interfaceName.getName());
+        } else {                   
+            //print.09={0} doesn't implement {1}
+            throw new ClassCastException(Messages.getString("print.09", object.getClass().getName(), interfaceName.getName())); //$NON-NLS-1$        
         }
     }
 
     public static Attribute verifyAttributeValue(Object attribute, Class<?> interfaceName) {
-        if (attribute == null) {
-            throw new NullPointerException("Null attribute");
+        if (attribute == null) {                      
+          //print.0A= Null attribute 
+            throw new NullPointerException(Messages.getString("print.0A")); //$NON-NLS-1$            
         } else if (interfaceName.isInstance(attribute)) {
             return (Attribute) attribute;
-        } else {
-            throw new ClassCastException("Object is not an instance of "
-                    + interfaceName.getName());
+        } else {                  
+            //print.0B= object is not an instance of {0}
+            throw new ClassCastException(Messages.getString("print.0B", interfaceName.getName())); //$NON-NLS-1$        
         }
     }
 
     public static void verifyCategoryForValue(Class<?> attributeCategory, Attribute attribute) {
-        if (!attributeCategory.equals(attribute.getCategory())) {
-            throw new IllegalArgumentException(attributeCategory.getName()
-                    + "is not equal to the category of the attribute"
-                    + attribute.getCategory().getName());
+        if (!attributeCategory.equals(attribute.getCategory())) {                        
+            //print.0C= {0} is not equal to the category of the attribute {1}
+            throw new IllegalArgumentException(Messages.getString("print.0C", attributeCategory.getName(), attribute.getCategory().getName())); //$NON-NLs-1$        
         }
     }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/HashAttributeSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/HashAttributeSet.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/HashAttributeSet.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/HashAttributeSet.java Fri Jul 23 11:11:29 2010
@@ -23,6 +23,8 @@ import java.io.ObjectOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public class HashAttributeSet implements Serializable, AttributeSet {
     private static final long serialVersionUID = 5311560590283707917L;
 
@@ -47,23 +49,26 @@ public class HashAttributeSet implements
     }
 
     protected HashAttributeSet(Class<?> interfaceName) {
-        if (interfaceName == null) {
-            throw new NullPointerException("Null attribute interface");
+        if (interfaceName == null) {             
+            //print.0D= NUll attribute interface
+            throw new NullPointerException(Messages.getString("print.0D")); //$NON-NLS-1$        
         }
         attributeInterfaceName = interfaceName;
     }
 
     protected HashAttributeSet(Attribute attribute, Class<?> interfaceName) {
-        if (interfaceName == null) {
-            throw new NullPointerException("Null attribute interface");
+        if (interfaceName == null) {            
+            //print.0D= NUll attribute interface
+            throw new NullPointerException(Messages.getString("print.0D")); //$NON-NLS-1$            
         }
         attributeInterfaceName = interfaceName;
         add(attribute);
     }
 
     protected HashAttributeSet(Attribute[] attributes, Class<?> interfaceName) {
-        if (interfaceName == null) {
-            throw new NullPointerException("Null attribute interface");
+        if (interfaceName == null) {            
+             //print.0D= NUll attribute interface
+            throw new NullPointerException(Messages.getString("print.0D")); //$NON-NLS-1$        
         }
         attributeInterfaceName = interfaceName;
         if (attributes != null) {

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/IntegerSyntax.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/IntegerSyntax.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/IntegerSyntax.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/IntegerSyntax.java Fri Jul 23 11:11:29 2010
@@ -19,6 +19,8 @@ package javax.print.attribute;
 
 import java.io.Serializable;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public abstract class IntegerSyntax implements Cloneable, Serializable {
     private static final long serialVersionUID = 3644574816328081943L;
     
@@ -31,9 +33,9 @@ public abstract class IntegerSyntax impl
 
     protected IntegerSyntax(int intValue, int lowerBound, int upperBound) {
         super();
-        if ((intValue < lowerBound) || (intValue > upperBound)) {
-            throw new IllegalArgumentException("Value " + intValue + " not in valid range ("
-                    + lowerBound + "," + upperBound + ")");
+        if ((intValue < lowerBound) || (intValue > upperBound)) {             
+            //print.0E= Value {0} not in valid range ({1})
+            throw new IllegalArgumentException(Messages.getString("print.0E", intValue, lowerBound+","+upperBound)); //$NON-NLS-1$        
         }
         value = intValue;
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/ResolutionSyntax.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/ResolutionSyntax.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/ResolutionSyntax.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/ResolutionSyntax.java Fri Jul 23 11:11:29 2010
@@ -19,6 +19,8 @@ package javax.print.attribute;
 
 import java.io.Serializable;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public abstract class ResolutionSyntax implements Cloneable, Serializable {
     private static final long serialVersionUID = 2706743076526672017L;
 
@@ -31,14 +33,17 @@ public abstract class ResolutionSyntax i
     private final int feedRes;
 
     public ResolutionSyntax(int crossFeedResolution, int feedResolution, int units) {
-        if (crossFeedResolution < 1) {
-            throw new IllegalArgumentException("CrossFeedResolution " + "is less than 1");
-        }
-        if (feedResolution < 1) {
-            throw new IllegalArgumentException("FeedResolution is less than 1");
-        }
-        if (units < 1) {
-            throw new IllegalArgumentException("Units is less than 1");
+        if (crossFeedResolution < 1) {           
+            //print.0F= CrossFeedResolution is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.0F")); //$NON-NLS-1$            
+        }
+        if (feedResolution < 1) {            
+            //print.10= Feed resolution is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.10")); //$NON-NLS-1$        
+        }
+        if (units < 1) {            
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$        
         }
         crossFeedRes = crossFeedResolution * units;
         feedRes = feedResolution * units;
@@ -56,7 +61,8 @@ public abstract class ResolutionSyntax i
 
     public int getCrossFeedResolution(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$
         }
         return Math.round(((float) crossFeedRes) / units);
     }
@@ -67,7 +73,8 @@ public abstract class ResolutionSyntax i
 
     public int getFeedResolution(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$
         }
         return Math.round(((float) feedRes) / units);
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/SetOfIntegerSyntax.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/SetOfIntegerSyntax.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/SetOfIntegerSyntax.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/SetOfIntegerSyntax.java Fri Jul 23 11:11:29 2010
@@ -20,22 +20,26 @@ package javax.print.attribute;
 import java.io.Serializable;
 import java.util.Vector;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public abstract class SetOfIntegerSyntax implements Cloneable, Serializable {
     private static final long serialVersionUID = 3666874174847632203L;
 
     private int[][] canonicalArray;
 
     protected SetOfIntegerSyntax(int value) {
-        if (value < 0) {
-            throw new IllegalArgumentException("Value " + value + " is less than 0");
+        if (value < 0) {                       
+            //print.12= Value {0} is less than 0
+            throw new IllegalArgumentException(Messages.getString("print.12", value)); //NON-NLS-1$            
         }
         canonicalArray = new int[][] { { value, value } };
     }
 
     protected SetOfIntegerSyntax(int lowerBound, int upperBound) {
         if (lowerBound <= upperBound) {
-            if (lowerBound < 0) {
-                throw new IllegalArgumentException("Lower bound is less than 0");
+            if (lowerBound < 0) {              
+            //print.13= Lower bound is less than 0
+            throw new IllegalArgumentException(Messages.getString("print.13")); //NON-NLS-1$              
             }
             canonicalArray = new int[][] { { lowerBound, upperBound } };
         } else {
@@ -103,9 +107,9 @@ public abstract class SetOfIntegerSyntax
                             continue;
                         } else if (Character.isDigit(symbol)) {
                             num1long = num1long * 10 + Character.digit(symbol, 10);
-                            if (num1long > Integer.MAX_VALUE) {
-                                throw new IllegalArgumentException(num1long
-                                        + " is out of int range");
+                            if (num1long > Integer.MAX_VALUE) {                                                            
+                                //print.14= {0} is out of int range
+                                throw new IllegalArgumentException(Messages.getString("print.24", num1long)); //$NON-NLs-1$
                             }
                             num2long = num1long;
                         } else if ((symbol == ':') || (symbol == '-')) {
@@ -131,9 +135,9 @@ public abstract class SetOfIntegerSyntax
                             continue;
                         } else if (Character.isDigit(symbol)) {
                             num2long = num2long * 10 + Character.digit(symbol, 10);
-                            if (num2long > Integer.MAX_VALUE) {
-                                throw new IllegalArgumentException(num2long
-                                        + " is out of int range");
+                            if (num2long > Integer.MAX_VALUE) {                             
+                                //print.14= {0} is out of int range
+                                throw new IllegalArgumentException(Messages.getString("print.14", num2long)); //$NON-NLs-1$                                
                             }
                         } else {
                             throw new IllegalArgumentException();
@@ -159,7 +163,8 @@ public abstract class SetOfIntegerSyntax
         int num2;
         for (int[] element : values) {
             if (element == null) {
-                throw new NullPointerException("int[][] array has null element");
+                //print.15= int[][] array has null element
+                throw new NullPointerException(Messages.getString("print.15")); //$NON-NLS-1$
             }
             if (element.length == 1) {
                 num1 = element[0];
@@ -168,11 +173,12 @@ public abstract class SetOfIntegerSyntax
                 num1 = element[0];
                 num2 = element[1];
             } else {
-                throw new IllegalArgumentException("Only array of length-1 "
-                        + "or length-2 arrays of ints are valid");
+            	//print.16= Only array of length-1 or length-2 arrays of ints are valid
+                throw new IllegalArgumentException(Messages.getString("print.16")); //$NON-NLS-1$                
             }
             if (num1 < 0) {
-                throw new IllegalArgumentException("Valid values are " + "not less than 0");
+                //print.17= Valid values are not less than 0
+                throw new IllegalArgumentException(Messages.getString("print.17")); //$NON-NLS-1$            
             } else if (num1 <= num2) {
                 addRange(vector, num1, num2);
             }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/Size2DSyntax.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/Size2DSyntax.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/Size2DSyntax.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/Size2DSyntax.java Fri Jul 23 11:11:29 2010
@@ -19,6 +19,8 @@ package javax.print.attribute;
 
 import java.io.Serializable;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public abstract class Size2DSyntax implements Cloneable, Serializable {
     private static final long serialVersionUID = 5584439964938660530L;
     
@@ -32,7 +34,8 @@ public abstract class Size2DSyntax imple
 
     protected Size2DSyntax(int x, int y, int units) {
         if ((x < 0) || (y < 0) || (units < 1)) {
-            throw new IllegalArgumentException("Valid values are:" + "x>=0, y>=0, units>=1");
+            //print.18= Valid values are x>=0, y>=0, units>=1
+            throw new IllegalArgumentException(Messages.getString("print.18")); //$NON-NLs-1$            
         }
         this.x = x * units;
         this.y = y * units;
@@ -40,7 +43,8 @@ public abstract class Size2DSyntax imple
 
     protected Size2DSyntax(float x, float y, int units) {
         if ((x < 0.0f) || (y < 0.0f) || (units < 1)) {
-            throw new IllegalArgumentException("Valid values are:" + "x>=0.0, y>=0.0, units>=1");
+            //print.19= VAlid values are x>=0.0, y>=0.0, units>=1
+            throw new IllegalArgumentException(Messages.getString("print.19")); //$NON-NLs-1$            
         }
         this.x = Math.round(x * units);
         this.y = Math.round(y * units);
@@ -61,14 +65,16 @@ public abstract class Size2DSyntax imple
 
     public float getX(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$
         }
         return ((float) x) / units;
     }
 
     public float getY(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$        
         }
         return ((float) y) / units;
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/CopiesSupported.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/CopiesSupported.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/CopiesSupported.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/CopiesSupported.java Fri Jul 23 11:11:29 2010
@@ -21,6 +21,8 @@ import javax.print.attribute.Attribute;
 import javax.print.attribute.SetOfIntegerSyntax;
 import javax.print.attribute.SupportedValuesAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class CopiesSupported extends SetOfIntegerSyntax implements
         SupportedValuesAttribute {
     private static final long serialVersionUID = 6927711687034846001L;
@@ -28,16 +30,19 @@ public final class CopiesSupported exten
     public CopiesSupported(int value) {
         super(value);
         if (value < 1) {
-            throw new IllegalArgumentException("Value" + value + "is less than 1");
+            //print.1A= Value {0} is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.1A", value)); //NON-NLS-1$        
         }
     }
 
     public CopiesSupported(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
         if (lowerBound > upperBound) {
-            throw new IllegalArgumentException("Null range");
-        } else if (lowerBound < 1) {
-            throw new IllegalArgumentException("Lower bound" + lowerBound + "is less than 1");
+            //print.1B= Null range
+            throw new IllegalArgumentException(Messages.getString("print.1B")); //$NON-NLS-1$            
+        } else if (lowerBound < 1) {                     
+            //print.1C= Lower bound {0} is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.1C", lowerBound)); //$NON-NLS-1$            
         }
     }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobImpressionsSupported.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobImpressionsSupported.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobImpressionsSupported.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobImpressionsSupported.java Fri Jul 23 11:11:29 2010
@@ -21,6 +21,8 @@ import javax.print.attribute.Attribute;
 import javax.print.attribute.SetOfIntegerSyntax;
 import javax.print.attribute.SupportedValuesAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class JobImpressionsSupported extends SetOfIntegerSyntax implements
         SupportedValuesAttribute {
     private static final long serialVersionUID = -4887354803843173692L;
@@ -28,9 +30,11 @@ public final class JobImpressionsSupport
     public JobImpressionsSupported(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
         if (lowerBound > upperBound) {
-            throw new IllegalArgumentException("Null range: lowerBound " + "> upperBound");
-        } else if (lowerBound < 0) {
-            throw new IllegalArgumentException("Lower bound " + lowerBound + " is less than 0");
+            //print.1D= Null range: lowerBound > upperBound
+            throw new IllegalArgumentException(Messages.getString("print.1D")); //$NON-NLS-1$
+       	} else if (lowerBound < 0) {
+            //print.1E=Lower bound {0} is less than 0
+            throw new IllegalArgumentException(Messages.getString("print.1E", lowerBound)); //$NON-NLs-1$            
         }
     }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobKOctetsSupported.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobKOctetsSupported.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobKOctetsSupported.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobKOctetsSupported.java Fri Jul 23 11:11:29 2010
@@ -21,6 +21,8 @@ import javax.print.attribute.Attribute;
 import javax.print.attribute.SetOfIntegerSyntax;
 import javax.print.attribute.SupportedValuesAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class JobKOctetsSupported extends SetOfIntegerSyntax implements
         SupportedValuesAttribute {
     private static final long serialVersionUID = -2867871140549897443L;
@@ -28,9 +30,11 @@ public final class JobKOctetsSupported e
     public JobKOctetsSupported(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
         if (lowerBound > upperBound) {
-            throw new IllegalArgumentException("Null range: lowerBound " + "> upperBound");
+		    //print.1D= Null range: lowerBound > upperBound
+            throw new IllegalArgumentException(Messages.getString("print.1D")); //$NON-NLS-1$        
         } else if (lowerBound < 0) {
-            throw new IllegalArgumentException("Lower bound " + lowerBound + " is less than 0");
+            //print.1E=Lower bound {0} is less than 0
+            throw new IllegalArgumentException(Messages.getString("print.1E", lowerBound)); //$NON-NLs-1$        
         }
     }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobMediaSheetsSupported.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobMediaSheetsSupported.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobMediaSheetsSupported.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobMediaSheetsSupported.java Fri Jul 23 11:11:29 2010
@@ -21,6 +21,8 @@ import javax.print.attribute.Attribute;
 import javax.print.attribute.SetOfIntegerSyntax;
 import javax.print.attribute.SupportedValuesAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class JobMediaSheetsSupported extends SetOfIntegerSyntax implements
         SupportedValuesAttribute {
     private static final long serialVersionUID = 2953685470388672940L;
@@ -28,9 +30,11 @@ public final class JobMediaSheetsSupport
     public JobMediaSheetsSupported(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
         if (lowerBound > upperBound) {
-            throw new IllegalArgumentException("Null range: lowerBound " + "> upperBound");
+            //print.1D= Null range: lowerBound > upperBound
+            throw new IllegalArgumentException(Messages.getString("print.1D")); //$NON-NLS-1$        
         } else if (lowerBound < 0) {
-            throw new IllegalArgumentException("Lower bound " + lowerBound + " is less then 0");
+            //print.1E=Lower bound {0} is less than 0
+            throw new IllegalArgumentException(Messages.getString("print.1E", lowerBound)); //$NON-NLs-1$        
         }
     }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java Fri Jul 23 11:11:29 2010
@@ -22,6 +22,8 @@ import java.util.HashSet;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintJobAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class JobStateReasons extends HashSet<JobStateReason> implements PrintJobAttribute {
     private static final long serialVersionUID = 8849088261264331812L;
 
@@ -47,7 +49,8 @@ public final class JobStateReasons exten
     @Override
     public boolean add(JobStateReason reason) {
         if (reason == null) {
-            throw new NullPointerException("Null JobStateReason");
+            //print.1F=Null JobStateReason
+            throw new NullPointerException(Messages.getString("print.1F")); //$NON-NLS-1$            
         }
         return super.add(reason);
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java Fri Jul 23 11:11:29 2010
@@ -22,6 +22,8 @@ import javax.print.attribute.DocAttribut
 import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class MediaPrintableArea implements DocAttribute, PrintJobAttribute,
         PrintRequestAttribute {
     private static final long serialVersionUID = -1597171464050795793L;
@@ -83,28 +85,32 @@ public final class MediaPrintableArea im
 
     public float getX(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+             //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$        
         }
         return ((float) x) / units;
     }
 
     public float getY(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$        
         }
         return ((float) y) / units;
     }
 
     public float getWidth(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$        
         }
         return ((float) width) / units;
     }
 
     public float getHeight(int units) {
         if (units < 1) {
-            throw new IllegalArgumentException("units is less than 1");
+            //print.11= Units is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.11")); // $NON-NLS-1$        
         }
         return ((float) height) / units;
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java Fri Jul 23 11:11:29 2010
@@ -25,6 +25,8 @@ import java.util.Map;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.Size2DSyntax;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 @SuppressWarnings("unused")
 public class MediaSize extends Size2DSyntax implements Attribute {
     private static final long serialVersionUID = -1967958664615414771L;
@@ -338,8 +340,9 @@ public class MediaSize extends Size2DSyn
 
     public MediaSize(int x, int y, int units) {
         super(x, y, units);
-        if (x > y) {
-            throw new IllegalArgumentException("x > y");
+        if (x > y) {            
+            //print.20= x > y
+            throw new IllegalArgumentException(Messages.getString("print.20")); //$NON-NLS-1$            
         }
         synchronized (MediaSize.class) {
             sizesList.add(this);
@@ -348,8 +351,9 @@ public class MediaSize extends Size2DSyn
 
     public MediaSize(float x, float y, int units) {
         super(x, y, units);
-        if (x > y) {
-            throw new IllegalArgumentException("x > y");
+        if (x > y) {            
+            //print.20= x > y
+            throw new IllegalArgumentException(Messages.getString("print.20")); //$NON-NLS-1$      
         }
         synchronized (MediaSize.class) {
             sizesList.add(this);
@@ -358,8 +362,9 @@ public class MediaSize extends Size2DSyn
 
     public MediaSize(int x, int y, int units, MediaSizeName mediaSizeName) {
         super(x, y, units);
-        if (x > y) {
-            throw new IllegalArgumentException("x > y");
+        if (x > y) {            
+            //print.20= x > y
+            throw new IllegalArgumentException(Messages.getString("print.20")); //$NON-NLS-1$        
         }
         this.mediaSizeName = mediaSizeName;
         synchronized (MediaSize.class) {
@@ -370,8 +375,9 @@ public class MediaSize extends Size2DSyn
 
     public MediaSize(float x, float y, int units, MediaSizeName mediaSizeName) {
         super(x, y, units);
-        if (x > y) {
-            throw new IllegalArgumentException("x > y");
+        if (x > y) {           
+            //print.20= x > y
+            throw new IllegalArgumentException(Messages.getString("print.20")); //$NON-NLS-1$       
         }
         this.mediaSizeName = mediaSizeName;
         synchronized (MediaSize.class) {
@@ -389,9 +395,9 @@ public class MediaSize extends Size2DSyn
     }
 
     public static MediaSizeName findMedia(float x, float y, int units) {
-        if ((x <= 0.0) || (y <= 0.0) || (units < 1)) {
-            throw new IllegalArgumentException("Valid values are: "
-                    + "x > 0, y > 0, units >= 1");
+        if ((x <= 0.0) || (y <= 0.0) || (units < 1)) {            
+            //print.21=Valid values are: x > 0, y > 0, units >=1
+            throw new IllegalArgumentException(Messages.getString("print.21")); //$NON-NLs-1$            
         }
         synchronized (MediaSize.class) {
             MediaSize hit = null;

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java Fri Jul 23 11:11:29 2010
@@ -21,6 +21,8 @@ import javax.print.attribute.Attribute;
 import javax.print.attribute.SetOfIntegerSyntax;
 import javax.print.attribute.SupportedValuesAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class NumberUpSupported extends SetOfIntegerSyntax implements
         SupportedValuesAttribute {
     private static final long serialVersionUID = -1041573395759141805L;
@@ -28,31 +30,37 @@ public final class NumberUpSupported ext
     public NumberUpSupported(int value) {
         super(value);
         if (value < 1) {
-            throw new IllegalArgumentException("Value" + value + "is less than 1");
+            //print.1A= Value {0} is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.1A", value)); //NON-NLS-1$        
         }
     }
 
     public NumberUpSupported(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
         if (lowerBound > upperBound) {
-            throw new IllegalArgumentException("Null range: lowerBound " + "> upperBound");
-        } else if (lowerBound < 1) {
-            throw new IllegalArgumentException("Lower bound " + lowerBound + " is less than 1");
+             //print.1D= Null range: lowerBound > upperBound
+            throw new IllegalArgumentException(Messages.getString("print.1D")); //$NON-NLS-1$        
+        } else if (lowerBound < 1) {             
+            //print.1C= Lower bound {0} is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.1C", lowerBound)); //$NON-NLS-1$            
         }
     }
 
     public NumberUpSupported(int[][] members) {
         super(members);
         if (members == null) {
-            throw new NullPointerException("Null int[][] parameter");
+            //print.22=Null int [][] parameter
+            throw new NullPointerException(Messages.getString("print.22")); //$NON-NLS-1$            
         }
         int[][] canonicalArray = getMembers();
         if (canonicalArray.length == 0) {
-            throw new IllegalArgumentException("Zero-length array");
+            //print.23=Zero-length array
+            throw new IllegalArgumentException(Messages.getString("print.23")); //$NON-NLS-1$            
         }
         for (int i = 0; i < canonicalArray.length; i++) {
             if (canonicalArray[i][0] < 1) {
-                throw new IllegalArgumentException("Valid values are not " + "less than 1");
+                //print.24= valid values are not less than 1
+                throw new IllegalArgumentException(Messages.getString("print.24")); //$NON-NLs-1$            
             }
         }
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PageRanges.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PageRanges.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PageRanges.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PageRanges.java Fri Jul 23 11:11:29 2010
@@ -23,6 +23,8 @@ import javax.print.attribute.PrintJobAtt
 import javax.print.attribute.PrintRequestAttribute;
 import javax.print.attribute.SetOfIntegerSyntax;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 public final class PageRanges extends SetOfIntegerSyntax implements DocAttribute,
         PrintJobAttribute, PrintRequestAttribute {
     private static final long serialVersionUID = 8639895197656148392L;
@@ -30,23 +32,27 @@ public final class PageRanges extends Se
     public PageRanges(int value) {
         super(value);
         if (value < 1) {
-            throw new IllegalArgumentException("Value" + value + "is less than 1");
+            //print.1A= Value {0} is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.1A", value)); //NON-NLS-1$        
         }
     }
 
     public PageRanges(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
         if (lowerBound > upperBound) {
-            throw new IllegalArgumentException("Null range: lowerBound " + "> upperBound");
+            //print.1D= Null range: lowerBound > upperBound
+            throw new IllegalArgumentException(Messages.getString("print.1D")); //$NON-NLS-1$        
         } else if (lowerBound < 1) {
-            throw new IllegalArgumentException("Lower bound " + lowerBound + " is less than 1");
+             //print.1C= Lower bound {0} is less than 1
+            throw new IllegalArgumentException(Messages.getString("print.1C", lowerBound)); //$NON-NLS-1$        
         }
     }
 
     public PageRanges(int[][] members) {
         super(members);
         if (members == null) {
-            throw new NullPointerException("Null int[][] parameter");
+             //print.22=Null int [][] parameter
+            throw new NullPointerException(Messages.getString("print.22")); //$NON-NLS-1$        
         }
         precisionCheck();
     }
@@ -54,7 +60,8 @@ public final class PageRanges extends Se
     public PageRanges(String string) {
         super(string);
         if (string == null) {
-            throw new NullPointerException("Null string parameter");
+            //print.25= null string parameter
+            throw new NullPointerException(Messages.getString("print.25")); //$NON-NLs-1$            
         }
         precisionCheck();
     }
@@ -62,11 +69,13 @@ public final class PageRanges extends Se
     private void precisionCheck() {
         int[][] canonicalArray = getMembers();
         if (canonicalArray.length == 0) {
-            throw new IllegalArgumentException("Zero-length array");
+            //print.23=Zero-length array
+            throw new IllegalArgumentException(Messages.getString("print.23")); //$NON-NLS-1$        
         }
         for (int i = 0; i < canonicalArray.length; i++) {
             if (canonicalArray[i][0] < 1) {
-                throw new IllegalArgumentException("Valid values are not " + "less than 1");
+                //print.24= valid values are not less than 1
+                throw new IllegalArgumentException(Messages.getString("print.24")); //$NON-NLs-1$           
             }
         }
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PrinterStateReasons.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PrinterStateReasons.java?rev=967044&r1=967043&r2=967044&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PrinterStateReasons.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/javax/print/attribute/standard/PrinterStateReasons.java Fri Jul 23 11:11:29 2010
@@ -25,6 +25,8 @@ import java.util.Set;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintServiceAttribute;
 
+import org.apache.harmony.print.internal.nls.Messages;
+
 /*
  * Table values are obtained from RFC2911: Internet Printing Protocol/1.1: 
  * Model and Semantics, section 4.4.11, http://ietf.org/rfc/rfc2911.txt?number=2911
@@ -63,17 +65,20 @@ public final class PrinterStateReasons e
     @Override
     public Severity put(PrinterStateReason reason, Severity severity) {
         if (reason == null) {
-            throw new NullPointerException("Reason is null");
+            //print.26=Reason is null
+            throw new NullPointerException(Messages.getString("print.26")); //$NON-NLS-1$            
         }
         if (severity == null) {
-            throw new NullPointerException("Severity is null");
+            //print.27=Severity is null
+            throw new NullPointerException(Messages.getString("print.26")); //$NON-NLS-1$        
         }
         return super.put(reason, severity);
     }
 
     public Set<PrinterStateReason> printerStateReasonSet(Severity severity) {
         if (severity == null) {
-            throw new NullPointerException("Severity is null");
+            //print.27=Severity is null
+            throw new NullPointerException(Messages.getString("print.26")); //$NON-NLS-1$       
         }
         Set<PrinterStateReason> set = new HashSet<PrinterStateReason>();
         for (Map.Entry<PrinterStateReason, Severity> mapEntry : entrySet()) {

Added: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/Messages.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/Messages.java?rev=967044&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/Messages.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/Messages.java Fri Jul 23 11:11:29 2010
@@ -0,0 +1,243 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/*
+ * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
+ * All changes made to this file manually will be overwritten 
+ * if this tool runs again. Better make changes in the template file.
+ */
+
+package org.apache.harmony.print.internal.nls;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.harmony.kernel.vm.VM;
+
+/**
+ * This class retrieves strings from a resource bundle and returns them,
+ * formatting them with MessageFormat when required.
+ * <p>
+ * It is used by the system classes to provide national language support, by
+ * looking up messages in the <code>
+ *    org.apache.harmony.luni.internal.nls.messages
+ * </code> resource bundle. Note that if this file is
+ * not available, or an invalid key is looked up, or resource bundle support is
+ * not available, the key itself will be returned as the associated message.
+ * This means that the <em>KEY</em> should a reasonable human-readable (english)
+ * string.
+ * 
+ */
+public class Messages {
+
+    // ResourceBundle holding the system messages.
+    static private ResourceBundle bundle = null;
+
+    /**
+     * Retrieves a message which has no arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg) {
+        if (bundle == null)
+            return msg;
+        try {
+            return bundle.getString(msg);
+        } catch (MissingResourceException e) {
+            return "Missing message: " + msg; //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * Retrieves a message which takes 1 argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            Object the object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg) {
+        return getString(msg, new Object[] { arg });
+    }
+
+    /**
+     * Retrieves a message which takes 1 integer argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            int the integer to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, int arg) {
+        return getString(msg, new Object[] { Integer.toString(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 1 character argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            char the character to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, char arg) {
+        return getString(msg, new Object[] { String.valueOf(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 2 arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg1
+     *            Object an object to insert in the formatted output.
+     * @param arg2
+     *            Object another object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg1, Object arg2) {
+        return getString(msg, new Object[] { arg1, arg2 });
+    }
+
+    /**
+     * Retrieves a message which takes several arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param args
+     *            Object[] the objects to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object[] args) {
+        String format = msg;
+
+        if (bundle != null) {
+            try {
+                format = bundle.getString(msg);
+            } catch (MissingResourceException e) {
+            }
+        }
+
+        return format(format, args);
+    }
+
+    /**
+     * Generates a formatted text string given a source string containing
+     * "argument markers" of the form "{argNum}" where each argNum must be in
+     * the range 0..9. The result is generated by inserting the toString of each
+     * argument into the position indicated in the string.
+     * <p>
+     * To insert the "{" character into the output, use a single backslash
+     * character to escape it (i.e. "\{"). The "}" character does not need to be
+     * escaped.
+     * 
+     * @param format
+     *            String the format to use when printing.
+     * @param args
+     *            Object[] the arguments to use.
+     * @return String the formatted message.
+     */
+    public static String format(String format, Object[] args) {
+        StringBuilder answer = new StringBuilder(format.length()
+                + (args.length * 20));
+        String[] argStrings = new String[args.length];
+        for (int i = 0; i < args.length; ++i) {
+            if (args[i] == null)
+                argStrings[i] = "<null>"; //$NON-NLS-1$
+            else
+                argStrings[i] = args[i].toString();
+        }
+        int lastI = 0;
+        for (int i = format.indexOf('{', 0); i >= 0; i = format.indexOf('{',
+                lastI)) {
+            if (i != 0 && format.charAt(i - 1) == '\\') {
+                // It's escaped, just print and loop.
+                if (i != 1)
+                    answer.append(format.substring(lastI, i - 1));
+                answer.append('{');
+                lastI = i + 1;
+            } else {
+                // It's a format character.
+                if (i > format.length() - 3) {
+                    // Bad format, just print and loop.
+                    answer.append(format.substring(lastI, format.length()));
+                    lastI = format.length();
+                } else {
+                    int argnum = (byte) Character.digit(format.charAt(i + 1),
+                            10);
+                    if (argnum < 0 || format.charAt(i + 2) != '}') {
+                        // Bad format, just print and loop.
+                        answer.append(format.substring(lastI, i + 1));
+                        lastI = i + 1;
+                    } else {
+                        // Got a good one!
+                        answer.append(format.substring(lastI, i));
+                        if (argnum >= argStrings.length)
+                            answer.append("<missing argument>"); //$NON-NLS-1$
+                        else
+                            answer.append(argStrings[argnum]);
+                        lastI = i + 3;
+                    }
+                }
+            }
+        }
+        if (lastI < format.length())
+            answer.append(format.substring(lastI, format.length()));
+        return answer.toString();
+    }
+
+    /**
+     * Changes the locale of the messages.
+     * 
+     * @param locale
+     *            Locale the locale to change to.
+     */
+    static public ResourceBundle setLocale(final Locale locale,
+            final String resource) {
+        try {
+            final ClassLoader loader = VM.bootCallerClassLoader();
+            return (ResourceBundle) AccessController
+                    .doPrivileged(new PrivilegedAction<Object>() {
+                        public Object run() {
+                            return ResourceBundle.getBundle(resource, locale,
+                                    loader != null ? loader : ClassLoader
+                                            .getSystemClassLoader());
+                        }
+                    });
+        } catch (MissingResourceException e) {
+        }
+        return null;
+    }
+
+    static {
+        // Attempt to load the messages.
+        try {
+            bundle = setLocale(Locale.getDefault(),
+                    "org.apache.harmony.print.internal.nls.messages"); //$NON-NLS-1$
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/messages.properties?rev=967044&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/messages.properties (added)
+++ harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/messages.properties Fri Jul 23 11:11:29 2010
@@ -0,0 +1,75 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+# messages for EN locale
+print.00=Argument is null
+print.01=Wrong type of print data
+print.02=Services list is null
+print.03=Service list is empty
+print.04=Attribute set is null
+print.05=Default service is absent in the services list
+print.06=Unmodifiable attribute set
+print.07=Null attribute set
+print.08={0} is not interface Attribute or it's subinterface
+print.09={0} doesn't implement {1}
+print.0A=Null attribute 
+print.0B=object is not an instance of {0}
+print.0C={0} is not equal to the category of the attribute {1}
+print.0D=NUll attribute interface
+print.0E=Value {0} not in valid range ({1})
+print.0F=CrossFeedResolution is less than 1
+print.10=Feed resolution is less than 1
+print.11=Units is less than 1
+print.12=Value {0} is less than 0
+print.13=Lower bound is less than 0
+print.14={0} is out of int range
+print.15=int[][] array has null element
+print.16=Only array of length-1 or length-2 arrays of ints are valid
+print.17=Valid values are not less than 0
+print.18=Valid values are x>=0, y>=0, units>=1
+print.19=VAlid values are x>=0.0, y>=0.0, units>=1
+print.1A=Value {0} is less than 1
+print.1B=Null range
+print.1C=Lower bound {0} is less than 1
+print.1D=Null range: lowerBound > upperBound
+print.1F=Null JobStateReason
+print.20=x > y
+print.21=Valid values are: x > 0, y > 0, units >=1
+print.22=Null int [][] parameter
+print.23=Zero-length array
+print.24=valid values are not less than 1
+print.25=null string parameter
+print.26=Reason is null
+print.27=Severity is null
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Propchange: harmony/enhanced/java/trunk/classlib/modules/print/src/main/java/common/org/apache/harmony/print/internal/nls/messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message