FOMUnsupportedTextTypeException - Remove type="Text/Html" attribute from Atom feed

380 Views Asked by At

I am having trouble getting entries from parsed Atom Feed. I am getting these feed from web service. Thing is Code work absolutely fine in my local server but when I deploy it on my dev box I am getting FOMUnsupportedTextTypeException Exception. when I check the difference in generated Atom feed i found little change in feed xml. below is my local feed

<atom:entry>
<atom:id>e0f7f5e7-a5f3-4a2e-a87d-d8def2b6bc2c</atom:id>
<atom:title">Locations</atom:title>
<atom:author>
<atom:uri>uid=wpsadmin,o=defaultWIMFileBasedRealm</atom:uri>
<atom:name>wpsadmin</atom:name>
</atom:author>

and here my dev box generated xml.

<atom:entry>
<atom:id>e0f7f5e7-a5f3-4a2e-a87d-d8def2b6bc2c</atom:id>
<atom:title type="text/html">Locations</atom:title>
<atom:author>
<atom:uri>uid=wpsadmin,o=defaultWIMFileBasedRealm</atom:uri>
<atom:name>wpsadmin</atom:name>
</atom:author>

the only difference is type="text/html"in atom:title

I am using abdera parser to parse atom and using IBM Portal 8 in both local and dev.

I am getting error at this code

Document<Feed> doc = response.getDocument();   
Feed feed = (Feed) doc.getRoot();   
for (Entry entry : feed.getEntries()) {  //exception at this line

exception is FOMUnsupportedTextTypeException

Here Is the full exception detail

[3/28/13 8:15:22:630 CDT] 0000041f servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception was thrown by one of the service methods of the servlet [/jsp/html/searchWCM.jsp] in application [APA_SearchWCM]. Exception created : [org.apache.abdera.parser.stax.FOMUnsupportedTextTypeException: Unsupported Text Type: text/html
    at org.apache.abdera.parser.stax.FOMBuilder.getTextType(FOMBuilder.java:66)
    at org.apache.abdera.parser.stax.FOMFactory.createElement(FOMFactory.java:558)
    at org.apache.abdera.parser.stax.FOMBuilder.constructNode(FOMBuilder.java:108)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:430)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:298)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:223)
    at org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:93)
    at org.apache.axiom.om.impl.llom.OMContainerHelper.buildNext(OMContainerHelper.java:164)
    at org.apache.axiom.om.impl.llom.OMNodeHelper.getNextOMSibling(OMNodeHelper.java:40)
    at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:106)
    at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
    at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
    at org.apache.axiom.om.impl.traverse.OMFilterIterator.hasNext(OMFilterIterator.java:54)
    at org.apache.abdera.parser.stax.util.FOMElementIteratorWrapper.hasNext(FOMElementIteratorWrapper.java:37)
    at org.apache.abdera.parser.stax.util.FOMList.buffer(FOMList.java:62)
    at org.apache.abdera.parser.stax.util.FOMList.get(FOMList.java:71)
    at org.apache.abdera.parser.stax.util.FOMList$BufferIterator.next(FOMList.java:197)
    at org.apache.abdera.parser.stax.FOMFeed.getEntry(FOMFeed.java:208)
    at com.ibm.searchwcm.SearchAndFilter.getSearchResultFromServer(SearchAndFilter.java:279)
    at com.ibm.searchwcm.SearchAndFilter.getSearchResult(SearchAndFilter.java:115)
    at com.ibm._jsp._searchWCM._jspService(_searchWCM.java:204)
    at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:205)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)

Can anybody tell me how to remove type="text/html" attribute from atom:title?

1

There are 1 best solutions below

1
On

As the Atom spec shows, that feed is incorrect:

Text constructs MAY have a "type" attribute.  When present, the value
MUST be one of "text", "html", or "xhtml".  If the "type" attribute
is not provided, Atom Processors MUST behave as though it were
present with a value of "text".

Abdera is correct to reject it. From your question, it seems like that feed is being generated by Lotus Web Content Manager; if so, that's a bug in WCF that may have been fixed. If those two boxes are producing different feeds, perhaps they're running different versions.

Edit: From your other question I can see that your code is fetching the feed from azeez:10039/wps/mycontenthandler/. You need to figure out why your two environments are producing different feeds here rather than trying to patch up invalid data.