Hi, On Tue, 2004-12-07 at 08:59, Mark Wielaard wrote: > Trying to work around this you will at least have to deal with the > Writer problem yet again. Sigh. Patch attached. > > After that I am currently stuck unfortunately. > Will try to debug some more tonight.
Chris already made a couple of changes to gnu.xml.dom implementation (and added the above patch) to GNU JAXP CVS. If you resync with GNU JAXP and apply the following two patches it starts up again. First patch is for GNU JAXP. Handles the case were ReaderInputStream has too much characters. Second patch is for kaffe. Eclipse expects a SyncFailedException to have a non-null message, otherwise their log system just breaks spectacularly. We probably have a bug here. The SyncFailedException (caused by a ClosedChannelException) should not be thrown in the first place it seems. It is still not perfect. See the ArrayStoreException bug that I posted earlier and rereading the saved workspace is unfortunately still broken. But it is already much better then two days ago! Cheers, Mark
Index: libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java,v retrieving revision 1.3 diff -u -r1.3 ReaderInputStream.java --- libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java 6 Dec 2004 09:02:52 -0000 1.3 +++ libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java 7 Dec 2004 20:34:57 -0000 @@ -1,6 +1,6 @@ /* * ReaderInputStream.java - * Copyright (C) 1999,2000,2001 The Free Software Foundation + * Copyright (C) 1999, 2000, 2001, 2004 The Free Software Foundation * * This file is part of GNU JAXP, a library. * @@ -54,10 +54,17 @@ private Reader reader; private String encoding; + // Holds extra spillover data if necessary + private byte extra[]; + private int pos; + + private byte extra_marked[]; + private int pos_marked; + public ReaderInputStream(Reader reader) { this.reader = reader; - encoding = "UTF-8"; + this.encoding = "UTF-8"; } void setEncoding(String encoding) @@ -68,6 +75,14 @@ public int read() throws IOException { + if (extra != null) + { + int result = extra[pos]; + pos++; + if (pos >= extra.length) + extra = null; + return result; + } return reader.read(); } @@ -81,13 +96,40 @@ throws IOException { int l = len - off; + if (l == 0) + return 0; + + if (extra != null) + { + int available = extra.length - pos; + l = available < len ? available : len; + System.arraycopy(extra, 0, b, off, l); + pos += l; + if (pos >= extra.length) + extra = null; + return l; + } + char[] c = new char[l]; l = reader.read(c, 0, l); + if (l == -1) + return -1; + String s = new String(c, 0, l); byte[] d = s.getBytes(encoding); - // FIXME d.length may be > len - System.arraycopy(d, 0, b, off, d.length); - return d.length; + + int available = d.length; + int more = d.length - len; + if (more > 0) + { + extra = new byte[more]; + pos = 0; + System.arraycopy(d, len, extra, 0, more); + available -= more; + } + + System.arraycopy(d, 0, b, off, available); + return available; } public void close() @@ -103,29 +145,74 @@ public void mark(int limit) { + if (extra != null) + { + extra_marked = new byte[extra.length]; + System.arraycopy(extra, 0, extra_marked, 0, extra.length); + pos_marked = pos; + } + else + extra_marked = null; + try { - reader.mark(limit); + // Note that this might be a bit more than asked for. + // Because we might also have the extra_marked bytes. + // That is fine (and necessary for reset() to work). + reader.mark(limit); } - catch (IOException e) + catch (IOException ioe) { - throw new RuntimeException(e.getMessage()); + throw new RuntimeException(ioe); } } public void reset() throws IOException { + extra = extra_marked; + pos = pos_marked; + extra_marked = null; + reader.reset(); } public long skip(long n) throws IOException { - return reader.skip(n); + long done = 0; + if (extra != null) + { + int available = extra.length - pos; + done = available < n ? available : n; + pos += done; + if (pos >= extra.length) + extra = null; + } + + n -= done; + if (n > 0) + return reader.skip(n) + done; + else + return done; + } + + /** + * Returns conservative number of bytes available without blocking. + * Actual number of bytes that can be read without blocking might + * be (much) bigger. + */ + public int available() throws IOException + { + if (extra != null) + return pos - extra.length; + + return reader.ready() ? 1 : 0; } - // TODO available - + public String toString() + { + return "ReaderInputStream[" + reader + ", " + encoding + "]"; + } }
Index: libraries/javalib/java/io/FileDescriptor.java =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/io/FileDescriptor.java,v retrieving revision 1.9 diff -u -r1.9 FileDescriptor.java --- libraries/javalib/java/io/FileDescriptor.java 4 Oct 2004 14:46:23 -0000 1.9 +++ libraries/javalib/java/io/FileDescriptor.java 7 Dec 2004 20:34:27 -0000 @@ -120,7 +120,7 @@ if (ex instanceof SyncFailedException) throw (SyncFailedException) ex; else - throw new SyncFailedException(ex.getMessage()); + throw new SyncFailedException(ex.toString()); } } }
signature.asc
Description: This is a digitally signed message part
_______________________________________________ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe