Problem with LocalizationBundle in JFreeChart-0.9.13

A free public discussion forum for the JFreeChart class library.

Problem with LocalizationBundle in JFreeChart-0.9.13

Postby Nemezis » Tue Nov 04, 2003 11:48 am

Hi all!

I have some persistent problem with the LocalizationBundle in version 0.9.13 of JFreeChart.

I have downloaded this version and I've added all the LocalizationBundle_pl_PL.properties (three in JFreeChart package) - without result :shock:.

I have made some test...

I have run my app directly from the class files (I compile JFreeChart package myself ant I have attached the LocalizationBundle to package manually) - everything was OK!
But when I try to use JFreeChart-0.9.13.jar or I try to use contents of the JFreeChart jar in my jar package the exception is throw away (java.lang.ExceptionInInitializerError)!


IMPORTANT:
Problem appear on some machines, on other everything is fine - I don't know why!

What is wrong?

Have You any ideas?

Best regards.

Nemezis.
Last edited by Nemezis on Thu May 20, 2004 10:56 am, edited 3 times in total.
Nemezis
 
Posts: 3
Joined: Tue Nov 04, 2003 11:09 am
Location: Gliwice (Poland)

Re: Problem with LocalizationBundle in JFreeChart-0.9.13

Postby Nemezis » Thu Nov 06, 2003 12:00 pm

Thank You very much for fast response...

Nevermind...

I have noticed that the *.properties files may produce an ExceptionInInitializerError on some machines... The reason is unknown for me but the point is when one uses strictly the class of the JfreeChart package everything is fine, but when one uses the jar file (JFreeChart or his own jar included the JFreeChart package) the exception is thrown away.

I have done some modification in the JFreeChart package...

I suggest to use the LocalizationBundle.class rather then LocalizationBundle.properties file. In that case (use localization bundle class) everything works fine and no exception is thrown. Modification of those locale is maybe more difficult but the app is more localization bundle problems indepedent.

What You can do is change the boundle.properties file to boundle.class:

Example:

The LocalizationBundle.properties

    # org.jfree.chart.ChartPanel ResourceBundle properties file
    #
    # Changes (from 31-Aug-2003)
    # --------------------------
    # 31-Aug-2003 : Initial version (AL);
    #

    Auto_Range=Auto Range
    All_Axes=Both Axes
    Chart_Properties=Chart Properties
    Copy=Copy
    Horizontal_Axis=Horizontal Axis
    PNG_Image_Files=PNG Image Files
    Print...=Print...
    Properties...=Properties...
    Save_as...=Save as...
    Vertical_Axis=Vertical Axis
    Zoom_In=Zoom In
    Zoom_Out=Zoom Out


The LocalizationBundle.class

Code: Select all
package org.jfree.chart;

import java.util.*;

public class LocalizationBundle extends ListResourceBundle
{
    public Object[][] getContents()
    {
        return contents;
    }
   
    static final Object[][] contents =
    {
        {"Auto_Range", "Auto Range"},
        {"All_Axes", "Both Axes"},
        {"Chart_Properties", "Chart Properties"},
        {"Copy", "Copy"},
        {"Horizontal_Axis", "Horizontal Axis"},
        {"PNG_Image_Files", "PNG Image Files"},
        {"Print...", "Print..."},
        {"Properties...", "Properties..."},
        {"Save_as...", "Save as..."},
        {"Vertical_Axis", "Vertical Axis"},
        {"Zoom_In", "Zoom In"},
        {"Zoom_Out", "Zoom Out"},
    };
}


Thats all folks!
:lol:

Obviously You have to use right sufix.

Example:

For the Polish locale You have to add the _pl_PL sufix (LocalizationBundle_pl_pl).

The rest shouldn't modified...

Best regards.

Nemezis.

/*Ograniczony umysł wyżywa się w nieograniczonych ambicjach*/
Nemezis
 
Posts: 3
Joined: Tue Nov 04, 2003 11:09 am
Location: Gliwice (Poland)

Postby david.gilbert » Thu Nov 06, 2003 6:50 pm

I'd prefer to stick with the .properties files, but try to understand what has gone wrong. It would help if you could post the following information:

- your JDK version and operating system;
- the default locale for your system;
- does this occur with the jar files included in the distribution, or just the ones you have built yourself?
- any other information that would help to replicate the problem (it's not something I see on my systems).
Dave Gilbert
JFreeChart Project Leader

:idea: Buy the JFreeChart Developer Guide :idea:
david.gilbert
JFreeChart Project Leader
 
Posts: 10759
Joined: Fri Mar 14, 2003 10:29 am
Location: Europe

Postby Nemezis » Fri Nov 07, 2003 8:25 am

david.gilbert wrote:I'd prefer to stick with the .properties files, but try to understand what has gone wrong. It would help if you could post the following information:

- your JDK version and operating system;
- the default locale for your system;
- does this occur with the jar files included in the distribution, or just the ones you have built yourself?
- any other information that would help to replicate the problem (it's not something I see on my systems).


My JDK version:
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

Operation system:
Win2000 5.00.2195
(without Service Pack)

Problem specification:
Problem with LocalizationBundle finding appeared both in the jar files included in the distribution and in jar I have built myself (other components in my app use *.properties localization bundle files without similar problems).

What elese?
Hmmm...

I have used my app on several machines (all of them use Win2000 with the 1.4.2 JDK) and only on a few ones problem with LocalizationBundle emerged.

I have no idea what caused the problem.
This is at least strange... :shock:

Thank You in advance.

Nemezis.
Nemezis
 
Posts: 3
Joined: Tue Nov 04, 2003 11:09 am
Location: Gliwice (Poland)

Postby david.gilbert » Fri Nov 07, 2003 5:49 pm

And your locale?
Dave Gilbert
JFreeChart Project Leader

:idea: Buy the JFreeChart Developer Guide :idea:
david.gilbert
JFreeChart Project Leader
 
Posts: 10759
Joined: Fri Mar 14, 2003 10:29 am
Location: Europe

Postby Guest » Wed Nov 12, 2003 10:46 am

david.gilbert wrote:And your locale?


As I have written before my locale is pl_PL (Poland).
:wink:

Best regards.

Nemezis.
Guest
 

LocalizationBundle.class

Postby Adam » Wed Mar 03, 2004 5:42 pm

For what it's worth, I was having similar problems with jfreechart version 0.9.15 in that the program appeared to work fine, but when I checked my server logs (it is a web-based program) there were several error messages stating the following:

File does not exist: /Users/almelle/Sites/webSintering/org/jfree/chart/plot/LocalizationBundle.class
File does not exist: /Users/almelle/Sites/webSintering/org/jfree/chart/plot/LocalizationBundle_en.class
File does not exist: /Users/almelle/Sites/webSintering/org/jfree/chart/plot/LocalizationBundle_en_US.class

After spending some time trying to find why these classes weren't found, I found this topic, and made my own java files as described be Nemezis, and then compiled them, and it appears that this works just fine. Please also note that the *.property files for the class files above were also not found, and for this problem, I simply copied and renamed the LocalizationBundle.properties file.
Adam
 


Return to JFreeChart - General

Who is online

Users browsing this forum: Google [Bot] and 2 guests