[Swift-commit] r3414 - trunk/src/org/griphyn/vdl/mapping/file
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Tue Jun 29 13:57:28 CDT 2010
Author: wozniak
Date: 2010-06-29 13:57:28 -0500 (Tue, 29 Jun 2010)
New Revision: 3414
Modified:
trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java
Log:
Probable bug fix to CSVMapper
Modified: trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java 2010-06-24 20:37:31 UTC (rev 3413)
+++ trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java 2010-06-29 18:57:28 UTC (rev 3414)
@@ -14,7 +14,10 @@
import org.griphyn.vdl.mapping.AbsFile;
import org.griphyn.vdl.mapping.AbstractMapper;
+import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.GeneralizedFileFormat;
import org.griphyn.vdl.mapping.InvalidMappingParameterException;
+import org.griphyn.vdl.mapping.Mapper;
import org.griphyn.vdl.mapping.MappingParam;
import org.griphyn.vdl.mapping.Path;
import org.griphyn.vdl.mapping.PhysicalFormat;
@@ -61,13 +64,16 @@
if (read) {
return;
}
- String file = PARAM_FILE.getStringValue(this);
+
+ String file = getCSVFile();
+
String delim = PARAM_DELIMITER.getStringValue(this);
String hdelim = PARAM_HDELIMITER.getStringValue(this);
boolean header = PARAM_HEADER.getBooleanValue(this);
int skip = PARAM_SKIP.getIntValue(this);
try {
- BufferedReader br = new BufferedReader(new FileReader(file));
+ BufferedReader br =
+ new BufferedReader(new FileReader(file));
String line;
StringTokenizer st;
@@ -78,10 +84,6 @@
int ix = 0;
while (st.hasMoreTokens()) {
String column = st.nextToken();
- // TODO PMD reports this for the
- // following line:
- // An operation on an Immutable object (String, BigDecimal or BigInteger) won't change the object itself
- // This is likely a bug
column.replaceAll("\\s", "_");
cols.add(column);
colindex.put(column, new Integer(ix));
@@ -127,7 +129,19 @@
}
}
- public Collection existing() {
+ private String getCSVFile() {
+ String result = null;
+ Object object = PARAM_FILE.getRawValue(this);
+ DSHandle handle = (DSHandle) object;
+ Mapper mapper = handle.getMapper();
+ PhysicalFormat format = mapper.map(Path.EMPTY_PATH);
+ GeneralizedFileFormat fileFormat =
+ (GeneralizedFileFormat) format;
+ result = fileFormat.getPath();
+ return result;
+ }
+
+ public Collection existing() {
readFile();
List l = new ArrayList();
Iterator itl = content.iterator();
More information about the Swift-commit
mailing list