[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

Ciao John :)
I still don't see the reason for throwing an undeclared exception but
this is starting to look like a general eclipse problem, 
not a p2/ecf bug we are running into now. The assumption that's being
made by the person throwing the exception is that everybody watches and
catches OperationCanceledExceptions, an assumption that can't currently
be supported by JDT features...

My suggestion would be to avoid throwing an undeclared exception, or ,
as a convenience, add support to JDT allowing us to see such potential
application killers before they ship to the customer. If what you say is
true and any method taking in a monitor needs to be checked for
OperationCanceled then this could be implemented fairly easily, though
the nice way would be to use IStatus or notify the UI some other way,
via an event bus or whatever... :)
HTH,
Ciao, hh 

-----Original Message-----
From: p2-dev-bounces@xxxxxxxxxxx [mailto:p2-dev-bounces@xxxxxxxxxxx] On
Behalf Of John Arthorne
Sent: Monday, April 20, 2009 5:50 PM
To: P2 developer discussions
Subject: 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