You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2009/07/28 11:30:48 UTC
svn commit: r798469 [24/28] - in /harmony/enhanced/classlib/branches/java6:
./ depends/build/platform/ depends/files/ depends/jars/
depends/manifests/icu4j_4.0/ depends/manifests/icu4j_4.2.1/
depends/manifests/icu4j_4.2.1/META-INF/ make/ modules/access...
Modified: harmony/enhanced/classlib/branches/java6/modules/logging/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/logging/build.xml?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/logging/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/logging/build.xml Tue Jul 28 09:30:33 2009
@@ -19,27 +19,11 @@
<project name="LOGGING Build" default="build" basedir=".">
<description>Build for LOGGING component</description>
- <!-- import common properties -->
+ <property name="hy.module" value="logging" />
<property name="hy.hdk" location="${basedir}/../../deploy" />
<import file="${hy.hdk}/build/ant/properties.xml" />
- <property name="tests.output" location="../../build/test_report" />
-
- <!-- set global properties for this build. -->
- <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
-
- <fileset id="classes" dir="${hy.build}">
- <or>
- <present targetdir="${hy.logging.src.main.java}" />
- <present targetdir="${hy.logging.src.main.java}">
- <mapper type="regexp"
- from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
- to="\1.java"/>
- </present>
- </or>
- </fileset>
-
- <property name="logging.exclude.file" location="${hy.hdk}/build/logging.exclude" />
+ <property file="../../make/depends.properties" />
<target name="build" depends="compile-java, copy-jar-resources, build-jar, copy-resources" />
@@ -55,11 +39,12 @@
</target>
<!-- internal target for local and global test run sequence -->
- <target name="-test-module" depends="build, compile-tests, prepare-exclude, run-tests" />
+ <target name="-test-module" depends="build, run-tests" />
<target name="clean">
<delete file="${hy.jdk}/jre/lib/boot/logging.jar" />
<delete file="${hy.jdk}/jre/lib/boot/logging-src.jar" />
+ <delete dir="${tests.hdk.dir}" failonerror="false" />
<delete failonerror="false">
<fileset refid="classes" />
</delete>
@@ -69,11 +54,11 @@
<target name="compile-java">
<echo message="Compiling LOGGING classes" />
- <mkdir dir="${hy.build}" />
+ <mkdir dir="../../build/classes" />
<javac sourcepath=""
- srcdir="${hy.logging.src.main.java}"
- destdir="${hy.build}"
+ srcdir="src/main/java"
+ destdir="../../build/classes"
compiler="${hy.javac.compiler}"
memoryMaximumSize="${hy.javac.maxmem}"
source="${hy.javac.source}"
@@ -92,7 +77,7 @@
<target name="build-jar" depends="svn-info">
<jar destfile="${hy.jdk}/jre/lib/boot/logging.jar"
- manifest="${hy.logging}/META-INF/MANIFEST.MF"
+ manifest="META-INF/MANIFEST.MF"
compress="${hy.jar.compress}">
<fileset refid="classes" />
<manifest>
@@ -103,7 +88,7 @@
</jar>
<jar destfile="${hy.jdk}/jre/lib/boot/logging-src.jar">
- <fileset dir="${hy.logging.src.main.java}" />
+ <fileset dir="src/main/java" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
@@ -112,139 +97,10 @@
</jar>
</target>
- <target name="compile-tests" depends="copy-test-resources" >
- <echo message="Compiling LOGGING tests" />
-
- <mkdir dir="${hy.logging.bin.internal}" />
- <mkdir dir="${hy.logging.bin.test}" />
-
- <javac srcdir="${hy.logging.src.test.internal}"
- destdir="${hy.logging.bin.internal}"
- sourcepath=""
- compiler="${hy.javac.compiler}"
- memoryMaximumSize="${hy.javac.maxmem}"
- source="${hy.javac.source}"
- target="${hy.javac.target}"
- debug="${hy.javac.debug}">
-
- <compilerarg line="${build.compilerarg}" />
-
- <bootclasspath>
- <fileset dir="${hy.jdk}/jre/lib/boot">
- <include name="**/*.jar" />
- </fileset>
- </bootclasspath>
- <classpath location="${hy.hdk}/build/test/support.jar" />
- <classpath location="../../build/tests" />
- </javac>
- <javac srcdir="${hy.logging.src.test.java}"
- destdir="${hy.logging.bin.test}"
- sourcepath=""
- compiler="${hy.javac.compiler}"
- memoryMaximumSize="${hy.javac.maxmem}"
- source="${hy.javac.source}"
- target="${hy.javac.target}"
- debug="${hy.javac.debug}">
-
- <compilerarg line="${build.compilerarg}" />
-
- <bootclasspath>
- <fileset dir="${hy.jdk}/jre/lib/boot">
- <include name="**/*.jar" />
- </fileset>
- <pathelement path="${hy.logging.bin.internal}"/>
- </bootclasspath>
- <classpath location="${hy.hdk}/build/test/support.jar" />
- <classpath location="../../build/tests" />
- </javac>
- </target>
-
- <target name="prepare-exclude">
- <prepare-exclude-list moduleName="logging" dir="./make"
- result="${logging.exclude.file}"/>
- </target>
-
- <target name="run-tests">
-
- <mkdir dir="${tests.output}" />
-
- <property name="test.jre.home" value="${hy.jdk}/jre" />
-
- <copy file="../../support/src/test/resources/config/testing.policy"
- todir="${hy.hdk}/build/test" outputencoding="UTF-8" />
-
- <junit fork="yes"
- forkmode="${hy.test.forkmode}"
- timeout="${hy.test.timeout}"
- printsummary="withOutAndErr"
- errorproperty="test.errors"
- failureproperty="test.failures"
- showoutput="on"
- dir="${basedir}"
- jvm="${test.jre.home}/bin/java">
-
- <assertions enableSystemAssertions="true">
- <enable />
- </assertions>
-
- <jvmarg line="${hy.test.vmargs}" />
- <!-- Used by Support_Exec.execJava() -->
- <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
-
- <!-- Required by various tests that set security manager etc -->
- <jvmarg value="-Djava.security.policy=${hy.hdk}/build/test/testing.policy" />
-
- <jvmarg value="-Xbootclasspath/a:${hy.logging.bin.internal}"/>
-
- <classpath>
- <pathelement path="${hy.logging.bin.test}"/>
- </classpath>
- <classpath location="${hy.hdk}/build/test/support.jar" />
- <classpath location="../../build/tests" />
-
- <formatter type="xml" />
-
- <!-- run LogManagerTest in separated VM -->
- <batchtest todir="${tests.output}" haltonfailure="no"
- unless="test.case">
-
- <fileset dir="${hy.logging.src.test.java}">
- <include name="org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java"/>
- <excludesfile name="${logging.exclude.file}" />
- </fileset>
- </batchtest>
-
- <batchtest todir="${tests.output}" haltonfailure="no" >
-
- <fileset dir="${hy.logging.src.test.java}">
- <!-- if ${test.case} -->
- <include name="${converted.tc}" if="test.case" />
- <!-- unless ${test.case} -->
- <include name="org/apache/harmony/logging/tests/java/util/logging/*Test.java" unless="test.case" />
- <excludesfile name="${logging.exclude.file}" unless="test.case" />
-
- <exclude name="org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java" unless="test.case" />
- </fileset>
- </batchtest>
- </junit>
- <antcall target="touch-failures-file" />
- <antcall target="touch-errors-file" />
- </target>
-
- <target name="touch-failures-file" if="test.failures">
- <echo file="${tests.output}/test.failures"
- append="true">logging${line.separator}</echo>
- </target>
-
- <target name="touch-errors-file" if="test.errors">
- <echo file="${tests.output}/test.errors"
- append="true">logging${line.separator}</echo>
- </target>
-
<target name="copy-jar-resources">
- <mkdir dir="${hy.build}" />
- <copy todir="${hy.build}" includeemptydirs="false">
- <fileset dir="${hy.logging.src.main.java}">
+ <mkdir dir="../../build/classes" />
+ <copy todir="../../build/classes" includeemptydirs="false">
+ <fileset dir="src/main/java">
<exclude name="**/*.java" />
<exclude name="**/logging.properties" />
</fileset>
@@ -253,19 +109,75 @@
<target name="copy-resources">
<copy todir="${hy.jdk}/jre/lib" flatten="yes">
- <fileset dir="${hy.logging.src.main.java}">
+ <fileset dir="src/main/java">
<include name="**/logging.properties" />
</fileset>
</copy>
</target>
- <target name="copy-test-resources">
- <mkdir dir="${hy.logging.bin.test}" />
- <copy todir="${hy.logging.bin.test}" includeemptydirs="false">
- <fileset dir="${hy.logging.src.test.resources}">
- <exclude name="**/*.java" />
- </fileset>
+ <target name="test-jar" depends="svn-info,compile-tests">
+ <mkdir dir="${tests.hdk.dir}" />
+
+ <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
+
+ <jar destfile="${tests.hdk.dir}/logging_tests.jar">
+ <fileset dir="bin/test" />
+ <manifest>
+ <attribute name="Implementation-Version" value="${svn.info}"/>
+ </manifest>
+ <metainf refid="hy.required.metainf-files"/>
+ </jar>
+ <jar destfile="${tests.hdk.dir}/logging_boot_tests.jar">
+ <fileset dir="bin/test-internal" />
+ <manifest>
+ <attribute name="Implementation-Version" value="${svn.info}"/>
+ </manifest>
+ <metainf refid="hy.required.metainf-files"/>
+ </jar>
+
+ <copy file="../../support/src/test/resources/config/testing.policy"
+ todir="${hy.hdk}/build/test" outputencoding="UTF-8" />
+
+ <mkdir dir="${tests.excludes.hdk.dir}"/>
+ <copy todir="${tests.excludes.hdk.dir}">
+ <fileset dir="make" includes="exclude*"/>
+ <filterchain>
+ <tokenfilter>
+ <replaceregex pattern="\.java" replace="\.class" flags="g"/>
+ </tokenfilter>
+ </filterchain>
</copy>
+
+ <copy todir="${tests.resources.hdk.dir}">
+ <fileset dir="src/test/resources" />
+ </copy>
+
+ <copy file="../../${junit.jar}" todir="${hy.hdk}/build/test" />
+ </target>
+
+ <target name="compile-tests">
+ <compile-tests description="logging internal tests"
+ destdir="bin/test-internal">
+ <javac-elements>
+ <src>
+ <pathelement location="src/test/java-internal" />
+ </src>
+ </javac-elements>
+ </compile-tests>
+ <compile-tests description="logging api tests">
+ <javac-elements>
+ <bootclasspath>
+ <pathelement path="bin/test-internal"/>
+ </bootclasspath>
+ <src>
+ <pathelement location="src/test/java" />
+ </src>
+ </javac-elements>
+ </compile-tests>
+ </target>
+
+ <target name="run-tests" depends="test-jar">
+ <ant dir="${tests.hdk.dir}" target="test-module" />
</target>
</project>
Modified: harmony/enhanced/classlib/branches/java6/modules/logging/src/main/java/java/util/logging/FileHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/logging/src/main/java/java/util/logging/FileHandler.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/logging/src/main/java/java/util/logging/FileHandler.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/logging/src/main/java/java/util/logging/FileHandler.java Tue Jul 28 09:30:33 2009
@@ -563,7 +563,7 @@
* the log record to publish.
*/
@Override
- public void publish(LogRecord record) {
+ public synchronized void publish(LogRecord record) {
super.publish(record);
flush();
if (limit > 0 && output.getLength() >= limit) {
Modified: harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java Tue Jul 28 09:30:33 2009
@@ -17,17 +17,17 @@
package org.apache.harmony.logging.tests.java.util.logging;
-import java.io.BufferedReader;
+import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilePermission;
-import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
-import java.io.Reader;
import java.io.StringWriter;
import java.security.Permission;
import java.util.Properties;
@@ -132,7 +132,7 @@
h.publish(r);
h.close();
assertFileContent(TEMPPATH + SEP + "log", "java1.test.0", h
- .getFormatter());
+ .getFormatter(), "UTF-8");
output.close();
}
@@ -156,7 +156,7 @@
}
assertFileContent(TEMPPATH + SEP + "log", "java0.test.0",
new LogRecord[] { r, null, r, null, r, null, r },
- new MockFormatter());
+ new MockFormatter(), "UTF-8");
}
public void testDefaultValue() throws Exception {
@@ -180,16 +180,16 @@
handler.publish(r);
handler.close();
}
- assertFileContent(HOMEPATH, "java0.log", new XMLFormatter());
+ assertFileContent(HOMEPATH, "java0.log", new XMLFormatter(), null);
}
private void assertFileContent(String homepath, String filename,
- Formatter formatter) throws Exception {
- assertFileContent(homepath, filename, new LogRecord[] { r }, formatter);
+ Formatter formatter, String encoding) throws Exception {
+ assertFileContent(homepath, filename, new LogRecord[] { r }, formatter, encoding);
}
private void assertFileContent(String homepath, String filename,
- LogRecord[] lr, Formatter formatter) throws Exception {
+ LogRecord[] lr, Formatter formatter, String encoding) throws Exception {
handler.close();
String msg = "";
// if formatter is null, the file content should be empty
@@ -213,23 +213,26 @@
sb.append(formatter.getTail(handler));
msg = sb.toString();
}
- char[] chars = new char[msg.length()];
- Reader reader = null;
+ byte[] bytes = new byte[msg.length()];
+ InputStream inputStream = null;
try {
- reader = new BufferedReader(new FileReader(homepath + SEP
- + filename));
- reader.read(chars);
- // System.out.println(new String(chars));
- assertEquals(msg, new String(chars));
+ inputStream = new BufferedInputStream(new FileInputStream(homepath
+ + SEP + filename));
+ inputStream.read(bytes);
+ if (encoding == null) {
+ assertEquals(msg, new String(bytes));
+ } else {
+ assertEquals(msg, new String(bytes, encoding));
+ }
// assert has reached the end of the file
- assertEquals(-1, reader.read());
+ assertEquals(-1, inputStream.read());
} finally {
try {
- if (reader != null) {
- reader.close();
+ if (inputStream != null) {
+ inputStream.close();
}
} catch (Exception e) {
- // don't care
+ // ignored
}
reset(homepath, filename);
}
@@ -273,7 +276,7 @@
handler = new FileHandler("%t/testLimitCount%g", 1, 2, false);
handler.publish(r);
handler.close();
- assertFileContent(TEMPPATH, "testLimitCount1", handler.getFormatter());
+ assertFileContent(TEMPPATH, "testLimitCount1", handler.getFormatter(), "UTF-8");
// very small limit value, count=1
// output once, rotate(equals to nothing output)
@@ -281,7 +284,7 @@
handler.publish(r);
handler.close();
assertFileContent(TEMPPATH, "testLimitCount0", new LogRecord[0],
- handler.getFormatter());
+ handler.getFormatter(), "UTF-8");
// normal case, limit is 60(>2*msg length <3*msg length), append is
// false
@@ -300,9 +303,9 @@
}
assertFileContent(TEMPPATH, "testLimitCount0.1", new LogRecord[] {
- rs[5], rs[6], rs[7] }, handler.getFormatter());
+ rs[5], rs[6], rs[7] }, handler.getFormatter(), "UTF-8");
assertFileContent(TEMPPATH, "testLimitCount0.0", new LogRecord[] {
- rs[8], rs[9] }, handler.getFormatter());
+ rs[8], rs[9] }, handler.getFormatter(), "UTF-8");
// normal case, limit is 60(>2*msg length <3*msg length), append is true
handler = new FileHandler("%t/testLimitCount%u", 60, 3, false);
@@ -319,11 +322,11 @@
}
handler.close();
assertFileContent(TEMPPATH, "testLimitCount0.2", new LogRecord[] {
- rs[3], rs[4], null, rs[5] }, handler.getFormatter());
+ rs[3], rs[4], null, rs[5] }, handler.getFormatter(), "UTF-8");
assertFileContent(TEMPPATH, "testLimitCount0.1", new LogRecord[] {
- rs[6], rs[7], rs[8] }, handler.getFormatter());
+ rs[6], rs[7], rs[8] }, handler.getFormatter(), "UTF-8");
assertFileContent(TEMPPATH, "testLimitCount0.0",
- new LogRecord[] { rs[9] }, handler.getFormatter());
+ new LogRecord[] { rs[9] }, handler.getFormatter(), "UTF-8");
FileHandler h1 = null;
FileHandler h2 = null;
@@ -566,7 +569,7 @@
String msg = new String(out.toByteArray());
Formatter f = handler.getFormatter();
assertEquals(msg, f.getHead(handler) + f.format(r) + f.getTail(handler));
- assertFileContent(HOMEPATH, "setoutput.log", handler.getFormatter());
+ assertFileContent(HOMEPATH, "setoutput.log", handler.getFormatter(), null);
}
/*
@@ -587,10 +590,10 @@
h2.close();
h3.close();
h4.close();
- assertFileContent(TEMPPATH + SEP + "log", "string", h.getFormatter());
- assertFileContent(TEMPPATH + SEP + "log", "string.1", h.getFormatter());
- assertFileContent(TEMPPATH + SEP + "log", "string.2", h.getFormatter());
- assertFileContent(TEMPPATH + SEP + "log", "string.3", h.getFormatter());
+ assertFileContent(TEMPPATH + SEP + "log", "string", h.getFormatter(), "UTF-8");
+ assertFileContent(TEMPPATH + SEP + "log", "string.1", h.getFormatter(), "UTF-8");
+ assertFileContent(TEMPPATH + SEP + "log", "string.2", h.getFormatter(), "UTF-8");
+ assertFileContent(TEMPPATH + SEP + "log", "string.3", h.getFormatter(), "UTF-8");
// default is append mode
FileHandler h6 = new FileHandler("%t/log/string%u.log");
@@ -601,7 +604,7 @@
h7.close();
try {
assertFileContent(TEMPPATH + SEP + "log", "string0.log", h
- .getFormatter());
+ .getFormatter(), "UTF-8");
fail("should assertion failed");
} catch (Error e) {
}
@@ -616,9 +619,9 @@
h9.close();
h8.close();
assertFileContent(TEMPPATH + SEP + "log", "0string0.log", h
- .getFormatter());
+ .getFormatter(), "UTF-8");
assertFileContent(TEMPPATH + SEP + "log", "1string1.log", h
- .getFormatter());
+ .getFormatter(), "UTF-8");
file = new File(TEMPPATH + SEP + "log");
assertTrue(file.list().length <= 2);
}
@@ -627,7 +630,7 @@
IOException {
// regression HARMONY-2421
try {
- FileHandler fh = new FileHandler(new String(), 1, 1);
+ new FileHandler(new String(), 1, 1);
fail("Expected an IllegalArgumentException");
} catch (IllegalArgumentException e) {
// Expected
@@ -638,7 +641,7 @@
IOException {
// regression HARMONY-2421
try {
- FileHandler fh = new FileHandler(new String(), true);
+ new FileHandler(new String(), true);
fail("Expected an IllegalArgumentException");
} catch (IllegalArgumentException e) {
// Expected
@@ -649,7 +652,7 @@
IOException {
// regression HARMONY-2421
try {
- FileHandler fh = new FileHandler(new String(), 1, 1, true);
+ new FileHandler(new String(), 1, 1, true);
fail("Expected an IllegalArgumentException");
} catch (IllegalArgumentException e) {
// Expected
Modified: harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java Tue Jul 28 09:30:33 2009
@@ -53,7 +53,7 @@
private final static String INVALID_RESOURCE_BUNDLE = "impossible_not_existing";
- private final static String LOGGING_CONFIG_FILE= "src/test/resources/config/java/util/logging/logging.config";
+ private final static String LOGGING_CONFIG_FILE= "resources/config/java/util/logging/logging.config";
private final static String VALID_KEY = "LOGGERTEST";
Modified: harmony/enhanced/classlib/branches/java6/modules/luni-kernel/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni-kernel/build.xml?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni-kernel/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni-kernel/build.xml Tue Jul 28 09:30:33 2009
@@ -21,26 +21,13 @@
<description>Build for luni kernel stub jar</description>
- <!-- import common properties -->
+ <property name="hy.module" value="luni-kernel" />
<property name="hy.hdk" location="${basedir}/../../deploy" />
<import file="${hy.hdk}/build/ant/properties.xml" />
- <property name="hy.jdk" location="../../deploy/jdk" />
- <property name="hy.build" location="../../build/classes" />
<property name="stub.jar"
location="${hy.jdk}/jre/lib/boot/luni-kernel-stubs.jar" />
- <fileset id="classes" dir="${hy.build}">
- <or>
- <present targetdir="src/main/java" />
- <present targetdir="src/main/java">
- <mapper type="regexp"
- from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
- to="\1.java"/>
- </present>
- </or>
- </fileset>
-
<target name="warn">
<fail>...
@@ -68,8 +55,4 @@
</delete>
</target>
- <target name="-test-module">
- <!-- just to match "API" for other modules. -->
- </target>
-
</project>
Modified: harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/org/apache/harmony/kernel/vm/VM.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/org/apache/harmony/kernel/vm/VM.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/org/apache/harmony/kernel/vm/VM.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/org/apache/harmony/kernel/vm/VM.java Tue Jul 28 09:30:33 2009
@@ -59,6 +59,25 @@
};
/**
+ * This method must be provided by the VM vendor. Returns the class of the
+ * method (including natives) at the specified depth on the stack of the
+ * calling thread. Frames representing the VM implementation of
+ * java.lang.reflect are not included in the list. Notes:
+ * <ul>
+ * <li>This method operates on the defining classes of methods on stack.
+ * NOT the classes of receivers.</li>
+ * <li>The item at depth zero is the caller of this method</li>
+ * </ul>
+ *
+ * @param depth the stack depth of the requested Class
+ * @return the Class at the specified depth
+ * @see Class#getStackClasses
+ */
+ public static Class<?> getStackClass(int depth) {
+ return null;
+ }
+
+ /**
* This method must be provided by the vm vendor, as it is used by other
* provided class implementations. For example,
* java.io.ObjectInputStream.readObject() and
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/.classpath?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/.classpath Tue Jul 28 09:30:33 2009
@@ -14,5 +14,6 @@
</accessrules>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry kind="var" path="HARMONY_CLASSLIB/deploy/jdk/jre/lib/boot/luni-kernel-stubs.jar"/>
<classpathentry kind="output" path="bin/main"/>
</classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/build.xml?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/build.xml Tue Jul 28 09:30:33 2009
@@ -19,47 +19,19 @@
<project name="LUNI Build" default="build" basedir=".">
<description>Build for LUNI component</description>
- <!-- import common properties -->
+ <property name="hy.module" value="luni" />
<property name="hy.hdk" location="${basedir}/../../deploy" />
<import file="${hy.hdk}/build/ant/properties.xml" />
- <property name="tests.output" location="../../build/test_report" />
-
- <!-- set global properties for this build. -->
- <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
-
- <property name="hy.luni.src.test.api.java.platform"
- value="${hy.luni.src.test.api}/${hy.os.family}" />
- <property name="hy.luni.src.test.impl.java.platform"
- value="${hy.luni.src.test.impl}/${hy.os.family}" />
- <fileset id="classes" dir="${hy.build}">
- <or>
- <present targetdir="${hy.luni.src.main.java}" />
- <present targetdir="${hy.luni.src.main.java}">
- <mapper type="regexp"
- from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
- to="\1.java"/>
- </present>
- </or>
- </fileset>
-
- <fileset id="tests.api" dir="${hy.luni.bin.test}/api"/>
- <fileset id="tests.impl" dir="${hy.luni.bin.test}/impl"/>
-
- <property name="tests.hdk.dir" value="${hy.hdk}/build/test/luni" />
- <property name="tests.resources.hdk.dir" value="${tests.hdk.dir}/resources" />
- <property name="tests.excludes.hdk.dir" value="${tests.hdk.dir}/excludes" />
-
<property file="../../make/depends.properties" />
- <property name="fdlibm.zip" location="${depends.oss}/fdlibm_5.2.zip" />
- <property name="luni.exclude.file" location="${hy.hdk}/build/luni.exclude" />
+ <property name="fdlibm.zip" location="${depends.oss}/fdlibm_5.2.zip" />
<target name="build" depends="compile-java, copy-resources, build-jar" />
<target name="copy-native-includes">
<copy todir="${hy.hdk}/include" overwrite="yes">
- <fileset dir="${hy.luni.src.main.native}/include/shared">
+ <fileset dir="src/main/native/include/shared">
<include name="vmi.h" />
<include name="hyvmls.h" />
<include name="hysocket.h" />
@@ -70,7 +42,7 @@
</fileset>
</copy>
<copy todir="${hy.jdk}/include" overwrite="yes">
- <fileset dir="${hy.luni.src.main.native}/include/shared">
+ <fileset dir="src/main/native/include/shared">
<include name="jni.h" />
<include name="jni_types.h" />
<include name="jvmti.h" />
@@ -79,7 +51,7 @@
</copy>
<copy todir="${hy.hdk}/include" overwrite="yes">
- <fileset dir="${hy.luni.src.main.native}/include/${hy.os.family}">
+ <fileset dir="src/main/native/include/${hy.os.family}">
<include name="jclprots.h" />
</fileset>
</copy>
@@ -94,7 +66,7 @@
<target name="build-native-core" >
<!-- Build vmi dll -->
- <make dir="${hy.luni.src.main.native}/vmi/${hy.os.family}" />
+ <make dir="src/main/native/vmi/${hy.os.family}" />
<!-- On Linux we want to copy the libvmi.so into the
deploy/lib directory so that the natives can link
@@ -103,11 +75,11 @@
implementation is loaded
-->
<copy todir="${hy.hdk}/lib" overwrite="yes" failonerror="false">
- <fileset dir="${hy.luni.src.main.native}/vmi">
+ <fileset dir="src/main/native/vmi">
<include name="libvmi${shlib.suffix}"/>
</fileset>
<!-- Copy link exports file on z/OS -->
- <fileset dir="${hy.luni.src.main.native}/vmi/${hy.os.family}">
+ <fileset dir="src/main/native/vmi/${hy.os.family}">
<include name="*${linklib.suffix}" if="is.zos" />
</fileset>
</copy>
@@ -121,12 +93,12 @@
<target name="-build-native-secondary" >
<!-- Build fdlibm lib -->
- <make dir="${hy.luni.src.main.native}/fdlibm/${hy.os.family}" />
+ <make dir="src/main/native/fdlibm/${hy.os.family}" />
<!-- Build luni dll -->
- <make dir="${hy.luni.src.main.native}/luni/${hy.os.family}" />
+ <make dir="src/main/native/luni/${hy.os.family}" />
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
- <fileset dir="${hy.luni.src.main.native}/luni">
+ <fileset dir="src/main/native/luni">
<include name="*${shlib.suffix}*" />
<include name="*${progdb.suffix}*" if="is.windows" />
<exclude name="*${manifest.suffix}"/>
@@ -134,28 +106,28 @@
</copy>
<!-- Copy link exports file on z/OS -->
<copy todir="${hy.hdk}/lib" overwrite="yes">
- <fileset dir="${hy.luni.src.main.native}/luni/${hy.os.family}">
+ <fileset dir="src/main/native/luni/${hy.os.family}">
<include name="*${linklib.suffix}" if="is.zos" />
</fileset>
</copy>
<!-- Build vmls lib -->
- <make dir="${hy.luni.src.main.native}/vmls/${hy.os.family}" />
+ <make dir="src/main/native/vmls/${hy.os.family}" />
</target>
<target name="-build-hyzip" unless="hy.skip.zip.api">
<!-- Build hyzip lib -->
- <make dir="${hy.luni.src.main.native}/hyzip/${hy.os.family}" />
+ <make dir="src/main/native/hyzip/${hy.os.family}" />
</target>
<target name="-build-native-secondary2" >
<!-- Build launcher executables -->
- <make dir="${hy.luni.src.main.native}/launcher/${hy.os.family}" />
+ <make dir="src/main/native/launcher/${hy.os.family}" />
<!-- Copy across the built executables -->
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
- <fileset dir="${hy.luni.src.main.native}/launcher">
+ <fileset dir="src/main/native/launcher">
<patternset includes="java${exe.suffix}" />
<patternset includes="javaw${exe.suffix}" />
<include name="*${progdb.suffix}*" if="is.windows" />
@@ -170,41 +142,41 @@
<target name="overlay-oss" depends="-unzip-oss,-ascii2ebcdic-conversion" />
<target name="-unzip-oss">
- <unzip src="${fdlibm.zip}" dest="${hy.luni.src.main.native}/fdlibm_dist" />
- <chmod dir="${hy.luni.src.main.native}/fdlibm_dist" perm="ugo+r" />
+ <unzip src="${fdlibm.zip}" dest="src/main/native/fdlibm_dist" />
+ <chmod dir="src/main/native/fdlibm_dist" perm="ugo+r" />
</target>
<target name="-ascii2ebcdic-conversion" if="is.zos">
- <move todir="${hy.luni.src.main.native}/fdlibm_dist_ascii">
- <fileset dir="${hy.luni.src.main.native}/fdlibm_dist">
+ <move todir="src/main/native/fdlibm_dist_ascii">
+ <fileset dir="src/main/native/fdlibm_dist">
<include name="**/*" />
<exclude name="**/*.o" />
</fileset>
</move>
- <copy todir="${hy.luni.src.main.native}/fdlibm_dist" outputencoding="IBM-1047" >
- <fileset dir="${hy.luni.src.main.native}/fdlibm_dist_ascii">
+ <copy todir="src/main/native/fdlibm_dist" outputencoding="IBM-1047" >
+ <fileset dir="src/main/native/fdlibm_dist_ascii">
<include name="**/*" />
<exclude name="**/*.o" />
</fileset>
</copy>
- <fixcrlf srcdir="${hy.luni.src.main.native}/fdlibm_dist" includes="**/*" excludes="**/*.o" eol="unix" />
- <delete dir="${hy.luni.src.main.native}/fdlibm_dist_ascii" />
+ <fixcrlf srcdir="src/main/native/fdlibm_dist" includes="**/*" excludes="**/*.o" eol="unix" />
+ <delete dir="src/main/native/fdlibm_dist_ascii" />
</target>
<!-- Clean overlaid OSS packages -->
<target name="clean-overlay-oss" >
- <delete dir="${hy.luni.src.main.native}/fdlibm_dist" quiet="true" />
+ <delete dir="src/main/native/fdlibm_dist" quiet="true" />
</target>
<!-- Clean natives -->
<target name="clean-native">
- <make dir="${hy.luni.src.main.native}/fdlibm/${hy.os.family}" target="clean" />
- <make dir="${hy.luni.src.main.native}/vmi/${hy.os.family}" target="clean" />
- <make dir="${hy.luni.src.main.native}/luni/${hy.os.family}" target="clean" />
- <make dir="${hy.luni.src.main.native}/vmls/${hy.os.family}" target="clean" />
- <make dir="${hy.luni.src.main.native}/hyzip/${hy.os.family}"
+ <make dir="src/main/native/fdlibm/${hy.os.family}" target="clean" />
+ <make dir="src/main/native/vmi/${hy.os.family}" target="clean" />
+ <make dir="src/main/native/luni/${hy.os.family}" target="clean" />
+ <make dir="src/main/native/vmls/${hy.os.family}" target="clean" />
+ <make dir="src/main/native/hyzip/${hy.os.family}"
target="clean" />
- <make dir="${hy.luni.src.main.native}/launcher/${hy.os.family}"
+ <make dir="src/main/native/launcher/${hy.os.family}"
target="clean" />
</target>
@@ -220,16 +192,16 @@
</target>
<!-- internal target for local and global test run sequence -->
- <target name="-test-module" depends="build, compile-tests, prepare-exclude, test-jar, run-tests" />
+ <target name="-test-module" depends="build, test-jar, run-tests" />
<target name="clean" depends="clean-native-includes" >
<delete file="${hy.jdk}/jre/lib/boot/luni.jar" />
<delete file="${hy.jdk}/jre/lib/boot/luni-src.jar" />
+ <delete dir="${tests.hdk.dir}" failonerror="false" />
<delete failonerror="false">
<fileset refid="classes" />
</delete>
<delete failonerror="false" dir="bin"/>
- <delete dir="${tests.hdk.dir}" quiet="true" />
</target>
<target name="clean-native-includes">
@@ -258,8 +230,8 @@
<echo message="Compiling LUNI classes" />
<javac sourcepath=""
- srcdir="${hy.luni.src.main.java}"
- destdir="${hy.build}"
+ srcdir="src/main/java"
+ destdir="../../build/classes"
compiler="${hy.javac.compiler}"
memoryMaximumSize="${hy.javac.maxmem}"
source="${hy.javac.source}"
@@ -278,7 +250,7 @@
<target name="build-jar" depends="svn-info">
<jar destfile="${hy.jdk}/jre/lib/boot/luni.jar"
- manifest="${hy.luni}/META-INF/MANIFEST.MF"
+ manifest="META-INF/MANIFEST.MF"
compress="${hy.jar.compress}">
<fileset refid="classes" />
<manifest>
@@ -289,7 +261,7 @@
</jar>
<jar destfile="${hy.jdk}/jre/lib/boot/luni-src.jar">
- <fileset dir="${hy.luni.src.main.java}" />
+ <fileset dir="src/main/java" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
@@ -298,26 +270,32 @@
</jar>
</target>
- <target name="test-jar" depends="compile-tests, prepare-exclude">
+ <target name="test-jar" depends="compile-tests">
<mkdir dir="${tests.hdk.dir}"/>
- <jar destfile="${tests.hdk.dir}/${hy.luni.packaging.jarname}_tests_api.jar">
- <fileset refid="tests.api" />
+ <copy file="make/run-test.xml"
+ tofile="${tests.hdk.dir}/build.xml" />
+
+ <jar destfile="${tests.hdk.dir}/luni_tests_api.jar">
+ <fileset dir="bin/test/api" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
+ <metainf refid="hy.required.metainf-files"/>
</jar>
- <jar destfile="${tests.hdk.dir}/${hy.luni.packaging.jarname}_tests_impl.jar">
- <fileset refid="tests.impl" />
+ <jar destfile="${tests.hdk.dir}/luni_tests_impl.jar">
+ <fileset dir="bin/test/impl" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
+ <metainf refid="hy.required.metainf-files"/>
</jar>
- <copy todir="${tests.hdk.dir}">
- <fileset dir="${hy.luni.src.test.resources}" >
+ <copy todir="${tests.resources.hdk.dir}">
+ <fileset dir="src/test/resources" >
<include name="org/**/*"/>
+ <include name="net.resources/**/*"/>
</fileset>
</copy>
@@ -328,14 +306,14 @@
todir="${tests.resources.hdk.dir}/config"/>
<copy todir="${tests.resources.hdk.dir}">
- <fileset dir="${hy.luni.src.test.resources}" >
+ <fileset dir="src/test/resources" >
<include name="serialization/**/*"/>
</fileset>
</copy>
<mkdir dir="${tests.excludes.hdk.dir}"/>
<copy todir="${tests.excludes.hdk.dir}">
- <fileset dir="./make" includes="exclude*"/>
+ <fileset dir="make" includes="exclude*"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="\.java" replace="\.class" flags="g"/>
@@ -343,210 +321,44 @@
</filterchain>
</copy>
- <copy todir="${tests.hdk.dir}/.." file="${hy.hdk}/build/ant/properties.xml"/>
-
+ <copy file="../../${junit.jar}" todir="${hy.hdk}/build/test" />
+ <copy file="../../${jetty.jar}" todir="${hy.hdk}/build/test" />
</target>
<!-- compile both api tests and impl tests-->
- <target name="compile-tests" depends="compile-tests-api, compile-tests-impl" />
-
- <target name="compile-tests-api" depends="copy-test-resources">
- <compile-tests description="JUnit API Tests" destdir="${hy.luni.bin.test}/api">
+ <target name="compile-tests">
+ <compile-tests description="luni api tests" destdir="bin/test/api">
<javac-elements>
<src>
- <pathelement location="${hy.luni.src.test.api}/common" />
- <pathelement location="${hy.luni.src.test.api.java.platform}" />
+ <pathelement location="src/test/api/common" />
+ <pathelement location="src/test/api/${hy.os.family}" />
</src>
<include name="**/*.java" />
</javac-elements>
</compile-tests>
- </target>
-
- <target name="compile-tests-impl" depends="copy-test-resources">
- <compile-tests description="JUnit Impl tests" destdir="${hy.luni.bin.test}/impl">
+ <compile-tests description="luni impl tests" destdir="bin/test/impl">
<javac-elements>
<src>
- <pathelement location="${hy.luni.src.test.impl}/common" />
- <pathelement location="${hy.luni.src.test.impl.java.platform}" />
+ <pathelement location="src/test/impl/common" />
+ <pathelement location="src/test/impl/${hy.os.family}" />
</src>
<include name="**/*.java" />
</javac-elements>
</compile-tests>
</target>
- <target name="prepare-exclude">
- <prepare-exclude-list moduleName="luni" dir="./make"
- result="${luni.exclude.file}"/>
- </target>
-
<!-- run both api tests and impl tests -->
- <target name="run-tests" depends="run-tests-api, run-tests-impl" />
-
- <target name="run-tests-api">
- <run-tests description="JUnit API Tests">
- <junit-elements>
- <classpath>
- <pathelement path="${hy.luni.bin.test}/api"/>
- <pathelement path="${hy.luni.src.test.resources}"/>
- <pathelement path="../../build/tests"/>
- <fileset dir="${hy.hdk}/build/test/">
- <include name="*.jar" />
- </fileset>
- </classpath>
-
- <batchtest todir="${tests.output}" haltonfailure="no" >
- <fileset dir="${hy.luni.src.test.api}/common">
- <!-- if ${test.case} -->
- <include name="${converted.tc}" if="test.case" />
- <!-- unless ${test.case} -->
- <include name="**/*Test.java" unless="test.case" />
- <excludesfile name="${luni.exclude.file}" unless="test.case" />
- </fileset>
- <fileset dir="${hy.luni.src.test.api.java.platform}">
- <!-- if ${test.case} -->
- <include name="${converted.tc}" if="test.case" />
- <!-- unless ${test.case} -->
- <include name="**/*Test.java" unless="test.case" />
- <excludesfile name="${luni.exclude.file}" unless="test.case" />
- </fileset>
- </batchtest>
-
- </junit-elements>
- </run-tests>
- <antcall target="touch-failures-file" />
- <antcall target="touch-errors-file" />
- </target>
-
- <target name="run-tests-impl">
- <run-tests description="JUnit Impl Tests">
- <junit-elements>
- <classpath>
- <pathelement path="${hy.luni.bin.test}/impl"/>
- <pathelement path="${hy.luni.src.test.resources}"/>
- <pathelement path="../../build/tests"/>
- <fileset dir="${hy.hdk}/build/test/">
- <include name="*.jar" />
- </fileset>
- </classpath>
- <batchtest todir="${tests.output}" haltonfailure="no" >
- <fileset dir="${hy.luni.src.test.impl}/common">
- <!-- if ${test.case} -->
- <include name="${converted.tc}" if="test.case" />
- <!-- unless ${test.case} -->
- <include name="**/*Test.java" unless="test.case" />
- <excludesfile name="${luni.exclude.file}" unless="test.case" />
- </fileset>
- <fileset dir="${hy.luni.src.test.impl.java.platform}">
- <!-- if ${test.case} -->
- <include name="${converted.tc}" if="test.case" />
- <!-- unless ${test.case} -->
- <include name="**/*Test.java" unless="test.case" />
- <excludesfile name="${luni.exclude.file}" unless="test.case" />
- </fileset>
- </batchtest>
-
- </junit-elements>
- </run-tests>
-
- <antcall target="touch-failures-file" />
- <antcall target="touch-errors-file" />
- </target>
-
- <target name="touch-failures-file" if="test.failures">
- <echo file="${tests.output}/test.failures"
- append="true">luni${line.separator}</echo>
- </target>
-
- <target name="touch-errors-file" if="test.errors">
- <echo file="${tests.output}/test.errors"
- append="true">luni${line.separator}</echo>
+ <target name="run-tests" depends="test-jar">
+ <ant dir="${tests.hdk.dir}" target="test-module" />
</target>
<target name="copy-resources">
- <mkdir dir="${hy.build}" />
- <copy todir="${hy.build}" includeemptydirs="false">
- <fileset dir="${hy.luni.src.main.java}">
+ <mkdir dir="../../build/classes" />
+ <copy todir="../../build/classes" includeemptydirs="false">
+ <fileset dir="src/main/java">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
- <target name="copy-test-resources">
- <mkdir dir="${hy.luni.bin.test}" />
- <copy todir="${hy.luni.bin.test}" includeemptydirs="false">
- <fileset dir="${hy.luni.src.test.resources}" />
- </copy>
- </target>
-
- <macrodef name="compile-tests">
- <attribute name="description" default="" />
- <attribute name="destdir" />
- <element name="javac-elements" />
- <sequential>
- <echo message="Compiling LUNI @{description}" />
-
- <mkdir dir="@{destdir}" />
-
- <javac destdir="@{destdir}"
- compiler="${hy.javac.compiler}"
- memoryMaximumSize="${hy.javac.maxmem}"
- source="${hy.javac.source}"
- target="${hy.javac.target}"
- debug="${hy.javac.debug}">
-
- <compilerarg line="${build.compilerarg}" />
-
- <javac-elements />
-
- <bootclasspath>
- <fileset dir="${hy.jdk}/jre/lib/boot">
- <include name="**/*.jar" />
- </fileset>
- </bootclasspath>
- <classpath location="../../build/tests" />
- <classpath location="${hy.hdk}/build/test/support.jar" />
- </javac>
- </sequential>
- </macrodef>
-
- <macrodef name="run-tests">
- <attribute name="description" default="" />
- <element name="junit-elements" />
- <sequential>
- <echo message="Running LUNI @{description}" />
-
- <mkdir dir="${tests.output}" />
-
- <property name="test.jre.home" value="${hy.jdk}/jre" />
-
- <junit fork="yes"
- forkmode="${hy.test.forkmode}"
- timeout="${hy.test.timeout}"
- printsummary="withOutAndErr"
- errorproperty="test.errors"
- failureproperty="test.failures"
- showoutput="on"
- dir="${basedir}"
- jvm="${test.jre.home}/bin/java">
-
- <assertions enableSystemAssertions="true">
- <enable />
- </assertions>
-
- <jvmarg line="${hy.test.vmargs}" />
- <!-- Used by Support_Exec.execJava() -->
- <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
-
- <!-- Required by various tests that set security manager etc -->
- <jvmarg value="-Djava.security.policy=${hy.hdk}/build/test/testing.policy" />
-
- <!-- Required for running the java.net unit tests -->
- <jvmarg value="-Dtest.ini.file=../../support/src/test/resources/config/localhosttest.ini" />
-
- <junit-elements />
-
- <formatter type="xml" />
- </junit>
- </sequential>
- </macrodef>
</project>
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java Tue Jul 28 09:30:33 2009
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.harmony.luni.internal.io.FileCanonPathCache;
import org.apache.harmony.luni.util.DeleteOnExit;
import org.apache.harmony.luni.util.Msg;
import org.apache.harmony.luni.util.PriviAction;
@@ -488,6 +489,12 @@
*/
public String getCanonicalPath() throws IOException {
byte[] result = properPath(false);
+ String absPath = Util.toUTF8String(result);
+ String canonPath = FileCanonPathCache.get(absPath);
+
+ if (canonPath != null) {
+ return canonPath;
+ }
if(separatorChar == '/') {
// resolve the full path first
result = resolveLink(result, result.length, false);
@@ -559,7 +566,9 @@
newResult[newLength] = 0;
newResult = getCanonImpl(newResult);
newLength = newResult.length;
- return Util.toUTF8String(newResult, 0, newLength);
+ canonPath = Util.toUTF8String(newResult, 0, newLength);
+ FileCanonPathCache.put(absPath, canonPath);
+ return canonPath;
}
/*
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/PipedInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/PipedInputStream.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/PipedInputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/PipedInputStream.java Tue Jul 28 09:30:33 2009
@@ -189,11 +189,18 @@
@Override
public synchronized int read() throws IOException {
if (!isConnected) {
+ // K0074=Not connected
throw new IOException(Msg.getString("K0074")); //$NON-NLS-1$
}
if (buffer == null) {
+ // K0075=InputStream is closed
throw new IOException(Msg.getString("K0075")); //$NON-NLS-1$
}
+
+ if (lastWriter != null && !lastWriter.isAlive() && (in < 0)) {
+ // KA030=Write end dead
+ throw new IOException(Msg.getString("KA030")); //$NON-NLS-1$
+ }
/**
* Set the last thread to be reading on this PipedInputStream. If
* lastReader dies while someone is waiting to write an IOException of
@@ -208,6 +215,7 @@
return -1;
}
if ((attempts-- <= 0) && lastWriter != null && !lastWriter.isAlive()) {
+ // K0076=Pipe broken
throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
}
// Notify callers of receive()
@@ -278,13 +286,20 @@
}
if (!isConnected) {
+ // K0074=Not connected
throw new IOException(Msg.getString("K0074")); //$NON-NLS-1$
}
if (buffer == null) {
+ // K0075=InputStream is closed
throw new IOException(Msg.getString("K0075")); //$NON-NLS-1$
}
+ if (lastWriter != null && !lastWriter.isAlive() && (in < 0)) {
+ // KA030=Write end dead
+ throw new IOException(Msg.getString("KA030")); //$NON-NLS-1$
+ }
+
/**
* Set the last thread to be reading on this PipedInputStream. If
* lastReader dies while someone is waiting to write an IOException of
@@ -299,6 +314,7 @@
return -1;
}
if ((attempts-- <= 0) && lastWriter != null && !lastWriter.isAlive()) {
+ // K0076=Pipe broken
throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
}
// Notify callers of receive()
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AbstractStringBuilder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AbstractStringBuilder.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AbstractStringBuilder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AbstractStringBuilder.java Tue Jul 28 09:30:33 2009
@@ -91,7 +91,7 @@
}
private void enlargeBuffer(int min) {
- int newSize = (value.length >> 1 + value.length) + 2;
+ int newSize = ((value.length >> 1) + value.length) + 2;
char[] newData = new char[min > newSize ? min : newSize];
System.arraycopy(value, 0, newData, 0, count);
value = newData;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Math.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Math.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Math.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Math.java Tue Jul 28 09:30:33 2009
@@ -529,7 +529,8 @@
return Double.NaN;
}
/* max(+0.0,-0.0) == +0.0 */
- if (Double.doubleToRawLongBits(d1) != Double.doubleToRawLongBits(0.0d)) {
+ /* 0 == Double.doubleToRawLongBits(0.0d) */
+ if (Double.doubleToRawLongBits(d1) != 0) {
return d2;
}
return 0.0d;
@@ -565,7 +566,8 @@
return Float.NaN;
}
/* max(+0.0,-0.0) == +0.0 */
- if (Float.floatToRawIntBits(f1) != Float.floatToRawIntBits(0.0f)) {
+ /* 0 == Float.floatToRawIntBits(0.0f) */
+ if (Float.floatToRawIntBits(f1) != 0) {
return f2;
}
return 0.0f;
@@ -629,7 +631,8 @@
return Double.NaN;
}
/* min(+0.0,-0.0) == -0.0 */
- if (Double.doubleToRawLongBits(d1) != Double.doubleToRawLongBits(0.0d)) {
+ /* 0x8000000000000000L == Double.doubleToRawLongBits(-0.0d) */
+ if (Double.doubleToRawLongBits(d1) == 0x8000000000000000L) {
return -0.0d;
}
return d2;
@@ -665,7 +668,8 @@
return Float.NaN;
}
/* min(+0.0,-0.0) == -0.0 */
- if (Float.floatToRawIntBits(f1) != Float.floatToRawIntBits(0.0f)) {
+ /* 0x80000000 == Float.floatToRawIntBits(-0.0f) */
+ if (Float.floatToRawIntBits(f1) == 0x80000000) {
return -0.0f;
}
return f2;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/String.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/String.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/String.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/String.java Tue Jul 28 09:30:33 2009
@@ -861,7 +861,12 @@
|| (hashCode != s.hashCode && hashCode != 0 && s.hashCode != 0)) {
return false;
}
- return regionMatches(0, s, 0, count);
+ for (int i = 0; i < count; ++i) {
+ if (value[offset + i] != s.value[s.offset + i]) {
+ return false;
+ }
+ }
+ return true;
}
return false;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java Tue Jul 28 09:30:33 2009
@@ -1196,10 +1196,6 @@
}
Class<?> findClassImpl(String className) {
- Class<?> loadedClass = findLoadedClass(className);
- if (null != loadedClass) {
- return loadedClass;
- }
String partialName = className.replace('.', '/');
final String classFileName = new StringBuilder(partialName).append(".class").toString(); //$NON-NLS-1$
String packageName = null;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java Tue Jul 28 09:30:33 2009
@@ -21,7 +21,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
-import java.lang.reflect.Proxy;
/**
* HashMap is an implementation of Map. All optional operations (adding and
@@ -481,16 +480,9 @@
final Entry<K,V> findNonNullKeyEntry(Object key, int index, int keyHash) {
Entry<K,V> m = elementData[index];
- // To support proxy instance as keys
- if (Proxy.isProxyClass(key.getClass())) {
- while (m != null && (m.origKeyHash != keyHash || key != m.key)) {
- m = m.next;
- }
- } else {
- while (m != null
- && (m.origKeyHash != keyHash || !key.equals(m.key))) {
- m = m.next;
- }
+ while (m != null
+ && (m.origKeyHash != keyHash || !areEqualKeys(key, m.key))) {
+ m = m.next;
}
return m;
}
@@ -824,11 +816,11 @@
}
static boolean areEqualKeys(Object key1, Object key2) {
- return key1.equals(key2);
+ return (key1 == key2) || key1.equals(key2);
}
static boolean areEqualValues(Object value1, Object value2) {
- return value1.equals(value2);
+ return (value1 == value2) || value1.equals(value2);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java Tue Jul 28 09:30:33 2009
@@ -187,14 +187,10 @@
/**
* Starts a new timer.
- *
- * @param isDaemon
+ *
+ * @param name thread's name
+ * @param isDaemon daemon thread or not
*/
- TimerImpl(boolean isDaemon) {
- this.setDaemon(isDaemon);
- this.start();
- }
-
TimerImpl(String name, boolean isDaemon) {
this.setName(name);
this.setDaemon(isDaemon);
@@ -324,60 +320,78 @@
}
}
+
+ private static final class FinalizerHelper {
+ private final TimerImpl impl;
+
+ FinalizerHelper(TimerImpl impl) {
+ super();
+ this.impl = impl;
+ }
+
+ @Override
+ protected void finalize() {
+ synchronized (impl) {
+ impl.finished = true;
+ impl.notify();
+ }
+ }
+ }
+
+ private static long timerId;
+
+ private synchronized static long nextId() {
+ return timerId++;
+ }
/* This object will be used in synchronization purposes */
- private TimerImpl impl;
+ private final TimerImpl impl;
// Used to finalize thread
@SuppressWarnings("unused")
- private Object finalizer = new Object() { // $NON-LOCK-1$
- @Override
- protected void finalize() {
- synchronized (impl) {
- impl.finished = true;
- impl.notify();
- }
- }
- };
+ private final FinalizerHelper finalizer;
/**
- * Creates a new {@code Timer} which may be specified to be run as a daemon thread.
+ * Creates a new named {@code Timer} which may be specified to be run as a
+ * daemon thread.
*
- * @param isDaemon
- * {@code true} if the {@code Timer}'s thread should be a daemon thread.
+ * @param name the name of the {@code Timer}.
+ * @param isDaemon true if {@code Timer}'s thread should be a daemon thread.
+ * @throws NullPointerException is {@code name} is {@code null}
*/
- public Timer(boolean isDaemon) {
- impl = new TimerImpl(isDaemon);
+ public Timer(String name, boolean isDaemon) {
+ super();
+ if (name == null){
+ throw new NullPointerException("name is null");
+ }
+ this.impl = new TimerImpl(name, isDaemon);
+ this.finalizer = new FinalizerHelper(impl);
}
-
+
/**
- * Creates a new non-daemon {@code Timer}.
+ * Creates a new named {@code Timer} which does not run as a daemon thread.
+ *
+ * @param name the name of the Timer.
+ * @throws NullPointerException is {@code name} is {@code null}
*/
- public Timer() {
- impl = new TimerImpl(false);
+ public Timer(String name) {
+ this(name, false);
}
-
+
/**
- * Creates a new named {@code Timer} which may be specified to be run as a
- * daemon thread.
+ * Creates a new {@code Timer} which may be specified to be run as a daemon thread.
*
- * @param name
- * the name of the {@code Timer}.
- * @param isDaemon
- * true if {@code Timer}'s thread should be a daemon thread.
+ * @param isDaemon {@code true} if the {@code Timer}'s thread should be a daemon thread.
*/
- public Timer(String name, boolean isDaemon) {
- impl = new TimerImpl(name, isDaemon);
+ public Timer(boolean isDaemon) {
+ this("Timer-" + Timer.nextId(), isDaemon);
}
/**
- * Creates a new named {@code Timer} which does not run as a daemon thread.
- *
- * @param name
- * the name of the Timer.
+ * Creates a new non-daemon {@code Timer}.
*/
- public Timer(String name) {
- impl = new TimerImpl(name, false);
+ public Timer() {
+ this(false);
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnection.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnection.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnection.java Tue Jul 28 09:30:33 2009
@@ -138,9 +138,9 @@
JarFile openJarFile() throws IOException {
JarFile jar = null;
if (jarFileURL.getProtocol().equals("file")) { //$NON-NLS-1$
- jar = new JarFile(new File(Util.decode(jarFileURL.getFile(), false)),
- true, ZipFile.OPEN_READ);
- } else{
+ jar = new JarFile(new File(Util.decode(jarFileURL.getFile(), false,
+ "UTF-8")), true, ZipFile.OPEN_READ);
+ } else {
final InputStream is = jarFileURL.openConnection().getInputStream();
try {
jar = AccessController
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=798469&r1=798468&r2=798469&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 Tue Jul 28 09:30:33 2009
@@ -323,3 +323,4 @@
KA027=Inputstream of the JarURLConnection has been closed
KA028=Cannot set protocol version when stream in use
KA029=Can't find resource for bundle {0}, key {1}
+KA030=Write end dead
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java Tue Jul 28 09:30:33 2009
@@ -172,6 +172,17 @@
s = s.substring(start, end);
}
+ // Trim the length of very small numbers, natives can only handle down
+ // to E-309
+ final int APPROX_MIN_MAGNITUDE = -359;
+ final int MAX_DIGITS = 52;
+ length = s.length();
+ if (length > MAX_DIGITS && e < APPROX_MIN_MAGNITUDE) {
+ int d = Math.min(APPROX_MIN_MAGNITUDE - e, length - 1);
+ s = s.substring(0, length - d);
+ e += d;
+ }
+
return new StringExponentPair(s, e, negative);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java Tue Jul 28 09:30:33 2009
@@ -20,6 +20,7 @@
import java.io.ByteArrayOutputStream;
import java.io.UTFDataFormatException;
+import java.io.UnsupportedEncodingException;
import java.util.Calendar;
import java.util.TimeZone;
@@ -267,38 +268,61 @@
* java.lang.String The encoded string.
* @return java.lang.String The decoded version.
*/
- public static String decode(String s, boolean convertPlus) {
- if (!convertPlus && s.indexOf('%') == -1)
- return s;
- StringBuilder result = new StringBuilder(s.length());
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- for (int i = 0; i < s.length();) {
- char c = s.charAt(i);
- if (convertPlus && c == '+')
- result.append(' ');
- else if (c == '%') {
- out.reset();
- do {
- if (i + 2 >= s.length())
- throw new IllegalArgumentException(Msg.getString(
- "K01fe", i));
- int d1 = Character.digit(s.charAt(i + 1), 16);
- int d2 = Character.digit(s.charAt(i + 2), 16);
- if (d1 == -1 || d2 == -1)
- throw new IllegalArgumentException(Msg.getString(
- "K01ff", s.substring(i, i + 3), String
- .valueOf(i)));
- out.write((byte) ((d1 << 4) + d2));
- i += 3;
- } while (i < s.length() && s.charAt(i) == '%');
- result.append(out.toString());
- continue;
- } else
- result.append(c);
- i++;
- }
- return result.toString();
- }
+ public static String decode(String s, boolean convertPlus) {
+ return decode(s, convertPlus, null);
+ }
+
+ /**
+ * '%' and two following hex digit characters are converted to the
+ * equivalent byte value. All other characters are passed through
+ * unmodified. e.g. "ABC %24%25" -> "ABC $%"
+ *
+ * @param s
+ * java.lang.String The encoded string.
+ * @param encoding
+ * the specified encoding
+ * @return java.lang.String The decoded version.
+ */
+ public static String decode(String s, boolean convertPlus, String encoding) {
+ if (!convertPlus && s.indexOf('%') == -1)
+ return s;
+ StringBuilder result = new StringBuilder(s.length());
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ for (int i = 0; i < s.length();) {
+ char c = s.charAt(i);
+ if (convertPlus && c == '+')
+ result.append(' ');
+ else if (c == '%') {
+ out.reset();
+ do {
+ if (i + 2 >= s.length())
+ throw new IllegalArgumentException(Msg.getString(
+ "K01fe", i));
+ int d1 = Character.digit(s.charAt(i + 1), 16);
+ int d2 = Character.digit(s.charAt(i + 2), 16);
+ if (d1 == -1 || d2 == -1)
+ throw new IllegalArgumentException(Msg.getString(
+ "K01ff", s.substring(i, i + 3), String
+ .valueOf(i)));
+ out.write((byte) ((d1 << 4) + d2));
+ i += 3;
+ } while (i < s.length() && s.charAt(i) == '%');
+ if (encoding == null) {
+ result.append(out.toString());
+ } else {
+ try {
+ result.append(out.toString(encoding));
+ } catch (UnsupportedEncodingException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ continue;
+ } else
+ result.append(c);
+ i++;
+ }
+ return result.toString();
+ }
public static String toASCIILowerCase(String s) {
int len = s.length();
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c Tue Jul 28 09:30:33 2009
@@ -860,7 +860,7 @@
/* Ignore classpath defines for -jar */
/* XXX -cp is accepted ??? */
/* if user overrides bootclasspath, skip bootclasspath defines */
- if ( (isStandaloneJar && 0 == strcmp (props[l].key, "-Djava.class.path"))
+ if ( (isStandaloneJar && 0 == strncmp (props[l].key, "-Djava.class.path=", 18))
|| (ignoreBCP && 0 == strncmp (props[l].key, "-Xbootclasspath", 15)) )
{
props[l].key[0] = '\0';
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=798469&r1=798468&r2=798469&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 Tue Jul 28 09:30:33 2009
@@ -18,7 +18,7 @@
#include <string.h>
#include "cbigint.h"
-#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX)
+#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX)
#define USE_LL
#endif
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/dblparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/dblparse.c?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/dblparse.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/dblparse.c Tue Jul 28 09:30:33 2009
@@ -22,7 +22,7 @@
#include "harmonyglob.h"
#include "exceptions.h"
-#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX)
+#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX)
#define USE_LL
#endif
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltparse.c?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltparse.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/fltparse.c Tue Jul 28 09:30:33 2009
@@ -22,7 +22,7 @@
#include "harmonyglob.h"
#include "exceptions.h"
-#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(ZOS)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(ZOS) || defined(AIX)
#define USE_LL
#endif
@@ -221,7 +221,6 @@
jfloat result;
numBits = highestSetBitHighPrecision (f, length) + 1;
- numBits -= lowestSetBitHighPrecision (f, length);
if (numBits < 25 && e >= 0 && e < LOG5_OF_TWO_TO_THE_N)
{
return ((jfloat) LOW_I32_FROM_PTR (f)) * tenToTheE (e);
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=798469&r1=798468&r2=798469&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 Tue Jul 28 09:30:33 2009
@@ -181,7 +181,7 @@
vectors[i].iov_len = lengths[i];
i++;
}
- totalRead = readv(fd, vectors, size);
+ totalRead = readv(fd - FD_BIAS, vectors, size);
if(bufsCopied){
(*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
}
@@ -223,7 +223,7 @@
vectors[i].iov_len = lengths[i];
i++;
}
- totalWritten = writev(fd, vectors, size);
+ totalWritten = writev(fd - FD_BIAS, vectors, size);
if(bufsCopied){
(*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
}
@@ -255,7 +255,7 @@
#if defined(AIX) || defined(ZOS)
{
struct sf_parms parms;
- parms.file_descriptor = (int)fd;
+ parms.file_descriptor = (int)fd - FD_BIAS;
parms.file_offset = (off64_t)offset;
parms.file_bytes = count;
parms.header_data = 0;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/procimpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/procimpl.c?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/procimpl.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/procimpl.c Tue Jul 28 09:30:33 2009
@@ -129,6 +129,7 @@
int execvFailure[2] = {0,0};
int forkedChildIsRunning[2] = {0,0};
int error = 0;
+ int writeRC = 0;
/* Build the new io pipes (in/out/err) */
if (pipe(newFD[0]) == -1) goto error;
@@ -173,11 +174,14 @@
dup2(newFD[2][1], 2);
/* tells the parent that that very process is running */
- write(forkedChildIsRunning[1], &dummy, 1);
+ if (-1 == write(forkedChildIsRunning[1], &dummy, 1)) {
+ goto error;
+ }
if (dir) {
if (chdir(dir) == -1) {
- write(execvFailure[1], &errno, sizeof(errno));
+ /* capture return code to fix compiler warning */
+ writeRC = write(execvFailure[1], &errno, sizeof(errno));
exit(-1);
}
}
@@ -192,7 +196,8 @@
/* ===================================================== */
/* if we get here ==> tell the parent that the execv failed ! */
- write(execvFailure[1], &errno, sizeof(errno));
+ /* capture return code to fix compiler warning */
+ writeRC = write(execvFailure[1], &errno, sizeof(errno));
/* If the exec failed, we must exit or there will be two VM processes running. */
exit(rc);
} else {
@@ -212,7 +217,9 @@
*(procHandle) = (IDATA) grdpid;
/* let the forked child start. */
- read(forkedChildIsRunning[0], &dummy, 1);
+ if (-1 == read(forkedChildIsRunning[0], &dummy, 1)) {
+ goto error;
+ }
close(forkedChildIsRunning[0]);
close(forkedChildIsRunning[1]);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.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/BufferedOutputStreamTest.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java Tue Jul 28 09:30:33 2009
@@ -673,7 +673,7 @@
public void test_write_Scenario1() throws IOException {
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
ByteArrayInputStream byteArrayis = null;
- byte[] buffer = "1234567890".getBytes();
+ byte[] buffer = "1234567890".getBytes("UTF-8");
BufferedOutputStream buffos = new BufferedOutputStream(byteArrayos, 10);
buffos.write(buffer, 0, 10);
@@ -722,7 +722,7 @@
public void test_write_Scenario2() throws IOException {
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
ByteArrayInputStream byteArrayis = null;
- byte[] buffer = "1234567890".getBytes();
+ byte[] buffer = "1234567890".getBytes("UTF-8");
BufferedOutputStream buffos = new BufferedOutputStream(byteArrayos, 20);
buffos.write(buffer, 0, 10);
@@ -783,7 +783,7 @@
public void test_write_Scenario3() throws IOException {
ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
ByteArrayInputStream byteArrayis = null;
- byte[] buffer = "1234567890".getBytes();
+ byte[] buffer = "1234567890".getBytes("UTF-8");
BufferedOutputStream buffos = new BufferedOutputStream(byteArrayos, 5);
buffos.write(buffer, 0, 4);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FilterInputStreamTest.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/FilterInputStreamTest.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FilterInputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FilterInputStreamTest.java Tue Jul 28 09:30:33 2009
@@ -92,7 +92,7 @@
byte[] buf1 = new byte[100];
is.read(buf1);
assertTrue("Failed to read correct data", new String(buf1, 0,
- buf1.length).equals(fileString.substring(0, 100)));
+ buf1.length, "UTF-8").equals(fileString.substring(0, 100)));
}
/**
@@ -104,7 +104,7 @@
is.mark(1000);
is.read(buf1, 0, buf1.length);
assertTrue("Failed to read correct data", new String(buf1, 0,
- buf1.length).equals(fileString.substring(3000, 3100)));
+ buf1.length, "UTF-8").equals(fileString.substring(3000, 3100)));
}
/**
@@ -127,7 +127,7 @@
is.skip(1000);
is.read(buf1, 0, buf1.length);
assertTrue("Failed to skip to correct position", new String(buf1, 0,
- buf1.length).equals(fileString.substring(1000, 1010)));
+ buf1.length, "UTF-8").equals(fileString.substring(1000, 1010)));
}
/**
@@ -146,7 +146,7 @@
+ separator, "input.tst");
}
java.io.OutputStream fos = new java.io.FileOutputStream(fileName);
- fos.write(fileString.getBytes());
+ fos.write(fileString.getBytes("UTF-8"));
fos.close();
is = new MyFilterInputStream(new java.io.FileInputStream(fileName));
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ObjectStreamClassTest.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/ObjectStreamClassTest.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ObjectStreamClassTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ObjectStreamClassTest.java Tue Jul 28 09:30:33 2009
@@ -135,7 +135,7 @@
*/
public void test_getSerialVersionUID_classloader() throws Exception {
File file = new File(
- "src/test/resources/org/apache/harmony/luni/tests/ObjectStreamClassTest.jar");
+ "resources/org/apache/harmony/luni/tests/ObjectStreamClassTest.jar");
ClassLoader loader = new URLClassLoader(new URL[] { file.toURL() },
null);
Class cl1 = Class.forName("Test1$TestVarArgs", false, loader);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.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/PipedInputStreamTest.java?rev=798469&r1=798468&r2=798469&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.java Tue Jul 28 09:30:33 2009
@@ -73,11 +73,37 @@
pis.available();
}
- /**
- * @tests java.io.PipedInputStream#available()
- */
- public void test_available() throws Exception {
- // Test for method int java.io.PipedInputStream.available()
+
+ /**
+ * @test java.io.PipedInputStream#read()
+ */
+ public void test_readException() {
+ pis = new PipedInputStream();
+ pos = new PipedOutputStream();
+
+ try {
+ pis.connect(pos);
+ t = new Thread(pw = new PWriter(pos, 1000));
+ t.start();
+ assertTrue(t.isAlive());
+ while (true) {
+ pis.read();
+ t.interrupted();
+ }
+ } catch (IOException e) {
+ assertTrue(e.getMessage().contains("Write end dead"));
+ } finally {
+ try {
+ pis.close();
+ pos.close();
+ } catch (IOException ee) {}
+ }
+ }
+
+ /**
+ * @tests java.io.PipedInputStream#available()
+ */
+ public void test_available() throws Exception {
pis = new PipedInputStream();
pos = new PipedOutputStream();
@@ -418,4 +444,4 @@
return super.buffer.length;
}
}
-}
\ No newline at end of file
+}