Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-164

Possible issue in CloneableCloner.clone

XMLWordPrintable

      When QA-ing a one-off patch that involves JBMAR-153 and JBMAR-154, I looked around in the codebase and spotted a potential issue. The method clone of the class CloneableCloner has this code:

      Object cached;
      if ((cached = clones.get(orig)) != null) {
          return cached;
      }
      if ((cached = cloneTable.clone(cached, this, ClassCloner.IDENTITY)) != null) {
          clones.put(orig, cached);
          return cached;
      }
      

      And IntelliJ correctly warns that in the call cloneTable.clone in the second if statement, the cached parameter is always null. Possibly the argument should be orig instead? Problems like this seem to be quite common in Marshalling.

      If it indeed should always be null, I believe it's a lot cleaner to just write null.

      This affects master (2.0), the 1.4 branch and possibly other branches.

      I'm not providing a pull request because I'm not capable of deciding whether it is an issue or not.

              dlloyd@redhat.com David Lloyd
              lthon@redhat.com Ladislav Thon
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: