nus-yam/ex-repair huggingface dataset:
Program: 145663
Project: 145663
Buggy source:
@ScriptFunction(jsDocText="String_Node_Str") public synchronized Scriptable createEntity(String aDbId,String aSqlText) throws Exception {
  if (client == null) {
    throw new NullPointerException("String_Node_Str");
  }
  ApplicationDbEntity modelEntity=newGenericEntity();
  modelEntity.setName(USER_DATASOURCE_NAME);
  SqlQuery query=new SqlQuery(client,aDbId,aSqlText);
  query.setEntityId(String.valueOf(IDGenerator.genID()));
  modelEntity.setQuery(query);
  StoredQueryFactory factory=new StoredQueryFactory(client,true);
  factory.putTableFieldsMetadata(query);
  return modelEntity.defineProperties();
}

Fixed version (ground truth):
@ScriptFunction(jsDocText="String_Node_Str") public synchronized Scriptable createEntity(String aSqlText,String aDbId) throws Exception {
  if (client == null) {
    throw new NullPointerException("String_Node_Str");
  }
  ApplicationDbEntity modelEntity=newGenericEntity();
  modelEntity.setName(USER_DATASOURCE_NAME);
  SqlQuery query=new SqlQuery(client,aDbId,aSqlText);
  query.setEntityId(String.valueOf(IDGenerator.genID()));
  modelEntity.setQuery(query);
  StoredQueryFactory factory=new StoredQueryFactory(client,true);
  factory.putTableFieldsMetadata(query);
  return modelEntity.defineProperties();
}
Program: 145664
Project: 145664
Buggy source:
@ScriptFunction(jsDocText="String_Node_Str") public void executeSql(String aDbId,String aSqlClause) throws Exception {
  if (client == null) {
    throw new NullPointerException("String_Node_Str");
  }
  SqlCompiledQuery compiled=new SqlCompiledQuery(client,aDbId,aSqlClause);
  client.executeUpdate(compiled);
}

Fixed version (ground truth):
@ScriptFunction(jsDocText="String_Node_Str") public void executeSql(String aSqlClause,String aDbId) throws Exception {
  if (client == null) {
    throw new NullPointerException("String_Node_Str");
  }
  SqlCompiledQuery compiled=new SqlCompiledQuery(client,aDbId,aSqlClause);
  client.executeUpdate(compiled);
}
Program: 145665
Project: 145665
Buggy source:
public Object getJsObject(int colIndex) throws Exception {
  return Utils.toJs(getObject(colIndex));
}

Fixed version (ground truth):
public Object getJsObject(String aFieldName) throws Exception {
  return Utils.toJs(getObject(fields.find(aFieldName)));
}
Program: 145666
Project: 145666
Buggy source:
public void updateJsObject(int colIndex,Object aValue) throws Exception {
  updateObject(colIndex,Utils.toJava(aValue));
}

Fixed version (ground truth):
public void updateJsObject(String aFieldName,Object aValue) throws Exception {
  updateObject(fields.find(aFieldName),Utils.toJava(aValue));
}
Program: 145667
Project: 145667
Buggy source:
@Override public void resolve2Application(Field aField){
}

Fixed version (ground truth):
@Override public void resolve2Application(Field aField){
  if (SQLUtils.isSameTypeGroup(aField.getTypeInfo().getSqlType(),java.sql.Types.BLOB)) {
    if (aField.getTypeInfo().getSqlType() == java.sql.Types.CLOB || aField.getTypeInfo().getSqlType() == java.sql.Types.NCLOB) {
      aField.setTypeInfo(DataTypeInfo.CLOB.copy());
    }
 else {
      aField.setTypeInfo(DataTypeInfo.BLOB.copy());
    }
  }
}
Program: 145668
Project: 145668
Buggy source:
@Override public void resolve2Application(Field aField){
}

Fixed version (ground truth):
@Override public void resolve2Application(Field aField){
  if (SQLUtils.isSameTypeGroup(aField.getTypeInfo().getSqlType(),java.sql.Types.BLOB)) {
    if (aField.getTypeInfo().getSqlType() == java.sql.Types.CLOB || aField.getTypeInfo().getSqlType() == java.sql.Types.NCLOB) {
      aField.setTypeInfo(DataTypeInfo.CLOB.copy());
    }
 else {
      aField.setTypeInfo(DataTypeInfo.BLOB.copy());
    }
  }
}
Program: 145669
Project: 145669
Buggy source:
@Override public void resolve2Application(Field aField){
}

Fixed version (ground truth):
@Override public void resolve2Application(Field aField){
  if (SQLUtils.isSameTypeGroup(aField.getTypeInfo().getSqlType(),java.sql.Types.BLOB)) {
    if (aField.getTypeInfo().getSqlType() == java.sql.Types.CLOB || aField.getTypeInfo().getSqlType() == java.sql.Types.NCLOB) {
      aField.setTypeInfo(DataTypeInfo.CLOB.copy());
    }
 else {
      aField.setTypeInfo(DataTypeInfo.BLOB.copy());
    }
  }
}
Program: 145671
Project: 145671
Buggy source:
@Override public void resolve2Application(Field aField){
  if (aField != null) {
    int lSize=aField.getSize();
    int size=lSize >> 16;
    int scale=(lSize << 16) >> 16;
    if (SQLUtils.isSameTypeGroup(aField.getTypeInfo().getSqlType(),java.sql.Types.VARCHAR)) {
      aField.setSize(Math.max(0,scale));
      aField.setScale(0);
      aField.setPrecision(0);
    }
 else     if (SQLUtils.isSameTypeGroup(aField.getTypeInfo().getSqlType(),java.sql.Types.BLOB)) {
      aField.setTypeInfo(DataTypeInfo.BLOB);
      aField.setSize(Math.max(0,size));
    }
 else {
      aField.setSize(Math.max(0,size));
      if (scale > 0) {
        aField.setScale(scale);
        aField.setPrecision(scale);
      }
 else {
        aField.setScale(0);
        aField.setPrecision(0);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void resolve2Application(Field aField){
  if (aField != null) {
    int lSize=aField.getSize();
    int size=lSize >> 16;
    int scale=(lSize << 16) >> 16;
    if (SQLUtils.isSameTypeGroup(aField.getTypeInfo().getSqlType(),java.sql.Types.VARCHAR)) {
      aField.setSize(Math.max(0,scale));
      aField.setScale(0);
      aField.setPrecision(0);
    }
 else     if (SQLUtils.isSameTypeGroup(aField.getTypeInfo().getSqlType(),java.sql.Types.BLOB)) {
      if (aField.getTypeInfo().getSqlType() == java.sql.Types.CLOB || aField.getTypeInfo().getSqlType() == java.sql.Types.NCLOB) {
        aField.setTypeInfo(DataTypeInfo.CLOB.copy());
      }
 else {
        aField.setTypeInfo(DataTypeInfo.BLOB.copy());
      }
    }
 else {
      aField.setSize(Math.max(0,size));
      if (scale > 0) {
        aField.setScale(scale);
        aField.setPrecision(scale);
      }
 else {
        aField.setScale(0);
        aField.setPrecision(0);
      }
    }
  }
}
Program: 145672
Project: 145672
Buggy source:
public void startDownloadRequest(String aUrlPrefix,final int aRequestType,Map<String,String> aParams,RequestBuilder.Method aMethod) throws Exception {
  com.google.gwt.dom.client.Document doc=com.google.gwt.dom.client.Document.get();
  FormElement frm=doc.createFormElement();
  frm.setMethod(aMethod.toString());
  frm.setAction(APPLICATION_URI + aUrlPrefix);
  Iterator<Entry<String,String>> itr=aParams.entrySet().iterator();
  while (itr.hasNext()) {
    Entry<String,String> ent=itr.next();
    InputElement text=doc.createHiddenInputElement();
    text.setValue(ent.getValue());
    text.setName(ent.getKey());
    frm.appendChild(text);
  }
  InputElement text=doc.createHiddenInputElement();
  text.setValue(String.valueOf(aRequestType));
  text.setName(PlatypusHttpRequestParams.TYPE);
  frm.appendChild(text);
  frm.submit();
  frm.removeFromParent();
}

Fixed version (ground truth):
public void startDownloadRequest(String aUrlPrefix,final int aRequestType,Map<String,String> aParams,RequestBuilder.Method aMethod) throws Exception {
  com.google.gwt.dom.client.Document doc=com.google.gwt.dom.client.Document.get();
  FormElement frm=doc.createFormElement();
  frm.setMethod(aMethod.toString());
  frm.setAction(baseUrl + aUrlPrefix);
  for (  Entry<String,String> ent : aParams.entrySet()) {
    InputElement text=doc.createHiddenInputElement();
    text.setValue(ent.getValue());
    text.setName(ent.getKey());
    frm.appendChild(text);
  }
  InputElement text=doc.createHiddenInputElement();
  text.setValue(String.valueOf(aRequestType));
  text.setName(PlatypusHttpRequestParams.TYPE);
  frm.appendChild(text);
  frm.submit();
  frm.removeFromParent();
}
Program: 145673
Project: 145673
Buggy source:
private boolean consoleLogin() throws Exception {
  try {
    if (user == null || user.isEmpty() || password == null) {
      throw new Exception(BAD_APP_CREDENTIALS_MSG + "String_Node_Str");
    }
    EasSettings settings=EasSettings.createInstance(url);
    if (settings instanceof DbConnectionSettings) {
      if (dbUser == null || dbUser.isEmpty() || dbPassword == null || dbPassword.length == 0 || dbSchema == null || dbSchema.isEmpty()) {
        throw new Exception(BAD_DB_CREDENTIALS_MSG + "String_Node_Str");
      }
      settings.getInfo().put(ClientConstants.DB_CONNECTION_USER_PROP_NAME,dbUser);
      settings.getInfo().put(ClientConstants.DB_CONNECTION_PASSWORD_PROP_NAME,dbPassword);
      settings.getInfo().put(ClientConstants.DB_CONNECTION_SCHEMA_PROP_NAME,dbSchema);
      if (appPath != null) {
        ((DbConnectionSettings)settings).setApplicationPath(appPath);
      }
    }
    Client lclient=ClientFactory.getInstance(settings);
    try {
      return appLogin(lclient,user,password);
    }
 catch (    Exception ex) {
      lclient.shutdown();
      throw ex;
    }
  }
  finally {
    dbUser=null;
    dbSchema=null;
    dbPassword=null;
    user=null;
    password=null;
  }
}

Fixed version (ground truth):
private boolean consoleLogin() throws Exception {
  try {
    if (user == null || user.isEmpty() || password == null) {
      throw new Exception(BAD_APP_CREDENTIALS_MSG + "String_Node_Str");
    }
    EasSettings settings=EasSettings.createInstance(url);
    if (settings instanceof DbConnectionSettings) {
      if (dbUser == null || dbUser.isEmpty() || dbPassword == null || dbPassword.length == 0 || dbSchema == null || dbSchema.isEmpty()) {
        throw new Exception(BAD_DB_CREDENTIALS_MSG + "String_Node_Str");
      }
      settings.getInfo().put(ClientConstants.DB_CONNECTION_USER_PROP_NAME,dbUser);
      settings.getInfo().put(ClientConstants.DB_CONNECTION_PASSWORD_PROP_NAME,new String(dbPassword));
      settings.getInfo().put(ClientConstants.DB_CONNECTION_SCHEMA_PROP_NAME,dbSchema);
      if (appPath != null) {
        ((DbConnectionSettings)settings).setApplicationPath(appPath);
      }
    }
    Client lclient=ClientFactory.getInstance(settings);
    try {
      return appLogin(lclient,user,password);
    }
 catch (    Exception ex) {
      lclient.shutdown();
      throw ex;
    }
  }
  finally {
    dbUser=null;
    dbSchema=null;
    dbPassword=null;
    user=null;
    password=null;
  }
}
Program: 145674
Project: 145674
Buggy source:
@Override public int convertRowIndexToModel(int index){
  if (isSorted()) {
    return viewToModel[index];
  }
 else {
    return index;
  }
}

Fixed version (ground truth):
@Override public int convertRowIndexToModel(int index){
  if (viewToModel != null && index >= 0 && index < viewToModel.length) {
    if (isSorted()) {
      return viewToModel[index];
    }
 else {
      return index;
    }
  }
 else {
    return index;
  }
}
Program: 145675
Project: 145675
Buggy source:
@Override public int convertRowIndexToView(int index){
  if (isSorted()) {
    return modelToView[index];
  }
 else {
    return index;
  }
}

Fixed version (ground truth):
@Override public int convertRowIndexToView(int index){
  if (modelToView != null && index >= 0 && index < modelToView.length) {
    if (isSorted()) {
      return modelToView[index];
    }
 else {
      return index;
    }
  }
 else {
    return index;
  }
}
Program: 145678
Project: 145678
Buggy source:
/** 
 * Precesses request for both PlatypusAPI requests and "Platypus protocol over http" requests.
 * @param aHttpRequest
 * @param aPlatypusSession
 * @param aHttpResponse
 * @param aHttpSession
 * @throws Exception
 */
private void processPlatypusRequest(final HttpServletRequest aHttpRequest,final HttpServletResponse aHttpResponse,Session aPlatypusSession,HttpSession aHttpSession) throws Exception {
  Request platypusRequest=readPlatypusRequest(aHttpRequest,aHttpResponse,aPlatypusSession);
  try {
    RequestHandler<?> handler=findPlatypusHandler(platypusRequest,aPlatypusSession,aHttpRequest,aHttpResponse);
    handler.run();
    Response response=handler.getResponse();
    sendPlatypusResponse(aHttpRequest,platypusRequest,response,aHttpResponse);
    if (platypusRequest.getType() == Requests.rqLogout) {
      aHttpRequest.logout();
      aHttpSession.invalidate();
    }
  }
 catch (  Exception ex) {
    Logger.getLogger(PlatypusHttpServlet.class.getName()).log(Level.SEVERE,REQUEST_PROCESSSING_ERROR_MSG,ex);
    ErrorResponse er=new ErrorResponse(platypusRequest.getID(),ex.getMessage());
    try {
      sendJ2SEResponse(er,aHttpResponse);
    }
 catch (    Exception e) {
      Logger.getLogger(PlatypusHttpServlet.class.getName()).log(Level.SEVERE,ERRORRESPONSE_ERROR_MSG,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Precesses request for both PlatypusAPI requests and "Platypus protocol over http" requests.
 * @param aHttpRequest
 * @param aPlatypusSession
 * @param aHttpResponse
 * @param aHttpSession
 * @throws Exception
 */
private void processPlatypusRequest(final HttpServletRequest aHttpRequest,final HttpServletResponse aHttpResponse,Session aPlatypusSession,HttpSession aHttpSession) throws Exception {
  Request platypusRequest=readPlatypusRequest(aHttpRequest,aHttpResponse,aPlatypusSession);
  try {
    RequestHandler<?> handler=findPlatypusHandler(platypusRequest,aPlatypusSession,aHttpRequest,aHttpResponse);
    handler.run();
    Response response=handler.getResponse();
    platypusResponse(aHttpRequest,platypusRequest,response,aHttpResponse);
    if (platypusRequest.getType() == Requests.rqLogout) {
      aHttpRequest.logout();
      aHttpSession.invalidate();
    }
  }
 catch (  Exception ex) {
    Logger.getLogger(PlatypusHttpServlet.class.getName()).log(Level.SEVERE,REQUEST_PROCESSSING_ERROR_MSG,ex);
    ErrorResponse er=new ErrorResponse(platypusRequest.getID(),ex.getMessage());
    try {
      sendJ2SEResponse(er,aHttpResponse);
    }
 catch (    Exception e) {
      Logger.getLogger(PlatypusHttpServlet.class.getName()).log(Level.SEVERE,ERRORRESPONSE_ERROR_MSG,e);
    }
  }
}
Program: 145680
Project: 145680
Buggy source:
public boolean isActual(){
  return maxAge == Long.MAX_VALUE ? true : getExpires().getTime() > System.currentTimeMillis();
}

Fixed version (ground truth):
public boolean isActual(){
  return System.currentTimeMillis() - cDate.getTime() < maxAge;
}
Program: 145681
Project: 145681
Buggy source:
public Date getExpires(){
  return new Date(cDate.getTime() + maxAge);
}

Fixed version (ground truth):
public Date getExpires(){
  long expires=cDate.getTime() + maxAge;
  return new Date(expires > 0 ? expires : Long.MAX_VALUE);
}
Program: 145682
Project: 145682
Buggy source:
public JavaScriptObject createFilter(JavaScriptObject aConstraints) throws Exception {
  JsArrayMixed constraints=aConstraints.<JsArrayMixed>cast();
  Filter filter=new Filter(getRowset());
  filter.beginConstrainting();
  try {
    for (int i=0; i < constraints.length(); i++) {
      JavaScriptObject jsConstraint=constraints.getObject(i);
      Field field=RowsetUtils.unwrapField(jsConstraint);
      filter.addConstraint(getFields().find(field.getName()));
    }
  }
  finally {
    filter.endConstrainting();
  }
  return publishFilterFacade(filter,this);
}

Fixed version (ground truth):
public JavaScriptObject createFilter(JavaScriptObject aConstraints) throws Exception {
  JsArrayMixed constraints=aConstraints.<JsArrayMixed>cast();
  Filter filter=getRowset().createFilter();
  filter.beginConstrainting();
  try {
    for (int i=0; i < constraints.length(); i++) {
      JavaScriptObject jsConstraint=constraints.getObject(i);
      Field field=RowsetUtils.unwrapField(jsConstraint);
      filter.addConstraint(getFields().find(field.getName()));
    }
  }
  finally {
    filter.endConstrainting();
  }
  return publishFilterFacade(filter,this);
}
Program: 145683
Project: 145683
Buggy source:
public static Object extractValueFromJsArray(JsArrayMixed fieldsValues,int aIndex) throws Exception {
  Object v=null;
  if (!isNullInJsArray(fieldsValues,aIndex)) {
    v=Utils.unwrap(fieldsValues.getObject(aIndex));
  }
  return v;
}

Fixed version (ground truth):
public static Object extractValueFromJsArray(JsArrayMixed aArray,int aIndex) throws Exception {
  return Utils.toJava(boxArrayElementAsJava(aArray,aIndex));
}
Program: 145684
Project: 145684
Buggy source:
public PlatypusWindow(PlatypusDesktopContainer aDesktop,Form aForm){
  super();
  desktop=aDesktop;
  form=aForm;
  setMaximizable(true);
  setMinimizable(true);
  setAnimCollapse(false);
}

Fixed version (ground truth):
public PlatypusWindow(PlatypusDesktopContainer aDesktop,Form aForm){
  super();
  desktop=aDesktop;
  form=aForm;
  setMaximizable(true);
  setMinimizable(true);
  setAnimCollapse(true);
}
Program: 145685
Project: 145685
Buggy source:
public boolean isActual(){
  return getExpires().getTime() > System.currentTimeMillis();
}

Fixed version (ground truth):
public boolean isActual(){
  return maxAge == Long.MAX_VALUE ? true : getExpires().getTime() > System.currentTimeMillis();
}
Program: 145686
Project: 145686
Buggy source:
private void writeJsonResponse(String aResponseString,HttpServletResponse response) throws UnsupportedEncodingException, IOException {
  writeStringResponse(aResponseString,response,RowsetJsonConstants.JSON_CONTENTTYPE);
}

Fixed version (ground truth):
private void writeJsonResponse(String aResponse,HttpServletResponse response) throws UnsupportedEncodingException, IOException {
  writeResponse(aResponse,response,RowsetJsonConstants.JSON_CONTENTTYPE);
}
Program: 145687
Project: 145687
Buggy source:
private void writeExcelResponse(byte[] aResponseData,HttpServletResponse response) throws UnsupportedEncodingException, IOException {
  response.setCharacterEncoding(SettingsConstants.COMMON_ENCODING);
  response.setContentType(EXCEL_CONTENT_TYPE);
  response.addHeader("String_Node_Str","String_Node_Str");
  response.setContentLength(aResponseData.length);
  response.getOutputStream().write(aResponseData);
}

Fixed version (ground truth):
private void writeExcelResponse(byte[] aResponse,HttpServletResponse response) throws UnsupportedEncodingException, IOException {
  response.setCharacterEncoding(SettingsConstants.COMMON_ENCODING);
  response.setContentType(EXCEL_CONTENT_TYPE);
  response.addHeader("String_Node_Str","String_Node_Str");
  response.setContentLength(aResponse.length);
  response.getOutputStream().write(aResponse);
}
Program: 145688
Project: 145688
Buggy source:
@Override public void run(XMLHttpRequest aResult) throws Exception {
  Utils.executeScriptEventVoid(onSuccess,onSuccess,null);
}

Fixed version (ground truth):
@Override public void run(XMLHttpRequest aResult) throws Exception {
  Utils.executeScriptEventVoid(onSuccess,onSuccess,null);
  Location.reload();
}
Program: 145689
Project: 145689
Buggy source:
public static JavaScriptObject jsLogout(final JavaScriptObject onSuccess) throws Exception {
  return Utils.publishCancellable(AppClient.getInstance().logout(new Callback<XMLHttpRequest>(){
    @Override public void cancel(){
    }
    @Override public void run(    XMLHttpRequest aResult) throws Exception {
      Utils.executeScriptEventVoid(onSuccess,onSuccess,null);
    }
  }
));
}

Fixed version (ground truth):
public static JavaScriptObject jsLogout(final JavaScriptObject onSuccess) throws Exception {
  return Utils.publishCancellable(AppClient.getInstance().logout(new Callback<XMLHttpRequest>(){
    @Override public void cancel(){
    }
    @Override public void run(    XMLHttpRequest aResult) throws Exception {
      Utils.executeScriptEventVoid(onSuccess,onSuccess,null);
      Location.reload();
    }
  }
));
}
Program: 145690
Project: 145690
Buggy source:
public String executeServerModuleMethod(final String aModuleName,final String aMethodName,final JsArrayString aParams,final JavaScriptObject onSuccess) throws Exception {
  String[] convertedParams=new String[aParams.length()];
  for (int i=0; i < aParams.length(); i++)   convertedParams[i]=param(PlatypusHttpRequestParams.PARAMS_ARRAY,aParams.get(i));
  String query=params(param(PlatypusHttpRequestParams.TYPE,String.valueOf(Requests.rqExecuteServerModuleMethod)),param(PlatypusHttpRequestParams.MODULE_NAME,aModuleName),param(PlatypusHttpRequestParams.METHOD_NAME,aMethodName),params(convertedParams));
  if (onSuccess != null) {
    startRequest(API_URI,query,null,RequestBuilder.GET,new ResponseCallbackAdapter(){
      @Override public void doWork(      XMLHttpRequest aResponse) throws Exception {
        callBack(onSuccess,aResponse.getResponseText());
      }
      private native void callBack(      JavaScriptObject onSuccess,      String aData) throws Exception ;
    }
,null);
    return null;
  }
 else {
    return syncRequest(API_URI,query,null,RequestBuilder.GET);
  }
}

Fixed version (ground truth):
public String executeServerModuleMethod(final String aModuleName,final String aMethodName,final JsArrayString aParams,final JavaScriptObject onSuccess) throws Exception {
  String[] convertedParams=new String[aParams.length()];
  for (int i=0; i < aParams.length(); i++)   convertedParams[i]=param(PlatypusHttpRequestParams.PARAMS_ARRAY,aParams.get(i));
  String query=params(param(PlatypusHttpRequestParams.TYPE,String.valueOf(Requests.rqExecuteServerModuleMethod)),param(PlatypusHttpRequestParams.MODULE_NAME,aModuleName),param(PlatypusHttpRequestParams.METHOD_NAME,aMethodName),params(convertedParams));
  if (onSuccess != null) {
    startRequest(API_URI,query,null,RequestBuilder.GET,new ResponseCallbackAdapter(){
      @Override public void doWork(      XMLHttpRequest aResponse) throws Exception {
        String responseType=aResponse.getResponseHeader("String_Node_Str");
        if (responseType != null) {
          responseType=responseType.toLowerCase();
          if (responseType.contains("String_Node_Str") || responseType.contains("String_Node_Str")) {
            jsonCallBack(onSuccess,aResponse.getResponseText());
          }
 else {
            textCallBack(onSuccess,aResponse.getResponseText());
          }
        }
 else {
          textCallBack(onSuccess,aResponse.getResponseText());
        }
      }
      private native void jsonCallBack(      JavaScriptObject onSuccess,      String aData) throws Exception ;
      private native void textCallBack(      JavaScriptObject onSuccess,      String aData) throws Exception ;
    }
,null);
    return null;
  }
 else {
    return syncRequest(API_URI,query,null,RequestBuilder.GET);
  }
}
Program: 145691
Project: 145691
Buggy source:
public Cancellable pollData(String aQueryId,Parameters aParams,final Callback<Rowset> onSuccess,final Callback<String> onFailure) throws Exception {
  String query=params(param(PlatypusHttpRequestParams.TYPE,String.valueOf(Requests.rqExecuteQuery)),param(PlatypusHttpRequestParams.QUERY_ID,aQueryId),params(aParams));
  return startRequest(API_URI,query,"String_Node_Str",RequestBuilder.GET,new ResponseCallbackAdapter(){
    @Override public void doWork(    XMLHttpRequest aResponse) throws Exception {
      Rowset rowset=readRowset(aResponse);
      onSuccess.run(rowset);
    }
    private Rowset readRowset(    XMLHttpRequest aResponse) throws Exception {
      return RowsetReader.read(JSONParser.parseStrict(aResponse.getResponseText()));
    }
  }
,new ResponseCallbackAdapter(){
    @Override protected void doWork(    XMLHttpRequest aResponse) throws Exception {
      if (onFailure != null) {
        onFailure.run(aResponse.getStatusText());
      }
    }
  }
);
}

Fixed version (ground truth):
public Cancellable pollData(String aQueryId,Parameters aParams,final Callback<Rowset> onSuccess,final Callback<String> onFailure) throws Exception {
  String query=params(param(PlatypusHttpRequestParams.TYPE,String.valueOf(Requests.rqExecuteQuery)),param(PlatypusHttpRequestParams.QUERY_ID,aQueryId),params(aParams));
  return startRequest(API_URI,query,"String_Node_Str",RequestBuilder.GET,new ResponseCallbackAdapter(){
    @Override public void doWork(    XMLHttpRequest aResponse) throws Exception {
      Rowset rowset=readRowset(aResponse);
      onSuccess.run(rowset);
    }
    private Rowset readRowset(    XMLHttpRequest aResponse) throws Exception {
      return RowsetReader.read(JSONParser.parseStrict(aResponse.getResponseText()));
    }
  }
,new ResponseCallbackAdapter(){
    @Override protected void doWork(    XMLHttpRequest aResponse) throws Exception {
      if (onFailure != null) {
        int status=aResponse.getStatus();
        String statusText=aResponse.getStatusText();
        if ((statusText == null || statusText.isEmpty()) && status == 0)         statusText="String_Node_Str";
        onFailure.run(statusText);
      }
    }
  }
);
}
Program: 145692
Project: 145692
Buggy source:
@Override protected void doWork(XMLHttpRequest aResponse) throws Exception {
  if (onFailure != null) {
    onFailure.run(aResponse.getStatusText());
  }
}

Fixed version (ground truth):
@Override protected void doWork(XMLHttpRequest aResponse) throws Exception {
  if (onFailure != null) {
    int status=aResponse.getStatus();
    String statusText=aResponse.getStatusText();
    if ((statusText == null || statusText.isEmpty()) && status == 0)     statusText="String_Node_Str";
    onFailure.run(statusText);
  }
}
Program: 145694
Project: 145694
Buggy source:
private static TabItemConfig parseTabItemConfig(Element aTag,final ImageResourceCallback aImageLoadedCallback){
  final TabItemConfig config=new TabItemConfig();
  if (aTag.hasAttribute("String_Node_Str")) {
    String value=aTag.getAttribute("String_Node_Str");
    if (value != null && value.startsWith(PlatypusLabel.HTML_SWING_PREFIX))     config.setHTML(value.substring(PlatypusLabel.HTML_SWING_PREFIX.length()));
 else     config.setText(value);
  }
  if (aTag.hasAttribute("String_Node_Str")) {
    config.setIcon(AppClient.getInstance().getImageResource(aTag.getAttribute("String_Node_Str")).addJavaCallback(new ImageResourceCallback(){
      @Override public void run(      ImageResource aResource){
        config.setIcon(aResource);
        if (aImageLoadedCallback != null)         aImageLoadedCallback.run(aResource);
      }
    }
));
  }
  config.setClosable(false);
  return config;
}

Fixed version (ground truth):
private static TabItemConfig parseTabItemConfig(Element aTag,final ImageResourceCallback aImageLoadedCallback){
  final TabItemConfig config=new TabItemConfig();
  if (aTag.hasAttribute("String_Node_Str")) {
    String value=aTag.getAttribute("String_Node_Str");
    if (value != null && value.startsWith(PlatypusLabel.HTML_SWING_PREFIX))     config.setHTML(value.substring(PlatypusLabel.HTML_SWING_PREFIX.length()));
 else     config.setText(value);
  }
  if (aTag.hasAttribute("String_Node_Str")) {
    config.setIcon(AppClient.getInstance().getImageResource(aTag.getAttribute("String_Node_Str")).addCallback(new ImageResourceCallback(){
      @Override public void run(      ImageResource aResource){
        config.setIcon(aResource);
        if (aImageLoadedCallback != null)         aImageLoadedCallback.run(aResource);
      }
    }
));
  }
  config.setClosable(false);
  return config;
}
Program: 145695
Project: 145695
Buggy source:
private void setIconAndAlign(final CellButtonBase<?> btn,Element aTag) throws Exception {
  btn.setIconAlign(IconAlign.LEFT);
  if (aTag.hasAttribute("String_Node_Str")) {
    int horizontalTextPosition=Utils.getIntegerAttribute(aTag,"String_Node_Str",11);
switch (horizontalTextPosition) {
case 4:
      btn.setIconAlign(IconAlign.LEFT);
    break;
case 2:
  btn.setIconAlign(IconAlign.RIGHT);
break;
case 0:
btn.setIconAlign(IconAlign.LEFT);
break;
case 10:
btn.setIconAlign(IconAlign.RIGHT);
break;
case 11:
btn.setIconAlign(IconAlign.LEFT);
break;
default :
btn.setIconAlign(IconAlign.LEFT);
break;
}
}
if (aTag.hasAttribute("String_Node_Str")) {
int verticalTextPosition=Utils.getIntegerAttribute(aTag,"String_Node_Str",0);
switch (verticalTextPosition) {
case 0:
btn.setIconAlign(IconAlign.LEFT);
break;
case 1:
btn.setIconAlign(IconAlign.BOTTOM);
break;
case 3:
btn.setIconAlign(IconAlign.TOP);
break;
default :
btn.setIconAlign(IconAlign.LEFT);
break;
}
}
btn.setScale(ButtonScale.SMALL);
if (aTag.hasAttribute("String_Node_Str")) {
btn.setIcon(AppClient.getInstance().getImageResource(aTag.getAttribute("String_Node_Str")).addJavaCallback(new ImageResourceCallback(){
@Override public void run(ImageResource aResource){
btn.setIcon(aResource);
if (btn.getParent() instanceof HasLayout) {
HasLayout c=(HasLayout)btn.getParent();
c.forceLayout();
}
}
}
));
}
}

Fixed version (ground truth):
private void setIconAndAlign(final CellButtonBase<?> btn,Element aTag) throws Exception {
  btn.setIconAlign(IconAlign.LEFT);
  if (aTag.hasAttribute("String_Node_Str")) {
    int horizontalTextPosition=Utils.getIntegerAttribute(aTag,"String_Node_Str",11);
switch (horizontalTextPosition) {
case 4:
      btn.setIconAlign(IconAlign.LEFT);
    break;
case 2:
  btn.setIconAlign(IconAlign.RIGHT);
break;
case 0:
btn.setIconAlign(IconAlign.LEFT);
break;
case 10:
btn.setIconAlign(IconAlign.RIGHT);
break;
case 11:
btn.setIconAlign(IconAlign.LEFT);
break;
default :
btn.setIconAlign(IconAlign.LEFT);
break;
}
}
if (aTag.hasAttribute("String_Node_Str")) {
int verticalTextPosition=Utils.getIntegerAttribute(aTag,"String_Node_Str",0);
switch (verticalTextPosition) {
case 0:
btn.setIconAlign(IconAlign.LEFT);
break;
case 1:
btn.setIconAlign(IconAlign.BOTTOM);
break;
case 3:
btn.setIconAlign(IconAlign.TOP);
break;
default :
btn.setIconAlign(IconAlign.LEFT);
break;
}
}
btn.setScale(ButtonScale.SMALL);
if (aTag.hasAttribute("String_Node_Str")) {
btn.setIcon(AppClient.getInstance().getImageResource(aTag.getAttribute("String_Node_Str")).addCallback(new ImageResourceCallback(){
@Override public void run(ImageResource aResource){
btn.setIcon(aResource);
Scheduler.get().scheduleDeferred(new ScheduledCommand(){
@Override public void execute(){
if (btn.getParent() instanceof ResizeContainer) {
ResizeContainer c=(ResizeContainer)btn.getParent();
Size s=XElement.as(c.getElement().getParentElement()).getSize(true);
c.setPixelSize(s.getWidth() + 1,s.getHeight());
c.setPixelSize(s.getWidth() - 1,s.getHeight());
}
 else if (btn.getParent() instanceof HasLayout) {
((HasLayout)btn.getParent()).forceLayout();
}
}
}
);
}
}
));
}
}
Program: 145696
Project: 145696
Buggy source:
private Component createMenuItem(Element aTag) throws Exception {
  final MenuItem component=new MenuItem();
  processEvents(component,aTag);
  Publisher.publish(component);
  if (aTag.hasAttribute("String_Node_Str"))   component.setText(aTag.getAttribute("String_Node_Str"));
  if (aTag.hasAttribute("String_Node_Str")) {
    component.setIcon(AppClient.getInstance().getImageResource(aTag.getAttribute("String_Node_Str")).addJavaCallback(new ImageResourceCallback(){
      @Override public void run(      ImageResource aResource){
        component.setIcon(aResource);
      }
    }
));
  }
  checkBorders(component,aTag);
  PublishedComponent publishedComp=(PublishedComponent)component.getData(Form.PUBLISHED_DATA_KEY);
  processGeneralProperties(component,aTag,false,publishedComp);
  Form.inject(module,(String)component.getData(Form.PID_DATA_KEY),publishedComp);
  return component;
}

Fixed version (ground truth):
private Component createMenuItem(Element aTag) throws Exception {
  final MenuItem component=new MenuItem();
  processEvents(component,aTag);
  Publisher.publish(component);
  if (aTag.hasAttribute("String_Node_Str"))   component.setText(aTag.getAttribute("String_Node_Str"));
  if (aTag.hasAttribute("String_Node_Str")) {
    component.setIcon(AppClient.getInstance().getImageResource(aTag.getAttribute("String_Node_Str")).addCallback(new ImageResourceCallback(){
      @Override public void run(      ImageResource aResource){
        component.setIcon(aResource);
      }
    }
));
  }
  checkBorders(component,aTag);
  PublishedComponent publishedComp=(PublishedComponent)component.getData(Form.PUBLISHED_DATA_KEY);
  processGeneralProperties(component,aTag,false,publishedComp);
  Form.inject(module,(String)component.getData(Form.PID_DATA_KEY),publishedComp);
  return component;
}
Program: 145699
Project: 145699
Buggy source:
@Override public String getPath(){
  return null;
}

Fixed version (ground truth):
@Override public String getPath(){
  if (columnRef != null && columnRef.entity != null && columnRef.getColIndex() > 0) {
    return columnRef.entity.getEntityId() + "String_Node_Str" + columnRef.getColIndex();
  }
 else   return null;
}
Program: 145700
Project: 145700
Buggy source:
@Override public String getPath(){
  return null;
}

Fixed version (ground truth):
@Override public String getPath(){
  if (columnRef != null && columnRef.entity != null && columnRef.getColIndex() > 0) {
    return columnRef.entity.getEntityId() + "String_Node_Str" + columnRef.getColIndex();
  }
 else   return null;
}
Program: 145701
Project: 145701
Buggy source:
private void adjustWidths(){
  if (rows == 1) {
    return;
  }
  cleanCells();
  for (int i=0; i < rows; i++) {
    int columns=table.getCellCount(i);
    int mark=0;
    for (int j=0; j < columns; j++) {
      TableCellElement cell=table.getCellFormatter().getElement(i,j).cast();
      int colspan=cell.getColSpan();
      int w=0;
      for (int k=mark; k < (mark + colspan); k++) {
        ColumnConfig<M,?> c=cm.getColumn(k);
        if (c.isHidden()) {
          continue;
        }
        w+=cm.getColumnWidth(k);
      }
      mark+=colspan;
      cell.getStyle().setPropertyPx("String_Node_Str",w);
      int adj=cell.<XElement>cast().getFrameWidth(Side.LEFT,Side.RIGHT);
      XElement inner=cell.getFirstChildElement().cast();
      inner.setWidth(w - adj,true);
    }
  }
}

Fixed version (ground truth):
private void adjustWidths(){
}
Program: 145703
Project: 145703
Buggy source:
@ScriptFunction(jsDocText="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str") public boolean save() throws Exception {
  if (commitable) {
    try {
      commit();
      saved();
    }
 catch (    Exception ex) {
      rolledback();
      throw ex;
    }
  }
  return true;
}

Fixed version (ground truth):
@ScriptFunction(jsDocText="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str") public boolean save(Function aCallback) throws Exception {
  if (commitable) {
    try {
      commit();
      saved();
      if (aCallback != null) {
        Context cx=Context.getCurrentContext();
        boolean wasContext=cx != null;
        if (!wasContext) {
          cx=ScriptUtils.enterContext();
        }
        try {
          aCallback.call(cx,scriptScope,scriptScope,new Object[]{});
        }
  finally {
          if (!wasContext) {
            Context.exit();
          }
        }
      }
    }
 catch (    Exception ex) {
      rolledback();
      throw ex;
    }
  }
  return true;
}
Program: 145704
Project: 145704
Buggy source:
private String replaceLinkedParameters(String aSqlText,Set<Relation<QueryEntity>> parametersRelations){
  for (  Relation<QueryEntity> rel : parametersRelations) {
    if (rel.getLeftField() != null && rel.getRightParameter() != null) {
      aSqlText=Pattern.compile(COLON + rel.getRightParameter() + "String_Node_Str",Pattern.CASE_INSENSITIVE).matcher(aSqlText).replaceAll(COLON + rel.getLeftField());
    }
 else     if (rel.getLeftParameter() != null && rel.getRightParameter() != null) {
      aSqlText=Pattern.compile(COLON + rel.getRightParameter() + "String_Node_Str",Pattern.CASE_INSENSITIVE).matcher(aSqlText).replaceAll(COLON + rel.getLeftParameter());
    }
  }
  return aSqlText;
}

Fixed version (ground truth):
private String replaceLinkedParameters(String aSqlText,Set<Relation<QueryEntity>> parametersRelations){
  for (  Relation<QueryEntity> rel : parametersRelations) {
    if (rel.getLeftEntity() instanceof QueryParametersEntity && rel.getLeftField() != null && rel.getRightParameter() != null) {
      aSqlText=Pattern.compile(COLON + rel.getRightParameter().getName() + "String_Node_Str",Pattern.CASE_INSENSITIVE).matcher(aSqlText).replaceAll(COLON + rel.getLeftField().getName());
    }
  }
  return aSqlText;
}
Program: 145705
Project: 145705
Buggy source:
private Fields filterFields(Fields aFields){
  Fields resFields=new Fields();
  for (int i=aFields.getFieldsCount(); i > 0; i--) {
    Field field=aFields.get(i);
    if ((!filterForeignKeys || !field.isFk()) && (!filterPrimaryKeys || !field.isPk()) && !hidingFields.contains(field.getName().toLowerCase())) {
      resFields.add(field);
    }
  }
  return resFields;
}

Fixed version (ground truth):
private Fields filterFields(Fields aFields){
  Fields resFields=new Fields();
  for (int i=1; i <= aFields.getFieldsCount(); i++) {
    Field field=aFields.get(i);
    if ((!filterForeignKeys || !field.isFk()) && (!filterPrimaryKeys || !field.isPk()) && !hidingFields.contains(field.getName().toLowerCase())) {
      resFields.add(field);
    }
  }
  return resFields;
}
Program: 145708
Project: 145708
Buggy source:
public static byte[] load(String aResourceId) throws Exception {
  if (aResourceId != null && !aResourceId.isEmpty()) {
    Matcher htppMatcher=pattern.matcher(aResourceId);
    if (htppMatcher.matches()) {
      URL url=new URL(aResourceId);
      String file="String_Node_Str";
      if (url.getPath() != null && !url.getPath().isEmpty()) {
        file+=(new URI(null,null,url.getPath(),null)).toASCIIString();
      }
      if (url.getQuery() != null && !url.getQuery().isEmpty()) {
        file+="String_Node_Str" + url.getQuery();
      }
      if (url.getRef() != null && !url.getRef().isEmpty()) {
        file+="String_Node_Str" + url.getRef();
      }
      url=new URL(url.getProtocol(),IDN.toASCII(url.getHost()),url.getPort(),file);
      try (InputStream is=url.openStream()){
        return BinaryUtils.readStream(is,-1);
      }
     }
 else {
      if (cache == null) {
        throw new IllegalStateException("String_Node_Str");
      }
      String resourceId=translateResourcePath(aResourceId);
      ApplicationElement appElement=cache.get(resourceId);
      if (appElement != null) {
        if (appElement.getType() == ClientConstants.ET_RESOURCE) {
          if (!cache.isActual(appElement.getId(),appElement.getTxtContentLength(),appElement.getTxtCrc32())) {
            cache.remove(appElement.getId());
            appElement=cache.get(resourceId);
          }
        }
 else {
          throw new NotResourceException(resourceId);
        }
      }
      if (appElement != null && appElement.getType() == ClientConstants.ET_RESOURCE) {
        return appElement.getBinaryContent();
      }
 else {
        return null;
      }
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static byte[] load(String aResourceId) throws Exception {
  if (aResourceId != null && !aResourceId.isEmpty()) {
    Matcher htppMatcher=pattern.matcher(aResourceId);
    if (htppMatcher.matches()) {
      URL url=new URL(aResourceId);
      try {
        try (InputStream is=url.openStream()){
          return BinaryUtils.readStream(is,-1);
        }
       }
 catch (      IOException ex) {
        url=encodeUrl(url);
        try (InputStream is=url.openStream()){
          return BinaryUtils.readStream(is,-1);
        }
       }
    }
 else {
      if (cache == null) {
        throw new IllegalStateException("String_Node_Str");
      }
      String resourceId=translateResourcePath(aResourceId);
      ApplicationElement appElement=cache.get(resourceId);
      if (appElement != null) {
        if (appElement.getType() == ClientConstants.ET_RESOURCE) {
          if (!cache.isActual(appElement.getId(),appElement.getTxtContentLength(),appElement.getTxtCrc32())) {
            cache.remove(appElement.getId());
            appElement=cache.get(resourceId);
          }
        }
 else {
          throw new NotResourceException(resourceId);
        }
      }
      if (appElement != null && appElement.getType() == ClientConstants.ET_RESOURCE) {
        return appElement.getBinaryContent();
      }
 else {
        return null;
      }
    }
  }
 else {
    return null;
  }
}
Program: 145709
Project: 145709
Buggy source:
public boolean onBlockPlaced(int max,int owner){
  this.maxBlockCount=max;
  this.ownerID=owner;
  Hashtable<Integer,Integer> blockCounts=null;
  if (blocksPerPlayer.get(this.getClass()) == null) {
    blockCounts=new Hashtable<Integer,Integer>();
    blocksPerPlayer.put(this.getClass(),blockCounts);
  }
 else {
    blockCounts=blocksPerPlayer.get(this.getClass());
  }
  if (maxBlockCount != 0) {
    if (blockCounts.get(owner) != null && blockCounts.get(owner) < maxBlockCount) {
      blockCounts.put(owner,blockCounts.get(owner) + 1);
    }
 else {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean onBlockPlaced(int max,int owner){
  this.maxBlockCount=max;
  this.ownerID=owner;
  Hashtable<Integer,Integer> blockCounts=null;
  if (blocksPerPlayer.get(this.getClass()) == null) {
    blockCounts=new Hashtable<Integer,Integer>();
    blocksPerPlayer.put(this.getClass(),blockCounts);
  }
 else {
    blockCounts=blocksPerPlayer.get(this.getClass());
  }
  if (maxBlockCount != 0) {
    if (blockCounts.get(owner) == null) {
      blockCounts.put(owner,1);
    }
 else     if (blockCounts.get(owner) < maxBlockCount) {
      blockCounts.put(owner,blockCounts.get(owner) + 1);
    }
 else {
      return false;
    }
  }
  return true;
}
Program: 145712
Project: 145712
Buggy source:
private void placeBlockInFront(World world,int x,int y,int z){
  TileEntityUser tileEntity=(TileEntityUser)world.getTileEntity(x,y,z);
  int meta=world.getBlockMetadata(x,y,z);
  int i=getI(meta,x);
  int j=getJ(meta,y);
  int k=getK(meta,z);
  int slot=getFirstSlot(tileEntity,world,i,j,k);
  if (slot == -1)   return;
  Block block=null;
  ItemStack itemStack=tileEntity.getStackInSlot(slot);
  int itemMetadata=itemStack.getItemDamage();
  if (tileEntity.getStackInSlot(slot).getItem() instanceof IPlantable) {
    block=((IPlantable)itemStack.getItem()).getPlant(world,i,j,k);
    if (!world.getBlock(i,j - 1,k).equals(Blocks.farmland)) {
      return;
    }
  }
 else {
    block=Block.getBlockFromItem(itemStack.getItem());
  }
  if (world.getBlock(i,j,k).equals(Blocks.air) && block != null) {
    world.setBlock(i,j,k,block);
    world.setBlockMetadataWithNotify(i,j,k,itemMetadata,2);
    tileEntity.getStackInSlot(slot).stackSize--;
    if (tileEntity.getStackInSlot(slot).stackSize == 0)     tileEntity.setInventorySlotContents(slot,null);
  }
}

Fixed version (ground truth):
private void placeBlockInFront(World world,int x,int y,int z){
  TileEntityUser tileEntity=(TileEntityUser)world.getTileEntity(x,y,z);
  int meta=world.getBlockMetadata(x,y,z);
  int i=getI(meta,x);
  int j=getJ(meta,y);
  int k=getK(meta,z);
  int slot=getFirstSlot(tileEntity,world,i,j,k);
  if (slot == -1)   return;
  Block block=null;
  ItemStack itemStack=tileEntity.getStackInSlot(slot);
  int itemMetadata=itemStack.getItemDamage();
  if (itemStack.getItem() instanceof IPlantable) {
    block=((IPlantable)itemStack.getItem()).getPlant(world,i,j,k);
    if (!world.getBlock(i,j - 1,k).canSustainPlant(world,i,j,k,ForgeDirection.UP,(IPlantable)block))     return;
  }
 else {
    block=Block.getBlockFromItem(itemStack.getItem());
  }
  if (world.getBlock(i,j,k).equals(Blocks.air) && block != null) {
    world.setBlock(i,j,k,block);
    world.setBlockMetadataWithNotify(i,j,k,itemMetadata,2);
    tileEntity.getStackInSlot(slot).stackSize--;
    if (tileEntity.getStackInSlot(slot).stackSize == 0)     tileEntity.setInventorySlotContents(slot,null);
  }
}
Program: 145713
Project: 145713
Buggy source:
@Override public void onBlockHarvested(World world,int x,int y,int z,int meta,EntityPlayer player){
  super.onBlockHarvested(world,x,y,z,meta,player);
  Hashtable<Class<? extends BlockAdvancedDispensers>,Integer> map=blocksPerPlayer.get(player);
  map.put(this.getClass(),map.get(this.getClass()).intValue() - 2);
  System.out.println(map.get(this.getClass()).intValue());
}

Fixed version (ground truth):
@Override public void onBlockHarvested(World world,int x,int y,int z,int meta,EntityPlayer player){
  super.onBlockHarvested(world,x,y,z,meta,player);
  Hashtable<Class<? extends BlockAdvancedDispensers>,Integer> map=blocksPerPlayer.get(player);
  if (map != null) {
    EntityLivingBase owner=((TileEntityAdvancedDispensers)world.getTileEntity(x,y,z)).getOwner();
    int i=map.get(this.getClass()).intValue();
    if (i - 2 >= 0 && owner.equals(player)) {
      map.put(this.getClass(),i - 2);
    }
  }
}
Program: 145714
Project: 145714
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase livingBase,ItemStack itemStack){
  super.onBlockPlacedBy(world,x,y,z,livingBase,itemStack);
  Hashtable<Class<? extends BlockAdvancedDispensers>,Integer> blockCounts=blocksPerPlayer.get(livingBase);
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase livingBase,ItemStack itemStack){
  super.onBlockPlacedBy(world,x,y,z,livingBase,itemStack);
  ((TileEntityAdvancedDispensers)world.getTileEntity(x,y,z)).setOwner(livingBase);
  Hashtable<Class<? extends BlockAdvancedDispensers>,Integer> blockCounts=blocksPerPlayer.get(livingBase);
  if (maxBlockCount != 0 && blockCounts != null && blockCounts.get(this.getClass()) != null && blockCounts.get(this.getClass()) >= maxBlockCount) {
    if (livingBase instanceof EntityPlayer) {
      EntityPlayer player=(EntityPlayer)livingBase;
      player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + I18n.format("String_Node_Str",new Object[0])));
      if (!player.capabilities.isCreativeMode)       player.inventory.getStackInSlot(player.inventory.currentItem).stackSize++;
    }
    world.setBlock(x,y,z,Blocks.air);
  }
 else {
    if (blocksPerPlayer.get(livingBase) == null) {
      blocksPerPlayer.put(livingBase,new Hashtable<Class<? extends BlockAdvancedDispensers>,Integer>());
    }
    int value=0;
    if (blocksPerPlayer.get(livingBase).get(this.getClass()) != null) {
      value=blocksPerPlayer.get(livingBase).get(this.getClass()).intValue();
    }
    Hashtable<Class<? extends BlockAdvancedDispensers>,Integer> old=blocksPerPlayer.get(livingBase);
    old.put(this.getClass(),value + 1);
    System.out.println(old.get(this.getClass()).intValue());
    blocksPerPlayer.put(livingBase,old);
  }
}
Program: 145715
Project: 145715
Buggy source:
public TileEntityUser(){
  super("String_Node_Str",9);
}

Fixed version (ground truth):
public TileEntityUser(){
  super("String_Node_Str",9);
  fakePlayer=null;
}
Program: 145716
Project: 145716
Buggy source:
public void useItem(int slot){
  Item item=this.getStackInSlot(slot).getItem();
  int i=xCoord, j=yCoord, k=zCoord, c=0, meta=worldObj.getBlockMetadata(xCoord,yCoord,zCoord);
  do {
    i=AdvancedDispensersLib.INSTANCE.getI(meta,i);
    j=AdvancedDispensersLib.INSTANCE.getJ(meta,j);
    k=AdvancedDispensersLib.INSTANCE.getK(meta,k);
    c++;
  }
 while (c < fakePlayer.getRange() && !worldObj.getBlock(i,j,k).equals(Blocks.air));
  int side;
  if (meta % 2 == 0)   side=meta + 1;
 else   side=meta - 1;
  if (item.onItemUseFirst(this.getStackInSlot(slot),fakePlayer,worldObj,i,j,k,side,0.5f,0.5f,0.5f)) {
  }
 else   if (item.onItemUse(this.getStackInSlot(slot),fakePlayer,worldObj,i,j,k,side,0.5f,0.5f,0.5f)) {
  }
 else {
    this.setInventorySlotContents(slot,item.onItemRightClick(this.getStackInSlot(slot),worldObj,fakePlayer));
    if (this.getStackInSlot(slot).stackSize == 0)     this.setInventorySlotContents(slot,null);
  }
}

Fixed version (ground truth):
public void useItem(int slot){
  if (fakePlayer == null) {
    fakePlayer=new EntityFakePlayer(worldObj,this,xCoord,yCoord,zCoord,worldObj.getBlockMetadata(xCoord,yCoord,zCoord));
  }
  Item item=this.getStackInSlot(slot).getItem();
  int i=xCoord, j=yCoord, k=zCoord, c=0, meta=worldObj.getBlockMetadata(xCoord,yCoord,zCoord);
  do {
    i=AdvancedDispensersLib.INSTANCE.getI(meta,i);
    j=AdvancedDispensersLib.INSTANCE.getJ(meta,j);
    k=AdvancedDispensersLib.INSTANCE.getK(meta,k);
    c++;
  }
 while (c < fakePlayer.getRange() && !worldObj.getBlock(i,j,k).equals(Blocks.air));
  int side;
  if (meta % 2 == 0)   side=meta + 1;
 else   side=meta - 1;
  if (item.onItemUseFirst(this.getStackInSlot(slot),fakePlayer,worldObj,i,j,k,side,0.5f,0.5f,0.5f)) {
  }
 else   if (item.onItemUse(this.getStackInSlot(slot),fakePlayer,worldObj,i,j,k,side,0.5f,0.5f,0.5f)) {
  }
 else {
    this.setInventorySlotContents(slot,item.onItemRightClick(this.getStackInSlot(slot),worldObj,fakePlayer));
    if (this.getStackInSlot(slot).stackSize == 0)     this.setInventorySlotContents(slot,null);
  }
}