Skip to content

Commit

Permalink
Allow alpha-numeric for version fixes #47
Browse files Browse the repository at this point in the history
  • Loading branch information
selewis committed Dec 9, 2016
1 parent f7bb395 commit c178735
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="org/paint/gui/PaintTable.java|org/paint/dialog/CurationStatusColorPane.java|org/paint/dialog/CurationStatusColorDialog.java|org/paint/dialog/AspectColorPane.java" kind="src" output="target/classes" path="src">
<classpathentry excluding="org/paint/gui/PaintTable.java|org/paint/dialog/CurationStatusColorPane.java|org/paint/dialog/CurationStatusColorDialog.java|org/paint/dialog/AspectColorPane.java|org/paint/util/VersionNumber.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
Expand Down
2 changes: 1 addition & 1 deletion resources/org/paint/resources/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.28.c
v2.29
13 changes: 4 additions & 9 deletions src/org/paint/config/VersionResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.paint.util.VersionNumber;

/**
* Used for reading previous or default user settings from property file and storing current user settings
Expand All @@ -39,7 +38,7 @@ public class VersionResource { // extends DirectoryUtil {

protected static Logger log = Logger.getLogger("org.panther.paint.config.Preferences");

private VersionNumber version;
private String version;

private static VersionResource resource;

Expand All @@ -60,26 +59,22 @@ public static VersionResource inst() {
return resource;
}

public VersionNumber getVersion() {
public String getVersion() {
if (version == null) {
try {
InputStream inputStream = getExtensionLoader().getResourceAsStream(
"org/paint/resources/VERSION");
if (inputStream != null) {
List<String> lines = IOUtils.readLines(inputStream);
if (!lines.isEmpty()) {
version = new VersionNumber(lines.get(0));
version = lines.get(0);
}
}
} catch (Exception e) {
log.warn("Clould not load version from resource", e);
}
if (version == null) {
try {
version = new VersionNumber("2.0");
} catch (ParseException e) {
// ignore
}
version = "2.0";
}
}
return version;
Expand Down
2 changes: 1 addition & 1 deletion src/org/paint/dialog/AboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected void configure() {
JPanel icon_panel = new JPanel();
icon_panel.setLayout(new BorderLayout());
JLabel program = new JLabel(paint_fullname, image, SwingConstants.CENTER);
JLabel version = new JLabel(VersionResource.inst().getVersion().toString(), image, SwingConstants.CENTER);
JLabel version = new JLabel(VersionResource.inst().getVersion(), image, SwingConstants.CENTER);
program.setFont(new Font("Arial", Font.BOLD, 14));
version.setFont(new Font("Arial", Font.BOLD, 12));
icon_panel.add(program, BorderLayout.CENTER);
Expand Down
2 changes: 1 addition & 1 deletion src/org/paint/main/PaintStartupTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected void configureLogging() {
// log4j straight up, and have log4j appender for an error window
// error manager used to go to term info but no longer
// ErrorManager.inst().addErrorListener(new LogErrorListener());
LOG.info("Loading Paint version " + VersionResource.inst().getVersion().toString());
LOG.info("Loading Paint version " + VersionResource.inst().getVersion());
}

@Override
Expand Down
133 changes: 0 additions & 133 deletions src/org/paint/util/VersionNumber.java

This file was deleted.

0 comments on commit c178735

Please sign in to comment.