opensourceBIM / BIMserver

The open source BIMserver platform
GNU Affero General Public License v3.0
1.56k stars 610 forks source link

Bug in IfcPlugins 0.0.14 #407

Closed garview closed 8 years ago

garview commented 8 years ago

log:

Caused by: org.bimserver.plugins.deserializers.DeserializeException: Error on line 958: Number of hex chars in \X2\ definition not divisible by 4 at org.bimserver.ifc.step.deserializer.IfcParserWriterUtils.readString(IfcParserWriterUtils.java:127) ~[na:na] at org.bimserver.ifc.step.deserializer.IfcParserWriterUtils.convertSimpleValue(IfcParserWriterUtils.java:69) ~[na:na] at org.bimserver.ifc.step.deserializer.IfcStepStreamingDeserializer.convert(IfcStepStreamingDeserializer.java:605) ~[na:na] at org.bimserver.ifc.step.deserializer.IfcStepStreamingDeserializer.processRecord(IfcStepStreamingDeserializer.java:442) ~[na:na] at org.bimserver.ifc.step.deserializer.IfcStepStreamingDeserializer.processLine(IfcStepStreamingDeserializer.java:256) ~[na:na] at org.bimserver.ifc.step.deserializer.IfcStepStreamingDeserializer.read(IfcStepStreamingDeserializer.java:191) ~[na:na] at org.bimserver.ifc.step.deserializer.IfcStepStreamingDeserializer.read(IfcStepStreamingDeserializer.java:165) ~[na:na] at org.bimserver.database.actions.StreamingCheckinDatabaseAction.execute(StreamingCheckinDatabaseAction.java:175) ~[classes/:na] ... 6 common frames omitted

description: the error will be occured when the IfcParserWriterUtils proccess strings such as :'\X2\3010\X0\S\X2\301165E07F1D94A27BA1\X0-\X2\4E1D63A5\X0\'(Chinese charactors:【S】无缝钢管-丝接) The error will be disappeared when I commented out the code as following:(line100-106 in IfcParserWriterUtils )

while (result.contains("\S\")) { int index = result.indexOf("\S\"); char x = result.charAt(index + 3); ByteBuffer b = ByteBuffer.wrap(new byte[] { (byte) (x + 128) }); CharBuffer decode = Charsets.ISO_8859_1.decode(b); result = result.substring(0, index) + decode.get() + result.substring(index + 4); }

Everything seems to be right(checkin , 3D displayed) after this modification. question1 What is the role of this section of the code? question2 Is there any problem with this fix?

rubendel commented 8 years ago

Are you able to share the original IFC file?

garview commented 8 years ago

Of course. https://github.com/garview/files/raw/master/1/1.ifc The orginal file is too big to upload. But this 1.ifc can also reproduct this error.

BTW , could you reply the issue #401 ? It is asking for an api or example just like the API-1.png and example1.js in bimsurfer project. There would be very helpful for me to embed the 3D model in the other page with a clear and usable api.

regards

rubendel commented 8 years ago

Thanks for reporting. The role of the function is to parse the \S\ encoding, which is part of the ISO-10303-21 standard. Unfortunately the standard lacks mentioning an order of preference of the different encoding types. Because of this lack, depending on the implementation the different encoding types can "steal" the other's backslashes.

I have changed the order now (\S\ will be last in processing), this makes the file you submitted work, but there are no guarantees for the future. Until a new version of the standard comes out we'll probably have to keep adjusting the algorithm until we will comply with most of the other software out there.

garview commented 8 years ago

Thank you for the quick and helpful reply, it's really useful. related issue: #399 regards