logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1580771 - in /logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message: LocalizedMessage.java LocalizedMessageFactory.java
Date Mon, 24 Mar 2014 06:30:54 GMT
Author: ggregory
Date: Mon Mar 24 06:30:53 2014
New Revision: 1580771

URL: http://svn.apache.org/r1580771
Log:
Better internal names.

Modified:
    logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
    logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java

Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java?rev=1580771&r1=1580770&r2=1580771&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
Mon Mar 24 06:30:53 2014
@@ -47,7 +47,7 @@ public class LocalizedMessage implements
     private transient StatusLogger logger = StatusLogger.getLogger();
 
     private String loggerName;
-    private String messagePattern;
+    private String key;
     private String[] stringArgs;
     private transient Object[] argArray;
     private String formattedMessage;
@@ -72,7 +72,7 @@ public class LocalizedMessage implements
     }
 
     public LocalizedMessage(final String baseName, final Locale locale, final String key,
final Object[] arguments) {
-        this.messagePattern = key;
+        this.key = key;
         this.argArray = arguments;
         this.throwable = null;
         this.baseName = baseName;
@@ -82,7 +82,7 @@ public class LocalizedMessage implements
 
     public LocalizedMessage(final ResourceBundle bundle, final Locale locale, final String
key,
                             final Object[] arguments) {
-        this.messagePattern = key;
+        this.key = key;
         this.argArray = arguments;
         this.throwable = null;
         this.baseName = null;
@@ -179,9 +179,9 @@ public class LocalizedMessage implements
                 bundle = getResourceBundle(loggerName, locale, true);
             }
         }
-        final String messagePattern = getFormat();
-        final String msgPattern = (bundle == null || !bundle.containsKey(messagePattern))
?
-            messagePattern : bundle.getString(messagePattern);
+        final String myKey = getFormat();
+        final String msgPattern = (bundle == null || !bundle.containsKey(myKey)) ?
+            myKey : bundle.getString(myKey);
         final Object[] array = argArray == null ? stringArgs : argArray;
         final FormattedMessage msg = new FormattedMessage(msgPattern, array);
         formattedMessage = msg.getFormattedMessage();
@@ -191,7 +191,7 @@ public class LocalizedMessage implements
 
     @Override
     public String getFormat() {
-        return messagePattern;
+        return key;
     }
 
     @Override
@@ -256,7 +256,7 @@ public class LocalizedMessage implements
         out.defaultWriteObject();
         getFormattedMessage();
         out.writeUTF(formattedMessage);
-        out.writeUTF(messagePattern);
+        out.writeUTF(key);
         out.writeUTF(baseName);
         out.writeInt(argArray.length);
         stringArgs = new String[argArray.length];
@@ -271,7 +271,7 @@ public class LocalizedMessage implements
     private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException
{
         in.defaultReadObject();
         formattedMessage = in.readUTF();
-        messagePattern = in.readUTF();
+        key = in.readUTF();
         baseName = in.readUTF();
         final int length = in.readInt();
         stringArgs = (String[]) in.readObject();

Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java?rev=1580771&r1=1580770&r2=1580771&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java
Mon Mar 24 06:30:53 2014
@@ -66,17 +66,17 @@ public class LocalizedMessageFactory ext
     /**
      * Creates {@link org.apache.logging.log4j.message.StringFormattedMessage} instances.
      *
-     * @param message The message format String.
-     * @param params The parameters for the message.
+     * @param key The key String, used as a message if the key is absent.
+     * @param params The parameters for the message at the given key.
      * @return The Message.
      *
      * @see org.apache.logging.log4j.message.MessageFactory#newMessage(String, Object...)
      */
     @Override
-    public Message newMessage(final String message, final Object... params) {
+    public Message newMessage(final String key, final Object... params) {
         if (resourceBundle == null) {
-            return new LocalizedMessage(baseName,  message, params);
+            return new LocalizedMessage(baseName,  key, params);
         }
-        return new LocalizedMessage(resourceBundle, message, params);
+        return new LocalizedMessage(resourceBundle, key, params);
     }
 }



Mime
View raw message