You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Chandan V.A (JIRA)" <ji...@apache.org> on 2014/06/03 14:56:03 UTC

[jira] [Assigned] (OLINGO-312) Reading resource via Classloader

     [ https://issues.apache.org/jira/browse/OLINGO-312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chandan V.A reassigned OLINGO-312:
----------------------------------

    Assignee: Chandan V.A

> Reading resource via Classloader
> --------------------------------
>
>                 Key: OLINGO-312
>                 URL: https://issues.apache.org/jira/browse/OLINGO-312
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 1.2.0
>            Reporter: Giacomo Pati
>            Assignee: Chandan V.A
>
> While many servlet-containers tested by me work fine with construct below, WebSphere 8 doesn't like it and returns null for the resources path requested (it's actually outside of Classloader managed filesystem area, which I would consider being bad practice):
> {code}
> InputStream is = JPAEdmMappingModelService.class.getClassLoader().getResourceAsStream("../../" + mappingModelName);
> {code}
> As the class in question (JPAEdmMappingModelService) doesn't have access to the servlet context to properly read a file from the web space area I'd suggest (also for backwards compatibility reasons) to add this to the code as shown in the following patch:
> {code}
> @@ -195,6 +195,9 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
>    protected InputStream loadMappingModelInputStream() {
>      InputStream is = JPAEdmMappingModelService.class.getClassLoader().getResourceAsStream("../../" + mappingModelName);
> +      if(is == null) {
> +          is = JPAEdmMappingModelService.class.getClassLoader().getResourceAsStream(mappingModelName);
> +      }
>      return is;
> {code}
> which would alternatively allow to put the mapping file into the WEB-INF/classes folder.



--
This message was sent by Atlassian JIRA
(v6.2#6252)