preon / preon

Bit syntax for Java
183 stars 80 forks source link

Error using match with @BoundNumber #5

Open rdu opened 12 years ago

rdu commented 12 years ago

Hi Wilfred,

I am getting a Nullpointer Exception everytime I use a match within the @BoundNumber annotation in current snapshot. This is reproducable with plain archtype adding a match rule.

Example Stacktrace:

shouldDecodeCorrectly(de.guxx.ImageTest) Time elapsed: 0.11 sec <<< ERROR! java.lang.NullPointerException at org.codehaus.preon.el.util.Converters.toInt(Converters.java:60) at org.codehaus.preon.codec.NumericCodec.decode(NumericCodec.java:106) at org.codehaus.preon.binding.StandardBindingFactory$FieldBinding.load(StandardBindingFactory.java:104) at org.codehaus.preon.codec.ObjectCodec.decode(ObjectCodec.java:85) at org.codehaus.preon.DefaultCodecFactory$DefaultCodec.decode(DefaultCodecFactory.java:159) at org.codehaus.preon.Codecs.decode(Codecs.java:208) at org.codehaus.preon.Codecs.decode(Codecs.java:195) at org.codehaus.preon.Codecs.decode(Codecs.java:176) ...

wspringer commented 12 years ago

Are you able to run the tests in preon-binding? Because those tests include a lot of @BoundNumber references. So I figure if the problem you are seeing should also happen while you're running the tests. (In my case, they all succeed.)

rdu commented 12 years ago

The tests in preon-binding run without errors. But I can't see there any @BoundNumber(match="xxxx") reference. A simple @BoundNumber works well in my own testproject. Only in combination with "match" the error occours.

jsmyczek commented 12 years ago

Hi, I believe this commit should fix it: https://github.com/jsmyczek/preon/commit/d9e7f59c80960748cbaa8dd06246fa47ac59f9ba