harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qi...@apache.org
Subject svn commit: r676530 [3/3] - in /harmony/enhanced/classlib/branches/java6: depends/build/platform/ depends/oss/ modules/awt/src/main/native/lcmm/shared/ modules/awt/src/main/native/oglwrapper/shared/ modules/beans/src/main/java/java/beans/ modules/beans...
Date Mon, 14 Jul 2008 09:43:37 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/NotYetBoundExceptionTest.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/NotYetBoundExceptionTest.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/NotYetBoundExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/NotYetBoundExceptionTest.java Mon Jul 14 02:43:27 2008
@@ -25,6 +25,16 @@
  * Tests for NotYetBoundException
  */
 public class NotYetBoundExceptionTest extends TestCase {
+    
+    /**
+     * @tests {@link java.nio.channels.NotYetBoundException#NotYetBoundException()}
+     */
+    public void test_Constructor() {
+        NotYetBoundException e = new NotYetBoundException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
     /**
      * @tests serialization/deserialization compatibility.

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/NotYetConnectedExceptionTest.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/NotYetConnectedExceptionTest.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/NotYetConnectedExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/NotYetConnectedExceptionTest.java Mon Jul 14 02:43:27 2008
@@ -25,6 +25,16 @@
  * Tests for NotYetConnectedException
  */
 public class NotYetConnectedExceptionTest extends TestCase {
+    
+    /**
+     * @tests {@link java.nio.channels.NotYetConnectedException#NotYetConnectedException()}
+     */
+    public void test_Constructor() {
+        NotYetConnectedException e = new NotYetConnectedException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
     /**
      * @tests serialization/deserialization compatibility.

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/OverlappingFileLockExceptionTest.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/OverlappingFileLockExceptionTest.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/OverlappingFileLockExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/OverlappingFileLockExceptionTest.java Mon Jul 14 02:43:27 2008
@@ -25,6 +25,16 @@
  * Tests for OverlappingFileLockException
  */
 public class OverlappingFileLockExceptionTest extends TestCase {
+    
+    /**
+     * @tests {@link java.nio.channels.OverlappingFileLockException#OverlappingFileLockException()}
+     */
+    public void test_Constructor() {
+        OverlappingFileLockException e = new OverlappingFileLockException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
     /**
      * @tests serialization/deserialization compatibility.

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/UnresolvedAddressExceptionTest.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/UnresolvedAddressExceptionTest.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/UnresolvedAddressExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/UnresolvedAddressExceptionTest.java Mon Jul 14 02:43:27 2008
@@ -25,6 +25,16 @@
  * Tests for UnresolvedAddressException
  */
 public class UnresolvedAddressExceptionTest extends TestCase {
+    
+    /**
+     * @tests {@link java.nio.channels.UnresolvedAddressException#UnresolvedAddressException()}
+     */
+    public void test_Constructor() {
+        UnresolvedAddressException e = new UnresolvedAddressException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
     /**
      * @tests serialization/deserialization compatibility.

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/UnsupportedAddressTypeExceptionTest.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/UnsupportedAddressTypeExceptionTest.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/UnsupportedAddressTypeExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/UnsupportedAddressTypeExceptionTest.java Mon Jul 14 02:43:27 2008
@@ -25,6 +25,16 @@
  * Tests for UnsupportedAddressTypeException
  */
 public class UnsupportedAddressTypeExceptionTest extends TestCase {
+    
+    /**
+     * @tests {@link java.nio.channels.UnsupportedAddressTypeException#UnsupportedAddressTypeException()}
+     */
+    public void test_Constructor() {
+        UnsupportedAddressTypeException e = new UnsupportedAddressTypeException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
     /**
      * @tests serialization/deserialization compatibility.

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java Mon Jul 14 02:43:27 2008
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.harmony.pack200.Codec;
@@ -29,6 +30,7 @@
 import org.apache.harmony.unpack200.bytecode.CPClass;
 import org.apache.harmony.unpack200.bytecode.CodeAttribute;
 import org.apache.harmony.unpack200.bytecode.ExceptionTableEntry;
+import org.apache.harmony.unpack200.bytecode.NewAttribute;
 import org.apache.harmony.unpack200.bytecode.OperandManager;
 
 /**
@@ -424,7 +426,19 @@
                     CodeAttribute codeAttr = new CodeAttribute(maxStack,
                             maxLocal, methodByteCodePacked[c][m], segment,
                             operandManager, exceptionTable);
-                    methodAttributes[c][m].add(codeAttr);
+                    ArrayList methodAttributesList = methodAttributes[c][m];
+                    // Make sure we add the code attribute in the right place
+                    int indexForCodeAttr = 0;
+                    for (Iterator iterator = methodAttributesList.iterator(); iterator
+                            .hasNext();) {
+                        Attribute attribute = (Attribute) iterator.next();
+                        if((attribute instanceof NewAttribute && ((NewAttribute)attribute).getLayoutIndex() < 15)) {
+                            indexForCodeAttr ++;
+                        } else {
+                            break;
+                        }
+                    }
+                    methodAttributesList.add(indexForCodeAttr, codeAttr);
                     codeAttr.renumber(codeAttr.byteCodeOffsets);
                     ArrayList currentAttributes = (ArrayList) orderedCodeAttributes
                             .get(i);

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java Mon Jul 14 02:43:27 2008
@@ -379,6 +379,16 @@
         for (int i = 0; i < methodAttributes.length; i++) {
             for (int j = 0; j < methodAttributes[i].length; j++) {
                 long flag = methodFlags[i][j];
+             // Non-predefined attributes
+                for (int k = 0; k < otherLayouts.length; k++) {
+                    if (otherLayouts[k] != null
+                            && otherLayouts[k].matches(flag)
+                            && otherLayouts[k].getIndex() < 15) {
+                        // Add the next attribute
+                        methodAttributes[i][j].add(otherAttributes[k].get(0));
+                        otherAttributes[k].remove(0);
+                    }
+                }
                 if (deprecatedLayout.matches(flag)) {
                     methodAttributes[i][j].add(new DeprecatedAttribute());
                 }
@@ -404,16 +414,17 @@
                     // be e.g. KIB or KIH
                     if (type.equals("B") || type.equals("H"))
                         type = "I";
-                    ClassFileEntry value = methodSignatureLayout.getValue(
+                    CPUTF8 value = (CPUTF8) methodSignatureLayout.getValue(
                             result, type, cpBands.getConstantPool());
                     methodAttributes[i][j]
-                            .add(new ConstantValueAttribute(value));
+                            .add(new SignatureAttribute(value));
                     methodSignatureIndex++;
                 }
                 // Non-predefined attributes
                 for (int k = 0; k < otherLayouts.length; k++) {
                     if (otherLayouts[k] != null
-                            && otherLayouts[k].matches(flag)) {
+                            && otherLayouts[k].matches(flag)
+                            && otherLayouts[k].getIndex() >= 15) {
                         // Add the next attribute
                         methodAttributes[i][j].add(otherAttributes[k].get(0));
                         otherAttributes[k].remove(0);
@@ -613,7 +624,7 @@
                         className = className.substring(0, index);
                     }
                     // Add .java to the end
-                    value = cpBands.cpUTF8Value(className + ".java", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, false);
+                    value = cpBands.cpUTF8Value(className + ".java", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, true);
                 }
                 classAttributes[i].add(new SourceFileAttribute((CPUTF8)value));
                 sourceFileIndex++;
@@ -621,17 +632,20 @@
             if (enclosingMethodLayout.matches(flag)) {
                 CPClass theClass = cpBands
                         .cpClassValue(enclosingMethodRC[enclosingMethodIndex]);
-                CPNameAndType theMethod = cpBands
-                        .cpNameAndTypeValue(enclosingMethodRDN[enclosingMethodIndex]);
+                CPNameAndType theMethod = null;
+                if(enclosingMethodRDN[enclosingMethodIndex] != 0) {
+                    theMethod = cpBands
+                            .cpNameAndTypeValue(enclosingMethodRDN[enclosingMethodIndex] - 1);
+                }
                 classAttributes[i].add(new EnclosingMethodAttribute(theClass,
                         theMethod));
                 enclosingMethodIndex++;
             }
             if (signatureLayout.matches(flag)) {
                 long result = classSignature[signatureIndex];
-                ClassFileEntry value = signatureLayout.getValue(result, cpBands
+                CPUTF8 value = (CPUTF8) signatureLayout.getValue(result, cpBands
                         .getConstantPool());
-                classAttributes[i].add(new ConstantValueAttribute(value));
+                classAttributes[i].add(new SignatureAttribute(value));
                 signatureIndex++;
             }
             if (innerClassLayout.matches(flag)) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/CpBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/CpBands.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/CpBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/CpBands.java Mon Jul 14 02:43:27 2008
@@ -356,6 +356,11 @@
             }
             cpSignature[i] = signature.toString();
         }
+        for (int i = 0; i < cpSignatureInts.length; i++) {
+            if(cpSignatureInts[i] == -1) {
+                cpSignatureInts[i] = search(cpUTF8, cpSignature[i]);
+            }
+        }
     }
 
     /**
@@ -697,9 +702,11 @@
     }
 
     public CPUTF8 cpSignatureValue(int index, int domain) {
-        int globalIndex = index + signatureOffset;
+        int globalIndex;
         if(cpSignatureInts[index] != -1) {
             globalIndex = cpSignatureInts[index];
+        } else {
+            globalIndex = index + signatureOffset;
         }
         if (stringsToCPUTF8[domain] == null) {
             stringsToCPUTF8[domain] = new HashMap();

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java Mon Jul 14 02:43:27 2008
@@ -100,7 +100,8 @@
     private Attribute getOneAttribute(int index, List elements) {
         NewAttribute attribute = new NewAttribute(segment.getCpBands()
                 .cpUTF8Value(attributeLayout.getName(),
-                        ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ));
+                        ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ),
+                attributeLayout.getIndex());
         for (Iterator iter = elements.iterator(); iter.hasNext();) {
             AttributeLayoutElement element = (AttributeLayoutElement) iter
                     .next();

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java Mon Jul 14 02:43:27 2008
@@ -220,14 +220,12 @@
                     .getMethodFlags()[classNum][i], classBands
                     .getMethodAttributes()[classNum][i]));
         }
+        cp.addNestedEntries();
 
         // add inner class attribute (if required)
         boolean addInnerClassesAttr = false;
         IcTuple[] ic_local = getClassBands().getIcLocal()[classNum];
-        boolean ic_local_sent = false;
-        if (ic_local != null) {
-            ic_local_sent = true;
-        }
+        boolean ic_local_sent = ic_local != null;
         InnerClassesAttribute innerClassesAttribute = new InnerClassesAttribute(
                 "InnerClasses");
         IcTuple[] ic_relevant = getIcBands().getRelevantIcTuples(fullName, cp);
@@ -288,9 +286,8 @@
             }
             newAttrs[newAttrs.length - 1] = innerClassesAttribute;
             classFile.attributes = newAttrs;
-            cp.add(innerClassesAttribute);
+            cp.addWithNestedEntries(innerClassesAttribute);
         }
-        cp.addNestedEntries();
         // sort CP according to cp_All
         cp.resolve(this);
         // NOTE the indexOf is only valid after the cp.resolve()

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java Mon Jul 14 02:43:27 2008
@@ -373,4 +373,8 @@
     public int[] getRewrite() {
         return rewrite;
     }
+
+    public boolean nestedMustStartClassPool() {
+        return byteCodeForm.nestedMustStartClassPool();
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java Mon Jul 14 02:43:27 2008
@@ -52,6 +52,8 @@
     protected HashSet entriesContainsSet = new HashSet();
     protected HashSet othersContainsSet = new HashSet();
 
+    private final HashSet mustStartClassPool = new HashSet();
+
     protected Map indexCache = null;
 
     public String toString() {
@@ -117,6 +119,11 @@
             ClassFileEntry entry = (ClassFileEntry) iterator.next();
             ClassFileEntry[] nestedEntries = entry.getNestedClassFileEntries();
             newEntries.addAll(Arrays.asList(nestedEntries));
+            if(entry instanceof ByteCode) {
+                if(((ByteCode)entry).nestedMustStartClassPool()) {
+                    mustStartClassPool.addAll(Arrays.asList(nestedEntries));
+                }
+            }
         }
         for (Iterator iterator = newEntries.iterator(); iterator.hasNext();) {
             add((ClassFileEntry) iterator.next());
@@ -256,7 +263,7 @@
         ArrayList finalSort = new ArrayList();
         while (it.hasNext()) {
             ClassFileEntry nextEntry = (ClassFileEntry) it.next();
-            if (nextEntry.mustStartClassPool()) {
+            if (mustStartClassPool.contains(nextEntry)) {
                 startOfPool.add(nextEntry);
             } else {
                 finalSort.add(nextEntry);

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java Mon Jul 14 02:43:27 2008
@@ -58,14 +58,4 @@
         doWrite(dos);
     }
 
-    /**
-     * Answer true if the receiver must be at the beginning of the class pool
-     * (because it is the target of a single-byte ldc command). Otherwise answer
-     * false.
-     * 
-     * @return boolean true if the receiver must be under 256; otherwise false.
-     */
-    public boolean mustStartClassPool() {
-        return false;
-    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java Mon Jul 14 02:43:27 2008
@@ -169,6 +169,12 @@
 
     public void addAttribute(Attribute attribute) {
         attributes.add(attribute);
+        if(attribute instanceof LocalVariableTableAttribute) {
+            ((LocalVariableTableAttribute)attribute).setCodeLength(codeLength);
+        }
+        if(attribute instanceof LocalVariableTypeTableAttribute) {
+            ((LocalVariableTypeTableAttribute)attribute).setCodeLength(codeLength);
+        }
     }
 
     public List attributes() {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java Mon Jul 14 02:43:27 2008
@@ -87,30 +87,6 @@
 
     protected abstract void writeBody(DataOutputStream dos) throws IOException;
 
-    private boolean mustStartClassPool = false;
-
-    /**
-     * Set whether the receiver must be at the start of the class pool. Anything
-     * which is the target of a single- byte ldc (bytecode 18) command must be
-     * at the start of the class pool.
-     * 
-     * @param b
-     *            boolean true if the receiver must be at the start of the class
-     *            pool, otherwise false.
-     */
-    public void mustStartClassPool(boolean b) {
-        mustStartClassPool = b;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.harmony.unpack200.bytecode.ClassFileEntry#mustStartClassPool()
-     */
-    public boolean mustStartClassPool() {
-        return mustStartClassPool;
-    }
-
     public int getGlobalIndex() {
         return globalIndex;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java Mon Jul 14 02:43:27 2008
@@ -37,6 +37,14 @@
         this.method = method;
     }
 
+    protected ClassFileEntry[] getNestedClassFileEntries() {
+        if(method != null) {
+            return new ClassFileEntry[] {attributeName, cpClass, method};
+        } else {
+            return new ClassFileEntry[] {attributeName, cpClass};
+        }
+    }
+
     /*
      * (non-Javadoc)
      * 
@@ -50,8 +58,12 @@
         super.resolve(pool);
         cpClass.resolve(pool);
         class_index = pool.indexOf(cpClass);
-        method.resolve(pool);
-        method_index = pool.indexOf(method);
+        if(method != null) {
+            method.resolve(pool);
+            method_index = pool.indexOf(method);
+        } else {
+            method_index = 0;
+        }
     }
 
     /*

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java Mon Jul 14 02:43:27 2008
@@ -36,6 +36,7 @@
     private final int[] indexes;
     private final CPUTF8[] names;
     private final CPUTF8[] descriptors;
+    private int codeLength;
     private static final CPUTF8 attributeName = new CPUTF8(
             "LocalVariableTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
 
@@ -51,6 +52,11 @@
         this.indexes = indexes;
     }
 
+
+    public void setCodeLength(int length) {
+        codeLength = length;
+    }
+
     protected int getLength() {
         return 2 + (10 * local_variable_table_length);
     }
@@ -123,10 +129,7 @@
         // real length = end_pc - start_pc
         // special case if end_pc is beyond end of bytecode array
 
-        // First figure out the maximum size of the byteCodeOffsets array
-        int lastInstruction = ((Integer) byteCodeOffsets.get(byteCodeOffsets
-                .size() - 1)).intValue();
-        int maxSize = lastInstruction + 1;
+        int maxSize = codeLength;
 
         // Iterate through the lengths and update each in turn.
         // This is done in place in the lengths array.

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java Mon Jul 14 02:43:27 2008
@@ -18,11 +18,15 @@
 
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.harmony.unpack200.Pack200Exception;
 
 /**
  * Local variable type table.
  */
-public class LocalVariableTypeTableAttribute extends Attribute {
+public class LocalVariableTypeTableAttribute extends BCIRenumberedAttribute {
 
     private int local_variable_type_table_length;
     private final int[] start_pcs;
@@ -32,6 +36,7 @@
     private final int[] indexes;
     private final CPUTF8[] names;
     private final CPUTF8[] signatures;
+    private int codeLength;
     private static final CPUTF8 attributeName = new CPUTF8(
             "LocalVariableTypeTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
 
@@ -47,6 +52,10 @@
         this.indexes = indexes;
     }
 
+    public void setCodeLength(int length) {
+        codeLength = length;
+    }
+
     protected int getLength() {
         return 2 + (10 * local_variable_type_table_length);
     }
@@ -74,6 +83,80 @@
         }
     }
 
+    protected ClassFileEntry[] getNestedClassFileEntries() {
+        ArrayList nestedEntries = new ArrayList();
+        nestedEntries.add(getAttributeName());
+        for (int i = 0; i < local_variable_type_table_length; i++) {
+            nestedEntries.add(names[i]);
+            nestedEntries.add(signatures[i]);
+        }
+        ClassFileEntry[] nestedEntryArray = new ClassFileEntry[nestedEntries
+                .size()];
+        nestedEntries.toArray(nestedEntryArray);
+        return nestedEntryArray;
+    }
+    
+    protected int[] getStartPCs() {
+        return start_pcs;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.harmony.unpack200.bytecode.BCIRenumberedAttribute#renumber(java.util.List)
+     */
+    public void renumber(List byteCodeOffsets) throws Pack200Exception {
+        // Remember the unrenumbered start_pcs, since that's used later
+        // to calculate end position.
+        int[] unrenumbered_start_pcs = new int[start_pcs.length];
+        System.arraycopy(start_pcs, 0, unrenumbered_start_pcs, 0,
+                start_pcs.length);
+
+        // Next renumber start_pcs in place
+        super.renumber(byteCodeOffsets);
+
+        // lengths are BRANCH5 encoded, not BCI-encoded.
+        // In other words:
+        // start_pc is BCI5 start_pc
+        // end_pc is byteCodeOffset[(index of start_pc in byteCodeOffset) +
+        // (encoded length)]
+        // real length = end_pc - start_pc
+        // special case if end_pc is beyond end of bytecode array
+
+        int maxSize = codeLength;
+
+        // Iterate through the lengths and update each in turn.
+        // This is done in place in the lengths array.
+        for (int index = 0; index < lengths.length; index++) {
+            int start_pc = start_pcs[index];
+            int revisedLength = -1;
+            int encodedLength = lengths[index];
+
+            // First get the index of the start_pc in the byteCodeOffsets
+            int indexOfStartPC = unrenumbered_start_pcs[index];
+            // Given the index of the start_pc, we can now add
+            // the encodedLength to it to get the stop index.
+            int stopIndex = indexOfStartPC + encodedLength;
+            if (stopIndex < 0) {
+                throw new Pack200Exception("Error renumbering bytecode indexes");
+            }
+            // Length can either be an index into the byte code offsets, or one
+            // beyond the
+            // end of the byte code offsets. Need to determine which this is.
+            if (stopIndex == byteCodeOffsets.size()) {
+                // Pointing to one past the end of the byte code array
+                revisedLength = maxSize - start_pc;
+            } else {
+                // We're indexed into the byte code array
+                int stopValue = ((Integer) byteCodeOffsets.get(stopIndex))
+                        .intValue();
+                revisedLength = stopValue - start_pc;
+            }
+            lengths[index] = revisedLength;
+        }
+    }
+
+
     public String toString() {
         return "LocalVariableTypeTable: " + +local_variable_type_table_length
                 + " varaibles";

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java Mon Jul 14 02:43:27 2008
@@ -30,9 +30,15 @@
     private final List lengths = new ArrayList(); // List of Integers
     private final List body = new ArrayList();
     private ClassConstantPool pool;
+    private final int layoutIndex;
 
-    public NewAttribute(CPUTF8 attributeName) {
+    public NewAttribute(CPUTF8 attributeName, int layoutIndex) {
         super(attributeName);
+        this.layoutIndex = layoutIndex;
+    }
+
+    public int getLayoutIndex() {
+        return layoutIndex;
     }
 
     /*

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java Mon Jul 14 02:43:27 2008
@@ -44,6 +44,10 @@
         return 2;
     }
 
+    protected ClassFileEntry[] getNestedClassFileEntries() {
+        return new ClassFileEntry[] { getAttributeName(), signature };
+    }
+
     protected void resolve(ClassConstantPool pool) {
         super.resolve(pool);
         signature.resolve(pool);

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/ByteCodeForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/ByteCodeForm.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/ByteCodeForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/ByteCodeForm.java Mon Jul 14 02:43:27 2008
@@ -678,4 +678,8 @@
         // Most ByteCodeForms don't have any fixing up to do.
         return;
     }
+
+    public boolean nestedMustStartClassPool() {
+        return false;
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/NarrowClassRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/NarrowClassRefForm.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/NarrowClassRefForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/NarrowClassRefForm.java Mon Jul 14 02:43:27 2008
@@ -18,7 +18,6 @@
 
 import org.apache.harmony.unpack200.Pack200Exception;
 import org.apache.harmony.unpack200.bytecode.ByteCode;
-import org.apache.harmony.unpack200.bytecode.CPClass;
 import org.apache.harmony.unpack200.bytecode.OperandManager;
 
 /**
@@ -41,8 +40,10 @@
         super.setNestedEntries(byteCode, operandManager, offset);
         if (!widened) {
             byteCode.setNestedPositions(new int[][] { { 0, 1 } });
-            ((CPClass) byteCode.getNestedClassFileEntries()[0])
-                    .mustStartClassPool(true);
         }
     }
+
+    public boolean nestedMustStartClassPool() {
+        return !widened;
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/SingleByteReferenceForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/SingleByteReferenceForm.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/SingleByteReferenceForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/SingleByteReferenceForm.java Mon Jul 14 02:43:27 2008
@@ -18,7 +18,6 @@
 
 import org.apache.harmony.unpack200.Pack200Exception;
 import org.apache.harmony.unpack200.bytecode.ByteCode;
-import org.apache.harmony.unpack200.bytecode.ConstantPoolEntry;
 import org.apache.harmony.unpack200.bytecode.OperandManager;
 
 /**
@@ -44,8 +43,10 @@
             byteCode.setNestedPositions(new int[][] { { 0, 2 } });
         } else {
             byteCode.setNestedPositions(new int[][] { { 0, 1 } });
-            ((ConstantPoolEntry) byteCode.getNestedClassFileEntries()[0])
-                    .mustStartClassPool(true);
         }
     }
+
+    public boolean nestedMustStartClassPool() {
+        return !widened;
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/StringRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/StringRefForm.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/StringRefForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/forms/StringRefForm.java Mon Jul 14 02:43:27 2008
@@ -66,7 +66,6 @@
             byteCode.setNestedPositions(new int[][] { { 0, 2 } });
         } else {
             byteCode.setNestedPositions(new int[][] { { 0, 1 } });
-            ((CPString) nested[0]).mustStartClassPool(true);
         }
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfile.c?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfile.c Mon Jul 14 02:43:27 2008
@@ -38,6 +38,14 @@
 #include "portnls.h"
 #include "ut_hyprt.h"
 
+#ifdef ZOS
+#define FD_BIAS 1000
+#undef fwrite
+#undef fread
+#else
+#define FD_BIAS 0
+#endif /* ZOS */
+
 #define CDEV_CURRENT_FUNCTION _prototypes_private
 static I_32 EsTranslateOpenFlags (I_32 flags);
 static I_32 findError (I_32 errorCode);
@@ -141,7 +149,15 @@
 I_32 VMCALL
 hyfile_close (struct HyPortLibrary * portLibrary, IDATA fd)
 {
-  return close ((int) fd);
+
+#if (FD_BIAS != 0)
+    if (fd < FD_BIAS) {
+        /* Cannot close STD streams, and no other FD's should exist <FD_BIAS */
+	    return -1;
+    }
+#endif
+
+    return close ((int) (fd - FD_BIAS));
 }
 
 #undef CDEV_CURRENT_FUNCTION
@@ -202,6 +218,7 @@
   fdflags = fcntl (fd, F_GETFD, 0);
   fcntl (fd, F_SETFD, fdflags | FD_CLOEXEC);
 
+  fd += FD_BIAS;
   Trc_PRT_file_open_Exit (fd);
   return (IDATA) fd;
 }
@@ -246,8 +263,20 @@
 {
   IDATA rc = 0;
 
+#ifdef ZOS
+  if (fd == HYPORT_TTY_OUT) {
+    rc = fwrite(buf, sizeof(char), nbytes, stdout);
+  } else if (fd == HYPORT_TTY_ERR) {
+    rc = fwrite(buf, sizeof(char), nbytes, stderr);
+  } else if (fd < FD_BIAS) {
+    /* Cannot fsync STDIN, and no other FD's should exist <FD_BIAS */
+    return -1;
+  } else 
+#endif /* ZOS */
+  {
   /* write will just do the right thing for HYPORT_TTY_OUT and HYPORT_TTY_ERR */
-  rc = write ((int) fd, buf, nbytes);
+    rc = write ((int) (fd - FD_BIAS), buf, nbytes);
+  }
 
   if (rc == -1)
     {
@@ -280,7 +309,18 @@
       return 0;
     }
 
-  result = read ((int) fd, buf, nbytes);
+#ifdef ZOS
+  if (fd == HYPORT_TTY_IN) {
+    result = fread(buf, sizeof(char), nbytes, stdin);
+  }  else	if (fd < FD_BIAS) {
+    /* Cannot read from STDOUT/ERR, and no other FD's should exist <FD_BIAS */
+    return -1;
+  } else
+#endif /* ZOS */
+  {
+    result = read ((int) (fd - FD_BIAS), buf, nbytes);
+  }
+
   if (result == 0)
     {
       return -1;
@@ -310,9 +350,10 @@
  * can be returned when seeking beyond end of file.
  */
 I_64 VMCALL
-hyfile_seek (struct HyPortLibrary * portLibrary, IDATA fd, I_64 offset,
+hyfile_seek (struct HyPortLibrary * portLibrary, IDATA inFD, I_64 offset,
              I_32 whence)
 {
+  int fd = (int)inFD;
   off_t localOffset = (off_t) offset;
 
   if ((whence < HySeekSet) || (whence > HySeekEnd))
@@ -333,7 +374,14 @@
         }
     }
 
-  return (I_64) lseek ((int) fd, localOffset, whence);
+#if (FD_BIAS != 0)
+	if (fd < FD_BIAS) {
+		/* Cannot seek on STD streams, and no other FD's should exist <FD_BIAS */
+		return -1;
+	}
+#endif
+
+  return (I_64) lseek ((int) (fd - FD_BIAS), localOffset, whence);
 }
 
 #undef CDEV_CURRENT_FUNCTION
@@ -620,9 +668,22 @@
  * @internal @todo return negative portable return code on failure.
  */
 I_32 VMCALL
-hyfile_sync (struct HyPortLibrary * portLibrary, IDATA fd)
+hyfile_sync (struct HyPortLibrary * portLibrary, IDATA inFD)
 {
-  return fsync ((int) fd);
+  int fd = (int)inFD;
+
+#ifdef ZOS
+	 if (fd == HYPORT_TTY_OUT) {
+		return fflush(stdout);
+	} else if (fd == HYPORT_TTY_ERR) {
+		return fflush(stderr);
+	} else if (fd < FD_BIAS) {
+		/* Cannot fsync STDIN, and no other FD's should exist <FD_BIAS */
+		return -1;
+	}
+#endif /* ZOS */
+
+  return fsync ((int) (fd - FD_BIAS));
 }
 
 #undef CDEV_CURRENT_FUNCTION
@@ -800,10 +861,10 @@
  * @return 0 on success, negative portable error code on failure
  */
 I_32 VMCALL
-hyfile_set_length (struct HyPortLibrary *portLibrary, IDATA fd,
+hyfile_set_length (struct HyPortLibrary *portLibrary, IDATA inFD,
                    I_64 newLength)
 {
-
+  int fd = (int)inFD;
   I_32 rc;
   off_t length = (off_t) newLength;
 
@@ -820,7 +881,14 @@
         }
     }
 
-  rc = ftruncate (fd, length);
+#if (FD_BIAS != 0)
+	if (fd < FD_BIAS) {
+		/* Cannot ftruncate on STD streams, and no other FD's should exist <FD_BIAS */
+		return -1;
+	}
+#endif
+
+  rc = ftruncate (fd - FD_BIAS, length);
   if (0 != rc)
     {
       rc =

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfiletext.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfiletext.c?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfiletext.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyfiletext.c Mon Jul 14 02:43:27 2008
@@ -49,6 +49,9 @@
 #endif
 
 /* a2e overrides nl_langinfo to return ASCII strings. We need the native EBCDIC string */
+#if defined(ZOS) && defined (nl_langinfo)
+#undef nl_langinfo
+#endif
 
 #define CDEV_CURRENT_FUNCTION _prototypes_private
 #if (defined(HYVM_USE_ICONV))
@@ -105,9 +108,18 @@
   char* outBuf = NULL;
   IDATA i;
   int requiresTranslation = 0;
-
+#ifdef ZOS
+#pragma convlit(suspend)
+#endif /* ZOS */
   const char *utf8Encoding = "UTF-8";
-
+#ifdef ZOS
+#pragma convlit(resume)
+#endif /* ZOS */
+
+#ifdef ZOS
+  /* z/OS always needs to translate to EBCDIC */
+  requiresTranslation = 1;
+#else
   /* we can short circuit if the string is all ASCII */
   for (i = 0; i < nbytes; i++)
   {
@@ -117,6 +129,7 @@
           break;
       }
   }
+#endif /* ZOS */
 
   if (!requiresTranslation
       || strcmp (nl_langinfo (CODESET), utf8Encoding) == 0)
@@ -157,8 +170,18 @@
   IDATA result, i;
   int requiresTranslation = 0;
 
+#ifdef ZOS
+#pragma convlit(suspend)
+#endif
   const char *utf8Encoding = "UTF-8";
+#ifdef ZOS
+#pragma convlit(resume)
+#endif
 
+#ifdef ZOS
+  /* z/OS always needs to translate to EBCDIC */
+  requiresTranslation = 1;
+#else
   /* we can short circuit if the string is all ASCII */
   for (i = 0; i < nbytes; i++)
     {
@@ -168,6 +191,7 @@
           break;
         }
     }
+#endif /* ZOS */
 
   if (!requiresTranslation
       || strcmp (nl_langinfo (CODESET), utf8Encoding) == 0)
@@ -371,8 +395,16 @@
   iconv_t converter;
   size_t inbytesleft, outbytesleft;
   char *inbuf, *outbuf;
+
 /* iconv_open is not an a2e function, so we need to pass it honest-to-goodness EBCDIC strings */
+#ifdef ZOS
+#pragma convlit(suspend)
+#endif /* ZOS */
   converter = iconv_open (nl_langinfo (CODESET), "UTF-8");
+#ifdef ZOS
+#pragma convlit(resume)
+#endif /* ZOS */
+
   if (converter == (iconv_t) - 1)
     {
       /* no converter available for this code set. Just dump the UTF-8 chars */

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hymem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hymem.c?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hymem.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hymem.c Mon Jul 14 02:43:27 2008
@@ -71,6 +71,9 @@
                            "\nallocate of %u bytes (new total is %u bytes)\n",
                            byteAmount, DEBUG_TOTAL_ALLOCATED_MEMORY);
   mem = (void *) malloc (byteAmount + sizeof (UDATA));
+#if defined(HYS390)
+  mem = (void *) (((UDATA) mem) & 0x7FFFFFFF);
+#endif /* HYS390 */
   *((UDATA *) mem) = byteAmount;
   pointer = ((UDATA) mem + sizeof (UDATA));
 #else
@@ -78,7 +81,11 @@
     {                           /* prevent malloc from failing causing allocate to return null */
       byteAmount = 1;
     }
+
   pointer = malloc (byteAmount);
+#if defined(HYS390)
+  pointer = (void *) (((UDATA) pointer) & 0x7FFFFFFF);
+#endif /* HYS390 */
 #endif
 
 
@@ -141,6 +148,9 @@
   Trc_PRT_mem_hymem_reallocate_memory_Entry (memoryPointer, byteAmount);
 
   ptr = realloc (memoryPointer, byteAmount);
+#if defined(HYS390)
+  ptr = (void *) (((UDATA) ptr) & 0x7FFFFFFF);
+#endif
 
   Trc_PRT_mem_hymem_reallocate_memory_Exit (ptr);
   return ptr;

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hynlshelpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hynlshelpers.c?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hynlshelpers.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hynlshelpers.c Mon Jul 14 02:43:27 2008
@@ -99,6 +99,18 @@
 #else
   /* Query locale data */
   lang = setlocale (LC_CTYPE, NULL);
+
+#if defined (ZOS)
+  if (NULL != lang) {
+    /* z/OS sometimes returns the HFS path to a "locale object" so carve it up to make it look like the corresponding locale name */
+    char *lastSlash = strrchr(lang, '/');
+
+    if (NULL != lastSlash) {
+      lang = lastSlash + 1;
+    }
+  }
+#endif /* defined (ZOS) */
+
 #endif /* LINUX */
 
 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c Mon Jul 14 02:43:27 2008
@@ -266,6 +266,14 @@
   IDATA bytes;
   char tmpAbsolutePath[255];
   char buf[255];
+
+#ifdef ZOS
+#pragma convlit(suspend)
+#endif
+  char resultString[] = "000000009   -0002    3.14";
+#ifdef ZOS
+#pragma convlit(resume)
+#endif
   
   printf("testing hyfile_printf......\n");
   generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
@@ -279,10 +287,9 @@
     cleanup(*hyportLibrary);
     return -1;
   }
-  
+
   hyportLibrary->file_printf(hyportLibrary, fd, "%09d %7.4d %7.2f",9,-2,3.1415926535);
   
-  
   rc = hyportLibrary->file_close(hyportLibrary, fd);
   if (rc != 0) {
     Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
@@ -314,8 +321,8 @@
   }
   
 
-  if (strcmp(buf, "000000009   -0002    3.14") != 0) {
-    Hytest_setErrMsg(hyportLibrary, "Output should be [%s] not [%s] (%s)\n","000000009   -0002    3.14",buf,HY_GET_CALLSITE());
+  if (strcmp(buf, resultString) != 0) {
+    Hytest_setErrMsg(hyportLibrary, "Output should be [%s] not [%s] (%s)\n", resultString, buf, HY_GET_CALLSITE());
     hyportLibrary->file_close(hyportLibrary, fd);
     cleanup(*hyportLibrary);
     return -1;
@@ -544,6 +551,14 @@
   IDATA bytes;
   char tmpAbsolutePath[255];
   char buf[20];
+
+#ifdef ZOS
+#pragma convlit(suspend)
+#endif
+  char resultString[] = "01234";
+#ifdef ZOS
+#pragma convlit(resume)
+#endif
   
   printf("testing hyfile_read......\n");
   generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
@@ -597,8 +612,8 @@
     return -1;
   }
 
-  if (strcmp(buf, "01234") != 0) {
-    Hytest_setErrMsg(hyportLibrary, "Output should be [%s] not [%s] (%s)\n","02134",buf,HY_GET_CALLSITE());
+  if (strcmp(buf, resultString) != 0) {
+    Hytest_setErrMsg(hyportLibrary, "Output should be [%s] not [%s] (%s)\n", resultString, buf, HY_GET_CALLSITE());
     hyportLibrary->file_close(hyportLibrary, fd);
     cleanup(*hyportLibrary);
     return -1;

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java?rev=676530&r1=676529&r2=676530&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java Mon Jul 14 02:43:27 2008
@@ -118,7 +118,9 @@
      * @return java.land.String object
      */
     public Object getDecodedObject(BerInputStream in) throws IOException {
-        return new String(in.buffer, in.contentOffset, in.length);
+        /* To ensure we get the correct encoding on non-ASCII platforms, specify
+           that we wish to convert from ASCII to the default platform encoding */
+        return new String(in.buffer, in.contentOffset, in.length, "ISO-8859-1");
     }
 
     //



Mime
View raw message