harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r488656 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util: Formatter.java GregorianCalendar.java HashMap.java Hashtable.java Properties.java Vector.java WeakHashMap.java
Date Tue, 19 Dec 2006 12:24:04 GMT
Author: tellison
Date: Tue Dec 19 04:24:03 2006
New Revision: 488656

URL: http://svn.apache.org/viewvc?view=rev&rev=488656
Log:
Apply patch for HARMONY-2383 ([classlib] [luni] Fixes for some minor issues in the java.util
package found by Melody)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Formatter.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Formatter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Formatter.java?view=diff&rev=488656&r1=488655&r2=488656
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Formatter.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Formatter.java Tue
Dec 19 04:24:03 2006
@@ -1025,7 +1025,7 @@
             // only '-' is valid for flags
             if (FormatToken.FLAGS_UNSET != flags && FormatToken.FLAG_MINUS != flags)
{
                 throw new FormatFlagsConversionMismatchException(formatToken
-                        .getStrFlags().toString(), formatToken
+                        .getStrFlags(), formatToken
                         .getConversionType());
             }
 
@@ -1110,8 +1110,7 @@
 
             int flags = formatToken.getFlags();
             if (FormatToken.FLAGS_UNSET != flags) {
-                throw new IllegalFormatFlagsException(formatToken.getStrFlags()
-                        .toString());
+                throw new IllegalFormatFlagsException(formatToken.getStrFlags());
             }
 
             if (null == lineSeparator) {
@@ -1212,9 +1211,9 @@
             }
             if ('d' != currentConversionType) {
                 if (formatToken.isFlagSet(FormatToken.FLAG_ADD)
-                        | formatToken.isFlagSet(FormatToken.FLAG_SPACE)
-                        | formatToken.isFlagSet(FormatToken.FLAG_COMMA)
-                        | formatToken.isFlagSet(FormatToken.FLAG_PARENTHESIS)) {
+                        || formatToken.isFlagSet(FormatToken.FLAG_SPACE)
+                        || formatToken.isFlagSet(FormatToken.FLAG_COMMA)
+                        || formatToken.isFlagSet(FormatToken.FLAG_PARENTHESIS)) {
                     throw new FormatFlagsConversionMismatchException(
                             formatToken.getStrFlags(), formatToken
                                     .getConversionType());
@@ -2086,7 +2085,7 @@
 
         private void transform_N() {
             // TODO System.nanoTime();
-            long nanosecond = calendar.get(Calendar.MILLISECOND) * 1000000;
+            long nanosecond = calendar.get(Calendar.MILLISECOND) * 1000000L;
             result.append(paddingZeros(nanosecond, 9));
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java?view=diff&rev=488656&r1=488655&r2=488656
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
Tue Dec 19 04:24:03 2006
@@ -719,8 +719,8 @@
         timeVal += days * 86400000;
         // Use local time to compare with the gregorian change
         if (year == changeYear
-                && timeVal >= gregorianCutover + julianError() * 86400000) {
-            timeVal -= julianError() * 86400000;
+                && timeVal >= gregorianCutover + julianError() * 86400000L) {
+            timeVal -= julianError() * 86400000L;
         }
 
         // It is not possible to simply subtract getOffset(timeVal) from timeVal

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java?view=diff&rev=488656&r1=488655&r2=488656
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java Tue
Dec 19 04:24:03 2006
@@ -526,7 +526,7 @@
                 index = key == null ? 0 : (key.hashCode() & 0x7FFFFFFF)
                         % elementData.length;
             }
-            entry = createEntry(key, index, value);
+            createEntry(key, index, value);
             return null;
         }
         

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java?view=diff&rev=488656&r1=488655&r2=488656
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java Tue
Dec 19 04:24:03 2006
@@ -439,33 +439,39 @@
 		return new Collections.SynchronizedSet<Map.Entry<K, V>>(new AbstractSet<Map.Entry<K,V>>()
{
 			@Override
             public int size() {
-				return elementCount;
+                synchronized (Hashtable.this) {
+                    return elementCount;
+                }				
 			}
 
 			@Override
             public void clear() {
-				Hashtable.this.clear();
+                Hashtable.this.clear();
 			}
 
 			@Override
             @SuppressWarnings("unchecked")
             public boolean remove(Object object) {
-				if (contains(object)) {
-					Hashtable.this.remove(((Map.Entry<K, V>)object).getKey());
-					return true;
-				}
-				return false;
+                synchronized (Hashtable.this) {
+    				if (contains(object)) {
+    					Hashtable.this.remove(((Map.Entry<K, V>)object).getKey());
+    					return true;
+    				}
+    				return false;
+                }
 			}
 
 			@Override
             @SuppressWarnings("unchecked")
             public boolean contains(Object object) {
-				Entry<K, V> entry = getEntry(((Map.Entry<K, V>)object).getKey());
-				return object.equals(entry);
+                synchronized (Hashtable.this) {
+    				Entry<K, V> entry = getEntry(((Map.Entry<K, V>)object).getKey());
+    				return object.equals(entry);
+                }
 			}
 
 			@Override
-            public Iterator<Map.Entry<K,V>> iterator() {
+            public Iterator<Map.Entry<K,V>> iterator() {                
 				return new HashIterator<Map.Entry<K, V>>(new MapEntry.Type<Map.Entry<K,
V>, K, V>() {
 					public Map.Entry<K, V> get(MapEntry<K, V> entry) {
 						return entry;
@@ -614,26 +620,32 @@
             new AbstractSet<K>() {
     			@Override
                 public boolean contains(Object object) {
-    				return containsKey(object);
+                    synchronized (Hashtable.this) {
+                        return containsKey(object);
+                    }
     			}
     
     			@Override
                 public int size() {
-    				return elementCount;
+                    synchronized (Hashtable.this) {
+                        return elementCount;
+                    }
     			}
     
     			@Override
                 public void clear() {
-    				Hashtable.this.clear();
+                    Hashtable.this.clear();
     			}
     
     			@Override
                 public boolean remove(Object key) {
-    				if (containsKey(key)) {
-    					Hashtable.this.remove(key);
-    					return true;
-    				}
-    				return false;
+                    synchronized (Hashtable.this) {
+        				if (containsKey(key)) {
+        					Hashtable.this.remove(key);
+        					return true;
+        				}
+        				return false;
+                    }
     			}
     
     			@Override
@@ -843,17 +855,21 @@
 		return new Collections.SynchronizedCollection<V>(new AbstractCollection<V>()
{
 			@Override
             public boolean contains(Object object) {
-				return Hashtable.this.contains(object);
+                synchronized (Hashtable.this) {
+                    return Hashtable.this.contains(object);
+                }
 			}
 
 			@Override
             public int size() {
-				return elementCount;
+                synchronized (Hashtable.this) {
+                    return elementCount;
+                }
 			}
 
 			@Override
             public void clear() {
-				Hashtable.this.clear();
+                Hashtable.this.clear();  
 			}
 
 			@Override

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java?view=diff&rev=488656&r1=488655&r2=488656
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java Tue
Dec 19 04:24:03 2006
@@ -58,7 +58,7 @@
 	
 	private static final long serialVersionUID = 4112578634029874840L;
 
-    private DocumentBuilder builder = null;
+    private transient DocumentBuilder builder = null;
 
     private static final String PROP_DTD_NAME 
             = "http://java.sun.com/dtd/properties.dtd";
@@ -462,7 +462,7 @@
 	 *            the value
 	 * @return the old value mapped to the key, or null
 	 */
-	public synchronized Object setProperty(String name, String value) {
+	public Object setProperty(String name, String value) {
 		return put(name, value);
 	}
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java?view=diff&rev=488656&r1=488655&r2=488656
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java Tue Dec
19 04:24:03 2006
@@ -342,7 +342,9 @@
 			int pos = 0;
 
 			public boolean hasMoreElements() {
-				return pos < elementCount;
+                synchronized (Vector.this) {
+                    return pos < elementCount;
+                }
 			}
 
 			public E nextElement() {

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java?view=diff&rev=488656&r1=488655&r2=488656
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
Tue Dec 19 04:24:03 2006
@@ -43,7 +43,7 @@
 
     private int threshold;
 
-    transient int modCount;
+    volatile int modCount;
     
     //Simple utility method to isolate unchecked cast for array creation
     @SuppressWarnings("unchecked")



Mime
View raw message