System.out.println("Upgrade 32: loading " + f);
if (f.exists()) {
StringBuilder sb = new StringBuilder();
- try (Reader r = new InputStreamReader(new FileInputStream(f), "UTF-8")) {
+ try (FileInputStream fis = new FileInputStream(f); Reader r = new InputStreamReader(fis, "UTF-8")) {
int len;
char[] buf = new char[4096];
while ((len = r.read(buf)) > 0) {
}
- public static final int CURRENT_SCHEMA_VERSION = 33;
+ public static final int CURRENT_SCHEMA_VERSION = 34;
public static final int CONNECTION_TIMEOUT = 24 * 60 * 60;
"targetId" int NOT NULL,
"task" "jobType" NOT NULL,
"state" "jobState" NOT NULL DEFAULT 'open',
- "warning" smallint NOT NULL DEFAULT '0',
+ "attempt" smallint NOT NULL DEFAULT '0',
"executeFrom" DATE,
"executeTo" VARCHAR(11),
PRIMARY KEY ("id")
"version" smallint NOT NULL,
PRIMARY KEY ("version")
);
-INSERT INTO "schemeVersion" (version) VALUES(33);
+INSERT INTO "schemeVersion" (version) VALUES(34);
DROP TABLE IF EXISTS `passwordResetTickets`;
CREATE TABLE `passwordResetTickets` (
"content" text NOT NULL,
PRIMARY KEY ("certid", "type")
);
+
+DROP TABLE IF EXISTS "jobLog";
+CREATE TABLE "jobLog" (
+ "jobid" int NOT NULL,
+ "attempt" smallint NOT NULL,
+ "content" text NOT NULL,
+ PRIMARY KEY ("jobid", "attempt")
+);
+CREATE INDEX ON "jobLog" ("jobid");
--- /dev/null
+CREATE TABLE "jobLog" (
+ "jobid" int NOT NULL,
+ "attempt" smallint NOT NULL,
+ "content" text NOT NULL,
+ PRIMARY KEY ("jobid", "attempt")
+);
+CREATE INDEX ON "jobLog" ("jobid");
+
+ALTER TABLE "jobs" RENAME COLUMN "warning" TO "attempt";
ocspCsr.delete();
ocspCrt.delete();
String csr = PEM.encode("CERTIFICATE REQUEST", p10.getEncoded());
- try (Writer w = new OutputStreamWriter(new FileOutputStream(ocspCsr), "UTF-8")) {
+ try (FileOutputStream fos = new FileOutputStream(ocspCsr); Writer w = new OutputStreamWriter(fos, "UTF-8")) {
w.write(csr);
}
}
protected void tryReload() {
if (source != null && lastLoaded < source.lastModified()) {
System.out.println("Reloading template.... " + source);
- try (InputStreamReader r = new InputStreamReader(new FileInputStream(source), "UTF-8")) {
+ try (FileInputStream fis = new FileInputStream(source); InputStreamReader r = new InputStreamReader(fis, "UTF-8")) {
data = parse(r).getBlock(null);
r.close();
lastLoaded = source.lastModified() + 1000;
throw new Error("Public Suffix List could not be loaded.");
}
- try (BufferedReader br = new BufferedReader(new InputStreamReader(res, "UTF-8"))) {
+ try (InputStreamReader isr = new InputStreamReader(res, "UTF-8"); BufferedReader br = new BufferedReader(isr)) {
return new PublicSuffixes(br);
}
}
"WHERE `certId`=?");
updateMail = new GigiPreparedStatement("UPDATE certs SET created=NOW(), serial=?, caid=?, expire=? WHERE id=?");
- warnMail = new GigiPreparedStatement("UPDATE jobs SET warning=warning+1, state=CASE WHEN warning<3 THEN 'open'::`jobState` ELSE 'error'::`jobState` END WHERE id=?");
+ warnMail = new GigiPreparedStatement("UPDATE jobs SET attempt=attempt+1, state=CASE WHEN attempt<3 THEN 'open'::`jobState` ELSE 'error'::`jobState` END WHERE id=?");
revoke = new GigiPreparedStatement("SELECT certs.id, jobs.id FROM jobs INNER JOIN certs ON jobs.`targetId`=certs.id" + " WHERE jobs.state='open' AND task='revoke'");
revokeCompleted = new GigiPreparedStatement("UPDATE `certs` SET revoked=NOW() WHERE id=?");