[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [p2-dev] undeclared exception being thrown in 3.4.1


It is. monitor.setCanceled(true) sets a flag indicating that cancelation was requested. Any method that takes a progress monitor argument will check for cancelation using isCanceled(). If isCanceled returns true, it needs to stop what it's doing, and propagate the cancelation back up the stack to the UI. This is typically done by throwing OperationCanceledException. It can also be accomplished by returning a CANCEL status if the method happens to have an IStatus return type, although this is error prone because clients often forget to handle a cancel status return value.




"Haigermoser, Helmut" <Helmut.Haigermoser@xxxxxxxxxxxxx>
Sent by: p2-dev-bounces@xxxxxxxxxxx

04/20/2009 11:40 AM

Please respond to
P2 developer discussions <p2-dev@xxxxxxxxxxx>

To
"P2 developer discussions" <p2-dev@xxxxxxxxxxx>
cc
Subject
RE: [p2-dev] undeclared exception being thrown in 3.4.1





John, why isn't monitor.setCancelled used for that?  

-----Original Message-----
From: p2-dev-bounces@xxxxxxxxxxx [mailto:p2-dev-bounces@xxxxxxxxxxx] On
Behalf Of John Arthorne
Sent: Monday, April 20, 2009 5:38 PM
To: P2 developer discussions
Subject: Re: [p2-dev] undeclared exception being thrown in 3.4.1


As a general rule, you should expect the possibility of
OperationCanceledException from any API method in Eclipse that takes a
progress monitor argument. This is how cancelation is propagated back to
whoever passed in a progress monitor in the first place (typically the
UI).

John




"Haigermoser, Helmut" <Helmut.Haigermoser@xxxxxxxxxxxxx>
Sent by: p2-dev-bounces@xxxxxxxxxxx

04/20/2009 11:13 AM
Please respond to
P2 developer discussions <p2-dev@xxxxxxxxxxx>

To
"P2 developer discussions" <p2-dev@xxxxxxxxxxx> cc Subject [p2-dev]
undeclared exception being thrown in 3.4.1

               




Ciao @ll :)
One of our clients is getting an OperationCanceledException returned by
SimplePlanner.updatesFor, well, it's really coming from
ECFMetadataTransport.getLastModified but the exception does only reach
client code at that point.

Is this an already known thing or would you want me to raise a bug on
it? All I would ask for is declaring the points where this problem with
the internet connection can happen so that we have a chance of catching
it...

!STACK 0
org.eclipse.core.runtime.OperationCanceledException
               at
org.eclipse.equinox.internal.p2.metadata.repository.ECFMetadataTransport
.getLastModified(ECFMetadataTransport.java:143)
               at
org.eclipse.equinox.internal.p2.metadata.repository.CacheManager.createC
ache(CacheManager.java:69)
               at
org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.Simp
leMetadataRepositoryFactory.getLocalFile(SimpleMetadataRepositoryFactory
.java:59)
               at
org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.Simp
leMetadataRepositoryFactory.validateAndLoad(SimpleMetadataRepositoryFact
ory.java:97)
               at
org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.Simp
leMetadataRepositoryFactory.load(SimpleMetadataRepositoryFactory.java:85
)
               at
org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryMa
nager.loadRepository(MetadataRepositoryManager.java:485)
               at
org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryMa
nager.loadRepository(MetadataRepositoryManager.java:452)
               at
org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryMa
nager.loadRepository(MetadataRepositoryManager.java:435)
               at
org.eclipse.equinox.internal.p2.director.SimplePlanner.updatesFor(Simple
Planner.java:384)


TIA,
Ciao, hh
_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev


_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev