Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-12194

Remove deprecated ByteWrapper class



    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • Trunk
    • None
    • framework/entity
    • None


      I send a message about it to dev ML in mid 2017:

      Here is a comment from David in 2007 in the ByteWrapper class

      • @deprecated
      • NOTE DEJ20071022: deprecating this because we want to save the byte[] directly instead of inside a serialized
      • object, which makes it hard for other apps to use the data, and causes problems if this object is ever updated

      Here is another comment where it's used, in GenericEntity.getBytes()

      if (value instanceof byte[])

      Unknown macro: { return (byte[]) value; }

      if (value instanceof org.apache.ofbiz.entity.util.ByteWrapper)

      Unknown macro: { // NOTE DEJ20071022}

      Here is another related comment (in SqlJdbcUtil.deserializeField())

      // NOTE DEJ20071022: the following code is to convert the byte[] back into an object; if that fails
      //just return the byte[]; this was for the ByteWrapper thing which is now deprecated, so this may
      //be removed in the near future to enhance performance

      Where there is also this code commented out

      //alt 1: binaryInput = rs.getBinaryStream(ind);
      //alt 2: Blob blobLocator = rs.getBlob(ind);
      //if (blobLocator != null)

      Unknown macro: { // binaryInput = blobLocator.getBinaryStream(); //}

      deserializeField() is only used (twice) in SqlJdbcUtil.getValue() and here are the concerned types (11 & 12):

      fieldTypeMap.put("java.lang.Object", 11);
      fieldTypeMap.put("Object", 11);

      fieldTypeMap.put("java.sql.Blob", 12);
      fieldTypeMap.put("Blob", 12);
      fieldTypeMap.put("byte[]", 12);
      fieldTypeMap.put("java.nio.ByteBuffer", 12);
      fieldTypeMap.put("java.nio.HeapByteBuffer", 12);

      And I think we can clean this 2 cases from the ByteWrapper class . So it was 10 years ago, opinions before I open a Jira ?




            jleroux Jacques Le Roux
            jleroux Jacques Le Roux
            0 Vote for this issue
            2 Start watching this issue