Skip to content

Commit cbcfb72

Browse files
committed
Upgrading to Java 5
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1199845 13f79535-47bb-0310-9956-ffa450edef68
1 parent cb99634 commit cbcfb72

4 files changed

Lines changed: 33 additions & 55 deletions

File tree

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
<properties>
6262
<commons.componentid>csv</commons.componentid>
6363
<commons.jira.componentid>12311182</commons.jira.componentid>
64+
<maven.compile.source>1.5</maven.compile.source>
65+
<maven.compile.target>1.5</maven.compile.target>
6466
</properties>
6567

6668
<reporting>

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class CSVParser {
7979
/**
8080
* A record buffer for getLine(). Grows as necessary and is reused.
8181
*/
82-
private final List record = new ArrayList();
82+
private final List<String> record = new ArrayList<String>();
8383
private final Token reusableToken = new Token();
8484
private final CharBuffer wsBuf = new CharBuffer();
8585
private final CharBuffer code = new CharBuffer(4);
@@ -152,7 +152,7 @@ public CSVParser(Reader input, CSVFormat format) {
152152
* @throws IOException on parse error or input read-failure
153153
*/
154154
public String[][] getAllValues() throws IOException {
155-
List records = new ArrayList();
155+
List<String[]> records = new ArrayList<String[]>();
156156
String[] values;
157157
String[][] ret = null;
158158
while ((values = getLine()) != null) {

src/main/java/org/apache/commons/csv/CSVPrinter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public void flush() throws IOException {
7474
* @param values values to be outputted.
7575
*/
7676
public void println(String[] values) throws IOException {
77-
for (int i = 0; i < values.length; i++) {
78-
print(values[i]);
77+
for (String value : values) {
78+
print(value);
7979
}
8080
println();
8181
}

src/main/java/org/apache/commons/csv/writer/CSVConfig.java

Lines changed: 27 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -32,72 +32,48 @@
3232
*/
3333
public class CSVConfig {
3434

35-
/**
36-
* specifies if it is a fixed width csv file *
37-
*/
35+
/** specifies if it is a fixed width csv file */
3836
private boolean fixedWidth;
39-
/**
40-
* list of fields *
41-
*/
42-
private List fields;
37+
38+
/** list of fields */
39+
private List<CSVField> fields;
4340

44-
/**
45-
* Do no do any filling *
46-
*/
41+
/** Do no do any filling */
4742
public static final int FILLNONE = 0;
48-
/**
49-
* Fill content the the left. Mainly usable together with fixedWidth *
50-
*/
43+
44+
/** Fill content the the left. Mainly usable together with fixedWidth */
5145
public static final int FILLLEFT = 1;
52-
/**
53-
* Fill content to the right. Mainly usable together with fixedWidth *
54-
*/
46+
47+
/** Fill content to the right. Mainly usable together with fixedWidth */
5548
public static final int FILLRIGHT = 2;
5649

57-
/**
58-
* The fill pattern
59-
*/
50+
/** The fill pattern */
6051
private int fill;
61-
/**
62-
* The fill char. Defaults to a space
63-
*/
52+
53+
/** The fill char. Defaults to a space */
6454
private char fillChar = ' ';
65-
/**
66-
* The seperator character. Defaults to ,
67-
*/
55+
56+
/** The seperator character. Defaults to ,*/
6857
private char delimiter = ',';
69-
/**
70-
* The row separator. Defaults to \n
71-
*/
58+
59+
/** The row separator. Defaults to \n */
7260
private String rowDelimiter = "\n";
73-
/**
74-
* Should we ignore the delimiter. Defaults to false
75-
*/
61+
62+
/** Should we ignore the delimiter. Defaults to false */
7663
private boolean ignoreDelimiter = false;
77-
/**
78-
* the value delimiter. Defaults to "
79-
*/
64+
65+
/** the value delimiter. Defaults to " */
8066
private char valueDelimiter = '"';
81-
/**
82-
* Should we ignore the value delimiter. Defaults to true
83-
*/
67+
68+
/** Should we ignore the value delimiter. Defaults to true */
8469
private boolean ignoreValueDelimiter = true;
85-
/**
86-
* Specifies if we want to use a field header
87-
*/
70+
71+
/** Specifies if we want to use a field header */
8872
private boolean fieldHeader = false;
89-
/**
90-
* Specifies if the end of the line needs to be trimmed
91-
*/
73+
74+
/** Specifies if the end of the line needs to be trimmed */
9275
private boolean endTrimmed = false;
9376

94-
/**
95-
*
96-
*/
97-
public CSVConfig() {
98-
super();
99-
}
100-
10177
/**
10278
* @return if the CSV file is fixedWidth
10379
*/
@@ -117,7 +93,7 @@ public void setFixedWidth(boolean fixedWidth) {
11793

11894
public void addField(CSVField field) {
11995
if (fields == null) {
120-
fields = new ArrayList();
96+
fields = new ArrayList<CSVField>();
12197
}
12298
fields.add(field);
12399
}

0 commit comments

Comments
 (0)