W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > January 2008

RE: Exceptions thrown by the mobileok checker

From: Jo Rabin <jrabin@mtld.mobi>
Date: Wed, 30 Jan 2008 14:24:30 -0000
Message-ID: <C8FFD98530207F40BD8D2CAD608B50B4AD81B3@mtldsvr01.DotMobi.local>
To: <fd@w3.org>, <public-mobileok-checker@w3.org>

Presumably the same exceptions get thrown if a page under test has an
invalid reference to some external resource? In which case I suggest
that we catch these exceptions before beta starts on the basis that the
result should be FAIL.

Jo



> -----Original Message-----
> From: public-mobileok-checker-request@w3.org [mailto:public-mobileok-
> checker-request@w3.org] On Behalf Of Francois Daoust
> Sent: 30 January 2008 14:13
> To: public-mobileok-checker@w3.org
> Subject: Exceptions thrown by the mobileok checker
> 
> 
> Hi,
> 
> While re-writing the mobileOK checker validation page, I encountered a
> few cases when the checker throws some exceptions, not because it
> crashed, but because the URI entered is either inaccessible or not
> valid. See examples below.
> 
> The exceptions being thrown are developer-readable, but throwing such
> exceptions when it's not the checker's fault makes it harder to wrap
> something around it. If you take a look at:
> http://validator.w3.org/mobile/alpha?docAddr=test
> ... one would immediately think the checker crashed, and try again,
and
> again, and then yell by email.
> [note the exception returned is slightly different from the example
> below because the version of the JAR is older]
> 
> I'll handle the exceptions I can think of in the validator page to
> return a more user-friendly message that really states that the
problem
> lies with the URI, but I tend to think the checker should be a black
box
> that only throws exceptions when it crashes because of a bug, not
> because the URI is incorrect, and thus that the catching should rather
> be done within the checker.
> 
> Or that we should at least provide the list of the exceptions that may
> be thrown by the checker [does it already exist?]
> 
> I don't think that needs to be done for the beta though...
> If there's no objection, I could also action myself and do that,
> although I'm not sure I'll be able to work on it very soon.
> 
> What do you think?
> 
> Francois.
> 
> 
> 
> Examples:
> 
> 1. network error because the resource cannot be accessed:
> java -jar mobileOK-Basic-RI-1.0-deploy.jar thisdomaindoesntexist.com
> Exception in thread "main" org.w3c.mwi.mobileok.basic.TestException: A
> network error has happened while retrieving the requested Web page.
> MobileOK Basic Test can not be launched.
>         at
>
org.w3c.mwi.mobileok.basic.Preprocessor.preprocess(Preprocessor.java:37)
>         at
>
org.w3c.mwi.mobileok.basic.Tester.getPreprocessorResults(Tester.java:91)
>         at org.w3c.mwi.mobileok.basic.Tester.main(Tester.java:201)
> 
> 
> 2. URI syntax error because the URI is invalid:
> java -jar mobileOK-Basic-RI-1.0-deploy.jar http://
> Exception in thread "main" java.net.URISyntaxException: Expected
authority
> at index 7: http://
>         at java.net.URI$Parser.fail(URI.java:2809)
>         at java.net.URI$Parser.failExpecting(URI.java:2815)
>         at java.net.URI$Parser.parseHierarchical(URI.java:3063)
>         at java.net.URI$Parser.parse(URI.java:3014)
>         at java.net.URI.<init>(URI.java:578)
>         at org.w3c.mwi.mobileok.basic.Tester.main(Tester.java:136)
> 
> 
> 3. Protocol error when the URI is valid but the protocol unknown:
> java -jar mobileOK-Basic-RI-1.0-deploy.jar invalid://something
> Exception in thread "main" java.lang.IllegalStateException:
unsupported
> protocol: 'invalid'
>         at
>
org.apache.commons.httpclient.protocol.Protocol.lazyRegisterProtocol(Pro
to
> col.java:149)
>         at
>
org.apache.commons.httpclient.protocol.Protocol.getProtocol(Protocol.jav
a:
> 117)
>         at
> org.apache.commons.httpclient.HttpHost.<init>(HttpHost.java:107)
>         at
>
org.apache.commons.httpclient.HttpMethodBase.setURI(HttpMethodBase.java:
28
> 0)
>         at
>
org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:
22
> 0)
>         at
>
org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89
)
>         at
> org.w3c.mwi.mobileok.basic.HTTPResource.<init>(HTTPResource.java:107)
>         at
> org.w3c.mwi.mobileok.basic.HTTPResource.<init>(HTTPResource.java:80)
>         at
>
org.w3c.mwi.mobileok.basic.HTTPTextResource.<init>(HTTPTextResource.java
:3
> 7)
>         at
>
org.w3c.mwi.mobileok.basic.HTTPXHTMLResource.<init>(HTTPXHTMLResource.ja
va
> :93)
>         at
>
org.w3c.mwi.mobileok.basic.Preprocessor.preprocess(Preprocessor.java:31)
>         at
>
org.w3c.mwi.mobileok.basic.Tester.getPreprocessorResults(Tester.java:91)
>         at org.w3c.mwi.mobileok.basic.Tester.main(Tester.java:201)
> 
> 
Received on Wednesday, 30 January 2008 14:24:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2008 14:24:46 GMT