Hitachi Vantara Pentaho Community Forums
Results 1 to 12 of 12

Thread: resourcebundle-handling not working in 0.8.7

  1. #1
    Join Date
    Mar 2003
    Posts
    4,947

    Default resourcebundle-handling not working in 0.8.7

    Hi,

    A bug in the export functionality (CSV export always uses comma as separator no matter what you set it to due to it being hard-coded in the CSVWriter class) caused us to look at upgrading from 0.8.6 to 0.8.7.

    However, in addition to the separator-bug still being there, I think there is another issue. The resource-bundle handling seems to have stopped working between 8.6 and 8.7

    We're using "resource-labels" in our report designs to be able to localize our report output. We then use the jfreereport.setResourceBundleFactory() to set up our own resourcebundle handling.

    This worked fine in 0.8.6, but in 0.8.7 nothing happens, our labels don't get set.

    I did some debugging and even though we do the setresourcebundlefactory, the factory is NEVER called by jfree.


    Can someone shed some light on this? Input and pointers are much appreciated...

  2. #2

    Default

    Hi,
    you are true, the comma separator was hardcoded, I changed that in the CVS.
    Concerning the debug on resourcebundles, I do not have the time to dig on it right now, I hope to not forget comming back on it when I will have the time.
    If we forget, message us
    May the Moo force be with you,
    Said Mimil

    A student of JFree & Pentaho Academies,
    Cedric Pronzato

  3. #3
    Join Date
    Mar 2003
    Posts
    4,947

    Default

    ok, well thanks for confirming that my bug is indeed a bug... I would sure be happy if you'd take a look at the resourcehandling issue aswell.

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Hi,

    the resource-bundle factory should work. The JFreeReport.setResourceBundleFactory(..) method is never called, as the default implementation is set in the constrcutor of the JFreeReport object (not using the setter).

    The JFreeReport-Object itself is not used during the report processing. JFreeReport copies all relevant properties (and this includes the ResourceBundleFactory) into a ReportDefinitionImpl object. This makes sure, that noone can mess up the report processing.

    The resource-labels still use the old mechanism of passing a resource-id to the factory to get the resource-bundle. The resource-id can be any string, but the default implementation only accepts classnames (the common java-way of loading resourcebundles). If the label itself does not define a bundle-id, the report configuration is queried for the default (defined by the key 'org.jfree.report.ResourceBundle').

    The factory is (for instance) called from within the class "org.jfree.report.filter.ResourceFileFilter", which is part of all resource-labels.

    Regards,
    Thomas

  5. #5
    Join Date
    Mar 2003
    Posts
    4,947

    Default

    OK, maybe i didn't explain the problem well enough.

    What *we* do is call the setresourcebundlefactory, since we want jfree to use *our* factory rather than the default implementation in order for us to provide correct resource values.

    In the old version, we could see by debugging that jfree called our factory many times when the report was generated. When changing JAR to the new version, this doesn't happen anymore and the report output does not contain our resource-strings.

    I hope this clears things up.

  6. #6
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Hi,

    I cannot verify that (at least here). Custom resourcebundlefactories are used in the Pentaho-Plattform and work pretty well there. The Internationalization-Demo sets its own ResourceBundleFactories as well, and JFreeReport happily accepts them.

    Of course, you must make sure, that you set the resourcebundlefactory before you pass the report to one of the report processors. JFreeReport (the engine) clones the report for the processing and changes to the original report object have no effect on the report processors later on.

    IF you can send me a little demo that exposes the buggy behaviour, I'm quite sure fixing it (either the demo or the engine) will be a couple of minutes.

    Regards,
    Thomas

  7. #7
    Join Date
    Mar 2003
    Posts
    4,947

    Default

    Thanks for you response. Yeah, we do set the factory before processing the report, i think...

    The only thing we do to make this not working anymore is:
    1. generate the report with 0.8.6 and see that all our resource-strings get set
    2. change our JAR in the classpath to 0.8.7
    3. re-run with the same code, and now it stops working and I can see from sys-outs that my factory is not used anymore.

    I don't have the exact code for copy-paste, but the flow is:

    generator = reportgenerator.getInstance();
    JFreeReport myReport = generator.parseReport(myURL);
    reportBundleFactory f = new ReportBundleFactory();//MY factory
    myReport.setResourceBundleFactory(f);
    ..
    JoiningTableModel mymodel //i add data to this
    myReport.setData(myModel);
    ...
    PreviewDialog d = new PreviewDialog(myReport, ... , ...);

    This calls my factory in 0.8.6 but not in 0.8.7 as far as i can see...

  8. #8
    Join Date
    Aug 2004
    Posts
    24

    Angry still the same problem

    I still have this problem using jfreereport-0.8.7-10

    ....
    JFreeReport report = generator.parseReport( clsCaller.getClass().getResource( strFileWithPath ) );

    // set locale for the resource bundle used in the reports
    final MyResourceBundleFactory rfact = new MyResourceBundleFactory( MyTextValueHelper.getInstance(), this.locLocale );
    report.setResourceBundleFactory( rfact );

    The main question is how to generate the report straight to pdf without useing ReportGenerator.parseReport(...)
    Last edited by majobau; 03-02-2010 at 08:56 AM.

  9. #9
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    ReportGenerator#generateReport is just poorly named. It is a method to parse the XML file into a JFreeReport object. It has nothing to do with exports at all.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  10. #10
    Join Date
    Aug 2004
    Posts
    24

    Unhappy still the same problem

    that's right! Sorry for being too short in my posting!
    But the problem is still the same, after parsing the xml file the report is "frozen" and setting the
    ResourceBundleFactory has no effect!

    Controled by program logic I have to switch the locale the report will be generated with.

  11. #11
    Join Date
    Aug 2004
    Posts
    24

    Smile

    hi, I found an bug in my own resource bundle. mea culpa!

  12. #12

    Default

    Hi,

    We are using Pentaho Reports Designer 3.7

    We have a requirement for Internationalization of my Pentaho reports in Japanese,Chinese,Korean,Portuguese and Russian languages.
    Also,all these languages are supported by my database.

    Please let me know whether this can be implemented in Pentaho 3.7 ? If yes, how can we implement this?

    Also Please attach some guide or refernece material for internationalization if possible.

    Thanks & Regards,
    Karthik.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.