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

Chandan V.A resolved OLINGO-312.
--------------------------------

       Resolution: Fixed
    Fix Version/s: V2 1.3.0

> 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
>             Fix For: V2 1.3.0
>
>
> 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)

Reply via email to