harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r961261 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/awt/make/ classlib/modules/imageio/META-INF/ classlib/modules/imageio/make/ classlib/modules/imageio/src/main/java/javax/imageio/ class...
Date Wed, 07 Jul 2010 07:08:02 GMT
Author: hindessm
Date: Wed Jul  7 07:08:01 2010
New Revision: 961261

URL: http://svn.apache.org/viewvc?rev=961261&view=rev
Log:
Merge changes from trunk@961242.

Added:
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java
      - copied, changed from r958742, harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java
Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/awt/make/depends.properties
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/META-INF/MANIFEST.MF
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/make/depends.properties
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/build.xml
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/File.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URI.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLDecoder.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
    harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c
    harmony/enhanced/java/branches/java6/common_resources/   (props changed)
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/drlvm/vm/vmcore/src/init/vm_init.cpp
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/modules/jpda/README.txt

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 07:08:01 2010
@@ -1,3 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-958493
-/harmony/enhanced/trunk:810871-929252
+/harmony/enhanced/java/trunk:929253-961242
+/harmony/enhanced/trunk:476395-929252
+/incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 07:08:01 2010
@@ -1,7 +1,8 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-958493
+/harmony/enhanced/java/trunk/classlib:929253-961242
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
+/incubator/harmony/enhanced/trunk/classlib:292550-476394
 /incubator/harmony/enhanced/trunk/working_classlib:423974-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 07:08:01 2010
@@ -1,3 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-958493
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-961242
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
+/incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/awt/make/depends.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/awt/make/depends.properties?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/awt/make/depends.properties (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/awt/make/depends.properties Wed Jul  7 07:08:01 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/java6/classlib/modules/imageio/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/META-INF/MANIFEST.MF?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/imageio/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/META-INF/MANIFEST.MF Wed Jul  7 07:08:01 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/java6/classlib/modules/imageio/make/depends.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/make/depends.properties?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/imageio/make/depends.properties (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/make/depends.properties Wed Jul  7 07:08:01 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/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java Wed Jul  7 07:08:01 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

Copied: harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java (from r958742, harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java)
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java?p2=harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java&p1=harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java&r1=958742&r2=961261&rev=961261&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageTypeSpecifierTest.java Wed Jul  7 07:08:01 2010
@@ -17,14 +17,103 @@
 
 package javax.imageio;
 
+import static org.junit.Assert.assertArrayEquals;
+
 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.DataBuffer;
+import java.awt.image.PixelInterleavedSampleModel;
 
 import junit.framework.TestCase;
 
 public class ImageTypeSpecifierTest extends TestCase {
+    public void testCreateBanded() {
+        int[] bankIndices = new int[]{0, 1, 2};
+        int[] bandOffsets = new int[]{1, 1, 1};
+        ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+        int dataType = DataBuffer.TYPE_BYTE;
+        boolean hasAlpha = false;
+        
+        ImageTypeSpecifier typeSpecifier = ImageTypeSpecifier.createBanded(colorSpace,
+                                                                           bankIndices, 
+                                                                           bandOffsets, 
+                                                                           dataType, 
+                                                                           hasAlpha, 
+                                                                           false);
+        
+        ColorModel colorModel = typeSpecifier.getColorModel();
+        assertEquals("Failed to create with the correct colorspace type",
+                     ColorSpace.TYPE_RGB, colorModel.getColorSpace().getType());
+        assertEquals("Failed to create with the correct transparency",
+                     Transparency.OPAQUE, colorModel.getTransparency());
+        assertEquals("Failed to create with the correcttransfer type",
+                     DataBuffer.TYPE_BYTE, colorModel.getTransferType());
+        
+        BandedSampleModel sampleModel = (BandedSampleModel) typeSpecifier.getSampleModel();
+        assertArrayEquals("Failed to create with the correct bankIndices",
+                          bankIndices, sampleModel.getBankIndices());
+        assertArrayEquals("Failed to create with the correct bankIndices",
+                          bandOffsets, sampleModel.getBandOffsets());  
+    }
+
+    public void testCreateBufferedImage() {
+        ImageTypeSpecifier typeSpecifier = ImageTypeSpecifier.createGrayscale(8, 
+                                                                              DataBuffer.TYPE_BYTE, 
+                                                                              true);
+        
+        int width = 10;
+        int height = 10;
+        BufferedImage image = typeSpecifier.createBufferedImage(width, height);
+        assertEquals("Failed to create with the correct ColorModel",
+                     typeSpecifier.getColorModel(), image.getColorModel());
+        assertEquals("Failed to create with the correct SampleModel",
+                     typeSpecifier.getSampleModel().getClass(), image.getSampleModel().getClass());
+        assertEquals("Failed to create with the correct width",
+                     width, image.getWidth());
+        assertEquals("Failed to create with the correct height",
+                     height, image.getHeight());
+    }
+    
+    public void testGetBufferedImageType() {
+        ImageTypeSpecifier typeSpecifier = ImageTypeSpecifier.createGrayscale(8, 
+                                                                              DataBuffer.TYPE_BYTE, 
+                                                                              true);
+
+        assertEquals("Failed to return the correct type",
+                     BufferedImage.TYPE_BYTE_GRAY, typeSpecifier.getBufferedImageType());        
+    }
+    
+    public void testCreateInterleaved() {
+        ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+        int[] bandOffsets = new int[] { 1, 2, 3 };
+        int dataType = DataBuffer.TYPE_BYTE;
+
+        ImageTypeSpecifier type = ImageTypeSpecifier.createInterleaved(
+                colorSpace, bandOffsets, dataType, false, false);
+        ColorModel colorModel = type.getColorModel();
+        PixelInterleavedSampleModel sampleModel = (PixelInterleavedSampleModel) type
+                .getSampleModel();
+
+        // validate the colorModel
+        assertEquals("Failed to create with the correct colorspace type",
+                ColorSpace.TYPE_RGB, colorModel.getColorSpace().getType());
+        assertEquals("Failed to create with the correct transparency",
+                Transparency.OPAQUE, colorModel.getTransparency());
+        assertEquals("Failed to create with the correct transfer type",
+                DataBuffer.TYPE_BYTE, colorModel.getTransferType());
+
+        // validate the sampleModel
+        assertTrue("The sampleModel and colorModel are not compatible",
+                colorModel.isCompatibleSampleModel(sampleModel));
+        assertArrayEquals("Failed to create with the correct bandOffsets",
+                bandOffsets, sampleModel.getBandOffsets());
+        assertEquals("Failed to create with the correct pixel stride", 3,
+                sampleModel.getPixelStride());
+    }
+
     public void testCreateGrayscale() {        
         // create a 8-bit grayscale ImageTypeSpecifier
         ImageTypeSpecifier type =

Modified: harmony/enhanced/java/branches/java6/classlib/modules/luni/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/build.xml?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/build.xml (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/build.xml Wed Jul  7 07:08:01 2010
@@ -315,6 +315,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/java6/classlib/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/File.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/File.java Wed Jul  7 07:08:01 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;
 
@@ -1456,13 +1463,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/java6/classlib/modules/luni/src/main/java/java/net/URI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URI.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URI.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URI.java Wed Jul  7 07:08:01 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/java6/classlib/modules/luni/src/main/java/java/net/URLDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLDecoder.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLDecoder.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLDecoder.java Wed Jul  7 07:08:01 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/java6/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java Wed Jul  7 07:08:01 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/java6/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/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java Wed Jul  7 07:08:01 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/java6/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/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java Wed Jul  7 07:08:01 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/java6/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/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java Wed Jul  7 07:08:01 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/java6/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java Wed Jul  7 07:08:01 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/java6/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/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Wed Jul  7 07:08:01 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/java6/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c Wed Jul  7 07:08:01 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;
 }
 

Propchange: harmony/enhanced/java/branches/java6/common_resources/
            ('svn:mergeinfo' removed)

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 07:08:01 2010
@@ -1,5 +1,6 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-958493
+/harmony/enhanced/java/trunk/drlvm:929253-961242
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
+/incubator/harmony/enhanced/trunk/drlvm:292550-476394
 /incubator/harmony/enhanced/trunk/working_vm:423974-476394

Modified: harmony/enhanced/java/branches/java6/drlvm/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/drlvm/vm/vmcore/src/init/vm_init.cpp?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/drlvm/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/java/branches/java6/drlvm/vm/vmcore/src/init/vm_init.cpp Wed Jul  7 07:08:01 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);

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  7 07:08:01 2010
@@ -1,5 +1,6 @@
-/harmony/enhanced/java/trunk/jdktools:929253-958493
+/harmony/enhanced/java/trunk/jdktools:929253-961242
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147
+/incubator/harmony/enhanced/trunk/jdktools:292550-476394
 /incubator/harmony/enhanced/trunk/working_jdktools:423974-476394

Modified: harmony/enhanced/java/branches/java6/jdktools/modules/jpda/README.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/jdktools/modules/jpda/README.txt?rev=961261&r1=961260&r2=961261&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/jdktools/modules/jpda/README.txt (original)
+++ harmony/enhanced/java/branches/java6/jdktools/modules/jpda/README.txt Wed Jul  7 07:08:01 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