harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r986497 [2/4] - in /harmony/enhanced/java/branches/mrh: ./ classlib/ classlib/depends/build/platform/ classlib/depends/manifests/xalan-j_2.7.0/ classlib/depends/manifests/xerces_2.10.0/ classlib/make/ classlib/modules/archive/src/main/nativ...
Date Tue, 17 Aug 2010 21:36:14 GMT
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java Tue Aug 17 21:36:10 2010
@@ -111,9 +111,8 @@ public class JPEGImageWriter extends Ima
                         : reg.height;
             }
 
-            //-- TODO uncomment when JPEGImageWriteParam be implemented
             //-- Only default progressive mode yet
-            // progressive = param.getProgressiveMode() ==  ImageWriteParam.MODE_DEFAULT;
+            progressive = param.getProgressiveMode() ==  ImageWriteParam.MODE_DEFAULT;
 
             //-- def is 1
             deltaX = param.getSourceXSubsampling();
@@ -255,11 +254,12 @@ public class JPEGImageWriter extends Ima
      */
     @SuppressWarnings("unused")
     private void getScanLine(int scanline) {
-        //-- TODO: processImageProgress in ImageWriter
         Raster child = sourceRaster.createChild(srcXOff,
                 srcYOff + scanline * deltaY, srcWidth, 1, 0, 0, null);
 
         scanRaster.setRect(child);
+        // broadcast the current percentage of image completion
+        processImageProgress((float) scanline / (float) srcHeight * 100.0f);
     }
 
     /**

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/spi/ServiceRegistryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/spi/ServiceRegistryTest.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/spi/ServiceRegistryTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/spi/ServiceRegistryTest.java Tue Aug 17 21:36:10 2010
@@ -31,6 +31,22 @@ import javax.imageio.spi.ImageWriterSpi;
 
 public class ServiceRegistryTest extends TestCase {
 
+    public void testLookupProviders() {
+        // lookup from a correct provider-configuration file
+        Iterator it = ServiceRegistry.lookupProviders(CorrectProviderConfiguration.class); 
+        assertEquals("Failed to find provider and instantiate it",
+                "class javax.imageio.spi.CorrectProviderConfiguration", 
+                it.next().getClass().toString());
+       
+        // lookup from incorrect provider-configuration file
+        try {
+            it = ServiceRegistry.lookupProviders(IncorrectProviderConfiguration.class);
+            fail("ServiceConfigurationError expected");
+        } catch (Error e) {
+            // Ok
+        }
+    }
+    
     public void testDeregisterAll() {
         Class[] CATEGORIES = new Class[] {
                 ImageReaderSpi.class };
@@ -149,6 +165,18 @@ public class ServiceRegistryTest extends
         // Return false if this ordering is not set
         assertFalse("Failed to check if the ordering is not set", registry.unsetOrdering(CATEGORIES[0], reader2, reader));
     }
+    
+    public void testGetServiceProviderByClass() {
+    	Class[] CATEGORIES = new Class[] {
+                ImageReaderSpi.class };
+        
+        ServiceRegistry registry = new ServiceRegistry(Arrays.<Class<?>> asList(CATEGORIES).iterator());
+        ImageReaderSpi reader = new SampleImageReaderSpi();
+        registry.registerServiceProvider(reader, CATEGORIES[0]);
+        
+        ImageReaderSpi provider = registry.getServiceProviderByClass(SampleImageReaderSpi.class);
+        assertEquals(reader, provider);
+    }
 
     public void testRegistryServiceProvider() throws Exception {
         Class[] CATEGORIES = new Class[] {

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java Tue Aug 17 21:36:10 2010
@@ -17,9 +17,7 @@
 
 package javax.imageio.stream;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.nio.ByteOrder;
 import java.util.Arrays;
 
@@ -221,13 +219,12 @@ public class ImageOutputStreamImplTest e
 		out.writeUTF("test");
 		assertEquals("test", in.readUTF());
 
-		// FIXME: fails with ByteOrder.LITTLE_ENDIAN
-		// out.reset();
-		// in.reset();
-		// out.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-		// in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-		// out.writeUTF("test");
-		// assertEquals("test", in.readUTF());
+		out.reset();
+		in.reset();
+		out.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+		in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+		out.writeUTF("test");
+		assertEquals("test", in.readUTF());
 	}
 
 	static class BasicImageOutputStreamImpl extends ImageOutputStreamImpl {

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ManagementFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ManagementFactory.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ManagementFactory.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ManagementFactory.java Tue Aug 17 21:36:10 2010
@@ -43,6 +43,7 @@ import javax.management.ObjectName;
 import org.apache.harmony.lang.management.ManagementUtils;
 import org.apache.harmony.lang.management.MemoryManagerMXBeanImpl;
 import org.apache.harmony.lang.management.OpenTypeMappingIHandler;
+import org.apache.harmony.lang.management.internal.nls.Messages;
 
 
 /**
@@ -374,16 +375,16 @@ public class ManagementFactory {
         if (multiInstanceBeanNames.contains(mxbeanInterfaceName)) {
             // partial match is good enough
             if (!mxbeanName.startsWith(expectedObjectName)) {
-                throw new IllegalArgumentException(mxbeanName
-                        + " is not an instance of interface "
-                        + mxbeanInterfaceName);
+                // lm.02={0} is not an instance of interface {1}
+                throw new IllegalArgumentException(Messages.getString(
+                        "lm.02", mxbeanName, mxbeanInterfaceName)); //$NON-NLS-1$                
             }
         } else {
             // exact match required
             if (!expectedObjectName.equals(mxbeanName)) {
-                throw new IllegalArgumentException(mxbeanName
-                        + " is not an instance of interface "
-                        + mxbeanInterfaceName);
+                // lm.02= {0} is not an instance of interface {1}
+                throw new IllegalArgumentException(Messages.getString(
+                        "lm.02", mxbeanName, mxbeanInterfaceName)); //$NON-NLS-1$                
             }
         }
     }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/MemoryNotificationInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/MemoryNotificationInfo.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/MemoryNotificationInfo.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/MemoryNotificationInfo.java Tue Aug 17 21:36:10 2010
@@ -20,6 +20,7 @@ package java.lang.management;
 import javax.management.openmbean.CompositeData;
 
 import org.apache.harmony.lang.management.ManagementUtils;
+import org.apache.harmony.lang.management.internal.nls.Messages;
 
 /**
  * <p>
@@ -78,10 +79,12 @@ public class MemoryNotificationInfo {
     public MemoryNotificationInfo(String poolName, MemoryUsage usage, long count) {
         super();
         if (poolName == null) {
-            throw new NullPointerException("pooName is null"); //$NON-NLS-1$
+            //lm.03= poolName is null
+            throw new NullPointerException(Messages.getString("lm.03")); //$NON-NLS-1$            
         }
         if (usage == null) {
-            throw new NullPointerException("usage is null"); //$NON-NLS-1$
+            //lm.04=usage is null
+            throw new NullPointerException(Messages.getString("lm.04")); //$NOn-NLs-1$            
         }
         
         this.poolName = poolName;
@@ -92,8 +95,8 @@ public class MemoryNotificationInfo {
     private MemoryNotificationInfo(CompositeData cd) {
         final Object poolName = cd.get("poolName"); //$NON-NLS-1$
         if (poolName == null) {
-            throw new IllegalArgumentException(
-                    "Attribute poolName has null value"); //$NON-NLS-1$
+            //lm.05=Attribute poolName has null value
+            throw new IllegalArgumentException(Messages.getString("lm.05")); //$NON-NLs-1$           
         }
         this.poolName = (String) poolName;
         this.usage = MemoryUsage.from((CompositeData) cd.get("usage")); //$NON-NLS-1$

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ThreadInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ThreadInfo.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ThreadInfo.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/java/lang/management/ThreadInfo.java Tue Aug 17 21:36:10 2010
@@ -20,6 +20,7 @@ package java.lang.management;
 import javax.management.openmbean.CompositeData;
 
 import org.apache.harmony.lang.management.ManagementUtils;
+import org.apache.harmony.lang.management.internal.nls.Messages;
 
 
 /**
@@ -102,9 +103,9 @@ public class ThreadInfo {
             long threadIdVal = ((Long) attributeVals[0]).longValue();
             String threadNameVal = (String) attributeVals[1];
             if (threadNameVal == null) {
-                throw new IllegalArgumentException(
-                        "Invalid composite data: Attribute threadName has null value");
-            }
+                //lm.06=Invalid composite data: Attribute threadName has null value
+                throw new IllegalArgumentException(Messages.getString("lm.06")); //$NON-NLS-1$                
+                }
             String threadStateStringVal = (String) attributeVals[2];
 
             // Verify that threadStateStringVal contains a string that can be
@@ -113,9 +114,8 @@ public class ThreadInfo {
             try {
                 threadStateVal = Thread.State.valueOf(threadStateStringVal);
             } catch (IllegalArgumentException e) {
-                throw new IllegalArgumentException(
-                        "CompositeData contains an unexpected threadState value.",
-                        e);
+                //lm.07=CompsiteData contains an unexpected threadState value. {0}
+                throw new IllegalArgumentException(Messages.getString("lm.07", e)); //$NON-NLS-1$                
             }
 
             boolean suspendedVal = ((Boolean) attributeVals[3]).booleanValue();
@@ -131,7 +131,8 @@ public class ThreadInfo {
                     : null;
             CompositeData[] stackTraceDataVal = (CompositeData[]) attributeVals[12];
             if (stackTraceDataVal == null) {
-                throw new IllegalArgumentException("StackTraceElement[] is missing");
+                //lm.08=StackTraceElement[] is missing
+                throw new IllegalArgumentException(Messages.getString("lm.08")); //$NON-NLS-1$            
             }
             StackTraceElement[] stackTraceVals = getStackTracesFromCompositeData(stackTraceDataVal);
             result = new ThreadInfo(threadIdVal, threadNameVal, threadStateVal,

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/CompilationMXBeanImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/CompilationMXBeanImpl.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/CompilationMXBeanImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/CompilationMXBeanImpl.java Tue Aug 17 21:36:10 2010
@@ -21,6 +21,8 @@ import java.lang.management.CompilationM
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Runtime type for {@link CompilationMXBean}
  * 
@@ -97,9 +99,9 @@ public final class CompilationMXBeanImpl
      * @see java.lang.management.CompilationMXBean#getTotalCompilationTime()
      */
     public long getTotalCompilationTime() {
-        if (!isCompilationTimeMonitoringSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support monitoring of compilation time.");
+        if (!isCompilationTimeMonitoringSupported()) {            
+            //lm.09=VM does not support monitoring of compilation time
+            throw new UnsupportedOperationException(Messages.getString("lm.09")); //$NON-NLs-1$            
         }
         return this.getTotalCompilationTimeImpl();
     }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java Tue Aug 17 21:36:10 2010
@@ -31,6 +31,8 @@ import javax.management.MBeanOperationIn
 import javax.management.MBeanParameterInfo;
 import javax.management.ReflectionException;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Abstract implementation of the {@link DynamicMBean} interface that provides
  * behaviour required by a dynamic MBean. This class is subclassed by all of the
@@ -169,9 +171,9 @@ public abstract class DynamicMXBeanImpl 
         Method getterMethod = null;
         MBeanAttributeInfo attribInfo = getPresentAttribute(attribute,
                 AttributeAccessType.READING);
-        if (attribInfo == null) {
-            throw new AttributeNotFoundException("No such attribute : "
-                    + attribute);
+        if (attribInfo == null) {            
+            //lm.0A=No such attribute : {0}
+            throw new AttributeNotFoundException(Messages.getString("lm.0A", attribute)); //$NON-NLs-1$
         }
 
         try {
@@ -228,8 +230,8 @@ public abstract class DynamicMXBeanImpl 
         MBeanAttributeInfo attribInfo = getPresentAttribute(
                 attribute.getName(), AttributeAccessType.WRITING);
         if (attribInfo == null) {
-            throw new AttributeNotFoundException("No such attribute : "
-                    + attribute);
+            //lm.0A=No such attribute : {0}
+            throw new AttributeNotFoundException(Messages.getString("lm.0A", attribute)); //$NON-NLs-1$
         }
 
         try {
@@ -245,13 +247,13 @@ public abstract class DynamicMXBeanImpl 
 
         if (argType.isPrimitive()) {
             if (!ManagementUtils.isWrapperClass(
-                    attribute.getValue().getClass(), argType)) {
-                throw new InvalidAttributeValueException(attribInfo.getName()
-                        + " is a " + attribInfo.getType() + " attribute");
+                    attribute.getValue().getClass(), argType)) {               
+                //lm.0B= {0} is a {1} attribute
+                throw new InvalidAttributeValueException(Messages.getString("lm.0B", attribInfo.getName(), attribInfo.getType())); //$NON-NLS-1$
             }
         } else if (!argType.equals(attribute.getValue().getClass())) {
-            throw new InvalidAttributeValueException(attribInfo.getName()
-                    + " is a " + attribInfo.getType() + " attribute");
+            //lm.0B= {0} is a {1} attribute
+            throw new InvalidAttributeValueException(Messages.getString("lm.0B", attribInfo.getName(), attribInfo.getType())); //$NON-NLS-1$
         }
 
         Method setterMethod = null;
@@ -302,11 +304,10 @@ public abstract class DynamicMXBeanImpl 
         // Validate that we have the named action
         MBeanOperationInfo opInfo = getPresentOperation(actionName,
                 localSignature);
-        if (opInfo == null) {
-            throw new ReflectionException(
-                    new NoSuchMethodException(actionName),
-                    "No such operation : " + actionName);
-        }
+        if (opInfo == null) {            
+            //lm.0C=No such operation : {0}
+            throw new ReflectionException( new NoSuchMethodException (actionName), Messages.getString("lm.0C", actionName)); //$NON-NLS-1$          
+            }
 
         // For Java 5.0 platform MXBeans, no conversion
         // to open MBean types is necessary for any of the arguments.
@@ -412,7 +413,7 @@ public abstract class DynamicMXBeanImpl 
             Throwable root = e.getCause();
             if (root instanceof RuntimeException) {
                 throw (RuntimeException) root;
-            } else {
+            } else {                
                 throw new MBeanException((Exception) root);
             }// end else
         }// end catch

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/LoggingMXBeanImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/LoggingMXBeanImpl.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/LoggingMXBeanImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/LoggingMXBeanImpl.java Tue Aug 17 21:36:10 2010
@@ -25,6 +25,8 @@ import java.util.logging.LogManager;
 import java.util.logging.Logger;
 import java.util.logging.LoggingMXBean;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Runtime type for {@link java.util.logging.LoggingMXBean}.
  * 
@@ -139,9 +141,9 @@ public class LoggingMXBeanImpl extends D
                 logger.setLevel(null);
             }
         } else {
-            // Named Logger does not exist.
-            throw new IllegalArgumentException(
-                    "Unable to find Logger with name " + loggerName);
+            // Named Logger does not exist.           
+            //lm.0D=Unable to find logger with name {0}
+            throw new IllegalArgumentException(Messages.getString("lm.0D", loggerName)); //$NON-NLS-1$            
         }
     }
 }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java Tue Aug 17 21:36:10 2010
@@ -61,6 +61,8 @@ import javax.management.openmbean.Tabula
 import javax.management.openmbean.TabularDataSupport;
 import javax.management.openmbean.TabularType;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Support methods for org.apache.harmony.lang.management classes.
  * 
@@ -772,9 +774,9 @@ public class ManagementUtils {
             String[] expectedNames, String[] expectedTypes) {
         Object[] allVals = cd.getAll(expectedNames);
         // Check that the number of elements match
-        if (allVals.length != expectedTypes.length) {
-            throw new IllegalArgumentException(
-                    "CompositeData does not contain the expected number of attributes.");
+        if (allVals.length != expectedTypes.length) {                    
+            //lm.0E=CompositeData does not contain the expected number of attribute.
+            throw new IllegalArgumentException(Messages.getString("lm.0E")); //$NON-NLS-1$       
         }
 
         // Type of corresponding elements must be the same
@@ -793,11 +795,10 @@ public class ManagementUtils {
                     if (allVals[i] instanceof CompositeData) {
                         continue;
                     }
-                }
-                throw new IllegalArgumentException(
-                        "CompositeData contains an attribute not of expected type. "
-                                + "Expected " + expectedType + ", found "
-                                + actualType);
+                }                                
+                //lm.0F=CompositeData contains an attribute not of expected type. Expected {0} ,found {1}
+                throw new IllegalArgumentException(Messages.getString("lm.0F", expectedType, actualType)); //$NON-NLS-1$               
+               
             }
         }// end for
     }
@@ -814,10 +815,9 @@ public class ManagementUtils {
      */
     public static void verifyFieldNames(CompositeData cd, String[] expected) {
         for (int i = 0; i < expected.length; i++) {
-            if (!cd.containsKey(expected[i])) {
-                throw new IllegalArgumentException(
-                        "CompositeData object does not contain expected key : " //$NON-NLS-1$
-                                + expected[i]);
+            if (!cd.containsKey(expected[i])) {                
+                //lm.10=CompositeData object does not contain expected key: {0}
+                throw new IllegalArgumentException(Messages.getString("lm.10", expected[i])); //$NON-NLS-1$                
             }
         }// end for all elements in expected
     }
@@ -833,10 +833,10 @@ public class ManagementUtils {
      *            the number of expected attributes in <code>cd</code>
      */
     public static void verifyFieldNumber(CompositeData cd, int minSize) {
-        if (cd.values().size() < minSize) {
-            throw new IllegalArgumentException(
-                    "CompositeData object does not have the expected number of attributes"); //$NON-NLS-1$
-        }
+        if (cd.values().size() < minSize) {            
+            //lm.11=CompositeData object does not have the expected number of attributes 
+            throw new IllegalArgumentException(Messages.getString("lm.11")); //$NON-NLS-1$          
+            }
     }
 
     /**
@@ -1129,9 +1129,9 @@ public class ManagementUtils {
         Set<String> cdKeySet = data.getTabularType().getRowType().keySet();
         // The key set for the CompositeData instances comprising each row
         // must contain only two elements.
-        if (cdKeySet.size() != 2) {
-            throw new IllegalArgumentException(
-                    "TabularData's row type is not a CompositeType with two items.");
+        if (cdKeySet.size() != 2) {            
+            //lm.12=TabularData row type is not CompositeType with two items.
+            throw new IllegalArgumentException(Messages.getString("lm.12")); //$NON-NLS-1$
         }
         String[] keysArray = new String[2];
         int count = 0;

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/MemoryPoolMXBeanImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/MemoryPoolMXBeanImpl.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/MemoryPoolMXBeanImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/MemoryPoolMXBeanImpl.java Tue Aug 17 21:36:10 2010
@@ -26,6 +26,8 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Runtime type for {@link java.lang.management.MemoryPoolMXBean}
  * 
@@ -104,9 +106,10 @@ public final class MemoryPoolMXBeanImpl 
      * @see java.lang.management.MemoryPoolMXBean#getCollectionUsageThreshold()
      */
     public long getCollectionUsageThreshold() {
-        if (!isCollectionUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support collection usage threshold.");
+        if (!isCollectionUsageThresholdSupported()) {            
+            //lm.13=VM does not support collection usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.13")); //$NON-NLS-1$
+            
         }
         return this.getCollectionUsageThresholdImpl();
     }
@@ -125,8 +128,8 @@ public final class MemoryPoolMXBeanImpl 
      */
     public long getCollectionUsageThresholdCount() {
         if (!isCollectionUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support collection usage threshold.");
+            //lm.13=VM does not support collection usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.13")); //$NON-NLS-1$
         }
         return this.getCollectionUsageThresholdCountImpl();
     }
@@ -224,8 +227,8 @@ public final class MemoryPoolMXBeanImpl 
      */
     public long getUsageThreshold() {
         if (!isUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support usage threshold.");
+            //lm.14=VM does not support usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.14")); //$NON-NLS-1$
         }
         return this.getUsageThresholdImpl();
     }
@@ -244,8 +247,8 @@ public final class MemoryPoolMXBeanImpl 
      */
     public long getUsageThresholdCount() {
         if (!isUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support usage threshold.");
+            //lm.14=VM does not support usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.14")); //$NON-NLS-1$
         }
         return this.getUsageThresholdCountImpl();
     }
@@ -265,8 +268,8 @@ public final class MemoryPoolMXBeanImpl 
      */
     public boolean isCollectionUsageThresholdExceeded() {
         if (!isCollectionUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support collection usage threshold.");
+            //lm.13=VM does not support collection usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.13")); //$NON-NLS-1$            
         }
         return this.isCollectionUsageThresholdExceededImpl();
     }
@@ -300,8 +303,8 @@ public final class MemoryPoolMXBeanImpl 
      */
     public boolean isUsageThresholdExceeded() {
         if (!isUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support usage threshold.");
+            //lm.14=VM does not support usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.14")); //$NON-NLS-1$
         }
         return this.isUsageThresholdExceededImpl();
     }
@@ -370,8 +373,8 @@ public final class MemoryPoolMXBeanImpl 
      */
     public void setCollectionUsageThreshold(long threshold) {
         if (!isCollectionUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support collection usage threshold.");
+            //lm.13=VM does not support collection usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.13")); //$NON-NLS-1$
         }
 
         SecurityManager security = System.getSecurityManager();
@@ -379,14 +382,14 @@ public final class MemoryPoolMXBeanImpl 
             security.checkPermission(new ManagementPermission("control"));
         }
 
-        if (threshold < 0) {
-            throw new IllegalArgumentException(
-                    "Collection usage threshold cannot be negative.");
+        if (threshold < 0) {            
+            //lm.15=Collection usage threshold cannot be negative.
+            throw new IllegalArgumentException(Messages.getString("lm.15")); //$NON-NLS-1$            
         }
 
-        if (exceedsMaxPoolSize(threshold)) {
-            throw new IllegalArgumentException(
-                    "Collection usage threshold cannot exceed maximum amount of memory for pool.");
+        if (exceedsMaxPoolSize(threshold)) {            
+            //lm.16=Collection usage threshold cannot exceed maximum amount of memory for pool.
+            throw new IllegalArgumentException(Messages.getString("lm.16")); //$NON-NLS-1$
         }
         this.setCollectionUsageThresholdImpl(threshold);
     }
@@ -405,8 +408,8 @@ public final class MemoryPoolMXBeanImpl 
      */
     public void setUsageThreshold(long threshold) {
         if (!isUsageThresholdSupported()) {
-            throw new UnsupportedOperationException(
-                    "VM does not support usage threshold.");
+            //lm.13=VM does not support collection usage threshold.
+            throw new UnsupportedOperationException(Messages.getString("lm.13"));
         }
 
         SecurityManager security = System.getSecurityManager();
@@ -415,13 +418,13 @@ public final class MemoryPoolMXBeanImpl 
         }
 
         if (threshold < 0) {
-            throw new IllegalArgumentException(
-                    "Usage threshold cannot be negative.");
+            //lm.15=Collection usage threshold cannot be negative.
+            throw new IllegalArgumentException(Messages.getString("lm.15")); //$NON-NLS-1$            
         }
 
         if (exceedsMaxPoolSize(threshold)) {
-            throw new IllegalArgumentException(
-                    "Usage threshold cannot exceed maximum amount of memory for pool.");
+            //lm.16=Collection usage threshold cannot exceed maximum amount of memory for pool.
+            throw new IllegalArgumentException(Messages.getString("lm.16")); //$NON-NLS-1$
         }
         this.setUsageThresholdImpl(threshold);
     }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java Tue Aug 17 21:36:10 2010
@@ -44,6 +44,8 @@ import javax.management.ObjectName;
 import javax.management.ReflectionException;
 import javax.management.RuntimeMBeanException;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Concrete instance of the {@link InvocationHandler} interface that is used to
  * handle method invocations on MXBeans that have been obtained using the proxy
@@ -80,8 +82,8 @@ public class OpenTypeMappingIHandler imp
     private void setInfo(String mxBeanType) {
         this.info = ManagementUtils.getMBeanInfo(mxBeanType);
         if (info == null) {
-            throw new IllegalArgumentException("Unknown MXBean type : "
-                    + mxBeanType);
+            //lm.17=Unknown MXBean type : {0}
+            throw new IllegalArgumentException(Messages.getString("lm.17", mxBeanType)); //$NON-NLS-1$         
         }
     }
 
@@ -95,8 +97,8 @@ public class OpenTypeMappingIHandler imp
             if (ManagementUtils.VERBOSE_MODE) {
                 e.printStackTrace(System.err);
             }// end if
-            throw new IllegalArgumentException(
-                    "Bean name not in valid format.", e);
+            //lm.18=Bean name not in valid format. {0}
+            throw new IllegalArgumentException(Messages.getString("lm.18", e)); //$NON-NLS-1$           
         }
     }
 
@@ -105,8 +107,8 @@ public class OpenTypeMappingIHandler imp
      */
     private void checkBeanIsRegistered() throws IOException {
         if (!this.connection.isRegistered(this.mxBeanObjectName)) {
-            throw new IllegalArgumentException("Not registered : "
-                    + this.mxBeanObjectName);
+            //lm.19=Not registered {0}
+            throw new IllegalArgumentException(Messages.getString("lm.19", this.mxBeanObjectName)); //$NON-NLS-1$
         }
     }
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/RuntimeMXBeanImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/RuntimeMXBeanImpl.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/RuntimeMXBeanImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/RuntimeMXBeanImpl.java Tue Aug 17 21:36:10 2010
@@ -28,6 +28,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Runtime type for {@link java.lang.management.RuntimeMXBean}
  * 
@@ -63,8 +65,8 @@ public final class RuntimeMXBeanImpl ext
 	 */
 	public String getBootClassPath() {
 		if (!isBootClassPathSupported()) {
-			throw new UnsupportedOperationException(
-					"VM does not support boot classpath.");
+            //lm.1A=VM does not support boot classpath
+            throw new UnsupportedOperationException(Messages.getString("lm.1A")); //$NON-NLS-1$
 		}
 
 		SecurityManager security = System.getSecurityManager();

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ThreadMXBeanImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ThreadMXBeanImpl.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ThreadMXBeanImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ThreadMXBeanImpl.java Tue Aug 17 21:36:10 2010
@@ -23,6 +23,8 @@ import java.lang.management.ThreadMXBean
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
+import org.apache.harmony.lang.management.internal.nls.Messages;
+
 /**
  * Runtime type for {@link java.lang.management.ThreadMXBean}
  * 
@@ -177,8 +179,8 @@ public final class ThreadMXBeanImpl exte
     public long getThreadCpuTime(long id) {
         // Validate input.
         if (id <= 0) {
-            throw new IllegalArgumentException(
-                    "Thread id must be greater than 0.");
+            //lm.1B=Thread id must be greater than 0
+            throw new IllegalArgumentException(Messages.getString("lm.1B")); //$NON-NLS-1$            
         }
 
         long result = -1;
@@ -187,8 +189,8 @@ public final class ThreadMXBeanImpl exte
                 result = this.getThreadCpuTimeImpl(id);
             }
         } else {
-            throw new UnsupportedOperationException(
-                    "CPU time measurement is not supported on this virtual machine.");
+            //lm.1C=CPU time measurement is not supported on this virtual machine
+            throw new UnsupportedOperationException(Messages.getString("lm.1C")); //$NON-NLS-1$
         }
         return result;
     }
@@ -225,14 +227,14 @@ public final class ThreadMXBeanImpl exte
         // Validate inputs
         for (int i = 0; i < ids.length; i++) {
             if (ids[i] <= 0) {
-                throw new IllegalArgumentException(
-                        "Thread id must be greater than 0.");
+                //lm.1B=Thread id must be greater than 0
+                throw new IllegalArgumentException(Messages.getString("lm.1B")); //$NON-NLS-1$            
             }
         }
 
-        if (maxDepth < 0) {
-            throw new IllegalArgumentException(
-                    "maxDepth value cannot be negative.");
+        if (maxDepth < 0) {            
+            //lm.1D=maxDepth value cannot be negative.
+            throw new IllegalArgumentException(Messages.getString("lm.1D")); //$NON-NLS-1$
         }
 
         // Create an array and populate with individual ThreadInfos
@@ -256,12 +258,12 @@ public final class ThreadMXBeanImpl exte
 
         // Validate inputs
         if (id <= 0) {
-            throw new IllegalArgumentException(
-                    "Thread id must be greater than 0.");
+            //lm.1B=Thread id must be greater than 0
+            throw new IllegalArgumentException(Messages.getString("lm.1B")); //$NON-NLS-1$            
         }
         if (maxDepth < 0) {
-            throw new IllegalArgumentException(
-                    "maxDepth value cannot be negative.");
+            //lm.1D=maxDepth value cannot be negative.
+            throw new IllegalArgumentException(Messages.getString("lm.1D")); //$NON-NLS-1$
         }
         return this.getThreadInfoImpl(id, maxDepth);
     }
@@ -480,8 +482,8 @@ public final class ThreadMXBeanImpl exte
     public long getThreadUserTime(long id) {
         // Validate input.
         if (id <= 0) {
-            throw new IllegalArgumentException(
-                    "Thread id must be greater than 0.");
+            //lm.1B=Thread id must be greater than 0
+            throw new IllegalArgumentException(Messages.getString("lm.1B")); //$NON-NLS-1$                          
         }
 
         long result = -1;
@@ -490,8 +492,8 @@ public final class ThreadMXBeanImpl exte
                 result = this.getThreadUserTimeImpl(id);
             }
         } else {
-            throw new UnsupportedOperationException(
-                    "CPU time measurement is not supported on this virtual machine.");
+            //lm.1C=CPU time measurement is not supported on this virtual machine
+            throw new UnsupportedOperationException(Messages.getString("lm.1C")); //$NON-NLS-1$    
         }
         return result;
     }
@@ -541,8 +543,8 @@ public final class ThreadMXBeanImpl exte
      */
     public boolean isThreadContentionMonitoringEnabled() {
         if (!isThreadContentionMonitoringSupported()) {
-            throw new UnsupportedOperationException(
-                    "Thread contention monitoring is not supported on this virtual machine.");
+            //lm.1E=Thread contention monitoring is not supported on this virtual machine.
+            throw new UnsupportedOperationException(Messages.getString("lm.1E")); //$NON-NLS-1$
         }
         return this.isThreadContentionMonitoringEnabledImpl();
     }
@@ -577,8 +579,9 @@ public final class ThreadMXBeanImpl exte
      */
     public boolean isThreadCpuTimeEnabled() {
         if (!isThreadCpuTimeSupported()) {
-            throw new UnsupportedOperationException(
-                    "Thread CPU timing is not supported on this virtual machine.");
+            
+            //lm.01=Thread CPU timing is not supported on this virtual machine.
+            throw new UnsupportedOperationException(Messages.getString("lm.01")); //$NON-NLS-1$
         }
         return this.isThreadCpuTimeEnabledImpl();
     }
@@ -631,8 +634,8 @@ public final class ThreadMXBeanImpl exte
      */
     public void setThreadContentionMonitoringEnabled(boolean enable) {
         if (!isThreadContentionMonitoringSupported()) {
-            throw new UnsupportedOperationException(
-                    "Thread contention monitoring is not supported on this virtual machine.");
+            //lm.1E=Thread contention monitoring is not supported on this virtual machine.
+            throw new UnsupportedOperationException(Messages.getString("lm.1E")); //$NON-NLS-1$            
         }
 
         SecurityManager security = System.getSecurityManager();
@@ -656,8 +659,8 @@ public final class ThreadMXBeanImpl exte
      */
     public void setThreadCpuTimeEnabled(boolean enable) {
         if (!isThreadCpuTimeSupported()) {
-            throw new UnsupportedOperationException(
-                    "Thread CPU timing is not supported on this virtual machine.");
+            //lm.01=Thread CPU timing is not supported on this virtual machine.
+            throw new UnsupportedOperationException(Messages.getString("lm.01")); //$NON-NLS-1$          
         }
 
         SecurityManager security = System.getSecurityManager();

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/ObjectInputStream.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/ObjectInputStream.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/ObjectInputStream.java Tue Aug 17 21:36:10 2010
@@ -117,6 +117,7 @@ public class ObjectInputStream extends I
         PRIMITIVE_CLASSES.put("char", char.class); //$NON-NLS-1$
         PRIMITIVE_CLASSES.put("float", float.class); //$NON-NLS-1$
         PRIMITIVE_CLASSES.put("double", double.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("void", void.class); //$NON-NLS-1$
     }
 
     private ObjectAccessor accessor = AccessorFactory.getObjectAccessor();

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/OutputStreamWriter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/OutputStreamWriter.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/OutputStreamWriter.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/OutputStreamWriter.java Tue Aug 17 21:36:10 2010
@@ -47,6 +47,8 @@ public class OutputStreamWriter extends 
 
     private ByteBuffer bytes = ByteBuffer.allocate(8192);
 
+    private boolean encoderFlush = false;
+
     /**
      * Constructs a new OutputStreamWriter using {@code out} as the target
      * stream to write converted characters to. The default character encoding
@@ -147,7 +149,18 @@ public class OutputStreamWriter extends 
     public void close() throws IOException {
         synchronized (lock) {
             if (encoder != null) {
-                encoder.flush(bytes);
+                if (encoderFlush) {
+                    CoderResult result = encoder.flush(bytes);
+                    while (!result.isUnderflow()) {
+                        if (result.isOverflow()) {
+                            flush();
+                            result = encoder.flush(bytes);
+                        } else {
+                            result.throwException();
+                        }
+                    }
+                }
+
                 flush();
                 out.flush();
                 out.close();
@@ -234,6 +247,7 @@ public class OutputStreamWriter extends 
 
     private void convert(CharBuffer chars) throws IOException {
         CoderResult result = encoder.encode(chars, bytes, true);
+        encoderFlush = true;
         while (true) {
             if (result.isError()) {
                 throw new IOException(result.toString());

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/PipedOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/PipedOutputStream.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/PipedOutputStream.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/PipedOutputStream.java Tue Aug 17 21:36:10 2010
@@ -145,10 +145,6 @@ public class PipedOutputStream extends O
      */
     @Override
     public void write(byte buffer[], int offset, int count) throws IOException {
-        if (dest == null) {
-            // luni.D1=Pipe Not Connected
-            throw new IOException(Messages.getString("luni.D1")); //$NON-NLS-1$
-        }
         super.write(buffer, offset, count);
     }
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/ArrayList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/ArrayList.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/ArrayList.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/ArrayList.java Tue Aug 17 21:36:10 2010
@@ -40,7 +40,7 @@ public class ArrayList<E> extends Abstra
 
     private transient int firstIndex;
 
-    private transient int lastIndex;
+    private transient int size;
 
     private transient E[] array;
 
@@ -62,14 +62,14 @@ public class ArrayList<E> extends Abstra
         if (capacity < 0) {
             throw new IllegalArgumentException();
         }
-        firstIndex = lastIndex = 0;
+        firstIndex = size = 0;
         array = newElementArray(capacity);
     }
 
     /**
      * Constructs a new instance of {@code ArrayList} containing the elements of
      * the specified collection. The initial size of the {@code ArrayList} will
-     * be 10% higher than the size of the specified collection.
+     * be 10% larger than the size of the specified collection.
      * 
      * @param collection
      *            the collection of elements to add.
@@ -77,10 +77,13 @@ public class ArrayList<E> extends Abstra
     public ArrayList(Collection<? extends E> collection) {
         firstIndex = 0;
         Object[] objects = collection.toArray();
-        int size = objects.length;
+        size = objects.length;
+
+        // REVIEW: Created 2 array copies of the original collection here
+        //         Could be better to use the collection iterator and
+        //         copy once?
         array = newElementArray(size + (size / 10));
         System.arraycopy(objects, 0, array, 0, size);
-        lastIndex = size;
         modCount = 1;
     }
 
@@ -104,39 +107,39 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public void add(int location, E object) {
-        int size = lastIndex - firstIndex;
-        if (0 < location && location < size) {
-            if (firstIndex == 0 && lastIndex == array.length) {
+        if (location < 0 || location > size) {
+            throw new IndexOutOfBoundsException(
+                    // luni.0A=Index: {0}, Size: {1}
+                    Messages.getString("luni.0A", //$NON-NLS-1$
+                            Integer.valueOf(location),
+                            Integer.valueOf(size)));
+        }
+        if (location == 0) {
+            if (firstIndex == 0) {
+                growAtFront(1);
+            }
+            array[--firstIndex] = object;
+        } else if (location == size) {
+            if (firstIndex + size == array.length) {
+                growAtEnd(1);
+            }
+            array[firstIndex + size] = object;
+        } else { // must be case: (0 < location && location < size)
+            if (size == array.length) {
                 growForInsert(location, 1);
-            } else if ((location < size / 2 && firstIndex > 0)
-                    || lastIndex == array.length) {
+            } else if (firstIndex + size == array.length
+                    || (firstIndex > 0 && location < size / 2)) {
                 System.arraycopy(array, firstIndex, array, --firstIndex,
                         location);
             } else {
                 int index = location + firstIndex;
                 System.arraycopy(array, index, array, index + 1, size
                         - location);
-                lastIndex++;
             }
             array[location + firstIndex] = object;
-        } else if (location == 0) {
-            if (firstIndex == 0) {
-                growAtFront(1);
-            }
-            array[--firstIndex] = object;
-        } else if (location == size) {
-            if (lastIndex == array.length) {
-                growAtEnd(1);
-            }
-            array[lastIndex++] = object;
-        } else {
-            throw new IndexOutOfBoundsException(
-                    // luni.0A=Index: {0}, Size: {1}
-                    Messages.getString("luni.0A", //$NON-NLS-1$
-                            Integer.valueOf(location),
-                            Integer.valueOf(lastIndex - firstIndex)));
         }
 
+        size++;
         modCount++;
     }
 
@@ -149,10 +152,11 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public boolean add(E object) {
-        if (lastIndex == array.length) {
+        if (firstIndex + size == array.length) {
             growAtEnd(1);
         }
-        array[lastIndex++] = object;
+        array[firstIndex + size] = object;
+        size++;
         modCount++;
         return true;
     }
@@ -173,34 +177,39 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public boolean addAll(int location, Collection<? extends E> collection) {
-        int size = lastIndex - firstIndex;
         if (location < 0 || location > size) {
             throw new IndexOutOfBoundsException(
                     // luni.0A=Index: {0}, Size: {1}
                     Messages.getString("luni.0A", //$NON-NLS-1$
                             Integer.valueOf(location),
-                            Integer.valueOf(lastIndex - firstIndex)));
-        }
-        if (this == collection) {
-            collection = (ArrayList)clone();
+                            Integer.valueOf(size)));
         }
+
         Object[] dumparray = collection.toArray();
         int growSize = dumparray.length;
+        // REVIEW: Why do this check here rather than check
+        //         collection.size() earlier? RI behaviour?
         if (growSize == 0) {
             return false;
         }
 
-        if (0 < location && location < size) {
+        if (location == 0) {
+            growAtFront(growSize);
+            firstIndex -= growSize;
+        } else if (location == size) {
+            if (firstIndex + size > array.length - growSize) {
+                growAtEnd(growSize);
+            }
+        } else { // must be case: (0 < location && location < size)
             if (array.length - size < growSize) {
                 growForInsert(location, growSize);
-            } else if ((location < size / 2 && firstIndex > 0)
-                    || lastIndex > array.length - growSize) {
+            } else if (firstIndex + size > array.length - growSize
+                       || (firstIndex > 0 && location < size / 2)) {
                 int newFirst = firstIndex - growSize;
                 if (newFirst < 0) {
                     int index = location + firstIndex;
                     System.arraycopy(array, index, array, index - newFirst,
                             size - location);
-                    lastIndex -= newFirst;
                     newFirst = 0;
                 }
                 System.arraycopy(array, firstIndex, array, newFirst, location);
@@ -209,20 +218,12 @@ public class ArrayList<E> extends Abstra
                 int index = location + firstIndex;
                 System.arraycopy(array, index, array, index + growSize, size
                         - location);
-                lastIndex += growSize;
-            }
-        } else if (location == 0) {
-            growAtFront(growSize);
-            firstIndex -= growSize;
-        } else if (location == size) {
-            if (lastIndex > array.length - growSize) {
-                growAtEnd(growSize);
             }
-            lastIndex += growSize;
         }
 
         System.arraycopy(dumparray, 0, this.array, location + firstIndex,
                 growSize);
+        size += growSize;
         modCount++;
         return true;
     }
@@ -241,11 +242,12 @@ public class ArrayList<E> extends Abstra
         if (dumpArray.length == 0) {
             return false;
         }
-        if (dumpArray.length > array.length - lastIndex) {
+        if (dumpArray.length > array.length - (firstIndex + size)) {
             growAtEnd(dumpArray.length);
         }
-        System.arraycopy(dumpArray, 0, this.array, lastIndex, dumpArray.length);
-        lastIndex += dumpArray.length;
+        System.arraycopy(dumpArray, 0, this.array, firstIndex + size,
+                         dumpArray.length);
+        size += dumpArray.length;
         modCount++;
         return true;
     }
@@ -258,9 +260,14 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public void clear() {
-        if (firstIndex != lastIndex) {
-            Arrays.fill(array, firstIndex, lastIndex, null);
-            firstIndex = lastIndex = 0;
+        if (size != 0) {
+            // REVIEW: Should we use Arrays.fill() instead of just
+            //         allocating a new array?  Should we use the same
+            //         sized array?
+            Arrays.fill(array, firstIndex, firstIndex + size, null);
+            // REVIEW: Should the indexes point into the middle of the
+            //         array rather than 0?
+            firstIndex = size = 0;
             modCount++;
         }
     }
@@ -294,6 +301,7 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public boolean contains(Object object) {
+        int lastIndex = firstIndex + size;
         if (object != null) {
             for (int i = firstIndex; i < lastIndex; i++) {
                 if (object.equals(array[i])) {
@@ -318,39 +326,45 @@ public class ArrayList<E> extends Abstra
      *            the minimum capacity asked for.
      */
     public void ensureCapacity(int minimumCapacity) {
-        if (array.length < minimumCapacity) {
+        int required = minimumCapacity - array.length;
+        if (required > 0) {
+            // REVIEW: Why do we check the firstIndex first? Growing
+            //         the end makes more sense
             if (firstIndex > 0) {
-                growAtFront(minimumCapacity - array.length);
+                growAtFront(required);
             } else {
-                growAtEnd(minimumCapacity - array.length);
+                growAtEnd(required);
             }
         }
     }
 
     @Override
     public E get(int location) {
-        if (0 <= location && location < (lastIndex - firstIndex)) {
-            return array[firstIndex + location];
-        }
-        throw new IndexOutOfBoundsException(
+        if (location < 0 || location >= size) {
+            throw new IndexOutOfBoundsException(
                 // luni.0A=Index: {0}, Size: {1}
                 Messages.getString("luni.0A", //$NON-NLS-1$
                         Integer.valueOf(location),
-                        Integer.valueOf(lastIndex - firstIndex)));
+                        Integer.valueOf(size)));
+        }
+        return array[firstIndex + location];
     }
 
     private void growAtEnd(int required) {
-        int size = lastIndex - firstIndex;
-        if (firstIndex >= required - (array.length - lastIndex)) {
-            int newLast = lastIndex - firstIndex;
-            if (size > 0) {
+        if (array.length - size >= required) {
+            // REVIEW: as growAtEnd, why not move size == 0 out as
+            //         special case
+            if (size != 0) {
                 System.arraycopy(array, firstIndex, array, 0, size);
-                int start = newLast < firstIndex ? firstIndex : newLast;
+                int start = size < firstIndex ? firstIndex : size;
+                // REVIEW: I think we null too much
+                //         array.length should be lastIndex ?
                 Arrays.fill(array, start, array.length, null);
             }
             firstIndex = 0;
-            lastIndex = newLast;
         } else {
+            // REVIEW: If size is 0?
+            //         Does size/2 seems a little high!
             int increment = size / 2;
             if (required > increment) {
                 increment = required;
@@ -359,27 +373,26 @@ public class ArrayList<E> extends Abstra
                 increment = 12;
             }
             E[] newArray = newElementArray(size + increment);
-            if (size > 0) {
+            if (size != 0) {
                 System.arraycopy(array, firstIndex, newArray, 0, size);
                 firstIndex = 0;
-                lastIndex = size;
             }
             array = newArray;
         }
     }
 
     private void growAtFront(int required) {
-        int size = lastIndex - firstIndex;
-        if (array.length - lastIndex + firstIndex >= required) {
+        if (array.length - size >= required) {
             int newFirst = array.length - size;
-            if (size > 0) {
+            // REVIEW: as growAtEnd, why not move size == 0 out as
+            //         special case
+            if (size != 0) {
                 System.arraycopy(array, firstIndex, array, newFirst, size);
-                int length = firstIndex + size > newFirst ? newFirst
-                        : firstIndex + size;
+                int lastIndex = firstIndex + size;
+                int length = lastIndex > newFirst ? newFirst : lastIndex;
                 Arrays.fill(array, firstIndex, length, null);
             }
             firstIndex = newFirst;
-            lastIndex = array.length;
         } else {
             int increment = size / 2;
             if (required > increment) {
@@ -389,18 +402,18 @@ public class ArrayList<E> extends Abstra
                 increment = 12;
             }
             E[] newArray = newElementArray(size + increment);
-            if (size > 0) {
-                System.arraycopy(array, firstIndex, newArray, newArray.length
-                        - size, size);
+            if (size != 0) {
+                System.arraycopy(array, firstIndex, newArray, increment, size);
             }
             firstIndex = newArray.length - size;
-            lastIndex = newArray.length;
             array = newArray;
         }
     }
 
     private void growForInsert(int location, int required) {
-        int size = lastIndex - firstIndex;
+        // REVIEW: we grow too quickly because we are called with the
+        //         size of the new collection to add without taking in
+        //         to account the free space we already have
         int increment = size / 2;
         if (required > increment) {
             increment = required;
@@ -409,6 +422,8 @@ public class ArrayList<E> extends Abstra
             increment = 12;
         }
         E[] newArray = newElementArray(size + increment);
+        // REVIEW: biased towards leaving space at the beginning?
+        //         perhaps newFirst should be (increment-required)/2?
         int newFirst = increment - required;
         // Copy elements after location to the new array skipping inserted
         // elements
@@ -417,13 +432,13 @@ public class ArrayList<E> extends Abstra
         // Copy elements before location to the new array from firstIndex
         System.arraycopy(array, firstIndex, newArray, newFirst, location);
         firstIndex = newFirst;
-        lastIndex = size + increment;
-
         array = newArray;
     }
 
     @Override
     public int indexOf(Object object) {
+        // REVIEW: should contains call this method?
+        int lastIndex = firstIndex + size;
         if (object != null) {
             for (int i = firstIndex; i < lastIndex; i++) {
                 if (object.equals(array[i])) {
@@ -442,11 +457,12 @@ public class ArrayList<E> extends Abstra
 
     @Override
     public boolean isEmpty() {
-        return lastIndex == firstIndex;
+        return size == 0;
     }
 
     @Override
     public int lastIndexOf(Object object) {
+        int lastIndex = firstIndex + size;
         if (object != null) {
             for (int i = lastIndex - 1; i >= firstIndex; i--) {
                 if (object.equals(array[i])) {
@@ -475,36 +491,39 @@ public class ArrayList<E> extends Abstra
     @Override
     public E remove(int location) {
         E result;
-        int size = lastIndex - firstIndex;
-        if (0 <= location && location < size) {
-            if (location == size - 1) {
-                result = array[--lastIndex];
-                array[lastIndex] = null;
-            } else if (location == 0) {
-                result = array[firstIndex];
-                array[firstIndex++] = null;
-            } else {
-                int elementIndex = firstIndex + location;
-                result = array[elementIndex];
-                if (location < size / 2) {
-                    System.arraycopy(array, firstIndex, array, firstIndex + 1,
-                            location);
-                    array[firstIndex++] = null;
-                } else {
-                    System.arraycopy(array, elementIndex + 1, array,
-                            elementIndex, size - location - 1);
-                    array[--lastIndex] = null;
-                }
-            }
-            if (firstIndex == lastIndex) {
-                firstIndex = lastIndex = 0;
-            }
-        } else {
+        if (location < 0 || location >= size) {
             throw new IndexOutOfBoundsException(
                     // luni.0A=Index: {0}, Size: {1}
                     Messages.getString("luni.0A", //$NON-NLS-1$
                             Integer.valueOf(location),
-                            Integer.valueOf(lastIndex - firstIndex)));
+                            Integer.valueOf(size)));
+        }
+        if (location == 0) {
+            result = array[firstIndex];
+            array[firstIndex++] = null;
+        } else if (location == size - 1) {
+            int lastIndex = firstIndex + size - 1;
+            result = array[lastIndex];
+            array[lastIndex] = null;
+        } else {
+            int elementIndex = firstIndex + location;
+            result = array[elementIndex];
+            if (location < size / 2) {
+                System.arraycopy(array, firstIndex, array, firstIndex + 1,
+                                 location);
+                array[firstIndex++] = null;
+            } else {
+                System.arraycopy(array, elementIndex + 1, array,
+                                 elementIndex, size - location - 1);
+                array[firstIndex+size-1] = null;
+            }
+        }
+        size--;
+
+        // REVIEW: we can move this to the first if case since it
+        //         can only occur when size==1
+        if (size == 0) {
+            firstIndex = 0;
         }
 
         modCount++;
@@ -534,31 +553,44 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     protected void removeRange(int start, int end) {
-        if (start >= 0 && start <= end && end <= (lastIndex - firstIndex)) {
-            if (start == end) {
-                return;
-            }
-            int size = lastIndex - firstIndex;
-            if (end == size) {
-                Arrays.fill(array, firstIndex + start, lastIndex, null);
-                lastIndex = firstIndex + start;
-            } else if (start == 0) {
-                Arrays.fill(array, firstIndex, firstIndex + end, null);
-                firstIndex += end;
-            } else {
-                System.arraycopy(array, firstIndex + end, array, firstIndex
-                        + start, size - end);
-                int newLast = lastIndex + start - end;
-                Arrays.fill(array, newLast, lastIndex, null);
-                lastIndex = newLast;
-            }
-            modCount++;
-        } else {
+        // REVIEW: does RI call this from remove(location)
+        if (start < 0) {
+            // REVIEW: message should indicate which index is out of range
             throw new IndexOutOfBoundsException(
                     // luni.0B=Array index out of range: {0}
                     Messages.getString("luni.0B", //$NON-NLS-1$
-                            lastIndex - firstIndex - end));
+                                       Integer.valueOf(start)));
+        } else if (end > size) {
+            // REVIEW: message should indicate which index is out of range
+            throw new IndexOutOfBoundsException(
+                    // luni.0A=Index: {0}, Size: {1}
+                    Messages.getString("luni.0A", //$NON-NLS-1$
+                               Integer.valueOf(end), Integer.valueOf(size)));
+        } else if (start > end) {
+            throw new IndexOutOfBoundsException(
+                    // luni.35=Start index ({0}) is greater than end index ({1})
+                    Messages.getString("luni.35", //$NON-NLS-1$
+                               Integer.valueOf(start), Integer.valueOf(end)));
+        }
+
+        if (start == end) {
+            return;
+        }
+        if (end == size) {
+            Arrays.fill(array, firstIndex + start, firstIndex + size, null);
+        } else if (start == 0) {
+            Arrays.fill(array, firstIndex, firstIndex + end, null);
+            firstIndex += end;
+        } else {
+            // REVIEW: should this optimize to do the smallest copy?
+            System.arraycopy(array, firstIndex + end, array, firstIndex
+                             + start, size - end);
+            int lastIndex = firstIndex + size;
+            int newLast = lastIndex + start - end;
+            Arrays.fill(array, newLast, lastIndex, null);
         }
+        size -= end - start;
+        modCount++;
     }
 
     /**
@@ -575,16 +607,16 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public E set(int location, E object) {
-        if (0 <= location && location < (lastIndex - firstIndex)) {
-            E result = array[firstIndex + location];
-            array[firstIndex + location] = object;
-            return result;
+        if (location < 0 || location >= size) {
+            throw new IndexOutOfBoundsException(
+                    // luni.0A=Index: {0}, Size: {1}
+                    Messages.getString("luni.0A", //$NON-NLS-1$
+                            Integer.valueOf(location),
+                            Integer.valueOf(size)));
         }
-        throw new IndexOutOfBoundsException(
-                // luni.0A=Index: {0}, Size: {1}
-                Messages.getString("luni.0A", //$NON-NLS-1$
-                        Integer.valueOf(location),
-                        Integer.valueOf(lastIndex - firstIndex)));
+        E result = array[firstIndex + location];
+        array[firstIndex + location] = object;
+        return result;
     }
 
     /**
@@ -594,7 +626,7 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public int size() {
-        return lastIndex - firstIndex;
+        return size;
     }
 
     /**
@@ -605,7 +637,6 @@ public class ArrayList<E> extends Abstra
      */
     @Override
     public Object[] toArray() {
-        int size = lastIndex - firstIndex;
         Object[] result = new Object[size];
         System.arraycopy(array, firstIndex, result, 0, size);
         return result;
@@ -629,13 +660,14 @@ public class ArrayList<E> extends Abstra
     @Override
     @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] contents) {
-        int size = lastIndex - firstIndex;
         if (size > contents.length) {
             Class<?> ct = contents.getClass().getComponentType();
             contents = (T[]) Array.newInstance(ct, size);
         }
         System.arraycopy(array, firstIndex, contents, 0, size);
         if (size < contents.length) {
+            // REVIEW: do we use this incorrectly - i.e. do we null
+            //         the rest out?
             contents[size] = null;
         }
         return contents;
@@ -648,12 +680,10 @@ public class ArrayList<E> extends Abstra
      * @see #size
      */
     public void trimToSize() {
-        int size = lastIndex - firstIndex;
         E[] newArray = newElementArray(size);
         System.arraycopy(array, firstIndex, newArray, 0, size);
         array = newArray;
         firstIndex = 0;
-        lastIndex = array.length;
         modCount = 0;
     }
 
@@ -662,7 +692,7 @@ public class ArrayList<E> extends Abstra
 
     private void writeObject(ObjectOutputStream stream) throws IOException {
         ObjectOutputStream.PutField fields = stream.putFields();
-        fields.put("size", lastIndex - firstIndex); //$NON-NLS-1$
+        fields.put("size", size); //$NON-NLS-1$
         stream.writeFields();
         stream.writeInt(array.length);
         Iterator<?> it = iterator();
@@ -675,9 +705,9 @@ public class ArrayList<E> extends Abstra
     private void readObject(ObjectInputStream stream) throws IOException,
             ClassNotFoundException {
         ObjectInputStream.GetField fields = stream.readFields();
-        lastIndex = fields.get("size", 0); //$NON-NLS-1$
+        size = fields.get("size", 0); //$NON-NLS-1$
         array = newElementArray(stream.readInt());
-        for (int i = 0; i < lastIndex; i++) {
+        for (int i = 0; i < size; i++) {
             array[i] = (E) stream.readObject();
         }
     }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/PriorityQueue.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/PriorityQueue.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/PriorityQueue.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/PriorityQueue.java Tue Aug 17 21:36:10 2010
@@ -239,22 +239,17 @@ public class PriorityQueue<E> extends Ab
      *         was not in the priority queue.
      */
     @Override
-    @SuppressWarnings("unchecked")
     public boolean remove(Object o) {
-        if (o == null) {
+        if (o == null || size == 0) {
             return false;
         }
-        int targetIndex;
-        for (targetIndex = 0; targetIndex < size; targetIndex++) {
-            if (0 == this.compare((E) o, elements[targetIndex])) {
-                break;
+        for (int i = 0; i < size; i++) {
+            if (o.equals(elements[i])) {
+                removeAt(i);
+                return true;
             }
         }
-        if (size == 0 || size == targetIndex) {
-            return false;
-        }
-        removeAt(targetIndex);
-        return true;
+        return false;
     }
 
     /**

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c Tue Aug 17 21:36:10 2010
@@ -131,7 +131,6 @@ JNI_OnLoad (JavaVM * vm, void *reserved)
        /* set other (not required by api specification) properties */
        (*vmInterface)->GetSystemProperty (vmInterface, "user.language", &propVal);
        if (propVal == NULL) {
-            /* FIXME provide appropriate non-dummy value */
            propRes = (*vmInterface)->SetSystemProperty (vmInterface, "user.language", (char *)hynls_get_language());
            if (VMI_ERROR_NONE != propRes) {
                /* goto fail2; */
@@ -139,7 +138,6 @@ JNI_OnLoad (JavaVM * vm, void *reserved)
        }
        (*vmInterface)->GetSystemProperty (vmInterface, "user.country", &propVal);
        if (propVal == NULL) {
-           /* FIXME provide appropriate non-dummy value */
            propRes = (*vmInterface)->SetSystemProperty (vmInterface, "user.country", (char *)hynls_get_region());
            if (VMI_ERROR_NONE != propRes) {
                /* goto fail2; */

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Tue Aug 17 21:36:10 2010
@@ -802,8 +802,7 @@ Java_org_apache_harmony_luni_platform_OS
   result = writev(SOCKET_CAST (socketP), vect, length);
 
   if (0 > result) {
-    /* TOFIX? man write(2) on linux implies we should check EWOULDBLOCK too */
-    if (errno != EAGAIN) {
+    if (errno != EAGAIN && errno != EWOULDBLOCK) {
       throwJavaNetSocketException(env, result);
     }
     result = 0;

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c Tue Aug 17 21:36:10 2010
@@ -448,7 +448,7 @@ Java_org_apache_harmony_luni_platform_OS
   jlong result = 0;
   LPWSABUF vect;
   int i;
-  jint sentBytes;
+  jint sentBytes = 0;
   jint rc;
   jclass byteBufferClass;
 
@@ -521,7 +521,9 @@ Java_org_apache_harmony_luni_platform_OS
 
   if (SOCKET_ERROR == result) {
     rc = WSAGetLastError ();
-    throwJavaNetSocketException(env, rc);
+    if (rc != WSATRY_AGAIN && rc != WSAEWOULDBLOCK) {
+        throwJavaNetSocketException(env, rc);
+    }
     result = 0;
   }
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedWriterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedWriterTest.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedWriterTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedWriterTest.java Tue Aug 17 21:36:10 2010
@@ -18,7 +18,9 @@
 package org.apache.harmony.luni.tests.java.io;
 
 import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.io.Writer;
 
 import tests.support.Support_StringWriter;
@@ -103,6 +105,16 @@ public class BufferedWriterTest extends 
         assertEquals("BufferdWriter do not flush itself before close", "a", mw
                 .getWritten());
     }
+    
+    /**
+     * @throws IOException 
+     * @tests java.io.BufferedWriter#close()
+     *
+     */
+    public void test_close2() throws IOException {
+        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new ByteArrayOutputStream()));
+            bw.close();
+    }
 
     /**
      * @tests java.io.BufferedWriter#flush()

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java Tue Aug 17 21:36:10 2010
@@ -1215,7 +1215,8 @@ class Test implements Serializable {
 	private static final long serialVersionUID = 1L;
 
 	Class classes[] = new Class[] { byte.class, short.class, int.class,
-			long.class, boolean.class, char.class, float.class, double.class };
+			long.class, boolean.class, char.class, float.class,
+                        double.class, void.class };
 
 	@Override
     public boolean equals(Object o) {

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedOutputStreamTest.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedOutputStreamTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedOutputStreamTest.java Tue Aug 17 21:36:10 2010
@@ -183,6 +183,30 @@ public class PipedOutputStreamTest exten
         } catch (NullPointerException e) {
             // expected
         }
+
+        pis = new PipedInputStream();
+        pos = new PipedOutputStream(pis);
+        pos.close();
+        pos.write(new byte[0], 0, 0);
+
+        try {
+            pis = new PipedInputStream();
+            pos = new PipedOutputStream(pis);
+            pos.write(new byte[0], -1, 0);
+            fail("IndexOutOfBoundsException expected");
+        } catch (IndexOutOfBoundsException t) {
+            //expected
+        }
+
+        try {
+            pis = new PipedInputStream();
+            pos = new PipedOutputStream(pis);
+            pos.write(null, -10, 0);
+            fail("should throw NullPointerException.");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
     }
 
     /**

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PriorityQueueTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PriorityQueueTest.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PriorityQueueTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PriorityQueueTest.java Tue Aug 17 21:36:10 2010
@@ -133,7 +133,18 @@ public class PriorityQueueTest extends T
         for (int i = 0; i < integerQueue.size(); i++) {
             assertEquals(newArray[i], integerQueue.poll());
         }
+    }
 
+    public void test_iterator_removeEquals() {
+        PriorityQueue<String> integerQueue = new PriorityQueue<String>(10, new MockComparatorStringByLength());
+        String[] array = { "ONE", "TWO", "THREE", "FOUR", "FIVE" };
+        for (int i = 0; i < array.length; i++) {
+            integerQueue.offer(array[i]);
+        }
+        // Try removing an entry that the comparator says is equal
+        assertFalse(integerQueue.remove("123"));
+        assertFalse(integerQueue.remove("one"));
+        assertTrue(integerQueue.remove("THREE"));
     }
 
     /**
@@ -594,7 +605,7 @@ public class PriorityQueueTest extends T
             queue.offer(array[i]);
         }
         assertFalse(queue.contains("BB"));
-        assertTrue(queue.remove("BB"));
+        assertTrue(queue.remove("AA"));
     }
 
     /**
@@ -607,12 +618,7 @@ public class PriorityQueueTest extends T
         PriorityQueue<Integer> integerQueue = new PriorityQueue<Integer>(list);
         assertFalse(integerQueue.remove(111));
         assertFalse(integerQueue.remove(null));
-        try {
-            integerQueue.remove("");
-            fail("should throw ClassCastException");
-        } catch (ClassCastException e) {
-            // expected
-        }
+        assertFalse(integerQueue.remove(""));
     }
 
     /**
@@ -634,13 +640,8 @@ public class PriorityQueueTest extends T
         Integer[] array = { 2, 45, 7, -12, 9, 23, 17, 1118, 10, 16, 39 };
         List<Integer> list = Arrays.asList(array);
         PriorityQueue<Integer> integerQueue = new PriorityQueue<Integer>(list);
-        try {
-            integerQueue.remove(new Float(1.3F));
-            fail("should throw ClassCastException");
-        } catch (ClassCastException e) {
-            // expected
-        }
-
+        assertFalse(integerQueue.remove(new Float(1.3F)));
+ 
         // although argument element type is not compatible with those in queue,
         // but comparator supports it.
         MockComparator<Object> comparator = new MockComparator<Object>();
@@ -652,12 +653,7 @@ public class PriorityQueueTest extends T
         PriorityQueue<Object> queue = new PriorityQueue<Object>();
         Object o = new Object();
         queue.offer(o);
-        try {
-            queue.remove(o);
-            fail("should throw ClassCastException");
-        } catch (ClassCastException e) {
-            // expected
-        }
+        assertTrue(queue.remove(o));
     }
 
     /**

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/AddressUtil.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/AddressUtil.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/AddressUtil.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/AddressUtil.java Tue Aug 17 21:36:10 2010
@@ -19,10 +19,6 @@ package org.apache.harmony.nio;
 import java.io.FileDescriptor;
 import java.nio.Buffer;
 import java.nio.channels.Channel;
-import java.nio.channels.DatagramChannel;
-import java.nio.channels.FileChannel;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
 
 import org.apache.harmony.luni.platform.FileDescriptorHandler;
 import org.apache.harmony.nio.internal.DirectBuffer;

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java?rev=986497&r1=986496&r2=986497&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java Tue Aug 17 21:36:10 2010
@@ -416,6 +416,7 @@ class DatagramChannelImpl extends Datagr
                 }
             }
             source.position(oldposition + sendCount);
+            isBound = true;
             return sendCount;
         } finally {
             end(sendCount >= 0);



Mime
View raw message