java.io patches

andrew raymond trick a-trick at students.uiuc.edu
Sun Oct 11 15:40:58 PDT 1998


While trying to get the _209_db benchmark from SpecJVM98 to work, I made
the following patches to the java libraries.

1) java.io. DataInputStream was not properly skipping ^M's at the end of a
line.

***************
*** 104,113 ****
                        }

                        cdata = (char)data;
!                       if (cdata == '\n') {
!                               buffer.append(cdata);
!                       }
!                       else {
                                /* Jump back to mark */
                                reset();
                        }
--- 104,111 ----
                        }

                        cdata = (char)data;
!                       /* ART - Do NOT append the ^M character */
!                       if (cdata != '\n') {
                                /* Jump back to mark */
                                reset();
                        }


2) java.io.StreamTokenizer was not translating escape sequences inside
quoted strings.

***************
*** 153,163 ****
                buffer.setLength( 0);
                chr = chrRead();
                while ( chr != cq) {
!                       buffer.append((char)(chr & 0xFF));
!                       if ( chr == '\\' ) {
!                               chr = chrRead();
!                               buffer.append((char)(chr & 0xFF));
                        }
                        chr = chrRead();
                        if ( chr == 256 )
                                break;
--- 153,186 ----
                buffer.setLength( 0);
                chr = chrRead();
                while ( chr != cq) {
!                   /* ART - translate escape sequences */
!                   if ( chr == '\\' ) {
!                       chr = chrRead();
!                       switch (chr) {
!                       case 'a':
!                           chr = 0x7;
!                           break;
!                       case 'b':
!                           chr = '\b';
!                           break;
!                       case 'f':
!                           chr = 0xC;
!                           break;
!                       case 'n':
!                           chr = '\n';
!                           break;
!                       case 'r':
!                           chr = '\r';
!                           break;
!                       case 't':
!                           chr = '\t';
!                           break;
!                       case 'v':
!                           chr = 0xB;
!                           break;
                        }
+                   }
+                   buffer.append((char)(chr & 0xFF));
                        chr = chrRead();
                        if ( chr == 256 )
                                break;

----------------
That's it.

Andy



More information about the kaffe mailing list