[teiid-issues] [JBoss JIRA] (TEIID-3383) Add NPE handling in WSConnectionImpl.invoke

Bas Piepers (JIRA) issues at jboss.org
Mon Mar 16 06:00:23 EDT 2015


     [ https://issues.jboss.org/browse/TEIID-3383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bas Piepers updated TEIID-3383:
-------------------------------
    Description: 
In the WSConnectionImpl.java class in the org.teiid.resource.adapter.ws package (of connector-ws-8.4.1-redhat-9.jar) in the invoke(DataSource ds) method at the end it tries to get the content-type from the response in line 164 and then returns the first item in the list of content types:

ArrayList contentTypes = (ArrayList)this.responseContext.get("content-type"); //$NON-NLS-1$
return new HttpDataSource(url, (InputStream)response.getEntity(), (String)contentTypes.get(0));

However if the web service that it calls returns an error code (like 415, for example) it does not always contain a content-type in its header. Basically this method expects a result to be returned all the time with a corresponding content-type which is not right. The line where it calls contentTypes.get(0) may result in a NPE.


  was:
In the WSConnectionImpl.java class in the org.teiid.resource.adapter.ws package (of connector-ws-8.4.1-redhat-9.jar) in the invoke(DataSource ds) method at the end it tries to get the content-type from the response in line 164 and then returns the first item in the list of content types:

ArrayList contentTypes = (ArrayList)this.responseContext.get("content-type"); //$NON-NLS-1$
return new HttpDataSource(url, (InputStream)response.getEntity(), (String)contentTypes.get(0));

However if the web service that it calls returns an error code (like 415, for example) it does not contain a content-type in its header. Basically this method expects a result to be returned all the time with a corresponding content-type which is not right. The line where it calls contentTypes.get(0) may result in a NPE.




> Add NPE handling in WSConnectionImpl.invoke
> -------------------------------------------
>
>                 Key: TEIID-3383
>                 URL: https://issues.jboss.org/browse/TEIID-3383
>             Project: Teiid
>          Issue Type: Bug
>          Components: Connector API
>    Affects Versions: 8.4.1
>            Reporter: Bas Piepers
>            Assignee: Steven Hawkins
>            Priority: Minor
>
> In the WSConnectionImpl.java class in the org.teiid.resource.adapter.ws package (of connector-ws-8.4.1-redhat-9.jar) in the invoke(DataSource ds) method at the end it tries to get the content-type from the response in line 164 and then returns the first item in the list of content types:
> ArrayList contentTypes = (ArrayList)this.responseContext.get("content-type"); //$NON-NLS-1$
> return new HttpDataSource(url, (InputStream)response.getEntity(), (String)contentTypes.get(0));
> However if the web service that it calls returns an error code (like 415, for example) it does not always contain a content-type in its header. Basically this method expects a result to be returned all the time with a corresponding content-type which is not right. The line where it calls contentTypes.get(0) may result in a NPE.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the teiid-issues mailing list