jaxp/src/com/sun/org/apache/xalan/internal/res/XSLMessages.java
author joehw
Mon, 18 Feb 2013 11:33:35 -0800
changeset 16953 a44e04deb948
parent 12457 c348e06f0e82
permissions -rw-r--r--
6657673: Issues with JAXP Reviewed-by: alanb, lancea, ahgross, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * Copyright 1999-2004 The Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *     http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * $Id: XSLMessages.java,v 1.2.4.1 2005/09/09 07:41:10 pvedula Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
package com.sun.org.apache.xalan.internal.res;
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    25
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import java.util.ListResourceBundle;
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
/**
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    31
 * Sets things up for issuing error messages. This class is misnamed, and should
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    32
 * be called XalanMessages, or some such.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    33
 *
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * @xsl.usage internal
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 */
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    36
public class XSLMessages extends XPATHMessages {
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    38
    /**
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    39
     * The language specific resource object for Xalan messages.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    40
     */
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    41
    private static ListResourceBundle XSLTBundle = null;
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    42
    /**
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    43
     * The class name of the Xalan error message string table.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    44
     */
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    45
    private static final String XSLT_ERROR_RESOURCES =
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    46
            "com.sun.org.apache.xalan.internal.res.XSLTErrorResources";
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    48
    /**
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    49
     * Creates a message from the specified key and replacement arguments,
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    50
     * localized to the given locale.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    51
     *
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    52
     * @param msgKey The key for the message text.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    53
     * @param args The arguments to be used as replacement text in the message
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    54
     * created.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    55
     *
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    56
     * @return The formatted message string.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    57
     */
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    58
    public static String createMessage(String msgKey, Object args[]) //throws Exception
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
    {
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    60
        if (XSLTBundle == null) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    61
            XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    62
        }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    63
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    64
        if (XSLTBundle != null) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    65
            return createMsg(XSLTBundle, msgKey, args);
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    66
        } else {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    67
            return "Could not load any resource bundles.";
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    68
        }
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    71
    /**
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    72
     * Creates a message from the specified key and replacement arguments,
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    73
     * localized to the given locale.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    74
     *
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    75
     * @param msgKey The key for the message text.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    76
     * @param args The arguments to be used as replacement text in the message
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    77
     * created.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    78
     *
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    79
     * @return The formatted warning string.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    80
     */
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    81
    public static String createWarning(String msgKey, Object args[]) //throws Exception
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    82
    {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    83
        if (XSLTBundle == null) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    84
            XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    85
        }
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    87
        if (XSLTBundle != null) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    88
            return createMsg(XSLTBundle, msgKey, args);
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    89
        } else {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    90
            return "Could not load any resource bundles.";
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12457
diff changeset
    91
        }
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
}