java3d
  1. java3d
  2. JAVA3D-656

MediaContainerState tries to save/restore null field, causing NPE

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: not determined
    • Component/s: j3d-core-utils
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      656

      Description

      public void writeObject(DataOutput dataoutput)
      throws IOException

      {/* 62*/ super.writeObject(dataoutput); /* 64*/ dataoutput.writeBoolean(((MediaContainer)node).getCacheEnable()); /* 65*/ dataoutput.writeUTF(((MediaContainer)node).getURLString()); }

      public void readObject(DataInput datainput)
      throws IOException

      {/* 69*/ super.readObject(datainput); /* 71*/ ((MediaContainer)node).setCacheEnable(datainput.readBoolean()); /* 72*/ ((MediaContainer)node).setURLString(datainput.readUTF()); }

        Activity

        Hide
        mcneillk added a comment -

        MediaContainerState.java tries to read and write the URLString field on the
        MediaContainer object, but this field can, and often is, NULL.

        From the javadoc:

        "Only one type of sound media data specified using setURLString, setURLObject,
        or setInputStream may be non-null (or they may all be null). An attempt to set
        more than one of these attributes to a non-null reference will result in an
        exception being thrown."

        Best fix is to test which field is set, and save / restore that field. in the
        case of InputStream, the data can be saved in a byte[].

        Show
        mcneillk added a comment - MediaContainerState.java tries to read and write the URLString field on the MediaContainer object, but this field can, and often is, NULL. From the javadoc: "Only one type of sound media data specified using setURLString, setURLObject, or setInputStream may be non-null (or they may all be null). An attempt to set more than one of these attributes to a non-null reference will result in an exception being thrown." Best fix is to test which field is set, and save / restore that field. in the case of InputStream, the data can be saved in a byte[].
        Hide
        mcneillk added a comment -

        Assigned

        Show
        mcneillk added a comment - Assigned
        Hide
        mcneillk added a comment -

        Started

        Show
        mcneillk added a comment - Started
        Hide
        mcneillk added a comment -

        Checked-in.

        Show
        mcneillk added a comment - Checked-in.

          People

          • Assignee:
            mcneillk
            Reporter:
            mcneillk
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: