You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/06/07 05:09:48 UTC

svn commit: r545032 - in /harmony/enhanced/classlib/branches/java6/modules: beans/src/main/java/org/apache/harmony/beans/editors/ beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/reg...

Author: pyang
Date: Wed Jun  6 20:09:46 2007
New Revision: 545032

URL: http://svn.apache.org/viewvc?view=rev&rev=545032
Log:
Merge updates from classlib trunk@544827 since r544450

Modified:
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java
    harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java
    harmony/enhanced/classlib/branches/java6/modules/luni/META-INF/MANIFEST.MF
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ArrayList.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Hashtable.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java
    harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java
    harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java
    harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/ServerSocketChannelImpl.java
    harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
    harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c
    harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java Wed Jun  6 20:09:46 2007
@@ -67,6 +67,31 @@
             super.setValue(value);
         }
     }
+    
+    @Override
+    public void setAsText(String text) {
+        if (null == text) {
+            throw new NullPointerException();
+        }
+
+        int r = 0;
+        int g = 0;
+        int b = 0;
+
+        try {
+            int index = text.indexOf(",");
+            r = Integer.parseInt(text.substring(0, index));
+            text = text.substring(index + 1);
+            index = text.indexOf(",");
+            g = Integer.parseInt(text.substring(0, index));
+            text = text.substring(index + 1);
+            b = Integer.parseInt(text);
+            setValue(new Color(r, g, b));
+        } catch (Exception e) {
+            throw new IllegalArgumentException(text);
+        }
+    }
+    
 
     @Override
     public boolean isPaintable() {

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java Wed Jun  6 20:09:46 2007
@@ -17,6 +17,7 @@
 
 package org.apache.harmony.beans.tests.java.beans;
 
+import java.awt.Color;
 import java.beans.PropertyEditor;
 import java.beans.PropertyEditorManager;
 
@@ -72,5 +73,36 @@
 
         editor.setAsText(text);
         assertEquals(text, editor.getAsText());
+    }
+    
+    // Regression for HARMONY-4062
+    public void testColorEditor() {
+        PropertyEditor propertyEditor = PropertyEditorManager
+                .findEditor(Color.class);
+        propertyEditor.setValue(new Color(0, 0, 0));
+        propertyEditor.setAsText("1,2,3");
+        Color newColor = new Color(1, 2, 3);
+        assertEquals(newColor, propertyEditor.getValue());
+
+        try {
+            propertyEditor.setAsText(null);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected.
+        }
+
+        try {
+            propertyEditor.setAsText("illegalArugment");
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected.
+        }
+
+        try {
+            propertyEditor.setAsText("1,2,3,4");
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            //expected.
+        }
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java Wed Jun  6 20:09:46 2007
@@ -77,15 +77,15 @@
 public class RegistryContext implements Context, Referenceable {
 
     /**
-     * Constant that holds the name of the environment property
-     * for specifying that RMI security manager should be installed.
+     * System property used to state whether the RMI security manager should be
+     * installed.
      */
-    public static final String SECURITY_MANAGER =
+    public static final String SECURITY_MANAGER = 
             "java.naming.rmi.security.manager"; //$NON-NLS-1$
 
     /**
-     * Constant that holds the name of the environment property
-     * for specifying the name of {@link RMIClientSocketFactory} class.
+     * System property used to supply the name of the
+     * {@link RMIClientSocketFactory} to use.
      */
     public static final String CLIENT_SOCKET_FACTORY =
             "org.apache.harmony.jndi.provider.rmi.registry.clientSocketFactory"; //$NON-NLS-1$

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/META-INF/MANIFEST.MF?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/META-INF/MANIFEST.MF Wed Jun  6 20:09:46 2007
@@ -28,6 +28,7 @@
  javax.net;resolution:=optional,
  javax.net.ssl,
  javax.xml.parsers,
+ org.apache.harmony.awt.gl.image,
  org.apache.harmony.nio,
  org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional,
  org.w3c.dom,

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ArrayList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ArrayList.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ArrayList.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ArrayList.java Wed Jun  6 20:09:46 2007
@@ -75,9 +75,11 @@
 	 */
 	public ArrayList(Collection<? extends E> collection) {
 		int size = collection.size();
-		firstIndex = lastIndex = 0;
+		firstIndex = 0;
 		array = newElementArray(size + (size / 10));
-		addAll(collection);
+        collection.toArray(array);
+        lastIndex = size;
+        modCount = 1;
 	}
     
     @SuppressWarnings("unchecked")
@@ -201,12 +203,9 @@
         }
 
         if (growSize > 0) {
-            Iterator<? extends E> it = collection.iterator();
-            int index = location + firstIndex;
-            int end = index + growSize;
-            while (index < end) {
-                array[index++] = it.next();
-            }
+            Object[] dumparray = new Object[growSize];
+            collection.toArray(dumparray);
+            System.arraycopy(dumparray, 0, this.array, location+firstIndex, growSize);
             modCount++;
             return true;
         }
@@ -227,11 +226,10 @@
 			if (lastIndex > array.length - growSize) {
                 growAtEnd(growSize);
             }
-			Iterator<? extends E> it = collection.iterator();
-			int end = lastIndex + growSize;
-			while (lastIndex < end) {
-                array[lastIndex++] = it.next();
-            }
+            Object[] dumparray = new Object[growSize];
+            collection.toArray(dumparray);
+            System.arraycopy(dumparray, 0, this.array, lastIndex, growSize);
+            lastIndex += growSize;
 			modCount++;
 			return true;
 		}
@@ -366,7 +364,7 @@
 
 	private void growAtFront(int required) {
 		int size = size();
-		if (array.length - lastIndex >= required) {
+		if (array.length - lastIndex + firstIndex >= required) {
 			int newFirst = array.length - size;
 			if (size > 0) {
 				System.arraycopy(array, firstIndex, array, newFirst, size);
@@ -526,8 +524,26 @@
 		modCount++;
 		return result;
 	}
-
+    
 	/**
+     * Removes the first one of the specified object in this list, if present.
+     * 
+     * @param object
+     *            the object to removes
+     * @return true if the list contains the object
+     * @see java.util.AbstractCollection#remove(java.lang.Object)
+     */
+    @Override
+    public boolean remove(Object object) {
+        int location = indexOf(object);
+        if (location >= 0) {
+            remove(location);
+            return true;
+        }
+        return false;
+    }
+
+    /**
 	 * Removes the objects in the specified range from the start to the end, but
 	 * not including the end index.
 	 * 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java Wed Jun  6 20:09:46 2007
@@ -575,15 +575,51 @@
         }
 
         public int indexOf(Object object) {
+            final int size;
+            final Object[] array;
             synchronized (mutex) {
-                return list.indexOf(object);
+                size = list.size();
+                array = new Object[size];
+                list.toArray(array);
             }
+            if (null != object)
+                for (int i = 0; i < size; i++) {
+                    if (object.equals(array[i])) {
+                        return i;
+                    }
+                }
+            else {
+                for (int i = 0; i < size; i++) {
+                    if (null == array[i]) {
+                        return i;
+                    }
+                }
+            }
+            return -1;
         }
 
         public int lastIndexOf(Object object) {
+            final int size;
+            final Object[] array;
             synchronized (mutex) {
-                return list.lastIndexOf(object);
+                size = list.size();
+                array = new Object[size];
+                list.toArray(array);
+            }
+            if (null != object)
+                for (int i = size - 1; i >= 0; i--) {
+                    if (object.equals(array[i])) {
+                        return i;
+                    }
+                }
+            else {
+                for (int i = size - 1; i >= 0; i--) {
+                    if (null == array[i]) {
+                        return i;
+                    }
+                }
             }
+            return -1;
         }
 
         public ListIterator<E> listIterator() {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java Wed Jun  6 20:09:46 2007
@@ -372,10 +372,10 @@
     }
 
     /**
-     * Constructs an empty enum map using the given key type.
+     * Constructs an empty EnumMap.
      * 
      * @param keyType
-     *            the class object of the key type used by this enum map
+     *           the Class that is to be used for the key type for this map
      * @throws NullPointerException
      *             if the keyType is null
      */
@@ -384,11 +384,12 @@
     }
 
     /**
-     * Constructs an enum map using the same key type as the given enum map and
-     * initially containing the same mappings.
+     * Constructs an EnumMap using the same key type and contents as the given
+     * EnumMap.
      * 
      * @param map
-     *            the enum map from which this enum map is initialized
+     *            the EnumMap from which the initial contents of this EnumMap
+     *            are copied
      * @throws NullPointerException
      *             if the map is null
      */
@@ -397,16 +398,16 @@
     }
 
     /**
-     * Constructs an enum map initialized from the given map. If the given map
-     * is an EnumMap instance, this constructor behaves in the exactly the same
-     * way as {@link EnumMap#EnumMap(EnumMap)}}. Otherwise, the given map at
-     * least should contain one mapping.
+     * Constructs an EnumMap with the same contents as the given Map. If the Map
+     * is an EnumMap, this is equivalent to calling
+     * {@link EnumMap#EnumMap(EnumMap)}}. Otherwise, the given map cannot be
+     * empty so that the key type of this EnumMap can be inferred.
      * 
      * @param map
-     *            the map from which this enum map is initialized
+     *            the Map from which the initial contents of this EnumMap are
+     *            copied
      * @throws IllegalArgumentException
-     *             if the map is not an enum map instance and does not contain
-     *             any mappings
+     *             if the map is empty and is not of type <code>EnumMap</code>
      * @throws NullPointerException
      *             if the map is null
      */
@@ -430,7 +431,7 @@
     }
 
     /**
-     * Removes all mappings in this map.
+     * Clears this map.
      */
     @Override
     public void clear() {
@@ -440,7 +441,7 @@
     }
 
     /**
-     * Answers a shallow copy of this map.
+     * Clones this map to create a shallow copy.
      * 
      * @return a shallow copy of this map
      */
@@ -456,11 +457,11 @@
     }
 
     /**
-     * Answers true if this map has a mapping for the given key.
+     * Returns true if the given object is present as a key in this map.
      * 
      * @param key
-     *            the key whose presence in this map is to be tested
-     * @return true if this map has a mapping for the given key.
+     *            the key to look for
+     * @return true if this map contains the key
      */
     @Override
     public boolean containsKey(Object key) {
@@ -472,11 +473,11 @@
     }
 
     /**
-     * Answers true if this map has one or more keys mapped to the given value.
+     * Returns true if the given object is present as a value in this map.
      * 
      * @param value
-     *            the value whose presence in this map is to be tested
-     * @return true if this map has one or more keys mapped to the given value.
+     *            the value to look for
+     * @return true if this map contains the value.
      */
     @Override
     public boolean containsValue(Object value) {
@@ -517,12 +518,11 @@
     }
 
     /**
-     * Compares the given object with this map. Answers true if the given object
-     * is equal to this map.
+     * Returns true if this EnumMap is equal to the given object.
      * 
      * @param object
-     *            the object to be compared with this map
-     * @return true if the given object is equal to this map.
+     *            the object
+     * @return true if this EnumMap is equal to the given object.
      */
     @Override
     public boolean equals(Object object) {
@@ -541,13 +541,12 @@
     }
 
     /**
-     * Answers the value which is mapped to the given key in this map, or null
-     * if this map has no mapping for the given key.
+     * Returns the value stored in this map for the given key in this map, or null
+     * if this map has no entry for that key.
      * 
      * @param key
-     *            the key whose associated value is to be returned
-     * @return the value to which this map maps the given key, or null if this
-     *         map has no mapping for the given key.
+     *            the key to get the value for.
+     * @return the value for the given key.
      */
     @Override
     @SuppressWarnings("unchecked")
@@ -578,17 +577,17 @@
     }
 
     /**
-     * Associates the given value with the given key in this map. If the map
-     * previously had a mapping for this key, the old value is replaced.
+     * Stores a value in this map for the given key. If the map already has an
+     * entry for this key the current value will be overwritten.
      * 
      * @param key
-     *            the key with which the given value is to be associated value
+     *            the key
      * @param value
-     *            the value to be associated with the given key
-     * @return the value to which this map maps the given key, or null if this
-     *         map has no mapping for the given key.
+     *            the value to store for the given key
+     * @return the value stored for the given key, or null if this map has no
+     *         entry for the key
      * @throws NullPointerException
-     *             if the given key is null
+     *             if the key is null
      */
     @Override
     @SuppressWarnings("unchecked")
@@ -597,15 +596,12 @@
     }
 
     /**
-     * Copies all the mappings in the given map to this map. These mappings will
-     * replace all mappings that this map had for all of the keys currently in
-     * the given map.
+     * Add all the entries in the given map to this map
      * 
      * @param map
-     *            the key whose presence in this map is to be tested
+     *            the map whose entries to copy
      * @throws NullPointerException
-     *             if the given map is null, or if one or more keys in the given
-     *             map are null
+     *             if the given map or any of its keys are null
      */
     @Override
     @SuppressWarnings("unchecked")
@@ -614,12 +610,12 @@
     }
 
     /**
-     * Removes the mapping for this key from this map if it is present.
+     * Removes the entry for the given key from this map, if there is one.
      * 
      * @param key
-     *            the key whose mapping is to be removed from this map
-     * @return the previous value associated with the given key, or null if this
-     *         map has no mapping for this key.
+     *            the key to remove
+     * @return the value that had been stored for the key, or null if there was
+     *         not one.
      */
     @Override
     @SuppressWarnings("unchecked")
@@ -638,9 +634,9 @@
     }
 
     /**
-     * Answers the number of the mappings in this map.
+     * Returns the size of this map
      * 
-     * @return the number of the mappings in this map
+     * @return the number of entries in the map
      */
     @Override
     public int size() {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Hashtable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Hashtable.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Hashtable.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Hashtable.java Wed Jun  6 20:09:46 2007
@@ -373,7 +373,7 @@
         for (int i = elementData.length; --i >= 0;) {
             Entry<K, V> entry = elementData[i];
             while (entry != null) {
-                if (value.equals(entry.value)) {
+                if (entry.value.equals(value)) {
                     return true;
                 }
                 entry = entry.next;

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java Wed Jun  6 20:09:46 2007
@@ -68,7 +68,10 @@
         // Test for method java.io.FileOutputStream(java.lang.String)
         f = new File(fileName = System.getProperty("user.home"), "fos.tst");
         fileName = f.getAbsolutePath();
-        fos = new java.io.FileOutputStream(f);
+        fos = new FileOutputStream(fileName);
+
+        // Regression test for HARMONY-4012
+        new FileOutputStream("nul");
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java Wed Jun  6 20:09:46 2007
@@ -17,7 +17,6 @@
 
 package java.nio;
 
-import org.apache.harmony.luni.platform.MappedPlatformAddress;
 import org.apache.harmony.luni.platform.PlatformAddress;
 import org.apache.harmony.nio.internal.DirectBuffer;
 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java Wed Jun  6 20:09:46 2007
@@ -114,6 +114,7 @@
     /*
      * for native call
      */
+    @SuppressWarnings("unused")
     private DatagramChannelImpl(){
         super(SelectorProvider.provider());
         fd = new FileDescriptor();

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/ServerSocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/ServerSocketChannelImpl.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/ServerSocketChannelImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/ServerSocketChannelImpl.java Wed Jun  6 20:09:46 2007
@@ -27,7 +27,6 @@
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.IllegalBlockingModeException;
 import java.nio.channels.NotYetBoundException;
-import java.nio.channels.SelectableChannel;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 import java.nio.channels.spi.SelectorProvider;
@@ -95,6 +94,7 @@
     }
     
     // for native call
+    @SuppressWarnings("unused")
     private ServerSocketChannelImpl() throws IOException {
         super(SelectorProvider.provider());
         status = SERVER_STATUS_OPEN;

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java Wed Jun  6 20:09:46 2007
@@ -154,6 +154,7 @@
     /*
      * for native call
      */
+    @SuppressWarnings("unused")
     private SocketChannelImpl(){
         super(SelectorProvider.provider());
         fd = new FileDescriptor();

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c Wed Jun  6 20:09:46 2007
@@ -504,7 +504,7 @@
       return -1;
     }
 
-  if ((flags & HyOpenTruncate) == HyOpenTruncate)
+  if ((GetFileType(aHandle) == FILE_TYPE_DISK) && ((flags & HyOpenTruncate) == HyOpenTruncate))
     {
       if (0 == CloseHandle (aHandle))
 	{
@@ -602,7 +602,7 @@
   I_32 error;
 
   lowerOffset = (DWORD) (offset & 0xFFFFFFFF);
-  upperOffset = (DWORD) ((offset >> 32) & 0x7FFFFFFF);
+  upperOffset = (DWORD) ((offset >> 32) & 0xFFFFFFFF);
 
   if ((whence < HySeekSet) || (whence > HySeekEnd))
     {

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c?view=diff&rev=545032&r1=545031&r2=545032
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c Wed Jun  6 20:09:46 2007
@@ -73,7 +73,7 @@
     exit(1);
   }
 
-  hyportLibrary.file_printf(&hyportLibrary, fd, "%d%c%s\n", 1, '2', "3");
+  hyportLibrary.file_printf(&hyportLibrary, fd, "%d%c%s", 1, '2', "3");
   rc = hyportLibrary.file_sync(&hyportLibrary, fd);
   if (rc != 0) {
     fprintf(stderr, "hyfile_sync failed %s\n",
@@ -108,7 +108,7 @@
     exit(1);
   }
 
-  offset = hyportLibrary.file_seek(&hyportLibrary, fd, -11, HySeekEnd);
+  offset = hyportLibrary.file_seek(&hyportLibrary, fd, -10, HySeekEnd);
   printf("  offset = %d\n", offset);
   if (offset != 7) {
     fprintf(stderr, "Failed to seek hytest.tmp2\n");
@@ -142,7 +142,7 @@
 
   length = hyportLibrary.file_length(&hyportLibrary, "hytest.tmp2");
   printf("  length = %d\n", length);
-  if (length != 18) {
+  if (length != 17) {
     fprintf(stderr, "hytest.tmp2 has incorrect length\n");
     cleanup(hyportLibrary);
     exit(1);