Skip to content

Commit

Permalink
fixes #709 throw the exception as it is (#717)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu committed Apr 18, 2023
1 parent 3c93e45 commit 7afdd3b
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions src/main/java/com/networknt/schema/I18nSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,9 @@
public class I18nSupport {

private static final String BASE_NAME = "jsv-messages";
private static final ResourceBundle bundle;

static {
ResourceBundle tmpBundle = null;
try {
tmpBundle = ResourceBundle.getBundle(BASE_NAME);
} catch (MissingResourceException mre) {
// Need to avoid by all means that we fail loading ValidatorTypeCode with a
// "java.lang.NoClassDefFoundError: Could not initialize class com.networknt.schema.ValidatorTypeCode"
// due to the fact that a ResourceBundle is incomplete
mre.printStackTrace();
}
bundle = tmpBundle;
}
private static final ResourceBundle bundle = ResourceBundle.getBundle(BASE_NAME);

public static String getString(String key) {
String retval = null;
try {
retval = bundle.getString(key);
} catch (MissingResourceException mre) {
// Need to avoid by all means that we fail loading ValidatorTypeCode with a
// "java.lang.NoClassDefFoundError: Could not initialize class com.networknt.schema.ValidatorTypeCode"
// due to the fact that a ResourceBundle is incomplete
mre.printStackTrace();
}
return retval;
return bundle.getString(key);
}

}

0 comments on commit 7afdd3b

Please sign in to comment.