Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1804

Serialisation of long[] type was not working correctly.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0, 3.1B2
    • 3.1RC1, 3.2.M1, 3.0.3
    • None

    Description

      When an attribute of type long[] should be written into the database there was just an object reference written.

      Patch for 3.0.x:

      From 5f9d95f1a2f72d7c2c45ed7105b0506ce3e8cf4a Mon Sep 17 00:00:00 2001
      From: Kris Erik Schwerdt <kriserik@quantentunnel.de>
      Date: Fri, 22 Mar 2013 15:52:24 +0100
      Subject: [PATCH] BUGFIX: added type long[] correctly.

      The type long[] was not correctly deserialized before, because there was
      missing a line in org.apache.cayenne.util.Util. This line has been added
      now.

      .../src/main/java/org/apache/cayenne/util/Util.java | 3 +++
      1 file changed, 3 insertions

      diff --git a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java b/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
      index 3a114d4..86dd0d8 100644
      — a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
      +++ b/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
      @@ -645,6 +645,9 @@ public class Util {
      else if ("int".equals(className))

      { return int[].class; }
      + else if ("long".equals(className)) { + return long[].class; + }
      else if ("short".equals(className)) { return short[].class; }

      1.8.2


      Patch for trunk:

      From 7afbc06cbf324b5d2e3d27abeef1c04b11a99ec2 Mon Sep 17 00:00:00 2001
      From: Kris Erik Schwerdt <kriserik@quantentunnel.de>
      Date: Fri, 22 Mar 2013 16:11:45 +0100
      Subject: [PATCH] BUGFIX: added type long[] correctly.

      The type long[] was not correctly deserialized before, because there was
      missing a line in org.apache.cayenne.di.spi.DefaultAdhocObjectFactory
      and org.apache.cayenne.reflect.PropertyUtils. This line has been added
      now.

      .../java/org/apache/cayenne/di/spi/DefaultAdhocObjectFactory.java | 3 +++
      .../src/main/java/org/apache/cayenne/reflect/PropertyUtils.java | 6 ++++++
      2 files changed, 9 insertions

      diff --git a/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultAdhocObjectFactory.java b/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultAdhocObjectFactory.java
      index 1e2d4d6..6e91598 100644
      — a/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultAdhocObjectFactory.java
      +++ b/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultAdhocObjectFactory.java
      @@ -159,6 +159,9 @@ public class DefaultAdhocObjectFactory implements AdhocObjectFactory {
      else if ("int".equals(className)) { return int[].class; }

      + else if ("long".equals(className))

      { + return long[].class; + }

      else if ("short".equals(className))

      { return short[].class; }

      diff --git a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PropertyUtils.java b/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PropertyUtils.java
      index 297eb6f..c37f0e0 100644
      — a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PropertyUtils.java
      +++ b/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PropertyUtils.java
      @@ -276,6 +276,9 @@ public class PropertyUtils {
      else if ("int".equals(className))

      { return Integer.class; }

      + else if ("long".equals(className))

      { + return Long.class; + }

      else if ("short".equals(className))

      { return Short.class; }

      @@ -310,6 +313,9 @@ public class PropertyUtils {
      else if ("int".equals(className))

      { return Integer.valueOf(0); }

      + else if ("long".equals(className))

      { + return Long.valueOf(0); + }

      else if ("short".equals(className))

      { return Short.valueOf((short) 0); }


      1.8.2

      Attachments

        Activity

          People

            Unassigned Unassigned
            kes31 Kris Erik Schwerdt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: