Null Pointer Exception in SequenceOf.write
-
Matthew,
I've been doing a bit of testing and I hit a NPE in SequenceOf.java.
Here's a little background:
I give my user the ability to add/remove sensors (analog or binary inputs) they want exposed through BACnet. So let's say I create 10 bacnet objects I add to my local device. Everything is fine. I hit my slave server with a BACnet browser and I can see everything as expected. If I delete any number of bacnet objects using removeObject on the local device and then run the scan again from my BACnet browser, I get the exception.
Here is the full stack trace:
java.lang.NullPointerException at com.serotonin.bacnet4j.type.constructed.SequenceOf.write(SequenceOf.java:49) at com.serotonin.bacnet4j.type.constructed.BaseType.write(BaseType.java:33) at com.serotonin.bacnet4j.type.Encodable.writeEncodable(Encodable.java:272) at com.serotonin.bacnet4j.type.constructed.ReadAccessResult$Result.write(ReadAccessResult.java:114) at com.serotonin.bacnet4j.type.constructed.SequenceOf.write(SequenceOf.java:49) at com.serotonin.bacnet4j.type.constructed.BaseType.write(BaseType.java:33) at com.serotonin.bacnet4j.type.Encodable.write(Encodable.java:191) at com.serotonin.bacnet4j.type.Encodable.writeOptional(Encodable.java:205) at com.serotonin.bacnet4j.type.constructed.ReadAccessResult.write(ReadAccessResult.java:45) at com.serotonin.bacnet4j.type.constructed.SequenceOf.write(SequenceOf.java:49) at com.serotonin.bacnet4j.type.Encodable.write(Encodable.java:162) at com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyMultipleAck.write(ReadPropertyMultipleAck.java:46) at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.sendResponse(IpMessageControl.java:239) at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.access$300(IpMessageControl.java:74) at com.serotonin.bacnet4j.npdu.ip.IpMessageControl$IncomingMessageExecutor.runImpl(IpMessageControl.java:536) at com.serotonin.bacnet4j.npdu.ip.IpMessageControl$IncomingMessageExecutor.run(IpMessageControl.java:454) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
Regards,
Fred -
Hi Fred,
I made an adjustment to the SequeceOf class and checked it in. See if it works better for you now.
-
Thanks Matthew, that did the trick.
Can you share your plans on when you'll be updating the released versions of bacnet4j and modbus4j?
Regards.
-
Well, yes... I have none. Both projects are stable at the moment though. I'd say it's safe to use builds of the current code.
-
Thanks Matthew,
I did the build myself for the update you checked in for SequenceOf.java since I didn't see an updated jar file. The rest of my code is relative to the latest release published on sourceforge.
If I can avoid it, I never like building 3rd party libraries.
Regards,
Fred -
If it's any consolation, the ANT scripts in the repo are what i use to create the builds, so you'll get from that exactly what you'd get from me.