1 23 24 28 29 package com.sun.enterprise.tools.common.validation.util; 30 31 import java.util.MissingResourceException ; 32 import java.util.ResourceBundle ; 33 34 import com.sun.enterprise.tools.common.validation.Constants; 35 36 37 47 public class BundleReader { 48 49 52 private static ResourceBundle resourceBundle; 53 54 55 56 public BundleReader() { 57 } 58 59 65 public static String getValue(String key) { 66 if(resourceBundle == null) 67 return key; 68 try { 69 return resourceBundle.getString(key); 70 } catch (MissingResourceException missingResourceException) { 71 return key; 72 } 73 } 74 75 76 79 public static void setBundle(String bundleFile){ 80 try { 81 resourceBundle = ResourceBundle.getBundle(bundleFile); 82 } catch (Exception ex) { } 83 } 84 85 86 static { 87 try { 88 resourceBundle = ResourceBundle.getBundle(Constants.BUNDLE_FILE); 89 } catch (Exception ex) { } 90 } 91 } 92 | Popular Tags |