Project

General

Profile

Bug #6790

The Slice class and its subclasses hold duplicate state

Added by Andrei Buium about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrei Buium
Category:
d1_jibx_extensions
Target version:
Start date:
2015-01-30
Due date:
% Done:

100%

Story Points:
Sprint:

Description

The Slice class (with start/count/total members) seems a bit error prone since its extending classes (with a List member) need to know to update Slice variables when they clear/modify their inner List.

At the moment, a Log can be modified with myLog.addLogEntry(logEntry), then we call myLog.getCount() and receive an incorrect count.
The only bug caused by this that I'm aware of, was fixed in the d1_integration CommonCallAdapter.
It would be good to make sure this can't happen though by making sure we don't have duplicate state (Slice.count and Log.logEntryList.size()).

History

#1 Updated by Rob Nahf about 9 years ago

  • Category set to d1_common_java

#2 Updated by Rob Nahf about 9 years ago

  • Target version set to CLJ-2.0.0

#3 Updated by Dave Vieglais over 8 years ago

  • Assignee set to Andrei Buium

#4 Updated by Robert Waltz over 8 years ago

  • Category changed from d1_common_java to d1_jibx_extensions

The slice class is the superclass of Log, ObjectFormatList and ObjectList. The three children are wrappers for Java Lists.

Being the Parent, the slice class knows nothing about its descendants.

If the descendants of Slice need to change the behaviour of slice.count (by making it a wrapper of another method such as List.size() ), then Slice.count should be an overwritten at the child level. In d1_jibx_extensions a new decorator class should be created that will add the behaviour to Log, ObjectFormatList and ObjectList. The pattern established by ComparableSubjectDecorator should be followed in order to add new functionality.

#5 Updated by Andrei Buium over 8 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 30

Code is written but I'm testing to make sure there aren't problems left.

#6 Updated by Andrei Buium over 8 years ago

  • % Done changed from 30 to 100
  • Status changed from In Progress to Closed

Tested. All classes decorated as expected and all unit tests are passing. Finished committing all the code.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)