sorry it still an issue because of the remove of trim() the offset (ie. pos) must be incremented, otherwise there is a "space" that is not part of the name that is added at the begining of names.
// we've got to find the starting point of the name. We
// do this by finding the pos of all the date/time fields, then
// the name - to ensure we don't get tricked up by a userid the
// same as the filename,for example
int pos = 0;
boolean ok = true;
for (int i = dateTimePos; i < dateTimePos+3; i++) {
pos = raw.indexOf(fields[i], pos);
if (pos < 0) {
ok = false;
break;
}
else { // move on the length of the field
pos += (fields[i].length()+1);
}
}
if (ok) {
//String remainder = raw.substring(pos).trim();
String remainder = raw.substring(pos);
if (!isLink)
name = remainder;
else { // symlink, try to extract it
pos = remainder.indexOf(SYMLINK_ARROW);
if (pos <= 0) { // couldn't find symlink, give up & just assign as name
name = remainder;
}
else {
int len = SYMLINK_ARROW.length();
//name = remainder.substring(0, pos).trim();
name = remainder.substring(0, pos);
if (pos+len < remainder.length())
linkedname = remainder.substring(pos+len);
}
}
}