<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ClassCastException in PropertyStates]]></title><description><![CDATA[<p dir="auto">When a com.serotonin.bacnet4j.type.constructed.ProptertyStates object is instantiated via the <strong>PropertyStates(int type, BaseType state)</strong> constructor, the getState() function will work fine as a BaseType object is required.</p>
<p dir="auto">However, when a PropertyStates object is instantiated via the <strong>public PropertyStates(ByteQueue queue)</strong> constructor, the getState() function can generate ClassCastExceptions if it is not a BaseType.</p>
<p dir="auto">In my case, I had a ClassCastException because this.state was a BinaryPV, which isn't a BaseType.</p>
<p dir="auto">Changing</p>
<pre><code>    public BaseType getState() {
        return (BaseType) state.getDatum();
    }
</code></pre>
<p dir="auto">to this</p>
<pre><code>    public Encodable getState() {
        return state.getDatum();
    }

</code></pre>
<p dir="auto">resolves the problem.  Or if getState returned this.state, that should probably work too.</p>
]]></description><link>https://forum.mango-os.com/topic/838/classcastexception-in-propertystates</link><generator>RSS for Node</generator><lastBuildDate>Thu, 21 May 2026 07:22:25 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/838.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 May 2011 11:05:12 GMT</pubDate><ttl>60</ttl></channel></rss>