forked from I2P_Developers/i2p.i2p
PrintWriter doesn't throw exceptions, so call checkError()
This commit is contained in:
@ -87,6 +87,8 @@ abstract class PersistDHT {
|
||||
out.println(ni.toPersistentString());
|
||||
count++;
|
||||
}
|
||||
if (out.checkError())
|
||||
throw new IOException("Failed write to " + file);
|
||||
} catch (IOException ioe) {
|
||||
if (log.shouldLog(Log.WARN))
|
||||
log.warn("Error writing the DHT File", ioe);
|
||||
|
@ -112,6 +112,8 @@ public class SubscriptionsBean extends BaseBean
|
||||
out.println(url);
|
||||
}
|
||||
out.close();
|
||||
if (out.checkError())
|
||||
throw new IOException("Failed write to " + file);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
@ -53,6 +53,8 @@ public class CertUtil {
|
||||
}
|
||||
wr.println("-----END CERTIFICATE-----");
|
||||
wr.flush();
|
||||
if (wr.checkError())
|
||||
throw new IOException("Failed write to " + file);
|
||||
return true;
|
||||
} catch (CertificateEncodingException cee) {
|
||||
error("Error writing X509 Certificate " + file.getAbsolutePath(), cee);
|
||||
|
@ -529,6 +529,11 @@ public class DataHelper {
|
||||
out.flush();
|
||||
fos.getFD().sync();
|
||||
out.close();
|
||||
if (out.checkError()) {
|
||||
out = null;
|
||||
tmpFile.delete();
|
||||
throw new IOException("Failed to write properties to " + tmpFile);
|
||||
}
|
||||
out = null;
|
||||
if (!FileUtil.rename(tmpFile, file))
|
||||
throw new IOException("Failed rename from " + tmpFile + " to " + file);
|
||||
|
@ -322,6 +322,8 @@ public class WorkingDir {
|
||||
out.println(s);
|
||||
}
|
||||
System.err.println("Copied " + oldFile + " with modifications");
|
||||
if (out.checkError())
|
||||
throw new IOException("Failed write to " + newFile);
|
||||
return true;
|
||||
} catch (IOException ioe) {
|
||||
if (in != null) {
|
||||
|
Reference in New Issue
Block a user