Skip to content
Permalink
Browse files

[FIXED JENKINS-29134] cont.

* Renamed constant "envVarPattern" to "ENV_VAR_PATTERN".

Signed-off-by: Deniz Bahadir <dbahadir@benocs.com>
  • Loading branch information...
Bagira80 committed Jul 15, 2015
1 parent 25537f0 commit 9c1a033923f6bc4b80a19cf682f03994f405695a
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/main/java/org/jvnet/hudson/tools/versionnumber/VersionNumberBuilder.java
@@ -59,7 +59,7 @@

private static final DateFormat defaultDateFormat = new SimpleDateFormat("yyyy-MM-dd");
// Pattern: ${VAR_NAME} or $VAR_NAME
private static final String envVarPattern = new String("^(?:\\$\\{(\\w+)\\})|(?:\\$(\\w+))$");
private static final String ENV_VAR_PATTERN = new String("^(?:\\$\\{(\\w+)\\})|(?:\\$(\\w+))$");

private final String versionNumberString;
private final Date projectStartDate;
@@ -168,7 +168,7 @@ private static String makeValid(String buildNum) {
} catch (Exception e) {
// Obviously, we did not receive a valid integer as override.
// Is it a reference to an environment-variable?
if (buildNum.matches(envVarPattern)) {
if (buildNum.matches(ENV_VAR_PATTERN)) {
// Yes, so return it as-is and only retrieve its value when
// the value must be accessed (to always get the most
// up-to-date value).
@@ -293,15 +293,15 @@ private VersionNumberBuildInfo incBuild(AbstractBuild build, Map<String, String>

// have we overridden any of the version number info? If so, set it up here
boolean saveOverrides = false;
Pattern pattern = Pattern.compile(envVarPattern);
Pattern pattern = Pattern.compile(ENV_VAR_PATTERN);

if (!this.oBuildsToday.equals("")) {
saveOverrides = true; // Always need to save if not empty!
// Just in case someone directly edited the config-file with invalid values.
oBuildsToday = makeValid(oBuildsToday);
int newVal = buildsToday;
try {
if (!oBuildsToday.matches(envVarPattern)) {
if (!oBuildsToday.matches(ENV_VAR_PATTERN)) {
newVal = Integer.parseInt(oBuildsToday);
oBuildsToday = ""; // Reset!
} else {
@@ -322,7 +322,7 @@ private VersionNumberBuildInfo incBuild(AbstractBuild build, Map<String, String>
oBuildsThisMonth = makeValid(oBuildsThisMonth);
int newVal = buildsThisMonth;
try {
if (!oBuildsThisMonth.matches(envVarPattern)) {
if (!oBuildsThisMonth.matches(ENV_VAR_PATTERN)) {
newVal = Integer.parseInt(oBuildsThisMonth);
oBuildsThisMonth = ""; // Reset!
} else {
@@ -343,7 +343,7 @@ private VersionNumberBuildInfo incBuild(AbstractBuild build, Map<String, String>
oBuildsThisYear = makeValid(oBuildsThisYear);
int newVal = buildsThisYear;
try {
if (!oBuildsThisYear.matches(envVarPattern)) {
if (!oBuildsThisYear.matches(ENV_VAR_PATTERN)) {
newVal = Integer.parseInt(oBuildsThisYear);
oBuildsThisYear = ""; // Reset!
} else {
@@ -364,7 +364,7 @@ private VersionNumberBuildInfo incBuild(AbstractBuild build, Map<String, String>
oBuildsAllTime = makeValid(oBuildsAllTime);
int newVal = buildsAllTime;
try {
if (!oBuildsAllTime.matches(envVarPattern)) {
if (!oBuildsAllTime.matches(ENV_VAR_PATTERN)) {
newVal = Integer.parseInt(oBuildsAllTime);
oBuildsAllTime = ""; // Reset!
} else {

0 comments on commit 9c1a033

Please sign in to comment.
You can’t perform that action at this time.