harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r961356 - in /harmony/enhanced/java/branches/mrh: ./ classlib/ classlib/depends/build/platform/ classlib/modules/archive/src/main/native/zip/unix/ classlib/modules/awt/make/ classlib/modules/imageio/META-INF/ classlib/modules/imageio/make/ ...
Date Wed, 07 Jul 2010 12:23:45 GMT
Author: hindessm
Date: Wed Jul  7 12:23:44 2010
New Revision: 961356

URL: http://svn.apache.org/viewvc?rev=961356&view=rev
Log:
Merged changes from trunk@961314.

Added:
    harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java
      - copied unchanged from r961314, harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/lock386.c
      - copied unchanged from r961314, harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/thread/windows/lock386.c
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/windows.x86/locklbl.asm
      - copied unchanged from r961314, harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/thread/windows/windows.x86/locklbl.asm
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/windows.x86_64/locklbl.asm
      - copied unchanged from r961314, harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/thread/windows/windows.x86_64/locklbl.asm
Removed:
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/lock386.c
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/windows.x86/locklbl.asm
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/windows.x86_64/locklbl.asm
Modified:
    harmony/enhanced/java/branches/mrh/   (props changed)
    harmony/enhanced/java/branches/mrh/classlib/   (props changed)
    harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk
    harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk
    harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/main/native/zip/unix/makefile
    harmony/enhanced/java/branches/mrh/classlib/modules/awt/make/depends.properties
    harmony/enhanced/java/branches/mrh/classlib/modules/imageio/META-INF/MANIFEST.MF
    harmony/enhanced/java/branches/mrh/classlib/modules/imageio/make/depends.properties
    harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/build.xml
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/File.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URI.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLDecoder.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Properties.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/hyzip/unix/makefile
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
    harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/makefile
    harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/makefile
    harmony/enhanced/java/branches/mrh/common_resources/   (props changed)
    harmony/enhanced/java/branches/mrh/drlvm/   (props changed)
    harmony/enhanced/java/branches/mrh/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp
    harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/README.txt

Propchange: harmony/enhanced/java/branches/mrh/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 12:23:44 2010
@@ -1,2 +1,2 @@
 /harmony/enhanced/java/branches/mrh:935751
-/harmony/enhanced/java/trunk:935751-957748
+/harmony/enhanced/java/trunk:935751-961314

Propchange: harmony/enhanced/java/branches/mrh/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 12:23:44 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk:926318-926838
 /harmony/enhanced/java/branches/mrh/classlib:935751
-/harmony/enhanced/java/trunk/classlib:935751-957748
+/harmony/enhanced/java/trunk/classlib:935751-961314
 /harmony/enhanced/trunk/classlib:476395-926317

Modified: harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk (original)
+++ harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk Wed Jul  7 12:23:44 2010
@@ -52,3 +52,6 @@ HYDEBUGCFLAGS = -g -O0
 # On z/OS set DLLPATH to LIBPATH so we link against .x export files in
 # $(HY_HDK)/lib instead of directly against the .so libraries.
 DLLPATH=$(LIBPATH)
+
+# AR doesn't support the 'o' option on z/OS so mtime will be updated
+AREXTRACT= x

Modified: harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk (original)
+++ harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk Wed Jul  7 12:23:44 2010
@@ -52,3 +52,6 @@ HYDEBUGCFLAGS = -g -O0
 # On z/OS set DLLPATH to LIBPATH so we link against .x export files in
 # $(HY_HDK)/lib instead of directly against the .so libraries.
 DLLPATH=$(LIBPATH)
+
+# AR doesn't support the 'o' option on z/OS so mtime will be updated
+AREXTRACT= x

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/main/native/zip/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/main/native/zip/unix/makefile?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/main/native/zip/unix/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/main/native/zip/unix/makefile Wed Jul  7 12:23:44 2010
@@ -27,6 +27,6 @@ BUILDFILES = zcpool.o zipalloc.o zipcach
 LIBNAME = $(LIBPATH)libhyzip.a
 
 $(HY_BIN)%.o: $(LIBPATH)libhypool.a(%.o)
-	( cd $(HY_BIN) && ar $(ARFLAGS) xo $(LIBPATH)libhypool.a $@ )
+	( cd $(HY_BIN) && ar $(ARFLAGS) $(AREXTRACT) $(LIBPATH)libhypool.a $@ )
 
 include $(HY_TARGET)/hdk/build/make/rules.mk

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/awt/make/depends.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/awt/make/depends.properties?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/awt/make/depends.properties (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/awt/make/depends.properties Wed Jul  7 12:23:44 2010
@@ -38,10 +38,10 @@ lcms.url=${awt.base}/harmony-lcms-${lcms
 lcms.md5@x86@=48e8ce8481fcebdbb31cdebac38a0c05
 lcms.md5@x86_64@=d7dfc53649e352877e3eb6daad12c290
 
-png.ver=1.4.1
+png.ver=1.4.3
 png.dir=${depends.lib.dir}/libpng-${png.ver}
 png.testfile=${png.dir}/png.h
 png.tar=${depends.lib.dir}/harmony-libpng-${png.ver}.tar.gz
 png.url=${awt.base}/harmony-libpng-${png.ver}.tar.gz
-png.md5@x86@=c1dda2d4e71557b6d901be921b77c761
-png.md5@x86_64@=083ff91fa54e4e354613785d6cae2f09
+png.md5@x86@=e52e01bc0bafa6c7cfef466b0333e39f
+png.md5@x86_64@=e16aa690c3f3eda4b6bdd9668c9cd32b

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/META-INF/MANIFEST.MF?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/META-INF/MANIFEST.MF Wed Jul  7 12:23:44 2010
@@ -18,6 +18,7 @@ Import-Package: java.awt,
  java.io,
  java.lang,
  java.lang.reflect,
+ java.math,
  java.net,
  java.nio,
  java.security,

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/make/depends.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/make/depends.properties?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/make/depends.properties (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/make/depends.properties Wed Jul  7 12:23:44 2010
@@ -24,10 +24,10 @@ jpeg.url=${awt.base}/harmony-jpeg-${jpeg
 jpeg.md5@x86@=84d69fb0eb5baca4e0dd36cf017dd6a6
 jpeg.md5@x86_64@=1c111660a0e8d048286ac645bd72c22c
 
-png.ver=1.4.1
+png.ver=1.4.3
 png.dir=${depends.lib.dir}/libpng-${png.ver}
 png.testfile=${png.dir}/png.h
 png.tar=${depends.lib.dir}/harmony-libpng-${png.ver}.tar.gz
 png.url=${awt.base}/harmony-libpng-${png.ver}.tar.gz
-png.md5@x86@=c1dda2d4e71557b6d901be921b77c761
-png.md5@x86_64@=083ff91fa54e4e354613785d6cae2f09
+png.md5@x86@=e52e01bc0bafa6c7cfef466b0333e39f
+png.md5@x86_64@=e16aa690c3f3eda4b6bdd9668c9cd32b

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java Wed Jul  7 12:23:44 2010
@@ -14,17 +14,25 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Rustem V. Rafikov
- */
+
 package javax.imageio;
 
+import java.awt.Point;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.BandedSampleModel;
+import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DataBuffer;
 import java.awt.image.DirectColorModel;
-import java.awt.image.SampleModel;
-import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.PixelInterleavedSampleModel;
+import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
-import java.awt.color.ColorSpace;
+import java.awt.image.SampleModel;
+import java.awt.image.WritableRaster;
+import java.util.Hashtable;
 
 import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.x.imageio.internal.nls.Messages;
@@ -72,9 +80,66 @@ public class ImageTypeSpecifier {
                                                        int[] bandOffsets,
                                                        int dataType,
                                                        boolean hasAlpha,
-                                                       boolean isAlphaPremultiplied) throws NotImplementedException {
-        // TODO: implement
-        throw new NotImplementedException();
+                                                       boolean isAlphaPremultiplied) {
+        if (colorSpace == null) {
+            throw new IllegalArgumentException();            
+        }
+        
+        if (bandOffsets == null) {
+            throw new IllegalArgumentException();
+        }
+        
+        if (dataType != DataBuffer.TYPE_BYTE &&
+            dataType != DataBuffer.TYPE_DOUBLE &&
+            dataType != DataBuffer.TYPE_FLOAT &&
+            dataType != DataBuffer.TYPE_INT &&
+            dataType != DataBuffer.TYPE_SHORT &&
+            dataType != DataBuffer.TYPE_USHORT) {
+            throw new IllegalArgumentException();
+        }
+        
+        int numComponents = colorSpace.getNumComponents();
+        if (hasAlpha) {
+            numComponents++;
+        }
+        if (bandOffsets.length != numComponents) {
+            throw new IllegalArgumentException();
+        }
+        
+        int transparency = hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
+        int[] bits = new int[numComponents];
+        
+        for (int i = 0; i < numComponents; i++) {
+            bits[i] = DataBuffer.getDataTypeSize(dataType);
+        }
+        
+        ColorModel colorModel = new ComponentColorModel(colorSpace, 
+                                                        bits, 
+                                                        hasAlpha, 
+                                                        isAlphaPremultiplied,
+                                                        transparency,
+                                                        dataType);
+        
+        int minBandOffset = bandOffsets[0];
+        int maxBandOffset = bandOffsets[0];
+        for (int i = 0; i < bandOffsets.length; i++) {
+            if (minBandOffset > bandOffsets[i]) {
+                minBandOffset = bandOffsets[i];
+            }
+            if (maxBandOffset < bandOffsets[i]) {
+                maxBandOffset = bandOffsets[i];
+            }
+        }
+        int pixelStride = maxBandOffset - minBandOffset + 1;
+        
+        SampleModel sampleModel = new PixelInterleavedSampleModel(dataType, 
+                                                                  1,
+                                                                  1,
+                                                                  pixelStride, 
+                                                                  pixelStride, 
+                                                                  bandOffsets);
+               
+        return new ImageTypeSpecifier(colorModel, sampleModel);
     }
 
 
@@ -83,34 +148,140 @@ public class ImageTypeSpecifier {
                                                   int[] bandOffsets,
                                                   int dataType,
                                                   boolean hasAlpha,
-                                                  boolean isAlphaPremultiplied) throws NotImplementedException {
-        // TODO: implement
-        throw new NotImplementedException();
+                                                  boolean isAlphaPremultiplied) {
+        if (colorSpace == null) {
+            throw new IllegalArgumentException();
+        }
+        
+        if (bankIndices == null) {
+            throw new IllegalArgumentException();
+        }
+        
+        if (bandOffsets == null) {
+            throw new IllegalArgumentException();
+        }
+        
+        if (bankIndices.length != bandOffsets.length) {
+            throw new IllegalArgumentException();
+        }
+        
+        int numComponents = colorSpace.getNumComponents();
+        if (hasAlpha) {
+            numComponents++;
+        }
+        if (bandOffsets.length != numComponents) {
+            throw new IllegalArgumentException();
+        }
+        
+        if (dataType != DataBuffer.TYPE_BYTE &&
+            dataType != DataBuffer.TYPE_DOUBLE &&
+            dataType != DataBuffer.TYPE_FLOAT &&
+            dataType != DataBuffer.TYPE_INT &&
+            dataType != DataBuffer.TYPE_SHORT &&
+            dataType != DataBuffer.TYPE_USHORT) {
+            throw new IllegalArgumentException();
+        }
+        
+        int[] bits = new int[numComponents];
+        for (int i = 0; i < numComponents; i++) {
+            bits[i] = DataBuffer.getDataTypeSize(dataType);
+        }
+        int transparency = hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
+        
+        ColorModel colorModel = new ComponentColorModel(colorSpace,
+                                                        bits,
+                                                        hasAlpha,
+                                                        isAlphaPremultiplied,
+                                                        transparency,
+                                                        dataType);
+        
+        SampleModel sampleModel = new BandedSampleModel(dataType,
+                                                        1,
+                                                        1,
+                                                        1,
+                                                        bankIndices,
+                                                        bandOffsets);
+        
+        return new ImageTypeSpecifier(colorModel, sampleModel);
     }
 
     public static ImageTypeSpecifier createGrayscale(int bits,
-                                                     int dataType,
-                                                     boolean isSigned) throws NotImplementedException {
-        // TODO: implement
-        throw new NotImplementedException();
+            int dataType,
+            boolean isSigned) {
+        return createGrayscale(bits, dataType, isSigned, false, false);
     }
 
     public static ImageTypeSpecifier createGrayscale(int bits,
-                                                     int dataType,
-                                                     boolean isSigned,
-                                                     boolean isAlphaPremultiplied) throws NotImplementedException {
-        // TODO: implement
-        throw new NotImplementedException();
+            int dataType,
+            boolean isSigned,
+            boolean isAlphaPremultiplied) {
+        return createGrayscale(bits, dataType, isSigned, true, isAlphaPremultiplied);
+    }
+
+    private static ImageTypeSpecifier createGrayscale(int bits,
+             int dataType,
+             boolean isSigned,
+             boolean hasAlpha,
+             boolean isAlphaPremultiplied) {
+
+        if ((bits != 1) && (bits != 2) && (bits != 4) && (bits != 8) && (bits != 16)) {
+            throw new IllegalArgumentException();
+        }
+
+        ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_GRAY);
+
+        int numComponent = hasAlpha ? 2 : 1;
+        int numBits[] = new int[numComponent];
+        numBits[0] = bits;
+        if (numComponent ==2) {
+            numBits[1] = bits;
+        }
+        int transparency = hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
+        ColorModel model = new ComponentColorModel(colorSpace, numBits, hasAlpha, isAlphaPremultiplied, transparency, dataType);
+
+        return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(1, 1));
     }
 
+
     public static ImageTypeSpecifier createIndexed(byte[] redLUT,
                                                    byte[] greenLUT,
                                                    byte[] blueLUT,
                                                    byte[] alphaLUT,
                                                    int bits,
-                                                   int dataType) throws NotImplementedException {
-        // TODO: implement
-        throw new NotImplementedException();
+                                                   int dataType) {
+       if ((redLUT == null) || (greenLUT == null) || blueLUT == null) {
+           throw new IllegalArgumentException();
+       }
+       
+       if ((bits != 1) && (bits != 2) && (bits != 4) && (bits != 8) && (bits != 16)) {
+           throw new IllegalArgumentException();
+       }
+       
+       int length = 1 << bits;
+       if ((redLUT.length != length) || (greenLUT.length != length) || (blueLUT.length != length) ||
+               (alphaLUT != null && alphaLUT.length != length)) {
+           throw new IllegalArgumentException();
+       }
+       
+       if ((dataType != DataBuffer.TYPE_BYTE) && (dataType != DataBuffer.TYPE_SHORT) &&
+               (dataType != DataBuffer.TYPE_USHORT) && (dataType != DataBuffer.TYPE_INT)) {
+           throw new IllegalArgumentException();
+       }
+       
+       if ((bits > 8 && dataType == DataBuffer.TYPE_BYTE) || 
+               (bits > 16 && dataType == DataBuffer.TYPE_INT)) {
+           throw new IllegalArgumentException();
+       }
+       
+       ColorModel model = null;
+       int size = redLUT.length;
+       if (alphaLUT == null) {
+           model = new IndexColorModel(bits, size, redLUT, greenLUT, blueLUT);
+       } else {
+           model = new IndexColorModel(bits, size, redLUT, greenLUT, blueLUT, alphaLUT);
+       }
+       
+       return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(1, 1));
     }
 
     public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType) throws NotImplementedException {
@@ -125,9 +296,9 @@ public class ImageTypeSpecifier {
         return new ImageTypeSpecifier(image);
     }
 
-    public int getBufferedImageType() throws NotImplementedException {
-        // TODO: implement
-        throw new NotImplementedException();
+    public int getBufferedImageType() {
+        BufferedImage bufferedImage = createBufferedImage(1, 1);
+        return bufferedImage.getType();
     }
 
     public int getNumComponents() {
@@ -151,7 +322,7 @@ public class ImageTypeSpecifier {
 
     public SampleModel getSampleModel(int width, int height) {
         if ((long)width*height > Integer.MAX_VALUE) {
-            throw new IllegalArgumentException(Messages.getString("imageio.28"));
+            throw new IllegalArgumentException(Messages.getString("imageio.28")); //$NON-NLS-1$
         }
         return sampleModel.createCompatibleSampleModel(width, height);
     }
@@ -160,9 +331,19 @@ public class ImageTypeSpecifier {
         return colorModel;
     }
 
-    public BufferedImage createBufferedImage(int width, int height) throws NotImplementedException {
-        // TODO: implement
-        throw new NotImplementedException();
+    public BufferedImage createBufferedImage(int width, int height) {
+        if (width <= 0 || height <= 0) {
+            throw new IllegalArgumentException();
+        }
+        
+        if ((long)width*height > Integer.MAX_VALUE) {
+            throw new IllegalArgumentException();
+        }
+        
+        SampleModel sm = sampleModel.createCompatibleSampleModel(width, height);
+        WritableRaster writableRaster = Raster.createWritableRaster(sm, new Point(0, 0)); 
+        
+        return new BufferedImage(colorModel, writableRaster, colorModel.isAlphaPremultiplied(), new Hashtable());
     }
 
     @Override

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/build.xml?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/build.xml (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/build.xml Wed Jul  7 12:23:44 2010
@@ -317,6 +317,9 @@
                     <pathelement location="src/test/api/${hy.os.family}" />
                 </src>
                 <include name="**/*.java" />
+                <classpath location="${hy.hdk}/build/test/jetty-6.0.0.jar" />
+                <classpath location="${hy.hdk}/build/test/jetty-util-6.0.0.jar" />
+                <classpath location="${hy.hdk}/build/test/servlet-api-2.5-6.0.0.jar" />
             </javac-elements>
         </compile-tests>
         <compile-tests description="${hy.module} impl tests"

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/File.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/File.java Wed Jul  7 12:23:44 2010
@@ -79,7 +79,14 @@ public class File implements Serializabl
     public static final String pathSeparator;
 
     /* Temp file counter */
-    private static int counter;
+    private static int counter = 0;
+
+    /* identify for differnt VM processes */
+    private static int counterBase = 0;
+
+    private static class TempFileLocker {};
+
+    private static TempFileLocker tempFileLocker = new TempFileLocker();
 
     private static boolean caseSensitive;
 
@@ -1300,13 +1307,20 @@ public class File implements Serializabl
     }
 
     private static File genTempFile(String prefix, String suffix, File directory) {
-        if (counter == 0) {
-            int newInt = new SecureRandom().nextInt();
-            counter = ((newInt / 65535) & 0xFFFF) + 0x2710;
+        int identify = 0;
+        synchronized (tempFileLocker) {
+            if (counter == 0) {
+                int newInt = new SecureRandom().nextInt();
+                counter = ((newInt / 65535) & 0xFFFF) + 0x2710;
+                counterBase = counter;
+            }
+            identify = counter++;
         }
+
         StringBuilder newName = new StringBuilder();
         newName.append(prefix);
-        newName.append(counter++);
+        newName.append(counterBase);
+        newName.append(identify);
         newName.append(suffix);
         return new File(directory, newName.toString());
     }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URI.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URI.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URI.java Wed Jul  7 12:23:44 2010
@@ -41,7 +41,7 @@ public final class URI implements Compar
 
     static final String someLegal = unreserved + punct;
 
-    static final String queryLegal =  unreserved + reserved + "\\";
+    static final String queryLegal = unreserved + reserved + "\\\""; //$NON-NLS-1$
     
     static final String allLegal = unreserved + reserved;
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLDecoder.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLDecoder.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLDecoder.java Wed Jul  7 12:23:44 2010
@@ -23,8 +23,10 @@ import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
+import java.security.AccessController;
 
 import org.apache.harmony.luni.internal.nls.Messages;
+import org.apache.harmony.luni.util.PriviAction;
 
 /**
  * This class is used to decode a string which is encoded in the {@code
@@ -53,8 +55,11 @@ public class URLDecoder {
 
         if (defaultCharset == null) {
             try {
-                defaultCharset = Charset.forName(
-                        System.getProperty("file.encoding")); //$NON-NLS-1$
+                String encoding = AccessController
+                    .doPrivileged(new PriviAction<String>("file.encoding")); //$NON-NLS-1$
+                if (encoding != null) {
+                    defaultCharset = Charset.forName(encoding);
+                }
             } catch (IllegalCharsetNameException e) {
                 // Ignored
             } catch (UnsupportedCharsetException e) {

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java Wed Jul  7 12:23:44 2010
@@ -399,17 +399,20 @@ public abstract class URLStreamHandler {
      *         otherwise.
      */
     protected boolean hostsEqual(URL url1, URL url2) {
-        String host1 = getHost(url1), host2 = getHost(url2);
-        if (host1 != null && host1.equalsIgnoreCase(host2)) {
-            return true;
-        }
-        // Compare host address if the host name is not equal.
+        // Compare by addresses if known.
         InetAddress address1 = getHostAddress(url1);
         InetAddress address2 = getHostAddress(url2);
-        if (address1 != null && address1.equals(address2)) {
+        if (address1 != null && address2 != null) {
+            return address1.equals(address2);
+        }
+
+        // Compare by name.
+        String host1 = getHost(url1);
+        String host2 = getHost(url2);
+        if (host1 == null && host2 == null) {
             return true;
         }
-        return false;
+        return host1 != null && host1.equalsIgnoreCase(host2);
     }
 
     /**
@@ -450,7 +453,7 @@ public abstract class URLStreamHandler {
     }
 
     /*
-     * If the URL host is empty while protocal is file, the host is regarded as
+     * If the URL host is empty while protocol is file, the host is regarded as
      * localhost.
      */
     private static String getHost(URL url) {

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Properties.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Properties.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Properties.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Properties.java Wed Jul  7 12:23:44 2010
@@ -25,6 +25,7 @@ import java.io.OutputStreamWriter;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.StringReader;
+import java.io.Writer;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
@@ -97,15 +98,15 @@ public class Properties extends Hashtabl
         defaults = properties;
     }
 
-    private void dumpString(StringBuilder buffer, String string, boolean key) {
-        int i = 0;
-        if (!key && i < string.length() && string.charAt(i) == ' ') {
+    private void dumpString(StringBuilder buffer, String string, boolean isKey) {
+        int index = 0, length = string.length();
+        if (!isKey && index < length && string.charAt(index) == ' ') {
             buffer.append("\\ "); //$NON-NLS-1$
-            i++;
+            index++;
         }
 
-        for (; i < string.length(); i++) {
-            char ch = string.charAt(i);
+        for (; index < length; index++) {
+            char ch = string.charAt(index);
             switch (ch) {
             case '\t':
                 buffer.append("\\t"); //$NON-NLS-1$
@@ -120,23 +121,33 @@ public class Properties extends Hashtabl
                 buffer.append("\\r"); //$NON-NLS-1$
                 break;
             default:
-                if ("\\#!=:".indexOf(ch) >= 0 || (key && ch == ' ')) {
+                if ("\\#!=:".indexOf(ch) >= 0 || (isKey && ch == ' ')) {
                     buffer.append('\\');
                 }
                 if (ch >= ' ' && ch <= '~') {
                     buffer.append(ch);
                 } else {
-                    String hex = Integer.toHexString(ch);
-                    buffer.append("\\u"); //$NON-NLS-1$
-                    for (int j = 0; j < 4 - hex.length(); j++) {
-                        buffer.append("0"); //$NON-NLS-1$
-                    }
-                    buffer.append(hex);
+                    buffer.append(toHexaDecimal(ch));
                 }
             }
         }
     }
 
+    private char[] toHexaDecimal(final int ch) {
+        char[] hexChars = { '\\', 'u', '0', '0', '0', '0' };
+        int hexChar, index = hexChars.length, copyOfCh = ch;
+        do {
+            hexChar = copyOfCh & 15;
+            if (hexChar > 9) {
+                hexChar = hexChar - 10 + 'A';
+            } else {
+                hexChar += '0';
+            }
+            hexChars[--index] = (char) hexChar;
+        } while ((copyOfCh >>>= 4) != 0);
+        return hexChars;
+    }
+
     /**
      * Searches for the property with the specified name. If the property is not
      * found, the default {@code Properties} are checked. If the property is not
@@ -412,7 +423,7 @@ public class Properties extends Hashtabl
                     }
                     break;
                 }
-                if (Character.isWhitespace(nextChar)) {
+                if (nextChar < 256 && Character.isWhitespace(nextChar)) {
                     if (mode == CONTINUE) {
                         mode = IGNORE;
                     }
@@ -504,36 +515,36 @@ public class Properties extends Hashtabl
     private static String lineSeparator;
 
     /**
-     * Stores the mappings in this {@code Properties} to the specified {@code
-     * OutputStream}, putting the specified comment at the beginning. The output
-     * from this method is suitable for being read by the
+     * Stores the mappings in this {@code Properties} to the specified
+     * {@code OutputStream}, putting the specified comment at the beginning. The
+     * output from this method is suitable for being read by the
      * {@link #load(InputStream)} method.
      * 
-     * @param out the {@code OutputStream} to write to.
-     * @param comment the comment to put at the beginning.
-     * @throws IOException if an error occurs during the write to the {@code
-     *             OutputStream}.
-     * @throws ClassCastException if the key or value of a mapping is not a
-     *                {@code String}.
+     * @param out
+     *            the {@code OutputStream} to write to.
+     * @param comments
+     *            the comments to put at the beginning.
+     * @throws IOException
+     *             if an error occurs during the write to the
+     *             {@code OutputStream}.
+     * @throws ClassCastException
+     *             if the key or value of a mapping is not a {@code String}.
      */
-    public synchronized void store(OutputStream out, String comment)
+    public synchronized void store(OutputStream out, String comments)
             throws IOException {
         if (lineSeparator == null) {
             lineSeparator = AccessController
                     .doPrivileged(new PriviAction<String>("line.separator")); //$NON-NLS-1$
         }
-
-        StringBuilder buffer = new StringBuilder(200);
         OutputStreamWriter writer = new OutputStreamWriter(out, "ISO8859_1"); //$NON-NLS-1$
-        if (comment != null) {
-            writer.write("#"); //$NON-NLS-1$
-            writer.write(comment);
-            writer.write(lineSeparator);
+        if (comments != null) {
+            writeComments(writer, comments);
         }
-        writer.write("#"); //$NON-NLS-1$
+        writer.write('#');
         writer.write(new Date().toString());
         writer.write(lineSeparator);
 
+        StringBuilder buffer = new StringBuilder(200);
         for (Map.Entry<Object, Object> entry : entrySet()) {
             String key = (String) entry.getKey();
             dumpString(buffer, key, true);
@@ -546,6 +557,32 @@ public class Properties extends Hashtabl
         writer.flush();
     }
 
+    private void writeComments(Writer writer, String comments)
+            throws IOException {
+        writer.write('#');
+        char[] chars = comments.toCharArray();
+        for (int index = 0; index < chars.length; index++) {
+            if (chars[index] == '\r' || chars[index] == '\n') {
+                int indexPlusOne = index + 1;
+                if (chars[index] == '\r' && indexPlusOne < chars.length
+                        && chars[indexPlusOne] == '\n') {
+                    // "\r\n"
+                    continue;
+                }
+                writer.write(lineSeparator);
+                if (indexPlusOne < chars.length
+                        && (chars[indexPlusOne] == '#' || chars[indexPlusOne] == '!')) {
+                    // return char with either '#' or '!' afterward
+                    continue;
+                }
+                writer.write('#');
+            } else {
+                writer.write(chars[index]);
+            }
+        }
+        writer.write(lineSeparator);
+    }
+
     /**
      * Loads the properties from an {@code InputStream} containing the
      * properties in XML form. The XML document must begin with (and conform to)

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java Wed Jul  7 12:23:44 2010
@@ -1414,8 +1414,7 @@ public class HttpURLConnectionImpl exten
                 // keep asking for username/password until authorized
                 String challenge = resHeader.get("WWW-Authenticate"); //$NON-NLS-1$
                 if (challenge == null) {
-                    // luni.2E=Received authentication challenge is null
-                    throw new IOException(Messages.getString("luni.2E")); //$NON-NLS-1$
+                    break;
                 }
                 // drop everything and reconnect, might not be required for
                 // HTTP/1.1

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/hyzip/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/hyzip/unix/makefile?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/hyzip/unix/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/hyzip/unix/makefile Wed Jul  7 12:23:44 2010
@@ -25,6 +25,6 @@ BUILDFILES = hyzip.o zcpool.o zipalloc.o
 LIBNAME = $(LIBPATH)libhyzip.a
 
 $(HY_BIN)%.o: $(LIBPATH)libhypool.a(%.o)
-	( cd $(HY_BIN) && ar $(ARFLAGS) xo $(LIBPATH)libhypool.a $@ )
+	( cd $(HY_BIN) && ar $(ARFLAGS) $(AREXTRACT) $(LIBPATH)libhypool.a $@ )
 
 include $(HY_TARGET)/hdk/build/make/rules.mk

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java Wed Jul  7 12:23:44 2010
@@ -37,6 +37,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.HttpConnection;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.DefaultHandler;
+
 import tests.support.Support_Jetty;
 
 import junit.framework.TestCase;
@@ -265,6 +274,120 @@ public class HttpURLConnectionTest exten
         }
     }
 
+    public static class ResponseServer {
+        private Server server = null;
+
+        private int port = -1;
+
+        public class MyRealmHandler extends DefaultHandler {
+            public void handle(String target, HttpServletRequest request,
+                    HttpServletResponse response, int dispatch)
+                    throws IOException, ServletException {
+                boolean auth = request.getHeader("Authorization") != null;
+                String resLoc = request.getPathInfo();
+                boolean noRealm = "/norealm".equals(resLoc);
+
+                Request base_request = (request instanceof Request) ? (Request) request
+                        : HttpConnection.getCurrentConnection().getRequest();
+                base_request.setHandled(true);
+                response.setContentType("text/html");
+                response.addDateHeader("Date", System.currentTimeMillis());
+                if (noRealm) {
+                    response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+                    response.getWriter().print("<h1>No WWW-Authenticate</h1>");
+                } else {
+                    if (auth) {
+                        response.setStatus(HttpServletResponse.SC_OK);
+                    } else {
+                        response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+                        response.addHeader("WWW-Authenticate",
+                                "Basic realm=\"HelloWorld\"");
+                    }
+                }
+            }
+        }
+
+        public void startServer(DefaultHandler handler) throws Exception {
+            server = new Server(0);
+            server.setHandler(handler);
+            server.start();
+            port = server.getConnectors()[0].getLocalPort();
+        }
+
+        public void stopServer() throws Exception {
+            if (server != null) {
+                server.stop();
+                server = null;
+            }
+        }
+
+        public int getPort() {
+            return port;
+        }
+    }
+
+    /**
+     * Test response code which need authenticate
+     */
+    public void testGetResponseCode() throws Exception {
+        ResponseServer server = new ResponseServer();
+        HttpURLConnection conn = null;
+        try {
+            server.startServer(server.new MyRealmHandler());
+            int port = server.getPort();
+            try {
+                conn = (HttpURLConnection) new URL("http://localhost:" + port
+                        + "/norealm").openConnection();
+                assertEquals(401, conn.getResponseCode());
+            } finally {
+                if (conn != null) {
+                    try {
+                        conn.disconnect();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            try {
+                conn = (HttpURLConnection) new URL("http://localhost:" + port
+                        + "/realm").openConnection();
+                assertEquals(401, conn.getResponseCode());
+                assertEquals("Basic realm=\"HelloWorld\"", conn
+                        .getHeaderField("WWW-Authenticate"));
+            } finally {
+                if (conn != null) {
+                    try {
+                        conn.disconnect();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            try {
+                Authenticator.setDefault(new Authenticator() {
+                    public PasswordAuthentication getPasswordAuthentication() {
+                        return new PasswordAuthentication("test", "password"
+                                .toCharArray());
+                    }
+                });
+                server.startServer(server.new MyRealmHandler());
+                conn = (HttpURLConnection) new URL("http://localhost:" + port
+                        + "/realm").openConnection();
+                assertEquals(200, conn.getResponseCode());
+                assertNull(conn.getHeaderField("WWW-Authenticate"));
+            } finally {
+                if (conn != null) {
+                    try {
+                        conn.disconnect();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        } finally {
+            server.stopServer();
+        }
+    }
+
     /**
      * ProxySelector implementation used in the test.
      */
@@ -981,4 +1104,4 @@ public class HttpURLConnectionTest exten
 
     }
 
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.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/net/URLTest.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java Wed Jul  7 12:23:44 2010
@@ -72,33 +72,53 @@ public class URLTest extends TestCase {
     
     
     /**
-     * Check when the argument in url consists of windows path character back-slach
+     * Check when the argument in url consists of windows path character back-slash
      * @tests java.net.URL#openConnection(Proxy)
      * @throws Exception
      */
     public void test_openConnection_windows_path_character() throws Exception {
-        int port = 0;
+        int port = Support_Jetty.startDefaultHttpServer();
         HttpURLConnection con = null;
         try {
-            port = Support_Jetty.startDefaultHttpServer();
-        } catch (Exception e) {
-            fail("Exception during setup jetty : " + e.getMessage());
-        }
-        try {
             URL url = new URL("http://0.0.0.0:" + port + "/servlet?ResourceName=C:\\temp\\test.txt");
-            con = (HttpURLConnection)url.openConnection();
+            con = (HttpURLConnection) url.openConnection();
             con.setDoInput(true);
             con.setDoOutput(true);
             con.setUseCaches(false);
             con.setRequestMethod("GET");
             InputStream is = con.getInputStream();
-         } catch (Exception e) {
-             fail("Unexpected exception : " + e.getMessage());
-         } finally {
-            con.disconnect();
-         }
+        } finally {
+            if (con != null) {
+                con.disconnect();
+            }
+        }
     }
 
+   /**
+     * Check when the argument in url consists of quotation marks character
+     * @tests java.net.URL#openConnection(Proxy)
+     * @throws Exception
+     */
+    public void test_openConnection_quotation_marks_character()
+            throws Exception {
+        int port = Support_Jetty.startDefaultHttpServer();
+        HttpURLConnection con = null;
+        try {
+            URL url = new URL("http://0.0.0.0:" + port
+                    + "/servlet?ResourceName=[\"11111\",\"22222\"]");
+            con = (HttpURLConnection) url.openConnection();
+            con.setDoInput(true);
+            con.setDoOutput(true);
+            con.setUseCaches(false);
+            con.setRequestMethod("GET");
+            InputStream is = con.getInputStream();
+        } finally {
+            if (con != null) {
+                con.disconnect();
+            }
+        }
+    }
+    
     /**
      * @tests java.net.URL#URL(java.lang.String)
      */
@@ -696,20 +716,27 @@ public class URLTest extends TestCase {
     /**
      * @tests java.net.URL#equals(java.lang.Object)
      */
-    public void test_equalsLjava_lang_Object() {
-        // Test for method boolean java.net.URL.equals(java.lang.Object)
-        try {
-            u = new URL("http://www.apache.org:8080/dir::23??????????test.html");
-            u1 = new URL(
-                    "http://www.apache.org:8080/dir::23??????????test.html");
-            assertTrue("A) equals returns false for two identical URLs", u
-                    .equals(u1));
-            assertTrue("return true for null comaprison", !u1.equals(null));
-            u = new URL("ftp://www.apache.org:8080/dir::23??????????test.html");
-            assertTrue("Returned true for non-equal URLs", !u.equals(u1));
-        } catch (MalformedURLException e) {
-            fail("MalformedURLException during equals test : " + e.getMessage());
-        }
+    public void test_equalsLjava_lang_Object() throws MalformedURLException {
+        u = new URL("http://www.apache.org:8080/dir::23??????????test.html");
+        u1 = new URL("http://www.apache.org:8080/dir::23??????????test.html");
+        assertTrue("A) equals returns false for two identical URLs", u
+                .equals(u1));
+        assertTrue("return true for null comparison", !u1.equals(null));
+        u = new URL("ftp://www.apache.org:8080/dir::23??????????test.html");
+        assertTrue("Returned true for non-equal URLs", !u.equals(u1));
+
+        // Regression for HARMONY-6556
+        u = new URL("file", null, 0, "/test.txt");
+        u1 = new URL("file", null, 0, "/test.txt");
+        assertEquals(u, u1);
+        
+        u = new URL("file", "first.invalid", 0, "/test.txt");
+        u1 = new URL("file", "second.invalid", 0, "/test.txt");
+        assertFalse(u.equals(u1));
+        
+        u = new URL("file", "harmony.apache.org", 0, "/test.txt");
+        u1 = new URL("file", "www.apache.org", 0, "/test.txt");
+        assertEquals(u, u1);
     }
 
     /**

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.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/PropertiesTest.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.java Wed Jul  7 12:23:44 2010
@@ -17,10 +17,12 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.util.Enumeration;
@@ -541,6 +543,131 @@ public class PropertiesTest extends juni
         assertEquals(1, props.size());
     }
 
+    private String comment1 = "comment1";
+
+    private String comment2 = "comment2";
+
+    private void validateOutput(String[] expectStrings, byte[] output)
+            throws IOException {
+        ByteArrayInputStream bais = new ByteArrayInputStream(output);
+        BufferedReader br = new BufferedReader(new InputStreamReader(bais,
+                "ISO8859_1"));
+        for (String expectString : expectStrings) {
+            assertEquals(expectString, br.readLine());
+        }
+        br.readLine();
+        assertNull(br.readLine());
+        br.close();
+    }
+
+    public void testStore_scenario0() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\r' + comment2);
+        validateOutput(new String[] { "#comment1", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario1() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\n' + comment2);
+        validateOutput(new String[] { "#comment1", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario2() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\r' + '\n' + comment2);
+        validateOutput(new String[] { "#comment1", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario3() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\n' + '\r' + comment2);
+        validateOutput(new String[] { "#comment1", "#", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario4() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\r' + '#' + comment2);
+        validateOutput(new String[] { "#comment1", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario5() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\r' + '!' + comment2);
+        validateOutput(new String[] { "#comment1", "!comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario6() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\n' + '#' + comment2);
+        validateOutput(new String[] { "#comment1", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario7() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\n' + '!' + comment2);
+        validateOutput(new String[] { "#comment1", "!comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario8() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\r' + '\n' + '#' + comment2);
+        validateOutput(new String[] { "#comment1", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario9() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\n' + '\r' + '#' + comment2);
+        validateOutput(new String[] { "#comment1", "#", "#comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario10() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\r' + '\n' + '!' + comment2);
+        validateOutput(new String[] { "#comment1", "!comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
+    public void testStore_scenario11() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Properties props = new Properties();
+        props.store(baos, comment1 + '\n' + '\r' + '!' + comment2);
+        validateOutput(new String[] { "#comment1", "#", "!comment2" },
+                baos.toByteArray());
+        baos.close();
+    }
+
     /**
      * Sets up the fixture, for example, open a network connection. This method
      * is called before a test is executed.

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java Wed Jul  7 12:23:44 2010
@@ -47,7 +47,6 @@ import org.apache.harmony.luni.platform.
 import org.apache.harmony.luni.platform.INetworkSystem;
 import org.apache.harmony.luni.platform.Platform;
 import org.apache.harmony.luni.util.ErrorCodeException;
-import org.apache.harmony.nio.internal.nls.Messages;
 import org.apache.harmony.nio.AddressUtil;
 import org.apache.harmony.nio.internal.nls.Messages;
 
@@ -794,11 +793,9 @@ class SocketChannelImpl extends SocketCh
                 throw new ConnectionPendingException();
             }
             super.bind(localAddr);
-            // keep here to see if need next version
-            // channel.Address = getLocalSocketAddress();
-            // channel.localport = getLocalPort();
             channel.isBound = true;
-
+            channel.localAddress = super.getLocalAddress();
+            channel.localPort = super.getLocalPort();
         }
 
         /**

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Wed Jul  7 12:23:44 2010
@@ -426,6 +426,13 @@ public class SocketChannelTest extends T
         assertTrue(0 != socket.getLocalPort());
     }
 
+    public void testSocket_bind() throws Exception {
+        Socket socket = channel1.socket();
+        socket.bind(new InetSocketAddress("127.0.0.1", 0));
+        assertEquals("127.0.0.1", socket.getLocalAddress().getHostAddress());
+        assertTrue(socket.getLocalPort() != -1);
+    }
+
     private void assertSocketBeforeConnect(Socket s) throws IOException {
         assertFalse(s.isBound());
         assertFalse(s.isClosed());
@@ -2782,15 +2789,15 @@ public class SocketChannelTest extends T
 
         // Write them out, read what we wrote and check it
         client.write(buffers);
+        client.close();
         ByteBuffer readBuffer = ByteBuffer.allocate(1024);
-        worker.read(readBuffer);
+        while (EOF != worker.read(readBuffer)) {};
         readBuffer.flip();
         Buffer expected = ByteBuffer.allocate(1024).put(data).put(data).flip();
         assertEquals(expected, readBuffer);
 
         // Tidy-up
         worker.close();
-        client.close();
         server.close();
     }
 
@@ -2824,14 +2831,14 @@ public class SocketChannelTest extends T
 
         // Write them out, read what we wrote and check it
         client.write(buffers);
+        client.close();
         ByteBuffer readBuffer = ByteBuffer.allocate(1024);
-        worker.read(readBuffer);
+        while (EOF != worker.read(readBuffer)) {};
         readBuffer.flip();
         assertEquals(ByteBuffer.wrap(data), readBuffer);
 
         // Tidy-up
         worker.close();
-        client.close();
         server.close();
     }
 
@@ -2864,16 +2871,16 @@ public class SocketChannelTest extends T
         client.write(buffers, 0, 2); // writes "world!"
         assertEquals("Failed to drain buffer 1", 0, buffers[1].remaining());
         client.write(buffers, 0, 3); // write nothing
+        client.close();
 
         // Read what we wrote and check it
         ByteBuffer readBuffer = ByteBuffer.allocate(1024);
-        worker.read(readBuffer);
+        while (EOF != worker.read(readBuffer)) {};
         readBuffer.flip();
         assertEquals(ByteBuffer.wrap(data), readBuffer);
 
         // Tidy-up
         worker.close();
-        client.close();
         server.close();
     }
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c Wed Jul  7 12:23:44 2010
@@ -2035,21 +2035,27 @@ atoe_execv (const char *path, char *cons
     int size = 0, i, rc;
 
     /* Calculate the size of argv. argv always ends with a null pointer. */
-    while (*(argv+size)) {
+    while (argv[size]) {
         size++;
     }
 
     /* Allocate space for the new array and populate */
-    ebcdicArgv = (char**) malloc(size+1);
-    for (i=0; i<size; i++) {
-        *(ebcdicArgv+i) = strdup(a2e_string(argv[i]));
+    ebcdicArgv = (char**) malloc(sizeof(char*) * (size + 1));
+    for (i = 0; i < size; i++) {
+        ebcdicArgv[i] = a2e_string(argv[i]);
     }
 
     /* Null terminate the new array */
-    *(ebcdicArgv+size) = NULL;
+    ebcdicArgv[size] = NULL;
 
     rc = execv(ebcdicPath, ebcdicArgv);
 
+    for (i = 0; i < size; ++i) {
+        free(ebcdicArgv[i]);
+    }
+    free(ebcdicArgv);
+    free(ebcdicPath);
+
     return rc;
 }
 
@@ -2067,21 +2073,27 @@ atoe_execvp (const char *file, char *con
     int size = 0, i, rc;
 
     /* Calculate the size of argv. argv always ends with a null pointer. */
-    while (*(argv+size)) {
+    while (argv[size]) {
         size++;
     }
 
     /* Allocate space for the new array and populate */
-    ebcdicArgv = (char**) malloc(size+1);
-    for (i=0; i<size; i++) {
-        *(ebcdicArgv+i) = strdup(a2e_string(argv[i]));
+    ebcdicArgv = (char**) malloc(sizeof(char*) * (size + 1));
+    for (i = 0; i < size; i++) {
+        ebcdicArgv[i] = a2e_string(argv[i]);
     }
 
     /* Null terminate the new array */
-    *(ebcdicArgv+size) = NULL;
+    ebcdicArgv[size] = NULL;
 
     rc = execvp(ebcdicFile, ebcdicArgv);
 
+    for (i = 0; i < size; ++i) {
+        free(ebcdicArgv[i]);
+    }
+    free(ebcdicArgv);
+    free(ebcdicPath);
+
     return rc;
 }
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/makefile?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/common/windows/makefile Wed Jul  7 12:23:44 2010
@@ -24,7 +24,6 @@ LIBNAME=$(LIBPATH)hycommon.lib
 BUILDFILES = \
 	$(SHAREDSUB)libglob.obj $(SHAREDSUB)iohelp.obj \
 	$(SHAREDSUB)exceptions.obj $(SHAREDSUB)strhelp.obj \
-	$(HY_PLATFORM)\locklbl.obj lock386.obj \
 	$(SHAREDSUB)utf8decode.obj $(SHAREDSUB)utf8encode.obj
 MDLLIBFILES =
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/makefile?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/portlib/src/main/native/thread/windows/makefile Wed Jul  7 12:23:44 2010
@@ -26,7 +26,7 @@ LIBNAME=$(LIBPATH)$(LIBBASE).lib
 BUILDFILES = \
   $(SHAREDSUB)thread_copyright.obj $(HY_PLATFORM)\thrhelp.obj $(HY_PLATFORM)\thrspinlock.obj \
   $(SHAREDSUB)hythread.obj $(SHAREDSUB)hythreadinspect.obj $(SHAREDSUB)rwmutex.obj thrdsup.obj \
-  $(SHAREDSUB)thrprof.obj
+  $(SHAREDSUB)thrprof.obj $(HY_PLATFORM)\locklbl.obj lock386.obj
 
 # TOFIX $(LIBBASE).def should be a dependency on all libs
 VIRTFILES = $(LIBBASE).res

Propchange: harmony/enhanced/java/branches/mrh/common_resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 12:23:44 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh/common_resources:935751
-/harmony/enhanced/java/trunk/common_resources:935751-957748
+/harmony/enhanced/java/trunk/common_resources:935751-961314
 /harmony/enhanced/trunk/common_resources:476395-921782
 /incubator/harmony/enhanced/trunk/common_resources:292550-476394

Propchange: harmony/enhanced/java/branches/mrh/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 12:23:44 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751
-/harmony/enhanced/java/trunk/drlvm:935751-957748
+/harmony/enhanced/java/trunk/drlvm:935751-961314
 /harmony/enhanced/trunk/drlvm:476395-926313
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/working_vm:423974-476394

Modified: harmony/enhanced/java/branches/mrh/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp (original)
+++ harmony/enhanced/java/branches/mrh/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp Wed Jul  7 12:23:44 2010
@@ -295,8 +295,9 @@ static jint check_platform() {
     if((osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) ||  // NT 4.0
        (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) ||  // Windows 2000
        (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) ||  // Windows XP
-       (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) ||  // Windows.NET            
-       (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)) {  // Windows Vista            
+       (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) ||  // Windows.NET
+       (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) ||  // Windows Vista
+       (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)) {  // Windows 7
             return JNI_OK;
     }
     printf("Windows %d.%d is not supported\n", osvi.dwMajorVersion, osvi.dwMinorVersion);

Modified: harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/README.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/README.txt?rev=961356&r1=961355&r2=961356&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/README.txt (original)
+++ harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/README.txt Wed Jul  7 12:23:44 2010
@@ -285,7 +285,7 @@ JRE or another JRE supporting the JVMTI 
    for example, the Eclipse* JDT debugger.
 
 The JDWP agent supports all standard options described in JPDA specification,
-except 'onthrow' and 'onuncought' used for starting the debugger on demand.
+except 'onthrow' and 'onuncaught' used for starting the debugger on demand.
 
 To start JVM with the JDWP agent on the command line, use the options shown
 in the usage message:
@@ -372,7 +372,7 @@ The contributed JPDA module has the foll
 
 The following functionality is missing in the current JDWP implementation:
 
-  - Support for agent options onthrow and onuncought to start the debugger
+  - Support for agent options onthrow and onuncaught to start the debugger
     when an exception is thrown in the application.
 
   - Grouping different events for the same location, for example, breakpoint 



Mime
View raw message