jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1166638 [3/3] - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/ jackrabbit-jcr-commons/src/main/java/org/apac...
Date Thu, 08 Sep 2011 11:50:45 GMT
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java Thu Sep  8 11:50:44 2011
@@ -22,13 +22,12 @@ import java.lang.ref.PhantomReference;
 import java.lang.ref.ReferenceQueue;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Collections;
 
 /**
- * The <code>TransientFileFactory</code> utility class can be used to create
+ * The {@code TransientFileFactory} utility class can be used to create
  * <i>transient</i> files, i.e. temporary files that are automatically
- * removed once the associated <code>File</code> object is reclaimed by the
+ * removed once the associated {@code File} object is reclaimed by the
  * garbage collector.
  * <p/>
  * File deletion is handled by a low-priority background thread.
@@ -42,13 +41,13 @@ public class TransientFileFactory {
     private static TransientFileFactory INSTANCE;
 
     /**
-     * Queue where <code>MoribundFileReference</code> instances will be enqueued
-     * once the associated target <code>File</code> objects have been gc'ed.
+     * Queue where {@code MoribundFileReference} instances will be queued
+     * once the associated target {@code File} objects have been gc-ed.
      */
     private final ReferenceQueue<File> phantomRefQueue = new ReferenceQueue<File>();
 
     /**
-     * Collection of <code>MoribundFileReference</code> instances currently
+     * Collection of {@code MoribundFileReference} instances currently
      * being tracked.
      */
     private final Collection<MoribundFileReference> trackedRefs =
@@ -62,18 +61,16 @@ public class TransientFileFactory {
     /**
      * Shutdown hook which removes all files awaiting deletion
      */
-    private static Thread shutdownHook = null;
+    private static Thread shutdownHook;
 
     /**
-     * Returns the singleton <code>TransientFileFactory</code> instance.
+     * Returns the singleton {@code TransientFileFactory} instance.
      */
-    public static TransientFileFactory getInstance() {
-        synchronized (TransientFileFactory.class) {
-            if (INSTANCE == null) {
-                INSTANCE = new TransientFileFactory();
-            }
-            return INSTANCE;
+    public static synchronized TransientFileFactory getInstance() {
+        if (INSTANCE == null) {
+            INSTANCE = new TransientFileFactory();
         }
+        return INSTANCE;
     }
 
     /**
@@ -85,16 +82,17 @@ public class TransientFileFactory {
         reaper.setPriority(Thread.MIN_PRIORITY);
         reaper.setDaemon(true);
         reaper.start();
-        // register shutdownhook for final cleaning up
+        // register shutdown hook for final cleaning up
         try {
             shutdownHook = new Thread() {
+                @Override
                 public void run() {
                     doShutdown();
                 }
             };
             Runtime.getRuntime().addShutdownHook(shutdownHook);
         } catch (IllegalStateException e) {
-            // can't register shutdownhook because
+            // can't register shutdown hook because
             // jvm shutdown sequence has already begun,
             // silently ignore...
         }
@@ -104,15 +102,15 @@ public class TransientFileFactory {
     /**
      * Same as {@link File#createTempFile(String, String, File)} except that
      * the newly-created file will be automatically deleted once the
-     * returned <code>File</code> object has been gc'ed.
+     * returned {@code File} object has been gc-ed.
      *
      * @param prefix    The prefix string to be used in generating the file's
      *                  name; must be at least three characters long
      * @param suffix    The suffix string to be used in generating the file's
-     *                  name; may be <code>null</code>, in which case the
-     *                  suffix <code>".tmp"</code> will be used
+     *                  name; may be {@code null}, in which case the
+     *                  suffix {@code ".tmp"} will be used
      * @param directory The directory in which the file is to be created, or
-     *                  <code>null</code> if the default temporary-file
+     *                  {@code null} if the default temporary-file
      *                  directory is to be used
      * @return the newly-created empty file
      * @throws IOException If a file could not be created
@@ -150,8 +148,8 @@ public class TransientFileFactory {
         // to avoid ConcurrentModificationException (JCR-549)
         // @see java.lang.util.Collections.synchronizedList(java.util.List)
         synchronized(trackedRefs) {
-            for (Iterator<MoribundFileReference> it = trackedRefs.iterator(); it.hasNext();) {
-                it.next().delete();
+            for (MoribundFileReference trackedRef : trackedRefs) {
+                trackedRef.delete();
             }
 
         }
@@ -159,7 +157,7 @@ public class TransientFileFactory {
             try {
                 Runtime.getRuntime().removeShutdownHook(shutdownHook);
             } catch (IllegalStateException e) {
-                // can't unregister shutdownhook because
+                // can't unregister shutdown hook because
                 // jvm shutdown sequence has already begun,
                 // silently ignore... 
             }
@@ -173,8 +171,7 @@ public class TransientFileFactory {
      * The reaper thread that will remove the files that are ready for deletion.
      */
     private class ReaperThread extends Thread {
-
-        private volatile boolean stopping = false;
+        private volatile boolean stopping;
 
         ReaperThread(String name) {
             super(name);
@@ -184,6 +181,7 @@ public class TransientFileFactory {
          * Run the reaper thread that will delete files as their associated
          * marker objects are reclaimed by the garbage collector.
          */
+        @Override
         public void run() {
             while (!stopping) {
                 MoribundFileReference fileRef = null;
@@ -232,14 +230,14 @@ public class TransientFileFactory {
          */
         MoribundFileReference(File file, ReferenceQueue<File> queue) {
             super(file, queue);
-            this.path = file.getPath();
+            path = file.getPath();
         }
 
         /**
          * Deletes the file associated with this instance.
          *
-         * @return <code>true</code> if the file was deleted successfully;
-         *         <code>false</code> otherwise.
+         * @return {@code true} if the file was deleted successfully;
+         *         {@code false} otherwise.
          */
         boolean delete() {
             return new File(path).delete();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java Thu Sep  8 11:50:44 2011
@@ -16,40 +16,34 @@
  */
 package org.apache.jackrabbit.util;
 
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.BitSet;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.BitSet;
-import java.lang.ref.Reference;
-import java.lang.ref.WeakReference;
-import java.lang.ref.ReferenceQueue;
 
 /**
- * <code>WeakIdentityCollection</code> implements a Collection with weak values.
+ * {@code WeakIdentityCollection} implements a Collection with weak values.
  * Equality of elements is tested using the == operator.
  * <p/>
  * This collection does not hide the fact that the garbage collector will remove
  * a mapping at some point in time. Thus, the {@link java.util.Iterator} returned
- * by this collection might return <code>null</code> values. The same applies
+ * by this collection might return {@code null} values. The same applies
  * to the method {@link #toArray()} in both its variants.
  */
-public class WeakIdentityCollection implements Collection {
+public class WeakIdentityCollection<E> implements Collection<E> {
 
     /**
      * The weak references.
      */
-    private transient WeakRef[] elementData;
-
-    /**
-     * The current number of elements in {@link #elementData}.
-     */
-    private int size;
+    private final transient ArrayList<WeakRef> elementData;
 
     /**
      * The reference queue to poll for references that point to unreachable
      * objects.
      */
-    private final ReferenceQueue refQueue = new ReferenceQueue();
+    private final ReferenceQueue<E> refQueue = new ReferenceQueue<E>();
 
     /**
      * BitSet where a set bit indicates that the slot at this position in
@@ -64,10 +58,9 @@ public class WeakIdentityCollection impl
      */
     public WeakIdentityCollection(int initialCapacity) {
         if (initialCapacity < 0) {
-            throw new IllegalArgumentException("Illegal Capacity: " +
-                    initialCapacity);
+            throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
         }
-        this.elementData = new WeakRef[initialCapacity];
+        elementData = new ArrayList<WeakRef>(initialCapacity);
     }
 
     /**
@@ -75,67 +68,67 @@ public class WeakIdentityCollection impl
      *
      * @return the current size of this collection.
      */
+    @Override
     public int size() {
-        return size;
+        return elementData.size();
     }
 
     /**
-     * Returns <code>true</code> if this collection is empty.
+     * Returns {@code true} if this collection is empty.
      *
-     * @return <code>true</code> if this collection is empty.
+     * @return {@code true} if this collection is empty.
      */
+    @Override
     public boolean isEmpty() {
-        return size == 0;
+        return elementData.isEmpty();
     }
 
     /**
      * Releases all references held by this collection.
      */
+    @Override
     public void clear() {
-        for (int i = 0; i < size; i++) {
-            elementData[i] = null;
-        }
-        size = 0;
+        elementData.clear();
         emptySlots.clear();
     }
 
     /**
-     * Adds object <code>o</code> to this collection.
+     * Adds object {@code o} to this collection.
      *
      * @param o the object to add.
-     * @return always <code>true</code> as this collection allows duplicates.
-     * @throws NullPointerException if <code>o</code> is <code>null</code>.
+     * @return always {@code true} as this collection allows duplicates.
+     * @throws NullPointerException if {@code o} is {@code null}.
      */
-    public boolean add(Object o) {
+    @Override
+    public boolean add(E o) {
         if (o == null) {
             throw new NullPointerException("Object must not be null");
         }
         // poll refQueue for a slot we can reuse
         WeakRef ref = (WeakRef) refQueue.poll();
         if (ref != null) {
-            elementData[ref.index] = new WeakRef(o, ref.index);
+            elementData.set(ref.index, new WeakRef(o, ref.index));
             cleanQueue();
         } else if (!emptySlots.isEmpty()) {
             int idx = emptySlots.nextSetBit(0);
-            elementData[idx] = new WeakRef(o, idx);
+            elementData.set(idx, new WeakRef(o, idx));
             emptySlots.clear(idx);
         } else {
-            ensureCapacity(size + 1);
-            elementData[size++] = new WeakRef(o, size - 1);
+            elementData.add(new WeakRef(o, elementData.size()));
         }
         return true;
     }
 
     /**
-     * Returns <code>true</code> if this collection contains <code>o</code>.
+     * Returns {@code true} if this collection contains {@code o}.
      *
      * @param o element whose presence in this collection is to be tested.
-     * @return <code>true</code> if this collection contains the specified
-     *         element
+     * @return {@code true} if this collection contains the specified element
      */
+    @Override
     public boolean contains(Object o) {
-        for (int i = 0; i < size; i++) {
-            if (elementData[i].get() == o) {
+        for (WeakRef anElementData : elementData) {
+            if (anElementData.get() == o) {
                 return true;
             }
         }
@@ -143,18 +136,18 @@ public class WeakIdentityCollection impl
     }
 
     /**
-     * Removes the object <code>o</code> from this collection if it is present.
+     * Removes the object {@code o} from this collection if it is present.
      *
      * @param o the object to remove.
-     * @return <code>true</code> if this collection changed as a result of the
-     *         call.
+     * @return {@code true} if this collection changed as a result of the call.
      */
+    @Override
     public boolean remove(Object o) {
-        for (int i = 0; i < size; i++) {
-            if (elementData[i].get() == o) {
+        for (int i = 0; i < elementData.size(); i++) {
+            if (elementData.get(i).get() == o) {
                 emptySlots.set(i);
                 // overwrite entry with dummy ref
-                elementData[i] = new WeakRef(null, i);
+                elementData.set(i, new WeakRef(null, i));
                 return true;
             }
         }
@@ -164,28 +157,32 @@ public class WeakIdentityCollection impl
     /**
      * @throws UnsupportedOperationException always.
      */
-    public boolean addAll(Collection c) {
+    @Override
+    public boolean addAll(Collection<? extends E> c) {
         throw new UnsupportedOperationException("addAll");
     }
 
     /**
      * @throws UnsupportedOperationException always.
      */
-    public boolean containsAll(Collection c) {
+    @Override
+    public boolean containsAll(Collection<?> c) {
         throw new UnsupportedOperationException("containsAll");
     }
 
     /**
      * @throws UnsupportedOperationException always.
      */
-    public boolean removeAll(Collection c) {
+    @Override
+    public boolean removeAll(Collection<?> c) {
         throw new UnsupportedOperationException("removeAll");
     }
 
     /**
      * @throws UnsupportedOperationException always.
      */
-    public boolean retainAll(Collection c) {
+    @Override
+    public boolean retainAll(Collection<?> c) {
         throw new UnsupportedOperationException("retainAll");
     }
 
@@ -195,38 +192,60 @@ public class WeakIdentityCollection impl
      * not throw a {@link java.util.ConcurrentModificationException} if this
      * collection is modified while iterating over the collection.
      *
-     * @return an {@link java.util.Iterator} over the elements of this
-     *         collection.
+     * @return an {@link java.util.Iterator} over the elements of this collection.
      */
-    public Iterator iterator() {
-        return new Iter();
+    @Override
+    public Iterator<E> iterator() {
+        return new Iterator<E>() {
+            private final Iterator<WeakRef> elementIterator = elementData.iterator();
+
+            @Override
+            public boolean hasNext() {
+                return elementIterator.hasNext();
+            }
+
+            @Override
+            public E next() {
+                return elementIterator.next().get();
+            }
+
+            @Override
+            public void remove() {
+                elementIterator.remove();
+            }
+        };
     }
 
     /**
      * Returns an array containing all of the elements in this collection. The
-     * returned array may contain <code>null</code> elements!
+     * returned array may contain {@code null} elements!
      *
      * @return an array containing all of the elements in this collection.
      */
+    @Override
     public Object[] toArray() {
-        Object[] result = new Object[size];
+        Object[] result = new Object[elementData.size()];
         for (int i = 0; i < result.length; i++) {
-            result[i] = elementData[i].get();
+            result[i] = elementData.get(i).get();
         }
         return result;
     }
 
     /**
-     * The returned array may contain <code>null</code> elements!
+     * The returned array may contain {@code null} elements!
      * @inheritDoc
      */
-    public Object[] toArray(Object a[]) {
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] a) {
+        int size = elementData.size();
+        
         if (a.length < size) {
-            a = (Object[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size);
+            a = (T[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size);
         }
 
         for (int i = 0; i < size; i++) {
-            a[i] = elementData[i].get();
+            a[i] = (T) elementData.get(i).get();
         }
 
         if (a.length > size) {
@@ -237,24 +256,6 @@ public class WeakIdentityCollection impl
     }
 
     /**
-     * Ensures that the internal {@link #elementData} has
-     * <code>minCapacity</code>.
-     *
-     * @param minCapacity the minimal capacity to ensure.
-     */
-    private void ensureCapacity(int minCapacity) {
-        int oldCapacity = elementData.length;
-        if (minCapacity > oldCapacity) {
-            Object oldData[] = elementData;
-            int newCapacity = (oldCapacity * 3)/2 + 1;
-                if (newCapacity < minCapacity)
-            newCapacity = minCapacity;
-            elementData = new WeakRef[newCapacity];
-            System.arraycopy(oldData, 0, elementData, 0, size);
-        }
-    }
-
-    /**
      * Polls the reference queue until no reference is available anymore.
      */
     private void cleanQueue() {
@@ -265,55 +266,10 @@ public class WeakIdentityCollection impl
     }
 
     /**
-     * Iterator implementation for this collecation.
-     */
-    private final class Iter implements Iterator {
-
-        /**
-         * current index.
-         */
-        private int index;
-
-        /**
-         * The current element data.
-         */
-        private Reference[] elements = elementData;
-
-        /**
-         * The current size of this collection.
-         */
-        private int size = WeakIdentityCollection.this.size;
-
-        /**
-         * @throws UnsupportedOperationException always.
-         */
-        public void remove() {
-            throw new UnsupportedOperationException("remove");
-        }
-
-        /**
-         * @inheritDoc
-         */
-        public boolean hasNext() {
-            return index < size;
-        }
-
-        /**
-         * @inheritDoc
-         */
-        public Object next() {
-            if (index >= size) {
-                throw new NoSuchElementException();
-            }
-            return elements[index++].get();
-        }
-    }
-
-    /**
      * Weak reference with index value that points to the slot in {@link
      * WeakIdentityCollection#elementData}.
      */
-    private final class WeakRef extends WeakReference {
+    private final class WeakRef extends WeakReference<E> {
 
         /**
          * The index of this weak reference.
@@ -326,7 +282,7 @@ public class WeakIdentityCollection impl
          * @param referent object the new weak reference will refer to.
          * @param index    the index of this weak reference.
          */
-        public WeakRef(Object referent, int index) {
+        public WeakRef(E referent, int index) {
             super(referent, refQueue);
             this.index = index;
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java Thu Sep  8 11:50:44 2011
@@ -30,11 +30,11 @@ import java.util.Arrays;
  * A series of convenience methods are supplied to ease the burden
  * of the developer. Because inlining the checks can improve per
  * character performance, the tables of character properties are
- * public. Using the character as an index into the <code>CHARS</code>
+ * public. Using the character as an index into the {@code CHARS}
  * array and applying the appropriate mask flag (e.g.
- * <code>MASK_VALID</code>), yields the same results as calling the
+ * {@code MASK_VALID}), yields the same results as calling the
  * convenience methods. There is one exception: check the comments
- * for the <code>isValid</code> method for details.
+ * for the {@code isValid} method for details.
  *
  * @author Glenn Marcy, IBM
  * @author Andy Clark, IBM
@@ -85,15 +85,16 @@ public class XMLChar {
     /** NCName character mask. */
     public static final int MASK_NCNAME = 0x80;
 
+    private XMLChar() {
+    }
+
     //
     // Static initialization
     //
 
     static {
-
         // Initializing the Character Flag Array
         // Code generated by: XMLCharGenerator.
-
         CHARS[9] = 35;
         CHARS[10] = 19;
         CHARS[13] = 19;
@@ -726,7 +727,7 @@ public class XMLChar {
      * @param c The character to check.
      */
     public static boolean isSupplemental(int c) {
-        return (c >= 0x10000 && c <= 0x10FFFF);
+        return c >= 0x10000 && c <= 0x10FFFF;
     }
 
     /**
@@ -737,7 +738,7 @@ public class XMLChar {
      * @param l The low surrogate.
      */
     public static int supplemental(char h, char l) {
-        return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000;
+        return (h - 0xD800) * 0x400 + l - 0xDC00 + 0x10000;
     }
 
     /**
@@ -746,7 +747,7 @@ public class XMLChar {
      * @param c The supplemental character to "split".
      */
     public static char highSurrogate(int c) {
-        return (char) (((c - 0x00010000) >> 10) + 0xD800);
+        return (char) ((c - 0x00010000 >> 10) + 0xD800);
     }
 
     /**
@@ -755,7 +756,7 @@ public class XMLChar {
      * @param c The supplemental character to "split".
      */
     public static char lowSurrogate(int c) {
-        return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00);
+        return (char) ((c - 0x00010000 & 0x3FF) + 0xDC00);
     }
 
     /**
@@ -764,7 +765,7 @@ public class XMLChar {
      * @param c The character to check.
      */
     public static boolean isHighSurrogate(int c) {
-        return (0xD800 <= c && c <= 0xDBFF);
+        return 0xD800 <= c && c <= 0xDBFF;
     }
 
     /**
@@ -773,7 +774,7 @@ public class XMLChar {
      * @param c The character to check.
      */
     public static boolean isLowSurrogate(int c) {
-        return (0xDC00 <= c && c <= 0xDFFF);
+        return 0xDC00 <= c && c <= 0xDFFF;
     }
 
 
@@ -782,14 +783,13 @@ public class XMLChar {
      * also checks the surrogate character range from 0x10000 to 0x10FFFF.
      * <p>
      * If the program chooses to apply the mask directly to the
-     * <code>CHARS</code> array, then they are responsible for checking
+     * {@code CHARS} array, then they are responsible for checking
      * the surrogate character range.
      *
      * @param c The character to check.
      */
     public static boolean isValid(int c) {
-        return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) ||
-               (0x10000 <= c && c <= 0x10FFFF);
+        return c < 0x10000 && (CHARS[c] & MASK_VALID) != 0 || 0x10000 <= c && c <= 0x10FFFF;
     } // isValid(int):boolean
 
     /**
@@ -807,8 +807,7 @@ public class XMLChar {
      * @param c The character to check.
      */
     public static boolean isContent(int c) {
-        return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) ||
-               (0x10000 <= c && c <= 0x10FFFF);
+        return c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0 || 0x10000 <= c && c <= 0x10FFFF;
     } // isContent(int):boolean
 
     /**
@@ -897,14 +896,16 @@ public class XMLChar {
      * @return true if name is a valid Name
      */
     public static boolean isValidName(String name) {
-        if (name.length() == 0)
+        if (name.length() == 0) {
             return false;
+        }
         char ch = name.charAt(0);
-        if( isNameStart(ch) == false)
-           return false;
+        if (!isNameStart(ch)) {
+            return false;
+        }
         for (int i = 1; i < name.length(); i++ ) {
            ch = name.charAt(i);
-           if( isName( ch ) == false ){
+           if(!isName(ch)){
               return false;
            }
         }
@@ -924,14 +925,16 @@ public class XMLChar {
      * @return true if name is a valid NCName
      */
     public static boolean isValidNCName(String ncName) {
-        if (ncName.length() == 0)
+        if (ncName.length() == 0) {
             return false;
+        }
         char ch = ncName.charAt(0);
-        if( isNCNameStart(ch) == false)
-           return false;
+        if(!isNCNameStart(ch)) {
+            return false;
+        }
         for (int i = 1; i < ncName.length(); i++ ) {
            ch = ncName.charAt(i);
-           if( isNCName( ch ) == false ){
+           if(!isNCName(ch)){
               return false;
            }
         }
@@ -949,8 +952,9 @@ public class XMLChar {
      * @return true if nmtoken is a valid Nmtoken
      */
     public static boolean isValidNmtoken(String nmtoken) {
-        if (nmtoken.length() == 0)
+        if (nmtoken.length() == 0) {
             return false;
+        }
         for (int i = 0; i < nmtoken.length(); i++ ) {
            char ch = nmtoken.charAt(i);
            if(  ! isName( ch ) ){
@@ -979,7 +983,7 @@ public class XMLChar {
             int length = ianaEncoding.length();
             if (length > 0) {
                 char c = ianaEncoding.charAt(0);
-                if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
+                if (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z') {
                     for (int i = 1; i < length; i++) {
                         c = ianaEncoding.charAt(i);
                         if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryImpl.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryImpl.java Thu Sep  8 11:50:44 2011
@@ -31,7 +31,7 @@ import java.io.FileNotFoundException;
 import java.io.ByteArrayInputStream;
 
 /**
- * <code>BinaryImpl</code> implements the <code>Binary</code> interface.
+ * {@code BinaryImpl} implements the {@code Binary} interface.
  */
 public class BinaryImpl implements Binary {
 
@@ -56,12 +56,12 @@ public class BinaryImpl implements Binar
     private byte[] buffer = EMPTY_BYTE_ARRAY;
 
     /**
-     * Creates a new <code>BinaryImpl</code> instance from an
-     * <code>InputStream</code>. The contents of the stream is spooled
+     * Creates a new {@code BinaryImpl} instance from an
+     * {@code InputStream}. The contents of the stream is spooled
      * to a temporary file or to a byte buffer if its size is smaller than
      * {@link #MAX_BUFFER_SIZE}.
      * <p/>
-     * @param in stream to be represented as a <code>BLOBFileValue</code> instance
+     * @param in stream to be represented as a {@code BLOBFileValue} instance
      * @throws IOException if an error occurs while reading from the stream or
      *                     writing to the temporary file
      */
@@ -107,10 +107,10 @@ public class BinaryImpl implements Binar
     }
 
     /**
-     * Creates a new <code>BinaryImpl</code> instance from a
-     * <code>byte[]</code> array.
+     * Creates a new {@code BinaryImpl} instance from a
+     * {@code byte[]} array.
      *
-     * @param buffer byte array to be represented as a <code>BinaryImpl</code>
+     * @param buffer byte array to be represented as a {@code BinaryImpl}
      *               instance
      */
     public BinaryImpl(byte[] buffer) {
@@ -121,9 +121,7 @@ public class BinaryImpl implements Binar
         tmpFile = null;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public InputStream getStream() throws RepositoryException {
         if (tmpFile != null) {
             try {
@@ -138,9 +136,7 @@ public class BinaryImpl implements Binar
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public int read(byte[] b, long position) throws IOException, RepositoryException {
         if (tmpFile != null) {
             // this instance is backed by a temp file
@@ -163,9 +159,7 @@ public class BinaryImpl implements Binar
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public long getSize() throws RepositoryException {
         if (tmpFile != null) {
             // this instance is backed by a temp file
@@ -180,9 +174,7 @@ public class BinaryImpl implements Binar
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void dispose() {
         if (tmpFile != null) {
             // this instance is backed by a temp file

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java Thu Sep  8 11:50:44 2011
@@ -25,8 +25,8 @@ import java.util.Calendar;
 import java.math.BigDecimal;
 
 /**
- * A <code>DateValue</code> provides an implementation
- * of the <code>Value</code> interface representing a date value.
+ * A {@code DateValue} provides an implementation
+ * of the {@code Value} interface representing a date value.
  */
 public class DateValue extends BaseValue {
 
@@ -35,9 +35,9 @@ public class DateValue extends BaseValue
     private final Calendar date;
 
     /**
-     * Constructs a <code>DateValue</code> object representing a date.
+     * Constructs a {@code DateValue} object representing a date.
      *
-     * @param date the date this <code>DateValue</code> should represent
+     * @param date the date this {@code DateValue} should represent
      * @throws IllegalArgumentException if the given date cannot be represented
      * as defined by ISO 8601.
      */
@@ -48,16 +48,16 @@ public class DateValue extends BaseValue
     }
 
     /**
-     * Returns a new <code>DateValue</code> initialized to the value
-     * represented by the specified <code>String</code>.
+     * Returns a new {@code DateValue} initialized to the value
+     * represented by the specified {@code String}.
      * <p/>
-     * The specified <code>String</code> must be a ISO8601-compliant date/time
+     * The specified {@code String} must be a ISO8601-compliant date/time
      * string.
      *
      * @param s the string to be parsed.
-     * @return a newly constructed <code>DateValue</code> representing the
+     * @return a newly constructed {@code DateValue} representing the
      *         the specified value.
-     * @throws javax.jcr.ValueFormatException If the <code>String</code> is not a valid
+     * @throws javax.jcr.ValueFormatException If the {@code String} is not a valid
      *                              ISO8601-compliant date/time string.
      * @see ISO8601
      */
@@ -73,8 +73,8 @@ public class DateValue extends BaseValue
     /**
      * Indicates whether some other object is "equal to" this one.
      * <p/>
-     * The result is <code>true</code> if and only if the argument is not
-     * <code>null</code> and is a <code>DateValue</code> object that
+     * The result is {@code true} if and only if the argument is not
+     * {@code null} and is a {@code DateValue} object that
      * represents the same value as this object.
      * <p>
      * The value comparison is performed using the ISO 8601 string
@@ -87,8 +87,8 @@ public class DateValue extends BaseValue
      * an exact time comparison in UTC.
      *
      * @param obj the reference object with which to compare.
-     * @return <code>true</code> if this object is the same as the obj
-     *         argument; <code>false</code> otherwise.
+     * @return {@code true} if this object is the same as the obj
+     *         argument; {@code false} otherwise.
      */
     public boolean equals(Object obj) {
         if (this == obj) {
@@ -117,9 +117,8 @@ public class DateValue extends BaseValue
     }
 
     //------------------------------------------------------------< BaseValue >
-    /**
-     * {@inheritDoc}
-     */
+
+    @Override
     protected String getInternalString() throws ValueFormatException {
         if (date != null) {
             return ISO8601.format(date);
@@ -129,12 +128,9 @@ public class DateValue extends BaseValue
     }
 
     //----------------------------------------------------------------< Value >
-    /**
-     * {@inheritDoc}
-     */
-    public Calendar getDate()
-            throws ValueFormatException, IllegalStateException,
-            RepositoryException {
+
+    @Override
+    public Calendar getDate() throws IllegalStateException, RepositoryException {
         if (date != null) {
             return (Calendar) date.clone();
         } else {
@@ -142,12 +138,8 @@ public class DateValue extends BaseValue
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public long getLong()
-            throws ValueFormatException, IllegalStateException,
-            RepositoryException {
+    @Override
+    public long getLong() throws IllegalStateException, RepositoryException {
         if (date != null) {
             return date.getTimeInMillis();
         } else {
@@ -155,12 +147,8 @@ public class DateValue extends BaseValue
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public boolean getBoolean()
-            throws ValueFormatException, IllegalStateException,
-            RepositoryException {
+    @Override
+    public boolean getBoolean() throws IllegalStateException, RepositoryException {
         if (date != null) {
             throw new ValueFormatException("cannot convert date to boolean");
         } else {
@@ -168,12 +156,8 @@ public class DateValue extends BaseValue
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public double getDouble()
-            throws ValueFormatException, IllegalStateException,
-            RepositoryException {
+    @Override
+    public double getDouble() throws IllegalStateException, RepositoryException {
         if (date != null) {
             long ms = date.getTimeInMillis();
             if (ms <= Double.MAX_VALUE) {
@@ -185,12 +169,8 @@ public class DateValue extends BaseValue
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public BigDecimal getDecimal()
-            throws ValueFormatException, IllegalStateException,
-            RepositoryException {
+    @Override
+    public BigDecimal getDecimal() throws IllegalStateException, RepositoryException {
         if (date != null) {
             return new BigDecimal(date.getTimeInMillis());
         } else {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueFactoryImpl.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueFactoryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueFactoryImpl.java Thu Sep  8 11:50:44 2011
@@ -20,7 +20,7 @@ import javax.jcr.ValueFactory;
 import javax.jcr.ValueFormatException;
 
 /**
- * Simple extension of the <code>AbstractValueFactory</code> that omits any
+ * Simple extension of the {@code AbstractValueFactory} that omits any
  * validation checks for path and name values.
  *
  * @see javax.jcr.Session#getValueFactory()
@@ -30,7 +30,7 @@ public class ValueFactoryImpl extends Ab
     private static final ValueFactory valueFactory = new ValueFactoryImpl();
 
     /**
-     * Constructs a <code>ValueFactory</code> object.
+     * Constructs a {@code ValueFactory} object.
      */
     protected ValueFactoryImpl() {
     }
@@ -45,6 +45,7 @@ public class ValueFactoryImpl extends Ab
     /**
      * @see AbstractValueFactory#checkPathFormat(String)
      */
+    @Override
     protected void checkPathFormat(String pathValue) throws ValueFormatException {
         // ignore
     }
@@ -52,6 +53,7 @@ public class ValueFactoryImpl extends Ab
     /**
      * @see AbstractValueFactory#checkNameFormat(String)
      */
+    @Override
     protected void checkNameFormat(String nameValue) throws ValueFormatException {
         // ignore
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java Thu Sep  8 11:50:44 2011
@@ -40,7 +40,7 @@ import java.io.BufferedOutputStream;
 import java.net.URI;
 
 /**
- * The <code>ValueHelper</code> class provides several <code>Value</code>
+ * The {@code ValueHelper} class provides several {@code Value}
  * related utility methods.
  */
 public class ValueHelper {
@@ -60,7 +60,8 @@ public class ValueHelper {
      * @see #convert(Value, int, ValueFactory)
      */
     public static Value convert(String srcValue, int targetType, ValueFactory factory)
-        throws ValueFormatException, IllegalArgumentException {
+            throws ValueFormatException, IllegalArgumentException {
+
         if (srcValue == null) {
             return null;
         } else {
@@ -76,7 +77,8 @@ public class ValueHelper {
      * @throws IllegalArgumentException
      */
     public static Value convert(InputStream srcValue, int targetType, ValueFactory factory)
-        throws ValueFormatException, IllegalArgumentException {
+            throws ValueFormatException, IllegalArgumentException {
+
         if (srcValue == null) {
             return null;
         } else {
@@ -86,7 +88,7 @@ public class ValueHelper {
 
     /**
      * Same as {@link #convert(String[], int, ValueFactory)} using
-     * <code>ValueFactoryImpl</code>.
+     * {@code ValueFactoryImpl}.
      *
      * @param srcValues
      * @param targetType
@@ -96,6 +98,7 @@ public class ValueHelper {
      */
     public static Value[] convert(String[] srcValues, int targetType, ValueFactory factory)
             throws ValueFormatException, IllegalArgumentException {
+
         if (srcValues == null) {
             return null;
         }
@@ -113,9 +116,9 @@ public class ValueHelper {
      * @throws IllegalArgumentException
      * @see #convert(Value, int, ValueFactory)
      */
-    public static Value[] convert(InputStream[] srcValues, int targetType,
-                                  ValueFactory factory)
+    public static Value[] convert(InputStream[] srcValues, int targetType, ValueFactory factory)
             throws ValueFormatException, IllegalArgumentException {
+
         if (srcValues == null) {
             return null;
         }
@@ -134,9 +137,9 @@ public class ValueHelper {
      * @throws IllegalArgumentException
      * @see #convert(Value, int, ValueFactory)
      */
-    public static Value[] convert(Value[] srcValues, int targetType,
-                                  ValueFactory factory)
+    public static Value[] convert(Value[] srcValues, int targetType, ValueFactory factory)
             throws ValueFormatException, IllegalArgumentException {
+
         if (srcValues == null) {
             return null;
         }
@@ -175,8 +178,8 @@ public class ValueHelper {
      * @throws IllegalArgumentException
      */
     public static Value convert(Value srcValue, int targetType, ValueFactory factory)
-            throws ValueFormatException, IllegalStateException,
-            IllegalArgumentException {
+            throws ValueFormatException, IllegalStateException, IllegalArgumentException {
+
         if (srcValue == null) {
             return null;
         }
@@ -554,13 +557,11 @@ public class ValueHelper {
     }
 
     /**
-     *
      * @param srcValue
      * @param factory
      * @throws IllegalStateException
      */
-    public static Value copy(Value srcValue, ValueFactory factory)
-        throws IllegalStateException {
+    public static Value copy(Value srcValue, ValueFactory factory) throws IllegalStateException {
         if (srcValue == null) {
             return null;
         }
@@ -615,8 +616,7 @@ public class ValueHelper {
      * @param factory
      * @throws IllegalStateException
      */
-    public static Value[] copy(Value[] srcValues, ValueFactory factory)
-        throws IllegalStateException {
+    public static Value[] copy(Value[] srcValues, ValueFactory factory) throws IllegalStateException {
         if (srcValues == null) {
             return null;
         }
@@ -629,20 +629,19 @@ public class ValueHelper {
     }
 
     /**
-     * Serializes the given value to a <code>String</code>. The serialization
+     * Serializes the given value to a {@code String}. The serialization
      * format is the same as used by Document & System View XML, i.e.
      * binary values will be Base64-encoded whereas for all others
-     * <code>{@link Value#getString()}</code> will be used.
+     * {@code }{@link Value#getString()}</code> will be used.
      *
      * @param value        the value to be serialized
-     * @param encodeBlanks if <code>true</code> space characters will be encoded
-     *                     as <code>"_x0020_"</code> within he output string.
+     * @param encodeBlanks if {@code true} space characters will be encoded
+     *                     as {@code "_x0020_"} within he output string.
      * @return a string representation of the given value.
      * @throws IllegalStateException if the given value is in an illegal state
-     * @throws RepositoryException   if an error occured during the serialization.
+     * @throws RepositoryException   if an error occurred during the serialization.
      */
-    public static String serialize(Value value, boolean encodeBlanks)
-            throws IllegalStateException, RepositoryException {
+    public static String serialize(Value value, boolean encodeBlanks) throws IllegalStateException, RepositoryException {
         StringWriter writer = new StringWriter();
         try {
             serialize(value, encodeBlanks, false, writer);
@@ -654,24 +653,24 @@ public class ValueHelper {
     }
 
     /**
-     * Outputs the serialized value to a <code>Writer</code>. The serialization
+     * Outputs the serialized value to a {@code Writer}. The serialization
      * format is the same as used by Document & System View XML, i.e.
      * binary values will be Base64-encoded whereas for all others
-     * <code>{@link Value#getString()}</code> will be used for serialization.
+     * {@code }{@link Value#getString()}</code> will be used for serialization.
      *
      * @param value        the value to be serialized
-     * @param encodeBlanks if <code>true</code> space characters will be encoded
-     *                     as <code>"_x0020_"</code> within he output string.
-     * @param enforceBase64 if <code>true</code>, base64 encoding will always be used
+     * @param encodeBlanks if {@code true} space characters will be encoded
+     *                     as {@code "_x0020_"} within he output string.
+     * @param enforceBase64 if {@code true}, base64 encoding will always be used
      * @param writer       writer to output the encoded data
      * @throws IllegalStateException if the given value is in an illegal state
-     * @throws IOException           if an i/o error occured during the
+     * @throws IOException           if an i/o error occurred during the
      *                               serialization
-     * @throws RepositoryException   if an error occured during the serialization.
+     * @throws RepositoryException   if an error occurred during the serialization.
      */
-    public static void serialize(Value value, boolean encodeBlanks, boolean enforceBase64,
-                                 Writer writer)
+    public static void serialize(Value value, boolean encodeBlanks, boolean enforceBase64, Writer writer)
             throws IllegalStateException, IOException, RepositoryException {
+
         if (value.getType() == PropertyType.BINARY) {
             // binary data, base64 encoding required;
             // the encodeBlanks flag can be ignored since base64-encoded
@@ -691,12 +690,12 @@ public class ValueHelper {
         } else {
             String textVal = value.getString();
             if (enforceBase64) {
-                byte bytes[] = textVal.getBytes("UTF-8");
+                byte[] bytes = textVal.getBytes("UTF-8");
                 Base64.encode(bytes, 0, bytes.length, writer);
             }
             else {
                 if (encodeBlanks) {
-                    // enocde blanks in string
+                    // encode blanks in string
                     textVal = Text.replace(textVal, " ", "_x0020_");
                 }
                 writer.write(textVal);
@@ -705,23 +704,23 @@ public class ValueHelper {
     }
 
     /**
-     * Deserializes the given string to a <code>Value</code> of the given type.
+     * Deserializes the given string to a {@code Value} of the given type.
      *
      * @param value        string to be deserialized
      * @param type         type of value
-     * @param decodeBlanks if <code>true</code> <code>"_x0020_"</code>
+     * @param decodeBlanks if {@code true} {@code "_x0020_"}
      *                     character sequences will be decoded to single space
      *                     characters each.
-     * @param factory      ValueFactory used to build the <code>Value</code> object.
-     * @return the deserialized <code>Value</code>
+     * @param factory      ValueFactory used to build the {@code Value} object.
+     * @return the deserialized {@code Value}
      * @throws ValueFormatException if the string data is not of the required
      *                              format
-     * @throws RepositoryException  if an error occured during the
+     * @throws RepositoryException  if an error occurred during the
      *                              deserialization.
      */
-    public static Value deserialize(String value, int type, boolean decodeBlanks,
-                                    ValueFactory factory)
-            throws ValueFormatException, RepositoryException {
+    public static Value deserialize(String value, int type, boolean decodeBlanks, ValueFactory factory)
+            throws RepositoryException {
+
         if (type == PropertyType.BINARY) {
             // base64 encoded binary value;
             // the encodeBlanks flag can be ignored since base64-encoded
@@ -750,25 +749,25 @@ public class ValueHelper {
 
     /**
      * Deserializes the string data read from the given reader to a
-     * <code>Value</code> of the given type.
+     * {@code Value} of the given type.
      *
      * @param reader       reader for the string data to be deserialized
      * @param type         type of value
-     * @param decodeBlanks if <code>true</code> <code>"_x0020_"</code>
+     * @param decodeBlanks if {@code true} {@code "_x0020_"}
      *                     character sequences will be decoded to single space
      *                     characters each.
-     * @param factory      ValueFactory used to build the <code>Value</code> object.
-     * @return the deserialized <code>Value</code>
-     * @throws IOException          if an i/o error occured during the
+     * @param factory      ValueFactory used to build the {@code Value} object.
+     * @return the deserialized {@code Value}
+     * @throws IOException          if an i/o error occurred during the
      *                              serialization
      * @throws ValueFormatException if the string data is not of the required
      *                              format
-     * @throws RepositoryException  if an error occured during the
+     * @throws RepositoryException  if an error occurred during the
      *                              deserialization.
      */
-    public static Value deserialize(Reader reader, int type,
-                                    boolean decodeBlanks, ValueFactory factory)
-            throws IOException, ValueFormatException, RepositoryException {
+    public static Value deserialize(Reader reader, int type, boolean decodeBlanks, ValueFactory factory)
+            throws IOException, RepositoryException {
+        
         if (type == PropertyType.BINARY) {
             // base64 encoded binary value;
             // the encodeBlanks flag can be ignored since base64-encoded
@@ -790,19 +789,14 @@ public class ValueHelper {
             // pass InputStream wrapper to ValueFactory, that creates a BinaryValue.
             return factory.createValue(new FilterInputStream(new FileInputStream(tmpFile)) {
 
+                @Override
                 public void close() throws IOException {
                     in.close();
                     // temp file can now safely be removed
                     tmpFile.delete();
                 }
             });
-/*
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            Base64.decode(reader, baos);
-            // no need to close ByteArrayOutputStream
-            //baos.close();
-            return new BinaryValue(baos.toByteArray());
-*/
+
         } else {
             char[] chunk = new char[8192];
             int read;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java Thu Sep  8 11:50:44 2011
@@ -16,26 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import java.util.Iterator;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.MergeException;
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionException;
-import javax.jcr.version.VersionHistory;
-
 import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
@@ -47,6 +27,16 @@ import org.apache.jackrabbit.spi.commons
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionHistory;
+import java.util.Iterator;
+
 /**
  * {@code VersionManagerImpl}...
  */
@@ -318,4 +308,4 @@ public class JcrVersionManager implement
         }
         return activity;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java Thu Sep  8 11:50:44 2011
@@ -16,14 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.RepositoryException;
-
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
@@ -34,6 +26,11 @@ import org.apache.jackrabbit.util.WeakId
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.RepositoryException;
+import java.util.Collection;
+
 /**
  * {@code ItemState} represents the state of an {@code Item}.
  */
@@ -57,8 +54,8 @@ public abstract class ItemState {
     /**
      * Listeners (weak references)
      */
-    @SuppressWarnings("unchecked")
-    private final transient Collection<ItemStateLifeCycleListener> listeners = new WeakIdentityCollection(5);
+    private final transient Collection<ItemStateLifeCycleListener> listeners
+            = new WeakIdentityCollection<ItemStateLifeCycleListener>(5);
 
     /**
      * The {@code ItemStateFactory} which is used to create new

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathMap.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathMap.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathMap.java Thu Sep  8 11:50:44 2011
@@ -132,7 +132,7 @@ public class PathMap<T> {
      * Internal class holding the object associated with a certain
      * path element.
      */
-    public final static class Element<T> {
+    public static final class Element<T> {
 
         /**
          * Parent element

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java?rev=1166638&r1=1166637&r2=1166638&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java Thu Sep  8 11:50:44 2011
@@ -424,7 +424,7 @@ public abstract class Pattern {
 
     // -----------------------------------------------------< AbstractNamePattern >---
 
-    private static abstract class AbstractNamePattern extends Pattern {
+    private abstract static class AbstractNamePattern extends Pattern {
         protected abstract boolean matches(Element element);
 
         @Override



Mime
View raw message