directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1746258 [9/9] - in /directory/shared/branches/shared-value: asn1/ber/src/main/java/org/apache/directory/api/asn1/actions/ asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/ asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/gr...
Date Tue, 31 May 2016 09:32:13 GMT
Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/MandatoryComponentsMonitor.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/MandatoryComponentsMonitor.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/MandatoryComponentsMonitor.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/MandatoryComponentsMonitor.java
Tue May 31 09:32:09 2016
@@ -46,6 +46,7 @@ public class MandatoryComponentsMonitor
      * 
      * @return true if all components are used
      */
+    @Override
     public boolean finalStateValid()
     {
         return allComponentsUsed();

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Network.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Network.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Network.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Network.java
Tue May 31 09:32:09 2016
@@ -31,6 +31,8 @@ import java.net.InetAddress;
  */
 public final class Network
 {
+    public static final InetAddress LOOPBACK = getLoopbackAddress();
+    public static final String LOOPBACK_HOSTNAME = getLoopbackHostName();
 
     /**
      * Private constructor.
@@ -39,10 +41,7 @@ public final class Network
     {
     }
 
-    public static final InetAddress LOOPBACK = getLoopbackAddress();
-    public static final String LOOPBACK_HOSTNAME = getLoopbackHostName();
-
-
+    
     private static String getLoopbackHostName()
     {
         InetAddress loopbackAddress = InetAddress.getLoopbackAddress();
@@ -52,8 +51,7 @@ public final class Network
 
     private static InetAddress getLoopbackAddress()
     {
-        InetAddress loopbackAddress = InetAddress.getLoopbackAddress();
-        return loopbackAddress;
+        return InetAddress.getLoopbackAddress();
     }
 
 

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/NoDuplicateKeysMap.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/NoDuplicateKeysMap.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/NoDuplicateKeysMap.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/NoDuplicateKeysMap.java
Tue May 31 09:32:09 2016
@@ -35,6 +35,10 @@ import org.apache.directory.api.i18n.I18
 @SuppressWarnings("rawtypes")
 public class NoDuplicateKeysMap extends HashMap
 {
+    // add a serial version uid, so that if we change things in the future
+    // without changing the format, we can still deserialize properly.
+    private static final long serialVersionUID = 5107433500719957457L;
+
     /**
      * Overrides java.util.Map.put(java.lang.Object, java.lang.Object) to
      * prevent duplicate keys.
@@ -42,6 +46,7 @@ public class NoDuplicateKeysMap extends
      * @see java.util.Map#put(java.lang.Object, java.lang.Object)
      */
     @SuppressWarnings("unchecked")
+    @Override
     public Object put( Object key, Object value ) throws IllegalArgumentException
     {
         if ( containsKey( key ) )
@@ -53,8 +58,4 @@ public class NoDuplicateKeysMap extends
             return super.put( key, value );
         }
     }
-
-    // add a serial version uid, so that if we change things in the future
-    // without changing the format, we can still deserialize properly.
-    private static final long serialVersionUID = 5107433500719957457L;
 }

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OptionalComponentsMonitor.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OptionalComponentsMonitor.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OptionalComponentsMonitor.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OptionalComponentsMonitor.java
Tue May 31 09:32:09 2016
@@ -46,6 +46,7 @@ public class OptionalComponentsMonitor e
      * 
      * @return always true
      */
+    @Override
     public boolean finalStateValid()
     {
         return true;

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OsgiUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OsgiUtils.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OsgiUtils.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/OsgiUtils.java
Tue May 31 09:32:09 2016
@@ -43,6 +43,10 @@ public final class OsgiUtils
     /** A logger */
     private static final Logger LOG = LoggerFactory.getLogger( OsgiUtils.class );
 
+    private OsgiUtils()
+    {
+    }
+
 
     /**
      * All the packages that are exported from all bundles found on the system
@@ -55,7 +59,7 @@ public final class OsgiUtils
     {
         if ( pkgs == null )
         {
-            pkgs = new HashSet<String>();
+            pkgs = new HashSet<>();
         }
 
         Set<File> candidates = getClasspathCandidates( filter );
@@ -89,7 +93,7 @@ public final class OsgiUtils
     {
         if ( pkgs == null )
         {
-            pkgs = new HashSet<String>();
+            pkgs = new HashSet<>();
         }
 
         int index = 0;
@@ -140,7 +144,7 @@ public final class OsgiUtils
 
     public static Set<File> getClasspathCandidates( FileFilter filter )
     {
-        Set<File> candidates = new HashSet<File>();
+        Set<File> candidates = new HashSet<>();
         String separator = System.getProperty( "path.separator" );
         String[] cpElements = System.getProperty( "java.class.path" ).split( separator );
 
@@ -222,9 +226,4 @@ public final class OsgiUtils
             }
         }
     }
-
-
-    private OsgiUtils()
-    {
-    }
 }

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Position.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Position.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Position.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Position.java
Tue May 31 09:32:09 2016
@@ -39,6 +39,10 @@ public class Position
     public int end = 0;
 
 
+    /**
+     * @see Object#toString()
+     */
+    @Override
     public String toString()
     {
         return "[" + start + ", " + end + ", " + length + "]";

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SequencedHashMap.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SequencedHashMap.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SequencedHashMap.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SequencedHashMap.java
Tue May 31 09:32:09 2016
@@ -60,12 +60,42 @@ import org.apache.directory.api.i18n.I18
 @SuppressWarnings("rawtypes")
 public class SequencedHashMap implements Map, Cloneable, Externalizable
 {
+    // add a serial version uid, so that if we change things in the future
+    // without changing the format, we can still deserialize properly.
+    private static final long serialVersionUID = 3380552487888102930L;
+    
+    // constants to define what the iterator should return on "next"
+    private static final int KEY = 0;
+
+    private static final int VALUE = 1;
+
+    private static final int ENTRY = 2;
+
+    private static final int REMOVED_MASK = 0x80000000;
+
+    /**
+     * Sentinel used to hold the head and tail of the list of entries.
+     */
+    private transient MapEntry sentinel;
+
+    /**
+     * Map of keys to entries
+     */
+    private HashMap entries;
+
+    /**
+     * Holds the number of modifications that have occurred to the map,
+     * excluding modifications made through a collection view's iterator (e.g.
+     * entrySet().iterator().remove()). This is used to create a fail-fast
+     * behavior with the iterators.
+     */
+    private transient long modCount = 0;
 
     /**
      * {@link java.util.Map.Entry} that doubles as a node in the linked list of
      * sequenced mappings.
      */
-    private static class Entry implements Map.Entry, KeyValue
+    private static class MapEntry implements Map.Entry, KeyValue
     {
         // Note: This class cannot easily be made clonable. While the actual
         // implementation of a clone would be simple, defining the semantics is
@@ -86,12 +116,12 @@ public class SequencedHashMap implements
         // package private to allow the SequencedHashMap to access and
         // manipulate
         // them.
-        Entry next = null;
+        MapEntry next = null;
 
-        Entry prev = null;
+        MapEntry prev = null;
 
 
-        public Entry( Object key, Object value )
+        public MapEntry( Object key, Object value )
         {
             this.key = key;
             this.value = value;
@@ -99,6 +129,7 @@ public class SequencedHashMap implements
 
 
         // per Map.Entry.getKey()
+        @Override
         public Object getKey()
         {
             return this.key;
@@ -106,6 +137,7 @@ public class SequencedHashMap implements
 
 
         // per Map.Entry.getValue()
+        @Override
         public Object getValue()
         {
             return this.value;
@@ -113,6 +145,7 @@ public class SequencedHashMap implements
 
 
         // per Map.Entry.setValue()
+        @Override
         public Object setValue( Object newValue )
         {
             Object oldValue = this.value;
@@ -125,13 +158,15 @@ public class SequencedHashMap implements
          * Compute the instance's hash code
          * @return the instance's hash code 
          */
+        @Override
         public int hashCode()
         {
             // implemented per api docs for Map.Entry.hashCode()
-            return ( ( getKey() == null ? 0 : getKey().hashCode() ) ^ ( getValue() == null
? 0 : getValue().hashCode() ) );
+            return ( getKey() == null ? 0 : getKey().hashCode() ) ^ ( getValue() == null
? 0 : getValue().hashCode() );
         }
 
 
+        @Override
         public boolean equals( Object obj )
         {
             if ( obj == null )
@@ -152,12 +187,13 @@ public class SequencedHashMap implements
             Map.Entry other = ( Map.Entry ) obj;
 
             // implemented per api docs for Map.Entry.equals(Object)
-            return ( ( getKey() == null ? other.getKey() == null : getKey().equals( other.getKey()
) ) && ( getValue() == null ? other
+            return ( getKey() == null ? other.getKey() == null : getKey().equals( other.getKey()
) ) && ( getValue() == null ? other
                 .getValue() == null
-                : getValue().equals( other.getValue() ) ) );
+                : getValue().equals( other.getValue() ) );
         }
 
 
+        @Override
         public String toString()
         {
             return "[" + getKey() + "=" + getValue() + "]";
@@ -166,38 +202,6 @@ public class SequencedHashMap implements
 
 
     /**
-     * Construct an empty sentinel used to hold the head (sentinel.next) and the
-     * tail (sentinel.prev) of the list. The sentinel has a <code>null</code>
-     * key and value.
-     */
-    private static Entry createSentinel()
-    {
-        Entry s = new Entry( null, null );
-        s.prev = s;
-        s.next = s;
-        return s;
-    }
-
-    /**
-     * Sentinel used to hold the head and tail of the list of entries.
-     */
-    private Entry sentinel;
-
-    /**
-     * Map of keys to entries
-     */
-    private HashMap entries;
-
-    /**
-     * Holds the number of modifications that have occurred to the map,
-     * excluding modifications made through a collection view's iterator (e.g.
-     * entrySet().iterator().remove()). This is used to create a fail-fast
-     * behavior with the iterators.
-     */
-    private transient long modCount = 0;
-
-
-    /**
      * Construct a new sequenced hash map with default initial size and load
      * factor.
      */
@@ -253,10 +257,24 @@ public class SequencedHashMap implements
 
 
     /**
+     * Construct an empty sentinel used to hold the head (sentinel.next) and the
+     * tail (sentinel.prev) of the list. The sentinel has a <code>null</code>
+     * key and value.
+     */
+    private static MapEntry createSentinel()
+    {
+        MapEntry s = new MapEntry( null, null );
+        s.prev = s;
+        s.next = s;
+        return s;
+    }
+
+
+    /**
      * Removes an internal entry from the linked list. This does not remove it
      * from the underlying map.
      */
-    private void removeEntry( Entry entry )
+    private void removeEntry( MapEntry entry )
     {
         entry.next.prev = entry.prev;
         entry.prev.next = entry.next;
@@ -267,7 +285,7 @@ public class SequencedHashMap implements
      * Inserts a new internal entry to the tail of the linked list. This does
      * not add the entry to the underlying map.
      */
-    private void insertEntry( Entry entry )
+    private void insertEntry( MapEntry entry )
     {
         entry.next = sentinel;
         entry.prev = sentinel.prev;
@@ -281,6 +299,7 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#size()}.
      */
+    @Override
     public int size()
     {
         // use the underlying Map's size since size is not maintained here.
@@ -291,6 +310,7 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#isEmpty()}.
      */
+    @Override
     public boolean isEmpty()
     {
         // for quick check whether the map is entry, we can check the linked
@@ -303,6 +323,7 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#containsKey(Object)}.
      */
+    @Override
     public boolean containsKey( Object key )
     {
         // pass on to underlying map implementation
@@ -313,6 +334,7 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#containsValue(Object)}.
      */
+    @Override
     public boolean containsValue( Object value )
     {
         // unfortunately, we cannot just pass this call to the underlying map
@@ -326,7 +348,7 @@ public class SequencedHashMap implements
         // code duplication.
         if ( value == null )
         {
-            for ( Entry pos = sentinel.next; pos != sentinel; pos = pos.next )
+            for ( MapEntry pos = sentinel.next; pos != sentinel; pos = pos.next )
             {
                 if ( pos.getValue() == null )
                 {
@@ -336,7 +358,7 @@ public class SequencedHashMap implements
         }
         else
         {
-            for ( Entry pos = sentinel.next; pos != sentinel; pos = pos.next )
+            for ( MapEntry pos = sentinel.next; pos != sentinel; pos = pos.next )
             {
                 if ( value.equals( pos.getValue() ) )
                 {
@@ -351,10 +373,11 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#get(Object)}.
      */
+    @Override
     public Object get( Object o )
     {
         // find entry for the specified key object
-        Entry entry = ( Entry ) entries.get( o );
+        MapEntry entry = ( MapEntry ) entries.get( o );
 
         if ( entry == null )
         {
@@ -383,7 +406,7 @@ public class SequencedHashMap implements
         // test
         // for an empty list though because we don't want to return the
         // sentinel!
-        return ( isEmpty() ) ? null : sentinel.next;
+        return isEmpty() ? null : sentinel.next;
     }
 
 
@@ -464,7 +487,7 @@ public class SequencedHashMap implements
         // test
         // for an empty list though because we don't want to return the
         // sentinel!
-        return ( isEmpty() ) ? null : sentinel.prev;
+        return isEmpty() ? null : sentinel.prev;
     }
 
 
@@ -520,6 +543,7 @@ public class SequencedHashMap implements
      * Implements {@link Map#put(Object, Object)}.
      */
     @SuppressWarnings("unchecked")
+    @Override
     public Object put( Object key, Object value )
     {
         modCount++;
@@ -527,7 +551,7 @@ public class SequencedHashMap implements
         Object oldValue = null;
 
         // lookup the entry for the specified key
-        Entry e = ( Entry ) entries.get( key );
+        MapEntry e = ( MapEntry ) entries.get( key );
 
         // check to see if it already exists
         if ( e != null )
@@ -550,7 +574,7 @@ public class SequencedHashMap implements
         else
         {
             // add new entry
-            e = new Entry( key, value );
+            e = new MapEntry( key, value );
             entries.put( key, e );
         }
         // assert(entry in map, but not list)
@@ -565,9 +589,10 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#remove(Object)}.
      */
+    @Override
     public Object remove( Object key )
     {
-        Entry e = removeImpl( key );
+        MapEntry e = removeImpl( key );
         return ( e == null ) ? null : e.getValue();
     }
 
@@ -576,9 +601,9 @@ public class SequencedHashMap implements
      * Fully remove an entry from the map, returning the old entry or null if
      * there was no such entry with the specified key.
      */
-    private Entry removeImpl( Object key )
+    private MapEntry removeImpl( Object key )
     {
-        Entry e = ( Entry ) entries.remove( key );
+        MapEntry e = ( MapEntry ) entries.remove( key );
 
         if ( e == null )
         {
@@ -603,6 +628,7 @@ public class SequencedHashMap implements
      * @throws NullPointerException
      *             if <code>t</code> is <code>null</code>
      */
+    @Override
     public void putAll( Map t )
     {
         Iterator iter = t.entrySet().iterator();
@@ -617,6 +643,7 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#clear()}.
      */
+    @Override
     public void clear()
     {
         modCount++;
@@ -633,6 +660,7 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#equals(Object)}.
      */
+    @Override
     public boolean equals( Object obj )
     {
         if ( obj == null )
@@ -658,6 +686,7 @@ public class SequencedHashMap implements
      * Implements {@link Map#hashCode()}.
      * @return the instance's hash code 
      */
+    @Override
     public int hashCode()
     {
         return entrySet().hashCode();
@@ -671,12 +700,13 @@ public class SequencedHashMap implements
      * required, use {@link #entrySet()}.{@link Set#iterator() iterator()} and
      * iterate over the entries in the map formatting them as appropriate.
      */
+    @Override
     public String toString()
     {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         buf.append( '[' );
 
-        for ( Entry pos = sentinel.next; pos != sentinel; pos = pos.next )
+        for ( MapEntry pos = sentinel.next; pos != sentinel; pos = pos.next )
         {
             buf.append( pos.getKey() );
             buf.append( '=' );
@@ -697,44 +727,52 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#keySet()}.
      */
+    @Override
     public Set keySet()
     {
         return new AbstractSet()
         {
 
             // required impls
+            @Override
             public Iterator iterator()
             {
                 return new OrderedIterator( KEY );
             }
 
 
+            @Override
             public boolean remove( Object o )
             {
-                Entry e = SequencedHashMap.this.removeImpl( o );
-                return ( e != null );
+                MapEntry e = SequencedHashMap.this.removeImpl( o );
+                
+                return e != null;
             }
 
 
             // more efficient impls than abstract set
+            @Override
             public void clear()
             {
                 SequencedHashMap.this.clear();
             }
 
 
+            @Override
             public int size()
             {
                 return SequencedHashMap.this.size();
             }
 
 
+            @Override
             public boolean isEmpty()
             {
                 return SequencedHashMap.this.isEmpty();
             }
 
 
+            @Override
             public boolean contains( Object o )
             {
                 return SequencedHashMap.this.containsKey( o );
@@ -747,17 +785,20 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#values()}.
      */
+    @Override
     public Collection values()
     {
         return new AbstractCollection()
         {
             // required impl
+            @Override
             public Iterator iterator()
             {
                 return new OrderedIterator( VALUE );
             }
 
 
+            @Override
             public boolean remove( Object value )
             {
                 // do null comparison outside loop so we only need to do it
@@ -767,7 +808,7 @@ public class SequencedHashMap implements
                 // code duplication.
                 if ( value == null )
                 {
-                    for ( Entry pos = sentinel.next; pos != sentinel; pos = pos.next )
+                    for ( MapEntry pos = sentinel.next; pos != sentinel; pos = pos.next )
                     {
                         if ( pos.getValue() == null )
                         {
@@ -778,7 +819,7 @@ public class SequencedHashMap implements
                 }
                 else
                 {
-                    for ( Entry pos = sentinel.next; pos != sentinel; pos = pos.next )
+                    for ( MapEntry pos = sentinel.next; pos != sentinel; pos = pos.next )
                     {
                         if ( value.equals( pos.getValue() ) )
                         {
@@ -793,24 +834,28 @@ public class SequencedHashMap implements
 
 
             // more efficient impls than abstract collection
+            @Override
             public void clear()
             {
                 SequencedHashMap.this.clear();
             }
 
 
+            @Override
             public int size()
             {
                 return SequencedHashMap.this.size();
             }
 
 
+            @Override
             public boolean isEmpty()
             {
                 return SequencedHashMap.this.isEmpty();
             }
 
 
+            @Override
             public boolean contains( Object o )
             {
                 return SequencedHashMap.this.containsValue( o );
@@ -822,12 +867,13 @@ public class SequencedHashMap implements
     /**
      * Implements {@link Map#entrySet()}.
      */
+    @Override
     public Set entrySet()
     {
         return new AbstractSet()
         {
             // helper
-            private Entry findEntry( Object o )
+            private MapEntry findEntry( Object o )
             {
                 if ( o == null )
                 {
@@ -840,7 +886,7 @@ public class SequencedHashMap implements
                 }
 
                 Map.Entry e = ( Map.Entry ) o;
-                Entry entry = ( Entry ) entries.get( e.getKey() );
+                MapEntry entry = ( MapEntry ) entries.get( e.getKey() );
 
                 if ( entry != null && entry.equals( e ) )
                 {
@@ -854,15 +900,17 @@ public class SequencedHashMap implements
 
 
             // required impl
+            @Override
             public Iterator iterator()
             {
                 return new OrderedIterator( ENTRY );
             }
 
 
+            @Override
             public boolean remove( Object o )
             {
-                Entry e = findEntry( o );
+                MapEntry e = findEntry( o );
 
                 if ( e == null )
                 {
@@ -874,24 +922,28 @@ public class SequencedHashMap implements
 
 
             // more efficient impls than abstract collection
+            @Override
             public void clear()
             {
                 SequencedHashMap.this.clear();
             }
 
 
+            @Override
             public int size()
             {
                 return SequencedHashMap.this.size();
             }
 
 
+            @Override
             public boolean isEmpty()
             {
                 return SequencedHashMap.this.isEmpty();
             }
 
 
+            @Override
             public boolean contains( Object o )
             {
                 return findEntry( o ) != null;
@@ -899,15 +951,6 @@ public class SequencedHashMap implements
         };
     }
 
-    // constants to define what the iterator should return on "next"
-    private static final int KEY = 0;
-
-    private static final int VALUE = 1;
-
-    private static final int ENTRY = 2;
-
-    private static final int REMOVED_MASK = 0x80000000;
-
     private class OrderedIterator implements Iterator
     {
         /**
@@ -925,14 +968,14 @@ public class SequencedHashMap implements
          * Holds the "current" position in the iterator. When pos.next is the
          * sentinel, we've reached the end of the list.
          */
-        private Entry pos = sentinel;
+        private MapEntry pos = sentinel;
 
         /**
          * Holds the expected modification count. If the actual modification
          * count of the map differs from this value, then a concurrent
          * modification has occurred.
          */
-        private transient long expectedModCount = modCount;
+        private long expectedModCount = modCount;
 
 
         /**
@@ -956,6 +999,7 @@ public class SequencedHashMap implements
          * @return <code>true</code> if there are more elements left to be
          *         returned from the iterator; <code>false</code> otherwise.
          */
+        @Override
         public boolean hasNext()
         {
             return pos.next != sentinel;
@@ -971,6 +1015,7 @@ public class SequencedHashMap implements
          * @throws ConcurrentModificationException
          *             if a modification occurs in the underlying map.
          */
+        @Override
         public Object next()
         {
             if ( modCount != expectedModCount )
@@ -1013,6 +1058,7 @@ public class SequencedHashMap implements
          * @throws ConcurrentModificationException
          *             if a modification occurs in the underlying map.
          */
+        @Override
         public void remove()
         {
             if ( ( returnType & REMOVED_MASK ) != 0 )
@@ -1047,6 +1093,7 @@ public class SequencedHashMap implements
      * @throws CloneNotSupportedException
      *             if clone is not supported by a subclass.
      */
+    @Override
     public Object clone() throws CloneNotSupportedException
     {
         // yes, calling super.clone() silly since we're just blowing away all
@@ -1091,7 +1138,7 @@ public class SequencedHashMap implements
      */
     private Map.Entry getEntry( int index )
     {
-        Entry pos = sentinel;
+        MapEntry pos = sentinel;
 
         if ( index < 0 )
         {
@@ -1110,7 +1157,7 @@ public class SequencedHashMap implements
         // if sentinel is next, past end of list
         if ( pos.next == sentinel )
         {
-            throw new ArrayIndexOutOfBoundsException( I18n.err( I18n.ERR_04428, index, (
i + 1 ) ) );
+            throw new ArrayIndexOutOfBoundsException( I18n.err( I18n.ERR_04428, index, i
+ 1 ) );
         }
 
         return pos.next;
@@ -1158,7 +1205,7 @@ public class SequencedHashMap implements
      */
     public int indexOf( Object key )
     {
-        Entry e = ( Entry ) entries.get( key );
+        MapEntry e = ( MapEntry ) entries.get( key );
         if ( e == null )
         {
             return -1;
@@ -1255,6 +1302,7 @@ public class SequencedHashMap implements
      * @throws ClassNotFoundException
      *             if the stream raises it
      */
+    @Override
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
     {
         int size = in.readInt();
@@ -1275,18 +1323,14 @@ public class SequencedHashMap implements
      * @throws IOException
      *             if the stream raises it
      */
+    @Override
     public void writeExternal( ObjectOutput out ) throws IOException
     {
         out.writeInt( size() );
-        for ( Entry pos = sentinel.next; pos != sentinel; pos = pos.next )
+        for ( MapEntry pos = sentinel.next; pos != sentinel; pos = pos.next )
         {
             out.writeObject( pos.getKey() );
             out.writeObject( pos.getValue() );
         }
     }
-
-    // add a serial version uid, so that if we change things in the future
-    // without changing the format, we can still deserialize properly.
-    private static final long serialVersionUID = 3380552487888102930L;
-
 }

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Serialize.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Serialize.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Serialize.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Serialize.java
Tue May 31 09:32:09 2016
@@ -97,7 +97,7 @@ public final class Serialize
             throw new ArrayIndexOutOfBoundsException();
         }
 
-        return ( buffer[pos] << 24 ) + ( buffer[pos + 1] << 16 ) + ( buffer[pos
+ 2] << 8 ) + ( buffer[pos + 3] << 0 );
+        return ( buffer[pos] << 24 ) + ( buffer[pos + 1] << 16 ) + ( buffer[pos
+ 2] << 8 ) + buffer[pos + 3];
     }
 
 
@@ -154,6 +154,6 @@ public final class Serialize
 
         byte value = buffer[pos];
 
-        return ( value != 0x00 );
+        return value != 0x00;
     }
 }

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SingletonEnumeration.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SingletonEnumeration.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SingletonEnumeration.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SingletonEnumeration.java
Tue May 31 09:32:09 2016
@@ -42,8 +42,7 @@ public class SingletonEnumeration<T> imp
     /**
      * Creates a NamingEnumeration over a single element.
      * 
-     * @param element
-     *            TODO
+     * @param element The element to store in this enumeration
      */
     public SingletonEnumeration( final T element )
     {
@@ -56,6 +55,7 @@ public class SingletonEnumeration<T> imp
      * 
      * @see javax.naming.NamingEnumeration#close()
      */
+    @Override
     public void close()
     {
         hasMore = false;
@@ -65,6 +65,7 @@ public class SingletonEnumeration<T> imp
     /**
      * @see javax.naming.NamingEnumeration#hasMore()
      */
+    @Override
     public boolean hasMore()
     {
         return hasMore;
@@ -74,6 +75,7 @@ public class SingletonEnumeration<T> imp
     /**
      * @see javax.naming.NamingEnumeration#next()
      */
+    @Override
     public T next()
     {
         if ( hasMore )
@@ -89,6 +91,7 @@ public class SingletonEnumeration<T> imp
     /**
      * @see java.util.Enumeration#hasMoreElements()
      */
+    @Override
     public boolean hasMoreElements()
     {
         return hasMore;
@@ -98,6 +101,7 @@ public class SingletonEnumeration<T> imp
     /**
      * @see java.util.Enumeration#nextElement()
      */
+    @Override
     public T nextElement()
     {
         return next();

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Strings.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Strings.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Strings.java
Tue May 31 09:32:09 2016
@@ -341,8 +341,6 @@ public final class Strings
      * @param toLowerCase how to normalize for case: upper or lower
      * @return the deep trimmed string
      * @see Strings#deepTrim( String )
-     *
-     * TODO Replace the toCharArray() by substring manipulations
      */
     public static String deepTrim( String str, boolean toLowerCase )
     {

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SynchronizedLRUMap.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SynchronizedLRUMap.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SynchronizedLRUMap.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/SynchronizedLRUMap.java
Tue May 31 09:32:09 2016
@@ -93,6 +93,7 @@ public final class SynchronizedLRUMap ex
      * @return Returns the value. Returns null if the key has a null value <i>or</i>
      *         if the key has no value.
      */
+    @Override
     public synchronized Object get( Object key )
     {
         if ( !containsKey( key ) )
@@ -122,11 +123,12 @@ public final class SynchronizedLRUMap ex
      *            Object to add
      * @return Former value of the key
      */
+    @Override
     public Object put( Object key, Object value )
     {
 
         int mapSize = size();
-        Object retval = null;
+        Object retval;
 
         if ( mapSize >= maximumSize )
         {

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Unicode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Unicode.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Unicode.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/Unicode.java
Tue May 31 09:32:09 2016
@@ -74,6 +74,10 @@ public final class Unicode
     private static final int CHAR_THREE_BYTES_MASK = 0xFFFF0000;
     private static final int CHAR_FOUR_BYTES_MASK = 0xFFE00000;
 
+    private Unicode()
+    {
+    }
+
     /**
      * Count the number of bytes needed to return an Unicode char. This can be
      * from 1 to 6.
@@ -375,7 +379,7 @@ public final class Unicode
 
         char c = str.charAt( pos );
 
-        return ( ( c > 127 ) || UNICODE_SUBSET[c] );
+        return ( c > 127 ) || UNICODE_SUBSET[c];
     }
 
 
@@ -388,7 +392,7 @@ public final class Unicode
      */
     public static boolean isUnicodeSubset( char c )
     {
-        return ( ( c > 127 ) || UNICODE_SUBSET[c] );
+        return ( c > 127 ) || UNICODE_SUBSET[c];
     }
 
 
@@ -401,7 +405,7 @@ public final class Unicode
      */
     public static boolean isUnicodeSubset( byte b )
     {
-        return ( ( b < 0 ) || ( b > 127 ) || UNICODE_SUBSET[b] );
+        return ( b < 0 ) || ( b > 127 ) || UNICODE_SUBSET[b];
     }
 
 
@@ -437,7 +441,7 @@ public final class Unicode
             // Write length of string
             objectOutput.writeInt( str.length() );
 
-            StringBuffer strBuf = new StringBuffer( str );
+            StringBuilder strBuf = new StringBuilder( str );
 
             // Write the string in portions not larger than 21845 characters
             while ( strBuf != null )
@@ -477,13 +481,11 @@ public final class Unicode
      */
     public static String readUTF( ObjectInput objectInput ) throws IOException
     {
-        StringBuffer strBuf = null;
-
         // Read length of the string
         int strLength = objectInput.readInt();
 
         // Start reading the string
-        strBuf = new StringBuffer( objectInput.readUTF() );
+        StringBuilder strBuf = new StringBuilder( objectInput.readUTF() );
 
         if ( strLength == 0 && strBuf.toString().equals( "null" ) )
         {
@@ -499,9 +501,4 @@ public final class Unicode
             return strBuf.toString();
         }
     }
-
-
-    private Unicode()
-    {
-    }
 }

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/MultiException.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/MultiException.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/MultiException.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/MultiException.java
Tue May 31 09:32:09 2016
@@ -39,7 +39,7 @@ public class MultiException extends Exce
     static final long serialVersionUID = 2889747406899775761L;
 
     /** Collection of nested exceptions. */
-    private Collection<Throwable> nestedExceptions = new ArrayList<Throwable>();
+    private Collection<Throwable> nestedExceptions = new ArrayList<>();
 
 
     /**
@@ -121,6 +121,7 @@ public class MultiException extends Exce
      * @param out
      *            PrintWriter to write the nested stack trace to.
      */
+    @Override
     public void printStackTrace( PrintWriter out )
     {
         super.printStackTrace( out );
@@ -153,6 +154,7 @@ public class MultiException extends Exce
      * @param out
      *            PrintStream to write the nested stack trace to.
      */
+    @Override
     public void printStackTrace( PrintStream out )
     {
         super.printStackTrace( out );
@@ -182,6 +184,7 @@ public class MultiException extends Exce
      * Beside printing out the standard stack trace this method prints out the
      * stack traces of all the nested exceptions using standard error.
      */
+    @Override
     public void printStackTrace()
     {
         this.printStackTrace( System.err );

Modified: directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/RuntimeMultiException.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/RuntimeMultiException.java?rev=1746258&r1=1746257&r2=1746258&view=diff
==============================================================================
--- directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/RuntimeMultiException.java
(original)
+++ directory/shared/branches/shared-value/util/src/main/java/org/apache/directory/api/util/exception/RuntimeMultiException.java
Tue May 31 09:32:09 2016
@@ -39,7 +39,7 @@ public class RuntimeMultiException exten
     private static final long serialVersionUID = 8582253398936366771L;
 
     /** Collection of nested exceptions. */
-    private Collection<Throwable> nestedExceptions = new ArrayList<Throwable>();
+    private Collection<Throwable> nestedExceptions = new ArrayList<>();
 
 
     /**
@@ -130,6 +130,7 @@ public class RuntimeMultiException exten
      * @param out
      *            PrintWriter to write the nested stack trace to.
      */
+    @Override
     public void printStackTrace( PrintWriter out )
     {
         super.printStackTrace( out );
@@ -162,6 +163,7 @@ public class RuntimeMultiException exten
      * @param out
      *            PrintStream to write the nested stack trace to.
      */
+    @Override
     public void printStackTrace( PrintStream out )
     {
         super.printStackTrace( out );
@@ -191,6 +193,7 @@ public class RuntimeMultiException exten
      * Beside printing out the standard stack trace this method prints out the
      * stack traces of all the nested exceptions using standard error.
      */
+    @Override
     public void printStackTrace()
     {
         this.printStackTrace( System.err );




Mime
View raw message