Skip to main content

Code exception not in build 36 until and including latest build 100

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
johnsirach
Offline
Joined: 2013-08-01

Hi all,

First of all i do not see the toolbar so can not preview or insert code blocks etc (Using google chrome 28.0.1500.95 m).

I'm very new to JavaFX, so maybe i'm the error here.

I'm building a javafx application for which it would be nice if it is running on the raspberry pi. I got this application working on windows systems. It also works on the raspberry pi, but only with build 36 (which is the first ARM preview of jdk8 i believe?).

With every build after 36 i got the following Exception (it is copy pasted from my log file written by log4j2):

2013-08-01 14:42:00,288 [JavaFX Application Thread] ERROR err - Exception in thread "JavaFX Application Thread"
2013-08-01 14:42:00,305 [JavaFX Application Thread] ERROR err - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
2013-08-01 14:42:00,310 [JavaFX Application Thread] ERROR err - at java.util.ArrayList.rangeCheck(ArrayList.java:638)
2013-08-01 14:42:00,315 [JavaFX Application Thread] ERROR err - at java.util.ArrayList.get(ArrayList.java:414)
2013-08-01 14:42:00,320 [JavaFX Application Thread] ERROR err - at com.sun.javafx.css.StyleMap.getCascadingStyles(StyleMap.java:121)
2013-08-01 14:42:00,324 [JavaFX Application Thread] ERROR err - at javafx.scene.CssStyleHelper.getStyle(CssStyleHelper.java:683)
2013-08-01 14:42:00,329 [JavaFX Application Thread] ERROR err - at javafx.scene.CssStyleHelper.lookupFont(CssStyleHelper.java:1548)
2013-08-01 14:42:00,333 [JavaFX Application Thread] ERROR err - at javafx.scene.CssStyleHelper.transitionToState(CssStyleHelper.java:460)
2013-08-01 14:42:00,338 [JavaFX Application Thread] ERROR err - at javafx.scene.Node.impl_processCSS(Node.java:8665)
2013-08-01 14:42:00,343 [JavaFX Application Thread] ERROR err - at javafx.scene.Parent.impl_processCSS(Parent.java:1192)
2013-08-01 14:42:00,347 [JavaFX Application Thread] ERROR err - at javafx.scene.Parent.impl_processCSS(Parent.java:1204)
2013-08-01 14:42:00,352 [JavaFX Application Thread] ERROR err - at javafx.scene.Node.processCSS(Node.java:8575)
2013-08-01 14:42:00,357 [JavaFX Application Thread] ERROR err - at javafx.scene.Scene.doCSSPass(Scene.java:538)
2013-08-01 14:42:00,361 [JavaFX Application Thread] ERROR err - at javafx.scene.Scene.preferredSize(Scene.java:1503)
2013-08-01 14:42:00,366 [JavaFX Application Thread] ERROR err - at javafx.scene.Scene.impl_preferredSize(Scene.java:1570)
2013-08-01 14:42:00,371 [JavaFX Application Thread] ERROR err - at javafx.stage.Window$9.invalidated(Window.java:733)
2013-08-01 14:42:00,375 [JavaFX Application Thread] ERROR err - at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
2013-08-01 14:42:00,380 [JavaFX Application Thread] ERROR err - at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:143)
2013-08-01 14:42:00,385 [JavaFX Application Thread] ERROR err - at javafx.stage.Window.setShowing(Window.java:799)
2013-08-01 14:42:00,389 [JavaFX Application Thread] ERROR err - at javafx.stage.Window.show(Window.java:814)
2013-08-01 14:42:00,394 [JavaFX Application Thread] ERROR err - at javafx.stage.Stage.show(Stage.java:243)
2013-08-01 14:42:00,398 [JavaFX Application Thread] ERROR err - at pidome.client.PidomeClient$1$1.run(Unknown Source)
2013-08-01 14:42:00,404 [JavaFX Application Thread] ERROR err - at com.sun.javafx.application.PlatformImpl$5$1.run(PlatformImpl.java:244)
2013-08-01 14:42:00,410 [JavaFX Application Thread] ERROR err - at com.sun.javafx.application.PlatformImpl$5$1.run(PlatformImpl.java:241)
2013-08-01 14:42:00,415 [JavaFX Application Thread] ERROR err - at java.security.AccessController.doPrivileged(Native Method)
2013-08-01 14:42:00,419 [JavaFX Application Thread] ERROR err - at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:241)
2013-08-01 14:42:00,424 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication$RunnableEvent.dispatch(LensApplication.java:169)
2013-08-01 14:42:00,428 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication._runLoop(LensApplication.java:756)
2013-08-01 14:42:00,438 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication.access$700(LensApplication.java:55)
2013-08-01 14:42:00,447 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication$4.run(LensApplication.java:815)
2013-08-01 14:42:00,452 [JavaFX Application Thread] ERROR err - at java.lang.Thread.run(Thread.java:724)
2013-08-01 14:42:00,604 [JavaFX Application Thread] ERROR err - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
2013-08-01 14:42:00,615 [JavaFX Application Thread] ERROR err - at java.util.ArrayList.rangeCheck(ArrayList.java:638)
2013-08-01 14:42:00,628 [JavaFX Application Thread] ERROR err - at java.util.ArrayList.get(ArrayList.java:414)
2013-08-01 14:42:00,634 [JavaFX Application Thread] ERROR err - at com.sun.javafx.css.StyleMap.getCascadingStyles(StyleMap.java:121)
2013-08-01 14:42:00,646 [JavaFX Application Thread] ERROR err - at javafx.scene.CssStyleHelper.getStyle(CssStyleHelper.java:683)
2013-08-01 14:42:00,651 [JavaFX Application Thread] ERROR err - at javafx.scene.CssStyleHelper.lookupFont(CssStyleHelper.java:1548)
2013-08-01 14:42:00,658 [JavaFX Application Thread] ERROR err - at javafx.scene.CssStyleHelper.transitionToState(CssStyleHelper.java:460)
2013-08-01 14:42:00,668 [JavaFX Application Thread] ERROR err - at javafx.scene.Node.impl_processCSS(Node.java:8665)
2013-08-01 14:42:00,673 [JavaFX Application Thread] ERROR err - at javafx.scene.Parent.impl_processCSS(Parent.java:1192)
2013-08-01 14:42:00,683 [JavaFX Application Thread] ERROR err - at javafx.scene.Parent.impl_processCSS(Parent.java:1204)
2013-08-01 14:42:00,687 [JavaFX Application Thread] ERROR err - at javafx.scene.Node.processCSS(Node.java:8575)
2013-08-01 14:42:00,692 [JavaFX Application Thread] ERROR err - at javafx.scene.Node.processCSS(Node.java:8566)
2013-08-01 14:42:00,697 [JavaFX Application Thread] ERROR err - at javafx.scene.Scene.doCSSPass(Scene.java:538)
2013-08-01 14:42:00,701 [JavaFX Application Thread] ERROR err - at javafx.scene.Scene.access$3600(Scene.java:189)
2013-08-01 14:42:00,706 [JavaFX Application Thread] ERROR err - at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2294)
2013-08-01 14:42:00,710 [JavaFX Application Thread] ERROR err - at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:325)
2013-08-01 14:42:00,715 [JavaFX Application Thread] ERROR err - at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:533)
2013-08-01 14:42:00,720 [JavaFX Application Thread] ERROR err - at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:513)
2013-08-01 14:42:00,724 [JavaFX Application Thread] ERROR err - at com.sun.javafx.tk.quantum.QuantumToolkit$16.run(QuantumToolkit.java:380)
2013-08-01 14:42:00,729 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication$RunnableEvent.dispatch(LensApplication.java:169)
2013-08-01 14:42:00,733 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication._runLoop(LensApplication.java:756)
2013-08-01 14:42:00,738 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication.access$700(LensApplication.java:55)
2013-08-01 14:42:00,742 [JavaFX Application Thread] ERROR err - at com.sun.glass.ui.lens.LensApplication$4.run(LensApplication.java:815)
2013-08-01 14:42:00,747 [JavaFX Application Thread] ERROR err - at java.lang.Thread.run(Thread.java:724)

This exceptions rises when running the following code:

<br />
    public void start(Stage primaryStage) {<br />
        redirectOutputToLog();<br />
        rootStage = primaryStage;<br />
        rootStage.setTitle("PiDome Client");<br />
        rootStage.setFullScreen(true);<br />
        rootStage.initStyle(StageStyle.UNDECORATED);<br />
        ready.addListener(new ChangeListener<Boolean>(){<br />
            @Override<br />
            public void changed(<br />
                ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {<br />
                    if (Boolean.TRUE.equals(t1)) {<br />
                        Platform.runLater(new Runnable() {<br />
                            @Override<br />
                            public void run() {<br />
                                rootStage.setScene(mainStage.scene());<br />
                                rootStage.show();<br />
                            }<br />
                        });<br />
                    }<br />
                }<br />
        });<br />
        initialize();<br />
    }<br />

The boolean is set to true by the following code:

<br />
    @Override<br />
    public void handleMainSceneEvent(MainSceneEvent event) {<br />
        if(event.getEventType().equals(MainSceneEvent.SCENEBUILDDONE)){<br />
            if(ready.getValue().equals(false)) notifyPreloader(new ProgressNotification(100));<br />
            if(ready.getValue().equals(false)) notifyPreloader(new StateChangeNotification(StateChangeNotification.Type.BEFORE_START));<br />
            ready.setValue(Boolean.TRUE);<br />
        }<br />
    }<br />

The function mainStage.Scene() returns:

<br />
    public final Scene scene(){<br />
        return appScene;<br />
    }<br />

The Scene appScene is created with (shortened) :

<br />
//// Declarations<br />
    Pane root = new Pane();<br />
    Scene appScene = new Scene(root, DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight()); //1920*1080 by default</p>
<p>    public final void createScene(){<br />
        LOG.debug("Screen dimensions: width: {}, height: {}",DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight());<br />
        root.getStylesheets().add("/pidome/client/resources/theme/standard/main.css");<br />
        root.getChildren().add(notBar);<br />
        root.getChildren().add(topBar);<br />
        root.getChildren().add(mainControl);<br />
        root.getChildren().add(bottomBar);<br />
        root.getChildren().add(subControl);</p>
<p>        //console.show();<br />
        _fireSceneBuildDone();<br />
    }</p>
<p>

Contents of main.css

<br />
.root {<br />
    display: block;<br />
    -fx-text-fill: white;<br />
    -fx-background-color: #000000;<br />
    -fx-background-image: url("/pidome/client/resources/theme/standard/images/background.jpg");<br />
    -fx-background-repeat: stretch;<br />
    -fx-background-position: center center;<br />
}</p>
<p>.button Text {<br />
    -fx-text-fill: linear-gradient(white, #d0d0d0);<br />
}</p>
<p>.label {<br />
    -fx-text-fill: #ffffff;<br />
}</p>
<p>.text {<br />
}<br />

As you can see i'm using a preloader, and it seems to be discarded when starting the application. The preloader is in full screen, as is the main application.

i have done some digging in the source code of javafx (found on Bitbucket openJFX) and found in file StyleMap.java (https://bitbucket.org/openjfxmirrors/openjfx-8-controls-rt/src/3450a1dac...) on line 121 and 122 without a check if the array even has something on position 0.

<br />
            CascadingStyle cascadingStyle = cascadingStyleList.get(0);<br />
            String property = cascadingStyle.getProperty();<br />

I do not know if the latsest build is the same as this openjfx file version.

My final question is: Am i doing something wrong? Or is there a bug introduced since 36b? Wich seems plausible since this file (as seen on bitbucket) is changed since build 36.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
johnsirach
Offline
Joined: 2013-08-01

Just in case the posting does show up on the forum, an answer is not needed anymore, see: https://forums.oracle.com/thread/2568421