nus-yam/ex-repair huggingface dataset:
Program: 51366
Project: 51366
Buggy source:
@Override public void onPageFinished(WebView view,String url){
  if (!mHasFiredReadyEvent) {
    mDisplayController.initializeJavaScriptState();
    fireChangeEventForProperty(MraidPlacementTypeProperty.createWithType(mPlacementType));
    fireReadyEvent();
    if (getOnReadyListener() != null)     getOnReadyListener().onReady(MraidView.this);
    mHasFiredReadyEvent=true;
  }
}

Fixed version (ground truth):
@Override public void onPageFinished(WebView view,String url){
  if (!mHasFiredReadyEvent && mDisplayController != null) {
    mDisplayController.initializeJavaScriptState();
    fireChangeEventForProperty(MraidPlacementTypeProperty.createWithType(mPlacementType));
    fireReadyEvent();
    if (getOnReadyListener() != null)     getOnReadyListener().onReady(MraidView.this);
    mHasFiredReadyEvent=true;
  }
}
Program: 51367
Project: 51367
Buggy source:
public AdView(Context context){
  super(context);
  disableScrollingAndZoom();
  getSettings().setJavaScriptEnabled(true);
  getSettings().setPluginsEnabled(true);
  setBackgroundColor(Color.TRANSPARENT);
  setWebViewClient(new AdWebViewClient());
}

Fixed version (ground truth):
public AdView(Context context){
  super(context);
  disableScrollingAndZoom();
  getSettings().setJavaScriptEnabled(true);
  setBackgroundColor(Color.TRANSPARENT);
  setWebViewClient(new AdWebViewClient());
}
Program: 51368
Project: 51368
Buggy source:
public void removeAllBanners(){
  stopLoading();
  clearAnimation();
  if (mCurrentView != null) {
    mBaseView.removeView(mCurrentView);
    mCurrentView.destroy();
    mCurrentView=null;
  }
}

Fixed version (ground truth):
public void removeAllBanners(){
  stopLoading();
  clearAnimation();
  if (mCurrentView != null) {
    mBaseView.removeView(mCurrentView);
    mCurrentView.removeAllViews();
    mCurrentView.destroy();
    mCurrentView=null;
  }
}
Program: 51369
Project: 51369
Buggy source:
private void removeLocationUpdates(){
  mLocationManager.removeUpdates(mLocationListener);
  mLocationRequestUpdatesEnabled=false;
}

Fixed version (ground truth):
private void removeLocationUpdates(){
  if (mLocationRequestUpdatesEnabled) {
    mLocationManager.removeUpdates(mLocationListener);
    mLocationRequestUpdatesEnabled=false;
  }
}
Program: 51370
Project: 51370
Buggy source:
protected HttpURLConnection makeConnection(String url){
  HttpURLConnection connection=null;
  try {
    connection=(HttpURLConnection)new URL(url).openConnection();
    for (    Entry<String,String> entry : mRequestPropertyList.entrySet())     connection.setRequestProperty(entry.getKey(),entry.getValue());
    connection.connect();
  }
 catch (  MalformedURLException e) {
    Log.e(LOGTAG,"String_Node_Str" + url,e);
  }
catch (  Exception e) {
    Log.e(LOGTAG,"String_Node_Str",e);
  }
  return connection;
}

Fixed version (ground truth):
protected HttpURLConnection makeConnection(Plus1Request request){
  HttpURLConnection connection=null;
  String url=getRequestUrl(request);
  Log.d(LOGTAG,"String_Node_Str" + url);
  try {
    connection=(HttpURLConnection)new URL(url).openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("String_Node_Str");
    for (    Entry<String,String> entry : mRequestPropertyList.entrySet()) {
      connection.setRequestProperty(entry.getKey(),entry.getValue());
      Log.d(LOGTAG,String.format("String_Node_Str",entry.getKey(),entry.getValue()));
    }
    UrlEncodedFormEntity postEntity=getUrlEncodedFormEntity(request);
    connection.setRequestProperty("String_Node_Str","String_Node_Str");
    connection.setRequestProperty("String_Node_Str",Integer.toString((int)postEntity.getContentLength()));
    postEntity.writeTo(connection.getOutputStream());
    connection.connect();
  }
 catch (  MalformedURLException e) {
    Log.e(LOGTAG,"String_Node_Str" + url,e);
  }
catch (  Exception e) {
    Log.e(LOGTAG,"String_Node_Str",e);
  }
  return connection;
}
Program: 51371
Project: 51371
Buggy source:
@Override final protected T doInBackground(Plus1Request... requests){
  Plus1Request request=requests[0];
  String requestUrl=getRequestUrl(request);
  HttpURLConnection connection=makeConnection(requestUrl);
  if (connection == null)   return null;
  T result=null;
  String content="String_Node_Str";
  try {
    UrlEncodedFormEntity postEntity=getUrlEncodedFormEntity(request);
    connection.setRequestMethod("String_Node_Str");
    connection.setRequestProperty("String_Node_Str","String_Node_Str");
    connection.setRequestProperty("String_Node_Str",Integer.toString((int)postEntity.getContentLength()));
    postEntity.writeTo(connection.getOutputStream());
    InputStream stream=connection.getInputStream();
    byte[] buffer=new byte[BUFFER_SIZE];
    int count=0;
    BufferedInputStream bufStream=new BufferedInputStream(stream,BUFFER_SIZE);
    while ((count=bufStream.read(buffer)) != -1) {
      if (isCancelled())       return null;
      content+=new String(buffer,0,count);
    }
    bufStream.close();
    EnumMap<SdkParameter,String> parameters=getSdkParametersByJson(connection.getHeaderField(SDK_PARAMETERS_HEADER));
    EnumMap<SdkAction,String> actions=getSdkActionsByJson(connection.getHeaderField(SDK_ACTION_HEADER));
    if (!(null == parameters || parameters.isEmpty()))     notifyOnSdkParametersLoaded(parameters);
    if (!(null == actions || actions.isEmpty()))     notifyOnSdkActionsLoaded(actions);
    result=makeResult(content.toString(),connection);
  }
 catch (  IOException e) {
    Log.e(LOGTAG,"String_Node_Str" + requestUrl + "String_Node_Str",e);
  }
catch (  Exception e) {
    Log.e(LOGTAG,"String_Node_Str" + e.getMessage(),e);
  }
 finally {
    connection.disconnect();
  }
  return result;
}

Fixed version (ground truth):
@Override final protected T doInBackground(Plus1Request... requests){
  Plus1Request request=requests[0];
  String requestUrl=getRequestUrl(request);
  HttpURLConnection connection=makeConnection(request);
  if (connection == null)   return null;
  T result=null;
  String content="String_Node_Str";
  try {
    InputStream stream=connection.getInputStream();
    byte[] buffer=new byte[BUFFER_SIZE];
    int count=0;
    BufferedInputStream bufStream=new BufferedInputStream(stream,BUFFER_SIZE);
    while ((count=bufStream.read(buffer)) != -1) {
      if (isCancelled())       return null;
      content+=new String(buffer,0,count);
    }
    bufStream.close();
    EnumMap<SdkParameter,String> parameters=getSdkParametersByJson(connection.getHeaderField(SDK_PARAMETERS_HEADER));
    EnumMap<SdkAction,String> actions=getSdkActionsByJson(connection.getHeaderField(SDK_ACTION_HEADER));
    if (!(null == parameters || parameters.isEmpty()))     notifyOnSdkParametersLoaded(parameters);
    if (!(null == actions || actions.isEmpty()))     notifyOnSdkActionsLoaded(actions);
    result=makeResult(content.toString(),connection);
  }
 catch (  IOException e) {
    Log.e(LOGTAG,"String_Node_Str" + requestUrl + "String_Node_Str",e);
  }
catch (  Exception e) {
    Log.e(LOGTAG,"String_Node_Str" + e.getMessage(),e);
  }
 finally {
    connection.disconnect();
  }
  return result;
}
Program: 51372
Project: 51372
Buggy source:
private void notifyOnSdkActionsLoaded(EnumMap<SdkAction,String> actions){
  for (  ChangeSdkPropertiesListener listener : mChangeSdkPropertiesListenerList)   listener.onSdkActionsLoaded(actions);
}

Fixed version (ground truth):
private void notifyOnSdkActionsLoaded(EnumMap<SdkAction,String> actions){
  Log.d(LOGTAG,"String_Node_Str");
  for (  ChangeSdkPropertiesListener listener : mChangeSdkPropertiesListenerList)   listener.onSdkActionsLoaded(actions);
}
Program: 51373
Project: 51373
Buggy source:
private void notifyOnSdkParametersLoaded(EnumMap<SdkParameter,String> parameters){
  for (  ChangeSdkPropertiesListener listener : mChangeSdkPropertiesListenerList)   listener.onSdkParametersLoaded(parameters);
}

Fixed version (ground truth):
private void notifyOnSdkParametersLoaded(EnumMap<SdkParameter,String> parameters){
  Log.d(LOGTAG,"String_Node_Str");
  for (  ChangeSdkPropertiesListener listener : mChangeSdkPropertiesListenerList)   listener.onSdkParametersLoaded(parameters);
}
Program: 51374
Project: 51374
Buggy source:
protected HtmlBannerInfo makeResult(String content,HttpURLConnection connection) throws IOException {
  Log.d(LOGTAG,"String_Node_Str" + content);
  HtmlBannerInfo bannerInfo=new HtmlBannerInfo();
  bannerInfo.mResponseCode=connection.getResponseCode();
  bannerInfo.mBannerContent=content;
  bannerInfo.mBannerAdType=connection.getHeaderField("String_Node_Str");
  Log.d(LOGTAG,"String_Node_Str" + bannerInfo.mResponseCode);
  Log.d(LOGTAG,"String_Node_Str" + bannerInfo.mBannerAdType);
  Log.d(LOGTAG,"String_Node_Str" + bannerInfo.mBannerContent);
  return bannerInfo;
}

Fixed version (ground truth):
protected HtmlBannerInfo makeResult(String content,HttpURLConnection connection) throws IOException {
  HtmlBannerInfo bannerInfo=new HtmlBannerInfo();
  bannerInfo.mResponseCode=connection.getResponseCode();
  bannerInfo.mBannerContent=content;
  bannerInfo.mBannerAdType=connection.getHeaderField("String_Node_Str");
  Log.d(LOGTAG,"String_Node_Str" + bannerInfo.mResponseCode);
  Log.d(LOGTAG,"String_Node_Str" + bannerInfo.mBannerAdType);
  Log.d(LOGTAG,"String_Node_Str" + bannerInfo.mBannerContent);
  return bannerInfo;
}
Program: 51375
Project: 51375
Buggy source:
@Override protected void onPostExecute(HtmlBannerInfo bannerInfo){
  if (bannerInfo == null) {
    notifyOnBannerLoadFailed(LoadError.DownloadFailed);
  }
 else   if (bannerInfo.mResponseCode.equals(HttpStatus.SC_NO_CONTENT)) {
    notifyOnBannerLoadFailed(LoadError.NoHaveBanner);
  }
 else {
    try {
      notifyOnBannerLoaded(bannerInfo.mBannerContent,BannerAdType.valueOf(bannerInfo.mBannerAdType));
    }
 catch (    IllegalArgumentException e) {
      Log.e(LOGTAG,"String_Node_Str" + bannerInfo.mBannerAdType,e);
      notifyOnBannerLoadFailed(LoadError.UnknownAnswer);
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(HtmlBannerInfo bannerInfo){
  if (bannerInfo == null) {
    notifyOnBannerLoadFailed(LoadError.DownloadFailed);
  }
 else   if (bannerInfo.mResponseCode.equals(HttpStatus.SC_NO_CONTENT)) {
    notifyOnBannerLoadFailed(LoadError.NoHaveBanner);
  }
 else {
    try {
      notifyOnBannerLoaded(bannerInfo.mBannerContent,null == bannerInfo.mBannerAdType ? BannerAdType.plus1 : BannerAdType.valueOf(bannerInfo.mBannerAdType));
    }
 catch (    IllegalArgumentException e) {
      Log.e(LOGTAG,"String_Node_Str" + bannerInfo.mBannerAdType,e);
      notifyOnBannerLoadFailed(LoadError.UnknownAnswer);
    }
  }
}
Program: 51376
Project: 51376
Buggy source:
public void run(){
  if (!(mView.isClosed() || mView.isExpanded())) {
    modifyRequest(mRequest);
    mDownloaderTask=makeDownloaderTask();
    mDownloaderTask.execute(mRequest);
  }
}

Fixed version (ground truth):
public void run(){
  modifyRequest(mRequest);
  makeInitRequestTask().execute(mRequest);
  mReInitHandler.postDelayed(this,mReInitDelay * 1000);
}
Program: 51378
Project: 51378
Buggy source:
private void start(){
  Log.d(LOGTAG,"String_Node_Str");
  if (mRequest == null || mView == null || mDownloaderTask != null)   return;
  TimerTask task=new TimerTask(){
    public void run(){
      if (!(mView.isClosed() || mView.isExpanded())) {
        modifyRequest(mRequest);
        mDownloaderTask=makeDownloaderTask();
        mDownloaderTask.execute(mRequest);
      }
    }
  }
;
  if (isAutoRefreshEnabled()) {
    mDownloaderTimer.schedule(task,0,mRefreshDelay);
  }
 else {
    mDownloaderTimer.schedule(task,0);
  }
}

Fixed version (ground truth):
private void start(){
  Log.d(LOGTAG,"String_Node_Str");
  if (mRequest == null || mView == null || mDownloaderTask != null)   return;
  mExecuteDownloadHandler.post(mExecuteDownloadTask);
}
Program: 51379
Project: 51379
Buggy source:
private void stop(){
  Log.d(LOGTAG,"String_Node_Str");
  if (mDownloaderTask != null) {
    mDownloaderTask.cancel(true);
    mDownloaderTask=null;
  }
  mDownloaderTimer.cancel();
}

Fixed version (ground truth):
private void stop(){
  Log.d(LOGTAG,"String_Node_Str");
  if (mDownloaderTask != null) {
    mDownloaderTask.cancel(true);
    mDownloaderTask=null;
  }
  mExecuteDownloadHandler.removeCallbacks(mExecuteDownloadTask);
}
Program: 51380
Project: 51380
Buggy source:
public static String getContainerMetrics(Plus1BannerView view){
  float density=((Activity)view.getContext()).getResources().getDisplayMetrics().density;
  return String.format("String_Node_Str",view.getLayoutParams().width / density + 0.5f,view.getLayoutParams().height / density + 0.5f);
}

Fixed version (ground truth):
public static String getContainerMetrics(Plus1BannerView view){
  float density=((Activity)view.getContext()).getResources().getDisplayMetrics().density;
  return String.format("String_Node_Str",(int)(view.getLayoutParams().width / density + 0.5f),(int)(view.getLayoutParams().height / density + 0.5f));
}
Program: 51381
Project: 51381
Buggy source:
public void onCloseButton(Plus1BannerView view){
  onCloseBannerView();
}

Fixed version (ground truth):
public void onCloseButton(Plus1BannerView view){
  stop();
}
Program: 51382
Project: 51382
Buggy source:
public Plus1BannerAsker(Plus1Request request,Plus1BannerView view){
  mRequest=request;
  mView=view;
  view.setOnAutorefreshChangeListener(new Plus1BannerView.OnAutorefreshStateListener(){
    public void onAutorefreshStateChanged(    Plus1BannerView view){
      if (view.getAutorefreshEnabled() && !view.isExpanded())       start();
 else       stop();
    }
  }
);
}

Fixed version (ground truth):
public Plus1BannerAsker(Plus1Request request,Plus1BannerView view){
  mRequest=request;
  mView=view;
}
Program: 51383
Project: 51383
Buggy source:
/** 
 * @deprecated please use disableAutoDetectLocation() without argument
 */
public Plus1BannerAsker disableAutoDetectLocation(boolean disable){
  mDisabledAutoDetectLocation=disable;
  return this;
}

Fixed version (ground truth):
public Plus1BannerAsker disableAutoDetectLocation(){
  mDisabledAutoDetectLocation=true;
  return this;
}
Program: 51385
Project: 51385
Buggy source:
public Plus1BannerAsker init(){
  if (initialized)   return this;
  if (!isDisabledAutoDetectLocation()) {
    this.locationManager=(LocationManager)view.getContext().getSystemService(Context.LOCATION_SERVICE);
    this.locationListener=new Plus1LocationListener(request);
  }
  if (viewStateListener != null)   view.setViewStateListener(viewStateListener);
 else   view.setViewStateListener(this);
  if (visibilityTimeout == 0)   visibilityTimeout=timeout * 3;
  handler=new Handler();
  initialized=true;
  return this;
}

Fixed version (ground truth):
public Plus1BannerAsker init(){
  if (initialized)   return this;
  if (!isDisabledAutoDetectLocation()) {
    this.locationManager=(LocationManager)view.getContext().getSystemService(Context.LOCATION_SERVICE);
    this.locationListener=new Plus1LocationListener(request);
  }
  if (viewStateListener != null)   view.setViewStateListener(viewStateListener);
 else   view.setViewStateListener(this);
  if (visibilityTimeout == 0)   visibilityTimeout=timeout * 3;
  handler=new Handler();
  new WebView(view.getContext()).resumeTimers();
  initialized=true;
  return this;
}
Program: 51386
Project: 51386
Buggy source:
protected void updateBanner(){
  final Plus1Banner banner=getBanner();
  view.post(new Runnable(){
    public void run(){
      view.setBanner(banner);
    }
  }
);
  if (banner != null) {
    String imageUrl=null;
    if (!banner.getPictureUrl().equals("String_Node_Str"))     imageUrl=banner.getPictureUrl();
 else     if (!banner.getPictureUrlPng().equals("String_Node_Str"))     imageUrl=banner.getPictureUrlPng();
    if (imageUrl != null)     downloadImage(imageUrl);
  }
}

Fixed version (ground truth):
protected void updateBanner(){
  try {
    final Plus1Banner banner=getBanner();
    view.post(new Runnable(){
      public void run(){
        view.setBanner(banner);
      }
    }
);
    if (banner != null) {
      String imageUrl=null;
      if (!banner.getPictureUrl().equals("String_Node_Str"))       imageUrl=banner.getPictureUrl();
 else       if (!banner.getPictureUrlPng().equals("String_Node_Str"))       imageUrl=banner.getPictureUrlPng();
      if (imageUrl != null)       downloadImage(imageUrl);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getName(),"String_Node_Str" + e.getMessage());
  }
}
Program: 51387
Project: 51387
Buggy source:
protected String getBannerData(){
  InputStream stream=getStream(request.getRequestUri());
  String result=new String();
  try {
    byte[] buffer=new byte[BUFFER_SIZE];
    int count=0;
    BufferedInputStream bufStream=new BufferedInputStream(stream,BUFFER_SIZE);
    if (bufStream != null)     while ((count=bufStream.read(buffer)) != -1)     result+=new String(buffer,0,count);
    bufStream.close();
  }
 catch (  IOException e) {
    Log.e(getClass().getName(),"String_Node_Str" + e.toString());
    if (bannerDownloadListener != null)     bannerDownloadListener.onBannerLoadFailed(LoadError.DownloadFailed);
  }
  return result;
}

Fixed version (ground truth):
protected String getBannerData(){
  InputStream stream=getStream(request.getRequestUri());
  String result=new String();
  try {
    byte[] buffer=new byte[BUFFER_SIZE];
    int count=0;
    BufferedInputStream bufStream=new BufferedInputStream(stream,BUFFER_SIZE);
    while ((count=bufStream.read(buffer)) != -1)     result+=new String(buffer,0,count);
    bufStream.close();
  }
 catch (  Exception e) {
    Log.e(getClass().getName(),"String_Node_Str" + e);
    if (bannerDownloadListener != null)     bannerDownloadListener.onBannerLoadFailed(LoadError.DownloadFailed);
  }
  return result;
}
Program: 51388
Project: 51388
Buggy source:
private void imageDownloaded(){
  if (banner.isImageBanner()) {
    if (!flipper.getCurrentView().equals(image))     flipper.showNext();
  }
 else   flipper.startFlipping();
  show();
}

Fixed version (ground truth):
private void imageDownloaded(){
  if (banner != null && banner.isImageBanner()) {
    if (!flipper.getCurrentView().equals(image))     flipper.showNext();
  }
 else   flipper.startFlipping();
  show();
}
Program: 51390
Project: 51390
Buggy source:
public void setBanner(Plus1Banner banner){
  if (!initialized)   init();
  this.banner=banner;
  if ((banner != null) && (banner.getId() > 0)) {
    flipper.stopFlipping();
    SpannableStringBuilder text=new SpannableStringBuilder(banner.getTitle());
    text.setSpan(new UnderlineSpan(),0,banner.getTitle().length(),0);
    title.setText(text);
    content.setText(banner.getContent());
    if (!banner.isImageBanner()) {
      if (flipper.getCurrentView().equals(image))       flipper.showNext();
      show();
    }
  }
 else   if (getVisibility() == VISIBLE) {
    if (hideAnimation != null)     startAnimation(hideAnimation);
    setVisibility(INVISIBLE);
    if (viewStateListener != null)     viewStateListener.onHideBannerView();
  }
}

Fixed version (ground truth):
public void setBanner(Plus1Banner banner){
  try {
    if (!initialized)     init();
    this.banner=banner;
    if ((banner != null) && (banner.getId() > 0)) {
      flipper.stopFlipping();
      SpannableStringBuilder text=new SpannableStringBuilder(banner.getTitle());
      text.setSpan(new UnderlineSpan(),0,banner.getTitle().length(),0);
      title.setText(text);
      content.setText(banner.getContent());
      if (!banner.isImageBanner()) {
        if (flipper.getCurrentView().equals(image))         flipper.showNext();
        show();
      }
    }
 else     if (getVisibility() == VISIBLE) {
      if (hideAnimation != null)       startAnimation(hideAnimation);
      setVisibility(INVISIBLE);
      if (viewStateListener != null)       viewStateListener.onHideBannerView();
    }
  }
 catch (  OutOfMemoryError e) {
    Log.e(getClass().getName(),"String_Node_Str" + e.getMessage());
  }
}
Program: 51391
Project: 51391
Buggy source:
protected void modifyConnection(HttpURLConnection connection){
  connection.setDoOutput(true);
  connection.setRequestProperty("String_Node_Str",Plus1Helper.getUserAgent());
  connection.setRequestProperty("String_Node_Str","String_Node_Str" + Plus1Helper.getClientSessionId(view.getContext()));
  connection.setRequestProperty("String_Node_Str",getDisplayMetrics());
  connection.setRequestProperty("String_Node_Str","String_Node_Str");
  connection.setRequestProperty("String_Node_Str",Locale.getDefault().getDisplayName(Locale.US));
  if ((deviceId != null) && !deviceId.equals("String_Node_Str"))   connection.setRequestProperty("String_Node_Str",deviceId);
}

Fixed version (ground truth):
protected void modifyConnection(HttpURLConnection connection){
  connection.setRequestProperty("String_Node_Str",Plus1Helper.getUserAgent());
  connection.setRequestProperty("String_Node_Str","String_Node_Str" + Plus1Helper.getClientSessionId(view.getContext()));
  connection.setRequestProperty("String_Node_Str",getDisplayMetrics());
  connection.setRequestProperty("String_Node_Str","String_Node_Str");
  connection.setRequestProperty("String_Node_Str",Locale.getDefault().getDisplayName(Locale.US));
  if ((deviceId != null) && !deviceId.equals("String_Node_Str"))   connection.setRequestProperty("String_Node_Str",deviceId);
}
Program: 51392
Project: 51392
Buggy source:
protected String getData(){
  openConnection();
  String result=new String();
  try {
    byte[] buffer=new byte[BUFFER_SIZE];
    int count=0;
    BufferedInputStream bufStream=new BufferedInputStream(stream,BUFFER_SIZE);
    if (bufStream != null)     while ((count=bufStream.read(buffer)) != -1)     result+=new String(buffer,0,count);
    bufStream.close();
  }
 catch (  IOException e) {
    Log.e(getClass().getName(),"String_Node_Str");
    if (bannerDownloadListener != null)     bannerDownloadListener.onBannerLoadFailed(LoadError.DownloadFailed);
  }
  return result;
}

Fixed version (ground truth):
protected String getData(){
  openConnection();
  String result=new String();
  try {
    byte[] buffer=new byte[BUFFER_SIZE];
    int count=0;
    BufferedInputStream bufStream=new BufferedInputStream(stream,BUFFER_SIZE);
    if (bufStream != null)     while ((count=bufStream.read(buffer)) != -1)     result+=new String(buffer,0,count);
    bufStream.close();
  }
 catch (  IOException e) {
    Log.e(getClass().getName(),"String_Node_Str" + e.toString());
    if (bannerDownloadListener != null)     bannerDownloadListener.onBannerLoadFailed(LoadError.DownloadFailed);
  }
  return result;
}
Program: 51393
Project: 51393
Buggy source:
public static String getUniqueHash() throws NoSuchAlgorithmException {
  MessageDigest sha1=MessageDigest.getInstance("String_Node_Str");
  sha1.update(Calendar.getInstance().getTime().toString().getBytes());
  Random rnd=new Random();
  for (int i=0; i < 10; i++)   sha1.update((byte)rnd.nextInt(255));
  return new BigInteger(sha1.digest()).abs().toString(16);
}

Fixed version (ground truth):
public static String getUniqueHash() throws NoSuchAlgorithmException {
  MessageDigest sha1=MessageDigest.getInstance("String_Node_Str");
  sha1.update(Calendar.getInstance().getTime().toString().getBytes());
  Random rnd=new Random();
  for (int i=0; i < 10; i++)   sha1.update((byte)rnd.nextInt(255));
  return getHex(sha1.digest());
}
Program: 51394
Project: 51394
Buggy source:
@Override protected Void doInBackground(Void... params){
  if (view.isClosed())   return null;
  if (request != null)   this.url=request.getRequestUri();
  final String result=getData();
  Log.d(getClass().getName(),"String_Node_Str" + result.toString());
  view.post(new Runnable(){
    public void run(){
      Plus1Banner banner=null;
      if (result.equals("String_Node_Str")) {
        if (bannerDownloadListener != null)         bannerDownloadListener.onBannerLoadFailed(LoadError.UnknownAnswer);
      }
 else       if (result.equals(NO_BANNER)) {
        if (bannerDownloadListener != null)         bannerDownloadListener.onBannerLoadFailed(LoadError.NoHaveBanner);
      }
 else {
        banner=parse(result);
        if ((banner != null) && (banner.getId() > 0)) {
          if (bannerDownloadListener != null)           bannerDownloadListener.onBannerLoaded();
        }
 else {
          if (bannerDownloadListener != null)           bannerDownloadListener.onBannerLoadFailed(LoadError.UnknownAnswer);
        }
      }
      view.setBanner(banner);
    }
  }
);
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... voids){
  while (running) {
    if (view.isClosed())     return null;
    updateBanner();
    if (runOnce)     return null;
    try {
      Thread.sleep(1000 * timeout);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  return null;
}
Program: 51395
Project: 51395
Buggy source:
public Plus1BannerAsker init(){
  if (initialized)   return this;
  if (!isDisabledAutoDetectLocation()) {
    this.locationManager=(LocationManager)view.getContext().getSystemService(Context.LOCATION_SERVICE);
    this.locationListener=new Plus1LocationListener(request);
  }
  if (!isDisabledIMEIDispatch()) {
    TelephonyManager telephonyManager=(TelephonyManager)view.getContext().getSystemService(Context.TELEPHONY_SERVICE);
    this.deviceId=telephonyManager.getDeviceId();
  }
  timer=new Timer();
  if (viewStateListener != null)   view.setViewStateListener(viewStateListener);
 else   view.setViewStateListener(this);
  if (visibilityTimeout == 0)   visibilityTimeout=timeout * 3;
  initialized=true;
  return this;
}

Fixed version (ground truth):
public Plus1BannerAsker init(){
  if (initialized)   return this;
  if (!isDisabledAutoDetectLocation()) {
    this.locationManager=(LocationManager)view.getContext().getSystemService(Context.LOCATION_SERVICE);
    this.locationListener=new Plus1LocationListener(request);
  }
  if (!isDisabledIMEIDispatch()) {
    TelephonyManager telephonyManager=(TelephonyManager)view.getContext().getSystemService(Context.TELEPHONY_SERVICE);
    this.deviceId=telephonyManager.getDeviceId();
  }
  if (viewStateListener != null)   view.setViewStateListener(viewStateListener);
 else   view.setViewStateListener(this);
  if (visibilityTimeout == 0)   visibilityTimeout=timeout * 3;
  initialized=true;
  return this;
}
Program: 51396
Project: 51396
Buggy source:
public Plus1BannerAsker start(){
  if ((request == null) || (view == null))   return this;
  init();
  if (!isDisabledAutoDetectLocation()) {
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,timeout * 10000,500f,locationListener);
  }
  timer.schedule(new TimerTask(){
    @Override public void run(){
      getDownloaderTask().execute();
    }
  }
,2000,1000);
  return this;
}

Fixed version (ground truth):
public Plus1BannerAsker start(){
  if ((request == null) || (view == null))   return this;
  init();
  if (!isDisabledAutoDetectLocation()) {
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,timeout * 10000,500f,locationListener);
  }
  downloaderTask=getDownloaderTask();
  downloaderTask.execute();
  return this;
}
Program: 51397
Project: 51397
Buggy source:
public void onHideBannerView(){
  if (askerStoper != null)   return;
  askerStoper=new Runnable(){
    public void run(){
      stop();
    }
  }
;
}

Fixed version (ground truth):
public void onHideBannerView(){
  if (askerStoper != null)   return;
  askerStoper=new Runnable(){
    public void run(){
      stop();
    }
  }
;
  new Handler().postDelayed(askerStoper,visibilityTimeout * 1000);
}
Program: 51398
Project: 51398
Buggy source:
public Plus1BannerAsker startOnce(){
  if ((request == null) || (view == null))   return this;
  init();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      getDownloaderTask().execute();
    }
  }
,100);
  return this;
}

Fixed version (ground truth):
public Plus1BannerAsker startOnce(){
  if ((request == null) || (view == null))   return this;
  init();
  downloaderTask.setRunOnce().execute();
  return this;
}
Program: 51399
Project: 51399
Buggy source:
public Plus1BannerAsker stop(){
  if (!isDisabledAutoDetectLocation())   locationManager.removeUpdates(locationListener);
  timer.cancel();
  return this;
}

Fixed version (ground truth):
public Plus1BannerAsker stop(){
  if (!isDisabledAutoDetectLocation())   locationManager.removeUpdates(locationListener);
  downloaderTask.stop();
  return this;
}
Program: 51402
Project: 51402
Buggy source:
/** 
 * Finds out if the block is protected by a chest protection plugin.
 * @param block
 * @return whether the block is protected by a chest protection plugin.
 */
public abstract boolean isProtected(Block block);

Fixed version (ground truth):
/** 
 * Finds out if the block is protected by a chest protection plugin.
 * @param block The block to check.
 * @return whether the block is protected by a chest protection plugin.
 */
public abstract boolean isProtected(Block block);
Program: 51403
Project: 51403
Buggy source:
/** 
 * Parses a command inventoryName and returns the inventoryName. If the inventoryName is world_nether/Notch it will return Notch, if it's Notch it will return Notch.
 * @param inventoryName
 * @return
 */
protected String getInventoryName(String inventoryName){
  String[] parts=inventoryName.split("String_Node_Str");
  if (parts.length == 2) {
    return parts[1];
  }
 else {
    return parts[0];
  }
}

Fixed version (ground truth):
/** 
 * Parses a command inventoryName and returns the inventoryName. If the inventoryName is world_nether/Notch it will return Notch, if it's Notch it will return Notch.
 * @param inventoryName Name of the requested inventory.
 * @return The inventory name, without the world group part.
 */
protected String getInventoryName(String inventoryName){
  String[] parts=inventoryName.split("String_Node_Str");
  if (parts.length == 2) {
    return parts[1];
  }
 else {
    return parts[0];
  }
}
Program: 51404
Project: 51404
Buggy source:
/** 
 * Parses a command inventoryName and returns the world group. If the inventoryName is cavegroup/Notch it will return the group called cavegroup, if it's Notch it will return the world the sender is in.
 * @param inventoryName
 * @param sender
 * @return
 */
protected WorldGroup getGroup(String inventoryName,CommandSender sender){
  String[] parts=inventoryName.split("String_Node_Str");
  if (parts.length == 2) {
    return plugin.getWorldGroupManager().getGroupByGroupName(parts[0]);
  }
  return getGroup(sender);
}

Fixed version (ground truth):
/** 
 * Parses a command inventoryName and returns the world group. If the inventoryName is cavegroup/Notch it will return the group called cavegroup, if it's Notch it will return the world the sender is in.
 * @param inventoryName Name of the requested inventory.
 * @param sender The command sender.
 * @return The world group.
 */
protected WorldGroup getGroup(String inventoryName,CommandSender sender){
  String[] parts=inventoryName.split("String_Node_Str");
  if (parts.length == 2) {
    return plugin.getWorldGroupManager().getGroupByGroupName(parts[0]);
  }
  return getGroup(sender);
}
Program: 51405
Project: 51405
Buggy source:
/** 
 * Wrapper around the unsafe method  {@link org.bukkit.UnsafeValues#modifyItemStack(ItemStack,String)}, that forces you to catch any exceptions, but suppresses deprecation warnings.
 * @param stack Stack to add NBT to. Depending on the implementation, this stack may or may not be modified.
 * @param nbt NBT to add.
 * @return The modified stack.
 * @throws Throwable Method may throw anything, as indicated by {@link org.bukkit.UnsafeValues}.
 */
@SuppressWarnings("String_Node_Str") private ItemStack addNBT(ItemStack stack,String nbt) throws Throwable {
  return Bukkit.getUnsafe().modifyItemStack(stack,nbt);
}

Fixed version (ground truth):
/** 
 * Wrapper around the unsafe method  {@code UnsafeValues.modifyItemStack(ItemStack, String)}, that forces you to catch any exceptions, but suppresses deprecation warnings.
 * @param stack Stack to add NBT to. Depending on the implementation, this stack may or may not be modified.
 * @param nbt NBT to add.
 * @return The modified stack.
 * @throws Throwable Method may throw anything, as indicated by {@code UnsafeValues}.
 */
@SuppressWarnings("String_Node_Str") private ItemStack addNBT(ItemStack stack,String nbt) throws Throwable {
  return Bukkit.getUnsafe().modifyItemStack(stack,nbt);
}
Program: 51406
Project: 51406
Buggy source:
/** 
 * Converts the compound tag to a map. All values in the tag will also have their tags converted to String//primitives/maps/Lists.
 * @param tagCompound
 * @return
 * @throws IOException
 */
static final Map<String,Object> toMap(NBTTagCompound tagCompound) throws IOException {
  Collection<String> tagNames=tagCompound.c();
  Map<String,Object> jsonObject=new HashMap<String,Object>(tagNames.size());
  for (  String subTagName : tagNames) {
    NBTBase subTag=tagCompound.get(subTagName);
    jsonObject.put(subTagName,nbtTagToJavaType(subTag));
  }
  return jsonObject;
}

Fixed version (ground truth):
/** 
 * Converts the compound tag to a map. All values in the tag will also have their tags converted to String//primitives/maps/Lists.
 * @param tagCompound The compound tag.
 * @return The map.
 * @throws IOException In case an unknown tag was encountered in the NBT tag.
 */
static final Map<String,Object> toMap(NBTTagCompound tagCompound) throws IOException {
  Collection<String> tagNames=tagCompound.c();
  Map<String,Object> jsonObject=new HashMap<String,Object>(tagNames.size());
  for (  String subTagName : tagNames) {
    NBTBase subTag=tagCompound.get(subTagName);
    jsonObject.put(subTagName,nbtTagToJavaType(subTag));
  }
  return jsonObject;
}
Program: 51407
Project: 51407
Buggy source:
/** 
 * Registers a registration. The registration cannot be null.
 * @param registration
 */
public void register(T registration){
  Validate.notNull(registration,"String_Node_Str");
  registered.put(filterName(registration.getName()),registration);
}

Fixed version (ground truth):
/** 
 * Registers a registration. The registration cannot be null.
 * @param registration The item to register.
 */
public void register(T registration){
  Validate.notNull(registration,"String_Node_Str");
  registered.put(filterName(registration.getName()),registration);
}
Program: 51408
Project: 51408
Buggy source:
/** 
 * Decodes the JSON and encodes. Useful for testing whether JSON is correctly read and written. <p> Do not rely on the order of elements in the tag, keep in mind that Minecraft uses a HashMap for storage. When a compound tag contains more than one element, do not compare serialized forms of the tag directly.
 * @param json JSON to decode and encode.
 * @return The JSON after it has been decoded and encoded.
 * @throws IOException
 */
private String reserialize(String json) throws IOException {
  NBTTagCompound compoundTag=JSONSimpleTypes.toTag(json);
  return toJSON(compoundTag);
}

Fixed version (ground truth):
/** 
 * Decodes the JSON and encodes. Useful for testing whether JSON is correctly read and written. <p> Do not rely on the order of elements in the tag, keep in mind that Minecraft uses a HashMap for storage. When a compound tag contains more than one element, do not compare serialized forms of the tag directly.
 * @param json JSON to decode and encode.
 * @return The JSON after it has been decoded and encoded.
 * @throws IOException When a decoding error occurs.
 */
private String reserialize(String json) throws IOException {
  NBTTagCompound compoundTag=JSONSimpleTypes.toTag(json);
  return toJSON(compoundTag);
}
Program: 51409
Project: 51409
Buggy source:
public LWCBridge(BetterEnderChest plugin){
  this.plugin=plugin;
}

Fixed version (ground truth):
public LWCBridge(BetterEnderChest plugin){
  this.plugin=plugin;
  try {
    protectionGetOwnerMethod=Protection.class.getMethod("String_Node_Str");
    Class<?> returnType=protectionGetOwnerMethod.getReturnType();
    if (returnType.getName().equals("String_Node_Str")) {
      playerInfoGetNameMethod=returnType.getMethod("String_Node_Str");
      playerInfoGetUUIDMethod=returnType.getMethod("String_Node_Str");
    }
  }
 catch (  NoClassDefFoundError e) {
  }
catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 51410
Project: 51410
Buggy source:
@Override public boolean isAvailable(){
  return Bukkit.getPluginManager().getPlugin("String_Node_Str") != null;
}

Fixed version (ground truth):
@Override public boolean isAvailable(){
  return protectionGetOwnerMethod != null;
}
Program: 51411
Project: 51411
Buggy source:
/** 
 * Gets the owner from the protection. If the UUID of the owner is unknown, null is returned.
 * @param protection The protection.
 * @return The owner, or null if the UUID is unknown.
 */
private ChestOwner getOwnerFromProtection(Protection protection){
  try {
    Object owner=GET_OWNER_METHOD.invoke(protection);
    if (owner instanceof String) {
      return getOwnerFromUUIDString((String)owner);
    }
    String name=(String)GET_NAME_METHOD.invoke(owner);
    UUID uuid=(UUID)GET_UUID_METHOD.invoke(owner);
    if (uuid == null) {
      return null;
    }
    return plugin.getChestOwners().playerChest(name,uuid);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
/** 
 * Gets the owner from the protection. If the UUID of the owner is unknown, null is returned.
 * @param protection The protection.
 * @return The owner, or null if the UUID is unknown.
 */
private ChestOwner getOwnerFromProtection(Protection protection){
  try {
    Object owner=protectionGetOwnerMethod.invoke(protection);
    if (owner instanceof String) {
      return getOwnerFromUUIDString((String)owner);
    }
    String name=(String)playerInfoGetNameMethod.invoke(owner);
    UUID uuid=(UUID)playerInfoGetUUIDMethod.invoke(owner);
    if (uuid == null) {
      return null;
    }
    return plugin.getChestOwners().playerChest(name,uuid);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 51412
Project: 51412
Buggy source:
@Override public String getOwnerName(Block block){
  Protection protection=LWC.getInstance().findProtection(block);
  try {
    Object owner=GET_OWNER_METHOD.invoke(protection);
    if (owner instanceof String) {
      return (String)owner;
    }
    return (String)GET_NAME_METHOD.invoke(owner);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public String getOwnerName(Block block){
  Protection protection=LWC.getInstance().findProtection(block);
  try {
    Object owner=protectionGetOwnerMethod.invoke(protection);
    if (owner instanceof String) {
      return (String)owner;
    }
    return (String)playerInfoGetNameMethod.invoke(owner);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 51413
Project: 51413
Buggy source:
/** 
 * Gets whether the string is a valid chest drop
 * @param drop
 * @return
 */
public boolean isValidChestDrop(String drop){
  try {
    ChestDrop.valueOf(drop);
    return true;
  }
 catch (  IllegalArgumentException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Gets whether the string is a valid chest drop.
 * @param drop The string.
 * @return True if the drop is valid, false otherwise.
 */
public boolean isValidChestDrop(String drop){
  try {
    ChestDrop.valueOf(drop);
    return true;
  }
 catch (  IllegalArgumentException e) {
    return false;
  }
}
Program: 51414
Project: 51414
Buggy source:
/** 
 * Returns the group of the world. World name is case insensitive. If the world name is not listed in a group (  {@link #isWorldListed(String)}) it will return the default group.
 * @param world Name of the world. Case insensitive.
 * @return The world group.
 */
public WorldGroup getGroupByWorldName(String worldName){
  for (  WorldGroup worldGroup : groups.values()) {
    if (worldGroup.isWorldInGroup(worldName)) {
      return worldGroup;
    }
  }
  return getOrCreateWorldGroup(BetterEnderChest.STANDARD_GROUP_NAME);
}

Fixed version (ground truth):
/** 
 * Returns the group of the world. World name is case insensitive. If the world name is not listed in a group (  {@link #isWorldListed(String)}) it will return the default group.
 * @param worldName Name of the world. Case insensitive.
 * @return The world group.
 */
public WorldGroup getGroupByWorldName(String worldName){
  for (  WorldGroup worldGroup : groups.values()) {
    if (worldGroup.isWorldInGroup(worldName)) {
      return worldGroup;
    }
  }
  return getOrCreateWorldGroup(BetterEnderChest.STANDARD_GROUP_NAME);
}
Program: 51415
Project: 51415
Buggy source:
/** 
 * Guesses the number of chest rows based on both the contents and the inventory name. It will calculate the minimum number of rows to fit all the items. It will also guess the number of rows based on the name, just like   {@link #getInventoryRows(String)}. It will then return the highest number of the two.
 * @param chestOwner The owner of the inventory.
 * @param it Iterating over the contents in the inventory.
 * @return Guessed number of rows.
 */
public int getInventoryRows(ChestOwner chestOwner,ListIterator<ItemStack> it){
  int highestSlot=0;
  while (it.hasNext()) {
    int currentSlot=it.nextIndex();
    ItemStack stack=it.next();
    if (stack != null) {
      highestSlot=Math.max(currentSlot,highestSlot);
    }
  }
  return Math.max((int)Math.ceil(highestSlot / 9.0),getInventoryRows(chestOwner));
}

Fixed version (ground truth):
/** 
 * Guesses the number of chest rows based on both the contents and the inventory name. It will calculate the minimum number of rows to fit all the items. It will also guess the number of rows based on the owner, just like   {@link #getInventoryRows(ChestOwner)}. It will then return the highest number of the two.
 * @param chestOwner The owner of the inventory.
 * @param it Iterating over the contents in the inventory.
 * @return Guessed number of rows.
 */
public int getInventoryRows(ChestOwner chestOwner,ListIterator<ItemStack> it){
  int highestSlot=0;
  while (it.hasNext()) {
    int currentSlot=it.nextIndex();
    ItemStack stack=it.next();
    if (stack != null) {
      highestSlot=Math.max(currentSlot,highestSlot);
    }
  }
  return Math.max((int)Math.ceil(highestSlot / 9.0),getInventoryRows(chestOwner));
}
Program: 51416
Project: 51416
Buggy source:
/** 
 * Gets the name of the file this chest will be saved to, without the extension. Currently, this is just the lowercase player name, but this will change when UUIDs are introduced. This method may suddenly dissappear.
 * @see BetterEnderChest#PUBLIC_CHEST_NAME
 * @see BetterEnderChest#DEFAULT_CHEST_NAME
 * @return The name of
 */
String getSaveFileName();

Fixed version (ground truth):
/** 
 * Gets the name of the file this chest will be saved to, without the extension. This is usually the string representation of the UUID, but some chests (like the public chest) can use something else.
 * @return The name of
 */
String getSaveFileName();
Program: 51418
Project: 51418
Buggy source:
/** 
 * Tries to parse the string as an UUID. If the string is an UUID, the name is looked up and a   {@link ChestOwner} is returned. If not, null isreturned.
 * @param ownerName The string that is maybe an UUID.
 * @return The {@link ChestOwner}, or null.
 */
private ChestOwner getOwnerFromUUIDString(String string){
  if (string.length() == 36) {
    try {
      UUID uuid=UUID.fromString(string);
      String ownerName=Bukkit.getOfflinePlayer(uuid).getName();
      if (ownerName == null) {
        ownerName="String_Node_Str";
      }
      return plugin.getChestOwners().playerChest(ownerName,uuid);
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Tries to parse the string as an UUID. If the string is an UUID, the name is looked up and a   {@link ChestOwner} is returned. If not, null isreturned.
 * @param string The string that is maybe an UUID.
 * @return The {@link ChestOwner}, or null.
 */
private ChestOwner getOwnerFromUUIDString(String string){
  if (string.length() == 36) {
    try {
      UUID uuid=UUID.fromString(string);
      String ownerName=Bukkit.getOfflinePlayer(uuid).getName();
      if (ownerName == null) {
        ownerName="String_Node_Str";
      }
      return plugin.getChestOwners().playerChest(ownerName,uuid);
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return null;
}
Program: 51419
Project: 51419
Buggy source:
/** 
 * Finds out if a player can access a block that is protected by a chest protection plugin.
 * @param block
 * @return whether the block is protected by a chest protection plugin.
 */
public abstract boolean canAccess(Player player,Block block);

Fixed version (ground truth):
/** 
 * Finds out if a player can access a block that is protected by a chest protection plugin.
 * @param player The player trying to access something.
 * @param block The block that is being accessed.
 * @return whether the block is protected by a chest protection plugin.
 */
public abstract boolean canAccess(Player player,Block block);
Program: 51420
Project: 51420
Buggy source:
/** 
 * Constructs a new PermissionException.
 * @param requiredPermission The permission node that was missing.
 * @throws IllegalArgumentExcepiont If requiredPermission is null.
 */
public NoPermissionException(String requiredPermission){
  super("String_Node_Str" + requiredPermission);
  Validate.notNull(requiredPermission,"String_Node_Str");
  this.permission=requiredPermission;
}

Fixed version (ground truth):
/** 
 * Constructs a new PermissionException.
 * @param requiredPermission The permission node that was missing.
 * @throws IllegalArgumentException If requiredPermission is null.
 */
public NoPermissionException(String requiredPermission){
  super("String_Node_Str" + requiredPermission);
  Validate.notNull(requiredPermission,"String_Node_Str");
  this.permission=requiredPermission;
}
Program: 51421
Project: 51421
Buggy source:
/** 
 * Imports an inventory from another plugin. Method must be called on the main thread. Will only be called if isAvailable() returns true. Will return null if there was nothing to import.
 * @param chestOwner The owner of the inventory.
 * @param worldGroup The group the inventory is in.
 * @param plugin The BetterEnderChest plugin.
 * @return The inventory, or null if there was nothing to import.
 * @throws IOException When something went wrong.
 */
public void importInventoryAsync(ChestOwner chestOwner,WorldGroup worldGroup,BetterEnderChest plugin,Consumer<Inventory> callback,Consumer<IOException> onError){
  try {
    Inventory inventory=importInventory(chestOwner,worldGroup,plugin);
    if (inventory != null) {
      callback.consume(inventory);
    }
 else {
      onError.consume(new ChestNotFoundException(chestOwner,worldGroup));
    }
  }
 catch (  IOException e) {
    onError.consume(e);
  }
}

Fixed version (ground truth):
/** 
 * Imports an inventory from another plugin. Method must be called on the main thread. Will only be called if isAvailable() returns true. Will return null if there was nothing to import.
 * @param chestOwner The owner of the inventory.
 * @param worldGroup The group the inventory is in.
 * @param plugin The BetterEnderChest plugin.
 * @param callback Called with the inventory.
 * @param onError Called when there was an error.
 */
public void importInventoryAsync(ChestOwner chestOwner,WorldGroup worldGroup,BetterEnderChest plugin,Consumer<Inventory> callback,Consumer<IOException> onError){
  try {
    Inventory inventory=importInventory(chestOwner,worldGroup,plugin);
    if (inventory != null) {
      callback.consume(inventory);
    }
 else {
      onError.consume(new ChestNotFoundException(chestOwner,worldGroup));
    }
  }
 catch (  IOException e) {
    onError.consume(e);
  }
}
Program: 51422
Project: 51422
Buggy source:
/** 
 * Sets the inventory in the cache, replacing the old inventory that may have been in the cache.
 * @param inventory The new inventory
 */
void setInventory(Inventory enderInventory);

Fixed version (ground truth):
/** 
 * Sets the inventory in the cache, replacing the old inventory that may have been in the cache.
 * @param inventory The new inventory
 */
void setInventory(Inventory inventory);