private void initialize() {
final String entryName = this.ze.getName();
final String sTmp = entryName.substring("PJ/".length());
- int pos = sTmp.lastIndexOf('/');
+ final int pos = sTmp.lastIndexOf('/');
if (pos < 0) {
this.valid = false;
return;
}
this.collectivite = sTmp.substring(0, pos);
this.fileName = sTmp.substring(pos + 1);
- pos = this.fileName.lastIndexOf('.');
- if (pos >= 0) {
- this.pjName = this.fileName.substring(0, pos);
- } else {
- this.pjName = this.fileName;
- }
+ this.pjName = generatePjNameFromFileName(this.fileName);
+
this.uncompressedSize = this.ze.getSize();
}
public void setPath(final String path) {
this.path = path;
}
+
+ public static String generatePjNameFromFileName(final String pjName) {
+ final int pos = pjName.lastIndexOf('.');
+ return (pos >= 0 ? pjName.substring(0, pos) : pjName);
+ }
}