basilv/EnvGen — Issue #2: Allow comments without commas
Author: basilv
Created: 2011-12-18 22:07:22+00:00
State: open

EnvGen complains if you throw comments in that don’t have any commas, because it checks the number of columns before checking whether the row is a comment… A patch like this might make it more intuitive by checking for comment first…

diff -ru src/java/com/basilv/envgen/EnvironmentPropertiesLoader.java src-b/java/com/basilv/envgen/EnvironmentPropertiesLoader.java
--- src/java/com/basilv/envgen/EnvironmentPropertiesLoader.java 2009-02-03 21:05:00.000000000 -0700
+++ src-b/java/com/basilv/envgen/EnvironmentPropertiesLoader.java 2011-04-11 10:32:26.312500000 -0600
@@ -39,6 +39,10 @@
int rowNumber = FIRST_ROW; // Indexed from one.
while (reader.readRecord()) {
int columnCount = reader.getColumnCount();
+ String propertyName = reader.get(0);
+ if (isComment(propertyName)) {
+ continue;
+ }
Assert.isTrue("Must have at least two columns - one for the property name " +
"and one row per environment for the property value.", columnCount > 1);
if (rowNumber == FIRST_ROW) {
@@ -46,10 +50,6 @@
envProps = new EnvironmentProperties(envCount);
}

- String propertyName = reader.get(0);
- if (isComment(propertyName)) {
- continue;
- }

for (int column = 1; column < columnCount; column++) {
int environment = column - 1;