86 lines
2.6 KiB
Java
86 lines
2.6 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package javax.baja.sys;
|
|
|
|
import java.text.MessageFormat;
|
|
import javax.baja.sys.BajaException;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.Localizable;
|
|
import javax.baja.util.Lexicon;
|
|
|
|
public class LocalizableException
|
|
extends BajaException
|
|
implements Localizable {
|
|
private String lexiconModule;
|
|
private String lexiconKey;
|
|
private Object[] lexiconArgs;
|
|
|
|
public String getLexiconModule() {
|
|
return this.lexiconModule;
|
|
}
|
|
|
|
public String getLexiconKey() {
|
|
return this.lexiconKey;
|
|
}
|
|
|
|
public Object[] getLexiconArguments() {
|
|
return this.lexiconArgs;
|
|
}
|
|
|
|
public String toString(Context context) {
|
|
return LocalizableException.format(this.lexiconModule, this.lexiconKey, this.lexiconArgs, context);
|
|
}
|
|
|
|
public static String format(String string, String string2, Object[] objectArray, Context context) {
|
|
try {
|
|
String string3 = Lexicon.make(string, context).get(string2, null);
|
|
if (string3 != null) {
|
|
return MessageFormat.format(string3, objectArray);
|
|
}
|
|
StringBuffer stringBuffer = new StringBuffer(string2);
|
|
if (objectArray != null) {
|
|
stringBuffer.append(" {");
|
|
int n = 0;
|
|
while (n < objectArray.length) {
|
|
if (n > 0) {
|
|
stringBuffer.append(", ");
|
|
}
|
|
stringBuffer.append(objectArray[n]);
|
|
++n;
|
|
}
|
|
stringBuffer.append(" }");
|
|
}
|
|
return stringBuffer.toString();
|
|
}
|
|
catch (Throwable throwable) {
|
|
throwable.printStackTrace();
|
|
return string2;
|
|
}
|
|
}
|
|
|
|
public LocalizableException(String string, String string2, Object[] objectArray, Throwable throwable) {
|
|
super(LocalizableException.format(string, string2, objectArray, null), throwable);
|
|
this.lexiconModule = string;
|
|
this.lexiconKey = string2;
|
|
this.lexiconArgs = objectArray;
|
|
}
|
|
|
|
public LocalizableException(String string, String string2, Object[] objectArray) {
|
|
this(string, string2, objectArray, null);
|
|
}
|
|
|
|
public LocalizableException(String string, String string2, Throwable throwable) {
|
|
this(string, string2, null, throwable);
|
|
}
|
|
|
|
public LocalizableException(String string, String string2) {
|
|
this(string, string2, null, null);
|
|
}
|
|
|
|
public LocalizableException(Lexicon lexicon, String string) {
|
|
this(lexicon.module.getModuleName(), string, null, null);
|
|
}
|
|
}
|
|
|