}
String stackTrace = "";
for (StackTraceElement ste : ex2.getStackTrace()) {
stackTrace += "\n" + ste.toString();
}
new UIMessage(true, mc3.getClass().getName() + " may not be stored to " + filename + " ! error: " + ex2.getMessage() + stackTrace, null, UIMessage.ERROR_TYPE);
interrupt_ = true;
} finally {
UIMessage.kill(wait);
/*
* the model should have been stored so we try to recover it from path
*/
mc3 = _importModel(temp.getPath());
if (mc3 instanceof Model) {
if (temp instanceof File) {
try {
RandomAccessFile rafTemp = new RandomAccessFile(temp, "r");
RandomAccessFile raf = new RandomAccessFile(filename, "rw");
raf.setLength(temp.length());
byte[] b = new byte[512];
int rBytes = 0;
while ((rBytes = rafTemp.read(b)) != -1) {
raf.write(b, 0, rBytes);
}
raf.close();
rafTemp.close();
new UIMessage(true, mc3.getClass().getName() + "'s been successfully stored to " + filename + " !", null, UIMessage.MODEL_TYPE);
} catch (IOException ex) {
if (DebugMap._getInstance().isDebuggerEnabled(Model.class)) {
ex.printStackTrace();
}
new UIMessage(true, mc3.getClass().getName() + " may not be stored to " + filename + " ! error: " + ex.getMessage(), null, UIMessage.ERROR_TYPE);
return false;
}
}
} else {
return false;