Menu

Bugs & Features

2004-06-10
2012-04-09
  • Christian Promintzer

    Hello everyone,

    I'm currently using JCurses for an "academic" probject and appreciate the easy way of using it.

    Unfortunately I found two major bugs during the implementation-phase of my project, which I fixed in my local-sourcetree of jcurses.
    In the spirit of open-source I would like to submit my fixes to the community - if someone is interested in them ;).

    *) The first issue deals with loading the native-library under MS Windows. The method Toolkit.getLibraryPath() seems to fail, if the library-path contains spaces. My fix uses the standard System.loadLibrary() instead of System.load(getLibraryPath()). this works on linux & win without problems.
    There is also a post in the help-forum concerning this problem.

    *) The second issue was the BorderLayoutManager throwing a NullPointerException at removeWidget(..). This is easily fixed by adding a check to the if-statement.

    greetings
    Christian (Vienna/AT)

     
    • Andy

      Andy - 2004-06-10

      Absolutely interested....

      However, you may want to check the CVS version out beforehand. The library loading code was substantially changed, and a number of other bugs fixed.

      But, yes patches and fixes are definately welcome. I really need to produce as new release - it has been on my todo. I will wait until we get your changes in first though.

      Many thanks...

       
    • Christian Promintzer

      Hi andy,

      Thanks for your reply - I checked out the cvs version today. The two issues I found are already fixed there - even a feature I was looking for (TextComponent.setEditable(..)) is already implemented in HEAD.. - great *g*

      Unfortunately I found another issue which seems has been introduced with V1.8 of the Window class:
      I get a the following exception from Window.loadFocusableClient() after using the new jcurses.jar:
      java.lang.ArrayIndexOutOfBoundsException: 5 >= 3
              at java.util.Vector.elementAt(Vector.java:431)
              at jcurses.widgets.Window.loadFocusableChilds(Window.java:678)
              at jcurses.widgets.Window.pack(Window.java:294)
              at javanotes.gui.text.JavaNotes.setContent(JavaNotes.java:143)
              at javanotes.gui.text.Search.openSelectedNote(Search.java:158)

      Reverting to V1.7 of Window solves the problem for me. But I guess the the change in loadFocusableClient() from 1.7 to 1.8 had some reasonable intention ;).

      greetings
      christian

       
      • Andy

        Andy - 2004-06-11

        Interesting....looking at the code in Window.java 1.8 and 1.7 I'm kinda fuzzy on why you would get the error on 1.8 but not 1.7, since you appear to have a _currentIndex value higher than the highest item in the list of focusable controls. The only way I can think of that this might have happened would be if you were making controls non-focusable, or removing them while focused. Admittedly, that should be supported, but I'm trying to understnad the problem. I've been working on some other minor code changes - just style and so on, removing unecessary brnaches and such. I have added some code to Window to make it a bit more resilient to invalid _currentIndex changes, and that should at least stop the error. I'll check that in in a bit, but I wanted to also find out more if I can, about what you are doing. It bugs me thatyou don't see the error in 1.7, and that makes me think I'm missing something.

         
    • Christian Promintzer

      Thanks for the hint about focused - I removed a widget while it was possibly focused.

      Here is the code of my setContent(Panel...) method:
          if (currentWindowPanel != null) {
            layoutManager.removeWidget(currentWindowPanel);
          }
          currentWindowPanel = panel;
          layoutManager.addWidget(currentWindowPanel,..);
          pack();
      .
      .

      I changed the method to:
          if (currentWindowPanel != null) {
            fileButton.getFocus();
            layoutManager.removeWidget(currentWindowPanel);
          }

      so that a button gets the focus before removing the panel. this works perfectly with Window V1.8.

      many thanks
      christian

       
      • Andy

        Andy - 2004-06-11

        Ok..good...that makes more sense. I'll go ahead and check in my code changes then. Basically it just does more checking on the _currentIndex value before using it - not only for negative values, but also for out of range values. I'm still not sure why it working on Window 1.7 though. I'll look into actually changing the focus when the focused item is removed as well.
        I really appreciate your input here. While I do use the library myself, the more people using it and identifying bugs and problems , the better.

         
    • Christian Promintzer

      Hello Andy,

      My project utilizing JCurses "rolled-out" successfully last friday. Thanks again for your great support - this is not self-evident for an opensource project !

      regards
      christian

       
    • Andy

      Andy - 2004-06-22

      Glad to hear it worked out for you.

      I have one more issue I want to verify completely before I do an actual release - the input thread doesn't terminate cleanly. I think I've got it just solved though.

      Keep an eye out for it though...

       

Log in to post a comment.