本文整理匯總了Java中java.lang.IllegalArgumentException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java IllegalArgumentException.printStackTrace方法的具體用法?Java IllegalArgumentException.printStackTrace怎麽用?Java IllegalArgumentException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.IllegalArgumentException
的用法示例。
在下文中一共展示了IllegalArgumentException.printStackTrace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getByName
import java.lang.IllegalArgumentException; //導入方法依賴的package包/類
public static WorldGenerator getByName(String name) {
WorldGenerator gen = generators.getOrDefault(name, null);
if (gen == null) {
try {
throw new IllegalArgumentException("\"" + name + "\" is not a valid WorldGenerator");
} catch (IllegalArgumentException e) {
e.printStackTrace();
ArmadaCraft.getInstance().shutdown();
}
} else {
return gen;
}
return null;
}
示例2: checkReply
import java.lang.IllegalArgumentException; //導入方法依賴的package包/類
public boolean checkReply(primitives_t reply, int iteration) {
try {
int n = iteration;
checkField(reply.i8, (byte)(n % 100), "i8");
checkField(reply.i16, (short)(n * 10), "i16");
checkField((long)reply.i64, (long)(n * 10000), "i64");
checkField(reply.position[0], (float)n, "position[0]");
checkField(reply.position[1], (float)n, "position[1]");
checkField(reply.position[2], (float)n, "position[2]");
checkField(reply.orientation[0], (double)n, "orientation[0]");
checkField(reply.orientation[1], (double)n, "orientation[1]");
checkField(reply.orientation[2], (double)n, "orientation[2]");
checkField(reply.orientation[3], (double)n, "orientation[3]");
checkField(reply.num_ranges, n, "num_ranges");
for (int i = 0; i < reply.num_ranges; i++) {
checkField(reply.ranges[i], (short)i, String.format("ranges[%d]", i));
}
checkField(reply.name, String.valueOf(n), "name");
checkField(reply.enabled, n % 2 == 1, "enabled");
} catch (IllegalArgumentException ex) {
ex.printStackTrace(System.err);
return false;
}
return true;
}
示例3: onDestroy
import java.lang.IllegalArgumentException; //導入方法依賴的package包/類
@Override
public void onDestroy() {
super.onDestroy();
if(richRemoteInputReceiver != null) {
try {
this.cordova.getActivity().unregisterReceiver(richRemoteInputReceiver);
richRemoteInputReceiver = null;
} catch(IllegalArgumentException e) {
//not an error case
if(Log.isLoggable(RICHNOTI, Log.DEBUG))
Log.d(TAG, "unregistering receiver in onDestroy: " +e.getMessage());
e.printStackTrace();
}
}
}