IDEMPIERE-992 JasperReport never finds the localized resource file when attached to the process / Thanks to José D. Paniagua

This commit is contained in:
Carlos Ruiz 2013-06-05 17:37:08 -05:00
parent 96be1963fb
commit c48da4c201
1 changed files with 5 additions and 3 deletions

View File

@ -779,16 +779,18 @@ public class ReportStarter implements ProcessCall, ClientProcess
File resFile = null; File resFile = null;
MAttachmentEntry[] entries = attachment.getEntries(); MAttachmentEntry[] entries = attachment.getEntries();
// try baseName + "_" + language // try baseName + "_" + language
String resname = jasperName + "_" + currLang.getLocale().getLanguage() + ".properties";
for( int i=0; i<entries.length; i++) { for( int i=0; i<entries.length; i++) {
if ( entries[i].getName().equals( jasperName+currLang.getLocale().getLanguage()+".properties")) { if (entries[i].getName().equals(resname)) {
resFile = getAttachmentEntryFile(entries[i]); resFile = getAttachmentEntryFile(entries[i]);
break; break;
} }
} }
if (resFile==null) { if (resFile==null) {
// try baseName only // try baseName only
resname = jasperName + ".properties";
for( int i=0; i<entries.length; i++) { for( int i=0; i<entries.length; i++) {
if ( entries[i].getName().equals( jasperName+".properties")) { if (entries[i].getName().equals(resname)) {
resFile = getAttachmentEntryFile(entries[i]); resFile = getAttachmentEntryFile(entries[i]);
break; break;
} }
@ -806,7 +808,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
private File getResourcesForResourceFile(String jasperName, Language currLang) { private File getResourcesForResourceFile(String jasperName, Language currLang) {
File resFile = null; File resFile = null;
try { try {
resFile = getFileAsResource(jasperName+currLang.getLocale().getLanguage()+".properties"); resFile = getFileAsResource(jasperName+"_"+currLang.getLocale().getLanguage()+".properties");
} catch (Exception e) { } catch (Exception e) {
// ignore exception - file couldn't exist // ignore exception - file couldn't exist
} }