JiBX
  1. JiBX
  2. JIBX-140

VerifyError on multi-dimensional arrays

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1
    • Fix Version/s: JiBX 1.1.2
    • Component/s: core
    • Labels:
      None
    • Environment:
      any
    • Number of attachments :
      0

      Description

      org.jibx.binding.classes.MethodBuilder.appendCreateArray(String) does not generate valid bytecode for multi-dimensional arrays.

      The class name added to the constant pool is incorrect for non-primitives. It would appear that replacing all of:

                  String btype = type;
                  while (btype.endsWith("[]")) {
                      btype = btype.substring(0, btype.length()-2);
                  }
                  String cname = type + "[]";
                  if (ClassItem.isPrimitive(btype)) {
                      cname = Utility.getSignature(cname);
                  }
                  append(new MULTIANEWARRAY(m_instructionBuilder.
                      getConstantPoolGen().addClass(cname), (short)1));
      

      with:

                 String cname = Utility.getSignature(type + "[]");
                  append(new MULTIANEWARRAY(m_instructionBuilder.
                      getConstantPoolGen().addClass(cname), (short)1));
      

      resolves the issue

      I think that even the following would be enough, since the dimension attribute above is hard-coded to 1 anyway:

                 String cname = Utility.getSignature(type);
                  append(new ANEWARRAY(m_instructionBuilder.
                      getConstantPoolGen().addClass(cname)));
      

      Please see "[jibx-users] VerifyError on multi-dimensional array" if more details are required.

        Activity

        Hide
        Dennis Sosnoski added a comment -

        Made the change, though I haven't added a test case for this.

        Show
        Dennis Sosnoski added a comment - Made the change, though I haven't added a test case for this.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            David Citron
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: