harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r485770 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/
Date Mon, 11 Dec 2006 17:45:50 GMT
Author: tellison
Date: Mon Dec 11 09:45:49 2006
New Revision: 485770

URL: http://svn.apache.org/viewvc?view=rev&rev=485770
Log:
Modified patch for HARMONY-2556 ([classlib] [luni] Fixes for some minor issues in the java.lang
and java.io packages found by Melody)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ByteArrayInputStream.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ByteArrayInputStream.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ByteArrayInputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ByteArrayInputStream.java
Mon Dec 11 09:45:49 2006
@@ -109,7 +109,7 @@
 	 *            ignored.
 	 */
 	@Override
-    public void mark(int readlimit) {
+    public synchronized void mark(int readlimit) {
 		mark = pos;
 	}
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
Mon Dec 11 09:45:49 2006
@@ -414,7 +414,7 @@
 	public void put(String name, byte value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Byte.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Byte(value);
+			slot.fieldValue = Byte.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();
@@ -435,7 +435,7 @@
 	public void put(String name, char value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Character.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Character(value);
+			slot.fieldValue = Character.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();
@@ -456,7 +456,7 @@
 	public void put(String name, double value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Double.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Double(value);
+			slot.fieldValue = Double.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();
@@ -477,7 +477,7 @@
 	public void put(String name, float value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Float.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Float(value);
+			slot.fieldValue = Float.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();
@@ -498,7 +498,7 @@
 	public void put(String name, int value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Integer.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Integer(value);
+			slot.fieldValue = Integer.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();
@@ -519,7 +519,7 @@
 	public void put(String name, long value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Long.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Long(value);
+			slot.fieldValue = Long.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();
@@ -564,7 +564,7 @@
 	public void put(String name, short value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Short.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Short(value);
+			slot.fieldValue = Short.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();
@@ -585,7 +585,7 @@
 	public void put(String name, boolean value) throws IllegalArgumentException {
 		ObjectSlot slot = findSlot(name, Boolean.TYPE);
 		if (slot != null) {
-			slot.fieldValue = new Boolean(value);
+			slot.fieldValue = Boolean.valueOf(value);
 			slot.defaulted = false; // No longer default value
 		} else
 			throw new IllegalArgumentException();

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java Mon Dec 11
09:45:49 2006
@@ -170,7 +170,7 @@
 
 	private String calculatePath(String dirPath, String name) {
         dirPath = fixSlashes(dirPath);
-        if (name != ""){ //$NON-NLS-1$
+        if (!name.equals("")){ //$NON-NLS-1$
             // Remove all the proceeding separator chars from name
             name = fixSlashes(name);
             while (name.length() > 0 && (name.charAt(0) == separatorChar)) {
@@ -1253,7 +1253,7 @@
 	 */
 	@Override
     public String toString() {
-		return path.toString();
+		return path;
 	}
 
 	/**

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java
Mon Dec 11 09:45:49 2006
@@ -124,6 +124,7 @@
 			if (lastChar == '\n') {
                 lastChar = -1;
             }
+            // fall through
 		case '\n':
 			lineNumber++;
 		}

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
Mon Dec 11 09:45:49 2006
@@ -719,7 +719,7 @@
                 ObjectStreamClass streamClass = ObjectStreamClass
                         .lookup(proxyClass);
                 streamClass.setLoadFields(new ObjectStreamField[0]);
-                registerObjectRead(streamClass, new Integer(nextHandle()),
+                registerObjectRead(streamClass, Integer.valueOf(nextHandle()),
                         false);
                 checkedSetSuperClassDesc(streamClass, readClassDesc());                
                 return streamClass;
@@ -1032,21 +1032,21 @@
             element.defaulted = false;
             Class<?> type = element.field.getType();
             if (type == Integer.TYPE) {
-                element.fieldValue = new Integer(input.readInt());
+                element.fieldValue = Integer.valueOf(input.readInt());
             } else if (type == Byte.TYPE) {
-                element.fieldValue = new Byte(input.readByte());
+                element.fieldValue = Byte.valueOf(input.readByte());
             } else if (type == Character.TYPE) {
-                element.fieldValue = new Character(input.readChar());
+                element.fieldValue = Character.valueOf(input.readChar());
             } else if (type == Short.TYPE) {
-                element.fieldValue = new Short(input.readShort());
+                element.fieldValue = Short.valueOf(input.readShort());
             } else if (type == Boolean.TYPE) {
-                element.fieldValue = new Boolean(input.readBoolean());
+                element.fieldValue = Boolean.valueOf(input.readBoolean());
             } else if (type == Long.TYPE) {
-                element.fieldValue = new Long(input.readLong());
+                element.fieldValue = Long.valueOf(input.readLong());
             } else if (type == Float.TYPE) {
-                element.fieldValue = new Float(input.readFloat());
+                element.fieldValue = Float.valueOf(input.readFloat());
             } else if (type == Double.TYPE) {
-                element.fieldValue = new Double(input.readDouble());
+                element.fieldValue = Double.valueOf(input.readDouble());
             } else {
                 // Either array or Object
                 try {
@@ -1546,7 +1546,7 @@
         ObjectStreamClass classDesc = readClassDesc();
 
         if (classDesc != null) {
-            Integer newHandle = new Integer(nextHandle());
+            Integer newHandle = Integer.valueOf(nextHandle());
             Class<?> localClass = classDesc.forClass();
             if (localClass != null) {
                 registerObjectRead(localClass, newHandle, unshared);
@@ -1580,7 +1580,7 @@
         ObjectStreamClass classDesc;
         primitiveData = input;
         Integer oldHandle = descriptorHandle;
-        descriptorHandle = new Integer(nextHandle());
+        descriptorHandle = Integer.valueOf(nextHandle());
         classDesc = readClassDescriptor();
         if (descriptorHandle != null) {
             registerObjectRead(classDesc, descriptorHandle, false);
@@ -1616,7 +1616,7 @@
             ClassNotFoundException, IOException {
         // read classdesc for Enum first
         ObjectStreamClass classDesc = readEnumDesc();
-        Integer newHandle = new Integer(nextHandle());
+        Integer newHandle = Integer.valueOf(nextHandle());
         // read name after class desc
         String name;
         byte tc = nextTC();
@@ -1662,7 +1662,7 @@
         // subclasses during readClassDescriptor()
         primitiveData = input;
         Integer oldHandle = descriptorHandle;
-        descriptorHandle = new Integer(nextHandle());
+        descriptorHandle = Integer.valueOf(nextHandle());
         ObjectStreamClass newClassDesc = readClassDescriptor();
         if (descriptorHandle != null) {
             registerObjectRead(newClassDesc, descriptorHandle, unshared);
@@ -1792,7 +1792,7 @@
      *             If an IO exception happened when reading the handle
      */
     private Integer readNewHandle() throws IOException {
-        return new Integer(input.readInt());
+        return Integer.valueOf(input.readInt());
     }
 
     /**
@@ -1825,7 +1825,7 @@
             throw new InvalidClassException(Msg.getString("K00d1")); //$NON-NLS-1$
         }
 
-        Integer newHandle = new Integer(nextHandle());
+        Integer newHandle = Integer.valueOf(nextHandle());
 
         // Note that these values come from the Stream, and in fact it could be
         // that the classes have been changed so that the info below now
@@ -2012,7 +2012,7 @@
             result = resolveObject(result);
         }
         int newHandle = nextHandle();
-        registerObjectRead(result, new Integer(newHandle), unshared);
+        registerObjectRead(result, Integer.valueOf(newHandle), unshared);
 
         return result;
     }
@@ -2035,7 +2035,7 @@
             result = resolveObject(result);
         }
         int newHandle = nextHandle();
-        registerObjectRead(result, new Integer(newHandle), unshared);
+        registerObjectRead(result, Integer.valueOf(newHandle), unshared);
 
         return result;
     }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java
Mon Dec 11 09:45:49 2006
@@ -671,7 +671,7 @@
 	 * @see #nextHandle
 	 */
 	private Integer registerObjectWritten(Object obj) {
-		Integer handle = new Integer(nextHandle());
+		Integer handle = Integer.valueOf(nextHandle());
 		registerObjectWritten(obj, handle);
 		return handle;
 	}
@@ -2016,7 +2016,7 @@
         currentPutField = null;
 
         output.writeByte(TC_ENUM);
-        while (!theClass.isEnum() && null != theClass ){
+        while ( theClass != null && !theClass.isEnum() ){
         	// write enum only
             theClass = theClass.getSuperclass();
         }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java
Mon Dec 11 09:45:49 2006
@@ -127,6 +127,15 @@
 		// Either both primitives or both not primitives. Compare based on name.
 		return this.getName().compareTo(f.getName());
 	}
+    
+    
+    public boolean equals(Object arg0) {
+        return compareTo(arg0) == 0;
+    }
+    
+    public int hashCode() {
+        return getName().hashCode();
+    }
 
 	/**
 	 * Return the name of the field the receiver represents

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java Mon
Dec 11 09:45:49 2006
@@ -214,7 +214,7 @@
                     }
                     first = false;
                     // Notify callers of receive()
-                    notifyAll();
+                    lock.notifyAll();
                     lock.wait(1000);
                 }
             } catch (InterruptedException e) {
@@ -312,7 +312,7 @@
             lastWriter = Thread.currentThread();
             try {
                 while (data != null && out == in) {
-                    notifyAll();
+                    lock.notifyAll();
                     wait(1000);
                     if (lastReader != null && !lastReader.isAlive()) {
                         throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
@@ -369,7 +369,7 @@
             while (count > 0) {
                 try {
                     while (data != null && out == in) {
-                        notifyAll();
+                        lock.notifyAll();
                         wait(1000);
                         if (lastReader != null && !lastReader.isAlive()) {
                             throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
@@ -417,13 +417,13 @@
 	void done() {
 		synchronized (lock) {
 			isClosed = true;
-			notifyAll();
+			lock.notifyAll();
 		}
 	}
 
 	void flush() {
 		synchronized (lock) {
-			notifyAll();
+			lock.notifyAll();
 		}
 	}
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java?view=diff&rev=485770&r1=485769&r2=485770
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java
Mon Dec 11 09:45:49 2006
@@ -612,7 +612,7 @@
     public final String readUTF() throws IOException {
         int utfSize = readUnsignedShort();
         if (utfSize == 0) {
-            return new String();
+            return "";
         }
         byte[] buf = new byte[utfSize];
         if (read(buf, 0, buf.length) == buf.length) {



Mime
View raw message