nus-yam/ex-repair huggingface dataset:
Program: 177783
Project: 177783
Buggy source:
protected void invoke(Activity context,SocializeListener listener,String delegateBean,Method method,Object[] args) throws Throwable {
  SocializeService service=getSocialize();
  if (!service.isInitialized()) {
    doInitAsync(context,listener,delegateBean,method,args);
  }
 else   if (!service.isAuthenticated()) {
    doAuthAsync(context,listener,delegateBean,method,args);
  }
 else {
    method.invoke(Socialize.getBean(delegateBean),args);
  }
}

Fixed version (ground truth):
protected void invoke(Activity context,SocializeListener listener,String delegateBean,Method method,Object[] args) throws Throwable {
  SocializeService service=getSocialize();
  if (!service.isInitialized(context)) {
    doInitAsync(context,listener,delegateBean,method,args);
  }
 else   if (!service.isAuthenticated()) {
    doAuthAsync(context,listener,delegateBean,method,args);
  }
 else {
    method.invoke(Socialize.getBean(delegateBean),args);
  }
}
Program: 177784
Project: 177784
Buggy source:
protected synchronized <L extends SocializeListener>void doInitAsync(final Activity context,final SocializeListener listener,final String delegateBean,final Method method,final Object[] args) throws Throwable {
  final SocializeService service=getSocialize();
  if (!service.isInitialized()) {
synchronized (this) {
      if (!service.isInitialized()) {
        context.runOnUiThread(new Runnable(){
          @Override public void run(){
            service.initAsync(context,new SocializeInitListener(){
              @Override public void onError(              SocializeException error){
                if (listener != null) {
                  listener.onError(error);
                }
              }
              @Override public void onInit(              Context ctx,              IOCContainer container){
                try {
                  invoke(context,listener,delegateBean,method,args);
                }
 catch (                Throwable e) {
                  if (listener != null) {
                    listener.onError(SocializeException.wrap(e));
                  }
                }
              }
            }
);
          }
        }
);
      }
 else {
        invoke(context,listener,delegateBean,method,args);
      }
    }
  }
 else {
    invoke(context,listener,delegateBean,method,args);
  }
}

Fixed version (ground truth):
protected synchronized <L extends SocializeListener>void doInitAsync(final Activity context,final SocializeListener listener,final String delegateBean,final Method method,final Object[] args) throws Throwable {
  final SocializeService service=getSocialize();
  if (!service.isInitialized(context)) {
synchronized (this) {
      if (!service.isInitialized(context)) {
        context.runOnUiThread(new Runnable(){
          @Override public void run(){
            service.initAsync(context,new SocializeInitListener(){
              @Override public void onError(              SocializeException error){
                if (listener != null) {
                  listener.onError(error);
                }
              }
              @Override public void onInit(              Context ctx,              IOCContainer container){
                try {
                  invoke(context,listener,delegateBean,method,args);
                }
 catch (                Throwable e) {
                  if (listener != null) {
                    listener.onError(SocializeException.wrap(e));
                  }
                }
              }
            }
);
          }
        }
);
      }
 else {
        invoke(context,listener,delegateBean,method,args);
      }
    }
  }
 else {
    invoke(context,listener,delegateBean,method,args);
  }
}
Program: 177785
Project: 177785
Buggy source:
/** 
 * Returns true if this SocializeService instance has been initialized.   PLEASE NOTE: Init should always be called so that each corresponding call to destroy is matched.
 * @return true if this SocializeService instance has been initialized.  
 */
public boolean isInitialized();

Fixed version (ground truth):
/** 
 * Returns true if this SocializeService instance has been initialized.  
 * @param context The current context.
 * @return true if this SocializeService instance has been initialized.  
 */
public boolean isInitialized(Context context);
Program: 177786
Project: 177786
Buggy source:
protected synchronized void authenticate(Context context,String consumerKey,String consumerSecret,AuthProviderData authProviderData,SocializeAuthListener authListener,boolean do3rdPartyAuth){
  if (checkKeys(consumerKey,consumerSecret,authListener)) {
    if (assertInitialized(authListener)) {
      userSystem.authenticate(context,consumerKey,consumerSecret,authProviderData,authListener,this,do3rdPartyAuth);
    }
  }
}

Fixed version (ground truth):
protected synchronized void authenticate(Context context,String consumerKey,String consumerSecret,AuthProviderData authProviderData,SocializeAuthListener authListener,boolean do3rdPartyAuth){
  if (checkKeys(consumerKey,consumerSecret,authListener)) {
    if (assertInitialized(context,authListener)) {
      userSystem.authenticate(context,consumerKey,consumerSecret,authProviderData,authListener,this,do3rdPartyAuth);
    }
  }
}
Program: 177787
Project: 177787
Buggy source:
protected boolean assertInitialized(SocializeListener listener){
  if (asserter != null) {
    return asserter.assertInitialized(this,listener);
  }
  if (!isInitialized()) {
    if (listener != null) {
      if (logger != null && logger.isInitialized()) {
        listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_INITIALIZED)));
      }
 else {
        listener.onError(new SocializeException("String_Node_Str"));
      }
    }
    if (logger != null) {
      if (logger.isInitialized()) {
        logger.error(SocializeLogger.NOT_INITIALIZED);
      }
 else {
        logger.error("String_Node_Str");
      }
    }
  }
  return isInitialized();
}

Fixed version (ground truth):
protected boolean assertInitialized(Context context,SocializeListener listener){
  if (asserter != null) {
    return asserter.assertInitialized(context,this,listener);
  }
  if (!isInitialized()) {
    if (listener != null) {
      if (logger != null && logger.isInitialized()) {
        listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_INITIALIZED)));
      }
 else {
        listener.onError(new SocializeException("String_Node_Str"));
      }
    }
    if (logger != null) {
      if (logger.isInitialized()) {
        logger.error(SocializeLogger.NOT_INITIALIZED);
      }
 else {
        logger.error("String_Node_Str");
      }
    }
  }
  return isInitialized();
}
Program: 177788
Project: 177788
Buggy source:
protected boolean assertAuthenticated(SocializeListener listener){
  if (asserter != null) {
    return asserter.assertAuthenticated(this,session,listener);
  }
  if (assertInitialized(listener)) {
    if (session != null) {
      return true;
    }
 else {
      if (listener != null) {
        if (logger != null && logger.isInitialized()) {
          listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_AUTHENTICATED)));
        }
 else {
          listener.onError(new SocializeException("String_Node_Str"));
        }
      }
      if (logger != null && logger.isInitialized()) {
        logger.error(SocializeLogger.NOT_AUTHENTICATED);
      }
 else {
        System.err.println("String_Node_Str");
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean assertAuthenticated(SocializeListener listener){
  if (asserter != null) {
    return asserter.assertAuthenticated(this,session,listener);
  }
  if (session != null) {
    return true;
  }
 else {
    if (listener != null) {
      if (logger != null && logger.isInitialized()) {
        listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_AUTHENTICATED)));
      }
 else {
        listener.onError(new SocializeException("String_Node_Str"));
      }
    }
    if (logger != null && logger.isInitialized()) {
      logger.error(SocializeLogger.NOT_AUTHENTICATED);
    }
 else {
      System.err.println("String_Node_Str");
    }
  }
  return false;
}
Program: 177789
Project: 177789
Buggy source:
@Override public void authenticateKnownUser(Context context,UserProviderCredentials userProviderCredentials,SocializeAuthListener authListener){
  if (assertInitialized(authListener)) {
    String consumerKey=config.getProperty(SocializeConfig.SOCIALIZE_CONSUMER_KEY);
    String consumerSecret=config.getProperty(SocializeConfig.SOCIALIZE_CONSUMER_SECRET);
    AuthProviderData authProviderData=this.authProviderDataFactory.getBean();
    authProviderData.setAuthProviderInfo(userProviderCredentials.getAuthProviderInfo());
    authProviderData.setToken3rdParty(userProviderCredentials.getAccessToken());
    authProviderData.setSecret3rdParty(userProviderCredentials.getTokenSecret());
    authProviderData.setUserId3rdParty(userProviderCredentials.getUserId());
    authenticate(context,consumerKey,consumerSecret,authProviderData,authListener,false);
  }
}

Fixed version (ground truth):
@Override public void authenticateKnownUser(Context context,UserProviderCredentials userProviderCredentials,SocializeAuthListener authListener){
  if (assertInitialized(context,authListener)) {
    String consumerKey=config.getProperty(SocializeConfig.SOCIALIZE_CONSUMER_KEY);
    String consumerSecret=config.getProperty(SocializeConfig.SOCIALIZE_CONSUMER_SECRET);
    AuthProviderData authProviderData=this.authProviderDataFactory.getBean();
    authProviderData.setAuthProviderInfo(userProviderCredentials.getAuthProviderInfo());
    authProviderData.setToken3rdParty(userProviderCredentials.getAccessToken());
    authProviderData.setSecret3rdParty(userProviderCredentials.getTokenSecret());
    authProviderData.setUserId3rdParty(userProviderCredentials.getUserId());
    authenticate(context,consumerKey,consumerSecret,authProviderData,authListener,false);
  }
}
Program: 177790
Project: 177790
Buggy source:
@Override public boolean isInitialized(){
  return this.initCount > 0;
}

Fixed version (ground truth):
@Override public boolean isInitialized(Context context){
  return this.initCount > 0 && container.getContext() == context;
}
Program: 177791
Project: 177791
Buggy source:
/** 
 * Clears the saved session state for the user.   WARNING: This will wipe any locally saved preferences for this user.
 * @param context
 */
public static void clearCache(Context context){
  if (!Socialize.getSocialize().isInitialized()) {
    Socialize.getSocialize().init(context);
  }
  Socialize.getSocialize().clearSessionCache(context);
}

Fixed version (ground truth):
/** 
 * Clears the saved session state for the user.   WARNING: This will wipe any locally saved preferences for this user.
 * @param context
 */
public static void clearCache(Context context){
  if (!Socialize.getSocialize().isInitialized(context)) {
    Socialize.getSocialize().init(context);
  }
  Socialize.getSocialize().clearSessionCache(context);
}
Program: 177792
Project: 177792
Buggy source:
public static void unregisterProxy(String name){
  Container.unregisterProxy(name);
}

Fixed version (ground truth):
/** 
 * Remove a previously registered proxy.
 * @param name
 */
public static void unregisterProxy(String name){
  Container.unregisterProxy(name);
}
Program: 177793
Project: 177793
Buggy source:
public static void registerProxy(String name,Object proxy){
  Container.registerProxy(name,proxy);
}

Fixed version (ground truth):
/** 
 * Registers a static proxy for the bean with the given name. This method should be called BEFORE the container is initialized.   Calling this method after container initialization will do nothing.
 * @param name
 * @param proxy
 */
public static void registerProxy(String name,Object proxy){
  Container.registerProxy(name,proxy);
}
Program: 177794
Project: 177794
Buggy source:
protected <T extends Object>void setRuntimeProxyInternal(String name,T bean,boolean isStatic){
  BeanRef beanRef=getBeanRef(name);
  if (beanRef != null) {
    if (!beanRef.isSingleton() || isStatic) {
      if (this.mapping.hasProxy(name)) {
        Logger.w(getClass().getSimpleName(),"String_Node_Str" + name + "String_Node_Str");
      }
      mapping.addProxyRef(name);
      ProxyObject<T> proxy=new ProxyObject<T>();
      proxy.setDelegate(bean);
      proxies.put(name,proxy);
    }
 else {
      Logger.w(getClass().getSimpleName(),"String_Node_Str" + name + "String_Node_Str");
    }
  }
 else {
    Logger.e(getClass().getSimpleName(),"String_Node_Str" + name + "String_Node_Str");
  }
}

Fixed version (ground truth):
protected <T extends Object>void setRuntimeProxyInternal(String name,T bean,boolean isStatic){
  BeanRef beanRef=getBeanRef(name);
  if (beanRef != null) {
    if (!beanRef.isSingleton() || isStatic) {
      if (this.mapping.hasProxy(name)) {
        Logger.w(getClass().getSimpleName(),"String_Node_Str" + name + "String_Node_Str");
      }
      mapping.addProxyRef(name);
      ProxyObject<T> proxy=new ProxyObject<T>();
      proxy.setDelegate(bean);
      proxy.setStaticProxy(isStatic);
      proxies.put(name,proxy);
    }
 else {
      Logger.w(getClass().getSimpleName(),"String_Node_Str" + name + "String_Node_Str");
    }
  }
 else {
    Logger.e(getClass().getSimpleName(),"String_Node_Str" + name + "String_Node_Str");
  }
}
Program: 177795
Project: 177795
Buggy source:
@Override public boolean assertInitialized(SocializeService service,SocializeListener listener){
  boolean initialized=service.isInitialized();
  if (!initialized) {
    if (listener != null) {
      if (logger != null) {
        listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_INITIALIZED)));
      }
 else {
        listener.onError(new SocializeException("String_Node_Str"));
      }
    }
    if (logger != null)     logger.error(SocializeLogger.NOT_INITIALIZED);
  }
  return initialized;
}

Fixed version (ground truth):
@Override public boolean assertInitialized(Context context,SocializeService service,SocializeListener listener){
  boolean initialized=service.isInitialized(context);
  if (!initialized) {
    if (listener != null) {
      if (logger != null) {
        listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_INITIALIZED)));
      }
 else {
        listener.onError(new SocializeException("String_Node_Str"));
      }
    }
    if (logger != null)     logger.error(SocializeLogger.NOT_INITIALIZED);
  }
  return initialized;
}
Program: 177796
Project: 177796
Buggy source:
@Override public boolean assertAuthenticated(SocializeService service,SocializeSession session,SocializeListener listener){
  if (assertInitialized(service,listener)) {
    if (session != null) {
      return true;
    }
 else {
      if (listener != null) {
        if (logger != null) {
          listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_AUTHENTICATED)));
        }
 else {
          listener.onError(new SocializeException("String_Node_Str"));
        }
      }
      if (logger != null)       logger.error(SocializeLogger.NOT_AUTHENTICATED);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean assertAuthenticated(SocializeService service,SocializeSession session,SocializeListener listener){
  if (session != null) {
    return true;
  }
 else {
    if (listener != null) {
      if (logger != null) {
        listener.onError(new SocializeException(logger.getMessage(SocializeLogger.NOT_AUTHENTICATED)));
      }
 else {
        listener.onError(new SocializeException("String_Node_Str"));
      }
    }
    if (logger != null)     logger.error(SocializeLogger.NOT_AUTHENTICATED);
  }
  return false;
}
Program: 177797
Project: 177797
Buggy source:
public boolean assertInitialized(SocializeService service,SocializeListener listener);

Fixed version (ground truth):
public boolean assertInitialized(Context context,SocializeService service,SocializeListener listener);
Program: 177798
Project: 177798
Buggy source:
@Override public boolean assertInitialized(SocializeListener listener){
  return super.assertInitialized(listener);
}

Fixed version (ground truth):
@Override public boolean assertInitialized(Context context,SocializeListener listener){
  return super.assertInitialized(context,listener);
}
Program: 177799
Project: 177799
Buggy source:
@Override public boolean assertInitialized(SocializeService service,SocializeListener listener){
  return true;
}

Fixed version (ground truth):
@Override public boolean assertInitialized(Context context,SocializeService service,SocializeListener listener){
  return true;
}
Program: 177801
Project: 177801
Buggy source:
@Override public boolean assertInitialized(SocializeListener listener){
  return true;
}

Fixed version (ground truth):
@Override public boolean assertInitialized(Context context,SocializeListener listener){
  return true;
}
Program: 177802
Project: 177802
Buggy source:
protected void invoke(Activity context,SocializeListener listener,String delegateBean,Method method,Object[] args) throws Throwable {
  SocializeService service=getSocialize();
  if (!service.isInitialized()) {
    doInit(context,listener,delegateBean,method,args);
  }
 else   if (!service.isAuthenticated()) {
    doAuth(context,listener,delegateBean,method,args);
  }
 else {
    method.invoke(Socialize.getBean(delegateBean),args);
  }
}

Fixed version (ground truth):
protected void invoke(Activity context,SocializeListener listener,String delegateBean,Method method,Object[] args) throws Throwable {
  SocializeService service=getSocialize();
  if (!service.isInitialized()) {
    doInitAsync(context,listener,delegateBean,method,args);
  }
 else   if (!service.isAuthenticated()) {
    doAuthAsync(context,listener,delegateBean,method,args);
  }
 else {
    method.invoke(Socialize.getBean(delegateBean),args);
  }
}
Program: 177803
Project: 177803
Buggy source:
/** 
 * Authenticates the application against the API as a user known to your app from a given 3rd party provider.
 * @param context The current context.
 * @param consumerKey The consumer key, obtained from registration at http://www.getsocialize.com.
 * @param consumerSecret The consumer secret, obtained from registration at http://www.getsocialize.com.
 * @param authProviderInfo Information about the auth provider to be used. 
 * @param userProviderCredentials Information about the user being authed.
 * @param authListener The callback for authentication outcomes.
 */
public void authenticateKnownUser(Context context,String consumerKey,String consumerSecret,AuthProviderInfo authProviderInfo,UserProviderCredentials userProviderCredentials,SocializeAuthListener authListener);

Fixed version (ground truth):
/** 
 * Authenticates the application against the API as a user known to your app from a given 3rd party provider.
 * @param context The current context.
 * @param userProviderCredentials Information about the user being authed.
 * @param authListener The callback for authentication outcomes.
 */
public void authenticateKnownUser(Context context,UserProviderCredentials userProviderCredentials,SocializeAuthListener authListener);
Program: 177804
Project: 177804
Buggy source:
@Override public synchronized void authenticateKnownUser(Context context,String consumerKey,String consumerSecret,AuthProviderInfo authProviderInfo,UserProviderCredentials userProviderCredentials,SocializeAuthListener authListener){
  if (assertInitialized(authListener)) {
    AuthProviderData authProviderData=this.authProviderDataFactory.getBean();
    authProviderData.setAuthProviderInfo(authProviderInfo);
    authProviderData.setToken3rdParty(userProviderCredentials.getAccessToken());
    authProviderData.setSecret3rdParty(userProviderCredentials.getTokenSecret());
    authProviderData.setUserId3rdParty(userProviderCredentials.getUserId());
    authenticate(context,consumerKey,consumerSecret,authProviderData,authListener,false);
  }
}

Fixed version (ground truth):
@Override public void authenticateKnownUser(Context context,UserProviderCredentials userProviderCredentials,SocializeAuthListener authListener){
  if (assertInitialized(authListener)) {
    String consumerKey=config.getProperty(SocializeConfig.SOCIALIZE_CONSUMER_KEY);
    String consumerSecret=config.getProperty(SocializeConfig.SOCIALIZE_CONSUMER_SECRET);
    AuthProviderData authProviderData=this.authProviderDataFactory.getBean();
    authProviderData.setAuthProviderInfo(userProviderCredentials.getAuthProviderInfo());
    authProviderData.setToken3rdParty(userProviderCredentials.getAccessToken());
    authProviderData.setSecret3rdParty(userProviderCredentials.getTokenSecret());
    authProviderData.setUserId3rdParty(userProviderCredentials.getUserId());
    authenticate(context,consumerKey,consumerSecret,authProviderData,authListener,false);
  }
}
Program: 177805
Project: 177805
Buggy source:
@Override public WritableSession load(Context context){
  SharedPreferences prefs=context.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE);
  String key=prefs.getString("String_Node_Str",null);
  String secret=prefs.getString("String_Node_Str",null);
  UserProviderCredentialsMap userProviderCredentials=loadUserProviderCredentials(prefs);
  WritableSession session=sessionFactory.create(key,secret,userProviderCredentials);
  session.setConsumerToken(prefs.getString("String_Node_Str",null));
  session.setConsumerTokenSecret(prefs.getString("String_Node_Str",null));
  String userJson=prefs.getString("String_Node_Str",null);
  if (userJson != null) {
    try {
      JSONObject json=new JSONObject(userJson);
      User user=userFactory.fromJSON(json);
      session.setUser(user);
    }
 catch (    JSONException e) {
      if (logger != null) {
        logger.error("String_Node_Str",e);
      }
 else {
        e.printStackTrace();
      }
    }
  }
  return session;
}

Fixed version (ground truth):
@Override public WritableSession load(Context context){
  SharedPreferences prefs=context.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE);
  String key=prefs.getString("String_Node_Str",null);
  String secret=prefs.getString("String_Node_Str",null);
  UserProviderCredentialsMap userProviderCredentials=loadUserProviderCredentials(prefs);
  WritableSession session=sessionFactory.create(key,secret,userProviderCredentials);
  session.setRestored(true);
  session.setConsumerToken(prefs.getString("String_Node_Str",null));
  session.setConsumerTokenSecret(prefs.getString("String_Node_Str",null));
  String userJson=prefs.getString("String_Node_Str",null);
  if (userJson != null) {
    try {
      JSONObject json=new JSONObject(userJson);
      User user=userFactory.fromJSON(json);
      session.setUser(user);
    }
 catch (    JSONException e) {
      if (logger != null) {
        logger.error("String_Node_Str",e);
      }
 else {
        e.printStackTrace();
      }
    }
  }
  return session;
}
Program: 177806
Project: 177806
Buggy source:
public SocializeSession authenticate(Context context,String endpoint,String key,String secret,AuthProviderData data,String udid) throws SocializeException {
  SocializeSession session=provider.authenticate(endpoint,key,secret,data,udid);
  checkNotifications(context,session);
  return session;
}

Fixed version (ground truth):
public SocializeSession authenticate(Context context,String endpoint,String key,String secret,AuthProviderData data,String udid) throws SocializeException {
  SocializeSession session=provider.authenticate(endpoint,key,secret,data,udid);
  if (!session.isRestored()) {
    checkNotifications(context,session);
  }
  return session;
}
Program: 177807
Project: 177807
Buggy source:
protected void handleRegularAuth(Context context,SocializeAuthRequest request,SocializeActionListener wrapper,SocializeAuthListener listener,String key,String secret,boolean force){
  SocializeSession session=null;
  if (!force) {
    try {
      session=loadSession(request.getEndpoint(),key,secret);
    }
 catch (    SocializeException e) {
      logger.warn("String_Node_Str",e);
    }
  }
  if (session != null) {
    if (logger != null && logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + session.getUser().getId() + "String_Node_Str");
    }
    if (listener != null) {
      listener.onAuthSuccess(session);
    }
  }
 else {
    AsyncAuthenicator authenicator=new AsyncAuthenicator(context,null,wrapper);
    authenicator.execute(request);
  }
}

Fixed version (ground truth):
protected void handleRegularAuth(Context context,SocializeAuthRequest request,SocializeActionListener wrapper,SocializeAuthListener listener,String key,String secret){
  AsyncAuthenicator authenicator=new AsyncAuthenicator(context,null,wrapper);
  authenicator.execute(request);
}
Program: 177809
Project: 177809
Buggy source:
@Override public void onAuthSuccess(AuthProviderResponse response){
  authProviderData.setUserId3rdParty(response.getUserId());
  authProviderData.setToken3rdParty(response.getToken());
  authProviderData.setSecret3rdParty(response.getSecret());
  handleRegularAuth(context,request,wrapper,listener,key,secret,true);
}

Fixed version (ground truth):
@Override public void onAuthSuccess(AuthProviderResponse response){
  authProviderData.setUserId3rdParty(response.getUserId());
  authProviderData.setToken3rdParty(response.getToken());
  authProviderData.setSecret3rdParty(response.getSecret());
  handleRegularAuth(context,request,wrapper,listener,key,secret);
}
Program: 177811
Project: 177811
Buggy source:
public void onBeforePost(Activity parent,SocialNetwork socialNetwork,Map<String,String> params){
}

Fixed version (ground truth):
public void onBeforePost(Activity parent,SocialNetwork socialNetwork,PostData postData){
}
Program: 177812
Project: 177812
Buggy source:
@Override protected FacebookAuthProviderInfo initInstance(){
  FacebookAuthProviderInfo info=new FacebookAuthProviderInfo();
  return info;
}

Fixed version (ground truth):
@Override protected FacebookAuthProviderInfo initInstance(){
  FacebookAuthProviderInfo info=facebookAuthProviderInfoInstanceFactory.getBean();
  return info;
}
Program: 177813
Project: 177813
Buggy source:
/** 
 * Sets a custom property.  This will override settings in socialize.properties.
 * @param key
 * @param value
 */
public void setProperty(String key,String value){
  if (properties == null) {
    properties=createProperties();
  }
  if (value != null)   value=value.trim();
  properties.put(key,value);
}

Fixed version (ground truth):
/** 
 * Sets a custom property.  This will override settings in socialize.properties.
 * @param key
 * @param value
 */
public void setProperty(String key,String value){
  if (properties == null) {
    properties=createProperties();
  }
  if (value != null) {
    value=value.trim();
    properties.put(key,value);
  }
 else {
    properties.remove(key);
  }
}
Program: 177814
Project: 177814
Buggy source:
@Override public Map<AuthProviderType,UserAuthData> getUserAuthData(){
  return null;
}

Fixed version (ground truth):
@Override public UserAuthData getUserAuthData(AuthProviderType type){
  return null;
}
Program: 177815
Project: 177815
Buggy source:
@Override public boolean isAuthenticated(AuthProviderType providerType){
  if (isAuthenticated()) {
    if (providerType.equals(AuthProviderType.SOCIALIZE)) {
      return true;
    }
    AuthProviderType authProviderType=session.getAuthProviderType();
    if (authProviderType == null) {
      return false;
    }
 else {
      return (authProviderType.equals(providerType));
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isAuthenticated(AuthProviderType providerType){
  if (isAuthenticated()) {
    if (providerType.equals(AuthProviderType.SOCIALIZE)) {
      return true;
    }
    UserAuthData userAuthData=session.getUserAuthData(providerType);
    if (userAuthData == null) {
      AuthProviderType authProviderType=session.getAuthProviderType();
      if (authProviderType == null) {
        return false;
      }
 else {
        return (authProviderType.equals(providerType));
      }
    }
 else {
      return true;
    }
  }
  return false;
}
Program: 177816
Project: 177816
Buggy source:
@Override public void clear3rdPartySession(Context context,AuthProviderType type){
  try {
    if (session != null) {
      AuthProvider<AuthProviderInfo> provider=authProviders.getProvider(type);
      if (provider != null) {
        boolean cleared=false;
        Map<AuthProviderType,UserAuthData> userAuthDataMap=session.getUserAuthData();
        if (userAuthDataMap != null) {
          UserAuthData userAuthData=userAuthDataMap.get(type);
          if (userAuthData != null) {
            AuthProviderInfo authProviderInfo=userAuthData.getAuthProviderInfo();
            if (authProviderInfo != null) {
              provider.clearCache(context,authProviderInfo);
              cleared=true;
            }
          }
        }
        if (!cleared) {
          AuthProvider<?> authProvider=session.getAuthProvider();
          String get3rdPartyAppId=session.get3rdPartyAppId();
          if (authProvider != null && !StringUtils.isEmpty(get3rdPartyAppId)) {
            authProvider.clearCache(context,get3rdPartyAppId);
          }
        }
      }
      session.clear(type);
    }
  }
  finally {
    if (userSystem != null) {
      userSystem.clearSession(type);
    }
  }
}

Fixed version (ground truth):
@Override public void clear3rdPartySession(Context context,AuthProviderType type){
  try {
    if (session != null) {
      AuthProvider<AuthProviderInfo> provider=authProviders.getProvider(type);
      if (provider != null) {
        boolean cleared=false;
        UserAuthData userAuthData=session.getUserAuthData(type);
        if (userAuthData != null) {
          AuthProviderInfo authProviderInfo=userAuthData.getAuthProviderInfo();
          if (authProviderInfo != null) {
            provider.clearCache(context,authProviderInfo);
            cleared=true;
          }
        }
        if (!cleared) {
          AuthProvider<?> authProvider=session.getAuthProvider();
          String get3rdPartyAppId=session.get3rdPartyAppId();
          if (authProvider != null && !StringUtils.isEmpty(get3rdPartyAppId)) {
            authProvider.clearCache(context,get3rdPartyAppId);
          }
        }
      }
      session.clear(type);
    }
  }
  finally {
    if (userSystem != null) {
      userSystem.clearSession(type);
    }
  }
}
Program: 177817
Project: 177817
Buggy source:
/** 
 * Returns the set of session data for any 3rd party providers.
 * @return
 */
public Map<AuthProviderType,UserAuthData> getUserAuthData();

Fixed version (ground truth):
public UserAuthData getUserAuthData(AuthProviderType type);
Program: 177818
Project: 177818
Buggy source:
public Map<AuthProviderType,UserAuthData> getUserAuthData(){
  return userAuthData;
}

Fixed version (ground truth):
@Override public UserAuthData getUserAuthData(AuthProviderType type){
  return userAuthData.get(type);
}
Program: 177819
Project: 177819
Buggy source:
@SuppressWarnings("String_Node_Str") @UsesMocks({Map.class,AuthProvider.class}) public void testGetProvider(){
  final AuthProviderType type=AuthProviderType.FACEBOOK;
  Map<Integer,AuthProvider> providerMap=AndroidMock.createMock(Map.class);
  AuthProvider provider=AndroidMock.createMock(AuthProvider.class);
  AndroidMock.expect(providerMap.get(type.getId())).andReturn(provider);
  AndroidMock.replay(providerMap);
  AuthProviders providers=new AuthProviders();
  providers.setProviders(providerMap);
  assertSame(provider,providers.getProvider(type));
  AndroidMock.verify(providerMap);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @UsesMocks({Map.class,AuthProvider.class}) public void testGetProvider(){
  final AuthProviderType type=AuthProviderType.FACEBOOK;
  Map<Integer,AuthProvider<?>> providerMap=AndroidMock.createMock(Map.class);
  AuthProvider<FacebookAuthProviderInfo> provider=AndroidMock.createMock(AuthProvider.class);
  AndroidMock.expect((AuthProvider<FacebookAuthProviderInfo>)providerMap.get(type.getId())).andReturn(provider);
  AndroidMock.replay(providerMap);
  AuthProviders providers=new AuthProviders();
  providers.setProviders(providerMap);
  assertSame(provider,providers.getProvider(type));
  AndroidMock.verify(providerMap);
}
Program: 177821
Project: 177821
Buggy source:
@Override public void authenticate(SocializeAuthRequest authRequest,String appId,AuthProviderListener listener){
  addResult(1,listener);
}

Fixed version (ground truth):
@Override public void authenticate(SocializeAuthRequest authRequest,AuthProviderInfo info,AuthProviderListener listener){
  addResult(1,listener);
}
Program: 177822
Project: 177822
Buggy source:
@Override public void clearCache(Context context,String appId){
  fail();
}

Fixed version (ground truth):
@Override public void clearCache(Context context,AuthProviderInfo info){
  fail();
}
Program: 177824
Project: 177824
Buggy source:
@Override public void authenticate(SocializeAuthRequest authRequest,FacebookAuthProviderInfo info,AuthProviderListener listener){
  AuthProviderResponse mockResponse=new AuthProviderResponse();
  mockResponse.setUserId(userId);
  mockResponse.setToken(token);
  listener.onAuthSuccess(mockResponse);
}

Fixed version (ground truth):
@Override public void authenticate(FacebookAuthProviderInfo info,AuthProviderListener listener){
  AuthProviderResponse mockResponse=new AuthProviderResponse();
  mockResponse.setUserId(userId);
  mockResponse.setToken(token);
  listener.onAuthSuccess(mockResponse);
}
Program: 177826
Project: 177826
Buggy source:
@Override public String buildShareLink(Entity entity){
  Long id=entity.getId();
  if (id != null) {
    if (config != null) {
      String host=config.getProperty(SocializeConfig.REDIRECT_HOST);
      if (!StringUtils.isEmpty(host)) {
        return host + "String_Node_Str" + id;
      }
    }
    return "String_Node_Str" + id;
  }
 else {
    return entity.getKey();
  }
}

Fixed version (ground truth):
@Override public String buildShareLink(Entity entity){
  return appUtils.getEntityUrl(entity);
}
Program: 177827
Project: 177827
Buggy source:
protected void setupListeners(){
  cancelButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      context.finish();
    }
  }
);
  saveButton.setOnClickListener(profileSaveButtonListenerFactory.getBean(getContext(),this));
  if (facebookEnabledCheckbox != null) {
    facebookEnabledCheckbox.setSignInListener(new SocializeAuthListener(){
      @Override public void onError(      SocializeException error){
        ProfileContentView.this.showError(ProfileContentView.this.getContext(),error);
      }
      @Override public void onCancel(){
      }
      @Override public void onAuthSuccess(      SocializeSession session){
        parent.setUserId(session.getUser().getId().toString());
        parent.doGetUserProfile();
      }
      @Override public void onAuthFail(      SocializeException error){
        ProfileContentView.this.showError(ProfileContentView.this.getContext(),error);
      }
    }
);
    facebookEnabledCheckbox.setSignOutListener(new FacebookSignOutListener(){
      @Override public void onSignOut(){
        parent.setUserId(Socialize.getSocialize().getSession().getUser().getId().toString());
        parent.doGetUserProfile();
      }
      @Override public void onCancel(){
      }
    }
);
  }
}

Fixed version (ground truth):
protected void setupListeners(){
  cancelButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      context.finish();
    }
  }
);
  saveButton.setOnClickListener(profileSaveButtonListenerFactory.getBean(getContext(),this));
  if (facebookEnabledCheckbox != null) {
    facebookEnabledCheckbox.setSignInListener(new SocializeAuthListener(){
      @Override public void onError(      SocializeException error){
        ProfileContentView.this.showErrorToast(ProfileContentView.this.getContext(),error);
      }
      @Override public void onCancel(){
      }
      @Override public void onAuthSuccess(      SocializeSession session){
        parent.setUserId(session.getUser().getId().toString());
        parent.doGetUserProfile();
      }
      @Override public void onAuthFail(      SocializeException error){
        ProfileContentView.this.showErrorToast(ProfileContentView.this.getContext(),error);
      }
    }
);
    facebookEnabledCheckbox.setSignOutListener(new FacebookSignOutListener(){
      @Override public void onSignOut(){
        parent.setUserId(Socialize.getSocialize().getSession().getUser().getId().toString());
        parent.doGetUserProfile();
      }
      @Override public void onCancel(){
      }
    }
);
  }
}
Program: 177828
Project: 177828
Buggy source:
@Override public void onAuthFail(SocializeException error){
  ProfileContentView.this.showError(ProfileContentView.this.getContext(),error);
}

Fixed version (ground truth):
@Override public void onAuthFail(SocializeException error){
  ProfileContentView.this.showErrorToast(ProfileContentView.this.getContext(),error);
}
Program: 177829
Project: 177829
Buggy source:
@Override public void onError(SocializeException error){
  ProfileContentView.this.showError(ProfileContentView.this.getContext(),error);
}

Fixed version (ground truth):
@Override public void onError(SocializeException error){
  ProfileContentView.this.showErrorToast(ProfileContentView.this.getContext(),error);
}
Program: 177830
Project: 177830
Buggy source:
public void init(Context context){
  packageName=context.getPackageName();
  try {
    Resources appR=context.getResources();
    CharSequence txt=appR.getText(appR.getIdentifier("String_Node_Str","String_Node_Str",context.getPackageName()));
    appName=txt.toString();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    if (logger != null) {
      logger.error(msg,e);
    }
 else {
      System.err.println(msg);
      e.printStackTrace();
    }
  }
  if (StringUtils.isEmpty(appName)) {
    appName=packageName;
  }
  if (StringUtils.isEmpty(appName)) {
    appName="String_Node_Str";
  }
}

Fixed version (ground truth):
public void init(Context context){
  packageName=context.getPackageName();
  try {
    Resources appR=context.getResources();
    CharSequence txt=appR.getText(appR.getIdentifier("String_Node_Str","String_Node_Str",packageName));
    appName=txt.toString();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    if (logger != null) {
      logger.error(msg,e);
    }
 else {
      System.err.println(msg);
      e.printStackTrace();
    }
  }
  if (StringUtils.isEmpty(appName)) {
    appName=packageName;
  }
  if (StringUtils.isEmpty(appName)) {
    appName="String_Node_Str";
  }
}
Program: 177831
Project: 177831
Buggy source:
@Override public String getMarketUrl(){
  StringBuilder builder=new StringBuilder();
  builder.append("String_Node_Str");
  builder.append(getAppName());
  return builder.toString();
}

Fixed version (ground truth):
@Override public String getMarketUrl(){
  StringBuilder builder=new StringBuilder();
  String appStore=config.getProperty(SocializeConfig.REDIRECT_APP_STORE);
  if (!StringUtils.isEmpty(appStore) && appStore.equalsIgnoreCase("String_Node_Str")) {
    builder.append("String_Node_Str");
  }
 else {
    builder.append("String_Node_Str");
  }
  builder.append(getPackageName());
  return builder.toString();
}
Program: 177832
Project: 177832
Buggy source:
public void test_buildShareLink(){
  SocializeConfig config=AndroidMock.createMock(SocializeConfig.class);
  Entity entity=AndroidMock.createMock(Entity.class);
  AndroidMock.expect(config.getProperty(SocializeConfig.REDIRECT_HOST)).andReturn("String_Node_Str");
  AndroidMock.expect(entity.getId()).andReturn(69L);
  AndroidMock.replay(config,entity);
  DefaultShareMessageBuilder builder=new DefaultShareMessageBuilder();
  builder.setConfig(config);
  String link=builder.buildShareLink(entity);
  AndroidMock.verify(config,entity);
  assertEquals("String_Node_Str",link);
}

Fixed version (ground truth):
@UsesMocks({AppUtils.class}) public void test_buildShareLink(){
  AppUtils appUtils=AndroidMock.createMock(AppUtils.class);
  Entity entity=AndroidMock.createMock(Entity.class);
  AndroidMock.expect(appUtils.getEntityUrl(entity)).andReturn("String_Node_Str");
  AndroidMock.replay(appUtils);
  DefaultShareMessageBuilder builder=new DefaultShareMessageBuilder();
  builder.setAppUtils(appUtils);
  String link=builder.buildShareLink(entity);
  AndroidMock.verify(appUtils);
  assertEquals("String_Node_Str",link);
}
Program: 177834
Project: 177834
Buggy source:
@Override public void authenticate(SocializeAuthRequest authRequest,AuthProviderInfo info,AuthProviderListener listener){
  addResult(1,listener);
}

Fixed version (ground truth):
@Override public void authenticate(AuthProviderInfo info,AuthProviderListener listener){
  addResult(1,listener);
}
Program: 177837
Project: 177837
Buggy source:
public Drawable getDrawable(String name,int density,boolean tileX,boolean tileY,int scaleToWidth,int scaleToHeight,boolean eternal,int forceDensity){
  String densityPath=getPath(name,density);
  String commonPath=getPath(name);
  CacheableDrawable drawable=cache.get(densityPath);
  if (drawable == null) {
    drawable=cache.get(commonPath);
  }
  if (drawable != null && !drawable.isRecycled()) {
    return drawable;
  }
  InputStream in=null;
  try {
    ClassLoader loader=null;
    if (classLoaderProvider != null) {
      loader=classLoaderProvider.getClassLoader();
    }
 else {
      loader=Drawables.class.getClassLoader();
    }
    String path=densityPath;
    in=loader.getResourceAsStream(path);
    if (in == null) {
      if (logger != null && logger.isInfoEnabled()) {
        logger.info("String_Node_Str" + path + "String_Node_Str");
      }
      path=commonPath;
      in=loader.getResourceAsStream(path);
    }
    if (in != null) {
      drawable=createDrawable(in,path,tileX,tileY,scaleToWidth,scaleToHeight,forceDensity);
      addToCache(path,drawable,eternal);
    }
 else {
      if (logger != null && logger.isWarnEnabled()) {
        logger.warn("String_Node_Str" + path + "String_Node_Str");
      }
    }
    return drawable;
  }
  finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException ignore) {
        ignore.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
public Drawable getDrawable(String name,int density,boolean tileX,boolean tileY,int scaleToWidth,int scaleToHeight,boolean eternal,int forceDensity){
  String densityPath=getPath(name,density);
  String commonPath=getPath(name);
  CacheableDrawable drawable=cache.get(densityPath + name);
  if (drawable == null) {
    drawable=cache.get(commonPath + name);
  }
  if (drawable != null && !drawable.isRecycled()) {
    return drawable;
  }
  InputStream in=null;
  try {
    ClassLoader loader=null;
    if (classLoaderProvider != null) {
      loader=classLoaderProvider.getClassLoader();
    }
 else {
      loader=Drawables.class.getClassLoader();
    }
    String path=densityPath;
    in=loader.getResourceAsStream(path);
    if (in == null) {
      if (logger != null && logger.isInfoEnabled()) {
        logger.info("String_Node_Str" + path + "String_Node_Str");
      }
      path=commonPath;
      in=loader.getResourceAsStream(path);
    }
    if (in != null) {
      drawable=createDrawable(in,path + name,tileX,tileY,scaleToWidth,scaleToHeight,forceDensity);
      addToCache(path + name,drawable,eternal);
    }
 else {
      if (logger != null && logger.isWarnEnabled()) {
        logger.warn("String_Node_Str" + path + "String_Node_Str");
      }
    }
    return drawable;
  }
  finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException ignore) {
        ignore.printStackTrace();
      }
    }
  }
}
Program: 177838
Project: 177838
Buggy source:
@Override public final void onCreate(Bundle savedInstanceState){
  try {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    onCreateSafe(savedInstanceState);
  }
 catch (  Throwable e) {
    Log.e("String_Node_Str","String_Node_Str",e);
    finish();
  }
}

Fixed version (ground truth):
@Override public final void onCreate(Bundle savedInstanceState){
  try {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    onCreateSafe(savedInstanceState);
  }
 catch (  Throwable e) {
    Log.e(SocializeLogger.LOG_TAG,"String_Node_Str",e);
    finish();
  }
}
Program: 177839
Project: 177839
Buggy source:
@Override public void onClick(View v){
  try {
    String uri="String_Node_Str" + action.getLat() + "String_Node_Str"+ action.getLon()+ "String_Node_Str";
    Intent intent=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
    getActivity().startActivity(intent);
  }
 catch (  Exception e) {
    if (logger != null) {
      logger.warn("String_Node_Str",e);
    }
 else {
      Log.w("String_Node_Str","String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  try {
    String uri="String_Node_Str" + action.getLat() + "String_Node_Str"+ action.getLon()+ "String_Node_Str";
    Intent intent=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
    getActivity().startActivity(intent);
  }
 catch (  Exception e) {
    if (logger != null) {
      logger.warn("String_Node_Str",e);
    }
 else {
      Log.w(SocializeLogger.LOG_TAG,"String_Node_Str",e);
    }
  }
}
Program: 177840
Project: 177840
Buggy source:
public void setAction(final SocializeAction action){
  if (actionView != null) {
    actionView.setAction(action,new Date());
    actionView.setVisibility(VISIBLE);
  }
  User user=action.getUser();
  if (user != null) {
    divider.setText("String_Node_Str" + user.getDisplayName());
  }
  if (actionLocation != null) {
    if (action.isLocationShared() && action.getLat() != null && action.getLon() != null) {
      Address address=geoUtils.geoCode(action.getLat(),action.getLon());
      if (address != null) {
        actionLocationLine.setVisibility(View.VISIBLE);
        actionLocation.setText(geoUtils.getSimpleLocation(address));
        actionLocation.setOnClickListener(new OnClickListener(){
          @Override public void onClick(          View v){
            try {
              String uri="String_Node_Str" + action.getLat() + "String_Node_Str"+ action.getLon()+ "String_Node_Str";
              Intent intent=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
              getActivity().startActivity(intent);
            }
 catch (            Exception e) {
              if (logger != null) {
                logger.warn("String_Node_Str",e);
              }
 else {
                Log.w("String_Node_Str","String_Node_Str",e);
              }
            }
          }
        }
);
      }
    }
  }
}

Fixed version (ground truth):
public void setAction(final SocializeAction action){
  if (actionView != null) {
    actionView.setAction(action,new Date());
    actionView.setVisibility(VISIBLE);
  }
  User user=action.getUser();
  if (user != null) {
    divider.setText("String_Node_Str" + user.getDisplayName());
  }
  if (actionLocation != null) {
    if (action.isLocationShared() && action.getLat() != null && action.getLon() != null) {
      Address address=geoUtils.geoCode(action.getLat(),action.getLon());
      if (address != null) {
        actionLocationLine.setVisibility(View.VISIBLE);
        actionLocation.setText(geoUtils.getSimpleLocation(address));
        actionLocation.setOnClickListener(new OnClickListener(){
          @Override public void onClick(          View v){
            try {
              String uri="String_Node_Str" + action.getLat() + "String_Node_Str"+ action.getLon()+ "String_Node_Str";
              Intent intent=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
              getActivity().startActivity(intent);
            }
 catch (            Exception e) {
              if (logger != null) {
                logger.warn("String_Node_Str",e);
              }
 else {
                Log.w(SocializeLogger.LOG_TAG,"String_Node_Str",e);
              }
            }
          }
        }
);
      }
    }
  }
}