diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java index 96ff4344616..c60f657b140 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java @@ -58,7 +58,7 @@ public class QueryNodeParseException extends QueryNodeException { public void setQuery(CharSequence query) { this.query = query; this.message = new MessageImpl( - QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, new Object[] {query, ""}); + QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, ""); } public CharSequence getQuery() { diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java index bf521a1ffcd..9cae3ac0d68 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java @@ -175,9 +175,9 @@ public class QueryTreeBuilder implements QueryBuilder { if (builder == null) { throw new QueryNodeException(new MessageImpl( - QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, new Object[]{node + QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, node .toQueryString(new EscapeQuerySyntaxImpl()), node.getClass() - .getName()})); + .getName())); } diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java index 10ef229c3e3..7c7156b0c8c 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java @@ -51,7 +51,7 @@ public class BoostQueryNode extends QueryNodeImpl { public BoostQueryNode(QueryNode query, float value) throws QueryNodeException { if (query == null) { throw new QueryNodeError(new MessageImpl( - QueryParserMessages.NODE_ACTION_NOT_SUPPORTED, new Object[]{"query", "null"})); + QueryParserMessages.NODE_ACTION_NOT_SUPPORTED, "query", "null")); } this.value = value; diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java index a8a4e9b86cc..14ae263d1ce 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java @@ -42,7 +42,7 @@ public class GroupQueryNode extends QueryNodeImpl { public GroupQueryNode(QueryNode query) { if (query == null) { throw new QueryNodeError(new MessageImpl( - QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, new Object[]{"query", "null"})); + QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, "query", "null")); } allocate(); diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java index ecabf99c3f8..9faff8d2e76 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java @@ -94,7 +94,7 @@ public class ModifierQueryNode extends QueryNodeImpl { public ModifierQueryNode(QueryNode query, Modifier mod) { if (query == null) { throw new QueryNodeError(new MessageImpl( - QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, new Object[]{"query", "null"})); + QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, "query", "null")); } allocate(); diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/PhraseSlopQueryNode.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/PhraseSlopQueryNode.java index 850462691e6..75f388fca67 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/PhraseSlopQueryNode.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/PhraseSlopQueryNode.java @@ -40,7 +40,7 @@ public class PhraseSlopQueryNode extends QueryNodeImpl implements FieldableNode throws QueryNodeException { if (query == null) { throw new QueryNodeError(new MessageImpl( - QueryParserMessages.NODE_ACTION_NOT_SUPPORTED, new Object[]{"query", "null"})); + QueryParserMessages.NODE_ACTION_NOT_SUPPORTED, "query", "null")); } this.value = value; diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ProximityQueryNode.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ProximityQueryNode.java index b8bdb8d79e5..c886d992641 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ProximityQueryNode.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ProximityQueryNode.java @@ -109,8 +109,8 @@ public class ProximityQueryNode extends BooleanQueryNode { if (type == Type.NUMBER) { if (distance <= 0) { throw new QueryNodeError(new MessageImpl( - QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, new Object[]{"distance", - distance})); + QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, "distance", + distance)); } else { this.distance = distance; diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/SlopQueryNode.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/SlopQueryNode.java index 5e57fe0f2e2..2b1a6a2b29c 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/SlopQueryNode.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/SlopQueryNode.java @@ -47,7 +47,7 @@ public class SlopQueryNode extends QueryNodeImpl implements FieldableNode { public SlopQueryNode(QueryNode query, int value) { if (query == null) { throw new QueryNodeError(new MessageImpl( - QueryParserMessages.NODE_ACTION_NOT_SUPPORTED, new Object[]{"query", "null"})); + QueryParserMessages.NODE_ACTION_NOT_SUPPORTED, "query", "null")); } this.value = value; diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/BooleanQueryNodeBuilder.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/BooleanQueryNodeBuilder.java index 3065c47604c..bcd2c2f8a6f 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/BooleanQueryNodeBuilder.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/BooleanQueryNodeBuilder.java @@ -67,9 +67,9 @@ public class BooleanQueryNodeBuilder implements StandardQueryBuilder { } catch (TooManyClauses ex) { throw new QueryNodeException(new MessageImpl( - QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, new Object[]{BooleanQuery + QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery .getMaxClauseCount(), queryNode - .toQueryString(new EscapeQuerySyntaxImpl())}), ex); + .toQueryString(new EscapeQuerySyntaxImpl())), ex); } diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchAllDocsQueryNodeBuilder.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchAllDocsQueryNodeBuilder.java index 090b7c16696..3b4cdb28a45 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchAllDocsQueryNodeBuilder.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchAllDocsQueryNodeBuilder.java @@ -40,9 +40,9 @@ public class MatchAllDocsQueryNodeBuilder implements StandardQueryBuilder { // validates node if (!(queryNode instanceof MatchAllDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( - QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, new Object[]{queryNode + QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .toQueryString(new EscapeQuerySyntaxImpl()), queryNode.getClass() - .getName()})); + .getName())); } return new MatchAllDocsQuery(); diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchNoDocsQueryNodeBuilder.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchNoDocsQueryNodeBuilder.java index 653f270d383..fb2c95cbbcf 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchNoDocsQueryNodeBuilder.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/MatchNoDocsQueryNodeBuilder.java @@ -40,9 +40,9 @@ public class MatchNoDocsQueryNodeBuilder implements StandardQueryBuilder { // validates node if (!(queryNode instanceof MatchNoDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( - QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, new Object[]{queryNode + QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .toQueryString(new EscapeQuerySyntaxImpl()), queryNode.getClass() - .getName()})); + .getName())); } return new BooleanQuery(); diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/StandardBooleanQueryNodeBuilder.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/StandardBooleanQueryNodeBuilder.java index f432ffa580c..312728690f2 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/StandardBooleanQueryNodeBuilder.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/StandardBooleanQueryNodeBuilder.java @@ -68,9 +68,9 @@ public class StandardBooleanQueryNodeBuilder implements StandardQueryBuilder { } catch (TooManyClauses ex) { throw new QueryNodeException(new MessageImpl( - QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, new Object[]{BooleanQuery + QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery .getMaxClauseCount(), queryNode - .toQueryString(new EscapeQuerySyntaxImpl())}), ex); + .toQueryString(new EscapeQuerySyntaxImpl())), ex); } diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/EscapeQuerySyntaxImpl.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/EscapeQuerySyntaxImpl.java index 5cfb99bf910..5288502581f 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/EscapeQuerySyntaxImpl.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/EscapeQuerySyntaxImpl.java @@ -289,7 +289,7 @@ public class EscapeQuerySyntaxImpl implements EscapeQuerySyntax { return c - 'A' + 10; } else { throw new ParseException(new MessageImpl( - QueryParserMessages.INVALID_SYNTAX_ESCAPE_NONE_HEX_UNICODE, new Object[]{c})); + QueryParserMessages.INVALID_SYNTAX_ESCAPE_NONE_HEX_UNICODE, c)); } } diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java index 364b01b4294..46640907361 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java @@ -47,8 +47,8 @@ public class ParseException extends QueryNodeParseException { */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { - super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, new Object[]{initialise( - currentTokenVal, expectedTokenSequencesVal, tokenImageVal)})); + super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise( + currentTokenVal, expectedTokenSequencesVal, tokenImageVal))); this.currentToken = currentTokenVal; this.expectedTokenSequences = expectedTokenSequencesVal; this.tokenImage = tokenImageVal; @@ -59,7 +59,7 @@ public class ParseException extends QueryNodeParseException { } public ParseException() { - super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, new Object[]{"Error"})); + super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); } /** diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java index ff3a00e0886..fd6640cb863 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java @@ -68,7 +68,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserC throw tme; } catch (Error tme) { - Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, new Object[]{query, tme.getMessage()}); + Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage()); QueryNodeParseException e = new QueryNodeParseException(tme); e.setQuery(query); e.setNonLocalizedMessage(message); diff --git a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/AllowLeadingWildcardProcessor.java b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/AllowLeadingWildcardProcessor.java index 3814aa8e146..a3075e0eadf 100644 --- a/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/AllowLeadingWildcardProcessor.java +++ b/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/AllowLeadingWildcardProcessor.java @@ -74,8 +74,8 @@ public class AllowLeadingWildcardProcessor extends QueryNodeProcessorImpl { case '*': case '?': throw new QueryNodeException(new MessageImpl( - QueryParserMessages.LEADING_WILDCARD_NOT_ALLOWED, new Object[]{node - .toQueryString(new EscapeQuerySyntaxImpl())})); + QueryParserMessages.LEADING_WILDCARD_NOT_ALLOWED, node + .toQueryString(new EscapeQuerySyntaxImpl()))); } } diff --git a/src/java/org/apache/lucene/messages/MessageImpl.java b/src/java/org/apache/lucene/messages/MessageImpl.java index 14b3b506b9f..cf9e520862f 100644 --- a/src/java/org/apache/lucene/messages/MessageImpl.java +++ b/src/java/org/apache/lucene/messages/MessageImpl.java @@ -36,7 +36,7 @@ public class MessageImpl implements Message { } - public MessageImpl(String key, Object[] args) { + public MessageImpl(String key, Object... args) { this(key); this.arguments = args; } diff --git a/src/java/org/apache/lucene/messages/NLS.java b/src/java/org/apache/lucene/messages/NLS.java index 97a727db6da..f902e46ed21 100644 --- a/src/java/org/apache/lucene/messages/NLS.java +++ b/src/java/org/apache/lucene/messages/NLS.java @@ -45,8 +45,8 @@ import java.util.ResourceBundle; */ public class NLS { - private static Map/*>*/ bundles = new HashMap/*>*/( - 0); + private static Map> bundles = + new HashMap>(0); protected NLS() { // Do not instantiate @@ -66,7 +66,7 @@ public class NLS { } public static String getLocalizedMessage(String key, Locale locale, - Object[] args) { + Object... args) { String str = getLocalizedMessage(key, locale); if (args.length > 0) { @@ -76,7 +76,7 @@ public class NLS { return str; } - public static String getLocalizedMessage(String key, Object[] args) { + public static String getLocalizedMessage(String key, Object... args) { return getLocalizedMessage(key, Locale.getDefault(), args); } @@ -89,7 +89,7 @@ public class NLS { * @param clazz * where constants will reside */ - //@SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") protected static void initializeMessages(String bundleName, Class clazz) { try { load(clazz); @@ -105,8 +105,8 @@ public class NLS { // slow resource checking // need to loop thru all registered resource bundles - for (Iterator/**/ it = bundles.keySet().iterator(); it.hasNext();) { - Class/**/ clazz = (Class) bundles.get((String)it.next()); + for (Iterator it = bundles.keySet().iterator(); it.hasNext();) { + Class clazz = bundles.get(it.next()); ResourceBundle resourceBundle = ResourceBundle.getBundle(clazz.getName(), locale); if (resourceBundle != null) { @@ -126,14 +126,14 @@ public class NLS { /** * @param clazz */ - private static void load(Class/**/ clazz) { + private static void load(Class clazz) { final Field[] fieldArray = clazz.getDeclaredFields(); boolean isFieldAccessible = (clazz.getModifiers() & Modifier.PUBLIC) != 0; // build a map of field names to Field objects final int len = fieldArray.length; - Map/**/ fields = new HashMap/**/(len * 2); + Map fields = new HashMap(len * 2); for (int i = 0; i < len; i++) { fields.put(fieldArray[i].getName(), fieldArray[i]); loadfieldValue(fieldArray[i], isFieldAccessible, clazz); @@ -145,7 +145,7 @@ public class NLS { * @param isFieldAccessible */ private static void loadfieldValue(Field field, boolean isFieldAccessible, - Class/**/ clazz) { + Class clazz) { int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) @@ -168,7 +168,7 @@ public class NLS { * @param key * - Message Key */ - private static void validateMessage(String key, Class/**/ clazz) { + private static void validateMessage(String key, Class clazz) { // Test if the message is present in the resource bundle try { ResourceBundle resourceBundle = ResourceBundle.getBundle(clazz.getName(), @@ -192,7 +192,7 @@ public class NLS { /* * Make a class field accessible */ - //@SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") private static void makeAccessible(final Field field) { if (System.getSecurityManager() == null) { field.setAccessible(true); diff --git a/src/test/org/apache/lucene/messages/TestNLS.java b/src/test/org/apache/lucene/messages/TestNLS.java index 97a14ebd065..35e35a973f3 100644 --- a/src/test/org/apache/lucene/messages/TestNLS.java +++ b/src/test/org/apache/lucene/messages/TestNLS.java @@ -26,13 +26,13 @@ import junit.framework.TestCase; public class TestNLS extends TestCase { public void testMessageLoading() { Message invalidSyntax = new MessageImpl( - MessagesTestBundle.Q0001E_INVALID_SYNTAX, new Object[]{"XXX"}); + MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX"); assertEquals("Syntax Error: XXX", invalidSyntax.getLocalizedMessage()); } public void testMessageLoading_ja() { Message invalidSyntax = new MessageImpl( - MessagesTestBundle.Q0001E_INVALID_SYNTAX, new Object[]{"XXX"}); + MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX"); assertEquals("構文エラー: XXX", invalidSyntax .getLocalizedMessage(Locale.JAPANESE)); } @@ -43,7 +43,7 @@ public class TestNLS extends TestCase { assertEquals("Truncated unicode escape sequence.", message); message = NLS.getLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX, - new Object[]{"XXX"}); + "XXX"); assertEquals("Syntax Error: XXX", message); } @@ -54,7 +54,7 @@ public class TestNLS extends TestCase { assertEquals("切り捨てられたユニコード・エスケープ・シーケンス。", message); message = NLS.getLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX, - Locale.JAPANESE, new Object[]{"XXX"}); + Locale.JAPANESE, "XXX"); assertEquals("構文エラー: XXX", message); } @@ -66,7 +66,7 @@ public class TestNLS extends TestCase { assertEquals("Truncated unicode escape sequence.", message); message = NLS.getLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX, - locale, new Object[]{"XXX"}); + locale, "XXX"); assertEquals("Syntax Error: XXX", message); }