Program: 48149
Project: 48149
Buggy source:
/** 
 * Performs the actual PAOS procedure. Connects the given card, establishes the HTTP channel and talks to the server. Afterwards disconnects the card.
 * @param token The TCToken containing the connection parameters.
 * @param connectionHandle The handle of the card that will be used.
 * @return A TCTokenResponse indicating success or failure.
 * @throws DispatcherException If there was a problem dispatching a request from the server.
 * @throws PAOSException If there was a transport error.
 */
private TCTokenResponse processBinding(TCTokenRequest tokenRequest,ConnectionHandleType connectionHandle) throws PAOSException, DispatcherException {
  TCTokenType token=tokenRequest.getTCToken();
  try {
    connectionHandle=prepareHandle(connectionHandle);
    TCTokenResponse response=new TCTokenResponse();
    response.setRefreshAddress(new URL(token.getRefreshAddress()));
    response.setResult(WSHelper.makeResultOK());
    String binding=token.getBinding();
    if ("String_Node_Str".equals(binding)) {
      PAOSTask task=new PAOSTask(dispatcher,connectionHandle,tokenRequest);
      FutureTask<StartPAOSResponse> paosTask=new FutureTask<StartPAOSResponse>(task);
      Thread paosThread=new Thread(paosTask,"String_Node_Str");
      paosThread.start();
      if (!tokenRequest.isTokenFromObject()) {
        waitForTask(paosTask);
      }
      response.setBindingTask(paosTask);
    }
 else     if (binding == null) {
      HttpGetTask task=new HttpGetTask(dispatcher,connectionHandle,tokenRequest);
      FutureTask<StartPAOSResponse> tlsTask=new FutureTask<StartPAOSResponse>(task);
      waitForTask(tlsTask);
      response.setBindingTask(tlsTask);
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
    return response;
  }
 catch (  WSException ex) {
    String msg="String_Node_Str";
    logger.error(msg,ex);
    throw new DispatcherException(msg,ex);
  }
catch (  InvocationTargetException ex) {
    logger.error(ex.getMessage(),ex);
    throw new DispatcherException(ex);
  }
catch (  MalformedURLException ex) {
    logger.error(ex.getMessage(),ex);
    throw new PAOSException(ex);
  }
 finally {
    try {
      CardApplicationDisconnect appDis=new CardApplicationDisconnect();
      appDis.setConnectionHandle(connectionHandle);
      dispatcher.deliver(appDis);
    }
 catch (    InvocationTargetException ex) {
      logger.error(ex.getMessage(),ex);
      throw new DispatcherException(ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs the actual PAOS procedure. Connects the given card, establishes the HTTP channel and talks to the server. Afterwards disconnects the card.
 * @param token The TCToken containing the connection parameters.
 * @param connectionHandle The handle of the card that will be used.
 * @return A TCTokenResponse indicating success or failure.
 * @throws DispatcherException If there was a problem dispatching a request from the server.
 * @throws PAOSException If there was a transport error.
 */
private TCTokenResponse processBinding(TCTokenRequest tokenRequest,ConnectionHandleType connectionHandle) throws PAOSException, DispatcherException {
  TCTokenType token=tokenRequest.getTCToken();
  try {
    connectionHandle=prepareHandle(connectionHandle);
    TCTokenResponse response=new TCTokenResponse();
    response.setRefreshAddress(new URL(token.getRefreshAddress()));
    response.setResult(WSHelper.makeResultOK());
    String binding=token.getBinding();
    if ("String_Node_Str".equals(binding)) {
      PAOSTask task=new PAOSTask(dispatcher,connectionHandle,tokenRequest);
      FutureTask<StartPAOSResponse> paosTask=new FutureTask<StartPAOSResponse>(task);
      Thread paosThread=new Thread(paosTask,"String_Node_Str");
      paosThread.start();
      if (!tokenRequest.isTokenFromObject()) {
        waitForTask(paosTask);
      }
      response.setBindingTask(paosTask);
    }
 else     if ("String_Node_Str".equals(binding)) {
      HttpGetTask task=new HttpGetTask(dispatcher,connectionHandle,tokenRequest);
      FutureTask<StartPAOSResponse> tlsTask=new FutureTask<StartPAOSResponse>(task);
      Thread tlsThread=new Thread(tlsTask,"String_Node_Str");
      tlsThread.start();
      waitForTask(tlsTask);
      response.setBindingTask(tlsTask);
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
    return response;
  }
 catch (  WSException ex) {
    String msg="String_Node_Str";
    logger.error(msg,ex);
    throw new DispatcherException(msg,ex);
  }
catch (  InvocationTargetException ex) {
    logger.error(ex.getMessage(),ex);
    throw new DispatcherException(ex);
  }
catch (  MalformedURLException ex) {
    logger.error(ex.getMessage(),ex);
    throw new PAOSException(ex);
  }
 finally {
    try {
      CardApplicationDisconnect appDis=new CardApplicationDisconnect();
      appDis.setConnectionHandle(connectionHandle);
      dispatcher.deliver(appDis);
    }
 catch (    InvocationTargetException ex) {
      logger.error(ex.getMessage(),ex);
      throw new DispatcherException(ex);
    }
  }
}