Skip to main content

Please review fix 6551236 - ArrayIndexException

3 replies [Last post]
bkurotsu
Offline
Joined: 2004-12-13
Points: 0

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fda
Offline
Joined: 2005-05-27
Points: 0

Reviewed. The fix should certainly work. But the logic is too complicated (it took a dozen minutes to understand it)

the following code seems more clear for understanding:

int distToDel = rrp.length() + 1;

if (thisFilePath.length() <= distToDel) {
return "";
} else {
// zap leading path plus the last path sep.
return thisFilePath.substring(distToDel);
}

fda
Offline
Joined: 2005-05-27
Points: 0

oops, forum dislikes tabs even stronger than me. code without tabs:

int distToDel = rrp.length() + 1;
if (thisFilePath.length() > disToDel) {
// zap leading path plus the last path sep.
return thisFilePath.substring(distToDel);
} else {
// rrp == file
return "";
}

bkurotsu
Offline
Joined: 2004-12-13
Points: 0

Fair comment, code rewritten.

Integrated rev 1436
https://jtharness.dev.java.net/source/browse/jtharness?rev=1436&view=rev