From df44a241e73bf942d42a93d00e1fb454eb51dd5b Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sun, 22 Nov 2020 09:09:35 -0500 Subject: [PATCH] extend error columns --- bubble-server/src/main/java/bubble/ApiConstants.java | 3 ++- .../src/main/java/bubble/model/cloud/BubbleBackup.java | 5 ++--- .../java/bubble/model/cloud/notify/NotificationBase.java | 5 ++--- .../src/main/resources/META-INF/bubble/bubble.properties | 2 +- .../db/migration/V2020112201__lengthen_error_columns.sql | 3 +++ 5 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 bubble-server/src/main/resources/db/migration/V2020112201__lengthen_error_columns.sql diff --git a/bubble-server/src/main/java/bubble/ApiConstants.java b/bubble-server/src/main/java/bubble/ApiConstants.java index fbdfbb5c..fafa49ab 100644 --- a/bubble-server/src/main/java/bubble/ApiConstants.java +++ b/bubble-server/src/main/java/bubble/ApiConstants.java @@ -288,7 +288,8 @@ public class ApiConstants { public static final String Q_REDIRECT = "redirect"; public static final int MAX_NOTIFY_LOG = 10000; - public static final int ERROR_MAXLEN = 4000; + public static final int ERROR_MAXLEN = 20000; + public static final int ERROR_MAX_BEFORE_ELLIPSES = 19900; public static String getToken(String json) { if (json == null) return null; diff --git a/bubble-server/src/main/java/bubble/model/cloud/BubbleBackup.java b/bubble-server/src/main/java/bubble/model/cloud/BubbleBackup.java index 8c7fed8d..4e4cb328 100644 --- a/bubble-server/src/main/java/bubble/model/cloud/BubbleBackup.java +++ b/bubble-server/src/main/java/bubble/model/cloud/BubbleBackup.java @@ -21,8 +21,7 @@ import javax.persistence.*; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; -import static bubble.ApiConstants.EP_BACKUPS; -import static bubble.ApiConstants.ERROR_MAXLEN; +import static bubble.ApiConstants.*; import static bubble.service.backup.BackupService.BR_STATE_LOCK_TIMEOUT; import static org.cobbzilla.util.daemon.ZillaRuntime.empty; import static org.cobbzilla.util.string.StringUtil.ellipsis; @@ -72,7 +71,7 @@ public class BubbleBackup extends IdentifiableBase implements HasAccount { @ECSearchable(filter=true) @ECField(index=60) @Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(ERROR_MAXLEN+ENC_PAD)+")") @Getter private String error; - public BubbleBackup setError (String err) { this.error = ellipsis(err, ERROR_MAXLEN); return this; } + public BubbleBackup setError (String err) { this.error = ellipsis(err, ERROR_MAX_BEFORE_ELLIPSES); return this; } public boolean hasError () { return !empty(error); } public boolean canDelete() { return status.isDeletable() || getCtimeAge() > BR_STATE_LOCK_TIMEOUT; } diff --git a/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationBase.java b/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationBase.java index 10cd39ec..2523eac5 100644 --- a/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationBase.java +++ b/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationBase.java @@ -23,8 +23,7 @@ import org.hibernate.annotations.Type; import javax.persistence.*; -import static bubble.ApiConstants.DB_JSON_MAPPER; -import static bubble.ApiConstants.ERROR_MAXLEN; +import static bubble.ApiConstants.*; import static org.cobbzilla.util.daemon.ZillaRuntime.bool; import static org.cobbzilla.util.daemon.ZillaRuntime.errorString; import static org.cobbzilla.util.json.JsonUtil.json; @@ -91,7 +90,7 @@ public class NotificationBase extends IdentifiableBase implements HasAccountNoNa @ECSearchable(filter=true) @ECField(index=100) @Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(ERROR_MAXLEN+ENC_PAD)+")") @JsonIgnore @Getter private String error; - public NotificationBase setError (String err) { this.error = ellipsis(err, ERROR_MAXLEN); return this; } + public NotificationBase setError (String err) { this.error = ellipsis(err, ERROR_MAX_BEFORE_ELLIPSES); return this; } public void setException(Exception e) { setError(errorString(e, ERROR_MAXLEN)); } } diff --git a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties index 05fbd137..43d7d999 100644 --- a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties +++ b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties @@ -1 +1 @@ -bubble.version=Adventure 1.4.29 +bubble.version=Adventure 1.4.30 diff --git a/bubble-server/src/main/resources/db/migration/V2020112201__lengthen_error_columns.sql b/bubble-server/src/main/resources/db/migration/V2020112201__lengthen_error_columns.sql new file mode 100644 index 00000000..f1b60e74 --- /dev/null +++ b/bubble-server/src/main/resources/db/migration/V2020112201__lengthen_error_columns.sql @@ -0,0 +1,3 @@ +ALTER TABLE received_notification ALTER COLUMN error TYPE VARCHAR(20100); +ALTER TABLE sent_notification ALTER COLUMN error TYPE VARCHAR(20100); +ALTER TABLE bubble_backup ALTER COLUMN error TYPE VARCHAR(20100);