Bug 219762 - "Capture Standard Output" option causes problems
Summary: "Capture Standard Output" option causes problems
Status: RESOLVED FIXED
Alias: None
Product: Tigerstripe (Archived)
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: S0.2.2.5   Edit
Assignee: Eric Dillon CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-21 06:16 EST by Richard Craddock CLA
Modified: 2008-04-14 13:36 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Craddock CLA 2008-02-21 06:16:47 EST
If you enable the option "Capture Standard Output/error ..." for a project, the try to generate, the system generates an error - "Cannot create element".

The generation.log is empty, and appears to be kept open by some thread as the file cannot be deleted either manually or by the "clearDirectory" option. 

It is necessary to restart eclipse to be able to delete this file. 



Get the following errors in the log:


java.lang.NullPointerException
	at org.eclipse.tigerstripe.workbench.ui.eclipse.dialogs.GenerateResultDialog.createDialogArea(GenerateResultDialog.java:82)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:752)
	at org.eclipse.jface.window.Window.create(Window.java:426)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1081)
	at org.eclipse.jface.window.Window.open(Window.java:785)
	at org.eclipse.tigerstripe.workbench.eclipse.wizards.generate.NewTigerstripeRunWizard.performFinish(NewTigerstripeRunWizard.java:233)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:616)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.eclipse.tigerstripe.workbench.eclipse.actions.AbstractOpenWizardAction.run(AbstractOpenWizardAction.java:163)
	at org.eclipse.tigerstripe.workbench.eclipse.actions.OpenGenerateInterfaceWizardAction.run(OpenGenerateInterfaceWizardAction.java:76)
	at org.eclipse.tigerstripe.workbench.eclipse.actions.AbstractOpenWizardAction.run(AbstractOpenWizardAction.java:187)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:256)
.....................

AND

Caused by: java.lang.NullPointerException
	at org.eclipse.tigerstripe.workbench.internal.core.generation.ProjectGenerator.internalRun(ProjectGenerator.java:424)
	at org.eclipse.tigerstripe.workbench.internal.core.generation.ProjectGenerator.run(ProjectGenerator.java:235)
	at org.eclipse.tigerstripe.workbench.eclipse.wizards.generate.NewTigerstripeRunWizard.finishPage(NewTigerstripeRunWizard.java:131)
	at org.eclipse.tigerstripe.workbench.eclipse.wizards.NewTSElementWizard$2.run(NewTSElementWizard.java:193)
	at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4466)
	at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Comment 1 Richard Craddock CLA 2008-02-21 06:52:49 EST
I tried a simple fix to address the "symptom" but I don't understand enough to fix the cure:

My fix was in ProjectGenerator.java, to put a couple of checks for null in the finally block of runInternal

if (changedStdOutStdErr) {
				if (stdoutAppender != null)
					stdoutAppender.close();
				if (stderrAppender != null)
					stderrAppender.close();
				System.setErr(stdErrStreamRef);
				System.setOut(stdOutStreamRef);
			}

This stopped the error appearing, but I can't now write to the log as I get the following when I try to deploy:

java.lang.NullPointerException
	at java.io.Writer.<init>(Unknown Source)
	at java.io.OutputStreamWriter.<init>(Unknown Source)
	at java.io.PrintWriter.<init>(Unknown Source)
	at java.io.PrintWriter.<init>(Unknown Source)
	at org.eclipse.tigerstripe.workbench.ui.eclipse.editors.pluginDescriptor.header.PluggablePluginProjectPackager.compileProject(PluggablePluginProjectPackager.java:249)
	at org.eclipse.tigerstripe.workbench.ui.eclipse.editors.pluginDescriptor.header.PluggablePluginProjectPackager.packageUpProject(PluggablePluginProjectPackager.java:60)
	at org.eclipse.tigerstripe.workbench.ui.eclipse.utils.PluginDeploymentHelper.deploy(PluginDeploymentHelper.java:67)
	at org.eclipse.tigerstripe.workbench.ui.eclipse.actions.DeployPluginActionDelegate$1.run(DeployPluginActionDelegate.java:54)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)


And a similar error when I actually run the plugin and try to log a message.


I have not put back this fix as it was not really addressing the issues.
Comment 2 Richard Craddock CLA 2008-02-21 06:53:36 EST
One more hint ...

when I run the application in debug mode I get this in the console :

log4j:WARN No appenders could be found for logger (org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager).
log4j:WARN Please initialize the log4j system properly.
Comment 3 Richard Craddock CLA 2008-04-09 09:43:56 EDT
As discussed this is a problem with  Log4j.

Eric agreed to check if the latest version fixes this, if that is available for inclusion.

If not, then disable this feature until it can be properly fixed.
Comment 4 Eric Dillon CLA 2008-04-14 13:36:32 EDT
Ok. So, I've currently disabled this feature in the workbench:
- the button is permanently disabled in the UI.
- if the settings of the projects had this option as enabled, it will be ignored during the run.

I've opened a totally separate bug for this as an enhancement feature. With reference to this entry.
(Bug 226978)