Datafile problems

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Datafile problems

BJ Freeman
see https://issues.apache.org/jira/browse/OFBIZ-3026
having to live with files that I am provided in the real world, I need
to beef up the datafile code.

The problem is the file I have has no data or delimiter to the last column.
nexttolastcolmn (delimiter) lastcolumn (eol)  = expected
data            no delimiter nodata (eol)= real data
If I add the delimiter then it works.
however this files are like  24 megs and up and not able to be edited
easily.


it seems the Record.createRecord is more for fixed files than for delimited.
this causes a an error in
            try {
                strVal = line.substring(modelField.position,
modelField.position + modelField.length);
            } catch (IndexOutOfBoundsException ioobe) {
                throw new DataFileException("Field " + modelField.name +
" from " + modelField.position +
                        " for " + modelField.length + " chars could not
be read from a line (" + lineNum + ") with only " +
                        line.length() + " chars.", ioobe);
            }
This is around line 515.

1) would this be the place to add code for the delimited
2) or would Record.createDelimitedRecord be a better place.
        if (line.endsWith(String.valueOf(delimiter))) {
            st = new StringTokenizer(line + " ", "" + delimiter, true);
            Debug.logInfo(" does end with a delimiter", module);
        }
        else {
            st = new StringTokenizer(line, "" + delimiter, true);
            Debug.logInfo(" does not end with a delimiter", module);
                  }
 about line 551

any thoughts.




--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.