SAP / olingo-jpa-processor-v4

The JPA Processor fills the gap between Olingo V4 and the database, by providing a mapping between JPA metadata and OData metadata, generating queries and supporting the entity manipulations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading of reference document for annotations fails in Spring Boot

Boltzmann opened this issue · comments

To get a description of Entities or Properties in the form of (xml)
<Annotation Term="Core.Description" String="Description Test"/>
we use the solution of the second step posted in #37 (comment), by creating an extension of JPAEdmMetadataPostProcessor overriding method provideReferences:

String uri = "http://docs.oasisopen.org/odata/odata/v4.0/os/vocabularies/Org.OData.Core.V1.xml";
IntermediateReferenceAccess reference = references.addReference(uri, "annotations/Org.OData.Core.V1.xml");
reference.addInclude("Org.OData.Core.V1", "Core");

However, in Spring Boot this fails with the error

nested exception is com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException: Parsing of 'annotations/Org.OData.Core.V1.xml' failed with message 'file:/app.jar!/BOOT-INF/classes!/annotations/Org.OData.Core.V1.xml (No such file or directory)'.

Reason for this is that the method loadXML in class CsdlDocumentReader uses this.getClass().getClassLoader().getResource(path) instead of this.getClass().getClassLoader().getResourceAsStream(path).

I was able to reproduce the error and approved you PR. Please merge it.

Hi @wog48, are you asking me? I cannot...maybe I need some information. See the SonarCloud build of the merge:

Error: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project odata-jpa: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator -> [Help 1]

Hi @wog48 , I saw you tried the sonar check again on 6th October. Can you please give an update if I can be of any help?

https://github.com/SAP/olingo-jpa-processor-v4/actions/workflows/sonar.yml shows that all merge requests from forked repositories do not work with sonar in this repo, while your branches and edits in master do. Maybe the merge are not allowed to use the sonar check here?

I tried to find the root cause, why the sonar token is not taken. Up to now I failed. Nevertheless, you should be able to merge the PR, as the sonar check is not required. In case you face a problem, I can merge the PR.

Thank you for merging the PR! Regarding

Nevertheless, you should be able to merge the PR, as the sonar check is not required.

have a look at #161 (comment).