diff --git a/base/src/com/thoughtworks/go/util/ExceptionUtils.java b/base/src/com/thoughtworks/go/util/ExceptionUtils.java index 92acaa812a3..7636f251311 100644 --- a/base/src/com/thoughtworks/go/util/ExceptionUtils.java +++ b/base/src/com/thoughtworks/go/util/ExceptionUtils.java @@ -51,17 +51,6 @@ public static void bombIfFailedToRunCommandLine(int returnValue, String msg) thr } } - public static void bombIfFailed(int returnValue, String msg) { - if (returnValue != 0) { - String output = String.format("return code is [%s], detail information : [%s]", returnValue, msg); - throw new RuntimeException(output); - } - } - - public static void bombIfNotNull(Object o, String msg) { - bombIf(o != null, msg); - } - public static void bombIf(boolean check, String msg) { if (check) { throw bomb(msg); diff --git a/base/src/com/thoughtworks/go/util/GoConstants.java b/base/src/com/thoughtworks/go/util/GoConstants.java index ac8c0dda2b0..7d9e0686c06 100644 --- a/base/src/com/thoughtworks/go/util/GoConstants.java +++ b/base/src/com/thoughtworks/go/util/GoConstants.java @@ -16,12 +16,20 @@ package com.thoughtworks.go.util; +import java.util.Calendar; import java.util.Date; public class GoConstants { - public static final Date NEVER = new Date(0, 0, 1); - public static final String PROJECT_STATUS_IN_BUILDING = "Building"; + public static final Date NEVER; public static final String GO_PLUGIN_MANIFEST_HEADER_PREFIX = "GoPlugin-"; + + static { + Calendar calendar = Calendar.getInstance(); + calendar.set(1900, Calendar.JANUARY, 1, 0, 0, 0); + calendar.set(Calendar.MILLISECOND, 0); + NEVER = calendar.getTime(); + } + /** * This will force the browser to clear the cache only for this page. * If any other pages need to clear the cache, we might want to move this @@ -44,15 +52,10 @@ public class GoConstants { public static final String CRUISE_RESULT = "cruise_job_result"; public static final String CRUISE_JOB_DURATION = "cruise_job_duration"; public static final String CRUISE_JOB_ID = "cruise_job_id"; - public static final String CRUISE_DATE_PATTERN = "cruise_date_pattern"; public static final String CRUISE_TIMESTAMP = "cruise_timestamp_"; public static final String THOUGHTWORKS_LICENSE_URL = "http://www.thoughtworks.com/products/go-continuous-delivery/compare"; - public static final String CRUISE_ENTERPRISE = "Go Enterprise Edition"; public static final String CRUISE_FREE = "Go Community Edition"; - public static final String CRUISE_LICENSE = "license"; public static final String EXPIRY_DATE = "expiry_date"; public static final String MAX_AGENTS = "max_agents"; public static final String MAX_USERS = "max_users"; @@ -68,7 +71,6 @@ public class GoConstants { public static final int PUBLISH_MAX_RETRIES = 3; public static final String TEST_EMAIL_SUBJECT = "Go Email Notification"; public static final int DEFAULT_TIMEOUT = 60 * 1000; - public static final String LICENSE_LIMITATION_ERROR = "License limitation error"; public static final long MEGABYTES_IN_GIGABYTE = 1024; public static final long MEGA_BYTE = 1024 * 1024; public static final long GIGA_BYTE = MEGABYTES_IN_GIGABYTE * MEGA_BYTE; diff --git a/base/src/com/thoughtworks/go/util/OperatingSystem.java b/base/src/com/thoughtworks/go/util/OperatingSystem.java index 2661ec5cfa9..f5725a96a48 100644 --- a/base/src/com/thoughtworks/go/util/OperatingSystem.java +++ b/base/src/com/thoughtworks/go/util/OperatingSystem.java @@ -28,7 +28,7 @@ public enum OperatingSystem { } public static OperatingSystem fromProperty() { - String osName = SystemEnvironment.getProperty("os.name"); + String osName = new SystemEnvironment().getPropertyImpl("os.name"); return parseOperatingSystem(osName); } diff --git a/base/src/com/thoughtworks/go/util/SystemTimeClock.java b/base/src/com/thoughtworks/go/util/SystemTimeClock.java index b638b9b58d3..67d16a5a08a 100644 --- a/base/src/com/thoughtworks/go/util/SystemTimeClock.java +++ b/base/src/com/thoughtworks/go/util/SystemTimeClock.java @@ -17,13 +17,21 @@ package com.thoughtworks.go.util; import java.io.Serializable; +import java.util.Calendar; import java.util.Date; import com.thoughtworks.go.utils.Timeout; import org.joda.time.DateTime; public class SystemTimeClock implements Clock, Serializable { - public static final Date ETERNITY = new Date(8099, 11, 31); + public static final Date ETERNITY; + + static { + Calendar calendar = Calendar.getInstance(); + calendar.set(9999, Calendar.DECEMBER, 31, 0, 0, 0); + calendar.set(Calendar.MILLISECOND, 0); + ETERNITY = calendar.getTime(); + } public Date currentTime() { return new Date(); diff --git a/common/src/com/thoughtworks/go/remote/work/BuildWork.java b/common/src/com/thoughtworks/go/remote/work/BuildWork.java index 5b12cc13fce..382f1df7c97 100644 --- a/common/src/com/thoughtworks/go/remote/work/BuildWork.java +++ b/common/src/com/thoughtworks/go/remote/work/BuildWork.java @@ -161,7 +161,7 @@ private void prepareJob(AgentIdentifier agentIdentifier) { } private EnvironmentVariableContext setupEnvrionmentContext(EnvironmentVariableContext context) { - context.setProperty("GO_SERVER_URL", SystemEnvironment.getProperty("serviceUrl"), false); + context.setProperty("GO_SERVER_URL", new SystemEnvironment().getPropertyImpl("serviceUrl"), false); context.setProperty("GO_TRIGGER_USER", assignment.getBuildApprover() , false); plan.getIdentifier().populateEnvironmentVariables(context); materialRevisions.populateEnvironmentVariables(context, workingDirectory); diff --git a/common/src/com/thoughtworks/go/util/validators/DatabaseValidator.java b/common/src/com/thoughtworks/go/util/validators/DatabaseValidator.java index 3fe124cc420..d8f9aafc2cc 100644 --- a/common/src/com/thoughtworks/go/util/validators/DatabaseValidator.java +++ b/common/src/com/thoughtworks/go/util/validators/DatabaseValidator.java @@ -25,7 +25,7 @@ public class DatabaseValidator extends ZipValidator { public Validation validate(Validation validation) { - File destDir = new File(SystemEnvironment.getProperty("user.dir"), "db"); + File destDir = new File(new SystemEnvironment().getPropertyImpl("user.dir"), "db"); destDir.mkdirs(); try { unzip(new ZipInputStream(this.getClass().getResourceAsStream("/defaultFiles/h2deltas.zip")), destDir); diff --git a/common/src/com/thoughtworks/go/util/validators/JettyWorkDirValidator.java b/common/src/com/thoughtworks/go/util/validators/JettyWorkDirValidator.java index f0dce03a74e..719c71a2942 100644 --- a/common/src/com/thoughtworks/go/util/validators/JettyWorkDirValidator.java +++ b/common/src/com/thoughtworks/go/util/validators/JettyWorkDirValidator.java @@ -28,10 +28,10 @@ public class JettyWorkDirValidator implements Validator { public Validation validate(Validation val) { if (SystemEnvironment.getProperty("jetty.home", "").equals("")) { - new SystemEnvironment().setProperty("jetty.home", SystemEnvironment.getProperty("user.dir")); + new SystemEnvironment().setProperty("jetty.home", new SystemEnvironment().getPropertyImpl("user.dir")); } - File home = new File(SystemEnvironment.getProperty("jetty.home")); - File work = new File(SystemEnvironment.getProperty("jetty.home"), "work"); + File home = new File(new SystemEnvironment().getPropertyImpl("jetty.home")); + File work = new File(new SystemEnvironment().getPropertyImpl("jetty.home"), "work"); if (home.exists()) { if (work.exists()) { try { diff --git a/config/config-api/src/com/thoughtworks/go/config/MingleConfig.java b/config/config-api/src/com/thoughtworks/go/config/MingleConfig.java index 0cfbce4cc9d..e7a5ebcab34 100644 --- a/config/config-api/src/com/thoughtworks/go/config/MingleConfig.java +++ b/config/config-api/src/com/thoughtworks/go/config/MingleConfig.java @@ -90,7 +90,7 @@ public void addError(String fieldName, String message) { } public String urlFor(String path) throws URIException { - URI baseUri = new URI(baseUrl, "UTF-8"); + URI baseUri = new URI(baseUrl, false, "UTF-8"); String originalPath = baseUri.getPath(); if (originalPath == null) { originalPath = ""; diff --git a/util/src/com/thoughtworks/go/util/command/CheckedCommandLineException.java b/util/src/com/thoughtworks/go/util/command/CheckedCommandLineException.java index a001296ddd3..3f326a20358 100644 --- a/util/src/com/thoughtworks/go/util/command/CheckedCommandLineException.java +++ b/util/src/com/thoughtworks/go/util/command/CheckedCommandLineException.java @@ -17,10 +17,6 @@ package com.thoughtworks.go.util.command; public class CheckedCommandLineException extends CruiseControlException { - public CheckedCommandLineException(String s) { - super(s); - } - public CheckedCommandLineException(String s, Throwable t) { super(s, t); }