From ffc76b7951bde6900d9a42899dbb43738dd7e509 Mon Sep 17 00:00:00 2001 From: jihye kim Date: Tue, 10 Apr 2012 21:36:17 +0900 Subject: [PATCH] [Title] modify checking google map [Type] bug fix [Module] event injector [Priority] major [Jira#] N_SE-492 [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- .../src/org/tizen/location/map/page/MapImage.java | 35 +++++++++++++++++++--- package/pkginfo.manifest | 4 +-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java b/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java index fa9328b..7007bbe 100644 --- a/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java +++ b/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java @@ -27,10 +27,13 @@ package org.tizen.location.map.page; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; +import java.util.List; //import java.util.ArrayList; //import java.util.List; @@ -115,15 +118,39 @@ public class MapImage extends AbstractInjectorPage { URL url = new URL("http://www.google.com"); //open a connection to that source - HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection(); - + HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection(); //trying to retrieve data from the source. If there //is no connection, this line will fail - Object objData = urlConnect.getContent(); + urlConnect.connect(); + + // parsing title + BufferedReader in = new BufferedReader (new InputStreamReader(urlConnect.getInputStream())); + String line; + boolean isLoading = false; + String title = ""; + while((line = in.readLine()) != null) { + if (line.contains(title)) { + int s = line.indexOf(title); + int e = line.indexOf(""); + line = line.substring(s + title.length(), e); + line = line.toLowerCase(); + if (line.contains("google")) { + isLoading = true; + } + break; + } + } + in.close(); + + if (!isLoading) { + this.googleMapScript = "



" + + "
Failed to load the map.
Please check the network status!
"; + return; + } urlConnect.disconnect(); } catch (UnknownHostException e) { // TODO Auto-generated catch block - e.printStackTrace(); + //e.printStackTrace(); this.googleMapScript = "



Can't connect to network.
"; return; } diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index f3dc4c9..d3c7f40 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,5 +1,5 @@ Package:eventinjector-eplugin -Version:0.2.13 +Version:0.2.14 OS:linux Build-host-os:linux Maintainer:yeongkyoon Lee , sungmin Ha @@ -9,7 +9,7 @@ Install-dependency:common-eplugin[linux], base-ide-product[linux] Source:eventinjector-eplugin Package:eventinjector-eplugin -Version:0.2.13 +Version:0.2.14 OS:windows Build-host-os:linux Maintainer:yeongkyoon Lee , sungmin Ha -- 2.7.4