0

I'm trying to debug a charm project. I've set break points in the code, but each time execution reaches a break point, Netbeans freezes and I'm obliged to forcefully close it. For what it's worth, I'm using Ubuntu 15.04

[Edit 1]

Here's an image of a set break point

enter image description here

I am getting an exception: Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException that doesn't point to any line in my code, so I want to debug and get what is causing the problem. Immediately the code gets to line 106, everything freezes.

[Edit 2]

Ok here's most of the controller code.

public void initialize(URL url, ResourceBundle rb) {

        departmentList.setPlaceholder(new Label("Oops!! EMPTY!!!"));

        /*
         Populate SideMenu
         */
        ObservableList<Label> schools = FXCollections.observableArrayList();
        ListView<Label> schoolList = new ListView<>(schools);
        for (School school : schoolsList) {
            schools.add(new Label(school.getName(), MaterialDesignIcon.ACCOUNT_BALANCE.graphic()));
        }
        /*
         Add Listeners to side Menu ListView
         */
        schoolList.getSelectionModel().selectedItemProperty().addListener(
                (ObservableValue<? extends Label> observable, Label oldValue, Label newValue) -> {
                    selectedSchool = parser.findSchool(newValue.getText());
                    loadDepartments();
                    MobileApplication.getInstance().hideLayer("Side Menu");

                });

        /*
         Add Listener to departments ListView
         */
        departmentList.getSelectionModel().selectedItemProperty().addListener(
                (ObservableValue<? extends Label> observable, Label oldValue, Label newValue) -> {

                    if (newValue == null) {//Got fired by clearing the Observable list
                        return;
                    }
                    System.out.println(newValue);
                    facDept[1] = newValue.getText();
                    /*
                     Reset before leaving; *to be removed and tried on mobile
                     */
                    loadDepartments();
                    MobileApplication.getInstance().switchView(SEMESTER_VIEW);
                });
        borderPane.setCenter(schoolList);
        center.getChildren().add(departmentList);
    }

    @FXML
    private void showLayer(ActionEvent event) {
        MobileApplication.getInstance().showLayer("Side Menu");
    }

I set a break point in the showLayer method(MobileApplication...), and debugging works. I set another one the line selectedSchool = parser.findSchool(newValue.getText());, but here debugging freezes. Note that the exception doesn't occur here.

theking
  • 87
  • 13
  • Debugging works fine for me on a Charm project, with NetBeans on my Mac. I can't test on Linux. How do you launch debugging? – José Pereda Nov 27 '15 at 20:13
  • I launch debugging with the debug button next to the run button or a right click on the project and select debug. Actually its not only Netbeans that freezes. The OS freezes too, I can move the mouse but can't click. I force quit the running program using the keyboard. – theking Nov 28 '15 at 17:30
  • Can you debug any other JavaFX project? And JavaFXPorts project (without Charm dependencies)? Do you set any breakpoint? – José Pereda Nov 28 '15 at 17:38
  • Yes; I can debug both JavaFX and simple JavaFXPorts projects. Netbeans doesn't freeze at the breakpoints. – theking Nov 28 '15 at 19:09
  • It's hard to tell if you don't show where it gets stuck. I've tested debugging Charm with no problem at all. Can you show some code were you set the breakpoint? – José Pereda Nov 28 '15 at 19:18
  • I've edited the question to show the break point. – theking Nov 28 '15 at 19:56
  • Once you have an exception, I'm not sure how the debugger will react. I suggest you use some try-catch first, to isolate the exception. – José Pereda Nov 28 '15 at 20:02
  • @JoséPereda I've solved the IndexOutOfBoundsException problem using the solution from [this post](http://stackoverflow.com/a/27623202/4194406) but still not solved the debugging problem. I tried debugging the FiftyStates sample and encountered the same problem. – theking Dec 04 '15 at 08:43

0 Answers0