From: SourceForge.net <no...@so...> - 2008-08-25 15:40:54
|
Bugs item #2065184, was opened at 2008-08-21 18:28 Message generated for change (Comment added) made by eraonel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=460297&aid=2065184&group_id=50595 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: eclipse-ccase Group: 2.x Status: Open Resolution: None Priority: 5 Private: No Submitted By: bjoy (bjoy1) Assigned to: Mikael Petterson (eraonel) Summary: closes System.err during plugin startup Initial Comment: This plugin is closing the PrintStream assigned to System.err during startup preventing any further error output from being seen. Using 2.1.2 build on Eclipse 3.3. Happens immediately after doing ClearCase | Activate Plugin in a new workspace. (Also happens at startup if no ClearCase client installed.) Here is a partial stack trace from a breakpoint set in the PrintStream.close() method: PrintStream.close() line: 304 [local variables unavailable] StreamEncoder$CharsetSE.implClose() line: 431 StreamEncoder$CharsetSE(StreamEncoder).close() line: 160 OutputStreamWriter.close() line: 222 ClearCase$1SystemOutConsoleHandler(StreamHandler).flushAndClose() line:244 ClearCase$1SystemOutConsoleHandler(StreamHandler).setOutputStream(OutputStream) line: 111 ClearCase$1SystemOutConsoleHandler.<init>() line: 552 ClearCase.configureLoggerForDebugging() line: 576 ClearCase.createInterface(int) line: 671 ClearcasePlugin.getClearcase() line: 640 ClearcasePlugin.start(BundleContext) line: 890 ---------------------------------------------------------------------- >Comment By: Mikael Petterson (eraonel) Date: 2008-08-25 17:40 Message: Logged In: YES user_id=102780 Originator: NO Hi, Do you have a minute to try out the patch? cheers, //mikael ---------------------------------------------------------------------- Comment By: bjoy (bjoy1) Date: 2008-08-25 15:39 Message: Logged In: YES user_id=1537033 Originator: YES I looked at this a little closer and it appears that the problem is in your ConsoleHandler subclass. Looking at the constructor for ConsoleHandler, you can see that it starts out by setting the output stream to System.err. When your subclass changes that to System.out by calling setOutputStream(System.out), ConsoleHandler closes the output stream it was using previously. My guess at a solution would be to change your subclass to override setOutputStream() (and remove your own call to setOutputStream()) so that there is no previous OutputStreamWriter instance to close: @Override protected synchronized void setOutputStream(OutputStream out) throws SecurityException { super.setOutputStream(System.out); } ---------------------------------------------------------------------- Comment By: Mikael Petterson (eraonel) Date: 2008-08-25 10:12 Message: Logged In: YES user_id=102780 Originator: NO Hi, I am trying to sort this out. I checked the plugin code that shows in the trace. In the ClearCase class we have an inner class called SystemOutConsoleHandler that extends the ConsoleHandler ( part of java 5). This is how it looks ( see below). The setOutputStream is called on the ConsoleHandler class. Since I have no source for the rt.jar I cannot set a breakpoint. Still I I don't see how I explicitly or implicitly the plugin is closing the PrintStream assinged to System.err. Please educate me in the matter so I have a chance to correct it. cheers, //mike /** * This enables logging to the console. */ static void configureLoggerForDebugging() { /** * A handler that logs detail messages (infos and higher) to * <code>System.out</code>. */ class SystemOutConsoleHandler extends ConsoleHandler { /** * * Creates a new instance. */ SystemOutConsoleHandler() { super(); setOutputStream(System.out); setLevel(Level.ALL); setFilter(new Filter() { public boolean isLoggable(final LogRecord record) { // only log infos and fine messages return record.getLevel().intValue() <= Level.INFO .intValue(); } }); } } // configure logging during development Logger logger = Logger .getLogger(ClearCase.class.getPackage().getName()); logger.setLevel(Level.ALL); // warnings and higher to System.err ConsoleHandler handler = new ConsoleHandler(); handler.setLevel(Level.WARNING); logger.addHandler(handler); // infors and lower to System.out logger.addHandler(new SystemOutConsoleHandler()); } ---------------------------------------------------------------------- Comment By: bjoy (bjoy1) Date: 2008-08-25 04:54 Message: Logged In: YES user_id=1537033 Originator: YES I am using JDK 5. How are you testing for the problem? The symptoms are that after the ClearCase plugin closes System.err, error output like stack traces produced by other plugins no longer appear in the console. It is legal but highly unfriendly that System.err is being closed. The PrintStream instance itself being closed has no idea it is being used for console error output. Trapping the origin of the problem was done by setting a breakpoint in PrintStream.close() which determined what plugin was doing the close. This is not something that is going to appear in the Error Log. ---------------------------------------------------------------------- Comment By: Mikael Petterson (eraonel) Date: 2008-08-24 21:43 Message: Logged In: YES user_id=102780 Originator: NO Hi, What version of the jdk are you using to run Eclipse with? I installed the new version 2.1.2 using the update service on a windows machine with no clearcase client installed. I activated the plugin and got no error. I am using Eclipse 3.3 How did you install? Do you mind attaching the whole eclipse logfile to this bug report? I would appreciate that very much. cheers, //mike ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=460297&aid=2065184&group_id=50595 |