diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2012-01-29 13:05:07 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2012-01-29 13:05:07 +0000 |
| commit | 22b64fd33e448ffc54134b28c7226342f54b4683 (patch) | |
| tree | 89a27bba6ddb8674b02a810775cfb148d6de8d67 /java/broker/src/velocity | |
| parent | 9bb75aae85d397bd9dd98c8230de3e576ce97572 (diff) | |
| download | qpid-python-22b64fd33e448ffc54134b28c7226342f54b4683.tar.gz | |
QPID-3789 : [Java] code tidyups
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1237273 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src/velocity')
| -rw-r--r-- | java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java | 33 | ||||
| -rw-r--r-- | java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm | 10 |
2 files changed, 26 insertions, 17 deletions
diff --git a/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java b/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java index a39799a6b6..a10d3b6a77 100644 --- a/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java +++ b/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java @@ -68,8 +68,7 @@ public class GenerateLogMessages } catch (InvalidTypeException e) { - // This occurs when a type other than 'number' appears in the - // paramater config {0, number...} + // This occurs when a type other than 'number' appears in the paramater config {0, number...}. System.err.println(e.getMessage()); System.exit(-1); } @@ -365,9 +364,9 @@ public class GenerateLogMessages // Taking an example of: // 'Text {n,type,format} [option] text {m} [option with param{p}] more' // This would give us: - // 0 - Text {n,type,format} - // 1 - option] text {m} - // 2 - option with param{p}] more + // 0 - Text {n,type,format}. + // 1 - option] text {m}. + // 2 - option with param{p}] more. // Create the parameter list for this item List<HashMap<String, String>> options = new LinkedList<HashMap<String, String>>(); @@ -442,17 +441,20 @@ public class GenerateLogMessages String[] parametersString = logMessage.split("\\{"); // Taking an example of 'Text {n[,type]} text {m} more text {p}' // This would give us: - // 0 - Text - // 1 - n[,type]} text - // 2 - m} more text - // 3 - p} + // 0 - Text. + // 1 - n[,type]} text. + // 2 - m} more text. + // 3 - p}. // Create the parameter list for this item List<HashMap<String, String>> parameters = new LinkedList<HashMap<String, String>>(); - // Check that we have some parameters to process - // Skip 0 as that will not be the first entry - // Text {n[,type]} text {m} more text {p} + /* + Check that we have some parameters to process + Skip 0 as that will not be the first entry + Text {n[,type]} text {m} more text {p}. + */ + if (parametersString.length > 1) { for (int index = 1; index < parametersString.length; index++) @@ -461,8 +463,11 @@ public class GenerateLogMessages // for easy retrieval in the macro template HashMap<String, String> parameter = new HashMap<String, String>(); - // Check for any properties of the parameter : - // e.g. {0} vs {0,number} vs {0,number,xxxx} + /* + Check for any properties of the parameter : + e.g. {0} vs {0,number} vs {0,number,xxxx}. + */ + int typeIndex = parametersString[index].indexOf(","); // The parameter type diff --git a/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm b/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm index fd847fd513..02bf155c44 100644 --- a/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm +++ b/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm @@ -43,8 +43,8 @@ import java.util.ResourceBundle; */ public class ${type.name}Messages { - static ResourceBundle _messages; - static Locale _currentLocale; + private static ResourceBundle _messages; + private static Locale _currentLocale; public static final String ${type.name.toUpperCase()}_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "${type.name.toLowerCase()}"; #foreach( $message in ${type.list} ) @@ -146,7 +146,7 @@ public class ${type.name}Messages ## append it to the log. #foreach($option in ${message.options}) - // Add Option : ${option.value} + // Add Option : ${option.value}. end = parts[${velocityCount}].indexOf(']'); if (${option.name}) { @@ -197,4 +197,8 @@ public class ${type.name}Messages #end + private ${type.name}Messages() + { + } + } |
