From 3f963b511f3c5344ba3ebd58148df8f31bf6c9a4 Mon Sep 17 00:00:00 2001 From: Robin Schneider Date: Tue, 23 Jul 2013 22:48:30 +0200 Subject: [PATCH] Fixed problem with OpeningHoursParser. The parser did not distinguish between "off" (valid in opening_hours) and "of". --- AUTHORS.MIT | 3 ++- .../src/net/osmand/util/OpeningHoursParser.java | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/AUTHORS.MIT b/AUTHORS.MIT index 456262e853..d2162dfcec 100644 --- a/AUTHORS.MIT +++ b/AUTHORS.MIT @@ -1,3 +1,4 @@ -Authors of patches and pull requests : +Authors of patches and pull requests: Hardy Mueller +Robin `ypid` Schneider diff --git a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java index 729835ea58..6cc7cbd014 100644 --- a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java +++ b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java @@ -468,7 +468,7 @@ public class OpeningHoursParser { // time starts break; } - if (ch == 'o' && r.charAt(k+1) == 'f' && r.charAt(k+1) == 'f'){ + if (r.substring(k, k + 2).equals("off")) { // value "off" is found break; } @@ -584,18 +584,18 @@ public class OpeningHoursParser { if(i1 == -1) { // if no minutes are given, try complete value as hour startHour = Integer.parseInt(stEnd[0].trim()); - startMin = 0; + startMin = 0; } else { startHour = Integer.parseInt(stEnd[0].substring(0, i1).trim()); - startMin = Integer.parseInt(stEnd[0].substring(i1 + 1).trim()); + startMin = Integer.parseInt(stEnd[0].substring(i1 + 1).trim()); } if(i2 == -1) { // if no minutes are given, try complete value as hour endHour = Integer.parseInt(stEnd[1].trim()); - endMin = 0; + endMin = 0; } else { endHour = Integer.parseInt(stEnd[1].substring(0, i2).trim()); - endMin = Integer.parseInt(stEnd[1].substring(i2 + 1).trim()); + endMin = Integer.parseInt(stEnd[1].substring(i2 + 1).trim()); } st = startHour * 60 + startMin; end = endHour * 60 + endMin;