List of usage examples for java.util IllegalFormatException getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:wjhk.jupload2.policies.DefaultUploadPolicy.java
/** @see UploadPolicy#getLocalizedString(String, Object...) */ public String getLocalizedString(String key, Object... args) { String ret = this.resourceBundle.getString(key); try {/* w w w .j av a 2s .co m*/ // We have to recreate the correct call to String.format switch (args.length) { case 0: return String.format(ret); case 1: return String.format(ret, args[0]); case 2: return String.format(ret, args[0], args[1]); case 3: return String.format(ret, args[0], args[1], args[2]); case 4: return String.format(ret, args[0], args[1], args[2], args[3]); case 5: return String.format(ret, args[0], args[1], args[2], args[3], args[4]); case 6: return String.format(ret, args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return String.format(ret, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); default: throw new IllegalArgumentException( "DefaultUploadPolicy.getLocalizedString accepts up to 7 variable parameters (" + args.length + " values were given for the 'args' argument"); } } catch (IllegalFormatException ife) { displayErr(ife.getClass().getName() + " (" + ife.getMessage() + ")when managing this string: " + ret); throw ife; } }