-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presumed bug in OrganisationsAPI.create_infrastructure_facility #2
Comments
Hello Peter, So the correct file to send will be this one: {'body': We take note of this feedback, as we should state this more clearly in the swagger documentation or at least in the error feedback. |
Sorry, I wasn't clear. I tried all kinds of things, including leaving the uri out. What I missed that is it is still in the example above. I now tried it again with this model in my JSON:
Interesting thing is that just before the call it looks like this:
What happens is that the constructor of the InfrastructureFacilityCreationDTO adds the uri. Look at my code below (which is part of a bigger process, but this is reduced to the core:
Output:
Interesting problem because that might be difficult to fix if you generate the logic... |
Thank you for this documented and complete feedback Peter, it will help us to fix the problem... We'll have a look on it and let you know. |
By the way, though I have some (unrelated) problems with storing devices (issue #6), the DevicesAPI doesn’t have the problem described above. Logic in my script:
Before the constructor is called:
Output from the constructor:
But the device can still be stored, so apparently the server logic works differently. That might guide you to a solution. |
It looks like there is a bug in API-client for OrganisationsAPI.create_infrasturcture_facility.
1. If I use the API-client and don’t provide an uri, like this:
I get an error:
(500) Reason: HTTP response headers: HTTPHeaderDict({'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'origin, content-type, accept, authorization', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS, HEAD', 'Vary': 'accept-encoding,accept-encoding', 'Content-Type': 'application/json', 'Content-Length': '7216', 'Date': 'Mon, 05 Jul 2021 07:57:58 GMT', 'Connection': 'close'}) HTTP response body: { "metadata" : { "pagination" : { "pageSize" : 0, "currentPage" : 0, "totalCount" : 0, "totalPages" : 0 }, "status" : [ ], "datafiles" : [ ] }, "result" : { "title" : "Unexpected internal error - java.lang.NullPointerException", "message" : null, "stack" : [ "org.opensilex.core.organisation.dal.InfrastructureFacilityModel.getUriSegments(InfrastructureFacilityModel.java:57)", "org.opensilex.core.organisation.dal.InfrastructureFacilityModel.getUriSegments(InfrastructureFacilityModel.java:14)", "org.opensilex.sparql.utils.ClassURIGenerator.getInstanceURI(ClassURIGenerator.java:18)", "org.opensilex.sparql.utils.URIGenerator.generateURI(URIGenerator.java:26)", "org.opensilex.sparql.service.SPARQLService.generateUniqueUriIfNullOrValidateCurrent(SPARQLService.java:1006)", "org.opensilex.sparql.service.SPARQLService.prepareInstanceCreation(SPARQLService.java:915)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:885)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:857)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:849)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:845)", "org.opensilex.core.organisation.dal.InfrastructureDAO.createFacility(InfrastructureDAO.java:222)", "org.opensilex.core.organisation.api.facitity.FacilityAPI.createInfrastructureFacility(FacilityAPI.java:78)" ], "fullstack" : [ "org.opensilex.core.organisation.dal.InfrastructureFacilityModel.getUriSegments(InfrastructureFacilityModel.java:57)", "org.opensilex.core.organisation.dal.InfrastructureFacilityModel.getUriSegments(InfrastructureFacilityModel.java:14)", "org.opensilex.sparql.utils.ClassURIGenerator.getInstanceURI(ClassURIGenerator.java:18)", "org.opensilex.sparql.utils.URIGenerator.generateURI(URIGenerator.java:26)", "org.opensilex.sparql.service.SPARQLService.generateUniqueUriIfNullOrValidateCurrent(SPARQLService.java:1006)", "org.opensilex.sparql.service.SPARQLService.prepareInstanceCreation(SPARQLService.java:915)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:885)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:857)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:849)", "org.opensilex.sparql.service.SPARQLService.create(SPARQLService.java:845)", "org.opensilex.core.organisation.dal.InfrastructureDAO.createFacility(InfrastructureDAO.java:222)", "org.opensilex.core.organisation.api.facitity.FacilityAPI.createInfrastructureFacility(FacilityAPI.java:78)", "jdk.internal.reflect.GeneratedMethodAccessor771.invoke(Unknown Source)", "java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.base/java.lang.reflect.Method.invoke(Method.java:566)", "org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)", "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)", "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)", "org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)", "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)", "org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)", "org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)", "org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)", "org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)", "org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)", "org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)", "org.glassfish.jersey.internal.Errors.process(Errors.java:292)", "org.glassfish.jersey.internal.Errors.process(Errors.java:274)", "org.glassfish.jersey.internal.Errors.process(Errors.java:244)", "org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)", "org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)", "org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)", "org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)", "org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)", "org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366)", "org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319)", "org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)", "org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)", "org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)", "org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)", "org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)", "org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)", "org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:295)", "org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)", "org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)", "org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)", "org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:552)", "org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)", "org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)", "org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)", "org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)", "org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)", "org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)", "org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)", "org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)", "org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)", "java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)", "java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)", "org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)", "java.base/java.lang.Thread.run(Thread.java:829)" ] } }
2. If I use the API and fill with an empty string, like this:
I get the same error.
CONCLUSION: It seems not possible to work with autogenerated uris via the API
3. If I use the API and add a manually generated uri
Result is this:
{'result': ['os-infra:npec.facilities.npec-greenhouse-compartment-71'], 'metadata': {'pagination': {'pageSize': 0, 'currentPage': 0, 'totalCount': 0, 'totalPages': 0}, 'status': [], 'datafiles': ['os-infra:npec.facilities.npec-greenhouse-compartment-71']}}
So it looks like the entity is added to PHIS correclty. Also, it appears in RDF4j:
However, it is not visible in the PHIS web-application.
Reason seems to be that it is not associated with the NPEC organisation. The facilities that are shown have been added via the online interface. These have an additional association with os-infra:npec in RDF4J
CONCLUSION: The API doesn’t seem to load the association with the organisation, while it does via the online web interface
The text was updated successfully, but these errors were encountered: