Re: eclipse regression

2006-03-04 Thread Mark Wielaard
Hi,

On Fri, 2006-03-03 at 11:29 +0100, Mark Wielaard wrote:
 I haven't figured out since when this stopped working, but it clearly is
 a regression. If you installed the feature with a working version of
 classpath (0.20) and then try to use it with a CVS version you will get
 messages like:
 !ENTRY org.eclipse.update.configurator 2006-03-03 11:19:10.787
 !MESSAGE Unable to parse file
 /tmp/eclipse/plugins/org.eclipse.cdt.core_3.0.2/plugin.xml.
 
 So I guess it is something going wrong with the parsing of xml files.
 But I haven't found the point yet where eclipse does this, or what the
 actual error is that occurs.

Christian and I debugged this some more and finally found out that the
following patch introduced the regression: SAX micropatch
http://lists.gnu.org/archive/html/classpath-patches/2006-01/msg00277.html

The patch seems completely reasonable. If we get any Exception so we
fall out of the parse loop then we report a fatal error, cleanup and
reset. Seems obvious since we will indeed not be able to continue with
regular processing of the file. But we didn't count on Eclipse...

Strangely enough the eclipse PluginParser is a DefaultHandler, that
doesn't override fatalError(), and if it has enough data it will throw a
subclass of SAXException from its own startElement() handler called
ParseCompleteException. It tries to catch this exception from
SAXParser.parse() and then continue happily.  You can find that code at:
http://dev.eclipse.org/viewcvs/index.cgi/*checkout*/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/PluginParser.java?rev=HEADcontent-type=text/plain

But of course since it threw this exception we, imho correctly, generate
a SAXParseException and call fatalError() on the handler which will then
throw this since the PluginParser didn't override it.

I cannot really see a good way to make eclipse happy. It clearly expects
that if it throws this SAXException from startElement() that it will get
this exception back as if nothing happened. But since it has just
destroyed our parser so we should indeed report a SAXParserException to
it (through the errorHandler).

Does anyone have a clever idea how to solve this?

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part


Re: eclipse regression

2006-03-04 Thread Mark Wielaard
On Sat, 2006-03-04 at 16:26 +0100, Mark Wielaard wrote:
 I cannot really see a good way to make eclipse happy. It clearly expects
 that if it throws this SAXException from startElement() that it will get
 this exception back as if nothing happened. But since it has just
 destroyed our parser so we should indeed report a SAXParserException to
 it (through the errorHandler).

Thought a bit more about it and the following seems appropriate:

2006-03-04  Mark Wielaard  [EMAIL PROTECTED]

* gnu/xml/stream/SAXParser.java (parse(InputSource)): Ignore
exceptions thrown by handlers while cleaning up and rethrow original
exception.

I checked with Christian that it solves the problem. So I am going to
commit this later and create the release branch, unless someone
complains loudly soon. (We can always fix it in a more appropriate way
if this is really too ugly for the next release.)

Cheers,

Mark
Index: gnu/xml/stream/SAXParser.java
===
RCS file: /cvsroot/classpath/classpath/gnu/xml/stream/SAXParser.java,v
retrieving revision 1.19
diff -u -r1.19 SAXParser.java
--- gnu/xml/stream/SAXParser.java	3 Mar 2006 12:30:59 -	1.19
+++ gnu/xml/stream/SAXParser.java	4 Mar 2006 17:54:38 -
@@ -657,17 +657,26 @@
   }
 catch (Exception e)
   {
-if (!startDocumentDone  contentHandler != null)
-  contentHandler.startDocument();
 SAXParseException e2 = new SAXParseException(e.getMessage(), this);
 e2.initCause(e);
-if (errorHandler != null)
-  errorHandler.fatalError(e2);
-if (contentHandler != null)
-  contentHandler.endDocument();
+try
+  {
+if (!startDocumentDone  contentHandler != null)
+  contentHandler.startDocument();
+if (errorHandler != null)
+  errorHandler.fatalError(e2);
+if (contentHandler != null)
+  contentHandler.endDocument();
+  }
+catch (SAXException sex)
+  {
+// Ignored, we will rethrow the original exception.
+  }
 reset();
 if (opened)
   in.close();
+if (e instanceof SAXException)
+  throw (SAXException) e;
 if (e instanceof IOException)
   throw (IOException) e;
 else


signature.asc
Description: This is a digitally signed message part


Re: eclipse regression

2006-03-03 Thread Mark Wielaard
Hi Christian,

On Fri, 2006-03-03 at 01:49 +0100, Christian Thalinger wrote:
 I'm unable to install some (any?) plugins in eclipse with CVS head.  I
 already talked to tashiro on irc and it works with 0.20 release.  The
 problem is in two places:
 
 * Software Updates - Find and install says: Current configuration
 problems
 
 * Software Updates - Manage Configuration does not allow to open
 Eclipse SDK, it only shows this entry.
 
 I hope i made myself clear (it's rather late).

Yep. I am seeing the same thing. I was trying out
http://developer.classpath.org/mediation/ClasspathHackingWithEclipse
from scratch and trying to install the CDT plugin and it fails as you
describe above. 

I haven't figured out since when this stopped working, but it clearly is
a regression. If you installed the feature with a working version of
classpath (0.20) and then try to use it with a CVS version you will get
messages like:
!ENTRY org.eclipse.update.configurator 2006-03-03 11:19:10.787
!MESSAGE Unable to parse file
/tmp/eclipse/plugins/org.eclipse.cdt.core_3.0.2/plugin.xml.

So I guess it is something going wrong with the parsing of xml files.
But I haven't found the point yet where eclipse does this, or what the
actual error is that occurs.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part