jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r801565 [1/2] - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query: ./ lucene/ lucene/join/
Date Thu, 06 Aug 2009 09:32:42 GMT
Author: mreutegg
Date: Thu Aug  6 09:32:38 2009
New Revision: 801565

URL: http://svn.apache.org/viewvc?rev=801565&view=rev
Log:
JCR-2087: Upgrade to Java 5 as the base platform

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildNodesQueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocNumberCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FileBasedNamespaceMappings.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationEntityResolver.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueStore.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NamePathResolverImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeTraversingQueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ParentAxisQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PerQueryCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PropertiesSynonymProvider.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimpleExcerptProvider.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/TermDocsCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WeightedHighlighter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardTermEnum.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/AncestorNodeJoin.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ChildNodeJoin.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/DescendantNodeJoin.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/EquiJoin.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ParentNodeJoin.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ScoreNodeMap.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java Thu Aug  6 09:32:38 2009
@@ -66,7 +66,8 @@
         }
     };
 
-    protected static final Map INSTANCES = new HashMap();
+    protected static final Map<String, OnWorkspaceInconsistency> INSTANCES
+            = new HashMap<String, OnWorkspaceInconsistency>();
 
     static {
         INSTANCES.put(FAIL.name, FAIL);
@@ -79,6 +80,8 @@
 
     /**
      * Protected constructor.
+     *
+     * @param name a unique name for this handler.
      */
     protected OnWorkspaceInconsistency(String name) {
         this.name = name;
@@ -103,7 +106,7 @@
      */
     public static OnWorkspaceInconsistency fromString(String name)
             throws IllegalArgumentException {
-        OnWorkspaceInconsistency handler = (OnWorkspaceInconsistency) INSTANCES.get(name.toLowerCase());
+        OnWorkspaceInconsistency handler = INSTANCES.get(name.toLowerCase());
         if (handler == null) {
             throw new IllegalArgumentException("Unknown name: " + name);
         } else {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java Thu Aug  6 09:32:38 2009
@@ -53,7 +53,7 @@
     private final NodeTypeRegistry registry;
 
     /** Property Name to TypeMapping[] mapping */
-    private final Map typeMapping = new HashMap();
+    private final Map<Name, TypeMapping[]> typeMapping = new HashMap<Name, TypeMapping[]>();
 
     /**
      * Creates a new <code>PropertyTypeRegistry</code> instance. This instance
@@ -75,7 +75,7 @@
      */
     public TypeMapping[] getPropertyTypes(Name propName) {
         synchronized (typeMapping) {
-            TypeMapping[] types = (TypeMapping[]) typeMapping.get(propName);
+            TypeMapping[] types = typeMapping.get(propName);
             if (types != null) {
                 return types;
             } else {
@@ -89,12 +89,12 @@
             NodeTypeDef def = registry.getNodeTypeDef(ntName);
             PropDef[] propDefs = def.getPropertyDefs();
             synchronized (typeMapping) {
-                for (int i = 0; i < propDefs.length; i++) {
-                    int type = propDefs[i].getRequiredType();
-                    if (!propDefs[i].definesResidual() && type != PropertyType.UNDEFINED) {
-                        Name name = propDefs[i].getName();
+                for (PropDef propDef : propDefs) {
+                    int type = propDef.getRequiredType();
+                    if (!propDef.definesResidual() && type != PropertyType.UNDEFINED) {
+                        Name name = propDef.getName();
                         // only remember defined property types
-                        TypeMapping[] types = (TypeMapping[]) typeMapping.get(name);
+                        TypeMapping[] types = typeMapping.get(name);
                         if (types == null) {
                             types = new TypeMapping[1];
                         } else {
@@ -102,7 +102,7 @@
                             System.arraycopy(types, 0, tmp, 0, types.length);
                             types = tmp;
                         }
-                        types[types.length - 1] = new TypeMapping(ntName, type, propDefs[i].isMultiple());
+                        types[types.length - 1] = new TypeMapping(ntName, type, propDef.isMultiple());
                         typeMapping.put(name, types);
                     }
                 }
@@ -120,18 +120,18 @@
     public void nodeTypeUnregistered(Name ntName) {
         // remove all TypeMapping instances refering to this ntName
         synchronized (typeMapping) {
-            Map modified = new HashMap();
+            Map<Name, TypeMapping[]> modified = new HashMap<Name, TypeMapping[]>();
             for (Iterator it = typeMapping.keySet().iterator(); it.hasNext();) {
                 Name propName = (Name) it.next();
-                TypeMapping[] mapping = (TypeMapping[]) typeMapping.get(propName);
-                List remove = null;
-                for (int i = 0; i < mapping.length; i++) {
-                    if (mapping[i].ntName.equals(ntName)) {
+                TypeMapping[] mapping = typeMapping.get(propName);
+                List<TypeMapping> remove = null;
+                for (TypeMapping tm : mapping) {
+                    if (tm.ntName.equals(ntName)) {
                         if (remove == null) {
                             // not yet created
-                            remove = new ArrayList(mapping.length);
+                            remove = new ArrayList<TypeMapping>(mapping.length);
                         }
-                        remove.add(mapping[i]);
+                        remove.add(tm);
                     }
                 }
                 if (remove != null) {
@@ -140,7 +140,7 @@
                         // all removed -> done
                     } else {
                         // only some removed
-                        List remaining = new ArrayList(Arrays.asList(mapping));
+                        List<TypeMapping> remaining = new ArrayList<TypeMapping>(Arrays.asList(mapping));
                         remaining.removeAll(remove);
                         modified.put(propName, remaining.toArray(new TypeMapping[remaining.size()]));
                     }
@@ -156,9 +156,8 @@
      * from the {@link org.apache.jackrabbit.core.nodetype.NodeTypeRegistry}.
      */
     private void fillCache() {
-        Name[] ntNames = registry.getRegisteredNodeTypes();
-        for (int i = 0; i < ntNames.length; i++) {
-            nodeTypeRegistered(ntNames[i]);
+        for (Name ntName : registry.getRegisteredNodeTypes()) {
+            nodeTypeRegistered(ntName);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java Thu Aug  6 09:32:38 2009
@@ -235,8 +235,7 @@
         try {
             while ((t = ts.next(t)) != null) {
                 String termText = t.term();
-                TermVectorOffsetInfo[] info =
-                        (TermVectorOffsetInfo[]) termMap.get(termText);
+                TermVectorOffsetInfo[] info = termMap.get(termText);
                 if (info == null) {
                     info = new TermVectorOffsetInfo[1];
                 } else {
@@ -264,7 +263,7 @@
             public TermVectorOffsetInfo[] getOffsets(int index) {
                 TermVectorOffsetInfo[] info = TermVectorOffsetInfo.EMPTY_OFFSET_INFO;
                 if (index >= 0 && index < terms.length) {
-                    info = (TermVectorOffsetInfo[]) termMap.get(terms[index]);
+                    info = termMap.get(terms[index]);
                 }
                 return info;
             }
@@ -284,7 +283,7 @@
             public int[] getTermFrequencies() {
                 int[] freqs = new int[terms.length];
                 for (int i = 0; i < terms.length; i++) {
-                    freqs[i] = ((TermVectorOffsetInfo[]) termMap.get(terms[i])).length;
+                    freqs[i] = termMap.get(terms[i]).length;
                 }
                 return freqs;
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java Thu Aug  6 09:32:38 2009
@@ -122,18 +122,16 @@
      */
     public NodeState getAggregateRoot(NodeState nodeState)
             throws ItemStateException, RepositoryException {
-        for (int i = 0; i < nodeIncludes.length; i++) {
-            NodeState aggregateRoot = nodeIncludes[i].matches(nodeState);
-            if (aggregateRoot != null
-                    && aggregateRoot.getNodeTypeName().equals(nodeTypeName)) {
+        for (NodeInclude nodeInclude : nodeIncludes) {
+            NodeState aggregateRoot = nodeInclude.matches(nodeState);
+            if (aggregateRoot != null && aggregateRoot.getNodeTypeName().equals(nodeTypeName)) {
                 return aggregateRoot;
             }
         }
         // check property includes
-        for (int i = 0; i < propertyIncludes.length; i++) {
-            NodeState aggregateRoot = propertyIncludes[i].matches(nodeState);
-            if (aggregateRoot != null
-                    && aggregateRoot.getNodeTypeName().equals(nodeTypeName)) {
+        for (PropertyInclude propertyInclude : propertyIncludes) {
+            NodeState aggregateRoot = propertyInclude.matches(nodeState);
+            if (aggregateRoot != null && aggregateRoot.getNodeTypeName().equals(nodeTypeName)) {
                 return aggregateRoot;
             }
         }
@@ -154,8 +152,8 @@
             throws ItemStateException {
         if (nodeState.getNodeTypeName().equals(nodeTypeName)) {
             List<NodeState> nodeStates = new ArrayList<NodeState>();
-            for (int i = 0; i < nodeIncludes.length; i++) {
-                nodeStates.addAll(Arrays.asList(nodeIncludes[i].resolve(nodeState)));
+            for (NodeInclude nodeInclude : nodeIncludes) {
+                nodeStates.addAll(Arrays.asList(nodeInclude.resolve(nodeState)));
             }
             if (nodeStates.size() > 0) {
                 return nodeStates.toArray(new NodeState[nodeStates.size()]);
@@ -171,9 +169,8 @@
             throws ItemStateException {
         if (nodeState.getNodeTypeName().equals(nodeTypeName)) {
             List<PropertyState> propStates = new ArrayList<PropertyState>();
-            for (int i = 0; i < propertyIncludes.length; i++) {
-                propStates.addAll(Arrays.asList(
-                        propertyIncludes[i].resolvePropertyStates(nodeState)));
+            for (PropertyInclude propertyInclude : propertyIncludes) {
+                propStates.addAll(Arrays.asList(propertyInclude.resolvePropertyStates(nodeState)));
             }
             if (propStates.size() > 0) {
                 return propStates.toArray(new PropertyState[propStates.size()]);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java Thu Aug  6 09:32:38 2009
@@ -220,13 +220,12 @@
     public Document document(int n, FieldSelector fieldSelector)
             throws CorruptIndexException, IOException {
         if (fieldSelector == FieldSelectors.UUID) {
-            Integer docNum = new Integer(n);
             Document doc;
-            NodeId id = docNumber2id.get(docNum);
+            NodeId id = docNumber2id.get(n);
             if (id == null) {
                 doc = super.document(n, fieldSelector);
                 id = new NodeId(doc.get(FieldNames.UUID));
-                docNumber2id.put(docNum, id);
+                docNumber2id.put(n, id);
             } else {
                 doc = new Document();
                 doc.add(new Field(FieldNames.UUID, id.toString(),
@@ -412,8 +411,8 @@
                 public void collect(Term term, TermDocs tDocs) throws IOException {
                     NodeId id = new NodeId(term.text());
                     while (tDocs.next()) {
-                        Integer docId = new Integer(tDocs.doc());
-                        NodeInfo info = (NodeInfo) docs.get(docId);
+                        Integer docId = tDocs.doc();
+                        NodeInfo info = docs.get(docId);
                         if (info == null) {
                             // shareable node, see above
                         } else {
@@ -454,8 +453,8 @@
                 }
                 log.debug("initialized {} DocIds in {} ms, {} foreign parents",
                         new Object[]{
-                            new Integer(parents.length),
-                            new Long(time),
+                            parents.length,
+                            time,
                             nf.format(foreignParents)
                         });
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java Thu Aug  6 09:32:38 2009
@@ -162,8 +162,8 @@
      * {@inheritDoc}
      */
     protected synchronized void doClose() throws IOException {
-        for (int i = 0; i < subReaders.length; i++) {
-            subReaders[i].release();
+        for (ReadOnlyIndexReader subReader : subReaders) {
+            subReader.release();
         }
     }
 
@@ -185,12 +185,12 @@
         Term term = new Term(FieldNames.UUID, id.toString());
         int doc;
         long tick;
-        for (int i = 0; i < subReaders.length; i++) {
-            TermDocs docs = subReaders[i].termDocs(term);
+        for (ReadOnlyIndexReader subReader : subReaders) {
+            TermDocs docs = subReader.termDocs(term);
             try {
                 if (docs.next()) {
                     doc = docs.doc();
-                    tick = subReaders[i].getCreationTick();
+                    tick = subReader.getCreationTick();
                     return new ForeignSegmentDocId(doc, tick);
                 }
             } finally {
@@ -204,8 +204,7 @@
      * {@inheritDoc}
      */
     public int getDocumentNumber(ForeignSegmentDocId docId) {
-        OffsetReader r = (OffsetReader) readersByCreationTick.get(
-                new Long(docId.getCreationTick()));
+        OffsetReader r = readersByCreationTick.get(docId.getCreationTick());
         if (r != null && !r.reader.isDeleted(docId.getDocNumber())) {
             return r.offset + docId.getDocNumber();
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java Thu Aug  6 09:32:38 2009
@@ -70,12 +70,6 @@
 
     private final class CaseTermEnum extends FilteredTermEnum {
 
-        private final int nameLength;
-
-        private final OffsetCharSequence termText;
-
-        private final OffsetCharSequence currentTerm;
-
         CaseTermEnum(IndexReader reader) throws IOException {
             // gather all terms that match
             // keep them in order and remember the doc frequency as value
@@ -88,10 +82,10 @@
             // lower case character and another one with an initial upper case
             // character
             List<RangeScan> rangeScans = new ArrayList<RangeScan>(2);
-            nameLength = FieldNames.getNameLength(term.text());
+            int nameLength = FieldNames.getNameLength(term.text());
             String propName = term.text().substring(0, nameLength);
-            this.termText = new OffsetCharSequence(nameLength, term.text());
-            this.currentTerm = new OffsetCharSequence(nameLength, term.text(), transform);
+            OffsetCharSequence termText = new OffsetCharSequence(nameLength, term.text());
+            OffsetCharSequence currentTerm = new OffsetCharSequence(nameLength, term.text(), transform);
 
             try {
                 // start with a term using the lower case character for the first
@@ -175,7 +169,7 @@
 
                 public int docFreq() {
                     Integer docFreq = orderedTerms.get(current);
-                    return docFreq != null ? docFreq.intValue() : 0;
+                    return docFreq != null ? docFreq : 0;
                 }
 
                 public void close() {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildNodesQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildNodesQueryHits.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildNodesQueryHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildNodesQueryHits.java Thu Aug  6 09:32:38 2009
@@ -87,7 +87,8 @@
 
     /**
      * Fetches the next {@link #childHits}
-     * @throws IOException
+     *
+     * @throws IOException if an error occurs while reading from the index.
      */
     private void fetchNextChildHits() throws IOException {
         if (childHits != null) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java Thu Aug  6 09:32:38 2009
@@ -233,7 +233,7 @@
                 node = parent;
             }
             for (int i = elements.size() - 1; i > -1; i--) {
-                ChildNodeEntry entry = (ChildNodeEntry) elements.get(i);
+                ChildNodeEntry entry = elements.get(i);
                 path.append('/').append(entry.getName().getLocalName());
                 if (entry.getIndex() > 1) {
                     path.append('[').append(entry.getIndex()).append(']');

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java Thu Aug  6 09:32:38 2009
@@ -31,7 +31,6 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.BitSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -238,7 +237,7 @@
         /**
          * List of UUIDs of selected nodes
          */
-        private List uuids = null;
+        private List<String> uuids = null;
 
         /**
          * The next document id to return
@@ -305,11 +304,13 @@
          * 3. find reference property UUIDs
          * 4. Use UUIDs to find document number
          * 5. Use the name test to filter the documents
-         * @throws IOException
+         * 
+         * @throws IOException if an exception occurs while reading from the
+         *                     index.
          */
         private void calculateChildren() throws IOException {
             if (uuids == null) {
-                uuids = new ArrayList();
+                uuids = new ArrayList<String>();
                 contextScorer.score(new HitCollector() {
                     public void collect(int doc, float score) {
                         hits.set(doc);
@@ -334,9 +335,9 @@
                         // no reference properties at all on this node
                         continue;
                     }
-                    for (int v = 0; v < values.length; v++) {
-                        if (values[v].startsWith(prefix)) {
-                            uuids.add(values[v].substring(prefix.length()));
+                    for (String value : values) {
+                        if (value.startsWith(prefix)) {
+                            uuids.add(value.substring(prefix.length()));
                         }
                     }
                 }
@@ -344,8 +345,8 @@
                 // collect the doc ids of all target nodes. we reuse the existing
                 // bitset.
                 hits.clear();
-                for (Iterator it = uuids.iterator(); it.hasNext();) {
-                    TermDocs node = reader.termDocs(new Term(FieldNames.UUID, (String) it.next()));
+                for (String uuid : uuids) {
+                    TermDocs node = reader.termDocs(new Term(FieldNames.UUID, uuid));
                     try {
                         while (node.next()) {
                             hits.set(node.doc());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java Thu Aug  6 09:32:38 2009
@@ -26,7 +26,6 @@
 import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Sort;
 import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.ItemManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -228,8 +227,8 @@
                              final SessionImpl session,
                              final Sort sort) throws IOException {
         if (sort.getSort().length == 0 && subQueryMatchesAll()) {
-            // maps path String to NodeId
-            Map startingPoints = new TreeMap();
+            // maps path String to ScoreNode
+            Map<String, ScoreNode> startingPoints = new TreeMap<String, ScoreNode>();
             QueryHits result = searcher.evaluate(getContextQuery());
             try {
                 // minLevels 0 and 1 are handled with a series of
@@ -254,8 +253,8 @@
 
             // prune overlapping starting points
             String previousPath = null;
-            for (Iterator it = startingPoints.keySet().iterator(); it.hasNext(); ) {
-                String path = (String) it.next();
+            for (Iterator<String> it = startingPoints.keySet().iterator(); it.hasNext(); ) {
+                String path = it.next();
                 // if the previous path is a prefix of this path then the
                 // current path is obsolete
                 if (previousPath != null && path.startsWith(previousPath)) {
@@ -265,13 +264,11 @@
                 }
             }
 
-            final Iterator scoreNodes = startingPoints.values().iterator();
+            final Iterator<ScoreNode> scoreNodes = startingPoints.values().iterator();
             return new AbstractQueryHits() {
 
                 private NodeTraversingQueryHits currentTraversal;
 
-                private ItemManager itemMgr = session.getItemManager();
-
                 {
                     fetchNextTraversal();
                 }
@@ -300,7 +297,7 @@
                         currentTraversal.close();
                     }
                     if (scoreNodes.hasNext()) {
-                        ScoreNode sn = (ScoreNode) scoreNodes.next();
+                        ScoreNode sn = scoreNodes.next();
                         try {
                             Node node = session.getNodeById(sn.getNodeId());
                             currentTraversal = new NodeTraversingQueryHits(node,
@@ -508,8 +505,8 @@
                 if (log.isDebugEnabled()) {
                     log.debug("Collected {} context hits in {} ms for {}",
                             new Object[]{
-                                    new Integer(contextHits.cardinality()),
-                                    new Long(time),
+                                    contextHits.cardinality(),
+                                    time,
                                     DescendantSelfAxisQuery.this
                             });
                 }
@@ -553,8 +550,8 @@
             // traverse
             while (pDocs.length != 0) {
                 boolean valid = false;
-                for (int i = 0; i < pDocs.length; i++) {
-                    if (ancestorCount >= minLevels && contextHits.get(pDocs[i])) {
+                for (int pDoc : pDocs) {
+                    if (ancestorCount >= minLevels && contextHits.get(pDoc)) {
                         valid = true;
                         break;
                     }
@@ -604,8 +601,8 @@
                 return hResolver.getParents(docs[0], pDocs);
             } else {
                 pDocs = new int[0];
-                for (int i = 0; i < docs.length; i++) {
-                    int[] p = hResolver.getParents(docs[i], new int[0]);
+                for (int doc : docs) {
+                    int[] p = hResolver.getParents(doc, new int[0]);
                     int[] tmp = new int[p.length + pDocs.length];
                     System.arraycopy(pDocs, 0, tmp, 0, pDocs.length);
                     System.arraycopy(p, 0, tmp, pDocs.length, p.length);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java Thu Aug  6 09:32:38 2009
@@ -344,10 +344,10 @@
         public String toString() {
             StringBuffer sb = new StringBuffer("MultiUUIDDocId(");
             String separator = "";
-            for (int i = 0; i < docIds.length; i++) {
+            for (UUIDDocId docId : docIds) {
                 sb.append(separator);
                 separator = ", ";
-                sb.append(docIds[i].id);
+                sb.append(docId.id);
             }
             sb.append(")");
             return sb.toString();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocNumberCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocNumberCache.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocNumberCache.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocNumberCache.java Thu Aug  6 09:32:38 2009
@@ -143,8 +143,8 @@
                 }
                 StringBuffer statistics = new StringBuffer();
                 int inUse = 0;
-                for (int i = 0; i < docNumbers.length; i++) {
-                    inUse += docNumbers[i].size();
+                for (LRUMap docNumber : docNumbers) {
+                    inUse += docNumber.size();
                 }
                 statistics.append("size=").append(inUse);
                 statistics.append("/").append(docNumbers[0].maxSize() * CACHE_SEGMENTS);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java Thu Aug  6 09:32:38 2009
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.NodeImpl;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,7 +43,7 @@
     private ScoreNodeIterator orderedNodes;
 
     /** Unordered list of {@link ScoreNode}[]s. */
-    private final List scoreNodes;
+    private final List<ScoreNode[]> scoreNodes;
 
     /** ItemManager to turn UUIDs into Node instances */
     protected final ItemManager itemMgr;
@@ -64,8 +65,8 @@
      *                      selectorIndex.
      */
     DocOrderScoreNodeIterator(ItemManager itemMgr,
-                             List scoreNodes,
-                             int selectorIndex) {
+                              List<ScoreNode[]> scoreNodes,
+                              int selectorIndex) {
         this.itemMgr = itemMgr;
         this.scoreNodes = scoreNodes;
         this.selectorIndex = selectorIndex;
@@ -147,29 +148,29 @@
             return;
         }
         long time = System.currentTimeMillis();
-        ScoreNode[][] nodes = (ScoreNode[][]) scoreNodes.toArray(new ScoreNode[scoreNodes.size()][]);
+        ScoreNode[][] nodes = scoreNodes.toArray(new ScoreNode[scoreNodes.size()][]);
 
-        final List invalidIDs = new ArrayList(2);
+        final List<NodeId> invalidIDs = new ArrayList<NodeId>(2);
 
         do {
             if (invalidIDs.size() > 0) {
                 // previous sort run was not successful -> remove failed uuids
-                List tmp = new ArrayList();
-                for (int i = 0; i < nodes.length; i++) {
-                    if (!invalidIDs.contains(nodes[i][selectorIndex].getNodeId())) {
-                        tmp.add(nodes[i]);
+                List<ScoreNode[]> tmp = new ArrayList<ScoreNode[]>();
+                for (ScoreNode[] node : nodes) {
+                    if (!invalidIDs.contains(node[selectorIndex].getNodeId())) {
+                        tmp.add(node);
                     }
                 }
-                nodes = (ScoreNode[][]) tmp.toArray(new ScoreNode[tmp.size()][]);
+                nodes = tmp.toArray(new ScoreNode[tmp.size()][]);
                 invalidIDs.clear();
             }
 
             try {
                 // sort the uuids
-                Arrays.sort(nodes, new Comparator() {
-                    public int compare(Object o1, Object o2) {
-                        ScoreNode n1 = ((ScoreNode[]) o1)[selectorIndex];
-                        ScoreNode n2 = ((ScoreNode[]) o2)[selectorIndex];
+                Arrays.sort(nodes, new Comparator<ScoreNode[]>() {
+                    public int compare(ScoreNode[] o1, ScoreNode[] o2) {
+                        ScoreNode n1 = o1[selectorIndex];
+                        ScoreNode n2 = o2[selectorIndex];
                         // handle null values
                         // null is considered less than any value
                         if (n1 == n2) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FileBasedNamespaceMappings.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FileBasedNamespaceMappings.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FileBasedNamespaceMappings.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FileBasedNamespaceMappings.java Thu Aug  6 09:32:38 2009
@@ -29,7 +29,6 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 
@@ -58,12 +57,12 @@
     /**
      * Map of uris indexed by prefixes
      */
-    private Map prefixToURI = new HashMap();
+    private Map<String, String> prefixToURI = new HashMap<String, String>();
 
     /**
      * Map of prefixes indexed by uris
      */
-    private Map uriToPrefix = new HashMap();
+    private Map<String, String> uriToPrefix = new HashMap<String, String>();
 
     /**
      * Current prefix count.
@@ -95,7 +94,7 @@
         if (!prefixToURI.containsKey(prefix)) {
             throw new NamespaceException(prefix + ": is not a registered namespace prefix.");
         }
-        return (String) prefixToURI.get(prefix);
+        return prefixToURI.get(prefix);
     }
 
     /**
@@ -109,7 +108,7 @@
      *                            mapping could not be stored.
      */
     public synchronized String getPrefix(String uri) throws NamespaceException {
-        String prefix = (String) uriToPrefix.get(uri);
+        String prefix = uriToPrefix.get(uri);
         if (prefix == null) {
             // make sure prefix is not taken
             while (prefixToURI.get(String.valueOf(prefixCount)) != null) {
@@ -144,9 +143,8 @@
                 props.load(in);
 
                 // read mappings from properties
-                Iterator iter = props.keySet().iterator();
-                while (iter.hasNext()) {
-                    String prefix = (String) iter.next();
+                for (Object o : props.keySet()) {
+                    String prefix = (String) o;
                     String uri = props.getProperty(prefix);
                     log.debug(prefix + " -> " + uri);
                     prefixToURI.put(prefix, uri);
@@ -169,12 +167,7 @@
         Properties props = new Properties();
 
         // store mappings in properties
-        Iterator iter = prefixToURI.keySet().iterator();
-        while (iter.hasNext()) {
-            String prefix = (String) iter.next();
-            String uri = (String) prefixToURI.get(prefix);
-            props.setProperty(prefix, uri);
-        }
+        props.putAll(prefixToURI);
 
         OutputStream out = new FileOutputStream(storage);
         try {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java Thu Aug  6 09:32:38 2009
@@ -141,11 +141,10 @@
             Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES);
             if (fields != null) {
                 doc.removeFields(FieldNames.PROPERTIES);
-                for (int i = 0; i < fields.length; i++) {
-                    String value = fields[i].stringValue();
+                for (Fieldable field : fields) {
+                    String value = field.stringValue();
                     value = value.replace('\uFFFF', '[');
-                    doc.add(new Field(FieldNames.PROPERTIES, value,
-                            Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
+                    doc.add(new Field(FieldNames.PROPERTIES, value, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                 }
             }
             return doc;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationEntityResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationEntityResolver.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationEntityResolver.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationEntityResolver.java Thu Aug  6 09:32:38 2009
@@ -35,10 +35,10 @@
     /**
      * Maps system ids to DTD resource names.
      */
-    private static final Map SYSTEM_IDS;
+    private static final Map<String, String> SYSTEM_IDS;
 
     static {
-        Map systemIds = new HashMap();
+        Map<String, String> systemIds = new HashMap<String, String>();
         systemIds.put(
                 "http://jackrabbit.apache.org/dtd/indexing-configuration-1.0.dtd",
                 "indexing-configuration-1.0.dtd");
@@ -56,7 +56,7 @@
      */
     public InputSource resolveEntity(String publicId, String systemId)
             throws SAXException, IOException {
-        String resourceName = (String) SYSTEM_IDS.get(systemId);
+        String resourceName = SYSTEM_IDS.get(systemId);
         if (resourceName != null) {
             InputStream in = getClass().getResourceAsStream(resourceName);
             if (in != null) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java Thu Aug  6 09:32:38 2009
@@ -96,7 +96,7 @@
     /**
      * The {@link IndexingRule}s inside this configuration.
      */
-    private Map configElements = new HashMap();
+    private Map<Name, List<IndexingRule>> configElements = new HashMap<Name, List<IndexingRule>>();
 
     /**
      * The indexing aggregates inside this configuration.
@@ -106,7 +106,7 @@
     /**
      * The configured analyzers for indexing properties.
      */
-    private Map analyzers = new HashMap();
+    private Map<String, Analyzer> analyzers = new HashMap<String, Analyzer>();
 
     /**
      * {@inheritDoc}
@@ -120,7 +120,7 @@
 
         NodeTypeRegistry ntReg = context.getNodeTypeRegistry();
         Name[] ntNames = ntReg.getRegisteredNodeTypes();
-        List idxAggregates = new ArrayList();
+        List<AggregateRule> idxAggregates = new ArrayList<AggregateRule>();
         NodeList indexingConfigs = config.getChildNodes();
         for (int i = 0; i < indexingConfigs.getLength(); i++) {
             Node configNode = indexingConfigs.item(i);
@@ -128,15 +128,15 @@
                 IndexingRule element = new IndexingRule(configNode);
                 // register under node type and all its sub types
                 log.debug("Found rule '{}' for NodeType '{}'", element, element.getNodeTypeName());
-                for (int n = 0; n < ntNames.length; n++) {
-                    if (ntReg.getEffectiveNodeType(ntNames[n]).includesNodeType(element.getNodeTypeName())) {
-                        List perNtConfig = (List) configElements.get(ntNames[n]);
+                for (Name ntName : ntNames) {
+                    if (ntReg.getEffectiveNodeType(ntName).includesNodeType(element.getNodeTypeName())) {
+                        List<IndexingRule> perNtConfig = configElements.get(ntName);
                         if (perNtConfig == null) {
-                            perNtConfig = new ArrayList();
-                            configElements.put(ntNames[n], perNtConfig);
+                            perNtConfig = new ArrayList<IndexingRule>();
+                            configElements.put(ntName, perNtConfig);
                         }
-                        log.debug("Registering it for name '{}'", ntNames[n]);
-                        perNtConfig.add(new IndexingRule(element, ntNames[n]));
+                        log.debug("Registering it for name '{}'", ntName);
+                        perNtConfig.add(new IndexingRule(element, ntName));
                     }
                 }
             } else if (configNode.getNodeName().equals("aggregate")) {
@@ -187,8 +187,7 @@
             }
 
         }
-        aggregateRules = (AggregateRule[]) idxAggregates.toArray(
-                new AggregateRule[idxAggregates.size()]);
+        aggregateRules = idxAggregates.toArray(new AggregateRule[idxAggregates.size()]);
     }
 
     /**
@@ -303,7 +302,7 @@
      */
     public Analyzer getPropertyAnalyzer(String fieldName) {
         if (analyzers.containsKey(fieldName)) {
-            return (Analyzer) analyzers.get(fieldName);
+            return analyzers.get(fieldName);
         }
         return null;
     }
@@ -317,30 +316,27 @@
      * @return the indexing rule or <code>null</code> if none applies.
      */
     private IndexingRule getApplicableIndexingRule(NodeState state) {
-        List rules = null;
-        List r = (List) configElements.get(state.getNodeTypeName());
+        List<IndexingRule> rules = null;
+        List<IndexingRule> r = configElements.get(state.getNodeTypeName());
         if (r != null) {
-            rules = new ArrayList();
+            rules = new ArrayList<IndexingRule>();
             rules.addAll(r);
         }
 
-        Iterator it = state.getMixinTypeNames().iterator();
-        while (it.hasNext()) {
-            r = (List) configElements.get(it.next());
+        for (Name name : state.getMixinTypeNames()) {
+            r = configElements.get(name);
             if (r != null) {
                 if (rules == null) {
-                    rules = new ArrayList();
+                    rules = new ArrayList<IndexingRule>();
                 }
                 rules.addAll(r);
             }
         }
 
         if (rules != null) {
-            it = rules.iterator();
-            while (it.hasNext()) {
-                IndexingRule ir = (IndexingRule) it.next();
-                if (ir.appliesTo(state)) {
-                    return ir;
+            for (IndexingRule rule : rules) {
+                if (rule.appliesTo(state)) {
+                    return rule;
                 }
             }
         }
@@ -381,8 +377,8 @@
      *                                prefix.
      */
     private void createPropertyConfigs(Node config,
-                                       Map propConfigs,
-                                       List namePatterns)
+                                       Map<Name, PropertyConfig> propConfigs,
+                                       List<NamePattern> namePatterns)
             throws IllegalNameException, NamespaceException {
         NodeList childNodes = config.getChildNodes();
         for (int i = 0; i < childNodes.getLength(); i++) {
@@ -404,24 +400,21 @@
                 boolean nodeScopeIndex = true;
                 Node nsIndex = attributes.getNamedItem("nodeScopeIndex");
                 if (nsIndex != null) {
-                    nodeScopeIndex = Boolean.valueOf(
-                            nsIndex.getNodeValue()).booleanValue();
+                    nodeScopeIndex = Boolean.valueOf(nsIndex.getNodeValue());
                 }
 
                 // get isRegexp flag
                 boolean isRegexp = false;
                 Node regexp = attributes.getNamedItem("isRegexp");
                 if (regexp != null) {
-                    isRegexp = Boolean.valueOf(
-                            regexp.getNodeValue()).booleanValue();
+                    isRegexp = Boolean.valueOf(regexp.getNodeValue());
                 }
 
                 // get useInExcerpt flag
                 boolean useInExcerpt = true;
                 Node excerpt = attributes.getNamedItem("useInExcerpt");
                 if (excerpt != null) {
-                    useInExcerpt = Boolean.valueOf(
-                            excerpt.getNodeValue()).booleanValue();
+                    useInExcerpt = Boolean.valueOf(excerpt.getNodeValue());
                 }
 
                 PropertyConfig pc = new PropertyConfig(
@@ -607,12 +600,12 @@
         /**
          * Map of {@link PropertyConfig}. Key=Name of property.
          */
-        private final Map propConfigs;
+        private final Map<Name, PropertyConfig> propConfigs;
 
         /**
          * List of {@link NamePattern}s.
          */
-        private final List namePatterns;
+        private final List<NamePattern> namePatterns;
 
         /**
          * An expression based on a relative path.
@@ -651,8 +644,8 @@
             this.nodeTypeName = getNodeTypeName(config);
             this.condition = getCondition(config);
             this.boost = getNodeBoost(config);
-            this.propConfigs = new HashMap();
-            this.namePatterns = new ArrayList();
+            this.propConfigs = new HashMap<Name, PropertyConfig>();
+            this.namePatterns = new ArrayList<NamePattern>();
             createPropertyConfigs(config, propConfigs, namePatterns);
         }
 
@@ -712,11 +705,7 @@
          */
         public boolean isIncludedInNodeScopeIndex(Name propertyName) {
             PropertyConfig config = getConfig(propertyName);
-            if (config != null) {
-                return config.nodeScopeIndex;
-            } else {
-                return false;
-            }
+            return config != null && config.nodeScopeIndex;
         }
 
         /**
@@ -730,11 +719,7 @@
          */
         public boolean useInExcerpt(Name propertyName) {
             PropertyConfig config = getConfig(propertyName);
-            if (config != null) {
-                return config.useInExcerpt;
-            } else {
-                return true;
-            }
+            return config == null || config.useInExcerpt;
         }
 
         /**
@@ -749,11 +734,7 @@
             if (!nodeTypeName.equals(state.getNodeTypeName())) {
                 return false;
             }
-            if (condition == null) {
-                return true;
-            } else {
-                return condition.evaluate(state);
-            }
+            return condition == null || condition.evaluate(state);
         }
 
         //-------------------------< internal >---------------------------------
@@ -765,14 +746,13 @@
          *         property.
          */
         private PropertyConfig getConfig(Name propertyName) {
-            PropertyConfig config = (PropertyConfig) propConfigs.get(propertyName);
+            PropertyConfig config = propConfigs.get(propertyName);
             if (config != null) {
                 return config;
             } else if (namePatterns.size() > 0) {
                 Path path = PATH_FACTORY.create(propertyName);
                 // check patterns
-                for (Iterator it = namePatterns.iterator(); it.hasNext(); ) {
-                    NamePattern np = (NamePattern) it.next();
+                for (NamePattern np : namePatterns) {
                     if (np.matches(path)) {
                         return np.getConfig();
                     }
@@ -974,8 +954,8 @@
                     PropertyState propState =
                             (PropertyState) ism.getItemState(propId);
                     InternalValue[] values = propState.getValues();
-                    for (int i = 0; i < values.length; i++) {
-                        if (values[i].toString().equals(propertyValue)) {
+                    for (InternalValue value : values) {
+                        if (value.toString().equals(propertyValue)) {
                             return true;
                         }
                     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java Thu Aug  6 09:32:38 2009
@@ -51,7 +51,7 @@
     /**
      * Maps UUID {@link String}s to {@link Document}s.
      */
-    private final Map pendingDocuments = new HashMap();
+    private final Map<String, Document> pendingDocuments = new HashMap<String, Document>();
 
     /**
      * Flag that indicates whether this indexing queue had been
@@ -95,18 +95,18 @@
             reader.release();
         }
         String[] uuids = queueStore.getPending();
-        for (int i = 0; i < uuids.length; i++) {
+        for (String uuid : uuids) {
             try {
-                Document doc = index.createDocument(new NodeId(uuids[i]));
-                pendingDocuments.put(uuids[i], doc);
+                Document doc = index.createDocument(new NodeId(uuid));
+                pendingDocuments.put(uuid, doc);
                 log.debug("added node {}. New size of indexing queue: {}",
-                        uuids[i], new Integer(pendingDocuments.size()));
+                        uuid, pendingDocuments.size());
             } catch (IllegalArgumentException e) {
-                log.warn("Invalid UUID in indexing queue store: " + uuids[i]);
+                log.warn("Invalid UUID in indexing queue store: " + uuid);
             } catch (RepositoryException e) {
                 // node does not exist anymore
-                log.debug("Node with uuid {} does not exist anymore", uuids[i]);
-                queueStore.removeUUID(uuids[i]);
+                log.debug("Node with uuid {} does not exist anymore", uuid);
+                queueStore.removeUUID(uuid);
             }
         }
         initialized = true;
@@ -119,7 +119,7 @@
      */
     public Document[] getFinishedDocuments() {
         checkInitialized();
-        List finished = new ArrayList();
+        List<Document> finished = new ArrayList<Document>();
         synchronized (this) {
             finished.addAll(pendingDocuments.values());
         }
@@ -131,7 +131,7 @@
                 it.remove();
             }
         }
-        return (Document[]) finished.toArray(new Document[finished.size()]);
+        return finished.toArray(new Document[finished.size()]);
     }
 
     /**
@@ -145,11 +145,11 @@
      */
     public synchronized Document removeDocument(String uuid) {
         checkInitialized();
-        Document doc = (Document) pendingDocuments.remove(uuid);
+        Document doc = pendingDocuments.remove(uuid);
         if (doc != null) {
             queueStore.removeUUID(uuid);
             log.debug("removed node {}. New size of indexing queue: {}",
-                    uuid, new Integer(pendingDocuments.size()));
+                    uuid, pendingDocuments.size());
             notifyIfEmpty();
         }
         return doc;
@@ -166,9 +166,9 @@
     public synchronized Document addDocument(Document doc) {
         checkInitialized();
         String uuid = doc.get(FieldNames.UUID);
-        Document existing = (Document) pendingDocuments.put(uuid, doc);
+        Document existing = pendingDocuments.put(uuid, doc);
         log.debug("added node {}. New size of indexing queue: {}",
-                uuid, new Integer(pendingDocuments.size()));
+                uuid, pendingDocuments.size());
         if (existing == null) {
             // document wasn't present, add it to the queue store
             queueStore.addUUID(uuid);
@@ -183,9 +183,9 @@
     public synchronized void close() {
         checkInitialized();
         // go through pending documents and close readers
-        Iterator it = pendingDocuments.values().iterator();
+        Iterator<Document> it = pendingDocuments.values().iterator();
         while (it.hasNext()) {
-            Document doc = (Document) it.next();
+            Document doc = it.next();
             Util.disposeDocument(doc);
             it.remove();
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueStore.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueStore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueStore.java Thu Aug  6 09:32:38 2009
@@ -65,7 +65,7 @@
     /**
      * The UUID Strings of the pending documents.
      */
-    private final Set pending = new HashSet();
+    private final Set<String> pending = new HashSet<String>();
 
     /**
      * The directory from where to read pending document UUIDs.
@@ -87,7 +87,7 @@
      * @return the UUIDs of the pending text extraction jobs.
      */
     public String[] getPending() {
-        return (String[]) pending.toArray(new String[pending.size()]);
+        return pending.toArray(new String[pending.size()]);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java Thu Aug  6 09:32:38 2009
@@ -107,18 +107,16 @@
      */
     protected Query getSynonymQuery(String field, String termStr)
             throws ParseException {
-        List synonyms = new ArrayList();
+        List<BooleanClause> synonyms = new ArrayList<BooleanClause>();
         synonyms.add(new BooleanClause(getFieldQuery(field, termStr),
                 BooleanClause.Occur.SHOULD));
         if (synonymProvider != null) {
-            String[] terms = synonymProvider.getSynonyms(termStr);
-            for (int i = 0; i < terms.length; i++) {
-                synonyms.add(new BooleanClause(getFieldQuery(field, terms[i]),
-                        BooleanClause.Occur.SHOULD));
+            for (String term : synonymProvider.getSynonyms(termStr)) {
+                synonyms.add(new BooleanClause(getFieldQuery(field, term), BooleanClause.Occur.SHOULD));
             }
         }
         if (synonyms.size() == 1) {
-            return ((BooleanClause) synonyms.get(0)).getQuery();
+            return synonyms.get(0).getQuery();
         } else {
             return getBooleanQuery(synonyms);
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java Thu Aug  6 09:32:38 2009
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
-import java.util.Iterator;
 import java.util.List;
 import java.math.BigDecimal;
 
@@ -152,7 +151,7 @@
     /**
      * Exceptions thrown during tree translation
      */
-    private final List exceptions = new ArrayList();
+    private final List<Exception> exceptions = new ArrayList<Exception>();
 
     /**
      * Creates a new <code>LuceneQueryBuilder</code> instance.
@@ -228,8 +227,8 @@
         Query q = builder.createLuceneQuery();
         if (builder.exceptions.size() > 0) {
             StringBuffer msg = new StringBuffer();
-            for (Iterator it = builder.exceptions.iterator(); it.hasNext();) {
-                msg.append(it.next().toString()).append('\n');
+            for (Exception exception : builder.exceptions) {
+                msg.append(exception.toString()).append('\n');
             }
             throw new RepositoryException("Exception building query: " + msg.toString());
         }
@@ -241,7 +240,8 @@
      * {@link org.apache.lucene.search.Query}.
      *
      * @return the lucene <code>Query</code>.
-     * @throws RepositoryException
+     * @throws RepositoryException if an error occurs while building the lucene
+     *                             query.
      */
     private Query createLuceneQuery() throws RepositoryException {
         return (Query) root.accept(this, null);
@@ -263,8 +263,8 @@
     public Object visit(OrQueryNode node, Object data) throws RepositoryException {
         BooleanQuery orQuery = new BooleanQuery();
         Object[] result = node.acceptOperands(this, null);
-        for (int i = 0; i < result.length; i++) {
-            Query operand = (Query) result[i];
+        for (Object aResult : result) {
+            Query operand = (Query) aResult;
             orQuery.add(operand, Occur.SHOULD);
         }
         return orQuery;
@@ -276,8 +276,8 @@
             return null;
         }
         BooleanQuery andQuery = new BooleanQuery();
-        for (int i = 0; i < result.length; i++) {
-            Query operand = (Query) result[i];
+        for (Object aResult : result) {
+            Query operand = (Query) aResult;
             andQuery.add(operand, Occur.MUST);
         }
         return andQuery;
@@ -290,8 +290,8 @@
         }
         // join the results
         BooleanQuery b = new BooleanQuery();
-        for (int i = 0; i < result.length; i++) {
-            b.add((Query) result[i], Occur.SHOULD);
+        for (Object aResult : result) {
+            b.add((Query) aResult, Occur.SHOULD);
         }
         // negate
         return new NotQuery(b);
@@ -311,7 +311,7 @@
 
     public Object visit(NodeTypeQueryNode node, Object data) {
 
-        List terms = new ArrayList();
+        List<Term> terms = new ArrayList<Term>();
         try {
             String mixinTypesField = resolver.getJCRName(NameConstants.JCR_MIXINTYPES);
             String primaryTypeField = resolver.getJCRName(NameConstants.JCR_PRIMARYTYPE);
@@ -363,11 +363,11 @@
             // exception occured
             return new BooleanQuery();
         } else if (terms.size() == 1) {
-            return new JackrabbitTermQuery((Term) terms.get(0));
+            return new JackrabbitTermQuery(terms.get(0));
         } else {
             BooleanQuery b = new BooleanQuery();
-            for (Iterator it = terms.iterator(); it.hasNext();) {
-                b.add(new JackrabbitTermQuery((Term) it.next()), Occur.SHOULD);
+            for (Term term : terms) {
+                b.add(new JackrabbitTermQuery(term), Occur.SHOULD);
             }
             return b;
         }
@@ -464,8 +464,8 @@
             exceptions.add(new InvalidQueryException("Number of location steps must be > 0"));
         }
         // loop over steps
-        for (int i = 0; i < steps.length; i++) {
-            context = (Query) steps[i].accept(this, context);
+        for (LocationStepQueryNode step : steps) {
+            context = (Query) step.accept(this, context);
         }
         if (data instanceof BooleanQuery) {
             BooleanQuery constraint = (BooleanQuery) data;
@@ -487,15 +487,15 @@
 
         // predicate on step?
         Object[] predicates = node.acceptOperands(this, data);
-        for (int i = 0; i < predicates.length; i++) {
-            andQuery.add((Query) predicates[i], Occur.MUST);
+        for (Object predicate : predicates) {
+            andQuery.add((Query) predicate, Occur.MUST);
         }
 
         // check for position predicate
         QueryNode[] pred = node.getPredicates();
-        for (int i = 0; i < pred.length; i++) {
-            if (pred[i].getType() == QueryNode.TYPE_RELATION) {
-                RelationQueryNode pos = (RelationQueryNode) pred[i];
+        for (QueryNode aPred : pred) {
+            if (aPred.getType() == QueryNode.TYPE_RELATION) {
+                RelationQueryNode pos = (RelationQueryNode) aPred;
                 if (pos.getValueType() == QueryConstants.TYPE_POSITION) {
                     node.setIndex(pos.getPositionValue());
                 }
@@ -585,8 +585,8 @@
             Object[] predicates = node.acceptOperands(this, data);
             if (predicates.length > 0) {
                 BooleanQuery andQuery = new BooleanQuery();
-                for (int i = 0; i < predicates.length; i++) {
-                    andQuery.add((Query) predicates[i], Occur.MUST);
+                for (Object predicate : predicates) {
+                    andQuery.add((Query) predicate, Occur.MUST);
                 }
                 andQuery.add(context, Occur.MUST);
                 context = andQuery;
@@ -709,13 +709,14 @@
                 case QueryConstants.OPERATION_EQ_VALUE:      // =
                 case QueryConstants.OPERATION_EQ_GENERAL:
                     BooleanQuery or = new BooleanQuery();
-                    for (int i = 0; i < stringValues.length; i++) {
+                    for (String value : stringValues) {
                         Term t = new Term(FieldNames.PROPERTIES,
-                                    FieldNames.createNamedValue(field, stringValues[i]));
+                                FieldNames.createNamedValue(field, value));
                         Query q;
                         if (transform[0] == TransformConstants.TRANSFORM_UPPER_CASE) {
                             q = new CaseTermQuery.Upper(t);
-                        } else if (transform[0] == TransformConstants.TRANSFORM_LOWER_CASE) {
+                        } else
+                        if (transform[0] == TransformConstants.TRANSFORM_LOWER_CASE) {
                             q = new CaseTermQuery.Lower(t);
                         } else {
                             q = new JackrabbitTermQuery(t);
@@ -730,8 +731,8 @@
                 case QueryConstants.OPERATION_GE_VALUE:      // >=
                 case QueryConstants.OPERATION_GE_GENERAL:
                     or = new BooleanQuery();
-                    for (int i = 0; i < stringValues.length; i++) {
-                        Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, stringValues[i]));
+                    for (String value : stringValues) {
+                        Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, value));
                         Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, "\uFFFF"));
                         or.add(new RangeQuery(lower, upper, true, transform[0]), Occur.SHOULD);
                     }
@@ -743,8 +744,8 @@
                 case QueryConstants.OPERATION_GT_VALUE:      // >
                 case QueryConstants.OPERATION_GT_GENERAL:
                     or = new BooleanQuery();
-                    for (int i = 0; i < stringValues.length; i++) {
-                        Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, stringValues[i]));
+                    for (String value : stringValues) {
+                        Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, value));
                         Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, "\uFFFF"));
                         or.add(new RangeQuery(lower, upper, false, transform[0]), Occur.SHOULD);
                     }
@@ -756,9 +757,9 @@
                 case QueryConstants.OPERATION_LE_VALUE:      // <=
                 case QueryConstants.OPERATION_LE_GENERAL:      // <=
                     or = new BooleanQuery();
-                    for (int i = 0; i < stringValues.length; i++) {
+                    for (String value : stringValues) {
                         Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, ""));
-                        Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, stringValues[i]));
+                        Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, value));
                         or.add(new RangeQuery(lower, upper, true, transform[0]), Occur.SHOULD);
                     }
                     query = or;
@@ -778,9 +779,9 @@
                 case QueryConstants.OPERATION_LT_VALUE:      // <
                 case QueryConstants.OPERATION_LT_GENERAL:
                     or = new BooleanQuery();
-                    for (int i = 0; i < stringValues.length; i++) {
+                    for (String value : stringValues) {
                         Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, ""));
-                        Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, stringValues[i]));
+                        Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, value));
                         or.add(new RangeQuery(lower, upper, false, transform[0]), Occur.SHOULD);
                     }
                     query = or;
@@ -793,12 +794,13 @@
                     BooleanQuery notQuery = new BooleanQuery();
                     notQuery.add(Util.createMatchAllQuery(field, indexFormatVersion), Occur.SHOULD);
                     // exclude all nodes where 'field' has the term in question
-                    for (int i = 0; i < stringValues.length; i++) {
-                        Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, stringValues[i]));
+                    for (String value : stringValues) {
+                        Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, value));
                         Query q;
                         if (transform[0] == TransformConstants.TRANSFORM_UPPER_CASE) {
                             q = new CaseTermQuery.Upper(t);
-                        } else if (transform[0] == TransformConstants.TRANSFORM_LOWER_CASE) {
+                        } else
+                        if (transform[0] == TransformConstants.TRANSFORM_LOWER_CASE) {
                             q = new CaseTermQuery.Lower(t);
                         } else {
                             q = new JackrabbitTermQuery(t);
@@ -818,15 +820,16 @@
                     //    all values are equal to term in question
                     notQuery = new BooleanQuery();
                     notQuery.add(Util.createMatchAllQuery(field, indexFormatVersion), Occur.SHOULD);
-                    for (int i = 0; i < stringValues.length; i++) {
+                    for (String value : stringValues) {
                         // exclude the nodes that have the term and are single valued
-                        Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, stringValues[i]));
+                        Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field, value));
                         Query svp = new NotQuery(new JackrabbitTermQuery(new Term(FieldNames.MVP, field)));
                         BooleanQuery and = new BooleanQuery();
                         Query q;
                         if (transform[0] == TransformConstants.TRANSFORM_UPPER_CASE) {
                             q = new CaseTermQuery.Upper(t);
-                        } else if (transform[0] == TransformConstants.TRANSFORM_LOWER_CASE) {
+                        } else
+                        if (transform[0] == TransformConstants.TRANSFORM_LOWER_CASE) {
                             q = new CaseTermQuery.Lower(t);
                         } else {
                             q = new JackrabbitTermQuery(t);
@@ -958,8 +961,8 @@
             Object[] predicates = node.acceptOperands(this, data);
             if (predicates.length > 0) {
                 BooleanQuery andQuery = new BooleanQuery();
-                for (int i = 0; i < predicates.length; i++) {
-                    andQuery.add((Query) predicates[i], Occur.MUST);
+                for (Object predicate : predicates) {
+                    andQuery.add((Query) predicate, Occur.MUST);
                 }
                 andQuery.add(context, Occur.MUST);
                 context = andQuery;
@@ -1021,9 +1024,9 @@
      */
     private String[] getStringValues(Name propertyName, String literal) {
         PropertyTypeRegistry.TypeMapping[] types = propRegistry.getPropertyTypes(propertyName);
-        List values = new ArrayList();
-        for (int i = 0; i < types.length; i++) {
-            switch (types[i].type) {
+        List<String> values = new ArrayList<String>();
+        for (PropertyTypeRegistry.TypeMapping type : types) {
+            switch (type.type) {
                 case PropertyType.NAME:
                     // try to translate name
                     try {
@@ -1149,6 +1152,6 @@
             values.add(literal);
             log.debug("Using literal " + literal + " as is.");
         }
-        return (String[]) values.toArray(new String[values.size()]);
+        return values.toArray(new String[values.size()]);
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactoryImpl.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactoryImpl.java Thu Aug  6 09:32:38 2009
@@ -19,7 +19,6 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.nodetype.NodeType;
@@ -126,7 +125,7 @@
      * {@inheritDoc}
      */
     public Query create(SelectorImpl selector) throws RepositoryException {
-        List terms = new ArrayList();
+        List<Term> terms = new ArrayList<Term>();
         String mixinTypesField = npResolver.getJCRName(NameConstants.JCR_MIXINTYPES);
         String primaryTypeField = npResolver.getJCRName(NameConstants.JCR_PRIMARYTYPE);
 
@@ -177,11 +176,11 @@
         }
         Query q;
         if (terms.size() == 1) {
-            q = new JackrabbitTermQuery((Term) terms.get(0));
+            q = new JackrabbitTermQuery(terms.get(0));
         } else {
             BooleanQuery b = new BooleanQuery();
-            for (Iterator it = terms.iterator(); it.hasNext();) {
-                b.add(new JackrabbitTermQuery((Term) it.next()), BooleanClause.Occur.SHOULD);
+            for (Term term : terms) {
+                b.add(new JackrabbitTermQuery(term), BooleanClause.Occur.SHOULD);
             }
             q = b;
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java Thu Aug  6 09:32:38 2009
@@ -135,15 +135,16 @@
      * @throws IOException if an error occurs while reading from
      *                     the search index.
      */
+    @SuppressWarnings({"unchecked"})
     private void calculateDocFilter() throws IOException {
         PerQueryCache cache = PerQueryCache.getInstance();
-        Map readerCache = (Map) cache.get(MatchAllScorer.class, reader);
+        Map<String, BitSet> readerCache = (Map<String, BitSet>) cache.get(MatchAllScorer.class, reader);
         if (readerCache == null) {
-            readerCache = new HashMap();
+            readerCache = new HashMap<String, BitSet>();
             cache.put(MatchAllScorer.class, reader, readerCache);
         }
         // get BitSet for field
-        docFilter = (BitSet) readerCache.get(field);
+        docFilter = readerCache.get(field);
 
         if (docFilter != null) {
             // use cached BitSet;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NamePathResolverImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NamePathResolverImpl.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NamePathResolverImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NamePathResolverImpl.java Thu Aug  6 09:32:38 2009
@@ -16,31 +16,27 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import javax.jcr.NamespaceException;
+
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NameFactory;
 import org.apache.jackrabbit.spi.PathFactory;
-import org.apache.jackrabbit.spi.commons.conversion.NameResolver;
+import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
 import org.apache.jackrabbit.spi.commons.conversion.NameParser;
-import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
-import org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.conversion.NameResolver;
+import org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
-import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
-
-import javax.jcr.NamespaceException;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 
 /**
  * <code>NamePathResolverImpl</code>...
  */
 public class NamePathResolverImpl extends DefaultNamePathResolver {
 
-    private static Logger log = LoggerFactory.getLogger(NamePathResolverImpl.class);
-
     private static final NameFactory NAME_FACTORY = NameFactoryImpl.getInstance();
     private static final PathFactory PATH_FACTORY = PathFactoryImpl.getInstance();
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeTraversingQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeTraversingQueryHits.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeTraversingQueryHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeTraversingQueryHits.java Thu Aug  6 09:32:38 2009
@@ -83,7 +83,7 @@
      * Implements a node iterator that traverses a node tree in document
      * order.
      */
-    private class TraversingNodeIterator implements Iterator {
+    private class TraversingNodeIterator implements Iterator<Node> {
 
         /**
          * The current <code>Node</code>, which acts as the starting point for
@@ -100,7 +100,7 @@
          * The chain of iterators which includes the iterators of the children
          * of the current node.
          */
-        private Iterator selfAndChildren;
+        private Iterator<Node> selfAndChildren;
 
         /**
          * Creates a <code>TraversingNodeIterator</code>.
@@ -134,19 +134,19 @@
         /**
          * @inheritDoc
          */
-        public Object next() {
+        public Node next() {
             init();
-            NodeImpl n = (NodeImpl) selfAndChildren.next();
-            return n;
+            return selfAndChildren.next();
         }
 
         /**
          * Initializes the iterator chain once.
          */
+        @SuppressWarnings({"unchecked"})
         private void init() {
             if (selfAndChildren == null) {
-                List allIterators = new ArrayList();
-                Iterator current = Collections.singletonList(currentNode).iterator();
+                List<Iterator<Node>> allIterators = new ArrayList<Iterator<Node>>();
+                Iterator<Node> current = Collections.singletonList(currentNode).iterator();
                 allIterators.add(current);
                 if (maxDepth == 0) {
                     // only current node

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ParentAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ParentAxisQuery.java?rev=801565&r1=801564&r2=801565&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ParentAxisQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ParentAxisQuery.java Thu Aug  6 09:32:38 2009
@@ -42,7 +42,7 @@
     /**
      * Default score is 1.0f.
      */
-    private static final Float DEFAULT_SCORE = new Float(1.0f);
+    private static final Float DEFAULT_SCORE = 1.0f;
 
     /**
      * The context query
@@ -241,7 +241,7 @@
          * key=[Integer] id of selected document from context query<br>
          * value=[Float] score for that document
          */
-        private final Map scores = new HashMap();
+        private final Map<Integer, Float> scores = new HashMap<Integer, Float>();
 
         /**
          * The next document id to return
@@ -286,11 +286,11 @@
          * {@inheritDoc}
          */
         public float score() throws IOException {
-            Float score = (Float) scores.get(new Integer(nextDoc));
+            Float score = scores.get(nextDoc);
             if (score == null) {
                 score = DEFAULT_SCORE;
             }
-            return score.floatValue();
+            return score;
         }
 
         /**
@@ -327,14 +327,14 @@
                             if (docs.length == 1) {
                                 // optimize single value
                                 hits.set(docs[0]);
-                                if (score != DEFAULT_SCORE.floatValue()) {
-                                    scores.put(new Integer(docs[0]), new Float(score));
+                                if (score != DEFAULT_SCORE) {
+                                    scores.put(docs[0], score);
                                 }
                             } else {
-                                for (int i = 0; i < docs.length; i++) {
-                                    hits.set(docs[i]);
-                                    if (score != DEFAULT_SCORE.floatValue()) {
-                                        scores.put(new Integer(docs[i]), new Float(score));
+                                for (int docNum : docs) {
+                                    hits.set(docNum);
+                                    if (score != DEFAULT_SCORE) {
+                                        scores.put(docNum, score);
                                     }
                                 }
                             }



Mime
View raw message