Skip to content

Commit

Permalink
TFJ-621 fixed TwitterFactory.getInstance()
Browse files Browse the repository at this point in the history
TwitterFactory.getInstance() was returning default singleton instance which is not associated with the configuration provided to the factory instance.
  • Loading branch information
yusuke committed Jul 28, 2011
1 parent 4a2f80e commit ddbdc2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Expand Up @@ -18,6 +18,7 @@

import twitter4j.auth.AccessToken;
import twitter4j.auth.Authorization;
import twitter4j.auth.AuthorizationFactory;
import twitter4j.auth.OAuthAuthorization;
import twitter4j.conf.Configuration;
import twitter4j.conf.ConfigurationContext;
Expand Down Expand Up @@ -71,12 +72,12 @@ public AsyncTwitterFactory(String configTreePath) {
}

/**
* Returns a default singleton instance.
* Returns an instance associated with the configuration bound to this factory.
*
* @return default singleton instance
*/
public AsyncTwitter getInstance() {
return SINGLETON;
return getInstance(AuthorizationFactory.getInstance(conf));
}

/**
Expand Down Expand Up @@ -108,7 +109,7 @@ public AsyncTwitter getInstance(Authorization auth) {
}

/**
* Returns default singleton AsyncTwitter instance. This is equivalent to new AsyncTwitterFactory().getInstance().
* Returns default singleton AsyncTwitter instance.
*
* @return default singleton AsyncTwitter instance
* @since Twitter4J 2.2.4
Expand Down
6 changes: 3 additions & 3 deletions twitter4j-core/src/main/java/twitter4j/TwitterFactory.java
Expand Up @@ -107,12 +107,12 @@ public TwitterFactory(String configTreePath) {
}

/**
* Returns a instance.
* Returns a instance associated with the configuration bound to this factory.
*
* @return default singleton instance
*/
public Twitter getInstance() {
return SINGLETON;
return getInstance(AuthorizationFactory.getInstance(conf));
}

/**
Expand Down Expand Up @@ -148,7 +148,7 @@ public Twitter getInstance(Authorization auth) {
}

/**
* Returns default singleton Twitter instance. This is equivalent to new TwitterFactory().getInstance().
* Returns default singleton Twitter instance.
*
* @return default singleton Twitter instance
* @since Twitter4J 2.2.4
Expand Down
Expand Up @@ -18,6 +18,7 @@

import twitter4j.auth.AccessToken;
import twitter4j.auth.Authorization;
import twitter4j.auth.AuthorizationFactory;
import twitter4j.auth.OAuthAuthorization;
import twitter4j.conf.Configuration;
import twitter4j.conf.ConfigurationContext;
Expand Down Expand Up @@ -68,12 +69,12 @@ public TwitterStreamFactory(String configTreePath) {
// implementations for BasicSupportFactory

/**
* Returns an instance.
* Returns a instance associated with the configuration bound to this factory.
*
* @return default instance
*/
public TwitterStream getInstance() {
return SINGLETON;
return getInstance(AuthorizationFactory.getInstance(conf));
}

/**
Expand Down Expand Up @@ -109,7 +110,7 @@ private TwitterStream getInstance(Configuration conf, Authorization auth) {
}

/**
* Returns default singleton TwitterStream instance. This is equivalent to new TwitterStreamFactory().getInstance().
* Returns default singleton TwitterStream instance.
*
* @return default singleton TwitterStream instance
* @since Twitter4J 2.2.4
Expand Down

0 comments on commit ddbdc2e

Please sign in to comment.