Hardwareid with : in it does not work anymore.

18 views
Skip to first unread message

Marcel van W

unread,
Feb 26, 2018, 4:27:51 PM2/26/18
to SiteWhere
I recently moved from sitewhere 1.9 to sitewhere 1.12 and since the update new device registrations are not working anymore. I get this stacktrace in the log:

2018-02-26T21:44:40,718 [SiteWhere MQTT(protobuf - SiteWhere/input/protobuf) Receiver 1] DEBUG [InboundEventSource] Device event receiver thread picked up event.
2018-02-26T21:44:40,718 [SiteWhere MQTT(protobuf - SiteWhere/input/protobuf) Receiver 1] DEBUG [ProtobufDeviceEventDecoder] Decoded registration for: 70:4d:7b:12:9c:f7
2018-02-26T21:44:40,718 [SiteWhere BlockingQueueInboundProcessingStrategy Processor 2] DEBUG [RegistrationManager] Handling device registration request.
2018-02-26T21:44:40,719 [SiteWhere BlockingQueueInboundProcessingStrategy Processor 2] DEBUG [RegistrationManager] Creating new device as part of registration.
2018-02-26T21:44:40,720 [SiteWhere BlockingQueueInboundProcessingStrategy Processor 2] ERROR [DefaultInboundEventProcessorChain] Processor failed to process registration request.
com.sitewhere.spi.SiteWhereSystemException: Hardware id must consist of alphanumeric values with dashes, underscores, and no spaces.
        at com.sitewhere.core.SiteWherePersistence.deviceCreateLogic(SiteWherePersistence.java:501) ~[sitewhere-core-1.12.0.jar!/:?]
        at com.sitewhere.mongodb.device.MongoDeviceManagement.createDevice(MongoDeviceManagement.java:638) ~[sitewhere-mongodb-1.12.0.jar!/:?]
        at com.sitewhere.device.DeviceManagementDecorator.createDevice(DeviceManagementDecorator.java:178) ~[sitewhere-core-1.12.0.jar!/:?]
        at com.sitewhere.device.communication.RegistrationManager.handleDeviceRegistration(RegistrationManager.java:110) ~[sitewhere-core-1.12.0.jar!/:?]
        at com.sitewhere.device.event.processor.RegistrationProcessor.onRegistrationRequest(RegistrationProcessor.java:43) ~[sitewhere-core-1.12.0.jar!/:?]
        at com.sitewhere.device.event.processor.DefaultInboundEventProcessorChain.onRegistrationRequest(DefaultInboundEventProcessorChain.java:100) [sitewhere-core-1.12.0.jar!/:?]
        at com.sitewhere.device.communication.InboundProcessingStrategy.sendToInboundProcessingChain(InboundProcessingStrategy.java:49) [sitewhere-core-1.12.0.jar!/:?]
        at com.sitewhere.device.communication.BlockingQueueInboundProcessingStrategy$BlockingMessageProcessor.run(BlockingQueueInboundProcessingStrategy.java:497) [sitewhere-core-1.12.0.jar!/:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_121]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]

It looks like the hardwareid does not support : in it anymore. I use mac addresses with colons in it ( mac adresses) which worked fine before. after looking in the code in github I see that SiteWherePersistence.java uses a regex: "^[\w-]+$" which only allows alphanumeric characters and - _ but nothing else. Is there a reason for this limitation? This is very inconvenient for me, because I have the mac addresses with colons in all my systems and need to convert the colons to something else now. Also I need to update all my devices to use a new hardwareid, Also all assignments need to be changed to the new hardwareids. 

I prefer the regex accepting more characters. Is this possible?

Best regards,

Marcel van Winden 
Reply all
Reply to author
Forward
0 new messages