writer.flush();
writer.close();
} catch (Exception e) {
- System.out.println("Saving file error: " + e.getMessage());
+ System.err.println("Saving file error: " + e.getMessage());
}
}
public void verifyAccount(String verificationCode) throws IOException {
verificationCode = verificationCode.replace("-", "");
signalingKey = Util.getSecret(52);
- accountManager.verifyAccountWithCode(verificationCode, signalingKey, axolotlStore.getLocalRegistrationId());
+ accountManager.verifyAccountWithCode(verificationCode, signalingKey, axolotlStore.getLocalRegistrationId(), false);
//accountManager.setGcmId(Optional.of(GoogleCloudMessaging.getInstance(this).register(REGISTRATION_ID)));
registered = true;
if (returnOnTimeout)
return;
} catch (InvalidVersionException e) {
- System.out.println("Ignoring error: " + e.getMessage());
+ System.err.println("Ignoring error: " + e.getMessage());
}
save();
}
} finally {
if (output != null) {
output.close();
+ output = null;
+ }
+ if (!tmpFile.delete()) {
+ System.err.println("Failed to delete temp file: " + tmpFile);
+ }
+ }
+ if (pointer.getPreview().isPresent()) {
+ File previewFile = new File(outputFile + ".preview");
+ try {
+ output = new FileOutputStream(previewFile);
+ byte[] preview = pointer.getPreview().get();
+ output.write(preview, 0, preview.length);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ return null;
+ } finally {
+ if (output != null) {
+ output.close();
+ }
}
- tmpFile.delete();
}
return outputFile;
}