From b0376a373cca5505d0ab5c620aec7821b8fe3064 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Mon, 27 Feb 2017 08:19:08 +0100 Subject: [PATCH] Woops again... --- VERSION | 2 +- changelog | 2 +- src/be/nikiroo/utils/Version.java | 3 ++- src/be/nikiroo/utils/test/VersionTest.java | 7 +++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 1892b926..31e5c843 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.2 +1.3.3 diff --git a/changelog b/changelog index b5e1d807..3e55a30d 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,4 @@ -Version 1.3.2 +Version 1.3.3 ------------- New Version class diff --git a/src/be/nikiroo/utils/Version.java b/src/be/nikiroo/utils/Version.java index a8ec3f5b..613fcfe5 100644 --- a/src/be/nikiroo/utils/Version.java +++ b/src/be/nikiroo/utils/Version.java @@ -40,16 +40,17 @@ public class Version { * the version (MAJOR.MINOR.PATCH) */ public Version(String version) { - this.version = version; try { String[] tab = version.split("\\."); this.major = Integer.parseInt(tab[0]); this.minor = Integer.parseInt(tab[1]); this.patch = Integer.parseInt(tab[2]); + this.version = version; } catch (Exception e) { this.major = 0; this.minor = 0; this.patch = 0; + this.version = null; } } diff --git a/src/be/nikiroo/utils/test/VersionTest.java b/src/be/nikiroo/utils/test/VersionTest.java index 8dc3ba32..75e2cdf0 100644 --- a/src/be/nikiroo/utils/test/VersionTest.java +++ b/src/be/nikiroo/utils/test/VersionTest.java @@ -32,6 +32,13 @@ class VersionTest extends TestLauncher { new Version( "Doors 98 SE Special Deluxe Edition Pro++ Not-Home") .isEmpty()); + + assertEquals( + "Bad input should return [unknown]", + "[unknown]", + new Version( + "Doors 98 SE Special Deluxe Edition Pro++ Not-Home") + .toString()); } }); -- 2.27.0