Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » ant and OperationCanceledException
ant and OperationCanceledException [message #330880] Thu, 14 August 2008 23:18 Go to next message
Henrich Kraemer is currently offline Henrich KraemerFriend
Messages: 59
Registered: July 2009
Member
Our code contributes an ant tasks which runs in the same VM as eclipse.

A layer of the code implements operations without knowing that they will
run in the context of ant.
However these operations output information to the console (stdout and
stderr) .

When an ant tasks get terminated by pressing the red terminate button in
eclipse's Console window any subsequent output throws
OperationCanceledException which is a RuntimeException (see stack trace
below).

This was a bit unexpected. It would be easier to ensure that operations
will leave consistent artifacts behind if they could not encounter an
OperationCanceledException when they output information. Instead the
code assumes that it will check IProgressMonitor.isCanceled() and react
when opportune. When the operations are run with the ant context the
progress monitor is the one provided by the ant integration via
getProject().getReference(AntCorePlugin.ECLIPSE_PROGRESS_MON ITOR.

However ignoring the exception seems problematic as the
DemuxOutputStream is left in a bad state. At
org.apache.tools.ant.DemuxOutputStream.processBuffer(java.io .ByteArrayOutputStream)
line: 172
the buffer gets not reset and therefore the same output will be made
again on a subsequent output. There may be other unwanted side effects.

The ignoring is done up on the stack via 'catch
(OperationCanceledException e) {}'

Is there a way to have ant not throw OperationCanceledException
exceptions on output and instead call the monitor.isCanceled?

org.eclipse.ant.internal.core.ant.ProgressBuildListener.chec kCanceled()
line: 302
org.eclipse.ant.internal.core.ant.ProgressBuildListener.mess ageLogged(org.apache.tools.ant.BuildEvent)
line: 289
org.apache.tools.ant.Project.fireMessageLoggedEvent(org.apac he.tools.ant.BuildEvent,
java.lang.String, int) line: 2171
org.apache.tools.ant.Project.fireMessageLogged(org.apache.to ols.ant.Task,
java.lang.String, java.lang.Throwable, int) line: 2271
org.apache.tools.ant.Project.log(org.apache.tools.ant.Task,
java.lang.String, int) line: 449
com.ibm.cic.ant.jar.Export(org.apache.tools.ant.Task).log(ja va.lang.String,
int) line: 294
com.ibm.cic.ant.jar.Export(com.ibm.cic.ant.jar.BaseTask).log (java.lang.String,
int) line: 867
com.ibm.cic.ant.jar.Export(org.apache.tools.ant.Task).handle Output(java.lang.String)
line: 224
org.apache.tools.ant.UnknownElement.handleOutput(java.lang.S tring) line:
208
org.apache.tools.ant.Project.demuxOutput(java.lang.String, boolean)
line: 1202
org.apache.tools.ant.DemuxOutputStream.processBuffer(java.io .ByteArrayOutputStream)
line: 172
org.apache.tools.ant.DemuxOutputStream.write(int) line: 147
org.apache.tools.ant.DemuxOutputStream.write(byte[], int, int) line: 241
java.io.PrintStream.write(byte[], int, int) line: 441
sun.nio.cs.StreamEncoder$ConverterSE.implFlushBuffer() line: 283
sun.nio.cs.StreamEncoder$ConverterSE.implFlush() line: 289
sun.nio.cs.StreamEncoder$ConverterSE(sun.nio.cs.StreamEncode r).flush()
line: 200
java.io.OutputStreamWriter.flush() line: 236
com.ibm.cic.common.logging.ConsoleLog$SysLog(com.ibm.cic.com mon.logging.StreamLog).flush()
line: 96
com.ibm.cic.common.logging.ConsoleLog$SysLog(com.ibm.cic.com mon.logging.StreamLog).logEntry(com.ibm.cic.common.logging.L ogEntry)
line: 74
com.ibm.cic.common.logging.ConsoleLog.logEntry(com.ibm.cic.c ommon.logging.LogEntry)
line: 139
com.ibm.cic.common.logging.LogManager.logAll(com.ibm.cic.com mon.logging.LogEntry)
line: 230
com.ibm.cic.common.logging.Logger.log(int, java.lang.String,
java.lang.Object[]) line: 236
com.ibm.cic.author.core.internal.operations.BaseOperation$Ex ecuteBeginEnd.end(org.eclipse.core.runtime.IProgressMonitor)
line: 123
com.ibm.cic.author.core.internal.operations.DeployablesExpor tOperation.execute(org.eclipse.core.runtime.IProgressMonitor ,
boolean) line: 324
com.ibm.cic.author.core.internal.operations.DeployablesExpor tOperation.execute(org.eclipse.core.runtime.IProgressMonitor )
line: 269
com.ibm.cic.ant.jar.Export.export() line: 301
com.ibm.cic.ant.jar.Export.doExecute() line: 210
com.ibm.cic.ant.jar.Export(com.ibm.cic.ant.jar.BaseTask).exe cute() line:
144
org.apache.tools.ant.UnknownElement.execute() line: 288
sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.refle ct.Method,
java.lang.Object, java.lang.Object[]) line: not available [native
method]
sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object ,
java.lang.Object[]) line: 64
sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Ob ject,
java.lang.Object[]) line: 43
java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...)
line: 615
org.apache.tools.ant.dispatch.DispatchUtils.execute(java.lan g.Object)
line: 105
org.apache.tools.ant.UnknownElement(org.apache.tools.ant.Tas k).perform()
line: 348
org.apache.tools.ant.Target.execute() line: 357
org.apache.tools.ant.Target.performTasks() line: 385
org.apache.tools.ant.Project.executeSortedTargets(java.util. Vector)
line: 1329
org.apache.tools.ant.Project.executeTarget(java.lang.String) line: 1298
org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor(org .apache.tools.ant.helper.DefaultExecutor).executeTargets(org .apache.tools.ant.Project,
java.lang.String[]) line: 41
org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(org.apache.tools.ant.Project,
java.lang.String[]) line: 32
org.apache.tools.ant.Project.executeTargets(java.util.Vector ) line: 1181
org.eclipse.ant.internal.core.ant.InternalAntRunner.run(java .util.List)
line: 623
org.eclipse.ant.internal.core.ant.InternalAntRunner.run() line: 456
sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.refle ct.Method,
java.lang.Object, java.lang.Object[]) line: not available [native
method]
sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object ,
java.lang.Object[]) line: 64
sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Ob ject,
java.lang.Object[]) line: 43
java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...)
line: 615
org.eclipse.ant.core.AntRunner.run(org.eclipse.core.runtime. IProgressMonitor)
line: 377
org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDe legate$1.run()
line: 230
Re: ant and OperationCanceledException [message #330903 is a reply to message #330880] Fri, 15 August 2008 17:45 Go to previous message
Darin Swanson is currently offline Darin SwansonFriend
Messages: 2386
Registered: July 2009
Senior Member
Henrich,

I would propose that you log a bug report with your examination and proposed
changes.

Thanks
Darins
http://runnerwhocodes.blogspot.com

"Henrich Kraemer" <henrich.kraemer@us.ibm.com> wrote in message
news:g82eg2$krp$1@build.eclipse.org...
> Our code contributes an ant tasks which runs in the same VM as eclipse.
>
> A layer of the code implements operations without knowing that they will
> run in the context of ant.
> However these operations output information to the console (stdout and
> stderr) .
>
> When an ant tasks get terminated by pressing the red terminate button in
> eclipse's Console window any subsequent output throws
> OperationCanceledException which is a RuntimeException (see stack trace
> below).
>
> This was a bit unexpected. It would be easier to ensure that operations
> will leave consistent artifacts behind if they could not encounter an
> OperationCanceledException when they output information. Instead the code
> assumes that it will check IProgressMonitor.isCanceled() and react when
> opportune. When the operations are run with the ant context the progress
> monitor is the one provided by the ant integration via
> getProject().getReference(AntCorePlugin.ECLIPSE_PROGRESS_MON ITOR.
>
> However ignoring the exception seems problematic as the DemuxOutputStream
> is left in a bad state. At
> org.apache.tools.ant.DemuxOutputStream.processBuffer(java.io .ByteArrayOutputStream)
> line: 172 the buffer gets not reset and therefore the same output will
> be made again on a subsequent output. There may be other unwanted side
> effects.
>
> The ignoring is done up on the stack via 'catch
> (OperationCanceledException e) {}'
>
> Is there a way to have ant not throw OperationCanceledException exceptions
> on output and instead call the monitor.isCanceled?
>
> org.eclipse.ant.internal.core.ant.ProgressBuildListener.chec kCanceled()
> line: 302
> org.eclipse.ant.internal.core.ant.ProgressBuildListener.mess ageLogged(org.apache.tools.ant.BuildEvent)
> line: 289
> org.apache.tools.ant.Project.fireMessageLoggedEvent(org.apac he.tools.ant.BuildEvent,
> java.lang.String, int) line: 2171
> org.apache.tools.ant.Project.fireMessageLogged(org.apache.to ols.ant.Task,
> java.lang.String, java.lang.Throwable, int) line: 2271
> org.apache.tools.ant.Project.log(org.apache.tools.ant.Task,
> java.lang.String, int) line: 449
> com.ibm.cic.ant.jar.Export(org.apache.tools.ant.Task).log(ja va.lang.String,
> int) line: 294
> com.ibm.cic.ant.jar.Export(com.ibm.cic.ant.jar.BaseTask).log (java.lang.String,
> int) line: 867
> com.ibm.cic.ant.jar.Export(org.apache.tools.ant.Task).handle Output(java.lang.String)
> line: 224
> org.apache.tools.ant.UnknownElement.handleOutput(java.lang.S tring) line:
> 208 org.apache.tools.ant.Project.demuxOutput(java.lang.String, boolean)
> line: 1202
> org.apache.tools.ant.DemuxOutputStream.processBuffer(java.io .ByteArrayOutputStream)
> line: 172 org.apache.tools.ant.DemuxOutputStream.write(int) line: 147
> org.apache.tools.ant.DemuxOutputStream.write(byte[], int, int) line: 241
> java.io.PrintStream.write(byte[], int, int) line: 441
> sun.nio.cs.StreamEncoder$ConverterSE.implFlushBuffer() line: 283
> sun.nio.cs.StreamEncoder$ConverterSE.implFlush() line: 289
> sun.nio.cs.StreamEncoder$ConverterSE(sun.nio.cs.StreamEncode r).flush()
> line: 200 java.io.OutputStreamWriter.flush() line: 236
> com.ibm.cic.common.logging.ConsoleLog$SysLog(com.ibm.cic.com mon.logging.StreamLog).flush()
> line: 96
> com.ibm.cic.common.logging.ConsoleLog$SysLog(com.ibm.cic.com mon.logging.StreamLog).logEntry(com.ibm.cic.common.logging.L ogEntry)
> line: 74
> com.ibm.cic.common.logging.ConsoleLog.logEntry(com.ibm.cic.c ommon.logging.LogEntry)
> line: 139
> com.ibm.cic.common.logging.LogManager.logAll(com.ibm.cic.com mon.logging.LogEntry)
> line: 230 com.ibm.cic.common.logging.Logger.log(int, java.lang.String,
> java.lang.Object[]) line: 236
> com.ibm.cic.author.core.internal.operations.BaseOperation$Ex ecuteBeginEnd.end(org.eclipse.core.runtime.IProgressMonitor)
> line: 123
> com.ibm.cic.author.core.internal.operations.DeployablesExpor tOperation.execute(org.eclipse.core.runtime.IProgressMonitor ,
> boolean) line: 324
> com.ibm.cic.author.core.internal.operations.DeployablesExpor tOperation.execute(org.eclipse.core.runtime.IProgressMonitor )
> line: 269 com.ibm.cic.ant.jar.Export.export() line: 301
> com.ibm.cic.ant.jar.Export.doExecute() line: 210
> com.ibm.cic.ant.jar.Export(com.ibm.cic.ant.jar.BaseTask).exe cute() line:
> 144 org.apache.tools.ant.UnknownElement.execute() line: 288
> sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.refle ct.Method,
> java.lang.Object, java.lang.Object[]) line: not available [native method]
> sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object ,
> java.lang.Object[]) line: 64
> sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Ob ject,
> java.lang.Object[]) line: 43
> java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...)
> line: 615
> org.apache.tools.ant.dispatch.DispatchUtils.execute(java.lan g.Object)
> line: 105
> org.apache.tools.ant.UnknownElement(org.apache.tools.ant.Tas k).perform()
> line: 348 org.apache.tools.ant.Target.execute() line: 357
> org.apache.tools.ant.Target.performTasks() line: 385
> org.apache.tools.ant.Project.executeSortedTargets(java.util. Vector) line:
> 1329 org.apache.tools.ant.Project.executeTarget(java.lang.String) line:
> 1298
> org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor(org .apache.tools.ant.helper.DefaultExecutor).executeTargets(org .apache.tools.ant.Project,
> java.lang.String[]) line: 41
> org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(org.apache.tools.ant.Project,
> java.lang.String[]) line: 32
> org.apache.tools.ant.Project.executeTargets(java.util.Vector ) line: 1181
> org.eclipse.ant.internal.core.ant.InternalAntRunner.run(java .util.List)
> line: 623 org.eclipse.ant.internal.core.ant.InternalAntRunner.run()
> line: 456
> sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.refle ct.Method,
> java.lang.Object, java.lang.Object[]) line: not available [native method]
> sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object ,
> java.lang.Object[]) line: 64
> sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Ob ject,
> java.lang.Object[]) line: 43
> java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...)
> line: 615
> org.eclipse.ant.core.AntRunner.run(org.eclipse.core.runtime. IProgressMonitor)
> line: 377
> org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDe legate$1.run()
> line: 230
Previous Topic:How to persist large objects?
Next Topic:Why Eclipse 3.4 does NOT diplay the packages avaible?
Goto Forum:
  


Current Time: Sun Oct 06 12:21:11 GMT 2024

Powered by FUDForum. Page generated in 0.03071 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top