nxbdi/snakeyaml

Dumping parameterized type causes ArrayIndexOutOfBoundsException

Closed this issue · 4 comments

What steps will reproduce the problem?
1. Compile and run the attached Java code



What is the expected output? What do you see instead?

I think I expect to see:

!!Issue
parm: {t: null}

or something similar.
Instead, I see:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
        at org.yaml.snakeyaml.representer.Representer.checkGlobalTag(Representer.java:211)
        at org.yaml.snakeyaml.representer.Representer.representJavaBeanProperty(Representer.java:145)
        at org.yaml.snakeyaml.representer.Representer.representJavaBean(Representer.java:83)
        at org.yaml.snakeyaml.representer.Representer$RepresentJavaBean.representData(Representer.java:49)
        at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:107)
        at org.yaml.snakeyaml.representer.BaseRepresenter.represent(BaseRepresenter.java:62)
        at org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:249)
        at org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:218)
        at org.yaml.snakeyaml.Yaml.dump(Yaml.java:206)
        at Issue.main(Issue.java:16)


What version of SnakeYAML are you using? On what Java version?
snakeyaml-1.8
java version "1.6.0_20"                                                         

OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)      

OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

Original issue reported on code.google.com by elkn...@gmail.com on 13 May 2011 at 7:45

Attachments:

Yes, I can reproduce the bug. We will have a look.

Original comment by py4fun@gmail.com on 16 May 2011 at 8:58

  • Changed state: Started
  • Added labels: ****
  • Removed labels: ****
It should be fixed. Try the latest source or 1.9-SNAPSHOT

Original comment by py4fun@gmail.com on 16 May 2011 at 11:52

  • Added labels: ****
  • Removed labels: ****
Looks good.  The 1.9-SNAPSHOT works.

Original comment by elkn...@gmail.com on 16 May 2011 at 7:25

  • Added labels: ****
  • Removed labels: ****
The fix 
(http://code.google.com/p/snakeyaml/source/detail?r=24fc247551f377df78607e651b5e
aa3ec1a84d7a) will be provided in version 1.9

Original comment by py4fun@gmail.com on 17 May 2011 at 7:43

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****