You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/06/18 09:37:03 UTC

svn commit: r548243 [5/5] - in /harmony/enhanced/classlib/branches/java6: ./ make/ modules/archive/src/main/java/java/util/jar/ modules/awt/ modules/awt/src/main/java/common/java/awt/geom/ modules/awt/src/main/java/common/org/apache/harmony/awt/geom/ m...

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml Mon Jun 18 00:36:49 2007
@@ -43,6 +43,19 @@
 
     <target name="build" depends="compile-java, copy-resources, build-jar" />
 
+    <!-- Build natives.-->
+    <target name="build-native">
+
+        <make dir="${hy.nio_char.src.main.native}/niochar/${hy.os.family}" />
+
+        <!-- Copy the built shared libs over to the jre/bin dir -->
+        <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
+            <fileset dir="${hy.nio_char.src.main.native}/niochar">
+                <patternset includes="*${shlib.suffix}*" />
+            </fileset>
+        </copy>
+    </target>
+
     <target name="test" depends="-test-module">
         <fail message="Some tests failed">
             <condition>
@@ -57,6 +70,12 @@
     <!-- internal target for local and global test run sequence -->
     <target name="-test-module" depends="build, compile-tests, prepare-exclude, run-tests" />
 
+    <!-- Clean natives. -->
+    <target name="clean-native">
+        <make dir="${hy.nio_char.src.main.native}/niochar/${hy.os.family}"
+                      target="clean" />
+    </target>
+
     <target name="clean">
         <delete file="${hy.jdk}/jre/lib/boot/${hy.nio_char.packaging.jarname}.jar" />
         <delete file="${hy.jdk}/jre/lib/boot/${hy.nio_char.packaging.jarname}-src.jar" />
@@ -95,6 +114,7 @@
         <copy todir="${hy.build}" includeemptydirs="false">
             <fileset dir="${hy.nio_char.src.main.java}">
                 <exclude name="**/*.java" />
+                <exclude name="**/java.nio.charset.spi.CharsetProvider" />
             </fileset>
         </copy>
     </target>
@@ -102,6 +122,9 @@
     <target name="build-jar" depends="svn-info">
         <jar destfile="${hy.jdk}/jre/lib/boot/${hy.nio_char.packaging.jarname}.jar"
              manifest="${hy.nio_char}/META-INF/MANIFEST.MF">
+            <metainf prefix="META-INF/services"
+                dir="${hy.nio_char.src.main.java}/org/apache/harmony/niochar"
+                includes="java.nio.charset.spi.CharsetProvider"/>
             <fileset refid="classes" />
             <manifest>
                 <attribute name="Implementation-Version" value="${svn.info}"/> 
@@ -111,6 +134,9 @@
         </jar>
 
         <jar destfile="${hy.jdk}/jre/lib/boot/${hy.nio_char.packaging.jarname}-src.jar">
+            <metainf prefix="META-INF/services"
+                dir="${hy.nio_char.src.main.java}/org/apache/harmony/niochar"
+                includes="java.nio.charset.spi.CharsetProvider"/>
             <fileset dir="${hy.nio_char.src.main.java}" />
             <manifest>
                 <attribute name="Implementation-Version" value="${svn.info}"/> 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/make/hyproperties.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/make/hyproperties.xml?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/make/hyproperties.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/make/hyproperties.xml Mon Jun 18 00:36:49 2007
@@ -23,6 +23,7 @@
       <src>
          <main>
             <java location="src/main/java" />
+            <native location="src/main/native" />
         	<resources location="src/main/resources" />
          </main>
          <test>

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/Charset.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/Charset.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/Charset.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/Charset.java Mon Jun 18 00:36:49 2007
@@ -38,7 +38,7 @@
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-import com.ibm.icu4jni.charset.CharsetProviderICU;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 /**
  * A charset defines a mapping between a Unicode character sequence and a byte
@@ -108,7 +108,7 @@
      */
 
     // built in provider instance, assuming thread-safe
-    private static CharsetProviderICU _builtInProvider = null;
+    private static CharsetProviderImpl _builtInProvider = null;
 
     // cached built in charsets
     private static TreeMap<String, Charset> _builtInCharsets = null;
@@ -146,9 +146,9 @@
          * charset provider.
          */
         _builtInProvider = AccessController
-                .doPrivileged(new PrivilegedAction<CharsetProviderICU>() {
-                    public CharsetProviderICU run() {
-                        return new CharsetProviderICU();
+                .doPrivileged(new PrivilegedAction<CharsetProviderImpl>() {
+                    public CharsetProviderImpl run() {
+                        return new CharsetProviderImpl();
                     }
                 });
     }
@@ -487,6 +487,9 @@
                 return cs;
             }
             // Try built-in charsets
+            if(_builtInProvider == null) {
+                _builtInProvider = new CharsetProviderImpl();
+            }
             cs = _builtInProvider.charsetForName(charsetName);
             if (null != cs) {
                 cacheCharset(cs);

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java Mon Jun 18 00:36:49 2007
@@ -389,7 +389,6 @@
                 status = endOfInput ? END : ONGOING;
                 if (endOfInput && remaining > 0) {
                     result = CoderResult.malformedForLength(remaining);
-                    in.position(in.position() + result.length());
                 } else {
                     return result;
                 }
@@ -412,9 +411,7 @@
                 if (action != CodingErrorAction.IGNORE)
                     return result;
             }
-            if (!result.isMalformed()) {
-                in.position(in.position() + result.length());
-            }
+            in.position(in.position() + result.length());
         }
     }
 

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 18 00:36:49 2007
@@ -0,0 +1,4 @@
+*.dll
+*.map
+*.pdb
+*.manifest

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 18 00:36:49 2007
@@ -0,0 +1 @@
+*.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 18 00:36:49 2007
@@ -0,0 +1 @@
+*.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 18 00:36:49 2007
@@ -0,0 +1,2 @@
+*.RES
+*.pdb

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java Mon Jun 18 00:36:49 2007
@@ -717,7 +717,7 @@
 			String result = new String(input);
 			if (result.startsWith("malform")) {
 				// reset the cursor to the error position
-				in.position(inPosition + "malform".length());
+				in.position(inPosition);
 				// set the error length
 				return CoderResult.malformedForLength("malform".length());
 			} else if (result.startsWith("unmap")) {

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java Mon Jun 18 00:36:49 2007
@@ -51,7 +51,7 @@
 	byte[] defaultReplacement = new byte[] { 63 };
 
 	// specific for Charset implementation subclass
-	byte[] specifiedReplacement = new byte[] { 26 };
+	byte[] specifiedReplacement = new byte[] { 63 };
 
 	static final String unistr = " buffer";// \u8000\u8001\u00a5\u3000\r\n";
 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java Mon Jun 18 00:36:49 2007
@@ -665,7 +665,7 @@
 		CharBuffer cb = c1.decode(ByteBuffer.wrap("abcd\u5D14efg"
 				.getBytes("iso8859-1")));
 		byte[] replacement = c1.newEncoder().replacement();
-		assertEquals(new String(cb.array()), "abcd" + new String(replacement)
+		assertEquals(new String(cb.array()).trim(), "abcd" + new String(replacement)
 				+ "efg");
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java Mon Jun 18 00:36:49 2007
@@ -51,7 +51,7 @@
 
 	ByteBuffer getMalformByteBuffer() throws UnsupportedEncodingException {
 		ByteBuffer buffer = ByteBuffer.allocate(20);
-		buffer.put(new byte[] { (byte) 0xd8, 0 });
+		buffer.put(new byte[] { (byte) 0xd8 });
 		buffer.put(unibytes);
 		buffer.flip();
 		return buffer;

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java Mon Jun 18 00:36:49 2007
@@ -60,7 +60,7 @@
 		// surrogate char
 
 		// valid surrogate pair
-		assertTrue(encoder.canEncode("\ud800\udc00"));
+		//assertTrue(encoder.canEncode("\ud800\udc00"));
 		// invalid surrogate pair
 		assertFalse(encoder.canEncode("\ud800\udb00"));
 		assertFalse(encoder.canEncode("\ud800"));
@@ -69,7 +69,7 @@
 	public void testSpecificDefaultValue() {
 		// FIXME: different here!
 		assertEquals(4.0, encoder.maxBytesPerChar(), 0.0);
-		assertEquals(2.5, encoder.averageBytesPerChar(), 0.0);
+		assertEquals(4.0, encoder.averageBytesPerChar(), 0.0);
 
 		// assertTrue(encoder.averageBytesPerChar() == 3);
 		// assertTrue(encoder.maxBytesPerChar() == 2);

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java Mon Jun 18 00:36:49 2007
@@ -38,7 +38,7 @@
 	 */
 	protected void setUp() throws Exception {
 		cs = CS;
-		specifiedReplacement = new byte[] { -3, -1 };
+		specifiedReplacement = new byte[] { -1, -3 };
 		surrogate = new byte[] { -1, -2 };
 		unibytes = new byte[] { 32, 0, 98, 0, 117, 0, 102, 0, 102, 0, 101, 0,
 				114, 0 };

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java Mon Jun 18 00:36:49 2007
@@ -33,7 +33,7 @@
 	 */
 	protected void setUp() throws Exception {
 		cs = CS;
-		specifiedReplacement = new byte[] { -17, -65, -67 };
+		specifiedReplacement = new byte[] { 63 };
 		super.setUp();
 	}
 
@@ -76,10 +76,10 @@
 	}
 
 	public void testSpecificDefaultValue() {
-		// assertEquals(1.1, encoder.averageBytesPerChar(), 0.0001);
-		assertEquals(2, encoder.averageBytesPerChar(), 0.0001);
-		// assertEquals(4, encoder.maxBytesPerChar(), 0);
-		assertEquals(3, encoder.maxBytesPerChar(), 0);
+		assertEquals(1.1, encoder.averageBytesPerChar(), 0.0001);
+		// assertEquals(2, encoder.averageBytesPerChar(), 0.0001);
+		assertEquals(4, encoder.maxBytesPerChar(), 0);
+		// assertEquals(3, encoder.maxBytesPerChar(), 0);
 	}
 
 	CharBuffer getMalformedCharBuffer() {

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java Mon Jun 18 00:36:49 2007
@@ -146,20 +146,17 @@
     }
 
     /**
-     * Expected format is the following:
-     * <dl>
-     * <dt>boolean all_allowed
-     * <dd>This is set to true if this BasicPermissionCollection contains a
-     * BasicPermission with '*' as its permission name.
-     * <dt>Class&lt;T&gt; permClass
-     * <dd>The class to which all BasicPermissions in this
-     * BasicPermissionCollection belongs.
-     * <dt>Hashtable&lt;K,V&gt; permissions
-     * <dd>The BasicPermissions in this BasicPermissionCollection. All
-     * BasicPermissions in the collection must belong to the same class. The
-     * Hashtable is indexed by the BasicPermission name; the value of the
-     * Hashtable entry is the permission.
-     * </dl>
+     * Writes the object to the given stream for serialization.
+     * 
+     * The following fields are stored via an ObjectOutputStream.PutField,
+     * obtained by calling putFields() on the given output stream, in order to
+     * comply with the serialized form specification for this class:
+     * 
+     * <code>boolean all_allowed</code>, set to <code>allEnabled</code>
+     * <code>Hashtable permissions</code>,
+     * set to <code>items</code>
+     * <code>Class permClass</code>, set to
+     * <code>permClass</code>
      */
     private void writeObject(java.io.ObjectOutputStream out) throws IOException {
         ObjectOutputStream.PutField fields = out.putFields();

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java?view=diff&rev=548243&r1=548242&r2=548243
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java Mon Jun 18 00:36:49 2007
@@ -273,10 +273,9 @@
     }
 
     /**
-     * 
-     * returns true if the provider implements the specified algorithm.  Caller must
-     * specify the cryptographic service and specify constraints via the
-     * attribute name the attribute value
+     * Returns true if this provider implements the given algorithm. Caller
+     * must specify the cryptographic service and specify constraints via the
+     * attribute name and value.
      * 
      * @param serv
      *            Crypto service
@@ -308,8 +307,8 @@
         return false;
     }
 
-    // returns true if the implementation meets the constraint expressed by the
-    // specified attribute name/value pair.
+    // Returns true if this provider has the same value as is given for the
+    // given attribute
     private boolean checkAttribute(String servAlg, String attribute, String val) {
         
         String attributeValue = getPropertyIgnoreCase(servAlg + ' ' + attribute);