1 19 20 package org.netbeans.modules.j2ee.sun.validation.util; 21 22 import java.util.MissingResourceException ; 23 import java.util.ResourceBundle ; 24 25 import org.netbeans.modules.j2ee.sun.validation.Constants; 26 27 28 38 public class BundleReader { 39 40 43 private static ResourceBundle resourceBundle; 44 45 46 47 public BundleReader() { 48 } 49 50 56 public static String getValue(String key) { 57 if(resourceBundle == null) 58 return key; 59 try { 60 return resourceBundle.getString(key); 61 } catch (MissingResourceException missingResourceException) { 62 return key; 63 } 64 } 65 66 67 70 public static void setBundle(String bundleFile){ 71 try { 72 resourceBundle = ResourceBundle.getBundle(bundleFile); 73 } catch (Exception ex) { } 74 } 75 76 77 static { 78 try { 79 resourceBundle = ResourceBundle.getBundle(Constants.BUNDLE_FILE); 80 } catch (Exception ex) { } 81 } 82 } 83 | Popular Tags |