svn commit: r759232 - in /ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile: DataFile.java DataFile2EntityXml.java ModelDataFileReader.java ModelField.java Record.java RecordIterator.java

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

svn commit: r759232 - in /ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile: DataFile.java DataFile2EntityXml.java ModelDataFileReader.java ModelField.java Record.java RecordIterator.java

doogie-3
Author: doogie
Date: Fri Mar 27 16:56:23 2009
New Revision: 759232

URL: http://svn.apache.org/viewvc?rev=759232&view=rev
Log:
Fix lines that *only* have whitespace.

Modified:
    ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java
    ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java
    ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java
    ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelField.java
    ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java
    ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java

Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java?rev=759232&r1=759231&r2=759232&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java Fri Mar 27 16:56:23 2009
@@ -41,7 +41,7 @@
  */
 
 public class DataFile {
-
+
     public static final String module = DataFile.class.getName();
 
     /** List of record in the file, contains Record objects */
@@ -153,14 +153,14 @@
         if (locationInfo == null) {
             locationInfo = "unknown";
         }
-
+
         RecordIterator recordIterator = this.makeRecordIterator(dataFileStream, locationInfo);
         while (recordIterator.hasNext()) {
             this.records.add(recordIterator.next());
         }
         // no need to manually close the stream since we are reading to the end of the file: recordIterator.close();
     }
-
+
     public RecordIterator makeRecordIterator(URL fileUrl) throws DataFileException {
         return new RecordIterator(fileUrl, this.modelDataFile);
     }

Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java?rev=759232&r1=759231&r2=759232&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java Fri Mar 27 16:56:23 2009
@@ -25,11 +25,11 @@
 import org.ofbiz.base.util.*;
 
 public class DataFile2EntityXml {
-
+
     /** Creates a new instance of DataFile2EntityXml */
     public DataFile2EntityXml() {
     }
-
+
     /**
      * @param args the command line arguments
      */
@@ -38,7 +38,7 @@
         BufferedWriter outFile = null;
 
         try {
-
+
             //outFile = new BufferedWriter(new FileWriter(file));
             outFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
         } catch (Exception e) {
@@ -81,17 +81,17 @@
         } catch (IOException e) {
             throw new DataFileException("Error writing to file " + fileName, e);
         }
-
+
     }
-
+
     public static void main(String[] args) throws Exception {
         // TODO code application logic here
         String dataFileLoc = args[0];
         String definitionLoc = args[1];
         String definitionName = args[2];
-
+
         BufferedWriter outFile = new BufferedWriter(new FileWriter(dataFileLoc + ".xml"));
-
+
         URL dataFileUrl = null;
         //try {
             dataFileUrl = UtilURL.fromFilename(dataFileLoc);
@@ -134,5 +134,5 @@
         outFile.close();
 
     }
-
+
 }

Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java?rev=759232&r1=759231&r2=759232&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java Fri Mar 27 16:56:23 2009
@@ -44,7 +44,7 @@
  */
 
 public class ModelDataFileReader {
-
+
     public static final String module = ModelDataFileReader.class.getName();
 
     public static UtilCache<URL, ModelDataFileReader> readers = new UtilCache<URL, ModelDataFileReader>("ModelDataFile", 0, 0);
@@ -314,7 +314,7 @@
         field.description = UtilXml.checkEmpty(fieldElement.getAttribute("description"));
         field.defaultValue = UtilXml.checkEmpty(fieldElement.getAttribute("default-value"));
         field.refField = UtilXml.checkEmpty(fieldElement.getAttribute("ref-field"));
-
+
         tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("prim-key"));
         if (tempStr != null && tempStr.length() > 0) {
             field.isPk = Boolean.parseBoolean(tempStr);

Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelField.java?rev=759232&r1=759231&r2=759232&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelField.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelField.java Fri Mar 27 16:56:23 2009
@@ -44,19 +44,19 @@
 
     /** Free form description of the Field */
     public String description = "";
-
+
     /** Default value for the Field */
     public Object defaultValue = null;
 
     /** boolean which specifies whether or not the Field is a Primary Key */
     public boolean isPk = false;
-
+
     /** boolean which specifies whether or not the Field is ignored */
     public boolean ignored = false;
 
     /** boolean which specifies whether or not the Field is taken from the input file */
     public boolean expression = false;
-
+
     /** Referenced field */
     public String refField = null;
 

Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java?rev=759232&r1=759231&r2=759232&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java Fri Mar 27 16:56:23 2009
@@ -501,7 +501,7 @@
         for (ModelField modelField: modelRecord.fields) {
             String strVal = null;
 
-
+
             try {
                 strVal = line.substring(modelField.position, modelField.position + modelField.length);
             } catch (IndexOutOfBoundsException ioobe) {
@@ -521,7 +521,7 @@
         }
         return record;
     }
-
+
     /**
      * @param line
      * @param lineNum

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=759232&r1=759231&r2=759232&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/RecordIterator.java Fri Mar 27 16:56:23 2009
@@ -33,7 +33,7 @@
  */
 
 public class RecordIterator {
-
+
     public static final String module = RecordIterator.class.getName();
 
     protected BufferedReader br;
@@ -48,7 +48,7 @@
     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;
 
@@ -60,12 +60,12 @@
         }
         this.setupStream(urlStream, fileUrl.toString());
     }
-
+
     public RecordIterator(InputStream dataFileStream, ModelDataFile modelDataFile, String locationInfo) throws DataFileException {
         this.modelDataFile = modelDataFile;
         this.setupStream(dataFileStream, locationInfo);
     }
-
+
     protected void setupStream(InputStream dataFileStream, String locationInfo) throws DataFileException {
         this.locationInfo = locationInfo;
         this.dataFileStream = dataFileStream;
@@ -78,11 +78,11 @@
         // get the line seeded
         this.getNextLine();
     }
-
+
     protected boolean getNextLine() throws DataFileException {
         this.nextLine = null;
         this.nextRecord = null;
-
+
         boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.separatorStyle);
         boolean isFixedLength = ModelDataFile.SEP_FIXED_LENGTH.equals(modelDataFile.separatorStyle);
         boolean isDelimited = ModelDataFile.SEP_DELIMITED.equals(modelDataFile.separatorStyle);
@@ -115,7 +115,7 @@
                 throw new DataFileException("Error reading line #" + nextLineNum + " from location: " + locationInfo, e);
             }
         }
-
+
         if (nextLine != null && !(eof.equals(nextLine.substring(0,1)) && 1 == nextLine.length())) {
             nextLineNum++;
             ModelRecord modelRecord = findModelForLine(nextLine, nextLineNum, modelDataFile);
@@ -130,29 +130,29 @@
             return false;
         }
     }
-
+
     public int getCurrentLineNumber() {
         return this.nextLineNum - 1;
     }
-
+
     public boolean hasNext() {
         return nextLine != null && !(eof.equals(nextLine.substring(0,1)) && 1 == nextLine.length());
-
+
     }
-
+
     public Record next() throws DataFileException {
         if (!hasNext()) {
             return null;
         }
-
+
         if (ModelDataFile.SEP_DELIMITED.equals(modelDataFile.separatorStyle) || ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.separatorStyle) || ModelDataFile.SEP_FIXED_LENGTH.equals(modelDataFile.separatorStyle)) {
             boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.separatorStyle);
             // if (Debug.infoOn()) Debug.logInfo("[DataFile.readDataFile] separatorStyle is " + modelDataFile.separatorStyle + ", isFixedRecord: " + isFixedRecord, module);
-
+
             // advance the line (we have already checked to make sure there is a next line
             this.curLine = this.nextLine;
             this.curRecord = this.nextRecord;
-
+
             // get a new next line
             this.getNextLine();
 
@@ -165,7 +165,7 @@
             if (this.curRecord.getModelRecord().childRecords.size() > 0) {
                 Stack<Record> parentStack = new Stack<Record>();
                 parentStack.push(curRecord);
-
+
                 while (this.nextRecord != null && this.nextRecord.getModelRecord().parentRecord != null) {
                     // if parent equals top parent on stack, add to that parents child list, otherwise pop off parent and try again
                     Record parentRecord = null;
@@ -185,12 +185,12 @@
                     }
 
                     parentRecord.addChildRecord(this.nextRecord);
-
+
                     // if the child record we just added is also a parent, push it onto the stack
                     if (this.nextRecord.getModelRecord().childRecords.size() > 0) {
                         parentStack.push(this.nextRecord);
                     }
-
+
                     // if it can't find a next line it will nextRecord will be null and the loop will break out
                     this.getNextLine();
                 }
@@ -198,7 +198,7 @@
         } else {
             throw new DataFileException("Separator style " + modelDataFile.separatorStyle + " not recognized.");
         }
-
+
         return curRecord;
     }
 
@@ -263,7 +263,7 @@
                 }
             }
         }
-
+
         if (modelRecord == null) {
             throw new DataFileException("Could not find record definition for line " + lineNum + "; first bytes: " +
                     line.substring(0, (line.length() > 5) ? 5 : line.length()));