Page 1 of 1

Chartool 1.0b15 error with Gurps character sheet

Posted: Thu Oct 21, 2010 3:18 pm
by Doctor Thantos
I downloaded the latest version of the Character tool and the text is all weird.

How do I fix this?
This is a screen capture of the messed up fonts.
This is a screen capture of the messed up fonts.
Chartool.JPG (149.4 KiB) Viewed 4042 times

Thanks

Doctor Thantos

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Thu Oct 21, 2010 3:48 pm
by jay
Hmmmmm, how weird. I'm not sure how to fix it right now, it might have something to do with the I/O stuff that Azhrei has been adding. I'll talk to him and see if we can figure it out.

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Thu Oct 21, 2010 5:03 pm
by Doctor Thantos
Maybe I need to install a font?

Perhaps Klingon? :D

Thanks for looking into it.

Doctor Thantos

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Thu Oct 21, 2010 5:24 pm
by neofax
FYI, it shows up fine for me, so my assumption is that it is a font issue.

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Thu Oct 21, 2010 9:32 pm
by Azhrei
Yeah, looks fine for me as well. But I didn't load the GURPS configuration. Let me try that, too...

I tried to use Game > Select Game... and got a NPE:

Code: Select all

java.lang.NullPointerException
	at com.jeta.forms.components.panel.FormPanel.getFormContainer(Unknown Source)
	at net.rptools.chartool.ui.component.AbstractDialog.setTitle(AbstractDialog.java:210)
	at net.rptools.chartool.ui.component.AbstractDialog.construct(AbstractDialog.java:174)
	at net.rptools.chartool.ui.component.AbstractDialog.<init>(AbstractDialog.java:107)
	at net.rptools.chartool.ui.component.GameSelectionDialog.<init>(GameSelectionDialog.java:204)
	at net.rptools.chartool.ui.component.GameMenuController$1.actionPerformed(GameMenuController.java:111)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:389)

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Fri Oct 22, 2010 8:41 am
by jay
Azhrei, Did you run it from WebStart? That is usually the cause of that exception.

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Fri Oct 22, 2010 12:54 pm
by Azhrei
Yes, I did. So I guess you know about this, huh? Hm.

Ah, I see the problem. You're trying to set the Title before the window has been realized. In other words, the setTitle() public method tries to retrieve the current window by calling the JIDE methods and those methods must be accessing the peer component -- which doesn't exist yet. It's probably getFormContainer() that's returning null.

In general, public methods shouldn't be called by constructors because of exactly this problem. The constructor's job is to initialize the object and by definition public methods expect the object to already be initialized. Catch-22.

In general, the constructor should call a private method that initializes the object and the public method should do a sanity check and make the same call. This is particularly important for methods that are not final! Otherwise, the setTitle() method could be overridden by a subclass and when the constructor calls it the subclass' method is actually invoked and that object hasn't been instantiated yet! (I believe Java tracks this and throws an exception, but languages like C++ don't do these runtime checks.)

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Fri Oct 22, 2010 2:49 pm
by Doctor Thantos
I downloaded the file in zip and I run it from the local Launch CharTool.bat and I get the screen above.

I tried reloading the current game and I get the following errors.

java.lang.NullPointerException
at net.rptools.parser.function.impl.Addition.checkParameters(Addition.java:63)
at net.rptools.parser.function.AbstractFunction.evaluate(AbstractFunction.java:48)
at net.rptools.parser.EvaluationTreeParser.evaluate(EvaluationTreeParser.java:115)
at net.rptools.parser.Expression.evaluate(Expression.java:55)
at net.rptools.chartool.model.property.RPScript.execute(RPScript.java:195)
at net.rptools.chartool.model.property.DefaultScriptPropertyValue.execute(DefaultScriptPropertyValue.java:167)
at net.rptools.chartool.model.property.PropertyNode.getValue(PropertyNode.java:779)
at net.rptools.chartool.model.property.PropertyNode.get(PropertyNode.java:658)
at net.rptools.chartool.model.property.PropertyNode.get(PropertyNode.java:601)
at net.rptools.chartool.model.property.PropertyMap.get(PropertyMap.java:321)
at net.rptools.chartool.ui.charsheet.CharSheetController.setFields(CharSheetController.java:434)
at net.rptools.chartool.ui.charsheet.CharSheetController.setData(CharSheetController.java:393)
at net.rptools.chartool.ui.CharacterTab.setCharacter(CharacterTab.java:241)
at net.rptools.chartool.model.CharToolPreferences$2.run(CharToolPreferences.java:348)
at net.rptools.chartool.ui.component.Utilities$ProgressWorker.done(Utilities.java:1203)
at javax.swing.SwingWorker$5.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
at sun.swing.AccumulativeRunnable.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at net.rptools.chartool.ui.LoggingEventQueue.dispatchEvent(LoggingEventQueue.java:74)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Sorry but I am not a programmer so I have no clue what the above means...

Thanks.

Doctor Thantos

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Fri Oct 22, 2010 3:12 pm
by jay
Azhrei wrote:Ah, I see the problem. You're trying to set the Title before the window has been realized. In other words, the setTitle() public method tries to retrieve the current window by calling the JIDE methods and those methods must be accessing the peer component -- which doesn't exist yet. It's probably getFormContainer() that's returning null.

In general, public methods shouldn't be called by constructors because of exactly this problem. The constructor's job is to initialize the object and by definition public methods expect the object to already be initialized. Catch-22.
I understand what you're saying, but I don't think that is the problem. While setTitle() is being called on an object that hasn't been fully initialized, the method that is throwing the exception is called on a fully initialized object.

Besides, the peer component doesn't get created until the setVisible() method is called. If that was the problem it would happen each and every time the code was executed, not just when loading from WebStart on some computers. Judging by the exception all of this code is executing on the AWT Event Thread, so it isn't something like an invokeLater() problem either. That doesn't mean that the Abeille doesn't load stuff in another thread...

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Fri Oct 22, 2010 3:19 pm
by jay
Doctor Thantos wrote:I downloaded the file in zip and I run it from the local Launch CharTool.bat and I get the screen above.

I tried reloading the current game and I get the following errors.

java.lang.NullPointerException
at net.rptools.parser.function.impl.Addition.checkParameters(Addition.java:63)
at net.rptools.parser.function.AbstractFunction.evaluate(AbstractFunction.java:48)
snip
This is an exception from the RPScript parser. If the strings on the form are getting messed up, it might be messing up the scripts that are contained in the forms.

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Fri Oct 22, 2010 4:05 pm
by Azhrei
jay wrote:This is an exception from the RPScript parser. If the strings on the form are getting messed up, it might be messing up the scripts that are contained in the forms.
Ah. Then this problem could be related to the UTF-8 changes for XML written to a zip file. Are these the "rpgame" files, Jay? I can take a look...

Also, the docs for JETAPanel indicate that instead of calling getFormContainer() it may be better to call getFormAccessor() and retrieve the top-level form element, then tell that component to change the layout.

Tracing the code for getFormContainer() there is a reference to bean.getDelegate(). I'm not familiar with Bean internals but I'm guessing that's a peer component...?

Re: Chartool 1.0b15 error with Gurps character sheet

Posted: Fri Oct 22, 2010 4:30 pm
by jay
Azhrei wrote:
jay wrote:This is an exception from the RPScript parser. If the strings on the form are getting messed up, it might be messing up the scripts that are contained in the forms.
Ah. Then this problem could be related to the UTF-8 changes for XML written to a zip file. Are these the "rpgame" files, Jay? I can take a look...
That is what I was wondering about. Just can't figure out why it would be broke for just one person. Feel free to take a look.
Azhrei wrote:Also, the docs for JETAPanel indicate that instead of calling getFormContainer() it may be better to call getFormAccessor() and retrieve the top-level form element, then tell that component to change the layout.
I had seen that as well, but I don't remember why I didn't follow it. This could be old code or I couldn't get it to work with the accessor.
Azhrei wrote:Tracing the code for getFormContainer() there is a reference to bean.getDelegate(). I'm not familiar with Bean internals but I'm guessing that's a peer component...?
I'll take a look when I get a chance.