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,21 +462,14 @@ public class ReportStarter implements ProcessCall, ClientProcess {
resFile = getResourcesForResourceFile(jasperName, currLang); resFile = getResourcesForResourceFile(jasperName, currLang);
// TODO: Implement file:/ for resources // TODO: Implement file:/ for resources
} else { } else {
File[] resources = reportDir.listFiles( new FileFilter( jasperName, reportDir, ".properties")); resFile = new File(jasperName+"_"+currLang.getLocale().getLanguage()+".properties");
// try baseName + "_" + language if (!resFile.exists()) {
for( int i=0; i<resources.length; i++) { resFile = null;
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;
} }
if (resFile == null) {
resFile = new File(jasperName+".properties");
if (!resFile.exists()) {
resFile = null;
} }
} }
} }