You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2013/10/15 14:36:41 UTC
[jira] [Created] (SLING-3175) Make MediaRange parser linient to
accept invalid Accept header generated by Oracle JDK HttpUrlConnection
Chetan Mehrotra created SLING-3175:
--------------------------------------
Summary: Make MediaRange parser linient to accept invalid Accept header generated by Oracle JDK HttpUrlConnection
Key: SLING-3175
URL: https://issues.apache.org/jira/browse/SLING-3175
Project: Sling
Issue Type: Improvement
Components: Servlets
Affects Versions: Servlets Post 2.3.2
Reporter: Chetan Mehrotra
Priority: Minor
While making a call to Sling using Java URLConnection we get following exception [1]. The root cause is due to parsing of invalid {{Accept}} header being sent as part of request
{noformat}
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
{noformat}
The problem here is that this header is added by JDK itself [0] and at times its not possible to change the request property of URLConnection created by third party library. Would be helpful to make Sling MediaRange parser more linient
[0] http://hg.openjdk.java.net/jdk6/jdk6-gate/jdk/file/tip/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
[1] 15.10.2013 16:51:01.646 *WARN* [10.40.247.115 [1381836061645] POST /rpc/protocol/model/rf HTTP/1.1] org.apache.sling.servlets.post.impl.helper.MediaRangeList Error registering media type *; q=.2 java.lang.ArrayIndexOutOfBoundsException: 1
at org.apache.sling.servlets.post.impl.helper.MediaRangeList$MediaRange.setType(MediaRangeList.java:237)
at org.apache.sling.servlets.post.impl.helper.MediaRangeList$MediaRange.<init>(MediaRangeList.java:191)
at org.apache.sling.servlets.post.impl.helper.MediaRangeList.init(MediaRangeList.java:90)
at org.apache.sling.servlets.post.impl.helper.MediaRangeList.<init>(MediaRangeList.java:56)
at org.apache.sling.servlets.post.impl.SlingPostServlet.createPostResponse(SlingPostServlet.java:279)
at org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:185)
--
This message was sent by Atlassian JIRA
(v6.1#6144)