ReportStarter: much more optimal searching for resource file

This commit is contained in:
teo_sarca 2008-11-24 16:04:20 +00:00
parent c45d46bf55
commit 80ae1dca25
1 changed files with 10 additions and 17 deletions

View File

@ -462,23 +462,16 @@ public class ReportStarter implements ProcessCall, ClientProcess {
resFile = getResourcesForResourceFile(jasperName, currLang);
// TODO: Implement file:/ for resources
} else {
File[] resources = reportDir.listFiles( new FileFilter( jasperName, reportDir, ".properties"));
// try baseName + "_" + language
for( int i=0; i<resources.length; i++) {
if ( resources[i].getName().equals( jasperName+currLang.getLocale().getLanguage()+".properties")) {
resFile=resources[i];
break;
}
}
if (resFile==null) {
// try baseName only
for( int i=0; i<resources.length; i++) {
if ( resources[i].getName().equals( jasperName+".properties")) {
resFile=resources[i];
break;
}
}
}
resFile = new File(jasperName+"_"+currLang.getLocale().getLanguage()+".properties");
if (!resFile.exists()) {
resFile = null;
}
if (resFile == null) {
resFile = new File(jasperName+".properties");
if (!resFile.exists()) {
resFile = null;
}
}
}
if (resFile!=null) {
try {