abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Pecoraro (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ABDERA-142) ClassCastException when trying to get a Service Document
Date Sun, 06 Apr 2008 04:09:24 GMT

    [ https://issues.apache.org/jira/browse/ABDERA-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586094#action_12586094
] 

Joseph Pecoraro commented on ABDERA-142:
----------------------------------------

That makes sense, Thanks!

> ClassCastException when trying to get a Service Document
> --------------------------------------------------------
>
>                 Key: ABDERA-142
>                 URL: https://issues.apache.org/jira/browse/ABDERA-142
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.2.2
>         Environment: Windows XP Java 1.4.2 and Java 5.
> Abdera 0.2 and 0.2.2.
>            Reporter: Joseph Pecoraro
>             Fix For: 0.2.2
>
>
> I get a ClassCastException when trying to pull a Service Document.  The CommonsClient
correctly pulls the Service Document for the server and the Service Document is valid.  I
will point out right now that this works just fine in Abdera 0.3.
> Example Error:
> java.lang.ClassCastException: org.apache.abdera.parser.stax.FOMExtensibleElement incompatible
with org.apache.abdera.model.Service
> Example Main to get the above error: [meant to be dirty but short]
> public static void main(String[] args) {
> 		ClientResponse _response = null;
> 		try {
> 			Abdera _abdera = new Abdera();
> 			CommonsClient _client = new CommonsClient(_abdera);
> 			_client.usePreemptiveAuthentication(true);
> 			_client.addCredentials("https://dogear.tap.ibm.com", null, null, new UsernamePasswordCredentials("username",
"password"));
> 			CommonsClient.registerTrustManager();
> 			_response = _client.get("https://dogear.tap.ibm.com/api/app");
> 			if(_response != null && _response.getStatus() == 200) {
>         	 	InputStream in = _response.getInputStream();
>         	 	if( in != null ) {
>         	 		Document<Service> doc = _abdera.getParser().parse(in);
>         	 		Service aService = (Service)doc.getRoot();
>         	 	}
>             }  
>         }
> 	  catch(Exception e) { e.printStackTrace(); } 
>         finally { _response.release(); }
> }
> More Information:
> If I take the same code and instead grab a Feed instead of a Service Document using a
Feed URL (such as https://dogear.tap.ibm.com/api/app?email=jjpecora%40us.ibm.com) and change
all occurrences of "Service" to "Feed" it runs without any issues and the Feed is loaded properly
 The same can be done with an Entry just like a Feed.
> If I take the same code and instead use Abdera 0.3 (and replace all instances of "CommonsClient"
with "AbderaClient") it runs without any issues.
> I have tried multiple Service Documents and the error persists.  I manually read and
scanned the InputStream for abnormalities that I thought might have affected the Parser and
it looks like a perfectly valid Atom Service Document.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message