Error running sablecc..

Jules Bean jmlb2 at hermes.cam.ac.uk
Mon Mar 22 07:17:51 PST 1999


On Mon, 22 Mar 1999, Jules Bean wrote:

> On Sun, 21 Mar 1999, Jules Bean wrote:
> 
> > I'm just about to start writing a parser using SableCC (which I found out
> > about from the link on the transvirtual page).
> > 
> > Unfortunately, I can't even run the supplied example parsers..
> > 
> > The problem is in this snippet of java code:
> > 
> > (from ca/mcgill/sablecc/parser/Parser.java)
> > 
> >     public Parser(Lexer lexer)
> >     {
> >         this.lexer = lexer;
> > 
> >         try
> >         {
> >             ObjectInputStream s = new
> > ObjectInputStream(getClass().getResourceAsStream("parser.dat"));
> >             actionTable = (int[][][]) s.readObject();
> >             gotoTable = (int[][]) s.readObject();
> >             errors = (String[]) s.readObject();
> >             s.close();
> >         }
> >         catch(Exception e)
> >         {
> >             throw new RuntimeException("Unable to read parser.dat.");
> >         }
> >     }
> > 
> > .the code throws the exception.  So, it looks like there's a problem with
> > either kaffe's serialisation stuff, or kaffe's getResource stuff.
> > 
> > I'm using 1.0b3 - I rather suspect the answer is going to be 'upgrade to
> > the CVS version', but I though I'd check here first.
> 
> OK.  I updated to CVS (as of today).  I still doesn't work.  Error exactly
> as above.
> 
> I know my way around gdb, I'm happy to give more helpful info, but I'm not
> sure what would help..
> 
> (To try it yourself, download sablecc from http://www.sable.mcgill.ca)

OK.  Replying to myself again.  Bad habit.

I made the obvious addition of e.printStackTrace() to the catch handler
above, and I see:

java.io.StreamCorruptedException: bad array:
java.io.StreamCorruptedException: error getting class:
java.io.StreamCorruptedException: error getting object:
java.io.StreamCorruptedException: mismatched serial version UIDs
        at java.lang.Throwable.<init>(Throwable.java:37)
        at java.lang.Exception.<init>(Exception.java:21)
        at java.io.IOException.<init>(IOException.java:22)
        at
java.io.ObjectStreamException.<init>(ObjectStreamException.java:24)
        at
java.io.StreamCorruptedException.<init>(StreamCorruptedException.java:24)
        at
kaffe.io.ObjectInputStreamImpl.getArray(ObjectInputStreamImpl.java:218)
        at
kaffe.io.ObjectInputStreamImpl.readObject(ObjectInputStreamImpl.java:125)
        at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:176)
        at ca.mcgill.sable.sablecc.parser.Parser.<init>(Parser.java:94)
        at ca.mcgill.sable.sablecc.SableCC.main(SableCC.java:155)
        at SableCC.main(SableCC.java:71)
java.lang.RuntimeException: Unable to read parser.dat.

Looks like it is an incompatibility between the JDK serialisation, and the
kaffe serialisation.

Jules

/----------------+-------------------------------+---------------------\
|  Jelibean aka  | jules at jellybean.co.uk         |  6 Evelyn Rd        |
|  Jules aka     |                               |  Richmond, Surrey   |
|  Julian Bean   | jmlb2 at hermes.cam.ac.uk        |  TW9 2TF *UK*       |
+----------------+-------------------------------+---------------------+
|  War doesn't demonstrate who's right... just who's left.             |
|  When privacy is outlawed... only the outlaws have privacy.          |
\----------------------------------------------------------------------/



More information about the kaffe mailing list