harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r814478 [2/3] - in /harmony/enhanced/classlib/branches/java6: ./ depends/build/ make/ modules/beans/make/ modules/beans/src/main/java/java/beans/ modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ modules/beans/src/test/...
Date Mon, 14 Sep 2009 05:45:04 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSMemory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSMemory.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSMemory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSMemory.java Mon Sep 14 05:45:00 2009
@@ -69,6 +69,15 @@
 		return singleton;
 	}
 
+    /*
+     * Native method to determine whether the underlying platform is little
+     * endian.
+     * 
+     * @return <code>true</code> if the platform is little endian or
+     * <code>false</code> if it is big endian.
+     */
+    private static native boolean isLittleEndianImpl();
+
 	/**
 	 * This class is not designed to be publicly instantiated.
 	 * 
@@ -78,16 +87,14 @@
 		super();
 	}
 
-	/**
-	 * Answers whether the byte order of this machine is little endian or not..
-	 * 
-	 * @return <code>false</code> for Big Endian, and
-	 *         <code>true</code. for Little Endian.
-	 */
-	public static native boolean isLittleEndianImpl();
-
+    /**
+     * Answers whether the byte order of this machine is little endian or not.
+     * 
+     * @return <code>false</code> for Big Endian, and
+     *         <code>true</code> for Little Endian.
+     */
 	public boolean isLittleEndian() {
-		return isLittleEndianImpl();
+		return NATIVE_ORDER == Endianness.LITTLE_ENDIAN;
 	}
 
 	/**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddress.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddress.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddress.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddress.java Mon Sep 14 05:45:00 2009
@@ -17,242 +17,250 @@
 
 package org.apache.harmony.luni.platform;
 
-
 /**
  * The platform address class is an unsafe virtualization of an OS memory block.
- * 
  */
 public class PlatformAddress implements ICommonDataTypes, Comparable {
 
-	/**
-	 * This final field defines the size of an address on this platform.
-	 */
-	static final int SIZEOF = Platform.getMemorySystem().getPointerSize();
-
-	/**
-	 * NULL is the canonical address with address value zero.
-	 */
-	public static final PlatformAddress NULL = new PlatformAddress(0, 0);
+    /**
+     * This final field defines the sentinel for an unknown address value.
+     */
+    static final long UNKNOWN = -1;
 
-	public static final IMemorySpy memorySpy = new RuntimeMemorySpy();
+    /**
+     * This final field defines the size of an address on this platform.
+     */
+    static final int SIZEOF = Platform.getMemorySystem().getPointerSize();
+
+    /**
+     * NULL is the canonical address with address value zero.
+     */
+    public static final PlatformAddress NULL = new PlatformAddress(0, 0);
+
+    /**
+     * INVALID is the canonical address with an invalid value
+     * (i.e. a non-address).
+     */
+    public static final PlatformAddress INVALID =
+        new PlatformAddress(UNKNOWN, UNKNOWN);
 
-	static final IMemorySystem osMemory = Platform.getMemorySystem();
+    public static final IMemorySpy memorySpy = new RuntimeMemorySpy();
 
-    static final long UNKNOWN = -1;
+    static final IMemorySystem osMemory = Platform.getMemorySystem();
+
+    final long osaddr;
 
-	final long osaddr;
-    
     final long size;
 
-	PlatformAddress(long address, long size) {
-		super();
-		osaddr = address;
+    PlatformAddress(long address, long size) {
+        super();
+        osaddr = address;
         this.size = size;
-	}
+    }
 
-	/**
-	 * Sending auto free to an address means that, when this subsystem has
-	 * allocated the memory, it will automatically be freed when this object is
-	 * collected by the garbage collector if the memory has not already been
-	 * freed explicitly.
-	 * 
-	 */
-	public final void autoFree() {
-		memorySpy.autoFree(this);
-	}
-    
-    public PlatformAddress duplicate(){
+    /**
+     * Sending auto free to an address means that, when this subsystem has
+     * allocated the memory, it will automatically be freed when this object is
+     * collected by the garbage collector if the memory has not already been
+     * freed explicitly.
+     * 
+     */
+    public final void autoFree() {
+        memorySpy.autoFree(this);
+    }
+
+    public PlatformAddress duplicate() {
         return PlatformAddressFactory.on(osaddr, size);
     }
 
-	public PlatformAddress offsetBytes(int offset) {
-		return PlatformAddressFactory.on(osaddr + offset, size - offset);
-	}
-
-	public PlatformAddress offsetBytes(long offset) {
-		return PlatformAddressFactory.on(osaddr + offset, size - offset);
-	}
-
-	public final void moveTo(PlatformAddress dest, long numBytes) {
-		osMemory.memmove(dest.osaddr, osaddr, numBytes);
-	}
-
-	public final boolean equals(Object other) {
-		return (other instanceof PlatformAddress)
-				&& (((PlatformAddress) other).osaddr == osaddr);
-	}
-
-	public final int hashCode() {
-		return (int) osaddr;
-	}
-
-	public final boolean isNULL() {
-		return this == NULL;
-	}
-
-	public void free() {
-		// Memory spys can veto the basic free if they determine the memory was
-		// not allocated.
-		if (memorySpy.free(this)) {
-		    osMemory.free(osaddr);
-		}
-	}
-
-	public final void setAddress(int offset, PlatformAddress address) {
-		osMemory.setAddress(osaddr + offset, address.osaddr);
-	}
-
-	public final PlatformAddress getAddress(int offset) {
-		int addr = getInt(offset);
-		return PlatformAddressFactory.on(addr);
-	}
-
-	public final void setByte(int offset, byte value) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JBYTE);
-		osMemory.setByte(osaddr + offset, value);
-	}
-
-	public final void setByteArray(int offset, byte[] bytes, int bytesOffset,
-			int length) {
-		memorySpy.rangeCheck(this, offset, length * SIZEOF_JBYTE);
-		osMemory.setByteArray(osaddr + offset, bytes, bytesOffset, length);
-	}
-
-	public final byte getByte(int offset) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JBYTE);
-		return osMemory.getByte(osaddr + offset);
-	}
-
-	public final void getByteArray(int offset, byte[] bytes, int bytesOffset,
-			int length) {
-		memorySpy.rangeCheck(this, offset, length * SIZEOF_JBYTE);
-		osMemory.getByteArray(osaddr + offset, bytes, bytesOffset, length);
-	}
-
-	public final void setShort(int offset, short value, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
-		osMemory.setShort(osaddr + offset, value, order);
-	}
-
-	public final void setShort(int offset, short value) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
-		osMemory.setShort(osaddr + offset, value);
-	}
-
-	public final short getShort(int offset, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
-		return osMemory.getShort(osaddr + offset, order);
-	}
-
-	public final short getShort(int offset) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
-		return osMemory.getShort(osaddr + offset);
-	}
-
-	public final void setInt(int offset, int value, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
-		osMemory.setInt(osaddr + offset, value, order);
-	}
-
-	public final void setInt(int offset, int value) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
-		osMemory.setInt(osaddr + offset, value);
-	}
-
-	public final int getInt(int offset, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
-		return osMemory.getInt(osaddr + offset, order);
-	}
-
-	public final int getInt(int offset) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
-		return osMemory.getInt(osaddr + offset);
-	}
-
-	public final void setLong(int offset, long value, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
-		osMemory.setLong(osaddr + offset, value, order);
-	}
-
-	public final void setLong(int offset, long value) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
-		osMemory.setLong(osaddr + offset, value);
-	}
-
-	public final long getLong(int offset, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
-		return osMemory.getLong(osaddr + offset, order);
-	}
-
-	public final long getLong(int offset) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
-		return osMemory.getLong(osaddr + offset);
-	}
-
-	public final void setFloat(int offset, float value, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
-		osMemory.setFloat(osaddr + offset, value, order);
-	}
-
-	public final void setFloat(int offset, float value) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
-		osMemory.setFloat(osaddr + offset, value);
-	}
-
-	public final float getFloat(int offset, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
-		return osMemory.getFloat(osaddr + offset, order);
-	}
-
-	public final float getFloat(int offset) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
-		return osMemory.getFloat(osaddr + offset);
-	}
-
-	public final void setDouble(int offset, double value, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
-		osMemory.setDouble(osaddr + offset, value, order);
-	}
-
-	public final void setDouble(int offset, double value) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
-		osMemory.setDouble(osaddr + offset, value);
-	}
-
-	public final double getDouble(int offset, Endianness order) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
-		return osMemory.getDouble(osaddr + offset, order);
-	}
-
-	public final double getDouble(int offset) {
-		memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
-		return osMemory.getDouble(osaddr + offset);
-	}
-
-	public final long toLong() {
-		return osaddr;
-	}
-
-	public final String toString() {
-		return "PlatformAddress[" + osaddr + "]"; //$NON-NLS-1$ //$NON-NLS-2$
-	}
-    
-    public final long getSize(){
+    public PlatformAddress offsetBytes(int offset) {
+        return PlatformAddressFactory.on(osaddr + offset, size - offset);
+    }
+
+    public PlatformAddress offsetBytes(long offset) {
+        return PlatformAddressFactory.on(osaddr + offset, size - offset);
+    }
+
+    public final void moveTo(PlatformAddress dest, long numBytes) {
+        osMemory.memmove(dest.osaddr, osaddr, numBytes);
+    }
+
+    public final boolean equals(Object other) {
+        return (other instanceof PlatformAddress)
+                && (((PlatformAddress) other).osaddr == osaddr);
+    }
+
+    public final int hashCode() {
+        return (int) osaddr;
+    }
+
+    public final boolean isNULL() {
+        return this == NULL;
+    }
+
+    public void free() {
+        // Memory spys can veto the basic free if they determine the memory was
+        // not allocated.
+        if (memorySpy.free(this)) {
+            osMemory.free(osaddr);
+        }
+    }
+
+    public final void setAddress(int offset, PlatformAddress address) {
+        osMemory.setAddress(osaddr + offset, address.osaddr);
+    }
+
+    public final PlatformAddress getAddress(int offset) {
+        int addr = getInt(offset);
+        return PlatformAddressFactory.on(addr);
+    }
+
+    public final void setByte(int offset, byte value) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JBYTE);
+        osMemory.setByte(osaddr + offset, value);
+    }
+
+    public final void setByteArray(int offset, byte[] bytes, int bytesOffset,
+            int length) {
+        memorySpy.rangeCheck(this, offset, length * SIZEOF_JBYTE);
+        osMemory.setByteArray(osaddr + offset, bytes, bytesOffset, length);
+    }
+
+    public final byte getByte(int offset) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JBYTE);
+        return osMemory.getByte(osaddr + offset);
+    }
+
+    public final void getByteArray(int offset, byte[] bytes, int bytesOffset,
+            int length) {
+        memorySpy.rangeCheck(this, offset, length * SIZEOF_JBYTE);
+        osMemory.getByteArray(osaddr + offset, bytes, bytesOffset, length);
+    }
+
+    public final void setShort(int offset, short value, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
+        osMemory.setShort(osaddr + offset, value, order);
+    }
+
+    public final void setShort(int offset, short value) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
+        osMemory.setShort(osaddr + offset, value);
+    }
+
+    public final short getShort(int offset, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
+        return osMemory.getShort(osaddr + offset, order);
+    }
+
+    public final short getShort(int offset) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JSHORT);
+        return osMemory.getShort(osaddr + offset);
+    }
+
+    public final void setInt(int offset, int value, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
+        osMemory.setInt(osaddr + offset, value, order);
+    }
+
+    public final void setInt(int offset, int value) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
+        osMemory.setInt(osaddr + offset, value);
+    }
+
+    public final int getInt(int offset, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
+        return osMemory.getInt(osaddr + offset, order);
+    }
+
+    public final int getInt(int offset) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JINT);
+        return osMemory.getInt(osaddr + offset);
+    }
+
+    public final void setLong(int offset, long value, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
+        osMemory.setLong(osaddr + offset, value, order);
+    }
+
+    public final void setLong(int offset, long value) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
+        osMemory.setLong(osaddr + offset, value);
+    }
+
+    public final long getLong(int offset, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
+        return osMemory.getLong(osaddr + offset, order);
+    }
+
+    public final long getLong(int offset) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JLONG);
+        return osMemory.getLong(osaddr + offset);
+    }
+
+    public final void setFloat(int offset, float value, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
+        osMemory.setFloat(osaddr + offset, value, order);
+    }
+
+    public final void setFloat(int offset, float value) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
+        osMemory.setFloat(osaddr + offset, value);
+    }
+
+    public final float getFloat(int offset, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
+        return osMemory.getFloat(osaddr + offset, order);
+    }
+
+    public final float getFloat(int offset) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JFLOAT);
+        return osMemory.getFloat(osaddr + offset);
+    }
+
+    public final void setDouble(int offset, double value, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
+        osMemory.setDouble(osaddr + offset, value, order);
+    }
+
+    public final void setDouble(int offset, double value) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
+        osMemory.setDouble(osaddr + offset, value);
+    }
+
+    public final double getDouble(int offset, Endianness order) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
+        return osMemory.getDouble(osaddr + offset, order);
+    }
+
+    public final double getDouble(int offset) {
+        memorySpy.rangeCheck(this, offset, SIZEOF_JDOUBLE);
+        return osMemory.getDouble(osaddr + offset);
+    }
+
+    public final long toLong() {
+        return osaddr;
+    }
+
+    public final String toString() {
+        return "PlatformAddress[" + osaddr + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public final long getSize() {
         return size;
     }
 
-	public final int compareTo(Object other) {
-		if (other == null) {
-			throw new NullPointerException(); // per spec.
-		}
-		if (other instanceof PlatformAddress) {
-			long otherPA = ((PlatformAddress) other).osaddr;
-			if (osaddr == otherPA) {
-				return 0;
-			}
-			return osaddr < otherPA ? -1 : 1;
-		}
+    public final int compareTo(Object other) {
+        if (other == null) {
+            throw new NullPointerException(); // per spec.
+        }
+        if (other instanceof PlatformAddress) {
+            long otherPA = ((PlatformAddress) other).osaddr;
+            if (osaddr == otherPA) {
+                return 0;
+            }
+            return osaddr < otherPA ? -1 : 1;
+        }
 
-		throw new ClassCastException(); // per spec.
-	}
+        throw new ClassCastException(); // per spec.
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties Mon Sep 14 05:45:00 2009
@@ -38,7 +38,7 @@
 K0020=Unknown format
 K002b=Unknown pattern character - '{0}'
 K002c=Access denied {0}
-K002e=Offset out of bounds
+K002e=Offset out of bounds \: {0}
 K002f=Arguments out of bounds
 K0032=Address null or destination port out of range
 K0033=Unknown socket type
@@ -324,3 +324,6 @@
 KA028=Cannot set protocol version when stream in use
 KA029=Can't find resource for bundle {0}, key {1}
 KA030=Write end dead
+K0031=Length out of bounds \: {0}
+K0032=Source size {0} does not fit into destination
+K0033=Start index ({0}) is greater than end index ({1})

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/fdlibm.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/fdlibm.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/fdlibm.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/gp.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/gp.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/gp.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hymagic.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hymagic.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hymagic.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hysocket.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hysocket.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hysocket.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hyvmls.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hyvmls.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hyvmls.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jni.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jni_types.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni_types.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni_types.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmpi.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmpi.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmpi.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmri.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmri.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmri.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmti.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmti_types.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti_types.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti_types.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/vmi.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmi.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmi.h:803062-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/vmizip.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmizip.h:803062-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmizip.h:803062-814402

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/cmain.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/cmain.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/cmain.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/cmain.c Mon Sep 14 05:45:00 2009
@@ -17,12 +17,20 @@
 
 #include "hycomp.h"
 #include "hyport.h"
+
 #ifdef HY_NO_THR
 #include "main_hlp.h"
+#if defined(ZOS)
+/* Need ascii2ebcdic functions on zOS */
+#include "atoe.h"
+#endif
 #endif /* HY_NO_THR */
+
 #include <stdlib.h>             /* for malloc for atoe and abort */
 #include <stdio.h>
 
+
+
 struct haCmdlineOptions
 {
   int argc;
@@ -104,6 +112,21 @@
   UDATA portLibDescriptor;
   hyport_init_library_type port_init_library_func;
 
+#if defined(ZOS)
+  /* Initialise the ascii2ebcdic functions before doing anything else */
+  rc = iconv_init();
+  if (0 != rc) {
+#pragma convlit(suspend)
+      fprintf(stderr, "Failed to initialise atoe library\n");
+#pragma convlit(resume)
+      return rc;
+  }
+
+  /* Convert our command line options into ASCII - this function is
+     part of the hya2e library */
+  ConvertArgstoASCII(argc, argv);
+#endif
+
   /* determine which VM directory to use and add it to the path */
   rc = main_addVMDirToPath(argc, argv, envp);
   if ( 0 != rc ) {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/unix/makefile?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/unix/makefile Mon Sep 14 05:45:00 2009
@@ -29,4 +29,9 @@
 endif
 EXENAME = $(EXEPATH)java
 
+ifeq ($(HY_OS),zos)
+# On z/OS statically link the a2e lib so it can be used before LIBPATH is set
+MDLLIBFILES = $(LIBPATH)libhya2e.a $(LIBPATH)libhycommon.a
+endif
+
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c Mon Sep 14 05:45:00 2009
@@ -42,9 +42,15 @@
 #define LONG_DIV(u64, div) ((U_32)(*(U_64*)(u64) / (U_32)(div)))
 #define LONG_REM(u64, div) ((U_32)(*(U_64*)(u64) % (U_32)(div)))
 
-                /* 32 bit */
+#ifndef HY_WORD64
+/* 32 bit */
 #define IS_NEGATIVE(ar,len)     (((I_32*)ar)[at(len*2-1)] < 0)
 #define atx(i) (at(i))
+#else
+/* 64 bit */
+#define IS_NEGATIVE(ar,len)	(((I_64*)ar)[len-1] < 0L)
+#define atx(i) (i)
+#endif
 
 #define GET_LENGTH(obj) ((*env)->GetArrayLength(env,obj))
 #define GET_ELEMENTS(obj) ((U_32*)(*env)->GetLongArrayElements(env, obj, NULL))

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/cbigint.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/cbigint.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/cbigint.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/cbigint.c Mon Sep 14 05:45:00 2009
@@ -253,6 +253,34 @@
     }
 }
 
+#ifndef HY_LITTLE_ENDIAN
+void simpleMultiplyAddHighPrecisionBigEndianFix(U_64 *arg1, IDATA length, U_64 arg2, U_32 *result) {
+	/* Assumes result can hold the product and arg2 only holds 32 bits
+	   of information */
+	U_64 product;
+	IDATA index, resultIndex;
+
+	index = resultIndex = 0;
+	product = 0;
+
+	do {
+		product = HIGH_IN_U64(product) + result[halfAt(resultIndex)] + arg2 * LOW_U32_FROM_PTR(arg1 + index);
+		result[halfAt(resultIndex)] = LOW_U32_FROM_VAR(product);
+		++resultIndex;
+		product = HIGH_IN_U64(product) + result[halfAt(resultIndex)] + arg2 * HIGH_U32_FROM_PTR(arg1 + index);
+		result[halfAt(resultIndex)] = LOW_U32_FROM_VAR(product);
+		++resultIndex;
+	} while (++index < length);
+
+	result[halfAt(resultIndex)] += HIGH_U32_FROM_VAR(product);
+	if (result[halfAt(resultIndex)] < HIGH_U32_FROM_VAR(product)) {
+		/* must be careful with ++ operator and macro expansion */
+		++resultIndex;
+		while (++result[halfAt(resultIndex)] == 0) ++resultIndex;
+	}
+}
+#endif
+
 void
 multiplyHighPrecision (U_64 * arg1, IDATA length1, U_64 * arg2, IDATA length2,
                        U_64 * result, IDATA length)
@@ -281,10 +309,11 @@
     {
       simpleMultiplyAddHighPrecision (arg1, length1, LOW_IN_U64 (arg2[count]),
                                       resultIn32 + (++index));
-      simpleMultiplyAddHighPrecision (arg1, length1,
-                                      HIGH_IN_U64 (arg2[count]),
-                                      resultIn32 + (++index));
-
+#ifdef HY_LITTLE_ENDIAN
+      simpleMultiplyAddHighPrecision(arg1, length1, HIGH_IN_U64(arg2[count]), resultIn32 + (++index));
+#else
+      simpleMultiplyAddHighPrecisionBigEndianFix(arg1, length1, HIGH_IN_U64(arg2[count]), resultIn32 + (++index));
+#endif
     }
 }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltconst.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltconst.h?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltconst.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltconst.h Mon Sep 14 05:45:00 2009
@@ -137,16 +137,23 @@
 #define SET_PINF_SNGL_PTR(fltptr) *U32P((fltptr)) = SINGLE_EXPONENT_MASK
 #define SET_NINF_SNGL_PTR(fltptr) *U32P((fltptr)) = (SINGLE_EXPONENT_MASK | SINGLE_SIGN_MASK)
 
-/* on some platforms (HP720) we cannot reference an unaligned float.  Build them by hand, one U_32 at a time. */
-#if defined(ATOMIC_FLOAT_ACCESS)
-#define PTR_DOUBLE_STORE(dstPtr, aDoublePtr) HIGH_U32_FROM_DBL_PTR(dstPtr) = HIGH_U32_FROM_DBL_PTR(aDoublePtr); LOW_U32_FROM_DBL_PTR(dstPtr) = LOW_U32_FROM_DBL_PTR(aDoublePtr)
-#define PTR_DOUBLE_VALUE(dstPtr, aDoublePtr) HIGH_U32_FROM_DBL_PTR(aDoublePtr) = HIGH_U32_FROM_DBL_PTR(dstPtr); LOW_U32_FROM_DBL_PTR(aDoublePtr) = LOW_U32_FROM_DBL_PTR(dstPtr)
+#if defined(HY_WORD64)
+ #define PTR_DOUBLE_VALUE(dstPtr, aDoublePtr) ((U64U32DBL *)(aDoublePtr))->u64val = ((U64U32DBL *)(dstPtr))->u64val
+ #define PTR_DOUBLE_STORE(dstPtr, aDoublePtr) ((U64U32DBL *)(dstPtr))->u64val = ((U64U32DBL *)(aDoublePtr))->u64val
+ #define STORE_LONG(dstPtr, hi, lo) ((U64U32DBL *)(dstPtr))->u64val = (((U_64)(hi)) << 32) | (lo)
 #else
-#define PTR_DOUBLE_STORE(dstPtr, aDoublePtr) (*(dstPtr) = *(aDoublePtr))
-#define PTR_DOUBLE_VALUE(dstPtr, aDoublePtr) (*(aDoublePtr) = *(dstPtr))
-#endif
+ /* on some platforms (HP720) we cannot reference an unaligned float.  Build them by hand, one U_32 at a time. */
+ #if defined(ATOMIC_FLOAT_ACCESS)
+ #define PTR_DOUBLE_STORE(dstPtr, aDoublePtr) HIGH_U32_FROM_DBL_PTR(dstPtr) = HIGH_U32_FROM_DBL_PTR(aDoublePtr); LOW_U32_FROM_DBL_PTR(dstPtr) = LOW_U32_FROM_DBL_PTR(aDoublePtr)
+ #define PTR_DOUBLE_VALUE(dstPtr, aDoublePtr) HIGH_U32_FROM_DBL_PTR(aDoublePtr) = HIGH_U32_FROM_DBL_PTR(dstPtr); LOW_U32_FROM_DBL_PTR(aDoublePtr) = LOW_U32_FROM_DBL_PTR(dstPtr)
+ #else
+ #define PTR_DOUBLE_STORE(dstPtr, aDoublePtr) (*(dstPtr) = *(aDoublePtr))
+ #define PTR_DOUBLE_VALUE(dstPtr, aDoublePtr) (*(aDoublePtr) = *(dstPtr))
+ #endif
+
+ #define STORE_LONG(dstPtr, hi, lo) HIGH_U32_FROM_LONG64_PTR(dstPtr) = (hi); LOW_U32_FROM_LONG64_PTR(dstPtr) = (lo)
+#endif /* HY_WORD64 */
 
-#define STORE_LONG(dstPtr, hi, lo) HIGH_U32_FROM_LONG64_PTR(dstPtr) = (hi); LOW_U32_FROM_LONG64_PTR(dstPtr) = (lo)
 #define PTR_SINGLE_VALUE(dstPtr, aSinglePtr) (*U32P(aSinglePtr) = *U32P(dstPtr))
 #define PTR_SINGLE_STORE(dstPtr, aSinglePtr) *((U_32 *)(dstPtr)) = (*U32P(aSinglePtr))
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c Mon Sep 14 05:45:00 2009
@@ -255,6 +255,8 @@
 #if defined(AIX) || defined(ZOS)
   {
     struct sf_parms parms;
+    int result;
+    int positionBack = Java_org_apache_harmony_luni_platform_OSFileSystem_seekImpl(env, thiz, fd, 0, 2);
     parms.file_descriptor = (int)fd - FD_BIAS;
     parms.file_offset = (off64_t)offset;
     parms.file_bytes = count;
@@ -262,7 +264,13 @@
     parms.header_length = 0;
     parms.trailer_data = 0;
     parms.trailer_length = 0;
-    return send_file(&socket, &parms, 0);
+    result = send_file(&socket, &parms, 0);
+    if (result == 0) {
+      Java_org_apache_harmony_luni_platform_OSFileSystem_seekImpl(env, thiz, fd, (jlong)positionBack, 1);
+      return count;
+    } else {
+      return result;
+    }
   }
 #else
   /* Value of offset is checked in jint scope (checked in java layer)

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java Mon Sep 14 05:45:00 2009
@@ -45,31 +45,17 @@
     
     private static void deleteTempFolder(File dir) {
         String files[] = dir.list();
-        for (int i = 0; i < files.length; i++) {
-            File f = new File(dir, files[i]);
-            if (f.isDirectory()) {
-                deleteTempFolder(f);
-            } else {
-                f.delete();
-            }
-        }
-        dir.delete();
-    }
-    
-    private static void cleanupTempFiles() {
-        // Delete all old temporary files
-        File tempDir = new File(System.getProperty("java.io.tmpdir"));
-        File[] files = tempDir.listFiles();
         if (files != null) {
-            for (File file : files) {
-                if (file.getName().startsWith("harmony-test")) {
-                    if (file.isDirectory()) {
-                        deleteTempFolder(file);
-                    }
-                    file.delete();
+            for (int i = 0; i < files.length; i++) {
+                File f = new File(dir, files[i]);
+                if (f.isDirectory()) {
+                    deleteTempFolder(f);
+                } else {
+                    f.delete();
                 }
             }
         }
+        dir.delete();
     }
     
     private static String addTrailingSlash(String path) {
@@ -91,8 +77,10 @@
     }
 
     protected void tearDown() {
-        tempDirectory = null;
-        cleanupTempFiles();
+        if (tempDirectory != null) {
+            deleteTempFolder(tempDirectory);
+            tempDirectory = null;
+        }
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketImplTest.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketImplTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketImplTest.java Mon Sep 14 05:45:00 2009
@@ -71,7 +71,6 @@
         // empty
     }
 
-    @Override
     public Object getOption(int optID) throws SocketException {
         return null;
     }
@@ -129,7 +128,6 @@
 
     }
 
-    @Override
     public void setOption(int optID, Object val) throws SocketException {
         // empty
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CollectionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CollectionsTest.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CollectionsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CollectionsTest.java Mon Sep 14 05:45:00 2009
@@ -41,6 +41,7 @@
 import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
+import java.util.Arrays;
 
 import org.apache.harmony.luni.internal.nls.Messages;
 import org.apache.harmony.testframework.serialization.SerializationTest;
@@ -593,6 +594,19 @@
 		testShuffle(ll2, "Random Access", false);
 	}
 
+    public void testShuffleRandomAccessWithSeededRandom() {
+        List<String> list = Arrays.asList("A", "B", "C", "D", "E", "F", "G");
+        Collections.shuffle(list, new Random(0));
+        assertEquals(Arrays.asList("B", "A", "D", "C", "G", "E", "F"), list);
+    }
+
+    public void testShuffleWithSeededRandom() {
+        List<String> list = new LinkedList<String>(Arrays.asList(
+                "A", "B", "C", "D", "E", "F", "G"));
+        Collections.shuffle(list, new Random(0));
+        assertEquals(Arrays.asList("B", "A", "D", "C", "G", "E", "F"), list);
+    }
+
 	private void testShuffle(List list, String type, boolean random) {
 		boolean sorted = true;
 		boolean allMatch = true;

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/net.resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-808406
+/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-814402

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/DirectByteBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/DirectByteBuffer.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/DirectByteBuffer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/DirectByteBuffer.java Mon Sep 14 05:45:00 2009
@@ -36,20 +36,8 @@
  */
 abstract class DirectByteBuffer extends BaseByteBuffer implements DirectBuffer {
 
-    // This class will help us track whether the address is valid or not.
-    static final class SafeAddress {
-        protected volatile boolean isValid = true;
-
-        protected final PlatformAddress address;
-
-        protected SafeAddress(PlatformAddress address) {
-            super();
-            this.address = address;
-        }
-    }
-
-    // This is a wrapped reference to the base address of the buffer memory.
-    protected final SafeAddress safeAddress;
+    // This is the base address of the buffer memory.
+    protected PlatformAddress address;
 
     // This is the offset from the base address at which this buffer logically
     // starts.
@@ -63,14 +51,13 @@
      * free the memory where possible.
      */
     DirectByteBuffer(int capacity) {
-        this(new SafeAddress(PlatformAddressFactory.alloc(capacity, (byte) 0)),
-                capacity, 0);
-        safeAddress.address.autoFree();
+        this(PlatformAddressFactory.alloc(capacity, (byte) 0), capacity, 0);
+        address.autoFree();
     }
 
-    DirectByteBuffer(SafeAddress address, int capacity, int offset) {
+    DirectByteBuffer(PlatformAddress address, int capacity, int offset) {
         super(capacity);
-        this.safeAddress = address;
+        this.address = address;
         this.offset = offset;
     }
 
@@ -212,7 +199,7 @@
     }
 
     public final boolean isAddressValid() {
-        return safeAddress.isValid;
+        return address != PlatformAddress.INVALID;
     }
 
     public final void addressValidityCheck() {
@@ -223,16 +210,12 @@
         }
     }
 
-    private void markAddressInvalid() {
-        safeAddress.isValid = false;
-    }
-
     /*
      * Answers the base address of the buffer (i.e. before offset).
      */
     public final PlatformAddress getBaseAddress() {
         addressValidityCheck();
-        return safeAddress.address;
+        return address;
     }
 
     /**
@@ -262,14 +245,15 @@
      * <code>IllegalStateException</code>.
      * <p>
      * Note this is is possible that the memory is freed by code that reaches
-     * into the address and explicitly frees it 'beneith' us -- this is bad
+     * into the address and explicitly frees it 'beneath' us -- this is bad
      * form.
      * </p>
      */
     public final void free() {
         if (isAddressValid()) {
-            markAddressInvalid();
-            safeAddress.address.free();
+            PlatformAddress a = address;
+            address = PlatformAddress.INVALID;
+            a.free();
         }
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadOnlyDirectByteBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadOnlyDirectByteBuffer.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadOnlyDirectByteBuffer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadOnlyDirectByteBuffer.java Mon Sep 14 05:45:00 2009
@@ -35,7 +35,7 @@
 
     static ReadOnlyDirectByteBuffer copy(DirectByteBuffer other, int markOfOther) {
         ReadOnlyDirectByteBuffer buf = new ReadOnlyDirectByteBuffer(
-                other.safeAddress, other.capacity(), other.offset);
+                other.address, other.capacity(), other.offset);
         buf.limit = other.limit();
         buf.position = other.position();
         buf.mark = markOfOther;
@@ -43,14 +43,9 @@
         return buf;
     }
 
-    protected ReadOnlyDirectByteBuffer(SafeAddress address, int capacity,
-            int offset) {
-        super(address, capacity, offset);
-    }
-
     protected ReadOnlyDirectByteBuffer(PlatformAddress address, int capacity,
             int offset) {
-        super(new SafeAddress(address), capacity, offset);
+        super(address, capacity, offset);
     }
 
     @Override
@@ -146,7 +141,7 @@
     @Override
     public ByteBuffer slice() {
         ReadOnlyDirectByteBuffer buf = new ReadOnlyDirectByteBuffer(
-                safeAddress, remaining(), offset + position);
+                address, remaining(), offset + position);
         buf.order = order;
         return buf;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadWriteDirectByteBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadWriteDirectByteBuffer.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadWriteDirectByteBuffer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ReadWriteDirectByteBuffer.java Mon Sep 14 05:45:00 2009
@@ -36,7 +36,7 @@
     static ReadWriteDirectByteBuffer copy(DirectByteBuffer other,
             int markOfOther) {
         ReadWriteDirectByteBuffer buf = new ReadWriteDirectByteBuffer(
-                other.safeAddress, other.capacity(), other.offset);
+                other.address, other.capacity(), other.offset);
         buf.limit = other.limit();
         buf.position = other.position();
         buf.mark = markOfOther;
@@ -48,15 +48,10 @@
         super(capacity);
     }
 
-    ReadWriteDirectByteBuffer(SafeAddress address, int capacity, int offset) {
+    ReadWriteDirectByteBuffer(PlatformAddress address, int capacity, int offset) {
         super(address, capacity, offset);
     }
 
-    ReadWriteDirectByteBuffer(PlatformAddress address, int aCapacity,
-            int anOffset) {
-        super(new SafeAddress(address), aCapacity, anOffset);
-    }
-
     @Override
     public ByteBuffer asReadOnlyBuffer() {
         return ReadOnlyDirectByteBuffer.copy(this, mark);
@@ -225,7 +220,7 @@
     @Override
     public ByteBuffer slice() {
         ReadWriteDirectByteBuffer buf = new ReadWriteDirectByteBuffer(
-                safeAddress, remaining(), offset + position);
+                address, remaining(), offset + position);
         buf.order = order;
         return buf;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/channels/Channels.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/channels/Channels.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/channels/Channels.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/channels/Channels.java Mon Sep 14 05:45:00 2009
@@ -28,7 +28,9 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
+
 import org.apache.harmony.nio.internal.IOUtil;
+import org.apache.harmony.nio.internal.nls.Messages;
 
 /**
  * This class provides several utilities to get I/O streams from channels.
@@ -242,8 +244,13 @@
         public synchronized int read(byte[] target, int offset, int length)
                 throws IOException {
             // avoid int overflow, check null target
-            if (length + offset > target.length || length < 0 || offset < 0) {
-                throw new ArrayIndexOutOfBoundsException();
+            if (offset > target.length || offset < 0) {
+                // nio.0C=Offset out of bounds \: {0}
+                throw new ArrayIndexOutOfBoundsException(Messages.getString("nio.0C", offset)); //$NON-NLS-1$
+            }
+            if (length < 0 || offset > target.length - length) {
+                // nio.0D=Length out of bounds \: {0}
+                throw new ArrayIndexOutOfBoundsException(Messages.getString("nio.0D", length)); //$NON-NLS-1$
             }
             if (0 == length) {
                 return 0;
@@ -271,9 +278,15 @@
         @Override
         public synchronized int read(byte[] target, int offset, int length)
                 throws IOException {
-            // avoid int overflow, check null target
-            if (length + offset > target.length || length < 0 || offset < 0) {
-                throw new ArrayIndexOutOfBoundsException();
+            // Force null target check first!
+            if (offset > target.length || offset < 0) {
+                // nio.0C=Offset out of bounds \: {0}
+                throw new ArrayIndexOutOfBoundsException(Messages.getString("nio.0C", offset)); //$NON-NLS-1$
+            }
+            
+            if (length < 0 || length > target.length - offset) {
+                // nio.0D=Length out of bounds \: {0}
+                throw new ArrayIndexOutOfBoundsException(Messages.getString("nio.0D", length)); //$NON-NLS-1$
             }
             if (0 == length) {
                 return 0;
@@ -306,8 +319,13 @@
         public synchronized void write(byte[] source, int offset, int length)
                 throws IOException {
             // avoid int overflow, check null source
-            if (length + offset > source.length || length < 0 || offset < 0) {
-                throw new ArrayIndexOutOfBoundsException();
+            if (offset > source.length || offset < 0) {
+                // nio.0C=Offset out of bounds \: {0}
+                throw new ArrayIndexOutOfBoundsException(Messages.getString("nio.0C", offset)); //$NON-NLS-1$
+            }
+            if (length < 0 || offset > source.length - length) {
+                // nio.0D=Length out of bounds \: {0}
+                throw new ArrayIndexOutOfBoundsException(Messages.getString("nio.0D", length)); //$NON-NLS-1$
             }
             if (0 == length) {
                 return;

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/nls/messages.properties?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/nls/messages.properties Mon Sep 14 05:45:00 2009
@@ -26,3 +26,5 @@
 nio.09=Unknown file channel type: {0}
 nio.0A=Lock position and size must be non-negative.
 nio.0B=New position must be non-negative.
+nio.0C=Offset out of bounds \: {0}
+nio.0D=Length out of bounds \: {0}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java Mon Sep 14 05:45:00 2009
@@ -539,7 +539,7 @@
                 }
             }
 
-            throw new ArrayIndexOutOfBoundsException();
+            throw new ArrayIndexOutOfBoundsException(key);
         }
 
         private E putEntry(int key, Entry<E> entry) {

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Mon Sep 14 05:45:00 2009
@@ -1711,7 +1711,7 @@
      * Regression test for Harmony-1947.
      */
     public void test_finishConnect() throws Exception {
-        SocketAddress address = new InetSocketAddress("localhost", 2046);
+        SocketAddress address = new InetSocketAddress("localhost", 0);
 
         ServerSocketChannel theServerChannel = ServerSocketChannel.open();
         ServerSocket serversocket = theServerChannel.socket();
@@ -1727,7 +1727,7 @@
             // Set the SocketChannel to non-blocking so that connect(..) does
             // not block
             channel1.configureBlocking(false);
-            boolean connected = channel1.connect(address);
+            boolean connected = channel1.connect(new InetSocketAddress("localhost",serversocket.getLocalPort()));
             if (!connected) {
                 // Now set the SocketChannel back to blocking so that
                 // finishConnect() blocks.

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile Mon Sep 14 05:45:00 2009
@@ -115,7 +115,7 @@
   ../shared/additional/x_windows_949.o 
 
 
-DLLNAME = ../libhyniochar.so
+DLLNAME = ../libhyniochar$(HY_SHLIB_SUFFIX)
 
 MDLLIBFILES += $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/depends/manifests/asm-3.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-808406
+/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-808406
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-808406
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-814402

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml Mon Sep 14 05:45:00 2009
@@ -52,7 +52,7 @@
             depends="-make-report-dir,-compile-native-tests,-run-native-tests" />
 
     <target name="copy-native-includes"
-            depends="-copy-thread-include,-copy-thread-stub-include" >
+            depends="-copy-thread-include,-copy-thread-stub-include, -copy-ascii-ebcdic-include" >
         <copy todir="${hy.hdk}/include" preservelastmodified="true">
             <fileset dir="src/main/native/include/shared">
                 <include name="hyport.h" />
@@ -92,10 +92,39 @@
         </copy>
     </target>
 
+    <target name="-copy-ascii-ebcdic-include" if="is.zos" >
+        <copy todir="${hy.hdk}/include" overwrite="yes">
+            <fileset dir="src/main/native/a2e/${hy.os.family}/headers">
+                <include name="atoe.h" />
+                <include name="ctype.h" />
+                <include name="dirent.h" />
+                <include name="dll.h" />
+                <include name="dlfcn.h" />
+                <include name="fcntl.h" />
+                <include name="grp.h" />
+                <include name="langinfo.h" />
+                <include name="locale.h" />
+                <include name="netdb.h" />
+                <include name="pwd.h" />
+                <include name="stdio.h" />
+                <include name="stdlib.h" />
+                <include name="string.h" />
+                <include name="time.h" />
+                <include name="utime.h" />
+                <include name="unistd.h" />
+                <include name="arpa\inet.h" />
+                <include name="sys\ipc.h" />
+                <include name="sys\stat.h" />
+                <include name="sys\time.h" />
+                <include name="sys\utsname.h" />
+            </fileset>
+        </copy>
+    </target>
+
     <!-- Build the portlib native components -->
     <target name="build-native"
         depends="-build-native,-build-native-thread,-build-native-thrstub,-build-native-port" />
-    <target name="-build-native">
+    <target name="-build-native" depends="-build-ascii-ebcdic">
        <!-- Build common lib -->
         <make dir="src/main/native/common/${hy.os.family}" />
 
@@ -103,6 +132,23 @@
         <make dir="src/main/native/pool/${hy.os.family}" />
     </target>
 
+    <target name="-build-ascii-ebcdic" if="is.zos" >
+        <!-- Build a2e lib for zOS platforms -->
+        <make dir="src/main/native/a2e/${hy.os.family}" />
+
+        <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
+            <fileset dir="src/main/native/a2e">
+                <include name="*${shlib.suffix}*" />
+                <exclude name="*${manifest.suffix}"/>
+            </fileset>
+        </copy>
+        <copy todir="${hy.hdk}/lib" overwrite="yes">
+            <fileset dir="src/main/native/a2e/${hy.os.family}">
+                <include name="*${linklib.suffix}" if="is.zos" />
+            </fileset>
+        </copy>
+    </target>
+
     <target name="-build-native-thread" unless="hy.skip.thr">
         <!-- Build thread dll -->
         <make dir="src/main/native/thread/${hy.os.family}" />
@@ -164,7 +210,7 @@
     </target>
 
     <!-- Clean natives -->
-    <target name="clean-native" depends="clean-native-includes">
+    <target name="clean-native" depends="clean-native-includes, -clean-native-ascii-ebcdic">
         <make dir="src/main/native/thread/${hy.os.family}" target="clean" />
         <make dir="src/main/native/thrstub/${hy.os.family}" target="clean" />
         <make dir="src/main/native/port/${hy.os.family}" target="clean" />
@@ -172,7 +218,12 @@
         <make dir="src/main/native/pool/${hy.os.family}" target="clean" />
     </target>
 
-    <target name="clean-native-includes">
+    <target name="-clean-native-ascii-ebcdic" if="is.zos" >
+        <!-- Clean a2e lib for zOS platforms -->
+        <make dir="src/main/native/a2e/${hy.os.family}" target="clean" />
+    </target>
+
+    <target name="clean-native-includes" depends="-clean-ascii-ebcdic-includes">
         <delete failonerror="false">
             <fileset dir="${hy.hdk}/include">
                 <include name="hyport.h" />
@@ -193,6 +244,35 @@
         </delete>
     </target>
 
+    <target name="-clean-ascii-ebcdic-includes" if="is.zos" >
+        <delete failonerror="false">
+            <fileset dir="${hy.hdk}/include">
+                <include name="atoe.h" />
+                <include name="ctype.h" />
+                <include name="dirent.h" />
+                <include name="dll.h" />
+                <include name="dlfcn.h" />
+                <include name="fcntl.h" />
+                <include name="grp.h" />
+                <include name="langinfo.h" />
+                <include name="locale.h" />
+                <include name="netdb.h" />
+                <include name="pwd.h" />
+                <include name="stdio.h" />
+                <include name="stdlib.h" />
+                <include name="string.h" />
+                <include name="time.h" />
+                <include name="utime.h" />
+                <include name="unistd.h" />
+                <include name="arpa\inet.h" />
+                <include name="sys\ipc.h" />
+                <include name="sys\stat.h" />
+                <include name="sys\time.h" />
+                <include name="sys\utsname.h" />
+            </fileset>
+        </delete>
+    </target>
+
     <target name="-make-report-dir">
         <mkdir dir="${tests.output}" />
     </target>
@@ -235,11 +315,15 @@
         <exec-native test="hyipcmutex" />
         <exec-native test="hymmap" />
 	
-        <move todir="${tests.output}">
+        <copy todir="${tests.output}" outputencoding="UTF-8">
             <fileset dir=".">
                 <include name="TEST-*.xml"/>
             </fileset>
-        </move>
+        </copy>
+
+        <delete>
+            <fileset dir="${hy.portlib}" includes="TEST-*.xml" />
+        </delete>
 
         <antcall target="touch-errors-file" />
     </target>

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/common/shared/strhelp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/common/shared/strhelp.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/common/shared/strhelp.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/common/shared/strhelp.c Mon Sep 14 05:45:00 2009
@@ -18,6 +18,9 @@
 #include <string.h>
 #include "hyport.h"
 #include "strhelp.h"
+#ifdef ZOS
+#include "atoe.h"
+#endif
 
 static int prop_alloc(HyPortLibrary * portLibrary, key_value_pair* property,
                       char* start, char* delim, char* end);
@@ -168,6 +171,11 @@
         return JNI_ERR;
     }
 
+#ifdef ZOS
+    /* Convert the scan buffer into ASCII */
+    scanCursor = e2a(scanCursor, seekResult);
+#endif
+
     fileSize = (IDATA) seekResult;
     arraySize = fileSize/50 + 1;
     props = hymem_allocate_memory(sizeof(key_value_pair)*(arraySize + 1));

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/include/shared/hyport.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/include/shared/hyport.h?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/include/shared/hyport.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/include/shared/hyport.h Mon Sep 14 05:45:00 2009
@@ -1046,6 +1046,7 @@
 #define HYPORT_CAPABILITY_SOCKETS  4
 #define HYPORT_CAPABILITY_LARGE_PAGE_SUPPORT  8
 #define HYPORT_MMAP_CAPABILITY_COPYONWRITE  1
+#define HYPORT_MMAP_CAPABILITY_READ  2
 #define HYPORT_MMAP_FLAG_CREATE_FILE  1
 #define HYPORT_MMAP_FLAG_READ  2
 #define HYPORT_MMAP_FLAG_WRITE  4

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hynls.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hynls.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hynls.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hynls.c Mon Sep 14 05:45:00 2009
@@ -34,6 +34,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef ZOS
+#include <iconv.h>
+#endif
+
 #define CDEV_CURRENT_FUNCTION _prototypes_private
 static const char *nlsh_lookup (struct HyPortLibrary *portLibrary,
                                 U_32 module_name, U_32 message_num);
@@ -1233,6 +1237,11 @@
   char temp[BUF_SIZE];
   IDATA count, nbytes = bufsize;
   char *cursor = buf;
+#ifdef ZOS
+	iconv_t converter;
+	size_t inbytesleft, outbytesleft;
+	char* inbuf, *outbuf;
+#endif
 
   if (nbytes <= 0)
     return 0;
@@ -1240,6 +1249,14 @@
   /* discount 1 for the trailing NUL */
   nbytes -= 1;
 
+#ifdef ZOS
+/* iconv_open is not an a2e function, so we need to pass it EBCDIC strings */
+#pragma convlit(suspend)
+	converter = iconv_open("UTF-8", "IBM-1047");
+#pragma convlit(resume)
+	if ( converter == (iconv_t)-1 ) return NULL;
+#endif
+
   while (nbytes)
     {
       count = BUF_SIZE > nbytes ? nbytes : BUF_SIZE;
@@ -1247,21 +1264,44 @@
 
       if (count < 0)
         {
-
+#ifdef ZOS
+          iconv_close(converter);
+#endif
           /* if we've made it through a successful read, return the buf. */
           if (nbytes + 1 != bufsize)
             return buf;
           return NULL;
         }
 
+#ifdef ZOS
+		inbuf = temp;
+		inbytesleft = count;
+		outbuf = cursor;
+		outbytesleft = nbytes;
+		if ( (size_t)-1 == iconv(converter, &inbuf, &inbytesleft, &outbuf, &outbytesleft) || inbytesleft == count ) {
+			/* conversion failed */
+			iconv_close(converter);
+			portLibrary->file_seek(portLibrary, fd, -1 * count, HySeekCur);
+			return NULL;
+		}
+		if ( inbytesleft > 0 ) {
+			portLibrary->file_seek(portLibrary, fd, inbytesleft - count, HySeekCur);
+		}
+		nbytes -= count - inbytesleft;
+		cursor += count - inbytesleft;
+#else 
       memcpy (cursor, temp, count);
       cursor += count;
       nbytes -= count;
-
+#endif /* ZOS */
     }
 
   *cursor = '\0';
 
+#ifdef ZOS
+	if ( converter != (iconv_t)-1 ) iconv_close(converter);
+#endif
+
   return buf;
 }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hyport.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hyport.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hyport.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/shared/hyport.c Mon Sep 14 05:45:00 2009
@@ -24,6 +24,9 @@
 #include "hyport.h"
 #include "portpriv.h"
 #include "hyportpg.h"
+#ifdef ZOS
+#include "atoe.h"
+#endif
 
 /**
  * Initialize the port library.
@@ -45,7 +48,15 @@
   /* return value of 0 is success */
   I_32 rc;
 
+#if defined(ZOS)
+  /* Initialise the ascii2ebcdic functions if it has not already been done */
+  rc = iconv_init();
+
+  if (rc ==0)
+#endif
+  {
   rc = hyport_create_library (portLibrary, version, size);
+  }
   
   if (rc == 0)
     {

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c Mon Sep 14 05:45:00 2009
@@ -49,6 +49,18 @@
 #include "portpriv.h"
 #include "hyportpg.h"
 
+#if defined(ZOS)
+#include <sys/ps.h>
+#include <sys/types.h>
+#include "atoe.h"
+
+#if !defined(PATH_MAX) 
+/* This is a somewhat arbitrarily selected fixed buffer size. */
+#define PATH_MAX 1024
+#endif
+
+#endif
+
 #define CDEV_CURRENT_FUNCTION _prototypes_private
 #if !defined(FREEBSD)
 static IDATA readSymbolicLink (struct HyPortLibrary *portLibrary,
@@ -191,7 +203,11 @@
       char *buffer;
       struct utsname sysinfo;
 
+#if !defined(ZOS)
       rc = uname (&sysinfo);
+#else /* !defined(ZOS) */
+      rc = __osname(&sysinfo);
+#endif /* !defined(ZOS) */
 
       if (rc >= 0)
         {
@@ -232,13 +248,18 @@
       int rc;
       struct utsname sysinfo;
 
+#if !defined(ZOS)
       rc = uname (&sysinfo);
+#else /* !defined(ZOS) */
+      rc = __osname(&sysinfo);
+#endif /* !defined(ZOS) */
 
       if (rc >= 0)
         {
           int len;
           char *buffer;
 
+#if !defined(ZOS)
           len = strlen (sysinfo.release) + 1;
           buffer = portLibrary->mem_allocate_memory (portLibrary, len);
           if (NULL == buffer)
@@ -247,6 +268,14 @@
             }
           strncpy (buffer, sysinfo.release, len);
           buffer[len - 1] = '\0';
+#else /* !defined(ZOS) */
+			len = strlen(sysinfo.version) + strlen(sysinfo.release) + 2; /* "." and terminating null character */
+			buffer = portLibrary->mem_allocate_memory(portLibrary, len);
+			if (NULL == buffer) {
+				return NULL;
+			}
+			sprintf(buffer, "%s.%s", sysinfo.version, sysinfo.release);
+#endif /* !defined(ZOS) */
 
           PPG_si_osVersion = buffer;
         }
@@ -334,6 +363,7 @@
   char *currentPath = NULL;
   char *originalWorkingDirectory = NULL;
 
+#if !defined(ZOS)
   if (!argv0)
     {
       return -1;
@@ -344,6 +374,39 @@
     {
       strcpy (currentPath, argv0);
     }
+#else /* !defined(ZOS) */
+    char *e2aName = NULL;
+	int token = 0;
+	W_PSPROC buf;
+	pid_t mypid = getpid();
+
+	memset(&buf, 0x00, sizeof(buf));
+	buf.ps_pathptr   = portLibrary->mem_allocate_memory(portLibrary, buf.ps_pathlen = PS_PATHBLEN);
+	if (buf.ps_pathptr   == NULL) {
+		retval = -1;
+		goto cleanup;
+	}
+	while ((token = w_getpsent(token, &buf, sizeof(buf))) > 0) {
+		if (buf.ps_pid == mypid) {
+            e2aName = e2a_func(buf.ps_pathptr, strlen(buf.ps_pathptr)+1);
+			break;
+		}
+	}
+
+    /* Return val of w_getpsent == -1 indicates error, == 0 indicates no more processes */
+	if (token <= 0) {
+		retval = -1;
+		goto cleanup;
+	}
+
+	currentPath = (portLibrary->mem_allocate_memory) (portLibrary, strlen(e2aName) + 1);
+	if (currentPath) {
+		strcpy(currentPath, e2aName);
+	}
+    portLibrary->mem_free_memory(portLibrary, buf.ps_pathptr);
+    free(e2aName);
+#endif /* !defined(ZOS) */
+
   if (!currentPath)
     {
       retval = -1;
@@ -678,8 +741,7 @@
 #if defined(LINUX) || defined(FREEBSD)
   /* returns number of online(_SC_NPROCESSORS_ONLN) processors, number configured(_SC_NPROCESSORS_CONF) may  be more than online */
   return sysconf (_SC_NPROCESSORS_ONLN);
-#else
-#if defined(MACOSX)
+#elif defined(MACOSX)
   /* derived from examples in the sysctl(3) man page from FreeBSD */
   int mib[2], ncpu;
   size_t len;
@@ -693,8 +755,6 @@
 #else
   return 0;
 #endif
-#endif
-
 }
 
 #undef CDEV_CURRENT_FUNCTION
@@ -722,6 +782,9 @@
   sysctl(mib, 2, &mem, &len, NULL, 0);
   return (U_64)mem;
 
+#elif defined(ZOS)
+	/* TODO: implement. Currently this function is unused. */
+	return 0;
 #else
   IDATA pagesize, num_pages;
 
@@ -866,23 +929,39 @@
 hysysinfo_get_username (struct HyPortLibrary * portLibrary, char *buffer,
                         UDATA length)
 {
+  char *remoteCopy = NULL;
+#if defined(ZOS)
+  char *loginID = getlogin();
+  if (NULL != loginID) {
+    struct passwd *userDescription = getpwnam(loginID);
+    if (NULL != userDescription) {
+      remoteCopy = userDescription->pw_name;
+    }
+  }
+	/* there exist situations where one of the above calls will fail.  Fall through to the Unix solution for those cases */
+#endif
+
+  if (NULL == remoteCopy) {
   uid_t uid = getuid ();
-  int nameLen;
   struct passwd *pwent = getpwuid (uid);
 
-  if (pwent == NULL)
+    if (pwent != NULL)
     {
-      return -1;
+      remoteCopy = pwent->pw_name;
     }
-
-  nameLen = strlen (pwent->pw_name);
+  }
+  if (NULL == remoteCopy) {
+    return -1;
+  } else {
+    size_t nameLen = strlen (remoteCopy);
 
   if ((nameLen + 1) > length)
     {
       return nameLen + 1;
     }
 
-  portLibrary->str_printf (portLibrary, buffer, length, "%s", pwent->pw_name);
+    portLibrary->str_printf (portLibrary, buffer, length, "%s", remoteCopy);
+  }
 
   return 0;
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml Mon Sep 14 05:45:00 2009
@@ -58,10 +58,6 @@
                 <include name="*${progdb.suffix}*" if="is.windows" />
                 <exclude name="*${manifest.suffix}"/>
             </fileset>
-            <!-- Copy link exports file on z/OS -->
-            <fileset dir="src/main/native/prefs/${hy.os.family}">
-                <include name="*${linklib.suffix}*" if="is.zos" />
-            </fileset>
         </copy>
     </target>
 

Modified: harmony/enhanced/classlib/branches/java6/modules/print/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/build.xml?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/build.xml Mon Sep 14 05:45:00 2009
@@ -96,12 +96,6 @@
                 <exclude name="*${manifest.suffix}"/>
             </fileset>
         </copy>
-        <!-- Copy link exports file on z/OS -->
-        <copy todir="${hy.hdk}/lib" preservelastmodified="true">
-            <fileset dir="src/main/native/print/${hy.os.family}">
-                <include name="*${linklib.suffix}" if="is.zos" />
-            </fileset>
-        </copy>
     </target>
 
     <target name="build-jar" depends="svn-info,class-patternset">

Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF Mon Sep 14 05:45:00 2009
@@ -9,7 +9,6 @@
 Bundle-Name: Harmony RMI
 Bundle-SymbolicName: org.apache.harmony.rmi
 Bundle-Version: 1.0.0
-Bundle-ClassPath: .
 Eclipse-JREBundle: true
 Import-Package: java.io,
  java.lang,
@@ -31,4 +30,7 @@
  java.rmi.registry,
  java.rmi.server,
  javax.activity,
- org.apache.harmony.rmi.transport;hy_usage="suncompat";mandatory:="hy_usage"
+ org.apache.harmony.rmi.activation,
+ org.apache.harmony.rmi.compiler,
+ org.apache.harmony.rmi.registry,
+ org.apache.harmony.rmi.transport;hy_usage=suncompat;mandatory:=hy_usage

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java:768152-808406
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java:768152-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java:768152-808406
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java:768152-814402

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/parser/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 05:45:00 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/parser:768152-808406
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/parser:768152-814402

Modified: harmony/enhanced/classlib/branches/java6/modules/text/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/META-INF/MANIFEST.MF?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/META-INF/MANIFEST.MF Mon Sep 14 05:45:00 2009
@@ -18,11 +18,10 @@
  java.lang,
  java.lang.reflect,
  java.math,
- java.net,
+ java.net;resolution:=optional,
  java.security,
  java.util,
  java.util.spi,
  org.apache.harmony.kernel.vm,
- org.apache.harmony.luni.util,
  org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional
 Export-Package: java.text

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/BreakIterator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/BreakIterator.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/BreakIterator.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/BreakIterator.java Mon Sep 14 05:45:00 2009
@@ -19,6 +19,8 @@
 
 import java.util.Locale;
 
+import org.apache.harmony.text.internal.nls.Messages;
+
 /**
  * Locates boundaries in text. This class defines a protocol for objects that
  * break up a piece of natural-language text according to a set of criteria.
@@ -538,11 +540,10 @@
      *             greater than the length of {@code buf}.
      */
     protected static long getLong(byte[] buf, int offset) {
-        if (null == buf) {
-            throw new NullPointerException();
-        }
-        if (offset < 0 || buf.length - offset < LONG_LENGTH) {
-            throw new ArrayIndexOutOfBoundsException();
+        // Force a buf null check first!
+        if (buf.length - offset < LONG_LENGTH || offset < 0) {
+            // text.1E=Offset out of bounds \: {0}
+            throw new ArrayIndexOutOfBoundsException(Messages.getString("text.1E", offset)); //$NON-NLS-1$
         }
         long result = 0;
         for (int i = offset; i < offset + LONG_LENGTH; i++) {
@@ -567,11 +568,10 @@
      *             greater than the length of {@code buf}.
      */
     protected static int getInt(byte[] buf, int offset) {
-        if (null == buf) {
-            throw new NullPointerException();
-        }
-        if (offset < 0 || buf.length - INT_LENGTH < offset) {
-            throw new ArrayIndexOutOfBoundsException();
+        // Force buf null check first!
+        if (buf.length - INT_LENGTH < offset || offset < 0) {
+            // text.1E=Offset out of bounds \: {0}
+            throw new ArrayIndexOutOfBoundsException(Messages.getString("text.1E", offset)); //$NON-NLS-1$
         }
         int result = 0;
         for (int i = offset; i < offset + INT_LENGTH; i++) {
@@ -596,11 +596,10 @@
      *             greater than the length of {@code buf}.
      */
     protected static short getShort(byte[] buf, int offset) {
-        if (null == buf) {
-            throw new NullPointerException();
-        }
-        if (offset < 0 || buf.length - SHORT_LENGTH < offset) {
-            throw new ArrayIndexOutOfBoundsException();
+        // Force buf null check first!
+        if (buf.length - SHORT_LENGTH < offset || offset < 0) {
+            // text.1E=Offset out of bounds \: {0}
+            throw new ArrayIndexOutOfBoundsException(Messages.getString("text.1E", offset)); //$NON-NLS-1$
         }
         short result = 0;
         for (int i = offset; i < offset + SHORT_LENGTH; i++) {

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Collator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Collator.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Collator.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Collator.java Mon Sep 14 05:45:00 2009
@@ -18,12 +18,11 @@
 package java.text;
 
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Comparator;
 import java.util.Locale;
 import java.util.Vector;
 
-import org.apache.harmony.luni.util.PriviAction;
-
 /**
  * Performs locale-sensitive string comparison. A concrete subclass,
  * {@link RuleBasedCollator}, allows customization of the collation ordering by
@@ -159,7 +158,11 @@
     static {
         // CACHE_SIZE includes key and value, so needs to be double
         String cacheSize = AccessController
-                .doPrivileged(new PriviAction<String>("collator.cache")); //$NON-NLS-1$
+                .doPrivileged(new PrivilegedAction<String>() {
+                    public String run() {
+                        return System.getProperty("collator.cache"); //$NON-NLS-1$
+                    }
+                });
         if (cacheSize != null) {
             try {
                 CACHE_SIZE = Integer.parseInt(cacheSize);

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/DateFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/DateFormat.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/DateFormat.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/DateFormat.java Mon Sep 14 05:45:00 2009
@@ -649,7 +649,7 @@
     public Date parse(String string) throws ParseException {
         ParsePosition position = new ParsePosition(0);
         Date date = parse(string, position);
-        if (position.getErrorIndex() != -1 || position.getIndex() == 0) {
+        if (position.getIndex() == 0) {
             // text.19=Unparseable date: {0}
             throw new ParseException(
                     Messages.getString("text.19", string), position.getErrorIndex()); //$NON-NLS-1$

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Format.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Format.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Format.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Format.java Mon Sep 14 05:45:00 2009
@@ -185,8 +185,10 @@
     public Object parseObject(String string) throws ParseException {
         ParsePosition position = new ParsePosition(0);
         Object result = parseObject(string, position);
-        if (position.getErrorIndex() != -1 || position.getIndex() == 0) {
-            throw new ParseException(null, position.getErrorIndex());
+        if (position.getIndex() == 0) {
+            // text.1C=Format.parseObject(String) parse failure
+            throw new ParseException(
+                    Messages.getString("text.1C"), position.getErrorIndex()); //$NON-NLS-1$
         }
         return result;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java Mon Sep 14 05:45:00 2009
@@ -857,8 +857,10 @@
     public Object[] parse(String string) throws ParseException {
         ParsePosition position = new ParsePosition(0);
         Object[] result = parse(string, position);
-        if (position.getErrorIndex() != -1 || position.getIndex() == 0) {
-            throw new ParseException(null, position.getErrorIndex());
+        if (position.getIndex() == 0) {
+            // text.1B=MessageFormat.parseObject(String) parse failure
+            throw new ParseException(
+                    Messages.getString("text.1B"), position.getErrorIndex()); //$NON-NLS-1$
         }
         return result;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/NumberFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/NumberFormat.java?rev=814478&r1=814477&r2=814478&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/NumberFormat.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/NumberFormat.java Mon Sep 14 05:45:00 2009
@@ -540,8 +540,10 @@
     public Number parse(String string) throws ParseException {
         ParsePosition pos = new ParsePosition(0);
         Number number = parse(string, pos);
-        if (pos.getErrorIndex() != -1 || pos.getIndex() == 0) {
-            throw new ParseException(null, pos.getErrorIndex());
+        if (pos.getIndex() == 0) {
+            // text.1D=Unparseable number: {0}
+            throw new ParseException(
+                    Messages.getString("text.1D", string), pos.getErrorIndex()); //$NON-NLS-1$
         }
         return number;
     }



Mime
View raw message