From 3e2dcd694813735ee386a96a54280ece8ade4b8f Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Thu, 3 Nov 2016 19:20:04 -0400 Subject: [PATCH] track down the source of null entries in pretty version (see #4696, #4712) --- .../processing/app/contrib/AvailableContribution.java | 9 ++++----- app/src/processing/app/contrib/Contribution.java | 11 +++++++++++ app/src/processing/app/contrib/LocalContribution.java | 5 +---- todo.txt | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/src/processing/app/contrib/AvailableContribution.java b/app/src/processing/app/contrib/AvailableContribution.java index c36cffa8a..9c78b831a 100644 --- a/app/src/processing/app/contrib/AvailableContribution.java +++ b/app/src/processing/app/contrib/AvailableContribution.java @@ -61,10 +61,7 @@ public class AvailableContribution extends Contribution { version = PApplet.parseInt(versionStr, 0); } - prettyVersion = params.get("prettyVersion"); - if (prettyVersion != null && prettyVersion.length() == 0) { - prettyVersion = null; - } + setPrettyVersion(params.get("prettyVersion")); String lastUpdatedStr = params.get("lastUpdated"); if (lastUpdatedStr != null) { @@ -337,7 +334,9 @@ public class AvailableContribution extends Contribution { writer.println("sentence=" + sentence); writer.println("paragraph=" + paragraph); writer.println("version=" + version); - writer.println("prettyVersion=" + prettyVersion); + if (prettyVersion != null) { + writer.println("prettyVersion=" + prettyVersion); + } writer.println("lastUpdated=" + lastUpdated); writer.println("minRevision=" + minRev); writer.println("maxRevision=" + maxRev); diff --git a/app/src/processing/app/contrib/Contribution.java b/app/src/processing/app/contrib/Contribution.java index 22a6e718a..0e26380de 100644 --- a/app/src/processing/app/contrib/Contribution.java +++ b/app/src/processing/app/contrib/Contribution.java @@ -158,6 +158,17 @@ abstract public class Contribution { } + public void setPrettyVersion(String pretty) { + if (pretty != null) { + // some entries were written as "null", causing that to show in the ui + if (pretty.equals("null") || pretty.length() == 0) { + pretty = null; + } + } + prettyVersion = pretty; + } + + // "1.0.2" or null if not present public String getPrettyVersion() { return prettyVersion; diff --git a/app/src/processing/app/contrib/LocalContribution.java b/app/src/processing/app/contrib/LocalContribution.java index 0bfa6a988..20c7176b0 100644 --- a/app/src/processing/app/contrib/LocalContribution.java +++ b/app/src/processing/app/contrib/LocalContribution.java @@ -86,10 +86,7 @@ public abstract class LocalContribution extends Contribution { System.err.println("Please contact the library author to fix it according to the guidelines."); } - prettyVersion = properties.get("prettyVersion"); - if (prettyVersion != null && prettyVersion.length() == 0) { - prettyVersion = null; - } + setPrettyVersion(properties.get("prettyVersion")); try { lastUpdated = Long.parseLong(properties.get("lastUpdated")); diff --git a/todo.txt b/todo.txt index 1cc6f6d7b..459ea75ca 100755 --- a/todo.txt +++ b/todo.txt @@ -7,6 +7,7 @@ o problem is because AquaButtonUI is calling getImage() (not getIcon()) o can be debugging from inside the getIconX() code in Toolkit X just needed to use setPressedIcon(), setDisabledIcon() X also found some other issues around the icon handling +X fix the library reporting scripts on the server contribs X Up-to-date status disappears after filter is removed @@ -26,7 +27,6 @@ _ https://github.com/processing/processing/issues/4705 _ could provide script to un-quarrantine _ xattr -d -r com.apple.quarantine -_ fix the library reporting scripts on the server _ sharing usage metrics about libraries _ https://github.com/processing/processing/issues/4708