harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r437854 [6/7] - in /incubator/harmony/enhanced/classlib/trunk/modules: accessibility/ accessibility/make/ accessibility/src/main/java/org/ accessibility/src/main/java/org/apache/ accessibility/src/main/java/org/apache/harmony/ accessibility...
Date Mon, 28 Aug 2006 21:46:37 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/build.xml?rev=437854&r1=437853&r2=437854&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/build.xml Mon Aug 28 14:46:26 2006
@@ -1,163 +1,163 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Copyright 2006 The Apache Software Foundation or its
-    licensors, as applicable.
-  
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-  
-       http://www.apache.org/licenses/LICENSE-2.0
-  
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-
-<project name="SQL Build" default="build" basedir=".">
-    <description>Build for SQL component</description>
-
-    <!-- import common properties -->
-    <import file="${basedir}/../../make/properties.xml" />
-
-    <!-- set global properties for this build. -->
-    <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
-
-    <fileset id="classes" dir="${hy.build}">
-        <includesfile name="${hy.sql}/make/patternset.txt" />
-        <excludesfile name="${hy.hdk}/build/patternsets/luni-kernel.txt" />
-        <excludesfile name="${hy.hdk}/build/patternsets/security-kernel.txt" />
-    </fileset>
-                               
-    <!-- Set build.compiler to "org.eclipse.jdt.core.JDTCompilerAdapter" to
-	     use the Eclipse Java compiler. -->
-    <property name="build.compiler" value="modern" />
-
-    <target name="build" depends="compile.java, build.jar" />
-
-    <target name="test" depends="build, compile.tests, run.tests" />
-
-    <target name="clean">
-        <delete failonerror="false">
-            <fileset refid="classes" />
-            <fileset dir="${hy.sql.bin.test}" />
-        </delete>
-    </target>
-
-    <target name="compile.java" depends="copy.resources">
-        <echo message="Compiling SQL classes" />
-
-        <javac sourcepath=""
-               srcdir="${hy.sql.src.main.java}"
-               destdir="${hy.build}"
-               source="${hy.javac.source}"
-               target="${hy.javac.target}"
-               debug="${hy.javac.debug}">
-
-            <bootclasspath>
-                <fileset dir="${hy.jdk}/jre/lib/boot">
-                    <include name="**/*.jar" />
-                </fileset>
-            </bootclasspath>
-        </javac>
-    </target>
-
-	<target name="copy.resources">
-    	<mkdir dir="${hy.build}" />
-        <copy todir="${hy.build}" includeemptydirs="false">
-            <fileset dir="${hy.sql.src.main.java}">
-                <exclude name="**/*.java" />
-            </fileset>
-        </copy>
-	</target>
-
-    <target name="build.jar" depends="svn-info">
-        <jar destfile="${hy.jdk}/jre/lib/boot/sql.jar"
-             manifest="${hy.sql}/META-INF/MANIFEST.MF">
-            <fileset refid="classes" />
-            <manifest>
-                <attribute name="Implementation-Version" value="${svn.info}"/> 
-            </manifest>
-        </jar>
-    </target>
-
-    <target name="compile.tests">
-        <echo message="Compiling SQL tests" />
-
-        <mkdir dir="${hy.sql.bin.test}" />
-
-        <javac srcdir="${hy.sql.src.test.java}"
-               destdir="${hy.sql.bin.test}"
-               sourcepath=""
-               source="${hy.javac.source}"
-               target="${hy.javac.target}"
-               debug="${hy.javac.debug}">
-
-            <bootclasspath>
-                <fileset dir="${hy.jdk}/jre/lib/boot">
-                    <include name="**/*.jar" />
-                </fileset>
-            </bootclasspath>
-            <classpath location="${hy.hdk}/build/test/support.jar" />
-        </javac>
-    </target>
-
-    <target name="run.tests">
-
-        <mkdir dir="${hy.tests.reports}" />
-
-        <property name="test.jre.home" value="${hy.jdk}/jre" />
-
-        <junit fork="yes"
-               forkmode="once"
-               printsummary="withOutAndErr"
-               errorproperty="test.errors"
-               failureproperty="test.failures"
-               showoutput="on"
-               dir="${basedir}"
-               jvm="${test.jre.home}/bin/java">
-
-            <jvmarg value="-showversion"/>
-
-            <env key="JAVA_HOME" value="${test.jre.home}"/>
-
-            <classpath>
-                <pathelement path="${hy.sql.bin.test}"/>
-                <pathelement path="${hy.sql.src.test.resources}"/>
-                <pathelement path="${hy.hdk}/build/test/support.jar"/>
-            </classpath>
-            <classpath location="../../build/tests" />
-
-            <formatter type="xml" />
-
-            <test name="${test.case}" todir="${hy.tests.reports}"
-                 if="test.case" />
-
-            <batchtest todir="${hy.tests.reports}" haltonfailure="no"
-                unless="test.case">
-
-                <fileset dir="${hy.sql.src.test.java}">
-                    <include name="**/*Test.java"/>
-
-                    <!-- This test is empty -->
-                    <exclude name="org/apache/harmony/sql/tests/java/sql/ArrayTest.java" />
-                </fileset>
-            </batchtest>
-        </junit>
-        <antcall target="touch-failures-file" />
-        <antcall target="touch-errors-file" />
-    </target>
-
-    <target name="touch-failures-file" if="test.failures">
-        <echo file="${hy.tests.reports}/test.failures"
-            append="true">sql${line.separator}</echo>
-    </target>
-
-    <target name="touch-errors-file" if="test.errors">
-        <echo file="${hy.tests.reports}/test.errors"
-            append="true">sql${line.separator}</echo>
-    </target>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2006 The Apache Software Foundation or its
+    licensors, as applicable.
+  
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<project name="SQL Build" default="build" basedir=".">
+    <description>Build for SQL component</description>
+
+    <!-- import common properties -->
+    <import file="${basedir}/../../make/properties.xml" />
+
+    <!-- set global properties for this build. -->
+    <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
+
+    <fileset id="classes" dir="${hy.build}">
+        <includesfile name="${hy.sql}/make/patternset.txt" />
+        <excludesfile name="${hy.hdk}/build/patternsets/luni-kernel.txt" />
+        <excludesfile name="${hy.hdk}/build/patternsets/security-kernel.txt" />
+    </fileset>
+                               
+    <!-- Set build.compiler to "org.eclipse.jdt.core.JDTCompilerAdapter" to
+         use the Eclipse Java compiler. -->
+    <property name="build.compiler" value="modern" />
+
+    <target name="build" depends="compile.java, copy.resources, build.jar" />
+
+    <target name="test" depends="build, compile.tests, run.tests" />
+
+    <target name="clean">
+        <delete failonerror="false">
+            <fileset refid="classes" />
+            <fileset dir="${hy.sql.bin.test}" />
+        </delete>
+    </target>
+
+    <target name="compile.java">
+        <echo message="Compiling SQL classes" />
+
+        <javac sourcepath=""
+               srcdir="${hy.sql.src.main.java}"
+               destdir="${hy.build}"
+               source="${hy.javac.source}"
+               target="${hy.javac.target}"
+               debug="${hy.javac.debug}">
+
+            <bootclasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+            </bootclasspath>
+        </javac>
+    </target>
+
+    <target name="copy.resources">
+        <mkdir dir="${hy.build}" />
+        <copy todir="${hy.build}" includeemptydirs="false">
+            <fileset dir="${hy.sql.src.main.java}">
+                <exclude name="**/*.java" />
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="build.jar" depends="svn-info">
+        <jar destfile="${hy.jdk}/jre/lib/boot/sql.jar"
+             manifest="${hy.sql}/META-INF/MANIFEST.MF">
+            <fileset refid="classes" />
+            <manifest>
+                <attribute name="Implementation-Version" value="${svn.info}"/> 
+            </manifest>
+        </jar>
+    </target>
+
+    <target name="compile.tests">
+        <echo message="Compiling SQL tests" />
+
+        <mkdir dir="${hy.sql.bin.test}" />
+
+        <javac srcdir="${hy.sql.src.test.java}"
+               destdir="${hy.sql.bin.test}"
+               sourcepath=""
+               source="${hy.javac.source}"
+               target="${hy.javac.target}"
+               debug="${hy.javac.debug}">
+
+            <bootclasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+            </bootclasspath>
+            <classpath location="${hy.hdk}/build/test/support.jar" />
+        </javac>
+    </target>
+
+    <target name="run.tests">
+
+        <mkdir dir="${hy.tests.reports}" />
+
+        <property name="test.jre.home" value="${hy.jdk}/jre" />
+
+        <junit fork="yes"
+               forkmode="once"
+               printsummary="withOutAndErr"
+               errorproperty="test.errors"
+               failureproperty="test.failures"
+               showoutput="on"
+               dir="${basedir}"
+               jvm="${test.jre.home}/bin/java">
+
+            <jvmarg value="-showversion"/>
+
+            <env key="JAVA_HOME" value="${test.jre.home}"/>
+
+            <classpath>
+                <pathelement path="${hy.sql.bin.test}"/>
+                <pathelement path="${hy.sql.src.test.resources}"/>
+                <pathelement path="${hy.hdk}/build/test/support.jar"/>
+            </classpath>
+            <classpath location="../../build/tests" />
+
+            <formatter type="xml" />
+
+            <test name="${test.case}" todir="${hy.tests.reports}"
+                 if="test.case" />
+
+            <batchtest todir="${hy.tests.reports}" haltonfailure="no"
+                unless="test.case">
+
+                <fileset dir="${hy.sql.src.test.java}">
+                    <include name="**/*Test.java"/>
+
+                    <!-- This test is empty -->
+                    <exclude name="org/apache/harmony/sql/tests/java/sql/ArrayTest.java" />
+                </fileset>
+            </batchtest>
+        </junit>
+        <antcall target="touch-failures-file" />
+        <antcall target="touch-errors-file" />
+    </target>
+
+    <target name="touch-failures-file" if="test.failures">
+        <echo file="${hy.tests.reports}/test.failures"
+            append="true">sql${line.separator}</echo>
+    </target>
+
+    <target name="touch-errors-file" if="test.errors">
+        <echo file="${hy.tests.reports}/test.errors"
+            append="true">sql${line.separator}</echo>
+    </target>
+
+</project>

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java?rev=437854&r1=437853&r2=437854&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java Mon Aug 28 14:46:26 2006
@@ -1,4 +1,4 @@
-/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,30 +13,42 @@
  * limitations under the License.
  */
 
+/*
+ * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
+ * All changes made to this file manually will be overwritten 
+ * if this tool runs again. Better make changes in the template file.
+ */
+
 package org.apache.harmony.sql.internal.nls;
 
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
-import org.apache.harmony.luni.util.MsgHelp;
+import org.apache.harmony.kernel.vm.VM;
 
+/**
+ * This class retrieves strings from a resource bundle and returns them,
+ * formatting them with MessageFormat when required.
+ * <p>
+ * It is used by the system classes to provide national language support, by
+ * looking up messages in the <code>
+ *    org.apache.harmony.sql.internal.nls.messages
+ * </code>
+ * resource bundle. Note that if this file is not available, or an invalid key
+ * is looked up, or resource bundle support is not available, the key itself
+ * will be returned as the associated message. This means that the <em>KEY</em>
+ * should a reasonable human-readable (english) string.
+ * 
+ */
 public class Messages {
 
     // ResourceBundle holding the system messages.
     static private ResourceBundle bundle = null;
 
-    static {
-        // Attempt to load the messages.
-        try {
-            bundle = MsgHelp.setLocale(
-                    Locale.getDefault(),
-                    "org.apache.harmony.sql.internal.nls.messages"); //$NON-NLS-1$
-        } catch (Throwable e) {
-            e.printStackTrace();
-        }
-    }
-
     /**
      * Retrieves a message which has no arguments.
      * 
@@ -127,6 +139,103 @@
             }
         }
 
-        return MsgHelp.format(format, args);
+        return format(format, args);
+    }
+    
+    /**
+     * Generates a formatted text string given a source string containing
+     * "argument markers" of the form "{argNum}" where each argNum must be in
+     * the range 0..9. The result is generated by inserting the toString of each
+     * argument into the position indicated in the string.
+     * <p>
+     * To insert the "{" character into the output, use a single backslash
+     * character to escape it (i.e. "\{"). The "}" character does not need to be
+     * escaped.
+     * 
+     * @param format
+     *            String the format to use when printing.
+     * @param args
+     *            Object[] the arguments to use.
+     * @return String the formatted message.
+     */
+    public static String format(String format, Object[] args) {
+        StringBuilder answer = new StringBuilder(format.length()
+                + (args.length * 20));
+        String[] argStrings = new String[args.length];
+        for (int i = 0; i < args.length; ++i) {
+            if (args[i] == null)
+                argStrings[i] = "<null>";	//$NON-NLS-1$
+            else
+                argStrings[i] = args[i].toString();
+        }
+        int lastI = 0;
+        for (int i = format.indexOf('{', 0); i >= 0; i = format.indexOf('{',
+                lastI)) {
+            if (i != 0 && format.charAt(i - 1) == '\\') {
+                // It's escaped, just print and loop.
+                if (i != 1)
+                    answer.append(format.substring(lastI, i - 1));
+                answer.append('{');
+                lastI = i + 1;
+            } else {
+                // It's a format character.
+                if (i > format.length() - 3) {
+                    // Bad format, just print and loop.
+                    answer.append(format.substring(lastI, format.length()));
+                    lastI = format.length();
+                } else {
+                    int argnum = (byte) Character.digit(format.charAt(i + 1),
+                            10);
+                    if (argnum < 0 || format.charAt(i + 2) != '}') {
+                        // Bad format, just print and loop.
+						answer.append(format.substring(lastI, i + 1));
+						lastI = i + 1;
+                    } else {
+                        // Got a good one!
+                        answer.append(format.substring(lastI, i));
+                        if (argnum >= argStrings.length)
+                            answer.append("<missing argument>");	//$NON-NLS-1$
+                        else
+                            answer.append(argStrings[argnum]);
+						lastI = i + 3;
+                    }
+                }
+            }
+        }
+        if (lastI < format.length())
+            answer.append(format.substring(lastI, format.length()));
+        return answer.toString();
+    }
+
+    /**
+     * Changes the locale of the messages.
+     * 
+     * @param locale
+     *            Locale the locale to change to.
+     */
+    static public ResourceBundle setLocale(final Locale locale,
+            final String resource) {
+        try {
+            final ClassLoader loader = VM.bootCallerClassLoader();
+            return (ResourceBundle) AccessController
+                    .doPrivileged(new PrivilegedAction<Object>() {
+                        public Object run() {
+                            return ResourceBundle.getBundle(resource, locale,
+                                    loader != null ? loader : ClassLoader.getSystemClassLoader());
+                        }
+                    });
+        } catch (MissingResourceException e) {
+        }
+        return null;
+    }
+
+    static {
+        // Attempt to load the messages.
+        try {
+            bundle = setLocale(Locale.getDefault(),
+                    "org.apache.harmony.sql.internal.nls.messages"); //$NON-NLS-1$
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/build.xml?rev=437854&r1=437853&r2=437854&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/build.xml Mon Aug 28 14:46:26 2006
@@ -1,211 +1,220 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Copyright 2005, 2006 The Apache Software Foundation or its
-    licensors, as applicable.
-  
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-  
-       http://www.apache.org/licenses/LICENSE-2.0
-  
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-
-<project name="SWING Build" default="build" basedir=".">
-    <description>Build for SWING component</description>
-
-    <!-- import common properties -->
-    <import file="${basedir}/../../make/properties.xml" />
-
-    <!-- set global properties for this build. -->
-    <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
-
-    <fileset id="classes" dir="${hy.build}">
-        <includesfile name="${hy.swing}/make/patternset.txt" />
-        <excludesfile name="${hy.hdk}/build/patternsets/luni-kernel.txt" />
-        <excludesfile name="${hy.hdk}/build/patternsets/security-kernel.txt" />
-    </fileset>
-                               
-    <!-- Set build.compiler to "org.eclipse.jdt.core.JDTCompilerAdapter" to
-	     use the Eclipse Java compiler. -->
-    <property name="build.compiler" value="modern" />
-
-    <property file="../../make/depends.properties" />
-
-    <property name="hy.swing.src.main.java.platform"
-              value="${hy.swing.src.main.java}/../${hy.os}" />
-
-    <property name="hy.swing.src.test.java.platform"
-              value="${hy.swing.src.test.java}/../${hy.os}" />
-
-    <target name="build" depends="compile.java, build.jar" />
-
-    <target name="test" depends="build, run.tests" />
-
-    <target name="clean">
-        <delete failonerror="false">
-            <fileset refid="classes" />
-            <fileset dir="${hy.swing.bin.test}" />
-        </delete>
-    </target>
-
-    <target name="compile.java">
-        <echo message="Compiling SWING classes" />
-
-        <mkdir dir="${hy.build}" />
-
-        <javac sourcepath=""
-               destdir="${hy.build}"
-               source="${hy.javac.source}"
-               target="${hy.javac.target}"
-               debug="${hy.javac.debug}">
-
-            <src>
-                <pathelement location="${hy.swing.src.main.java}"/>
-                <pathelement location="${hy.swing.src.main.java.platform}" />
-            </src>
-
-            <bootclasspath>
-                <fileset dir="${hy.jdk}/jre/lib/boot">
-                    <include name="**/*.jar" />
-                </fileset>
-            </bootclasspath>
-        </javac>
-    </target>
-
-    <target name="build.jar" depends="svn-info">
-        <jar destfile="${hy.jdk}/jre/lib/boot/${hy.swing.packaging.jarname}.jar"
-             manifest="${hy.swing}/META-INF/MANIFEST.MF">
-            <fileset refid="classes" />
-            <manifest>
-                <attribute name="Implementation-Version" value="${svn.info}"/> 
-            </manifest>
-        </jar>
-    </target>
-
-    <target name="compile.tests">
-        <echo message="Compiling SWING tests" />
-
-        <mkdir dir="${hy.swing.bin.test}" />
-
-        <javac srcdir="${hy.swing.src.test.api}/java/common"
-               destdir="${hy.swing.bin.test}"
-               sourcepath=""
-               source="${hy.javac.source}"
-               target="${hy.javac.target}"
-               debug="${hy.javac.debug}">
-
-            <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>
-    </target>
-
-    <target name="run.tests" depends="compile.tests,copy.test.resources"
-            if="with.awt.swing">
-
-        <mkdir dir="${hy.tests.reports}" />
-
-        <property name="test.jre.home" value="${hy.jdk}/jre" />
-
-        <junit fork="yes"
-               forkmode="once"
-               printsummary="withOutAndErr"
-               errorproperty="test.errors"
-               failureproperty="test.failures"
-               showoutput="on"
-               dir="${basedir}"
-               jvm="${test.jre.home}/bin/java">
-
-            <env key="JAVA_HOME" value="${test.jre.home}"/>
-
-            <formatter type="xml" />
-
-            <test name="${test.case}" todir="${hy.tests.reports}"
-                  if="test.case" />
-            <jvmarg value="-Xbootclasspath/a:${hy.swing.bin.test}${path.separator}../../${junit.jar}${path.separator}${hy.hdk}/build/test/support.jar"/>
-
-            <batchtest todir="${hy.tests.reports}" haltonfailure="no"
-                unless="test.case">
-
-                <fileset dir="${hy.swing.src.test.api}/java/common">
-                    <include name="**/*Test*.java"/>
-                    <exclude name="javax/swing/AccessibleJComponent_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/AccessibleJComponent_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/JComponent_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/JEditorPaneTest.java"/>
-                    <exclude name="javax/swing/JFormattedTextField_CommitActionRTest.java"/>
-                    <exclude name="javax/swing/JInternalFrame_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/JTextField_NotifyActionRTest.java"/>
-                    <exclude name="javax/swing/ProgressMonitorTest.java"/>
-                    <exclude name="javax/swing/RobotTestCase.java"/>
-                    <exclude name="javax/swing/SerializableTestCase.java"/>
-                    <exclude name="javax/swing/SpringTest.java"/>
-                    <exclude name="javax/swing/SwingWaitTestCase.java"/>
-                    <exclude name="javax/swing/TestBundle.java"/>
-                    <exclude name="javax/swing/event/SwingPropertyChangeSupportTest.java"/>
-                    <exclude name="javax/swing/plaf/basic/BasicDesktopPaneUIActionsTest.java"/>
-                    <exclude name="javax/swing/plaf/basic/BasicMenuUI_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/plaf/basic/BasicOptionPaneUITest.java"/>
-                    <exclude name="javax/swing/plaf/basic/BasicTreeUITest.java"/>
-                    <exclude name="javax/swing/table/BasicSwingTableTestCase.java"/>
-                    <exclude name="javax/swing/text/AbstractDocument_DefaultDocumentEventTest.java"/>
-                    <exclude name="javax/swing/text/AbstractDocument_ElementEditTest.java"/>
-                    <exclude name="javax/swing/text/AbstractDocument_UpdateTest.java"/>
-                    <exclude name="javax/swing/text/DefaultCaret_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/text/DefaultEditorKitTest.java"/>
-                    <exclude name="javax/swing/text/DefaultEditorKit_Actions_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/text/FlowViewTest.java"/>
-                    <exclude name="javax/swing/text/GapContentTest.java"/>
-                    <exclude name="javax/swing/text/GapContent_InternalTest.java"/>
-                    <exclude name="javax/swing/text/InternationalFormatterTest.java"/>
-                    <exclude name="javax/swing/text/JTextComponentTest.java"/>
-                    <exclude name="javax/swing/text/ParagraphViewTest.java"/>
-                    <exclude name="javax/swing/text/PlainViewI18N_LayoutTest.java"/>
-                    <exclude name="javax/swing/text/PlainViewI18N_LineViewTest.java"/>
-                    <exclude name="javax/swing/text/PlainViewI18N_LineView_UpdateTest.java"/>
-                    <exclude name="javax/swing/text/PlainViewI18N_VisualPositionTest.java"/>
-                    <exclude name="javax/swing/text/StringContentTest.java"/>
-                    <exclude name="javax/swing/text/StringContentTest_CommonTests.java"/>
-                    <exclude name="javax/swing/text/StyleConstantsTest.java"/>
-                    <exclude name="javax/swing/text/StyleContextTest.java"/>
-                    <exclude name="javax/swing/text/StyledEditorKitTest.java"/>
-                    <exclude name="javax/swing/text/TextAction_MultithreadedTest.java"/>
-                    <exclude name="javax/swing/text/ViewTestHelpers.java"/>
-                    <exclude name="javax/swing/text/View_ForwardUpdateRTest.java"/>
-                </fileset>
-            </batchtest>
-        </junit>
-        <antcall target="touch-failures-file" />
-        <antcall target="touch-errors-file" />
-    </target>
-
-    <target name="touch-failures-file" if="test.failures">
-        <echo file="${hy.tests.reports}/test.failures"
-            append="true">swing${line.separator}</echo>
-    </target>
-
-    <target name="touch-errors-file" if="test.errors">
-        <echo file="${hy.tests.reports}/test.errors"
-            append="true">swing${line.separator}</echo>
-    </target>
-
-    <target name="copy.test.resources">
-        <mkdir dir="${hy.swing.bin.test}" />
-        <copy todir="${hy.swing.bin.test}" includeemptydirs="false">
-            <fileset dir="${hy.swing.src.test.resources}">
-                <exclude name="**/*.java" />
-            </fileset>
-        </copy>
-    </target>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2005, 2006 The Apache Software Foundation or its
+    licensors, as applicable.
+  
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<project name="SWING Build" default="build" basedir=".">
+    <description>Build for SWING component</description>
+
+    <!-- import common properties -->
+    <import file="${basedir}/../../make/properties.xml" />
+
+    <!-- set global properties for this build. -->
+    <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
+
+    <fileset id="classes" dir="${hy.build}">
+        <includesfile name="${hy.swing}/make/patternset.txt" />
+        <excludesfile name="${hy.hdk}/build/patternsets/luni-kernel.txt" />
+        <excludesfile name="${hy.hdk}/build/patternsets/security-kernel.txt" />
+    </fileset>
+                               
+    <!-- Set build.compiler to "org.eclipse.jdt.core.JDTCompilerAdapter" to
+         use the Eclipse Java compiler. -->
+    <property name="build.compiler" value="modern" />
+
+    <property file="../../make/depends.properties" />
+
+    <property name="hy.swing.src.main.java.platform"
+              value="${hy.swing.src.main.java}/../${hy.os}" />
+
+    <property name="hy.swing.src.test.java.platform"
+              value="${hy.swing.src.test.java}/../${hy.os}" />
+
+    <target name="build" depends="compile.java, copy.resources, build.jar" />
+
+    <target name="test" depends="build, run.tests" />
+
+    <target name="clean">
+        <delete failonerror="false">
+            <fileset refid="classes" />
+            <fileset dir="${hy.swing.bin.test}" />
+        </delete>
+    </target>
+
+    <target name="compile.java">
+        <echo message="Compiling SWING classes" />
+
+        <mkdir dir="${hy.build}" />
+
+        <javac sourcepath=""
+               destdir="${hy.build}"
+               source="${hy.javac.source}"
+               target="${hy.javac.target}"
+               debug="${hy.javac.debug}">
+
+            <src>
+                <pathelement location="${hy.swing.src.main.java}"/>
+                <pathelement location="${hy.swing.src.main.java.platform}" />
+            </src>
+
+            <bootclasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+            </bootclasspath>
+        </javac>
+    </target>
+
+    <target name="copy.resources">
+        <mkdir dir="${hy.build}" />
+        <copy todir="${hy.build}" includeemptydirs="false">
+            <fileset dir="${hy.swing.src.main.java}">
+                <exclude name="**/*.java" />
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="build.jar" depends="svn-info">
+        <jar destfile="${hy.jdk}/jre/lib/boot/${hy.swing.packaging.jarname}.jar"
+             manifest="${hy.swing}/META-INF/MANIFEST.MF">
+            <fileset refid="classes" />
+            <manifest>
+                <attribute name="Implementation-Version" value="${svn.info}"/> 
+            </manifest>
+        </jar>
+    </target>
+
+    <target name="compile.tests">
+        <echo message="Compiling SWING tests" />
+
+        <mkdir dir="${hy.swing.bin.test}" />
+
+        <javac srcdir="${hy.swing.src.test.api}/java/common"
+               destdir="${hy.swing.bin.test}"
+               sourcepath=""
+               source="${hy.javac.source}"
+               target="${hy.javac.target}"
+               debug="${hy.javac.debug}">
+
+            <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>
+    </target>
+
+    <target name="run.tests" depends="compile.tests,copy.test.resources"
+            if="with.awt.swing">
+
+        <mkdir dir="${hy.tests.reports}" />
+
+        <property name="test.jre.home" value="${hy.jdk}/jre" />
+
+        <junit fork="yes"
+               forkmode="once"
+               printsummary="withOutAndErr"
+               errorproperty="test.errors"
+               failureproperty="test.failures"
+               showoutput="on"
+               dir="${basedir}"
+               jvm="${test.jre.home}/bin/java">
+
+            <env key="JAVA_HOME" value="${test.jre.home}"/>
+
+            <formatter type="xml" />
+
+            <test name="${test.case}" todir="${hy.tests.reports}"
+                  if="test.case" />
+            <jvmarg value="-Xbootclasspath/a:${hy.swing.bin.test}${path.separator}../../${junit.jar}${path.separator}${hy.hdk}/build/test/support.jar"/>
+
+            <batchtest todir="${hy.tests.reports}" haltonfailure="no"
+                unless="test.case">
+
+                <fileset dir="${hy.swing.src.test.api}/java/common">
+                    <include name="**/*Test*.java"/>
+                    <exclude name="javax/swing/AccessibleJComponent_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/AccessibleJComponent_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/JComponent_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/JEditorPaneTest.java"/>
+                    <exclude name="javax/swing/JFormattedTextField_CommitActionRTest.java"/>
+                    <exclude name="javax/swing/JInternalFrame_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/JTextField_NotifyActionRTest.java"/>
+                    <exclude name="javax/swing/ProgressMonitorTest.java"/>
+                    <exclude name="javax/swing/RobotTestCase.java"/>
+                    <exclude name="javax/swing/SerializableTestCase.java"/>
+                    <exclude name="javax/swing/SpringTest.java"/>
+                    <exclude name="javax/swing/SwingWaitTestCase.java"/>
+                    <exclude name="javax/swing/TestBundle.java"/>
+                    <exclude name="javax/swing/event/SwingPropertyChangeSupportTest.java"/>
+                    <exclude name="javax/swing/plaf/basic/BasicDesktopPaneUIActionsTest.java"/>
+                    <exclude name="javax/swing/plaf/basic/BasicMenuUI_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/plaf/basic/BasicOptionPaneUITest.java"/>
+                    <exclude name="javax/swing/plaf/basic/BasicTreeUITest.java"/>
+                    <exclude name="javax/swing/table/BasicSwingTableTestCase.java"/>
+                    <exclude name="javax/swing/text/AbstractDocument_DefaultDocumentEventTest.java"/>
+                    <exclude name="javax/swing/text/AbstractDocument_ElementEditTest.java"/>
+                    <exclude name="javax/swing/text/AbstractDocument_UpdateTest.java"/>
+                    <exclude name="javax/swing/text/DefaultCaret_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/text/DefaultEditorKitTest.java"/>
+                    <exclude name="javax/swing/text/DefaultEditorKit_Actions_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/text/FlowViewTest.java"/>
+                    <exclude name="javax/swing/text/GapContentTest.java"/>
+                    <exclude name="javax/swing/text/GapContent_InternalTest.java"/>
+                    <exclude name="javax/swing/text/InternationalFormatterTest.java"/>
+                    <exclude name="javax/swing/text/JTextComponentTest.java"/>
+                    <exclude name="javax/swing/text/ParagraphViewTest.java"/>
+                    <exclude name="javax/swing/text/PlainViewI18N_LayoutTest.java"/>
+                    <exclude name="javax/swing/text/PlainViewI18N_LineViewTest.java"/>
+                    <exclude name="javax/swing/text/PlainViewI18N_LineView_UpdateTest.java"/>
+                    <exclude name="javax/swing/text/PlainViewI18N_VisualPositionTest.java"/>
+                    <exclude name="javax/swing/text/StringContentTest.java"/>
+                    <exclude name="javax/swing/text/StringContentTest_CommonTests.java"/>
+                    <exclude name="javax/swing/text/StyleConstantsTest.java"/>
+                    <exclude name="javax/swing/text/StyleContextTest.java"/>
+                    <exclude name="javax/swing/text/StyledEditorKitTest.java"/>
+                    <exclude name="javax/swing/text/TextAction_MultithreadedTest.java"/>
+                    <exclude name="javax/swing/text/ViewTestHelpers.java"/>
+                    <exclude name="javax/swing/text/View_ForwardUpdateRTest.java"/>
+                </fileset>
+            </batchtest>
+        </junit>
+        <antcall target="touch-failures-file" />
+        <antcall target="touch-errors-file" />
+    </target>
+
+    <target name="touch-failures-file" if="test.failures">
+        <echo file="${hy.tests.reports}/test.failures"
+            append="true">swing${line.separator}</echo>
+    </target>
+
+    <target name="touch-errors-file" if="test.errors">
+        <echo file="${hy.tests.reports}/test.errors"
+            append="true">swing${line.separator}</echo>
+    </target>
+
+    <target name="copy.test.resources">
+        <mkdir dir="${hy.swing.bin.test}" />
+        <copy todir="${hy.swing.bin.test}" includeemptydirs="false">
+            <fileset dir="${hy.swing.src.test.resources}">
+                <exclude name="**/*.java" />
+            </fileset>
+        </copy>
+    </target>
+
+</project>

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/make/patternset.txt
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/make/patternset.txt?rev=437854&r1=437853&r2=437854&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/make/patternset.txt (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/make/patternset.txt Mon Aug 28 14:46:26 2006
@@ -36,3 +36,5 @@
 org/apache/harmony/x/swing/filechooser/windows/*
 org/apache/harmony/x/swing/plaf/resources/basic/*
 org/apache/harmony/x/swing/plaf/resources/metal/*
+
+org/apache/harmony/swing/internal/nls/*

Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/Messages.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/Messages.java?rev=437854&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/Messages.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/Messages.java Mon Aug 28 14:46:26 2006
@@ -0,0 +1,241 @@
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
+ * All changes made to this file manually will be overwritten 
+ * if this tool runs again. Better make changes in the template file.
+ */
+
+package org.apache.harmony.swing.internal.nls;
+
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.harmony.kernel.vm.VM;
+
+/**
+ * This class retrieves strings from a resource bundle and returns them,
+ * formatting them with MessageFormat when required.
+ * <p>
+ * It is used by the system classes to provide national language support, by
+ * looking up messages in the <code>
+ *    org.apache.harmony.swing.internal.nls.messages
+ * </code>
+ * resource bundle. Note that if this file is not available, or an invalid key
+ * is looked up, or resource bundle support is not available, the key itself
+ * will be returned as the associated message. This means that the <em>KEY</em>
+ * should a reasonable human-readable (english) string.
+ * 
+ */
+public class Messages {
+
+    // ResourceBundle holding the system messages.
+    static private ResourceBundle bundle = null;
+
+    /**
+     * Retrieves a message which has no arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg) {
+        if (bundle == null)
+            return msg;
+        try {
+            return bundle.getString(msg);
+        } catch (MissingResourceException e) {
+            return "Missing message: " + msg; //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * Retrieves a message which takes 1 argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            Object the object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg) {
+        return getString(msg, new Object[] { arg });
+    }
+
+    /**
+     * Retrieves a message which takes 1 integer argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            int the integer to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, int arg) {
+        return getString(msg, new Object[] { Integer.toString(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 1 character argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            char the character to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, char arg) {
+        return getString(msg, new Object[] { String.valueOf(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 2 arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg1
+     *            Object an object to insert in the formatted output.
+     * @param arg2
+     *            Object another object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg1, Object arg2) {
+        return getString(msg, new Object[] { arg1, arg2 });
+    }
+
+    /**
+     * Retrieves a message which takes several arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param args
+     *            Object[] the objects to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object[] args) {
+        String format = msg;
+
+        if (bundle != null) {
+            try {
+                format = bundle.getString(msg);
+            } catch (MissingResourceException e) {
+            }
+        }
+
+        return format(format, args);
+    }
+    
+    /**
+     * Generates a formatted text string given a source string containing
+     * "argument markers" of the form "{argNum}" where each argNum must be in
+     * the range 0..9. The result is generated by inserting the toString of each
+     * argument into the position indicated in the string.
+     * <p>
+     * To insert the "{" character into the output, use a single backslash
+     * character to escape it (i.e. "\{"). The "}" character does not need to be
+     * escaped.
+     * 
+     * @param format
+     *            String the format to use when printing.
+     * @param args
+     *            Object[] the arguments to use.
+     * @return String the formatted message.
+     */
+    public static String format(String format, Object[] args) {
+        StringBuilder answer = new StringBuilder(format.length()
+                + (args.length * 20));
+        String[] argStrings = new String[args.length];
+        for (int i = 0; i < args.length; ++i) {
+            if (args[i] == null)
+                argStrings[i] = "<null>";	//$NON-NLS-1$
+            else
+                argStrings[i] = args[i].toString();
+        }
+        int lastI = 0;
+        for (int i = format.indexOf('{', 0); i >= 0; i = format.indexOf('{',
+                lastI)) {
+            if (i != 0 && format.charAt(i - 1) == '\\') {
+                // It's escaped, just print and loop.
+                if (i != 1)
+                    answer.append(format.substring(lastI, i - 1));
+                answer.append('{');
+                lastI = i + 1;
+            } else {
+                // It's a format character.
+                if (i > format.length() - 3) {
+                    // Bad format, just print and loop.
+                    answer.append(format.substring(lastI, format.length()));
+                    lastI = format.length();
+                } else {
+                    int argnum = (byte) Character.digit(format.charAt(i + 1),
+                            10);
+                    if (argnum < 0 || format.charAt(i + 2) != '}') {
+                        // Bad format, just print and loop.
+						answer.append(format.substring(lastI, i + 1));
+						lastI = i + 1;
+                    } else {
+                        // Got a good one!
+                        answer.append(format.substring(lastI, i));
+                        if (argnum >= argStrings.length)
+                            answer.append("<missing argument>");	//$NON-NLS-1$
+                        else
+                            answer.append(argStrings[argnum]);
+						lastI = i + 3;
+                    }
+                }
+            }
+        }
+        if (lastI < format.length())
+            answer.append(format.substring(lastI, format.length()));
+        return answer.toString();
+    }
+
+    /**
+     * Changes the locale of the messages.
+     * 
+     * @param locale
+     *            Locale the locale to change to.
+     */
+    static public ResourceBundle setLocale(final Locale locale,
+            final String resource) {
+        try {
+            final ClassLoader loader = VM.bootCallerClassLoader();
+            return (ResourceBundle) AccessController
+                    .doPrivileged(new PrivilegedAction<Object>() {
+                        public Object run() {
+                            return ResourceBundle.getBundle(resource, locale,
+                                    loader != null ? loader : ClassLoader.getSystemClassLoader());
+                        }
+                    });
+        } catch (MissingResourceException e) {
+        }
+        return null;
+    }
+
+    static {
+        // Attempt to load the messages.
+        try {
+            bundle = setLocale(Locale.getDefault(),
+                    "org.apache.harmony.swing.internal.nls.messages"); //$NON-NLS-1$
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/messages.properties?rev=437854&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/messages.properties (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/messages.properties Mon Aug 28 14:46:26 2006
@@ -0,0 +1,16 @@
+# Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
+#  
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#  
+#      http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+# 
+
+# messages for EN locale

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/swing/internal/nls/messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/build.xml?rev=437854&r1=437853&r2=437854&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/build.xml Mon Aug 28 14:46:26 2006
@@ -32,45 +32,45 @@
     </fileset>
                                
     <!-- Set build.compiler to "org.eclipse.jdt.core.JDTCompilerAdapter" to
-	     use the Eclipse Java compiler. -->
+         use the Eclipse Java compiler. -->
     <property name="build.compiler" value="modern" />
-	
-	<property name="iculib.zip" location="${depends.oss}/icu4c-3.4-harmony.zip" />
+    
+    <property name="iculib.zip" location="${depends.oss}/icu4c-3.4-harmony.zip" />
 
-    <target name="build" depends="compile.java, build.jar" />
+    <target name="build" depends="compile.java, copy.resources, build.jar" />
 
     <target name="test" depends="build, compile.tests, run.tests" />
-	
+    
     <target name="overlay-oss">
-	<mkdir dir="${hy.text.src.main.native}/icu4c/unicode" />
-	<unzip src="${iculib.zip}" dest="${hy.text.src.main.native}/icu4c/unicode" />
-	<chmod dir="${hy.text.src.main.native}/icu4c/unicode" perm="ugo+r" />
-	<antcall target="copy.libs" inheritall="true" />
-    </target>
-	<target name="copy.libs" if="is.x86_64">
-	    <copy todir="${hy.text.src.main.native}/icu4c/unicode" overwrite="yes">
-	            <fileset dir="${depends.libs}" includes="*${shlib.suffix}*" />
-	    </copy>
+    <mkdir dir="${hy.text.src.main.native}/icu4c/unicode" />
+    <unzip src="${iculib.zip}" dest="${hy.text.src.main.native}/icu4c/unicode" />
+    <chmod dir="${hy.text.src.main.native}/icu4c/unicode" perm="ugo+r" />
+    <antcall target="copy.libs" inheritall="true" />
+    </target>
+    <target name="copy.libs" if="is.x86_64">
+        <copy todir="${hy.text.src.main.native}/icu4c/unicode" overwrite="yes">
+                <fileset dir="${depends.libs}" includes="*${shlib.suffix}*" />
+        </copy>
     </target>
     <target name="clean-overlay-oss">
-	<delete dir="${hy.text.src.main.native}/icu4c" quiet="true" />
+    <delete dir="${hy.text.src.main.native}/icu4c" quiet="true" />
     </target>
-	
+    
     <!-- Build native code -->
     <target name="build.native" >
-	<make dir="${hy.text.src.main.native}/text/${hy.os}" />
+    <make dir="${hy.text.src.main.native}/text/${hy.os}" />
 
-	<!-- Copy the built shared libs over to the jre/bin dir -->
-	<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
-	    <fileset dir="${hy.text.src.main.native}/text">
+    <!-- Copy the built shared libs over to the jre/bin dir -->
+    <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
+        <fileset dir="${hy.text.src.main.native}/text">
                 <patternset includes="*${shlib.suffix}*" />
             </fileset>
         </copy>
     </target>
-	
+    
     <!-- Clean natives -->
     <target name="clean.native">
-	<make dir="${hy.text.src.main.native}/text/${hy.os}" target="clean" />
+    <make dir="${hy.text.src.main.native}/text/${hy.os}" target="clean" />
     </target>
 
     <target name="clean">
@@ -98,6 +98,15 @@
                 </fileset>
             </bootclasspath>
         </javac>
+    </target>
+
+    <target name="copy.resources">
+        <mkdir dir="${hy.build}" />
+        <copy todir="${hy.build}" includeemptydirs="false">
+            <fileset dir="${hy.text.src.main.java}">
+                <exclude name="**/*.java" />
+            </fileset>
+        </copy>
     </target>
 
     <target name="build.jar" depends="svn-info">

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/make/patternset.txt
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/make/patternset.txt?rev=437854&r1=437853&r2=437854&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/make/patternset.txt (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/make/patternset.txt Mon Aug 28 14:46:26 2006
@@ -1,16 +1,18 @@
-# Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-#     http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-java/text/*
-org/apache/harmony/text/*
+# Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+java/text/*
+org/apache/harmony/text/*
+
+org/apache/harmony/text/internal/nls/*

Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java?rev=437854&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java Mon Aug 28 14:46:26 2006
@@ -0,0 +1,241 @@
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
+ * All changes made to this file manually will be overwritten 
+ * if this tool runs again. Better make changes in the template file.
+ */
+
+package org.apache.harmony.text.internal.nls;
+
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.harmony.kernel.vm.VM;
+
+/**
+ * This class retrieves strings from a resource bundle and returns them,
+ * formatting them with MessageFormat when required.
+ * <p>
+ * It is used by the system classes to provide national language support, by
+ * looking up messages in the <code>
+ *    org.apache.harmony.text.internal.nls.messages
+ * </code>
+ * resource bundle. Note that if this file is not available, or an invalid key
+ * is looked up, or resource bundle support is not available, the key itself
+ * will be returned as the associated message. This means that the <em>KEY</em>
+ * should a reasonable human-readable (english) string.
+ * 
+ */
+public class Messages {
+
+    // ResourceBundle holding the system messages.
+    static private ResourceBundle bundle = null;
+
+    /**
+     * Retrieves a message which has no arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg) {
+        if (bundle == null)
+            return msg;
+        try {
+            return bundle.getString(msg);
+        } catch (MissingResourceException e) {
+            return "Missing message: " + msg; //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * Retrieves a message which takes 1 argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            Object the object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg) {
+        return getString(msg, new Object[] { arg });
+    }
+
+    /**
+     * Retrieves a message which takes 1 integer argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            int the integer to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, int arg) {
+        return getString(msg, new Object[] { Integer.toString(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 1 character argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            char the character to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, char arg) {
+        return getString(msg, new Object[] { String.valueOf(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 2 arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg1
+     *            Object an object to insert in the formatted output.
+     * @param arg2
+     *            Object another object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg1, Object arg2) {
+        return getString(msg, new Object[] { arg1, arg2 });
+    }
+
+    /**
+     * Retrieves a message which takes several arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param args
+     *            Object[] the objects to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object[] args) {
+        String format = msg;
+
+        if (bundle != null) {
+            try {
+                format = bundle.getString(msg);
+            } catch (MissingResourceException e) {
+            }
+        }
+
+        return format(format, args);
+    }
+    
+    /**
+     * Generates a formatted text string given a source string containing
+     * "argument markers" of the form "{argNum}" where each argNum must be in
+     * the range 0..9. The result is generated by inserting the toString of each
+     * argument into the position indicated in the string.
+     * <p>
+     * To insert the "{" character into the output, use a single backslash
+     * character to escape it (i.e. "\{"). The "}" character does not need to be
+     * escaped.
+     * 
+     * @param format
+     *            String the format to use when printing.
+     * @param args
+     *            Object[] the arguments to use.
+     * @return String the formatted message.
+     */
+    public static String format(String format, Object[] args) {
+        StringBuilder answer = new StringBuilder(format.length()
+                + (args.length * 20));
+        String[] argStrings = new String[args.length];
+        for (int i = 0; i < args.length; ++i) {
+            if (args[i] == null)
+                argStrings[i] = "<null>";	//$NON-NLS-1$
+            else
+                argStrings[i] = args[i].toString();
+        }
+        int lastI = 0;
+        for (int i = format.indexOf('{', 0); i >= 0; i = format.indexOf('{',
+                lastI)) {
+            if (i != 0 && format.charAt(i - 1) == '\\') {
+                // It's escaped, just print and loop.
+                if (i != 1)
+                    answer.append(format.substring(lastI, i - 1));
+                answer.append('{');
+                lastI = i + 1;
+            } else {
+                // It's a format character.
+                if (i > format.length() - 3) {
+                    // Bad format, just print and loop.
+                    answer.append(format.substring(lastI, format.length()));
+                    lastI = format.length();
+                } else {
+                    int argnum = (byte) Character.digit(format.charAt(i + 1),
+                            10);
+                    if (argnum < 0 || format.charAt(i + 2) != '}') {
+                        // Bad format, just print and loop.
+						answer.append(format.substring(lastI, i + 1));
+						lastI = i + 1;
+                    } else {
+                        // Got a good one!
+                        answer.append(format.substring(lastI, i));
+                        if (argnum >= argStrings.length)
+                            answer.append("<missing argument>");	//$NON-NLS-1$
+                        else
+                            answer.append(argStrings[argnum]);
+						lastI = i + 3;
+                    }
+                }
+            }
+        }
+        if (lastI < format.length())
+            answer.append(format.substring(lastI, format.length()));
+        return answer.toString();
+    }
+
+    /**
+     * Changes the locale of the messages.
+     * 
+     * @param locale
+     *            Locale the locale to change to.
+     */
+    static public ResourceBundle setLocale(final Locale locale,
+            final String resource) {
+        try {
+            final ClassLoader loader = VM.bootCallerClassLoader();
+            return (ResourceBundle) AccessController
+                    .doPrivileged(new PrivilegedAction<Object>() {
+                        public Object run() {
+                            return ResourceBundle.getBundle(resource, locale,
+                                    loader != null ? loader : ClassLoader.getSystemClassLoader());
+                        }
+                    });
+        } catch (MissingResourceException e) {
+        }
+        return null;
+    }
+
+    static {
+        // Attempt to load the messages.
+        try {
+            bundle = setLocale(Locale.getDefault(),
+                    "org.apache.harmony.text.internal.nls.messages"); //$NON-NLS-1$
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties?rev=437854&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties Mon Aug 28 14:46:26 2006
@@ -0,0 +1,16 @@
+# Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
+#  
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#  
+#      http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+# 
+
+# messages for EN locale

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml?rev=437854&r1=437853&r2=437854&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml Mon Aug 28 14:46:26 2006
@@ -17,13 +17,13 @@
 -->
 
 <project name="Tools Build" default="build" basedir=".">
-	<description>Build for Tools component</description>
+    <description>Build for Tools component</description>
 
-	<!-- import common properties -->
-	<import file="${basedir}/../../make/properties.xml" />
+    <!-- import common properties -->
+    <import file="${basedir}/../../make/properties.xml" />
 
-	<!-- set global properties for this build. -->
-	<xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
+    <!-- set global properties for this build. -->
+    <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
 
     <fileset id="classes" dir="${hy.build}">
         <includesfile name="${hy.tools}/make/patternset.txt" />
@@ -31,88 +31,97 @@
         <excludesfile name="${hy.hdk}/build/patternsets/security-kernel.txt" />
     </fileset>
                                
-	<!-- Set build.compiler to "org.eclipse.jdt.core.JDTCompilerAdapter" to
-	     use the Eclipse Java compiler. -->
-	<property name="build.compiler" value="modern" />
+    <!-- Set build.compiler to "org.eclipse.jdt.core.JDTCompilerAdapter" to
+         use the Eclipse Java compiler. -->
+    <property name="build.compiler" value="modern" />
 
-	<target name="build" depends="compile.java, build.jar" />
+    <target name="build" depends="compile.java, copy.resources, build.jar" />
 
-	<target name="test" depends="build, compile.tests, run.tests" />
+    <target name="test" depends="build, compile.tests, run.tests" />
 
-	<target name="clean">
-		<delete failonerror="false">
+    <target name="clean">
+        <delete failonerror="false">
             <fileset refid="classes" />
-			<fileset dir="${hy.tools.bin.test}" />
-		</delete>
-	</target>
+            <fileset dir="${hy.tools.bin.test}" />
+        </delete>
+    </target>
 
-	<target name="compile.java">
-		<echo message="Compiling TOOLS classes" />
+    <target name="compile.java">
+        <echo message="Compiling TOOLS classes" />
 
-		<mkdir dir="${hy.build}" />
-		<mkdir dir="${hy.jdk}/lib" />
+        <mkdir dir="${hy.build}" />
+        <mkdir dir="${hy.jdk}/lib" />
 
-		<javac sourcepath=""
+        <javac sourcepath=""
                srcdir="${hy.tools.src.main.java}"
                destdir="${hy.build}"
                source="${hy.javac.source}"
                target="${hy.javac.target}"
                debug="${hy.javac.debug}">
 
-			<bootclasspath>
-				<fileset dir="${hy.jdk}/jre/lib/boot">
-					<include name="**/*.jar" />
-				</fileset>
-				<fileset dir="${hy.jdk}/lib">
-					<include name="**/*.jar" />
-				</fileset>
-			</bootclasspath>
-		</javac>
-	</target>
+            <bootclasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+                <fileset dir="${hy.jdk}/lib">
+                    <include name="**/*.jar" />
+                </fileset>
+            </bootclasspath>
+        </javac>
+    </target>
+
+    <target name="copy.resources">
+        <mkdir dir="${hy.build}" />
+        <copy todir="${hy.build}" includeemptydirs="false">
+            <fileset dir="${hy.tools.src.main.java}">
+                <exclude name="**/*.java" />
+            </fileset>
+        </copy>
+    </target>
 
-	<target name="build.jar" depends="svn-info">
-		<mkdir dir="${hy.jdk}/lib" />
+    <target name="build.jar" depends="svn-info">
+        <mkdir dir="${hy.jdk}/lib" />
 
-		<jar destfile="${hy.jdk}/lib/tools.jar"
+        <jar destfile="${hy.jdk}/lib/tools.jar"
              manifest="${hy.tools}/META-INF/MANIFEST.MF">
             <fileset refid="classes" />
             <manifest>
                 <attribute name="Implementation-Version" value="${svn.info}"/> 
             </manifest>
-		</jar>
-	</target>
+        </jar>
+    </target>
 
-	<target name="compile.tests">
-		<echo message="Compiling Tools tests" />
+    <target name="compile.tests">
+        <echo message="Compiling Tools tests" />
 
-		<mkdir dir="${hy.tools.bin.test}" />
+        <mkdir dir="${hy.tools.bin.test}" />
 
-		<javac srcdir="${hy.tools.src.test.java}"
+        <javac srcdir="${hy.tools.src.test.java}"
                destdir="${hy.tools.bin.test}"
                sourcepath=""
                source="${hy.javac.source}"
                target="${hy.javac.target}"
                debug="${hy.javac.debug}">
 
-			<bootclasspath>
-				<fileset dir="${hy.jdk}/jre/lib/boot">
-					<include name="**/*.jar" />
-				</fileset>
-				<fileset dir="${hy.jdk}/lib">
-					<include name="**/*.jar" />
-				</fileset>
-			</bootclasspath>
-			<classpath location="../../build/tests" />
-		</javac>
-	</target>
+            <bootclasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+                <fileset dir="${hy.jdk}/lib">
+                    <include name="**/*.jar" />
+                </fileset>
+            </bootclasspath>
+            <classpath location="../../build/tests" />
+        </javac>
+    </target>
 
-	<target name="run.tests">
+    <target name="run.tests">
 
-		<mkdir dir="${hy.tests.reports}" />
+        <mkdir dir="${hy.tests.reports}" />
 
-		<property name="test.jre.home" value="${hy.jdk}/jre" />
+        <property name="test.jre.home" value="${hy.jdk}/jre" />
 
-		<junit fork="yes"
+        <junit fork="yes"
                        forkmode="once"
                        printsummary="withOutAndErr"
                        errorproperty="test.errors"
@@ -121,40 +130,40 @@
                        dir="${basedir}"
                        jvm="${test.jre.home}/bin/java">
 
-			<jvmarg value="-showversion"/>
+            <jvmarg value="-showversion"/>
 
-			<env key="JAVA_HOME" value="${test.jre.home}"/>
+            <env key="JAVA_HOME" value="${test.jre.home}"/>
 
-			<classpath>
-				<pathelement path="${hy.tools.bin.test}"/>
-			</classpath>
-			<classpath location="../../build/tests" />
+            <classpath>
+                <pathelement path="${hy.tools.bin.test}"/>
+            </classpath>
+            <classpath location="../../build/tests" />
 
-			<formatter type="xml" />
+            <formatter type="xml" />
 
-			<test name="${test.case}" todir="${hy.tests.reports}"
+            <test name="${test.case}" todir="${hy.tests.reports}"
                               if="test.case" />
 
-			<batchtest todir="${hy.tests.reports}" haltonfailure="no"
+            <batchtest todir="${hy.tests.reports}" haltonfailure="no"
                                    unless="test.case">
 
-				<fileset dir="${hy.tools.src.test.java}">
-					<include name="**/*Test.java"/>
-				</fileset>
-			</batchtest>
-		</junit>
-		<antcall target="touch-failures-file" />
-		<antcall target="touch-errors-file" />
-	</target>
+                <fileset dir="${hy.tools.src.test.java}">
+                    <include name="**/*Test.java"/>
+                </fileset>
+            </batchtest>
+        </junit>
+        <antcall target="touch-failures-file" />
+        <antcall target="touch-errors-file" />
+    </target>
 
-	<target name="touch-failures-file" if="test.failures">
-		<echo file="${hy.tests.reports}/test.failures"
+    <target name="touch-failures-file" if="test.failures">
+        <echo file="${hy.tests.reports}/test.failures"
             append="true">tools${line.separator}</echo>
-	</target>
+    </target>
 
-	<target name="touch-errors-file" if="test.errors">
-		<echo file="${hy.tests.reports}/test.errors"
+    <target name="touch-errors-file" if="test.errors">
+        <echo file="${hy.tests.reports}/test.errors"
             append="true">tools${line.separator}</echo>
-	</target>
+    </target>
 
 </project>

Added: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/Messages.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/Messages.java?rev=437854&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/Messages.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/Messages.java Mon Aug 28 14:46:26 2006
@@ -0,0 +1,241 @@
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
+ * All changes made to this file manually will be overwritten 
+ * if this tool runs again. Better make changes in the template file.
+ */
+
+package org.apache.harmony.tools.internal.nls;
+
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.harmony.kernel.vm.VM;
+
+/**
+ * This class retrieves strings from a resource bundle and returns them,
+ * formatting them with MessageFormat when required.
+ * <p>
+ * It is used by the system classes to provide national language support, by
+ * looking up messages in the <code>
+ *    org.apache.harmony.tools.internal.nls.messages
+ * </code>
+ * resource bundle. Note that if this file is not available, or an invalid key
+ * is looked up, or resource bundle support is not available, the key itself
+ * will be returned as the associated message. This means that the <em>KEY</em>
+ * should a reasonable human-readable (english) string.
+ * 
+ */
+public class Messages {
+
+    // ResourceBundle holding the system messages.
+    static private ResourceBundle bundle = null;
+
+    /**
+     * Retrieves a message which has no arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg) {
+        if (bundle == null)
+            return msg;
+        try {
+            return bundle.getString(msg);
+        } catch (MissingResourceException e) {
+            return "Missing message: " + msg; //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * Retrieves a message which takes 1 argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            Object the object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg) {
+        return getString(msg, new Object[] { arg });
+    }
+
+    /**
+     * Retrieves a message which takes 1 integer argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            int the integer to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, int arg) {
+        return getString(msg, new Object[] { Integer.toString(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 1 character argument.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg
+     *            char the character to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, char arg) {
+        return getString(msg, new Object[] { String.valueOf(arg) });
+    }
+
+    /**
+     * Retrieves a message which takes 2 arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param arg1
+     *            Object an object to insert in the formatted output.
+     * @param arg2
+     *            Object another object to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object arg1, Object arg2) {
+        return getString(msg, new Object[] { arg1, arg2 });
+    }
+
+    /**
+     * Retrieves a message which takes several arguments.
+     * 
+     * @param msg
+     *            String the key to look up.
+     * @param args
+     *            Object[] the objects to insert in the formatted output.
+     * @return String the message for that key in the system message bundle.
+     */
+    static public String getString(String msg, Object[] args) {
+        String format = msg;
+
+        if (bundle != null) {
+            try {
+                format = bundle.getString(msg);
+            } catch (MissingResourceException e) {
+            }
+        }
+
+        return format(format, args);
+    }
+    
+    /**
+     * Generates a formatted text string given a source string containing
+     * "argument markers" of the form "{argNum}" where each argNum must be in
+     * the range 0..9. The result is generated by inserting the toString of each
+     * argument into the position indicated in the string.
+     * <p>
+     * To insert the "{" character into the output, use a single backslash
+     * character to escape it (i.e. "\{"). The "}" character does not need to be
+     * escaped.
+     * 
+     * @param format
+     *            String the format to use when printing.
+     * @param args
+     *            Object[] the arguments to use.
+     * @return String the formatted message.
+     */
+    public static String format(String format, Object[] args) {
+        StringBuilder answer = new StringBuilder(format.length()
+                + (args.length * 20));
+        String[] argStrings = new String[args.length];
+        for (int i = 0; i < args.length; ++i) {
+            if (args[i] == null)
+                argStrings[i] = "<null>";	//$NON-NLS-1$
+            else
+                argStrings[i] = args[i].toString();
+        }
+        int lastI = 0;
+        for (int i = format.indexOf('{', 0); i >= 0; i = format.indexOf('{',
+                lastI)) {
+            if (i != 0 && format.charAt(i - 1) == '\\') {
+                // It's escaped, just print and loop.
+                if (i != 1)
+                    answer.append(format.substring(lastI, i - 1));
+                answer.append('{');
+                lastI = i + 1;
+            } else {
+                // It's a format character.
+                if (i > format.length() - 3) {
+                    // Bad format, just print and loop.
+                    answer.append(format.substring(lastI, format.length()));
+                    lastI = format.length();
+                } else {
+                    int argnum = (byte) Character.digit(format.charAt(i + 1),
+                            10);
+                    if (argnum < 0 || format.charAt(i + 2) != '}') {
+                        // Bad format, just print and loop.
+						answer.append(format.substring(lastI, i + 1));
+						lastI = i + 1;
+                    } else {
+                        // Got a good one!
+                        answer.append(format.substring(lastI, i));
+                        if (argnum >= argStrings.length)
+                            answer.append("<missing argument>");	//$NON-NLS-1$
+                        else
+                            answer.append(argStrings[argnum]);
+						lastI = i + 3;
+                    }
+                }
+            }
+        }
+        if (lastI < format.length())
+            answer.append(format.substring(lastI, format.length()));
+        return answer.toString();
+    }
+
+    /**
+     * Changes the locale of the messages.
+     * 
+     * @param locale
+     *            Locale the locale to change to.
+     */
+    static public ResourceBundle setLocale(final Locale locale,
+            final String resource) {
+        try {
+            final ClassLoader loader = VM.bootCallerClassLoader();
+            return (ResourceBundle) AccessController
+                    .doPrivileged(new PrivilegedAction<Object>() {
+                        public Object run() {
+                            return ResourceBundle.getBundle(resource, locale,
+                                    loader != null ? loader : ClassLoader.getSystemClassLoader());
+                        }
+                    });
+        } catch (MissingResourceException e) {
+        }
+        return null;
+    }
+
+    static {
+        // Attempt to load the messages.
+        try {
+            bundle = setLocale(Locale.getDefault(),
+                    "org.apache.harmony.tools.internal.nls.messages"); //$NON-NLS-1$
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/messages.properties?rev=437854&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/messages.properties (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/messages.properties Mon Aug 28 14:46:26 2006
@@ -0,0 +1,16 @@
+# Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
+#  
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#  
+#      http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+# 
+
+# messages for EN locale

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/internal/nls/messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message