harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r441034 - in /incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java: java/util/logging/ org/apache/harmony/logging/internal/nls/
Date Thu, 07 Sep 2006 09:41:56 GMT
Author: smishura
Date: Thu Sep  7 02:41:54 2006
New Revision: 441034

URL: http://svn.apache.org/viewvc?view=rev&rev=441034
Log:
Apply patch for HARMONY-1331 ([classlib][internationalization]Internationalization of the
logging module)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/ErrorManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/FileHandler.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Level.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogRecord.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Logger.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LoggingPermission.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/SocketHandler.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/StreamHandler.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/ErrorManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/ErrorManager.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/ErrorManager.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/ErrorManager.java
Thu Sep  7 02:41:54 2006
@@ -90,14 +90,14 @@
             }
             synchronized (System.err) {
                 System.err.print(getClass().getName());
-                System.err.print(": Error Code - ");
+                System.err.print(": Error Code - "); //$NON-NLS-1$
                 System.err.print(errorCode);
                 if (message != null) {
-                    System.err.print(", Message - ");
+                    System.err.print(", Message - "); //$NON-NLS-1$
                     System.err.print(message);
                 }
                 if (exception != null) {
-                    System.err.print(", Exception - ");
+                    System.err.print(", Exception - "); //$NON-NLS-1$
                     exception.printStackTrace(System.err);
                 } else {
                     System.err.println();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/FileHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/FileHandler.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/FileHandler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/FileHandler.java
Thu Sep  7 02:41:54 2006
@@ -28,6 +28,8 @@
 import java.security.PrivilegedAction;
 import java.util.Hashtable;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * A <code>Handler</code> writes description of logging event into a specified
  * file or a rotating set of files.
@@ -247,7 +249,8 @@
         pattern = (null == p) ? getStringProperty(className + ".pattern", //$NON-NLS-1$
                 DEFAULT_PATTERN) : p;
         if (null == pattern || "".equals(pattern)) { //$NON-NLS-1$
-            throw new NullPointerException("Pattern cannot be empty"); //$NON-NLS-1$
+            // logging.19=Pattern cannot be empty
+            throw new NullPointerException(Messages.getString("logging.19")); //$NON-NLS-1$
         }
         append = (null == a) ? getBooleanProperty(className + ".append", //$NON-NLS-1$
                 DEFAULT_APPEND) : a.booleanValue();
@@ -272,7 +275,8 @@
             output = new MeasureOutputStream(new BufferedOutputStream(
                     new FileOutputStream(files[0])));
         } catch (FileNotFoundException e1) {
-            this.getErrorManager().error("Error happened when open log file.", //$NON-NLS-1$
+            // logging.1A=Error happened when open log file.
+            this.getErrorManager().error(Messages.getString("logging.1A"), //$NON-NLS-1$
                     e1, ErrorManager.OPEN_FAILURE);
         }
         setOutputStream(output);
@@ -412,10 +416,11 @@
      * 								
      */
     public FileHandler(String pattern) throws IOException {
-        if(null == pattern){ 
-            throw new NullPointerException("Pattern cannot be empty"); //$NON-NLS-1$
+        if(null == pattern){
+            // logging.19=Pattern cannot be empty
+            throw new NullPointerException(Messages.getString("logging.19")); //$NON-NLS-1$
         }
-        if("".equals(pattern)){
+        if("".equals(pattern)){ //$NON-NLS-1$
             throw new IllegalArgumentException();
         }
         init(pattern, null, new Integer(DEFAULT_LIMIT), new Integer(
@@ -447,7 +452,8 @@
 	 */
     public FileHandler(String pattern, boolean append) throws IOException {
         if(null == pattern || "".equals(pattern)){ //$NON-NLS-1$
-            throw new NullPointerException("Pattern cannot be empty"); //$NON-NLS-1$
+            // logging.19=Pattern cannot be empty
+            throw new NullPointerException(Messages.getString("logging.19")); //$NON-NLS-1$
         }        
         init(pattern, Boolean.valueOf(append), new Integer(DEFAULT_LIMIT),
                 new Integer(DEFAULT_COUNT));
@@ -483,11 +489,12 @@
      */
     public FileHandler(String pattern, int limit, int count) throws IOException {
         if(null == pattern || "".equals(pattern)){ //$NON-NLS-1$
-            throw new NullPointerException("Pattern cannot be empty"); //$NON-NLS-1$
+            // logging.19=Pattern cannot be empty
+            throw new NullPointerException(Messages.getString("logging.19")); //$NON-NLS-1$
         }        
         if (limit < 0 || count < 1) {
-            throw new IllegalArgumentException(
-                    "The limit and count property must larger than 0 and 1, respectively");
//$NON-NLS-1$
+            // logging.1B=The limit and count property must be larger than 0 and 1, respectively
+            throw new IllegalArgumentException(Messages.getString("logging.1B")); //$NON-NLS-1$
         }
         init(pattern, null, new Integer(limit), new Integer(count));
     }
@@ -527,11 +534,12 @@
     public FileHandler(String pattern, int limit, int count, boolean append)
             throws IOException {
         if(null == pattern || "".equals(pattern)){ //$NON-NLS-1$
-            throw new NullPointerException("Pattern cannot be empty"); //$NON-NLS-1$
+            // logging.19=Pattern cannot be empty
+            throw new NullPointerException(Messages.getString("logging.19")); //$NON-NLS-1$
         }        
         if (limit < 0 || count < 1) {
-            throw new IllegalArgumentException(
-                    "The limit and count property must larger than 0 and 1, respectively");
//$NON-NLS-1$
+            // logging.1B=The limit and count property must be larger than 0 and 1, respectively
+            throw new IllegalArgumentException(Messages.getString("logging.1B")); //$NON-NLS-1$
         }
         init(pattern, Boolean.valueOf(append), new Integer(limit), new Integer(
                 count));

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
Thu Sep  7 02:41:54 2006
@@ -21,6 +21,8 @@
 import java.security.PrivilegedExceptionAction;
 import java.io.UnsupportedEncodingException;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * A <code>Handler</code> object accepts a logging request and exports the
  * desired messages to a target, for example, a file, the console, etc. It can
@@ -118,7 +120,8 @@
 
     // print error message in some format
     void printInvalidPropMessage(String key, String value, Exception e) {
-        String msg = new StringBuffer().append("Invalid property value for ") //$NON-NLS-1$
+        // logging.12=Invalid property value for
+        String msg = new StringBuffer().append(Messages.getString("logging.12"))  //$NON-NLS-1$
                 .append(prefix).append(".").append(key).append(":").append( //$NON-NLS-1$//$NON-NLS-2$
                         value).toString();
         errorMan.error(msg, e, ErrorManager.GENERIC_FAILURE);
@@ -308,8 +311,10 @@
             if (Charset.isSupported(newEncoding)) {
                 this.encoding = newEncoding;
             } else {
-                throw new UnsupportedEncodingException("The encoding \"" //$NON-NLS-1$
-                        + newEncoding + "\" is not supported."); //$NON-NLS-1$
+                // logging.13=The encoding "{0}" is not supported.
+                throw new UnsupportedEncodingException(Messages.getString(
+                        "logging.13", //$NON-NLS-1$
+                        newEncoding));
             }
 
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Level.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Level.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Level.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Level.java
Thu Sep  7 02:41:54 2006
@@ -21,6 +21,8 @@
 import java.util.Map;
 import java.util.ResourceBundle;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * <code>Level</code> objects are used to indicate the level of logging. There
  * are a set of predefined logging levels, each associated with an integer
@@ -193,7 +195,8 @@
      */
     protected Level(String name, int level, String resourceBundleName) {
         if (null == name) {
-            throw new NullPointerException("The 'name' parameter is null."); //$NON-NLS-1$
+            // logging.1C=The 'name' parameter is null.
+            throw new NullPointerException(Messages.getString("logging.1C")); //$NON-NLS-1$
         }
         this.name = name;
         this.value = level;
@@ -255,7 +258,8 @@
      */
     public static final Level parse(String name) {
         if (null == name) {
-            throw new NullPointerException("The 'name' parameter is null."); //$NON-NLS-1$
+            // logging.1C=The 'name' parameter is null.
+            throw new NullPointerException(Messages.getString("logging.1C")); //$NON-NLS-1$
         }
         // Check if the name is a predefined one
         Level result = levels.get(name);
@@ -268,8 +272,9 @@
             result = new Level(name, v);
             return result;
         } catch (NumberFormatException e) {
-            throw new IllegalArgumentException("Cannot parse this name: " //$NON-NLS-1$
-                    + name);
+            // logging.1D=Cannot parse this name: {0}
+            throw new IllegalArgumentException(Messages.getString("logging.1D", //$NON-NLS-1$
+                    name));
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
Thu Sep  7 02:41:54 2006
@@ -30,6 +30,8 @@
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * <code>LogManager</code> is used to maintain configuration properties of the
  * logging framework, and to manage a hierarchical namespace of all named
@@ -148,10 +150,11 @@
     /**
      * <p>The String value of the {@link LoggingMXBean}'s ObjectName.</p>
      */
-    public static final String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging";
+    public static final String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging"; //$NON-NLS-1$
 
     public static LoggingMXBean getLoggingMXBean() {
-        throw new AssertionError("This method is not currently implemented.");
+        // logging.0=This method is not currently implemented.
+        throw new AssertionError(Messages.getString("logging.0")); //$NON-NLS-1$
     }
     /*
      * -------------------------------------------------------------------
@@ -288,14 +291,15 @@
 
     private void setLoggerLevel(Logger logger, String loggerName,
                                 boolean inherit) {
-        String configedLevel = getProperty(loggerName + ".level");
+        String configedLevel = getProperty(loggerName + ".level"); //$NON-NLS-1$
         if (null != configedLevel) {
             try {
                 logger.setLevel(Level.parse(configedLevel));
             } catch (IllegalArgumentException e) {
                 // Print invalid level setting to the screen
-                System.err.print("Invalid level name: " + configedLevel
-                        + ".");
+                // logging.1=Invalid level name: {0}.
+                System.err
+                        .print(Messages.getString("logging.1", configedLevel)); //$NON-NLS-1$
             }
         } else if (inherit) {
             logger.setLevel(null);
@@ -472,14 +476,14 @@
             String property = (String) enumeration.nextElement();
             if (property.endsWith(".level")) { //$NON-NLS-1$
                 String loggerName = property.substring(0,
-                        property.length() - ".level".length());
+                        property.length() - ".level".length()); //$NON-NLS-1$
                 Logger l = createLoggers?Logger.getLogger(loggerName):loggers.get(loggerName);
                 if (null != l) {
                     setLoggerLevel(l, loggerName, true);
                 }
             }else if(createLoggers && property.endsWith(".handlers")){ //$NON-NLS-1$
                 String loggerName = property.substring(0,
-                        property.length() - ".handlers".length());
+                        property.length() - ".handlers".length()); //$NON-NLS-1$
                 Logger.getLogger(loggerName);
                 //lazily load handlers because some of them are expensive
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogRecord.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogRecord.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogRecord.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogRecord.java
Thu Sep  7 02:41:54 2006
@@ -23,6 +23,8 @@
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * A <code>LogRecord</code> object represents a logging request. It is passed
  * between the logging framework and individual logging handlers. Client
@@ -176,7 +178,8 @@
      */
     public LogRecord(Level level, String msg) {
         if (null == level) {
-            throw new NullPointerException("The 'level' parameter is null."); //$NON-NLS-1$
+            // logging.4=The 'level' parameter is null.
+            throw new NullPointerException(Messages.getString("logging.4")); //$NON-NLS-1$
         }
         this.level = level;
         this.message = msg;
@@ -225,7 +228,8 @@
      */
     public void setLevel(Level level) {
         if (null == level) {
-            throw new NullPointerException("The 'level' parameter is null."); //$NON-NLS-1$
+            // logging.4=The 'level' parameter is null.
+            throw new NullPointerException(Messages.getString("logging.4")); //$NON-NLS-1$
         }
         this.level = level;
     }
@@ -501,7 +505,8 @@
         byte minor = in.readByte();
         //only check MAJOR version
         if (major != MAJOR) {
-            throw new IOException("Different version - " + major + "." + minor);  //$NON-NLS-1$//$NON-NLS-2$
+            // logging.5=Different version - {0}.{1}
+            throw new IOException(Messages.getString("logging.5", major, minor)); //$NON-NLS-1$

         }
         
         int length = in.readInt();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Logger.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Logger.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Logger.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Logger.java
Thu Sep  7 02:41:54 2006
@@ -25,6 +25,8 @@
 import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * Loggers are used to log records to certain outputs, including file, console,
  * etc. They use various handlers to actually do the output-dependent
@@ -285,9 +287,9 @@
                 // Failed to load using the current class's classloader, ignore
             }
         }
-        throw new MissingResourceException(
-                "Failed to load the specified resource bundle \"" //$NON-NLS-1$
-                        + resourceBundleName + "\".", resourceBundleName, null); //$NON-NLS-1$
+        // logging.8=Failed to load the specified resource bundle "{0}".
+        throw new MissingResourceException(Messages.getString("logging.8", //$NON-NLS-1$
+                resourceBundleName), resourceBundleName, null);  
     }
 
     /**
@@ -349,11 +351,11 @@
                  * are inconsistent with each other, i.e., different
                  * names
                  */
-                throw new IllegalArgumentException(
-                        "The specified resource bundle name \"" //$NON-NLS-1$
-                                + resourceBundleName
-                                + "\" is inconsistent with the existing one \"" //$NON-NLS-1$
-                                + l.getResourceBundleName() + "\"."); //$NON-NLS-1$
+                // logging.9=The specified resource bundle name "{0}" is 
+                // inconsistent with the existing one "{1}".
+                throw new IllegalArgumentException(Messages.getString(
+                        "logging.9", //$NON-NLS-1$
+                        resourceBundleName, l.getResourceBundleName())); 
             }
         }
     }
@@ -422,7 +424,8 @@
      */
     public synchronized void addHandler(Handler handler) {
         if (null == handler) {
-            throw new NullPointerException("The 'handler' parameter is null."); //$NON-NLS-1$
+            // logging.A=The 'handler' parameter is null.
+            throw new NullPointerException(Messages.getString("logging.A")); //$NON-NLS-1$
         }
         // Anonymous loggers can always add handlers
         if (this.isNamed) {
@@ -439,7 +442,7 @@
               return;
           }
           handlers = new ArrayList<Handler>();
-          String handlerStr = manager.getProperty("".equals(name)?"handlers":name+".handlers");
//$NON-NLS-1$
+          String handlerStr = manager.getProperty("".equals(name)?"handlers":name+".handlers");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
           if (null == handlerStr) {
               return;
           }
@@ -613,7 +616,8 @@
      */
     public synchronized void setParent(Logger parent) {
         if (null == parent) {
-            throw new NullPointerException("The 'parent' parameter is null."); //$NON-NLS-1$
+            // logging.B=The 'parent' parameter is null.
+            throw new NullPointerException(Messages.getString("logging.B")); //$NON-NLS-1$
         }
         // even anonymous loggers are checked
         LogManager.getLogManager().checkAccess();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LoggingPermission.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LoggingPermission.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LoggingPermission.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LoggingPermission.java
Thu Sep  7 02:41:54 2006
@@ -20,6 +20,8 @@
 import java.security.BasicPermission;
 import java.security.Guard;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * The permission required to control the logging when run with a
  * <code>SecurityManager</code>.
@@ -51,11 +53,12 @@
     public LoggingPermission(String name, String actions) {
         super(name, actions);
         if (!"control".equals(name)) { //$NON-NLS-1$
-            throw new IllegalArgumentException("Name must be \"control\"."); //$NON-NLS-1$
+            // logging.6=Name must be "control".
+            throw new IllegalArgumentException(Messages.getString("logging.6")); //$NON-NLS-1$
         }
         if (null != actions && !"".equals(actions)) { //$NON-NLS-1$
-            throw new IllegalArgumentException(
-                    "Actions must be either null or the empty string."); //$NON-NLS-1$
+            // logging.7=Actions must be either null or the empty string.
+            throw new IllegalArgumentException(Messages.getString("logging.7")); //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
Thu Sep  7 02:41:54 2006
@@ -19,6 +19,8 @@
 import java.security.AccessController;
 import java.security.PrivilegedExceptionAction;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 
 /**
  * A <code>Handler</code> put the description of log events into a cycled memory

@@ -118,8 +120,9 @@
             });
             target = (Handler) targetClass.newInstance();
         } catch (Exception e) {
-            throw new RuntimeException("Cannot load target handler:" //$NON-NLS-1$
-                    + targetName);
+            // logging.10=Cannot load target handler:{0}
+            throw new RuntimeException(Messages.getString("logging.10", //$NON-NLS-1$
+                    targetName));
         }
         //init size
         String sizeString = manager.getProperty(className+".size"); //$NON-NLS-1$
@@ -162,7 +165,8 @@
      */
     public MemoryHandler(Handler target, int size, Level pushLevel) {
         if (size <= 0) {
-            throw new IllegalArgumentException("Size must be positive."); //$NON-NLS-1$
+            // logging.11=Size must be positive.
+            throw new IllegalArgumentException(Messages.getString("logging.11")); //$NON-NLS-1$
         }
         target.getLevel();
         pushLevel.intValue();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/SocketHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/SocketHandler.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/SocketHandler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/SocketHandler.java
Thu Sep  7 02:41:54 2006
@@ -20,6 +20,8 @@
 import java.io.BufferedOutputStream;
 import java.io.IOException;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * A handler that writes log messages to a socket connection.
  * <p>
@@ -135,24 +137,27 @@
     private void initSocket(String host, String port) throws IOException {
         // check the validity of the host name
         if (null == host || "".equals(host)) { //$NON-NLS-1$
-            throw new IllegalArgumentException("Illegal host argument."); //$NON-NLS-1$
+            // logging.C=Illegal host argument.
+            throw new IllegalArgumentException(Messages.getString("logging.C")); //$NON-NLS-1$
         }
         // check the validity of the port number
         int p = 0;
         try {
             p = Integer.parseInt(port);
         } catch (NumberFormatException e) {
-            throw new IllegalArgumentException("Illegal port argument."); //$NON-NLS-1$
+            // logging.D=Illegal port argument.
+            throw new IllegalArgumentException(Messages.getString("logging.D")); //$NON-NLS-1$
         }
         if (p <= 0) {
-            throw new IllegalArgumentException("Illegal port argument."); //$NON-NLS-1$
+            // logging.D=Illegal port argument.
+            throw new IllegalArgumentException(Messages.getString("logging.D")); //$NON-NLS-1$
         }
         // establish the network connection
         try {
             this.socket = new Socket(host, p);
         } catch (IOException e) {
-            getErrorManager().error(
-                    "Failed to establish the network connection.", e, //$NON-NLS-1$
+            // logging.E=Failed to establish the network connection.
+            getErrorManager().error(Messages.getString("logging.E"), e, //$NON-NLS-1$
                     ErrorManager.OPEN_FAILURE);
             throw e;
         }
@@ -175,8 +180,8 @@
 	            this.socket = null;
             }
         } catch (Exception e) {
-            getErrorManager().error(
-                    "Exception occured when closing the socket handler.", e, //$NON-NLS-1$
+            // logging.F=Exception occured when closing the socket handler.
+            getErrorManager().error(Messages.getString("logging.F"), e, //$NON-NLS-1$
                     ErrorManager.CLOSE_FAILURE);
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/StreamHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/StreamHandler.java?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/StreamHandler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/StreamHandler.java
Thu Sep  7 02:41:54 2006
@@ -21,6 +21,8 @@
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 
+import org.apache.harmony.logging.internal.nls.Messages;
+
 /**
  * A <code>StreamHandler</code> object writes log messages to an output
  * stream, that is, objects of the class <code>java.io.OutputStream</code>.
@@ -121,10 +123,12 @@
     public StreamHandler(OutputStream os, Formatter formatter) {
         this();
         if (os == null) {
-            throw new NullPointerException("The OutputStream parameter is null");
+            // logging.2=The OutputStream parameter is null
+            throw new NullPointerException(Messages.getString("logging.2")); //$NON-NLS-1$
         }
         if (formatter == null) {
-            throw new NullPointerException("The Formatter parameter is null.");
+            // logging.3=The Formatter parameter is null.
+            throw new NullPointerException(Messages.getString("logging.3")); //$NON-NLS-1$
         }
         this.os = os;
         internalSetFormatter(formatter);
@@ -159,8 +163,8 @@
         try {
             this.writer.write(s);
         } catch (Exception e) {
-            getErrorManager().error(
-                    "Exception occurred when writing to the output stream.", e, //$NON-NLS-1$
+            // logging.14=Exception occurred when writing to the output stream.
+            getErrorManager().error(Messages.getString("logging.14"), e, //$NON-NLS-1$
                     ErrorManager.WRITE_FAILURE);
         }
     }
@@ -253,8 +257,8 @@
 	                this.os = null;
                 }
             } catch (Exception e) {
-                getErrorManager().error(
-                        "Exception occurred when closing the output stream.", e, //$NON-NLS-1$
+                // logging.15=Exception occurred when closing the output stream.
+                getErrorManager().error(Messages.getString("logging.15"), e, //$NON-NLS-1$
                         ErrorManager.CLOSE_FAILURE);
             }
         }
@@ -287,8 +291,8 @@
                     this.os.flush();
                 }
             } catch (Exception e) {
-                getErrorManager().error(
-                        "Exception occurred while flushing the output stream.", //$NON-NLS-1$
+                // logging.16=Exception occurred while flushing the output stream.
+                getErrorManager().error(Messages.getString("logging.16"), //$NON-NLS-1$
                         e, ErrorManager.FLUSH_FAILURE);
             }
         }
@@ -321,16 +325,15 @@
                 try {
                     msg = getFormatter().format(record);
                 } catch (Exception e) {
-                    getErrorManager()
-                            .error(
-                                    "Exception occurred while formatting the log record.",
//$NON-NLS-1$
-                                    e, ErrorManager.FORMAT_FAILURE);
+                    // logging.17=Exception occurred while formatting the log record.
+                    getErrorManager().error(Messages.getString("logging.17"), //$NON-NLS-1$
+                            e, ErrorManager.FORMAT_FAILURE);
                 }
                 write(msg);
             }
         } catch (Exception e) {
-            getErrorManager().error(
-                    "Exception occurred while logging the record.", e, //$NON-NLS-1$
+            // logging.18=Exception occurred while logging the record.
+            getErrorManager().error(Messages.getString("logging.18"), e, //$NON-NLS-1$
                     ErrorManager.GENERIC_FAILURE);
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties?view=diff&rev=441034&r1=441033&r2=441034
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties
Thu Sep  7 02:41:54 2006
@@ -14,3 +14,33 @@
 # 
 
 # messages for EN locale
+logging.0=This method is not currently implemented.
+logging.1=Invalid level name: {0}.
+logging.10=Cannot load target handler:{0}
+logging.11=Size must be positive.
+logging.12=Invalid property value for 
+logging.13=The encoding "{0}" is not supported.
+logging.14=Exception occurred when writing to the output stream.
+logging.15=Exception occurred when closing the output stream.
+logging.16=Exception occurred while flushing the output stream.
+logging.17=Exception occurred while formatting the log record.
+logging.18=Exception occurred while logging the record.
+logging.19=Pattern cannot be empty
+logging.1A=Error happened when open log file.
+logging.1B=The limit and count property must be larger than 0 and 1, respectively
+logging.1C=The 'name' parameter is null.
+logging.1D=Cannot parse this name: {0}
+logging.2=The OutputStream parameter is null
+logging.3=The Formatter parameter is null.
+logging.4=The 'level' parameter is null.
+logging.5=Different version - {0}.{1}
+logging.6=Name must be "control".
+logging.7=Actions must be either null or the empty string.
+logging.8=Failed to load the specified resource bundle "{0}".
+logging.9=The specified resource bundle name "{0}" is inconsistent with the existing one
"{1}".
+logging.A=The 'handler' parameter is null.
+logging.B=The 'parent' parameter is null.
+logging.C=Illegal host argument.
+logging.D=Illegal port argument.
+logging.E=Failed to establish the network connection.
+logging.F=Exception occured when closing the socket handler.



Mime
View raw message