Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

reformat everything

  • Loading branch information...
commit f45b5de841c9552328efcebbac0b593c5b3dcf85 1 parent 56e9bd0
@yusuke authored
Showing with 1,110 additions and 1,381 deletions.
  1. +2 −1  pom.xml
  2. +2 −1  twitter4j-appengine/pom.xml
  3. +2 −12 twitter4j-appengine/src/main/java/twitter4j/internal/http/alternative/AppEngineHttpResponseImpl.java
  4. +1 −6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyAccountSettings.java
  5. +1 −5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyDirectMessage.java
  6. +4 −4 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyPagableResponseList.java
  7. +1 −5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyPlace.java
  8. +1 −5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyQueryResult.java
  9. +1 −6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyRelatedResults.java
  10. +3 −2 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyResponseList.java
  11. +2 −6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazySimilarPlaces.java
  12. +1 −6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyTrends.java
  13. +1 −5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyTwitterAPIConfiguration.java
  14. +1 −5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyUser.java
  15. +1 −5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyUserList.java
  16. +2 −1  twitter4j-async/pom.xml
  17. +1 −1  twitter4j-async/src/main/java/twitter4j/api/FavoriteMethodsAsync.java
  18. +6 −6 twitter4j-async/src/main/java/twitter4j/api/ListMethodsAsync.java
  19. +2 −1  twitter4j-core/pom.xml
  20. +1 −5 twitter4j-core/src/main/java/twitter4j/Annotation.java
  21. +2 −2 twitter4j-core/src/main/java/twitter4j/GeoLocation.java
  22. +1 −1  twitter4j-core/src/main/java/twitter4j/ProfileImage.java
  23. +10 −10 twitter4j-core/src/main/java/twitter4j/StatusUpdate.java
  24. +1 −6 twitter4j-core/src/main/java/twitter4j/TwitterAPIMonitor.java
  25. +1 −5 twitter4j-core/src/main/java/twitter4j/api/AccountMethods.java
  26. +3 −3 twitter4j-core/src/main/java/twitter4j/api/FavoriteMethods.java
  27. +1 −6 twitter4j-core/src/main/java/twitter4j/api/FriendshipMethods.java
  28. +1 −6 twitter4j-core/src/main/java/twitter4j/api/GeoMethods.java
  29. +11 −16 twitter4j-core/src/main/java/twitter4j/api/ListMethods.java
  30. +1 −5 twitter4j-core/src/main/java/twitter4j/api/LocalTrendsMethods.java
  31. +1 −1  twitter4j-core/src/main/java/twitter4j/api/StatusMethods.java
  32. +1 −6 twitter4j-core/src/main/java/twitter4j/api/UserMethods.java
  33. +2 −2 twitter4j-core/src/main/java/twitter4j/auth/AccessToken.java
  34. +1 −6 twitter4j-core/src/main/java/twitter4j/conf/PropertyConfiguration.java
  35. +1 −5 twitter4j-core/src/main/java/twitter4j/internal/http/HttpClientWrapper.java
  36. +1 −5 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponse.java
  37. +2 −2 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponseListener.java
  38. +1 −1  twitter4j-core/src/main/java/twitter4j/internal/logging/Logger.java
  39. +85 −74 twitter4j-core/src/main/java/twitter4j/internal/org/json/CDL.java
  40. +18 −13 twitter4j-core/src/main/java/twitter4j/internal/org/json/Cookie.java
  41. +9 −6 twitter4j-core/src/main/java/twitter4j/internal/org/json/CookieList.java
  42. +15 −10 twitter4j-core/src/main/java/twitter4j/internal/org/json/HTTP.java
  43. +7 −4 twitter4j-core/src/main/java/twitter4j/internal/org/json/HTTPTokener.java
  44. +1 −1  twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONArray.java
  45. +4 −2 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONException.java
  46. +306 −298 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONML.java
  47. +3 −10 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONObject.java
  48. +12 −11 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONString.java
  49. +5 −3 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONStringer.java
  50. +123 −120 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONTokener.java
  51. +127 −101 twitter4j-core/src/main/java/twitter4j/internal/org/json/XML.java
  52. +196 −188 twitter4j-core/src/main/java/twitter4j/internal/org/json/XMLTokener.java
  53. +1 −5 twitter4j-core/src/main/java/twitter4j/internal/util/z_T4JInternalParseUtil.java
  54. +1 −1  twitter4j-core/src/test/java/twitter4j/FriendsFollowersTest.java
  55. +5 −5 twitter4j-core/src/test/java/twitter4j/StatusMethodsTest.java
  56. +0 −1  twitter4j-core/src/test/java/twitter4j/TimelineMethodsTest.java
  57. +3 −15 twitter4j-core/src/test/java/twitter4j/auth/OAuthTest.java
  58. +4 −6 twitter4j-core/src/test/java/twitter4j/internal/KryoSerializationTest.java
  59. +10 −13 twitter4j-core/src/test/java/twitter4j/internal/org/json/Test.java
  60. +2 −2 twitter4j-core/src/test/java/twitter4j/internal/util/ParseUtilTest.java
  61. +1 −1  twitter4j-core/src/test/java/twitter4j/internal/util/StringUtilTest.java
  62. +29 −29 twitter4j-examples/bin/logback.xml
  63. +2 −1  twitter4j-examples/pom.xml
  64. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/account/GetAccountSettings.java
  65. +1 −1  twitter4j-examples/src/main/java/twitter4j/examples/async/AsyncUpdate.java
  66. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/directmessage/GetDirectMessages.java
  67. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/directmessage/GetSentDirectMessages.java
  68. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/friendship/LookupFriendships.java
  69. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/geo/CreatePlace.java
  70. +1 −6 twitter4j-examples/src/main/java/twitter4j/examples/geo/GetSimilarPlaces.java
  71. +1 −7 twitter4j-examples/src/main/java/twitter4j/examples/geo/ReverseGeoCode.java
  72. +1 −7 twitter4j-examples/src/main/java/twitter4j/examples/geo/SearchPlaces.java
  73. +1 −6 twitter4j-examples/src/main/java/twitter4j/examples/json/LoadRawJSON.java
  74. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/json/SaveRawJSON.java
  75. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/list/GetAllUserLists.java
  76. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/list/GetUserListMemberships.java
  77. +1 −6 twitter4j-examples/src/main/java/twitter4j/examples/list/GetUserListStatuses.java
  78. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/list/GetUserListSubscriptions.java
  79. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/list/GetUserLists.java
  80. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/listmembers/GetUserListMembers.java
  81. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/listmembers/ShowUserListMembership.java
  82. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/listsubscribers/GetUserListSubscribers.java
  83. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/listsubscribers/ShowUserListSubscription.java
  84. +1 −8 twitter4j-examples/src/main/java/twitter4j/examples/oauth/GetAccessToken.java
  85. +1 −6 twitter4j-examples/src/main/java/twitter4j/examples/search/SearchTweets.java
  86. +1 −7 twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintFilterStream.java
  87. +1 −6 twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintFirehoseStream.java
  88. +1 −7 twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintLinksStream.java
  89. +1 −7 twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintRetweetStream.java
  90. +1 −7 twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintSampleStream.java
  91. +1 −9 twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintSiteStreams.java
  92. +1 −9 twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintUserStream.java
  93. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetHomeTimeline.java
  94. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetMentions.java
  95. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetRetweetedByMe.java
  96. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetRetweetedByUser.java
  97. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetRetweetedToMe.java
  98. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetRetweetedToUser.java
  99. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetRetweetsOfMe.java
  100. +1 −6 twitter4j-examples/src/main/java/twitter4j/examples/trends/GetAvailableTrends.java
  101. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/trends/GetDailyTrends.java
  102. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/trends/GetLocationTrends.java
  103. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/trends/GetWeeklyTrends.java
  104. +2 −7 twitter4j-examples/src/main/java/twitter4j/examples/tweets/GetRetweetedBy.java
  105. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/tweets/GetRetweetedByIds.java
  106. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/user/GetMemberSuggestions.java
  107. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/user/GetSuggestedUserCategories.java
  108. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/user/GetUserSuggestions.java
  109. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/user/LookupUsers.java
  110. +1 −5 twitter4j-examples/src/main/java/twitter4j/examples/user/SearchUsers.java
  111. +2 −1  twitter4j-httpclient-support/pom.xml
  112. +2 −1  twitter4j-media-support/pom.xml
  113. +2 −2 twitter4j-media-support/src/main/java/twitter4j/media/ImageUploadFactory.java
  114. +2 −1  twitter4j-stream/pom.xml
  115. +4 −4 twitter4j-stream/src/main/java/twitter4j/SiteStreamsImpl.java
  116. +1 −1  twitter4j-stream/src/test/java/twitter4j/SiteStreamsTest.java
  117. +2 −13 twitter4j-stream/src/test/java/twitter4j/internal/json/DAOTest.java
View
3  pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j</artifactId>
View
3  twitter4j-appengine/pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.twitter4j</groupId>
View
14 ...ppengine/src/main/java/twitter4j/internal/http/alternative/AppEngineHttpResponseImpl.java
@@ -26,18 +26,8 @@
import twitter4j.internal.org.json.JSONArray;
import twitter4j.internal.org.json.JSONObject;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.Locale;
+import java.io.*;
+import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.zip.GZIPInputStream;
View
7 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyAccountSettings.java
@@ -16,12 +16,7 @@
package twitter4j.internal.json;
-import twitter4j.AccountSettings;
-import twitter4j.Location;
-import twitter4j.RateLimitStatus;
-import twitter4j.TimeZone;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
+import twitter4j.*;
import javax.annotation.Generated;
View
6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyDirectMessage.java
@@ -16,11 +16,7 @@
package twitter4j.internal.json;
-import twitter4j.DirectMessage;
-import twitter4j.RateLimitStatus;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
-import twitter4j.User;
+import twitter4j.*;
import javax.annotation.Generated;
import java.util.Date;
View
8 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyPagableResponseList.java
@@ -24,19 +24,19 @@
*/
abstract class LazyPagableResponseList<T extends TwitterResponse> extends LazyResponseList<T> implements PagableResponseList<T> {
public boolean hasPrevious() {
- return ((PagableResponseList)getTarget()).hasPrevious();
+ return ((PagableResponseList) getTarget()).hasPrevious();
}
public long getPreviousCursor() {
- return ((PagableResponseList)getTarget()).getPreviousCursor();
+ return ((PagableResponseList) getTarget()).getPreviousCursor();
}
public boolean hasNext() {
- return ((PagableResponseList)getTarget()).hasNext();
+ return ((PagableResponseList) getTarget()).hasNext();
}
public long getNextCursor() {
- return ((PagableResponseList)getTarget()).getNextCursor();
+ return ((PagableResponseList) getTarget()).getNextCursor();
}
}
View
6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyPlace.java
@@ -1,10 +1,6 @@
package twitter4j.internal.json;
-import twitter4j.GeoLocation;
-import twitter4j.Place;
-import twitter4j.RateLimitStatus;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
+import twitter4j.*;
import javax.annotation.Generated;
View
6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyQueryResult.java
@@ -16,11 +16,7 @@
package twitter4j.internal.json;
-import twitter4j.Query;
-import twitter4j.QueryResult;
-import twitter4j.Tweet;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
+import twitter4j.*;
import java.util.List;
View
7 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyRelatedResults.java
@@ -16,12 +16,7 @@
package twitter4j.internal.json;
-import twitter4j.RateLimitStatus;
-import twitter4j.RelatedResults;
-import twitter4j.ResponseList;
-import twitter4j.Status;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
+import twitter4j.*;
import javax.annotation.Generated;
View
5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyResponseList.java
@@ -31,11 +31,12 @@
*/
abstract class LazyResponseList<T> implements ResponseList<T> {
ResponseList<T> target = null;
- LazyResponseList(){
+
+ LazyResponseList() {
}
protected ResponseList<T> getTarget() {
- if(target == null){
+ if (target == null) {
try {
target = createActualResponseList();
} catch (TwitterException e) {
View
8 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazySimilarPlaces.java
@@ -17,11 +17,7 @@
// generated with generate-lazy-objects.sh
package twitter4j.internal.json;
-import twitter4j.GeoLocation;
-import twitter4j.Place;
-import twitter4j.ResponseList;
-import twitter4j.SimilarPlaces;
-import twitter4j.TwitterException;
+import twitter4j.*;
/**
* @author Yusuke Yamamoto - yusuke at mac.com
@@ -47,7 +43,7 @@
* @return token the token needed to be able to create a new place with {@link twitter4j.api.GeoMethods#createPlace(String, String, String, GeoLocation, String)}
*/
public String getToken() {
- return ((SimilarPlaces)getTarget()).getToken();
+ return ((SimilarPlaces) getTarget()).getToken();
}
@Override
View
7 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyTrends.java
@@ -16,12 +16,7 @@
package twitter4j.internal.json;
-import twitter4j.Location;
-import twitter4j.RateLimitStatus;
-import twitter4j.Trend;
-import twitter4j.Trends;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
+import twitter4j.*;
import javax.annotation.Generated;
import java.util.Date;
View
6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyTwitterAPIConfiguration.java
@@ -15,11 +15,7 @@
*/
package twitter4j.internal.json;
-import twitter4j.MediaEntity;
-import twitter4j.RateLimitStatus;
-import twitter4j.TwitterAPIConfiguration;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
+import twitter4j.*;
import javax.annotation.Generated;
import java.util.Map;
View
6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyUser.java
@@ -16,11 +16,7 @@
package twitter4j.internal.json;
-import twitter4j.RateLimitStatus;
-import twitter4j.Status;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
-import twitter4j.User;
+import twitter4j.*;
import javax.annotation.Generated;
import java.net.URL;
View
6 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyUserList.java
@@ -16,11 +16,7 @@
package twitter4j.internal.json;
-import twitter4j.RateLimitStatus;
-import twitter4j.TwitterException;
-import twitter4j.TwitterRuntimeException;
-import twitter4j.User;
-import twitter4j.UserList;
+import twitter4j.*;
import javax.annotation.Generated;
import java.net.URI;
View
3  twitter4j-async/pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.twitter4j</groupId>
View
2  twitter4j-async/src/main/java/twitter4j/api/FavoriteMethodsAsync.java
@@ -76,7 +76,7 @@
* Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
* <br>This method calls http://api.twitter.com/1/favorites/[id].json
*
- * @param id the ID or screen name of the user for whom to request a list of favorite statuses
+ * @param id the ID or screen name of the user for whom to request a list of favorite statuses
* @param paging controls pagination. Supports sinceId and page parameters.
* @see <a href="https://dev.twitter.com/docs/api/1/get/favorites">GET favorites | Twitter Developers</a>
* @since Twitter4J 2.2.5
View
12 twitter4j-async/src/main/java/twitter4j/api/ListMethodsAsync.java
@@ -115,8 +115,8 @@
* List the lists the specified user has been added to.
* <br>This method calls http://api.twitter.com/1/lists/memberships.json
*
- * @param listMemberId The id of the list member
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
+ * @param listMemberId The id of the list member
+ * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/memberships">GET lists/memberships | Twitter Developers</a>
* @since Twitter4J 2.2.4
*/
@@ -137,9 +137,9 @@
* List the lists the specified user has been added to.
* <br>This method calls http://api.twitter.com/1/lists/memberships.json
*
- * @param listMemberId The id of the list member
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @param filterToOwnedLists Whether to return just lists the authenticating user owns, and the user represented by listMemberScreenName is a member of.
+ * @param listMemberId The id of the list member
+ * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
+ * @param filterToOwnedLists Whether to return just lists the authenticating user owns, and the user represented by listMemberScreenName is a member of.
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/memberships">GET lists/memberships | Twitter Developers</a>
* @since Twitter4J 2.2.4
*/
@@ -150,7 +150,7 @@
* <br>This method calls http://api.twitter.com/1/lists/memberships.json
*
* @param listMemberScreenName The screen name of the list member
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
+ * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
* @param filterToOwnedLists Whether to return just lists the authenticating user owns, and the user represented by listMemberScreenName is a member of.
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/memberships">GET lists/memberships | Twitter Developers</a>
* @since Twitter4J 2.2.4
View
3  twitter4j-core/pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.twitter4j</groupId>
View
6 twitter4j-core/src/main/java/twitter4j/Annotation.java
@@ -19,11 +19,7 @@
import twitter4j.internal.org.json.JSONException;
import twitter4j.internal.org.json.JSONObject;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.*;
/**
* A data class representing an Annotation of a Status or a Tweet
View
4 twitter4j-core/src/main/java/twitter4j/GeoLocation.java
@@ -37,10 +37,10 @@ public GeoLocation(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
-
+
/* For serialization purposes only. */
/* package */ GeoLocation() {
-
+
}
/**
View
2  twitter4j-core/src/main/java/twitter4j/ProfileImage.java
@@ -28,7 +28,7 @@
ImageSize MINI = ImageSize.mini;
ImageSize ORIGINAL = ImageSize.original;
- enum ImageSize{
+ enum ImageSize {
bigger, normal, mini, original
}
}
View
20 twitter4j-core/src/main/java/twitter4j/StatusUpdate.java
@@ -104,14 +104,14 @@ public StatusUpdate displayCoordinates(boolean displayCoordinates) {
/**
* @since Twitter4J 2.2.5
*/
- public void setMedia(File file){
+ public void setMedia(File file) {
this.mediaFile = file;
}
/**
* @since Twitter4J 2.2.5
*/
- public StatusUpdate media(File file){
+ public StatusUpdate media(File file) {
setMedia(file);
return this;
}
@@ -119,19 +119,19 @@ public StatusUpdate media(File file){
/**
* @since Twitter4J 2.2.5
*/
- public void setMedia(String name, InputStream body){
+ public void setMedia(String name, InputStream body) {
this.mediaName = name;
this.mediaBody = body;
}
- /*package*/ boolean isWithMedia(){
+ /*package*/ boolean isWithMedia() {
return mediaFile != null || mediaName != null;
}
/**
* @since Twitter4J 2.2.5
*/
- public StatusUpdate media(String name, InputStream body){
+ public StatusUpdate media(String name, InputStream body) {
setMedia(name, body);
return this;
}
@@ -139,14 +139,14 @@ public StatusUpdate media(String name, InputStream body){
/**
* @since Twitter4J 2.2.5
*/
- public void setPossiblySensitive(boolean possiblySensitive){
+ public void setPossiblySensitive(boolean possiblySensitive) {
this.possiblySensitive = possiblySensitive;
}
/**
* @since Twitter4J 2.2.5
*/
- public StatusUpdate possiblySensitive(boolean possiblySensitive){
+ public StatusUpdate possiblySensitive(boolean possiblySensitive) {
setPossiblySensitive(possiblySensitive);
return this;
}
@@ -154,7 +154,7 @@ public StatusUpdate possiblySensitive(boolean possiblySensitive){
/**
* @since Twitter4J 2.2.5
*/
- public boolean isPossiblySensitive(){
+ public boolean isPossiblySensitive() {
return possiblySensitive;
}
@@ -202,10 +202,10 @@ public StatusUpdate annotation(Annotation annotation) {
appendParameter("annotations", annotations.asParameterValue(), params);
}
params.add(includeEntities);
- if(null != mediaFile){
+ if (null != mediaFile) {
params.add(new HttpParameter("media[]", mediaFile));
params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
- }else if(mediaName != null && mediaBody != null){
+ } else if (mediaName != null && mediaBody != null) {
params.add(new HttpParameter("media[]", mediaName, mediaBody));
params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
}
View
7 twitter4j-core/src/main/java/twitter4j/TwitterAPIMonitor.java
@@ -21,12 +21,7 @@
import twitter4j.management.APIStatisticsMBean;
import twitter4j.management.APIStatisticsOpenMBean;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.NotCompliantMBeanException;
-import javax.management.ObjectName;
+import javax.management.*;
import java.lang.management.ManagementFactory;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
View
6 twitter4j-core/src/main/java/twitter4j/api/AccountMethods.java
@@ -16,11 +16,7 @@
package twitter4j.api;
-import twitter4j.AccountSettings;
-import twitter4j.AccountTotals;
-import twitter4j.RateLimitStatus;
-import twitter4j.TwitterException;
-import twitter4j.User;
+import twitter4j.*;
import java.io.File;
import java.io.InputStream;
View
6 twitter4j-core/src/main/java/twitter4j/api/FavoriteMethods.java
@@ -75,7 +75,7 @@
*/
ResponseList<Status> getFavorites(String id, int page)
throws TwitterException;
-
+
/**
* Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
* <br>This method calls http://api.twitter.com/1/favorites.json
@@ -88,12 +88,12 @@
*/
ResponseList<Status> getFavorites(Paging paging)
throws TwitterException;
-
+
/**
* Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
* <br>This method calls http://api.twitter.com/1/favorites/[id].json
*
- * @param id the ID or screen name of the user for whom to request a list of favorite statuses
+ * @param id the ID or screen name of the user for whom to request a list of favorite statuses
* @param paging controls pagination. Supports sinceId and page parameters.
* @return ResponseList<Status>
* @throws TwitterException when Twitter service or network is unavailable
View
7 twitter4j-core/src/main/java/twitter4j/api/FriendshipMethods.java
@@ -16,12 +16,7 @@
package twitter4j.api;
-import twitter4j.Friendship;
-import twitter4j.IDs;
-import twitter4j.Relationship;
-import twitter4j.ResponseList;
-import twitter4j.TwitterException;
-import twitter4j.User;
+import twitter4j.*;
/**
* @author Joern Huxhorn - jhuxhorn at googlemail.com
View
7 twitter4j-core/src/main/java/twitter4j/api/GeoMethods.java
@@ -16,12 +16,7 @@
package twitter4j.api;
-import twitter4j.GeoLocation;
-import twitter4j.GeoQuery;
-import twitter4j.Place;
-import twitter4j.ResponseList;
-import twitter4j.SimilarPlaces;
-import twitter4j.TwitterException;
+import twitter4j.*;
/**
* @author Yusuke Yamamoto - yusuke at mac.com
View
27 twitter4j-core/src/main/java/twitter4j/api/ListMethods.java
@@ -16,12 +16,7 @@
package twitter4j.api;
-import twitter4j.PagableResponseList;
-import twitter4j.Paging;
-import twitter4j.ResponseList;
-import twitter4j.Status;
-import twitter4j.TwitterException;
-import twitter4j.UserList;
+import twitter4j.*;
/**
* @author Joern Huxhorn - jhuxhorn at googlemail.com
@@ -130,7 +125,7 @@ UserList updateUserList(int listId, String newListName, boolean isPublicList, St
*
* @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
* @return the list of lists
- * @throws TwitterException when Twitter service or network is unavailable
+ * @throws TwitterException when Twitter service or network is unavailable
* @throws IllegalStateException when authorization is not enabled
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/memberships">GET lists/memberships | Twitter Developers</a>
* @since Twitter4J 2.2.4
@@ -142,15 +137,15 @@ UserList updateUserList(int listId, String newListName, boolean isPublicList, St
* List the lists the specified user has been added to.
* <br>This method calls http://api.twitter.com/1/lists/memberships.json
*
- * @param listMemberId The id of the list member
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
+ * @param listMemberId The id of the list member
+ * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
* @return the list of lists
* @throws TwitterException when Twitter service or network is unavailable
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/memberships">GET lists/memberships | Twitter Developers</a>
* @since Twitter4J 2.2.4
*/
PagableResponseList<UserList> getUserListMemberships(long listMemberId, long cursor)
- throws TwitterException;
+ throws TwitterException;
/**
* List the lists the specified user has been added to.
@@ -174,7 +169,7 @@ UserList updateUserList(int listId, String newListName, boolean isPublicList, St
* @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
* @param filterToOwnedLists Whether to return just lists the authenticating user owns, and the user represented by listMemberScreenName is a member of.
* @return the list of lists
- * @throws TwitterException when Twitter service or network is unavailable
+ * @throws TwitterException when Twitter service or network is unavailable
* @throws IllegalStateException when filerToOwnedLists is true but authorization is not enabled
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/memberships">GET lists/memberships | Twitter Developers</a>
* @since Twitter4J 2.2.4
@@ -182,15 +177,15 @@ UserList updateUserList(int listId, String newListName, boolean isPublicList, St
PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, long cursor, boolean filterToOwnedLists)
throws TwitterException;
- /**
+ /**
* List the lists the specified user has been added to.
* <br>This method calls http://api.twitter.com/1/lists/memberships.json
*
- * @param listMemberId The id of the list member
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @param filterToOwnedLists Whether to return just lists the authenticating user owns, and the user represented by listMemberId is a member of.
+ * @param listMemberId The id of the list member
+ * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
+ * @param filterToOwnedLists Whether to return just lists the authenticating user owns, and the user represented by listMemberId is a member of.
* @return the list of lists
- * @throws TwitterException when Twitter service or network is unavailable
+ * @throws TwitterException when Twitter service or network is unavailable
* @throws IllegalStateException when filerToOwnedLists is true but authorization is not enabled
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/memberships">GET lists/memberships | Twitter Developers</a>
* @since Twitter4J 2.2.4
View
6 twitter4j-core/src/main/java/twitter4j/api/LocalTrendsMethods.java
@@ -16,11 +16,7 @@
package twitter4j.api;
-import twitter4j.GeoLocation;
-import twitter4j.Location;
-import twitter4j.ResponseList;
-import twitter4j.Trends;
-import twitter4j.TwitterException;
+import twitter4j.*;
/**
* @author Joern Huxhorn - jhuxhorn at googlemail.com
View
2  twitter4j-core/src/main/java/twitter4j/api/StatusMethods.java
@@ -49,7 +49,7 @@
/**
* Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
* <br>This method calls http://api.twitter.com/1/statuses/update or<br>
- * This method calls https://upload.twitter.com/1/statuses/update_with_media
+ * This method calls https://upload.twitter.com/1/statuses/update_with_media
*
* @param latestStatus the latest status to be updated.
* @return the latest status
View
7 twitter4j-core/src/main/java/twitter4j/api/UserMethods.java
@@ -16,12 +16,7 @@
package twitter4j.api;
-import twitter4j.Category;
-import twitter4j.PagableResponseList;
-import twitter4j.ProfileImage;
-import twitter4j.ResponseList;
-import twitter4j.TwitterException;
-import twitter4j.User;
+import twitter4j.*;
/**
* @author Joern Huxhorn - jhuxhorn at googlemail.com
View
4 twitter4j-core/src/main/java/twitter4j/auth/AccessToken.java
@@ -45,9 +45,9 @@ public AccessToken(String token, String tokenSecret) {
super(token, tokenSecret);
String sUserId;
try {
- sUserId = token.substring(0, token.indexOf("-"));
+ sUserId = token.substring(0, token.indexOf("-"));
} catch (IndexOutOfBoundsException e) {
- throw new IllegalArgumentException("Invalid access token format.");
+ throw new IllegalArgumentException("Invalid access token format.");
}
if (sUserId != null) userId = Long.parseLong(sUserId);
}
View
7 twitter4j-core/src/main/java/twitter4j/conf/PropertyConfiguration.java
@@ -18,12 +18,7 @@
import twitter4j.internal.util.z_T4JInternalStringUtil;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectStreamException;
+import java.io.*;
import java.util.ArrayList;
import java.util.Properties;
import java.util.Set;
View
6 twitter4j-core/src/main/java/twitter4j/internal/http/HttpClientWrapper.java
@@ -23,11 +23,7 @@
import java.util.HashMap;
import java.util.Map;
-import static twitter4j.internal.http.RequestMethod.DELETE;
-import static twitter4j.internal.http.RequestMethod.GET;
-import static twitter4j.internal.http.RequestMethod.HEAD;
-import static twitter4j.internal.http.RequestMethod.POST;
-import static twitter4j.internal.http.RequestMethod.PUT;
+import static twitter4j.internal.http.RequestMethod.*;
/**
* HTTP Client wrapper with handy request methods, ResponseListener mechanism
View
6 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponse.java
@@ -24,11 +24,7 @@
import twitter4j.internal.org.json.JSONObject;
import twitter4j.internal.org.json.JSONTokener;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
+import java.io.*;
import java.util.List;
import java.util.Map;
View
4 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponseListener.java
@@ -5,6 +5,6 @@
*/
public interface HttpResponseListener {
- public void httpResponseReceived(HttpResponseEvent event);
-
+ public void httpResponseReceived(HttpResponseEvent event);
+
}
View
2  twitter4j-core/src/main/java/twitter4j/internal/logging/Logger.java
@@ -61,7 +61,7 @@
Configuration conf = ConfigurationContext.getInstance();
try {
- Method method = conf.getClass().getMethod("dumpConfiguration",new Class[]{});
+ Method method = conf.getClass().getMethod("dumpConfiguration", new Class[]{});
method.setAccessible(true);
method.invoke(conf);
} catch (IllegalAccessException ignore) {
View
159 twitter4j-core/src/main/java/twitter4j/internal/org/json/CDL.java
@@ -29,17 +29,18 @@ of this software and associated documentation files (the "Software"), to deal
* JSONArray, and to covert a JSONArray into comma delimited text. Comma
* delimited text is a very popular format for data interchange. It is
* understood by most database, spreadsheet, and organizer programs.
- * <p>
+ * <p/>
* Each row of text represents a row in a table or a data record. Each row
* ends with a NEWLINE character. Each row contains one or more values.
* Values are separated by commas. A value can contain any character except
* for comma, unless is is wrapped in single quotes or double quotes.
- * <p>
+ * <p/>
* The first row usually contains the names of the columns.
- * <p>
+ * <p/>
* A comma delimited list can be converted into a JSONArray of JSONObjects.
* The names for the elements in the JSONObjects can be taken from the names
* in the first row.
+ *
* @author JSON.org
* @version 2010-12-24
*/
@@ -48,6 +49,7 @@ of this software and associated documentation files (the "Software"), to deal
/**
* Get the next value. The value can be wrapped in quotes. The value can
* be empty.
+ *
* @param x A JSONTokener of the source text.
* @return The value string, or null if empty.
* @throws JSONException if the quoted string is badly formed.
@@ -60,49 +62,50 @@ private static String getValue(JSONTokener x) throws JSONException {
c = x.next();
} while (c == ' ' || c == '\t');
switch (c) {
- case 0:
- return null;
- case '"':
- case '\'':
- q = c;
- sb = new StringBuilder();
- for (;;) {
- c = x.next();
- if (c == q) {
- break;
- }
- if (c == 0 || c == '\n' || c == '\r') {
- throw x.syntaxError("Missing close quote '" + q + "'.");
+ case 0:
+ return null;
+ case '"':
+ case '\'':
+ q = c;
+ sb = new StringBuilder();
+ for (; ; ) {
+ c = x.next();
+ if (c == q) {
+ break;
+ }
+ if (c == 0 || c == '\n' || c == '\r') {
+ throw x.syntaxError("Missing close quote '" + q + "'.");
+ }
+ sb.append(c);
}
- sb.append(c);
- }
- return sb.toString();
- case ',':
- x.back();
- return "";
- default:
- x.back();
- return x.nextTo(',');
+ return sb.toString();
+ case ',':
+ x.back();
+ return "";
+ default:
+ x.back();
+ return x.nextTo(',');
}
}
/**
* Produce a JSONArray of strings from a row of comma delimited values.
+ *
* @param x A JSONTokener of the source text.
* @return A JSONArray of strings.
* @throws JSONException
*/
public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
JSONArray ja = new JSONArray();
- for (;;) {
+ for (; ; ) {
String value = getValue(x);
char c = x.next();
- if (value == null ||
- (ja.length() == 0 && value.length() == 0 && c != ',')) {
+ if (value == null ||
+ (ja.length() == 0 && value.length() == 0 && c != ',')) {
return null;
}
ja.put(value);
- for (;;) {
+ for (; ; ) {
if (c == ',') {
break;
}
@@ -111,7 +114,7 @@ public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
return ja;
}
throw x.syntaxError("Bad character '" + c + "' (" +
- (int)c + ").");
+ (int) c + ").");
}
c = x.next();
}
@@ -121,59 +124,62 @@ public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
/**
* Produce a JSONObject from a row of comma delimited text, using a
* parallel JSONArray of strings to provides the names of the elements.
+ *
* @param names A JSONArray of names. This is commonly obtained from the
- * first row of a comma delimited text file using the rowToJSONArray
- * method.
- * @param x A JSONTokener of the source text.
+ * first row of a comma delimited text file using the rowToJSONArray
+ * method.
+ * @param x A JSONTokener of the source text.
* @return A JSONObject combining the names and values.
* @throws JSONException
*/
public static JSONObject rowToJSONObject(JSONArray names, JSONTokener x)
throws JSONException {
JSONArray ja = rowToJSONArray(x);
- return ja != null ? ja.toJSONObject(names) : null;
+ return ja != null ? ja.toJSONObject(names) : null;
}
/**
- * Produce a comma delimited text row from a JSONArray. Values containing
- * the comma character will be quoted. Troublesome characters may be
- * removed.
- * @param ja A JSONArray of strings.
- * @return A string ending in NEWLINE.
- */
- public static String rowToString(JSONArray ja) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < ja.length(); i += 1) {
- if (i > 0) {
- sb.append(',');
- }
- Object object = ja.opt(i);
- if (object != null) {
- String string = object.toString();
- if (string.length() > 0 && (string.indexOf(',') >= 0 ||
- string.indexOf('\n') >= 0 || string.indexOf('\r') >= 0 ||
- string.indexOf(0) >= 0 || string.charAt(0) == '"')) {
- sb.append('"');
- int length = string.length();
- for (int j = 0; j < length; j += 1) {
- char c = string.charAt(j);
- if (c >= ' ' && c != '"') {
- sb.append(c);
- }
- }
- sb.append('"');
- } else {
- sb.append(string);
- }
- }
- }
- sb.append('\n');
- return sb.toString();
- }
+ * Produce a comma delimited text row from a JSONArray. Values containing
+ * the comma character will be quoted. Troublesome characters may be
+ * removed.
+ *
+ * @param ja A JSONArray of strings.
+ * @return A string ending in NEWLINE.
+ */
+ public static String rowToString(JSONArray ja) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < ja.length(); i += 1) {
+ if (i > 0) {
+ sb.append(',');
+ }
+ Object object = ja.opt(i);
+ if (object != null) {
+ String string = object.toString();
+ if (string.length() > 0 && (string.indexOf(',') >= 0 ||
+ string.indexOf('\n') >= 0 || string.indexOf('\r') >= 0 ||
+ string.indexOf(0) >= 0 || string.charAt(0) == '"')) {
+ sb.append('"');
+ int length = string.length();
+ for (int j = 0; j < length; j += 1) {
+ char c = string.charAt(j);
+ if (c >= ' ' && c != '"') {
+ sb.append(c);
+ }
+ }
+ sb.append('"');
+ } else {
+ sb.append(string);
+ }
+ }
+ }
+ sb.append('\n');
+ return sb.toString();
+ }
- /**
+ /**
* Produce a JSONArray of JSONObjects from a comma delimited text string,
* using the first row as a source of names.
+ *
* @param string The comma delimited text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
@@ -185,6 +191,7 @@ public static JSONArray toJSONArray(String string) throws JSONException {
/**
* Produce a JSONArray of JSONObjects from a comma delimited text string,
* using the first row as a source of names.
+ *
* @param x The JSONTokener containing the comma delimited text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
@@ -196,7 +203,8 @@ public static JSONArray toJSONArray(JSONTokener x) throws JSONException {
/**
* Produce a JSONArray of JSONObjects from a comma delimited text string
* using a supplied JSONArray as the source of element names.
- * @param names A JSONArray of strings.
+ *
+ * @param names A JSONArray of strings.
* @param string The comma delimited text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
@@ -209,8 +217,9 @@ public static JSONArray toJSONArray(JSONArray names, String string)
/**
* Produce a JSONArray of JSONObjects from a comma delimited text string
* using a supplied JSONArray as the source of element names.
+ *
* @param names A JSONArray of strings.
- * @param x A JSONTokener of the source text.
+ * @param x A JSONTokener of the source text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
*/
@@ -220,7 +229,7 @@ public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
return null;
}
JSONArray ja = new JSONArray();
- for (;;) {
+ for (; ; ) {
JSONObject jo = rowToJSONObject(names, x);
if (jo == null) {
break;
@@ -238,6 +247,7 @@ public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
* Produce a comma delimited text from a JSONArray of JSONObjects. The
* first row will be a list of names obtained by inspecting the first
* JSONObject.
+ *
* @param ja A JSONArray of JSONObjects.
* @return A comma delimited text.
* @throws JSONException
@@ -257,8 +267,9 @@ public static String toString(JSONArray ja) throws JSONException {
* Produce a comma delimited text from a JSONArray of JSONObjects using
* a provided list of names. The list of names is not included in the
* output.
+ *
* @param names A JSONArray of strings.
- * @param ja A JSONArray of JSONObjects.
+ * @param ja A JSONArray of JSONObjects.
* @return A comma delimited text.
* @throws JSONException
*/
View
31 twitter4j-core/src/main/java/twitter4j/internal/org/json/Cookie.java
@@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal
/**
* Convert a web browser cookie specification to a JSONObject and back.
* JSON and Cookies are both notations for name/value pairs.
+ *
* @author JSON.org
* @version 2010-12-24
*/
@@ -41,20 +42,21 @@ of this software and associated documentation files (the "Software"), to deal
* only a convention, not a standard. Often, cookies are expected to have
* encoded values. We encode '=' and ';' because we must. We encode '%' and
* '+' because they are meta characters in URL encoding.
+ *
* @param string The source string.
- * @return The escaped result.
+ * @return The escaped result.
*/
public static String escape(String string) {
- char c;
- String s = string.trim();
+ char c;
+ String s = string.trim();
StringBuilder sb = new StringBuilder();
- int length = s.length();
+ int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' || c == '=' || c == ';') {
sb.append('%');
- sb.append(Character.forDigit((char)((c >>> 4) & 0x0f), 16));
- sb.append(Character.forDigit((char)(c & 0x0f), 16));
+ sb.append(Character.forDigit((char) ((c >>> 4) & 0x0f), 16));
+ sb.append(Character.forDigit((char) (c & 0x0f), 16));
} else {
sb.append(c);
}
@@ -73,15 +75,16 @@ public static String escape(String string) {
* stored under the key "value". This method does not do checking or
* validation of the parameters. It only converts the cookie string into
* a JSONObject.
+ *
* @param string The cookie specification string.
* @return A JSONObject containing "name", "value", and possibly other
- * members.
+ * members.
* @throws JSONException
*/
public static JSONObject toJSONObject(String string) throws JSONException {
- String name;
- JSONObject jo = new JSONObject();
- Object value;
+ String name;
+ JSONObject jo = new JSONObject();
+ Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
@@ -111,6 +114,7 @@ public static JSONObject toJSONObject(String string) throws JSONException {
* If the JSONObject contains "expires", "domain", "path", or "secure"
* members, they will be appended to the cookie specification string.
* All other members are ignored.
+ *
* @param jo A JSONObject
* @return A cookie specification string
* @throws JSONException
@@ -142,9 +146,10 @@ public static String toString(JSONObject jo) throws JSONException {
/**
* Convert <code>%</code><i>hh</i> sequences to single characters, and
* convert plus to space.
+ *
* @param string A string that may contain
- * <code>+</code>&nbsp;<small>(plus)</small> and
- * <code>%</code><i>hh</i> sequences.
+ * <code>+</code>&nbsp;<small>(plus)</small> and
+ * <code>%</code><i>hh</i> sequences.
* @return The unescaped string.
*/
public static String unescape(String string) {
@@ -158,7 +163,7 @@ public static String unescape(String string) {
int d = JSONTokener.dehexchar(string.charAt(i + 1));
int e = JSONTokener.dehexchar(string.charAt(i + 2));
if (d >= 0 && e >= 0) {
- c = (char)(d * 16 + e);
+ c = (char) (d * 16 + e);
i += 2;
}
}
View
15 twitter4j-core/src/main/java/twitter4j/internal/org/json/CookieList.java
@@ -28,6 +28,7 @@ of this software and associated documentation files (the "Software"), to deal
/**
* Convert a web browser cookie list string to a JSONObject and back.
+ *
* @author JSON.org
* @version 2010-12-24
*/
@@ -38,11 +39,12 @@ of this software and associated documentation files (the "Software"), to deal
* of name/value pairs. The names are separated from the values by '='.
* The pairs are separated by ';'. The names and the values
* will be unescaped, possibly converting '+' and '%' sequences.
- *
+ * <p/>
* To add a cookie to a cooklist,
* cookielistJSONObject.put(cookieJSONObject.getString("name"),
- * cookieJSONObject.getString("value"));
- * @param string A cookie list string
+ * cookieJSONObject.getString("value"));
+ *
+ * @param string A cookie list string
* @return A JSONObject
* @throws JSONException
*/
@@ -64,14 +66,15 @@ public static JSONObject toJSONObject(String string) throws JSONException {
* of name/value pairs. The names are separated from the values by '='.
* The pairs are separated by ';'. The characters '%', '+', '=', and ';'
* in the names and values are replaced by "%hh".
+ *
* @param jo A JSONObject
* @return A cookie list string
* @throws JSONException
*/
public static String toString(JSONObject jo) throws JSONException {
- boolean b = false;
- Iterator keys = jo.keys();
- String string;
+ boolean b = false;
+ Iterator keys = jo.keys();
+ String string;
StringBuilder sb = new StringBuilder();
while (keys.hasNext()) {
string = keys.next().toString();
View
25 twitter4j-core/src/main/java/twitter4j/internal/org/json/HTTP.java
@@ -28,12 +28,15 @@ of this software and associated documentation files (the "Software"), to deal
/**
* Convert an HTTP header to a JSONObject and back.
+ *
* @author JSON.org
* @version 2010-12-24
*/
public class HTTP {
- /** Carriage return/line feed. */
+ /**
+ * Carriage return/line feed.
+ */
public static final String CRLF = "\r\n";
/**
@@ -63,15 +66,16 @@ of this software and associated documentation files (the "Software"), to deal
* ...}</pre>
* It does no further checking or conversion. It does not parse dates.
* It does not do '%' transforms on URLs.
+ *
* @param string An HTTP header string.
* @return A JSONObject containing the elements and attributes
- * of the XML string.
+ * of the XML string.
* @throws JSONException
*/
public static JSONObject toJSONObject(String string) throws JSONException {
- JSONObject jo = new JSONObject();
- HTTPTokener x = new HTTPTokener(string);
- String token;
+ JSONObject jo = new JSONObject();
+ HTTPTokener x = new HTTPTokener(string);
+ String token;
token = x.nextToken();
if (token.toUpperCase().startsWith("HTTP")) {
@@ -119,14 +123,15 @@ public static JSONObject toJSONObject(String string) throws JSONException {
* }</pre>
* Any other members of the JSONObject will be output as HTTP fields.
* The result will end with two CRLF pairs.
+ *
* @param jo A JSONObject
* @return An HTTP header string.
* @throws JSONException if the object does not contain enough
- * information.
+ * information.
*/
public static String toString(JSONObject jo) throws JSONException {
- Iterator keys = jo.keys();
- String string;
+ Iterator keys = jo.keys();
+ String string;
StringBuilder sb = new StringBuilder();
if (jo.has("Status-Code") && jo.has("Reason-Phrase")) {
sb.append(jo.getString("HTTP-Version"));
@@ -148,9 +153,9 @@ public static String toString(JSONObject jo) throws JSONException {
sb.append(CRLF);
while (keys.hasNext()) {
string = keys.next().toString();
- if (!string.equals("HTTP-Version") && !string.equals("Status-Code") &&
+ if (!string.equals("HTTP-Version") && !string.equals("Status-Code") &&
!string.equals("Reason-Phrase") && !string.equals("Method") &&
- !string.equals("Request-URI") && !jo.isNull(string)) {
+ !string.equals("Request-URI") && !jo.isNull(string)) {
sb.append(string);
sb.append(": ");
sb.append(jo.getString(string));
View
11 twitter4j-core/src/main/java/twitter4j/internal/org/json/HTTPTokener.java
@@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal
/**
* The HTTPTokener extends the JSONTokener to provide additional methods
* for the parsing of HTTP headers.
+ *
* @author JSON.org
* @version 2010-12-24
*/
@@ -34,6 +35,7 @@ of this software and associated documentation files (the "Software"), to deal
/**
* Construct an HTTPTokener from a string.
+ *
* @param string A source string.
*/
public HTTPTokener(String string) {
@@ -43,8 +45,9 @@ public HTTPTokener(String string) {
/**
* Get the next token or string. This is used in parsing HTTP headers.
- * @throws JSONException
+ *
* @return A String.
+ * @throws JSONException
*/
public String nextToken() throws JSONException {
char c;
@@ -55,7 +58,7 @@ public String nextToken() throws JSONException {
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
- for (;;) {
+ for (; ; ) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
@@ -65,8 +68,8 @@ public String nextToken() throws JSONException {
}
sb.append(c);
}
- }
- for (;;) {
+ }
+ for (; ; ) {
if (c == 0 || Character.isWhitespace(c)) {
return sb.toString();
}
View
2  twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONArray.java
@@ -108,7 +108,7 @@ public JSONArray(JSONTokener x) throws JSONException {
}
if (x.nextClean() != ']') {
x.back();
- for (; ;) {
+ for (; ; ) {
if (x.nextClean() == ',') {
x.back();
this.myArrayList.add(JSONObject.NULL);
View
6 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONException.java
@@ -2,15 +2,17 @@
/**
* The JSONException is thrown by the JSON.org classes when things are amiss.
+ *
* @author JSON.org
* @version 2010-12-24
*/
public class JSONException extends Exception {
- private static final long serialVersionUID = 0;
- private Throwable cause;
+ private static final long serialVersionUID = 0;
+ private Throwable cause;
/**
* Constructs a JSONException with an explanatory message.
+ *
* @param message Detail about the reason for the exception.
*/
public JSONException(String message) {
View
604 twitter4j-core/src/main/java/twitter4j/internal/org/json/JSONML.java
@@ -28,200 +28,202 @@ of this software and associated documentation files (the "Software"), to deal
/**
- * This provides static methods to convert an XML text into a JSONArray or
- * JSONObject, and to covert a JSONArray or JSONObject into an XML text using
+ * This provides static methods to convert an XML text into a JSONArray or
+ * JSONObject, and to covert a JSONArray or JSONObject into an XML text using
* the JsonML transform.
+ *
* @author JSON.org
* @version 2010-12-23
*/
public class JSONML {
-
+
/**
* Parse XML values and store them in a JSONArray.
- * @param x The XMLTokener containing the source string.
+ *
+ * @param x The XMLTokener containing the source string.
* @param arrayForm true if array form, false if object form.
- * @param ja The JSONArray that is containing the current tag or null
- * if we are at the outermost level.
+ * @param ja The JSONArray that is containing the current tag or null
+ * if we are at the outermost level.
* @return A JSONArray if the value is the outermost tag, otherwise null.
* @throws JSONException
*/
- private static Object parse(XMLTokener x, boolean arrayForm,
- JSONArray ja) throws JSONException {
- String attribute;
- char c;
- String closeTag = null;
- int i;
- JSONArray newja = null;
+ private static Object parse(XMLTokener x, boolean arrayForm,
+ JSONArray ja) throws JSONException {
+ String attribute;
+ char c;
+ String closeTag = null;
+ int i;
+ JSONArray newja = null;
JSONObject newjo = null;
- Object token;
- String tagName = null;
-
+ Object token;
+ String tagName = null;
+
// Test for and skip past these forms:
// <!-- ... -->
// <![ ... ]]>
// <! ... >
// <? ... ?>
-
+
while (true) {
- token = x.nextContent();
- if (token == XML.LT) {
- token = x.nextToken();
- if (token instanceof Character) {
- if (token == XML.SLASH) {
+ token = x.nextContent();
+ if (token == XML.LT) {
+ token = x.nextToken();
+ if (token instanceof Character) {
+ if (token == XML.SLASH) {
// Close tag </
- token = x.nextToken();
- if (!(token instanceof String)) {
- throw new JSONException(
- "Expected a closing name instead of '" +
- token + "'.");
- }
- if (x.nextToken() != XML.GT) {
- throw x.syntaxError("Misshaped close tag");
- }
- return token;
- } else if (token == XML.BANG) {
-
+ token = x.nextToken();
+ if (!(token instanceof String)) {
+ throw new JSONException(
+ "Expected a closing name instead of '" +
+ token + "'.");
+ }
+ if (x.nextToken() != XML.GT) {
+ throw x.syntaxError("Misshaped close tag");
+ }
+ return token;
+ } else if (token == XML.BANG) {
+
// <!
-
- c = x.next();
- if (c == '-') {
- if (x.next() == '-') {
- x.skipPast("-->");
- }
- x.back();
- } else if (c == '[') {
- token = x.nextToken();
- if (token.equals("CDATA") && x.next() == '[') {
- if (ja != null) {
- ja.put(x.nextCDATA());
- }
- } else {
- throw x.syntaxError("Expected 'CDATA['");
- }
- } else {
- i = 1;
- do {
- token = x.nextMeta();
- if (token == null) {
- throw x.syntaxError("Missing '>' after '<!'.");
- } else if (token == XML.LT) {
- i += 1;
- } else if (token == XML.GT) {
- i -= 1;
- }
- } while (i > 0);
- }
- } else if (token == XML.QUEST) {
+
+ c = x.next();
+ if (c == '-') {
+ if (x.next() == '-') {
+ x.skipPast("-->");
+ }
+ x.back();
+ } else if (c == '[') {
+ token = x.nextToken();
+ if (token.equals("CDATA") && x.next() == '[') {
+ if (ja != null) {
+ ja.put(x.nextCDATA());
+ }
+ } else {
+ throw x.syntaxError("Expected 'CDATA['");
+ }
+ } else {
+ i = 1;
+ do {
+ token = x.nextMeta();
+ if (token == null) {
+ throw x.syntaxError("Missing '>' after '<!'.");
+ } else if (token == XML.LT) {
+ i += 1;
+ } else if (token == XML.GT) {
+ i -= 1;
+ }
+ } while (i > 0);
+ }
+ } else if (token == XML.QUEST) {
// <?
- x.skipPast("?>");
- } else {
- throw x.syntaxError("Misshaped tag");
- }
+ x.skipPast("?>");
+ } else {
+ throw x.syntaxError("Misshaped tag");
+ }
// Open tag <
- } else {
- if (!(token instanceof String)) {
- throw x.syntaxError("Bad tagName '" + token + "'.");
- }
- tagName = (String)token;
- newja = new JSONArray();
- newjo = new JSONObject();
- if (arrayForm) {
- newja.put(tagName);
- if (ja != null) {
- ja.put(newja);
- }
- } else {
- newjo.put("tagName", tagName);
- if (ja != null) {
- ja.put(newjo);
- }
- }
- token = null;
- for (;;) {
- if (token == null) {
- token = x.nextToken();
- }
- if (token == null) {
- throw x.syntaxError("Misshaped tag");
- }
- if (!(token instanceof String)) {
- break;
- }
+ } else {
+ if (!(token instanceof String)) {
+ throw x.syntaxError("Bad tagName '" + token + "'.");
+ }
+ tagName = (String) token;
+ newja = new JSONArray();
+ newjo = new JSONObject();
+ if (arrayForm) {
+ newja.put(tagName);
+ if (ja != null) {
+ ja.put(newja);
+ }
+ } else {
+ newjo.put("tagName", tagName);
+ if (ja != null) {
+ ja.put(newjo);
+ }
+ }
+ token = null;
+ for (; ; ) {
+ if (token == null) {
+ token = x.nextToken();
+ }
+ if (token == null) {
+ throw x.syntaxError("Misshaped tag");
+ }
+ if (!(token instanceof String)) {
+ break;
+ }
// attribute = value
- attribute = (String)token;
- if (!arrayForm && (attribute == "tagName" || attribute == "childNode")) {
- throw x.syntaxError("Reserved attribute.");
- }
- token = x.nextToken();
- if (token == XML.EQ) {
- token = x.nextToken();
- if (!(token instanceof String)) {
- throw x.syntaxError("Missing value");
- }
- newjo.accumulate(attribute, XML.stringToValue((String)token));
- token = null;
- } else {
- newjo.accumulate(attribute, "");
- }
- }
+ attribute = (String) token;
+ if (!arrayForm && (attribute == "tagName" || attribute == "childNode")) {
+ throw x.syntaxError("Reserved attribute.");
+ }
+ token = x.nextToken();
+ if (token == XML.EQ) {
+ token = x.nextToken();
+ if (!(token instanceof String)) {
+ throw x.syntaxError("Missing value");
+ }
+ newjo.accumulate(attribute, XML.stringToValue((String) token));
+ token = null;
+ } else {
+ newjo.accumulate(attribute, "");
+ }
+ }
if (arrayForm && newjo.length() > 0) {
- newja.put(newjo);
+ newja.put(newjo);
}
// Empty tag <.../>
- if (token == XML.SLASH) {
- if (x.nextToken() != XML.GT) {
- throw x.syntaxError("Misshaped tag");
- }
- if (ja == null) {
- if (arrayForm) {
- return newja;
- } else {
- return newjo;
- }
- }
+ if (token == XML.SLASH) {
+ if (x.nextToken() != XML.GT) {
+ throw x.syntaxError("Misshaped tag");
+ }
+ if (ja == null) {
+ if (arrayForm) {
+ return newja;
+ } else {
+ return newjo;
+ }
+ }
// Content, between <...> and </...>
- } else {
- if (token != XML.GT) {
- throw x.syntaxError("Misshaped tag");
- }
- closeTag = (String)parse(x, arrayForm, newja);
- if (closeTag != null) {
- if (!closeTag.equals(tagName)) {
- throw x.syntaxError("Mismatched '" + tagName +
- "' and '" + closeTag + "'");
- }
- tagName = null;
- if (!arrayForm && newja.length() > 0) {
- newjo.put("childNodes", newja);
- }
- if (ja == null) {
- if (arrayForm) {
- return newja;
- } else {
- return newjo;
- }
- }
- }
- }
- }
- } else {
- if (ja != null) {
- ja.put(token instanceof String ?
- XML.stringToValue((String)token) : token);
- }
- }
+ } else {
+ if (token != XML.GT) {
+ throw x.syntaxError("Misshaped tag");
+ }
+ closeTag = (String) parse(x, arrayForm, newja);
+ if (closeTag != null) {
+ if (!closeTag.equals(tagName)) {
+ throw x.syntaxError("Mismatched '" + tagName +
+ "' and '" + closeTag + "'");
+ }
+ tagName = null;
+ if (!arrayForm && newja.length() > 0) {
+ newjo.put("childNodes", newja);
+ }
+ if (ja == null) {
+ if (arrayForm) {
+ return newja;
+ } else {
+ return newjo;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ if (ja != null) {
+ ja.put(token instanceof String ?
+ XML.stringToValue((String) token) : token);
+ }
+ }
}
}
@@ -234,12 +236,13 @@ private static Object parse(XMLTokener x, boolean arrayForm,
* name/value pairs. If the tag contains children, then strings and
* JSONArrays will represent the child tags.
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
+ *
* @param string The source string.
* @return A JSONArray containing the structured data from the XML string.
* @throws JSONException
*/
public static JSONArray toJSONArray(String string) throws JSONException {
- return toJSONArray(new XMLTokener(string));
+ return toJSONArray(new XMLTokener(string));
}
@@ -251,206 +254,211 @@ public static JSONArray toJSONArray(String string) throws JSONException {
* name/value pairs. If the tag contains children, then strings and
* JSONArrays will represent the child content and tags.
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
+ *
* @param x An XMLTokener.
* @return A JSONArray containing the structured data from the XML string.
* @throws JSONException
*/
public static JSONArray toJSONArray(XMLTokener x) throws JSONException {
- return (JSONArray)parse(x, true, null);
+ return (JSONArray) parse(x, true, null);
}
-
+
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject using the JsonML transform. Each XML tag is represented as
- * a JSONObject with a "tagName" property. If the tag has attributes, then
- * the attributes will be in the JSONObject as properties. If the tag
- * contains children, the object will have a "childNodes" property which
+ * a JSONObject with a "tagName" property. If the tag has attributes, then
+ * the attributes will be in the JSONObject as properties. If the tag
+ * contains children, the object will have a "childNodes" property which
* will be an array of strings and JsonML JSONObjects.
-
+ * <p/>
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
+ *
* @param x An XMLTokener of the XML source text.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException
*/
public static JSONObject toJSONObject(XMLTokener x) throws JSONException {
- return (JSONObject)parse(x, false, null);
+ return (JSONObject) parse(x, false, null);
}
-
-
+
+
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject using the JsonML transform. Each XML tag is represented as
- * a JSONObject with a "tagName" property. If the tag has attributes, then
- * the attributes will be in the JSONObject as properties. If the tag
- * contains children, the object will have a "childNodes" property which
+ * a JSONObject with a "tagName" property. If the tag has attributes, then
+ * the attributes will be in the JSONObject as properties. If the tag
+ * contains children, the object will have a "childNodes" property which
* will be an array of strings and JsonML JSONObjects.
-
+ * <p/>
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
+ *
* @param string The XML source text.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException
*/
public static JSONObject toJSONObject(String string) throws JSONException {
- return toJSONObject(new XMLTokener(string));
+ return toJSONObject(new XMLTokener(string));
}
/**
* Reverse the JSONML transformation, making an XML text from a JSONArray.
+ *
* @param ja A JSONArray.
* @return An XML string.
* @throws JSONException
*/
public static String toString(JSONArray ja) throws JSONException {
- int i;
- JSONObject jo;
- String key;
- Iterator keys;
- int length;
- Object object;
- StringBuilder sb = new StringBuilder();
- String tagName;
- String value;
-
+ int i;
+ JSONObject jo;
+ String key;
+ Iterator keys;
+ int length;
+ Object object;
+ StringBuilder sb = new StringBuilder();
+ String tagName;
+ String value;
+
// Emit <tagName
-
- tagName = ja.getString(0);
- XML.noSpace(tagName);
- tagName = XML.escape(tagName);
- sb.append('<');
- sb.append(tagName);
-
- object = ja.opt(1);
- if (object instanceof JSONObject) {
- i = 2;
- jo = (JSONObject)object;
-
+
+ tagName = ja.getString(0);
+ XML.noSpace(tagName);
+ tagName = XML.escape(tagName);
+ sb.append('<');
+ sb.append(tagName);