Skip to content

Commit

Permalink
TFJ-215 geo lat/long are always -1
Browse files Browse the repository at this point in the history
git-svn-id: http://yusuke.homeip.net/svn/twitter4j/trunk@386 117b7e0d-5933-0410-9d29-ab41bb01d86b
  • Loading branch information
yusuke committed Oct 12, 2009
1 parent 9b4e1f5 commit 8c46c67
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/java/twitter4j/Status.java
Expand Up @@ -100,6 +100,10 @@ private void init(Response res, Element elem, Twitter twitter) throws
isFavorited = getChildBoolean("favorited", elem);
inReplyToScreenName = getChildText("in_reply_to_screen_name", elem);
NodeList georssPoint = elem.getElementsByTagName("georss:point");
if(0 == georssPoint.getLength()){
// quick workaround for http://groups.google.com/group/twitter-development-talk/browse_thread/thread/2fb55a05ddead3cf
georssPoint = elem.getElementsByTagName("georss:Point");
}
if(1 == georssPoint.getLength()){
String[] point = georssPoint.item(0).getFirstChild().getNodeValue().split(" ");
latitude = Double.parseDouble(point[0]);
Expand Down
12 changes: 9 additions & 3 deletions src/test/java/twitter4j/TwitterTestUnit.java
Expand Up @@ -284,9 +284,15 @@ public void testRetweetMethods() throws Exception {

public void testGeoLocation() throws Exception{
Status withgeo2 = twitterAPI1.updateStatus("with geo",12.3456,-34.5678);
// not yet available
// assertEquals(12.3456, withgeo2.getLatitude());
// assertEquals(-34.5678, withgeo2.getLongitude());
if(withgeo2.getUser().isGeoEnabled()){
assertEquals(12.3456, withgeo2.getLatitude());
assertEquals(-34.5678, withgeo2.getLongitude());
}

withgeo2 = twitterAPI1.showStatus(4512367904l);
assertEquals(37.780300, withgeo2.getLatitude());
assertEquals(-122.396900, withgeo2.getLongitude());
assertTrue(withgeo2.getUser().isGeoEnabled());

HttpClient client = new HttpClient();
Status nogeo = new Status(client.get("http://yusuke.homeip.net/twitter4j/en/status-nogeo.xml"),new Twitter());
Expand Down

0 comments on commit 8c46c67

Please sign in to comment.