Hi,
I just saw Basename.java has wrong behaviour against suffix removal
which I corrected:
--- Basename.java Thu Jun 27 11:04:55 2002
+++ Basename.java.patched Thu Jun 27 11:05:59 2002
@@ -127,7 +127,7 @@
} else {
value = file.getName();
if (suffix != null && value.endsWith(suffix)) {
- int pos = value.indexOf('.');
+ int pos = value.lastIndexOf(suffix);
value = value.substring(0, pos);
}
getProject().setNewProperty(property, value);
At first, as it is removing a _suffix_, it must use lastIndexOf()
instead of indexOf(): there would have been problems with file.tar.gz
for example.
Then, as the complete suffix is supplied, this suffix should be
removed instead of relying on a '.' suffix separator.
At last, a simple computation could be used to get the position:
int pos = value.length() - suffix.length();
but this does not seem as versatile as lastIndexOf() in case anything
other than the bare supplied suffix is used to compute the position.
What do you think of it?
PS: I'm not subscribed to this list, please cc: me in case of a reply.
--
Lo�c P�ron
phone:(33) 683 880 177
mailto:[EMAIL PROTECTED]--- Basename.java Thu Jun 27 11:04:55 2002
+++ Basename.java.patched Thu Jun 27 11:05:59 2002
@@ -127,7 +127,7 @@
} else {
value = file.getName();
if (suffix != null && value.endsWith(suffix)) {
- int pos = value.indexOf('.');
+ int pos = value.lastIndexOf(suffix);
value = value.substring(0, pos);
}
getProject().setNewProperty(property, value);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>