Skip to content

Commit

Permalink
Remove tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
jodastephen committed Dec 7, 2015
1 parent f5bd8f5 commit e0b01d4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/joda/time/tz/ZoneInfoCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ public void parseDataFile(BufferedReader in, boolean backward) throws IOExceptio
rs.addRule(r);
}
} else if (token.equalsIgnoreCase("Zone")) {
if (st.countTokens() < 4) {
throw new IllegalArgumentException("Attempting to create a Zone from an incomplete tokenizer");
}
if (st.countTokens() < 4) {
throw new IllegalArgumentException("Attempting to create a Zone from an incomplete tokenizer");
}
zone = new Zone(st);
} else if (token.equalsIgnoreCase("Link")) {
String real = st.nextToken();
Expand Down
33 changes: 17 additions & 16 deletions src/test/java/org/joda/time/tz/TestCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ public static TestSuite suite() {
" -8:00 CA P%sT 1967\n" +
" -8:00 US P%sT";

static final String BROKEN_TIMEZONE_FILE =
static final String BROKEN_TIMEZONE_FILE =
"# Incomplete Rules for building America/Los_Angeles time zone.\n" +
"\n" +
"Rule US 1918 1919 - Mar lastSun 2:00 1:00 D\n" +
"Rule \n" ; // this line is intentionally incomplete

static final String BROKEN_TIMEZONE_FILE_2 =
"# Incomplete Zone for building America/Los_Angeles time zone.\n" +
"\n" +
"Rule CA 1948 only - Mar 14 2:00 1:00 D\n" +
"Rule CA 1949 only - Jan 1 2:00 0 S\n" +
"\n" +
"Zone "; // this line is intentionally left incomplete
"# Incomplete Zone for building America/Los_Angeles time zone.\n" +
"\n" +
"Rule CA 1948 only - Mar 14 2:00 1:00 D\n" +
"Rule CA 1949 only - Jan 1 2:00 0 S\n" +
"\n" +
"Zone "; // this line is intentionally left incomplete

private DateTimeZone originalDateTimeZone = null;

Expand Down Expand Up @@ -144,16 +144,17 @@ public void testCompileOnBrokenTimeZoneFile() throws Exception {
assertEquals("Attempting to create a Rule from an incomplete tokenizer", iae.getMessage());
}
}

public void testCompileOnBrokenTimeZoneFile_2() throws Exception {
try {
Provider provider = compileAndLoad(BROKEN_TIMEZONE_FILE_2);
fail();
} catch(NoSuchElementException nsee) {
// This thrown from the Zone constructor
fail("NoSuchElementException was thrown; broken timezone file?");
} catch(IllegalArgumentException iae) {
assertEquals("Attempting to create a Zone from an incomplete tokenizer", iae.getMessage());
}
try {
Provider provider = compileAndLoad(BROKEN_TIMEZONE_FILE_2);
fail();
} catch (NoSuchElementException nsee) {
// This thrown from the Zone constructor
fail("NoSuchElementException was thrown; broken timezone file?");
} catch (IllegalArgumentException iae) {
assertEquals("Attempting to create a Zone from an incomplete tokenizer", iae.getMessage());
}
}

private Provider compileAndLoad(String data) throws Exception {
Expand Down

0 comments on commit e0b01d4

Please sign in to comment.