Few bugs & patches

Tatu Saloranta tatu at hypermall.net
Sat Jan 15 16:59:53 PST 2000


I tried to report these bugs via Bug-tracking system at www.kaffe.org,
but report bounced back for some reason. So, as the bug reports &
patches
are rather small, I hope it's ok to send them to the list so someone
with access can use the patches (after checking they're ok).
So, here goes:

1) GridBagLayout.java gets an array index out of bounds - error when
   using GridBagConstraints.y = GridBagConstraints.RELATIVE. Seems like
    one line was accidentally missing from GridBagLayout.java, thus a
   simple patch is

(libraries/javalib/java/awt/GridBagLayout.java)
--- click click ---
358a359
>                               else y1 = -1;
--- click click ---


2) StreamTokenizer fails to tokenize both C and C++ - comments (if both
   are set on), as it first checks if the char following '/' is '/'; if
not,
   it simply decides to return '/' token, not check for the C-comment
(or
   was it vice versa). In any case, a simple fix is:

(libraries/javalib/java/io/StreamTokenizer.java)
--- click click ---
358a359
>                               else y1 = -1;
www:/~/java/fractlet% cat ../kaffe-patches/tokenizer-patch
146c146,147
<       else if (chr=='/' && CPlusPlusComments) {
---
>       else if (chr=='/' && CPlusPlusComments
>                && parseCPlusPlusCommentChars()) {
148d148
<               parseCPlusPlusCommentChars();
150c150,151
<       else if (chr=='/' && CComments) {
---
>       else if (chr=='/' && CComments
>                && parseCCommentChars()) {
152d152
<               parseCCommentChars();
331c331
< private void parseCPlusPlusCommentChars() throws IOException {
---
> private boolean parseCPlusPlusCommentChars() throws IOException {
337a338
>               return true;
341,342c342
<
<               ttype = '/';
---
>               return false;
346c346
< private void parseCCommentChars() throws IOException {
---
> private boolean parseCCommentChars() throws IOException {
352a353
>               return true;
357c358
<               ttype = '/';
---
>               return false;

--- click click ---

3) Not really a bug, but... Choice.java gets its preferred size by
simply
   checking the size of the current selection. JDK's behaviour seems to
be
   to size of the longest string, and that makes more sense. Thus:

(libraries/javalib/java/awt/widgets/Choice.java)

--- click click ---
<       Dimension d = entry.getPreferredSize();
<       d.width += BTN_WIDTH + 2*BORDER_WIDTH;
<       return d;
---
>     /* Instead of simply asking the current selection's size,
>      * we better find the maximum...
>      */
>     //Dimension d = entry.getPreferredSize();
>     Dimension d = new Dimension();
>     for (int i = items.size(); --i >= 0; ) {
>       Dimension d2 = entry.getPreferredSize(
>          ((String) items.elementAt(i)).length());
>       if (d2.width > d.width)
>           d.width = d2.width;
>       if (d2.height > d.height)
>           d.height = d2.height;
>     }
>     d.width += BTN_WIDTH + 2*BORDER_WIDTH;
>     return d;
--- click click ---

Hope these help!

--
Tatu aka Doomdark,
tatu at hypermall dot net


More information about the kaffe mailing list