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