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

JSON serialization of two-dimensional arrays (IfcCartesianPointList) #922

Open
hlg opened this Issue Feb 4, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@hlg
Copy link
Member

hlg commented Feb 4, 2019

When serializing IfcCartesianPointList with the streaming Json serializer, the two-dimensional array coordList is not properly resolved, resulting in invalid JSON as below.

{"_i":340330252,"_t":"IfcCartesianPointList2D","_s":1,"_eCoordList":[[
  {"_t":"IfcLengthMeasure","_r":org.bimserver.shared.HashMapWrappedVirtualObject@5a717be2},  
  {"_t":"IfcLengthMeasure","_r":org.bimserver.shared.HashMapWrappedVirtualObject@5a717be2}
],[
  {"_t":"IfcLengthMeasure","_r":org.bimserver.shared.HashMapWrappedVirtualObject@67b70973}, 
  {"_t":"IfcLengthMeasure","_r":org.bimserver.shared.HashMapWrappedVirtualObject@5a717be2}
], ... ]}

Can be reproduced with IFC4Add2TC1 slab standard case example and BIMserver 1.5.123 or 1.5.124.

Probably as a consequence, IfcCartesianPointLists do not show up in BIMvie.ws entity browser, although I had seen that working in 1.5.117, where they where serialized as

{"_i":58066349,"_t":"IfcCartesianPointList2D","_s":1,"_eCoordList":[[
  {"_t":"IfcLengthMeasure","_v":0.0},
  {"_t":"IfcLengthMeasure","_v":0.0}
],[
  {"_t":"IfcLengthMeasure","_v":1000.0},
  {"_t":"IfcLengthMeasure","_v":0.0}
], ... ]}

That is weird, because the JSON serializers don't seem to have changed between 1.5.117 and 1.5.123.

Moreover, I would assume they should be represented as lists of lists of primitives like this?

{"_i":340330252,"_t":"IfcCartesianPointList2D","_s":1,"CoordList":[[0,0],[1000,0], ... ]}

That would be similar to IfcCartesianPoint coordinates, which are one-dimensional lists of IfcLengthMeasure and are represented in JSON without the DefinedType explicitely included.

{"_i":15221196075,"_t":"IfcCartesianPoint","_s":1,"Coordinates":[0.0,0.0,0.0],"CoordinatesAsString":["0.0","0.0","0.0"]}

Did not test how JSON deserializers handle any of these.

Not sure if this is related: Non-streaming JSON serializer and JSON serializer with geometry provoke NPE's for this example.

org.bimserver.BimserverDatabaseException: java.lang.NullPointerException
	at org.bimserver.database.actions.DownloadByNewJsonQueryDatabaseAction.execute(DownloadByNewJsonQueryDatabaseAction.java:258)
	at org.bimserver.database.actions.DownloadByNewJsonQueryDatabaseAction.execute(DownloadByNewJsonQueryDatabaseAction.java:73)
	at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:735)
	at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:727)
	at org.bimserver.longaction.LongDownloadOrCheckoutAction.executeAction(LongDownloadOrCheckoutAction.java:120)
	at org.bimserver.longaction.LongDownloadAction.execute(LongDownloadAction.java:57)
	at org.bimserver.longaction.LongActionManager$1.run(LongActionManager.java:54)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: null
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDerivedStructuralFeatureID(BasicEObjectImpl.java:1497)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1008)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1003)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:998)
	at org.bimserver.database.actions.DownloadByNewJsonQueryDatabaseAction.execute(DownloadByNewJsonQueryDatabaseAction.java:218)
	... 11 common frames omitted

rubendel added a commit that referenced this issue Feb 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment