jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r773554 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ config/ data/ fs/db/ persistence/bundle/ persistence/bundle/util/ persistence/util/ state/ util/
Date Mon, 11 May 2009 13:17:58 GMT
Author: thomasm
Date: Mon May 11 13:17:58 2009
New Revision: 773554

URL: http://svn.apache.org/viewvc?rev=773554&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/SystemSession.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ErrorHandling.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/HashMapIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/LRUNodeIdCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/PostgreSQLNameIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/MLRUItemStateCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SystemSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SystemSession.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SystemSession.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SystemSession.java
Mon May 11 13:17:58 2009
@@ -26,13 +26,10 @@
 import org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.Name;
-import javax.jcr.security.AccessControlManager;
 import javax.jcr.security.Privilege;
 import javax.jcr.security.AccessControlPolicy;
 
 import javax.jcr.AccessDeniedException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.RepositoryException;
 import javax.jcr.PathNotFoundException;
 import javax.security.auth.Subject;
@@ -56,7 +53,7 @@
     static SystemSession create(RepositoryImpl rep, WorkspaceConfig wspConfig)
             throws RepositoryException {
         // create subject with SystemPrincipal
-        Set principals = new HashSet();
+        Set<SystemPrincipal> principals = new HashSet<SystemPrincipal>();
         principals.add(new SystemPrincipal());
         Subject subject =
                 new Subject(true, principals, Collections.EMPTY_SET,
@@ -106,6 +103,9 @@
     }
 
     //--------------------------------------------------------< inner classes >
+    /**
+     * An access manager that grants access to everything.
+     */
     private class SystemAccessManager extends AbstractAccessControlManager implements AccessManager
{
 
         private final PrivilegeRegistry privilegeRegistry;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
Mon May 11 13:17:58 2009
@@ -60,12 +60,12 @@
     /**
      * Public identifiers.
      */
-    private final Map publicIds = new HashMap();
+    private final Map<String, String> publicIds = new HashMap<String, String>();
 
     /**
      * System identifiers.
      */
-    private final Map systemIds = new HashMap();
+    private final Map<String, String> systemIds = new HashMap<String, String>();
 
     /**
      * Creates the singleton instance of this class.
@@ -125,7 +125,7 @@
             throws SAXException, IOException {
         String name;
 
-        name = (String) publicIds.get(publicId);
+        name = publicIds.get(publicId);
         if (name != null) {
             InputStream stream = getClass().getResourceAsStream(name);
             if (stream != null) {
@@ -133,7 +133,7 @@
             }
         }
 
-        name = (String) systemIds.get(systemId);
+        name = systemIds.get(systemId);
         if (name != null) {
             InputStream stream = getClass().getResourceAsStream(name);
             if (stream != null) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
Mon May 11 13:17:58 2009
@@ -32,7 +32,6 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.jcr.Item;
@@ -209,10 +208,8 @@
                 }
                 try {
                     NodeState state = pm.load(id);
-                    Set propertyNames = state.getPropertyNames();
-                    for (Iterator nameIt = propertyNames.iterator(); nameIt
-                            .hasNext();) {
-                        Name name = (Name) nameIt.next();
+                    Set<Name> propertyNames = state.getPropertyNames();
+                    for (Name name : propertyNames) {
                         PropertyId pid = new PropertyId(id, name);
                         PropertyState ps = pm.load(pid);
                         if (ps.getType() == PropertyType.BINARY) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
Mon May 11 13:17:58 2009
@@ -45,7 +45,6 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.HashMap;
 
 /**
@@ -83,7 +82,7 @@
     protected static final int SLEEP_BEFORE_RECONNECT = 10000;
 
     // the map of prepared statements (key: sql stmt, value: prepared stmt)
-    private HashMap preparedStatements = new HashMap();
+    private HashMap<String, PreparedStatement> preparedStatements = new HashMap<String,
PreparedStatement>();
 
     // SQL statements
     protected String selectExistSQL;
@@ -216,9 +215,8 @@
 
         try {
             // close shared prepared statements
-            Iterator it = preparedStatements.values().iterator();
-            while (it.hasNext()) {
-                closeStatement((PreparedStatement) it.next());
+            for (PreparedStatement prep : preparedStatements.values()) {
+                closeStatement(prep);
             }
             preparedStatements.clear();
 
@@ -540,7 +538,7 @@
                 Statement stmt = executeStmt(
                         selectFileAndFolderNamesSQL, new Object[]{folderPath});
                 rs = stmt.getResultSet();
-                ArrayList names = new ArrayList();
+                ArrayList<String> names = new ArrayList<String>();
                 while (rs.next()) {
                     String name = rs.getString(1);
                     if (name.length() == 0
@@ -581,7 +579,7 @@
                 Statement stmt = executeStmt(
                         selectFileNamesSQL, new Object[]{folderPath});
                 rs = stmt.getResultSet();
-                ArrayList names = new ArrayList();
+                ArrayList<String> names = new ArrayList<String>();
                 while (rs.next()) {
                     names.add(rs.getString(1));
                 }
@@ -616,7 +614,7 @@
                 Statement stmt = executeStmt(
                         selectFolderNamesSQL, new Object[]{folderPath});
                 rs = stmt.getResultSet();
-                ArrayList names = new ArrayList();
+                ArrayList<String> names = new ArrayList<String>();
                 while (rs.next()) {
                     String name = rs.getString(1);
                     if (name.length() == 0
@@ -1023,9 +1021,8 @@
         // gracefully in order to avoid potential memory leaks
 
         // close shared prepared statements
-        Iterator it = preparedStatements.values().iterator();
-        while (it.hasNext()) {
-            closeStatement((PreparedStatement) it.next());
+        for (PreparedStatement prep : preparedStatements.values()) {
+            closeStatement(prep);
         }
         try {
             closeConnection(con);
@@ -1528,9 +1525,12 @@
 
     //--------------------------------------------------------< inner classes >
 
+    /**
+     * An input stream that knows its size.
+     */
     class SizedInputStream extends FilterInputStream {
         private final long size;
-        private boolean consumed = false;
+        private boolean consumed;
 
         SizedInputStream(InputStream in, long size) {
             super(in);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
Mon May 11 13:17:58 2009
@@ -28,6 +28,7 @@
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.NamespaceRegistryImpl;
@@ -476,7 +477,7 @@
                 state.setMultiValued(false);
                 state.setValues(new InternalValue[]{InternalValue.create(bundle.getNodeTypeName())});
             } else if (id.getName().equals(NameConstants.JCR_MIXINTYPES)) {
-                Set mixins = bundle.getMixinTypeNames();
+                Set<Name> mixins = bundle.getMixinTypeNames();
                 state = createNew(id);
                 state.setType(PropertyType.NAME);
                 state.setDefinitionId(idJcrMixinTypes);
@@ -556,10 +557,10 @@
     private void storeInternal(ChangeLog changeLog)
             throws ItemStateException {
         // delete bundles
-        HashSet deleted = new HashSet();
-        Iterator iter = changeLog.deletedStates();
+        HashSet<ItemId> deleted = new HashSet<ItemId>();
+        Iterator<ItemState> iter = changeLog.deletedStates();
         while (iter.hasNext()) {
-            ItemState state = (ItemState) iter.next();
+            ItemState state = iter.next();
             if (state.isNode()) {
                 NodePropBundle bundle = getBundle((NodeId) state.getId());
                 if (bundle == null) {
@@ -570,7 +571,7 @@
             }
         }
         // gather added node states
-        HashMap modified = new HashMap();
+        HashMap<ItemId, NodePropBundle> modified = new HashMap<ItemId, NodePropBundle>();
         iter = changeLog.addedStates();
         while (iter.hasNext()) {
             ItemState state = (ItemState) iter.next();
@@ -670,16 +671,14 @@
         }
 
         // now store all modified bundles
-        iter = modified.values().iterator();
-        while (iter.hasNext()) {
-            NodePropBundle bundle = (NodePropBundle) iter.next();
+        for (NodePropBundle bundle : modified.values()) {
             putBundle(bundle);
         }
 
         // store the refs
-        iter = changeLog.modifiedRefs();
-        while (iter.hasNext()) {
-            NodeReferences refs = (NodeReferences) iter.next();
+        Iterator<NodeReferences> itMod = changeLog.modifiedRefs();
+        while (itMod.hasNext()) {
+            NodeReferences refs = itMod.next();
             if (refs.hasReferences()) {
                 store(refs);
             } else {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleCache.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleCache.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleCache.java
Mon May 11 13:17:58 2009
@@ -34,7 +34,7 @@
     /**
      * the current memory usage of this cache
      */
-    private long curSize = 0;
+    private long curSize;
 
     /**
      * the maximum chache size
@@ -44,12 +44,12 @@
     /**
      * the number of cache hits
      */
-    private long hits = 0;
+    private long hits;
 
     /**
      * the number of cache misses
      */
-    private long misses = 0;
+    private long misses;
 
     /**
      * a map of the cache entries

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
Mon May 11 13:17:58 2009
@@ -48,8 +48,8 @@
     protected String nameInsertSQL;
 
     // caches
-    private final HashMap string2Index = new HashMap();
-    private final HashMap index2String = new HashMap();
+    private final HashMap<String, Integer> string2Index = new HashMap<String, Integer>();
+    private final HashMap<Integer, String> index2String = new HashMap<Integer, String>();
 
     /**
      * Creates a new index that is stored in a db.
@@ -90,14 +90,14 @@
      */
     public int stringToIndex(String string) {
         // check cache
-        Integer index = (Integer) string2Index.get(string);
+        Integer index = string2Index.get(string);
         if (index == null) {
             String dbString = string.length() == 0 ? " " : string;
             int idx = getIndex(dbString);
             if (idx == -1) {
                 idx = insertString(dbString);
             }
-            index = new Integer(idx);
+            index = Integer.valueOf(idx);
             string2Index.put(string, index);
             index2String.put(index, string);
             return idx;
@@ -111,8 +111,8 @@
      */
     public String indexToString(int idx) throws IllegalArgumentException {
         // check cache
-        Integer index = new Integer(idx);
-        String s = (String) index2String.get(index);
+        Integer index = Integer.valueOf(idx);
+        String s = index2String.get(index);
         if (s == null) {
             s = getString(idx);
             if (s.equals(" ")) {
@@ -196,7 +196,7 @@
         String result = null;
         try {
             Statement stmt = connectionManager.executeStmt(
-                    nameSelectSQL, new Object[] { new Integer(index) });
+                    nameSelectSQL, new Object[] { Integer.valueOf(index) });
             ResultSet rs = stmt.getResultSet();
             try {
                 if (rs.next()) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ErrorHandling.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ErrorHandling.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ErrorHandling.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ErrorHandling.java
Mon May 11 13:17:58 2009
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.core.persistence.bundle.util;
 
 import java.util.HashSet;
-import java.util.Iterator;
 
 /**
  * ErrorHandling configuration abstraction class
@@ -36,7 +35,7 @@
     };
 
     /** the flags */
-    private final HashSet flags = new HashSet();
+    private final HashSet<String> flags = new HashSet<String>();
 
     /**
      * Creates a default error handling config.
@@ -73,9 +72,8 @@
      */
     public String toString() {
         StringBuffer ret = new StringBuffer("|");
-        Iterator iter = flags.iterator();
-        while (iter.hasNext()) {
-            ret.append(iter.next());
+        for (String flag : flags) {
+            ret.append(flag);
         }
         ret.append("|");
         return ret.toString();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/HashMapIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/HashMapIndex.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/HashMapIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/HashMapIndex.java
Mon May 11 13:17:58 2009
@@ -40,12 +40,12 @@
     /**
      * holds the string-to-index lookups.
      */
-    private final HashMap stringToIndex = new HashMap();
+    private final HashMap<String, Integer> stringToIndex = new HashMap<String, Integer>();
 
     /**
      * holds the index-to-string lookups.
      */
-    private final HashMap indexToString = new HashMap();
+    private final HashMap<Integer, String> indexToString = new HashMap<Integer,
String>();
 
     /**
      * a copy of the {@link #stringToIndex} as properties class for faster
@@ -94,11 +94,11 @@
             InputStream in = file.getInputStream();
             stringToIndexProps.clear();
             stringToIndexProps.load(in);
-            Iterator iter = stringToIndexProps.keySet().iterator();
+            Iterator<Object> iter = stringToIndexProps.keySet().iterator();
             while (iter.hasNext()) {
                 String uri = (String) iter.next();
                 String prop = stringToIndexProps.getProperty(uri);
-                Integer idx = new Integer(prop);
+                Integer idx = Integer.valueOf(prop);
                 stringToIndex.put(uri, idx);
                 indexToString.put(idx, uri);
             }
@@ -127,7 +127,7 @@
      * and if the resource was modified since.
      */
     public int stringToIndex(String nsUri) {
-        Integer idx = (Integer) stringToIndex.get(nsUri);
+        Integer idx = stringToIndex.get(nsUri);
         if (idx == null) {
             try {
                 load();
@@ -136,10 +136,10 @@
                 ise.initCause(e);
                 throw ise;
             }
-            idx = (Integer) stringToIndex.get(nsUri);
+            idx = stringToIndex.get(nsUri);
         }
         if (idx == null) {
-            idx = new Integer(indexToString.size());
+            idx = Integer.valueOf(indexToString.size());
             stringToIndex.put(nsUri, idx);
             indexToString.put(idx, nsUri);
             stringToIndexProps.put(nsUri, idx.toString());
@@ -161,8 +161,8 @@
      * and if the resource was modified since.
      */
     public String indexToString(int i) {
-        Integer idx = new Integer(i);
-        String s = (String) indexToString.get(idx);
+        Integer idx = Integer.valueOf(i);
+        String s = indexToString.get(idx);
         if (s == null) {
             try {
                 load();
@@ -171,7 +171,7 @@
                 ise.initCause(e);
                 throw ise;
             }
-            s = (String) indexToString.get(idx);
+            s = indexToString.get(idx);
         }
         return s;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
Mon May 11 13:17:58 2009
@@ -169,10 +169,10 @@
     public void writeState(DataOutputStream out, NodeReferences state)
             throws IOException {
         // references
-        Collection c = state.getReferences();
+        Collection<PropertyId> c = state.getReferences();
         out.writeInt(c.size() | (VERSION_CURRENT << 24)); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
-            PropertyId propId = (PropertyId) iter.next();
+        for (Iterator<PropertyId> iter = c.iterator(); iter.hasNext();) {
+            PropertyId propId = iter.next();
             writePropertyId(out, propId);
         }
     }
@@ -204,7 +204,7 @@
 
         // mixin types
         int count = in.readInt();   // count
-        Set set = new HashSet(count);
+        Set<Name> set = new HashSet<Name>(count);
         for (int i = 0; i < count; i++) {
             set.add(readQName(in)); // name
         }
@@ -254,33 +254,33 @@
         // definitionId
         out.writeUTF(state.getDefinitionId().toString());
         // mixin types
-        Collection c = state.getMixinTypeNames();
+        Collection<Name> c = state.getMixinTypeNames();
         out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
-            writeQName(out, (Name) iter.next());
+        for (Iterator<Name> iter = c.iterator(); iter.hasNext();) {
+            writeQName(out, iter.next());
         }
         // properties (names)
         c = state.getPropertyNames();
         out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
-            Name pName = (Name) iter.next();
+        for (Iterator<Name> iter = c.iterator(); iter.hasNext();) {
+            Name pName = iter.next();
             writeIndexedQName(out, pName);
         }
         // child nodes (list of name/uuid pairs)
-        c = state.getChildNodeEntries();
-        out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
-            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
+        Collection<ChildNodeEntry> collChild = state.getChildNodeEntries();
+        out.writeInt(collChild.size()); // count
+        for (Iterator<ChildNodeEntry> iter = collChild.iterator(); iter.hasNext();)
{
+            ChildNodeEntry entry = iter.next();
             writeQName(out, entry.getName());   // name
             writeID(out, entry.getId());  // uuid
         }
         writeModCount(out, state.getModCount());
         
         // shared set (list of parent uuids)
-        c = state.getSharedSet();
-        out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
-            writeID(out, (NodeId) iter.next());
+        Collection<NodeId> collShared = state.getSharedSet();
+        out.writeInt(collShared.size()); // count
+        for (Iterator<NodeId> iter = collShared.iterator(); iter.hasNext();) {
+            writeID(out, iter.next());
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/LRUNodeIdCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/LRUNodeIdCache.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/LRUNodeIdCache.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/LRUNodeIdCache.java
Mon May 11 13:17:58 2009
@@ -39,12 +39,12 @@
     /**
      * the number of cache hits
      */
-    private long hits = 0;
+    private long hits;
 
     /**
      * the number of cache misses
      */
-    private long misses = 0;
+    private long misses;
 
     /**
      * the map of cached ids

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/PostgreSQLNameIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/PostgreSQLNameIndex.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/PostgreSQLNameIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/PostgreSQLNameIndex.java
Mon May 11 13:17:58 2009
@@ -65,7 +65,7 @@
         } catch (Exception e) {
             IllegalStateException ise = new IllegalStateException("Unable to insert index
for string: " + string);
             ise.initCause(e);
-            throw ise ;
+            throw ise;
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
Mon May 11 13:17:58 2009
@@ -86,9 +86,9 @@
         // definitionId
         out.writeUTF(state.getDefinitionId().toString());
         // mixin types
-        Collection c = state.getMixinTypeNames();
+        Collection<Name> c = state.getMixinTypeNames();
         out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
+        for (Iterator<Name> iter = c.iterator(); iter.hasNext();) {
             out.writeUTF(iter.next().toString());   // name
         }
         // modCount
@@ -96,14 +96,14 @@
         // properties (names)
         c = state.getPropertyNames();
         out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
+        for (Iterator<Name> iter = c.iterator(); iter.hasNext();) {
             Name propName = (Name) iter.next();
             out.writeUTF(propName.toString());   // name
         }
         // child nodes (list of name/uuid pairs)
-        c = state.getChildNodeEntries();
-        out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
+        Collection<ChildNodeEntry> collChildren = state.getChildNodeEntries();
+        out.writeInt(collChildren.size()); // count
+        for (Iterator<ChildNodeEntry> iter = collChildren.iterator(); iter.hasNext();)
{
             ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             out.writeUTF(entry.getName().toString());   // name
             out.write(entry.getId().getUUID().getRawBytes());    // uuid
@@ -137,9 +137,9 @@
         state.setDefinitionId(NodeDefId.valueOf(s));
         // mixin types
         int count = in.readInt();   // count
-        Set set = new HashSet(count);
+        Set<Name> set = new HashSet<Name>(count);
         for (int i = 0; i < count; i++) {
-            set.add(NameFactoryImpl.getInstance().create(in.readUTF())); // name
+            set.add(NameFactoryImpl.getInstance().create(in.readUTF()));
         }
         if (set.size() > 0) {
             state.setMixinTypeNames(set);
@@ -327,10 +327,10 @@
         DataOutputStream out = new DataOutputStream(stream);
 
         // references
-        Collection c = refs.getReferences();
+        Collection<PropertyId> c = refs.getReferences();
         out.writeInt(c.size()); // count
-        for (Iterator iter = c.iterator(); iter.hasNext();) {
-            PropertyId propId = (PropertyId) iter.next();
+        for (Iterator<PropertyId> iter = c.iterator(); iter.hasNext();) {
+            PropertyId propId = iter.next();
             out.writeUTF(propId.toString());   // propertyId
         }
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/MLRUItemStateCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/MLRUItemStateCache.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/MLRUItemStateCache.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/MLRUItemStateCache.java
Mon May 11 13:17:58 2009
@@ -47,10 +47,10 @@
     private long maxMem;
 
     /** the number of writes */
-    private long numWrites = 0;
+    private long numWrites;
 
     /** the access count */
-    private long accessCount = 0;
+    private long accessCount;
 
     /** the cache access listeners */
     private CacheAccessListener accessListener;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java?rev=773554&r1=773553&r2=773554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java
Mon May 11 13:17:58 2009
@@ -32,11 +32,11 @@
     /**
      * mapping <original uuid> to <new uuid> of mix:referenceable nodes
      */
-    private final HashMap uuidMap = new HashMap();
+    private final HashMap<UUID, UUID> uuidMap = new HashMap<UUID, UUID>();
     /**
      * list of processed reference properties that might need correcting
      */
-    private final ArrayList references = new ArrayList();
+    private final ArrayList<Object> references = new ArrayList<Object>();
 
     /**
      * Creates a new instance.
@@ -82,7 +82,7 @@
      * @see #mappedUUID(UUID, UUID)
      */
     public UUID getMappedUUID(UUID oldUUID) {
-        return (UUID) uuidMap.get(oldUUID);
+        return uuidMap.get(oldUUID);
     }
 
     /**
@@ -91,7 +91,7 @@
      * @return an iterator over all processed reference properties
      * @see #processedReference(Object)
      */
-    public Iterator getProcessedReferences() {
+    public Iterator<Object> getProcessedReferences() {
         return references.iterator();
     }
 }



Mime
View raw message