Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 89835 invoked from network); 28 Aug 2006 21:47:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Aug 2006 21:47:52 -0000 Received: (qmail 17719 invoked by uid 500); 28 Aug 2006 21:47:51 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 17523 invoked by uid 500); 28 Aug 2006 21:47:51 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 17479 invoked by uid 99); 28 Aug 2006 21:47:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Aug 2006 14:47:50 -0700 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Aug 2006 14:47:45 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 41A711A981A; Mon, 28 Aug 2006 14:47:25 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r437854 [3/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 -0000 To: harmony-commits@incubator.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060828214725.41A711A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/harmony/enhanced/classlib/trunk/modules/instrument/make/patternset.txt URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/instrument/make/patternset.txt?rev=437854&r1=437853&r2=437854&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/instrument/make/patternset.txt (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/instrument/make/patternset.txt Mon Aug 28 14:46:26 2006 @@ -1,18 +1,19 @@ -# 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. - -java/lang/instrument/* - -org/apache/harmony/instrument/internal/* - +# 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. + +java/lang/instrument/* + +org/apache/harmony/instrument/internal/* +org/apache/harmony/instrument/internal/nls/* + Added: incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/Messages.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/Messages.java?rev=437854&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/Messages.java (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/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.instrument.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. + *

+ * It is used by the system classes to provide national language support, by + * looking up messages in the + * org.apache.harmony.instrument.internal.nls.messages + * + * 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 KEY + * 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. + *

+ * 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] = ""; //$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(""); //$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() { + 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.instrument.internal.nls.messages"); //$NON-NLS-1$ + } catch (Throwable e) { + e.printStackTrace(); + } + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/Messages.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/messages.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/messages.properties?rev=437854&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/messages.properties (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/java/org/apache/harmony/instrument/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/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/messages.properties ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/build.xml URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/build.xml?rev=437854&r1=437853&r2=437854&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/build.xml (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/build.xml Mon Aug 28 14:46:26 2006 @@ -1,191 +1,200 @@ - - - - - Build for JNDI component - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jndi${line.separator} - - - - jndi${line.separator} - - - - - - - - - - - - - + + + + + Build for JNDI component + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jndi${line.separator} + + + + jndi${line.separator} + + + + + + + + + + + + + Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java?rev=437854&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/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.jndi.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. + *

+ * It is used by the system classes to provide national language support, by + * looking up messages in the + * org.apache.harmony.jndi.internal.nls.messages + * + * 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 KEY + * 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. + *

+ * 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] = ""; //$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(""); //$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() { + 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.jndi.internal.nls.messages"); //$NON-NLS-1$ + } catch (Throwable e) { + e.printStackTrace(); + } + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties?rev=437854&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/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/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/build.xml URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/build.xml?rev=437854&r1=437853&r2=437854&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/logging/build.xml (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/logging/build.xml Mon Aug 28 14:46:26 2006 @@ -1,203 +1,213 @@ - - - - - Build for LOGGING component - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - logging${line.separator} - - - - logging${line.separator} - - - - - - - - - - - - - - - - - - - - + + + + + Build for LOGGING component + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + logging${line.separator} + + + + logging${line.separator} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/make/patternset.txt URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/make/patternset.txt?rev=437854&r1=437853&r2=437854&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/logging/make/patternset.txt (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/logging/make/patternset.txt Mon Aug 28 14:46:26 2006 @@ -1,15 +1,17 @@ -# Copyright 2005 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/util/logging/* \ No newline at end of file +# Copyright 2005 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/util/logging/* + +org/apache/harmony/logging/internal/nls/* Added: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/Messages.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/Messages.java?rev=437854&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/Messages.java (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/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.logging.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. + *

+ * It is used by the system classes to provide national language support, by + * looking up messages in the + * org.apache.harmony.logging.internal.nls.messages + * + * 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 KEY + * 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. + *

+ * 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] = ""; //$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(""); //$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() { + 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.logging.internal.nls.messages"); //$NON-NLS-1$ + } catch (Throwable e) { + e.printStackTrace(); + } + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/Messages.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties?rev=437854&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/org/apache/harmony/logging/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/logging/src/main/java/org/apache/harmony/logging/internal/nls/messages.properties ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml?rev=437854&r1=437853&r2=437854&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml Mon Aug 28 14:46:26 2006 @@ -38,7 +38,7 @@ - + @@ -251,7 +251,7 @@ - + + * It is used by the system classes to provide national language support, by + * looking up messages in the + * org.apache.harmony.luni.internal.nls.messages + * + * 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 KEY + * 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. + *

+ * 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] = ""; //$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(""); //$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() { + 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.luni.internal.nls.messages"); //$NON-NLS-1$ + } catch (Throwable e) { + e.printStackTrace(); + } + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/Messages.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties?rev=437854&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/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/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/build.xml URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/build.xml?rev=437854&r1=437853&r2=437854&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/math/build.xml (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/math/build.xml Mon Aug 28 14:46:26 2006 @@ -32,10 +32,10 @@ + use the Eclipse Java compiler. --> - + @@ -64,6 +64,15 @@ + + + + + + + + + Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/make/patternset.txt URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/make/patternset.txt?rev=437854&r1=437853&r2=437854&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/math/make/patternset.txt (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/math/make/patternset.txt Mon Aug 28 14:46:26 2006 @@ -1,16 +1,18 @@ -# Copyright 2005 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/math/* -com/ibm/oti/util/math/* \ No newline at end of file +# Copyright 2005 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/math/* +com/ibm/oti/util/math/* + +org/apache/harmony/math/internal/nls/*