Skip to content

Commit

Permalink
[Truffle] Fix warnings in TimeNodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Nov 21, 2016
1 parent 6728bbe commit 00a1066
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions truffle/src/main/java/org/jruby/truffle/core/time/TimeNodes.java
Expand Up @@ -672,23 +672,24 @@ public static String getShortZoneName(ZonedDateTime dateTime, ZoneId zone) {
}

@TruffleBoundary(throwsControlFlowException = true)
public static TimeZoneAndName parse(RubyNode node, String zone) {
public static TimeZoneAndName parse(RubyNode node, String zoneString) {
String zone = zoneString;
String upZone = zone.toUpperCase(Locale.ENGLISH);

Matcher tzMatcher = TZ_PATTERN.matcher(zone);
if (tzMatcher.matches()) {
String zoneName = tzMatcher.group(1);
String name = tzMatcher.group(1);
String sign = tzMatcher.group(2);
String hours = tzMatcher.group(3);
String minutes = tzMatcher.group(4);
String seconds = tzMatcher.group(5);

if (zoneName == null) {
zoneName = "";
if (name == null) {
name = "";
}

// Sign is reversed in legacy TZ notation
return getTimeZoneFromHHMM(node, zoneName, sign.equals("-"), hours, minutes, seconds);
return getTimeZoneFromHHMM(node, name, sign.equals("-"), hours, minutes, seconds);
} else {
if (LONG_TZNAME.containsKey(upZone)) {
zone = LONG_TZNAME.get(upZone);
Expand Down

0 comments on commit 00a1066

Please sign in to comment.