Author: jleroux
Date: Sun Oct 7 23:40:05 2007
New Revision: 582723
URL:
http://svn.apache.org/viewvc?rev=582723&view=revLog:
To allow to deal with problems in some DOS file, specifically file extracted from zip archives.
Modified:
ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java
Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java?rev=582723&r1=582722&r2=582723&view=diff==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java Sun Oct 7 23:40:05 2007
@@ -47,6 +47,7 @@
protected Record curRecord = null;
protected String nextLine = null;
protected Record nextRecord = null;
+ protected String eof = new String("\u001A"); // aka ASCII char 26, aka substitute, aka 0x1A, aka CTRL-Z, aka EOF DOS character. Added because problems in some DOS file, specifically file extracted from zip archives.
public RecordIterator(URL fileUrl, ModelDataFile modelDataFile) throws DataFileException {
this.modelDataFile = modelDataFile;
@@ -115,7 +116,7 @@
}
}
- if (nextLine != null) {
+ if (nextLine != null && !(eof.equals(nextLine.substring(0,1)) && 1 == nextLine.length())) {
nextLineNum++;
ModelRecord modelRecord = findModelForLine(nextLine, nextLineNum, modelDataFile);
if (isDelimited) {
@@ -135,7 +136,8 @@
}
public boolean hasNext() {
- return nextLine != null;
+ return nextLine != null && !(eof.equals(nextLine.substring(0,1)) && 1 == nextLine.length());
+
}
public Record next() throws DataFileException {