@@ -1,5 +1,5 @@
/*
/*
* Copyright 2002-2005 The Apache Software Foundation
* Copyright 2002-2006 The Apache Software Foundation
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
@@ -129,7 +129,6 @@ public class BuildNumber
} catch (final NumberFormatException nfe) {
} catch (final NumberFormatException nfe) {
final String message =
final String message =
myFile + " contains a non integer build number: " + buildNumber;
myFile + " contains a non integer build number: " + buildNumber;
throw new BuildException(message, nfe);
throw new BuildException(message, nfe);
}
}
}
}
@@ -173,7 +172,7 @@ public class BuildNumber
private void validate()
private void validate()
throws BuildException {
throws BuildException {
if (null == myFile) {
if (null == myFile) {
myFile = getProject().resolveFile( DEFAULT_FILENAME);
myFile = FILE_UTILS.resolveFile(getProject().getBaseDir(), DEFAULT_FILENAME);
}
}
if (!myFile.exists()) {
if (!myFile.exists()) {
@@ -182,20 +181,17 @@ public class BuildNumber
} catch (final IOException ioe) {
} catch (final IOException ioe) {
final String message =
final String message =
myFile + " doesn't exist and new file can't be created.";
myFile + " doesn't exist and new file can't be created.";
throw new BuildException(message, ioe);
throw new BuildException(message, ioe);
}
}
}
}
if (!myFile.canRead()) {
if (!myFile.canRead()) {
final String message = "Unable to read from " + myFile + ".";
final String message = "Unable to read from " + myFile + ".";
throw new BuildException(message);
throw new BuildException(message);
}
}
if (!myFile.canWrite()) {
if (!myFile.canWrite()) {
final String message = "Unable to write to " + myFile + ".";
final String message = "Unable to write to " + myFile + ".";
throw new BuildException(message);
throw new BuildException(message);
}
}
}
}