nus-yam/ex-repair huggingface dataset:
Program: 145457
Project: 145457
Buggy source:
public DatabaseAppCache(String aAppDatabaseJndiUrl) throws Exception {
  super("String_Node_Str" + String.valueOf(aAppDatabaseJndiUrl.hashCode()));
  if (!aAppDatabaseJndiUrl.startsWith(APP_URL_PREFIX)) {
    throw new IllegalArgumentException("String_Node_Str" + APP_URL_PREFIX + "String_Node_Str");
  }
  appDatabaseJndiUrl=aAppDatabaseJndiUrl;
  datasourceName=appDatabaseJndiUrl.substring(APP_URL_PREFIX.length(),appDatabaseJndiUrl.length());
  client=new DatabasesClient(null,datasourceName,false);
}

Fixed version (ground truth):
public DatabaseAppCache(String aAppDatabaseJndiUrl,String aAppCacheBasePath) throws Exception {
  super("String_Node_Str" + String.valueOf(aAppDatabaseJndiUrl.hashCode()),aAppCacheBasePath);
  if (!aAppDatabaseJndiUrl.startsWith(APP_URL_PREFIX)) {
    throw new IllegalArgumentException("String_Node_Str" + APP_URL_PREFIX + "String_Node_Str");
  }
  appDatabaseJndiUrl=aAppDatabaseJndiUrl;
  datasourceName=appDatabaseJndiUrl.substring(APP_URL_PREFIX.length(),appDatabaseJndiUrl.length());
  client=new DatabasesClient(null,datasourceName,false);
}
Program: 145458
Project: 145458
Buggy source:
@ScriptFunction(jsDoc=NEW_INDEX_JSDOC) public int getNewIndex(){
  return newIndex;
}

Fixed version (ground truth):
@ScriptFunction(jsDoc="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str") public int getNewIndex(){
  return newIndex;
}
Program: 145459
Project: 145459
Buggy source:
@ScriptFunction(jsDoc=NEW_INDEX_JSDOC) public int getNewIndex(){
  return newIndex;
}

Fixed version (ground truth):
@ScriptFunction(jsDoc="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str") public int getNewIndex(){
  return newIndex;
}
Program: 145460
Project: 145460
Buggy source:
@ScriptFunction(jsDoc=OLD_INDEX_JSDOC) public int getOldIndex(){
  return oldIndex;
}

Fixed version (ground truth):
@ScriptFunction(jsDoc="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str") public int getOldIndex(){
  return oldIndex;
}
Program: 145462
Project: 145462
Buggy source:
@Override public void eventExecuting(PublishedSourcedEvent anEvent){
  if (anEvent.getSource() == entity.getPublished()) {
    if (anEvent instanceof ApplicationEntity.CursorPositionChangedEvent || anEvent instanceof ApplicationEntity.CursorPositionWillChangeEvent) {
      scrollEvents++;
    }
 else {
      events++;
    }
  }
}

Fixed version (ground truth):
@Override public void eventExecuting(PublishedSourcedEvent anEvent){
  if (anEvent.getSource() == entity.getPublished()) {
    if (anEvent instanceof CursorPositionChangedEvent || anEvent instanceof CursorPositionWillChangeEvent) {
      scrollEvents++;
    }
 else {
      events++;
    }
  }
}
Program: 145463
Project: 145463
Buggy source:
@Override public void init(ServletConfig config) throws ServletException {
  try {
    super.init(config);
    ServerConfig scp=ServerConfig.parse(config);
    serverCore=PlatypusServerCore.getInstance(scp.getUrl(),scp.getDefaultDatasourceName(),scp.getTasks(),scp.getAppElementId());
  }
 catch (  Exception ex) {
    throw new ServletException(ex);
  }
}

Fixed version (ground truth):
@Override public void init(ServletConfig config) throws ServletException {
  try {
    super.init(config);
    ServerConfig scp=ServerConfig.parse(config);
    String docsRoot=config.getServletContext().getRealPath("String_Node_Str");
    serverCore=PlatypusServerCore.getInstance(scp.getUrl(),scp.getDefaultDatasourceName(),scp.getTasks(),scp.getAppElementId(),docsRoot + File.separator + ClientConstants.ENTITIES_CACHE_DIRECTORY_NAME);
  }
 catch (  Exception ex) {
    throw new ServletException(ex);
  }
}
Program: 145464
Project: 145464
Buggy source:
/** 
 * Generates path and creates it.
 * @param aAppelementName Application element name.
 * @return Generated and created path name.
 */
protected String generatePath(String aAppelementName){
  String pathName=basePath + File.separator + String.valueOf(Math.abs(aAppelementName.hashCode()) % 100);
  File path=new File(pathName);
  if (!path.exists()) {
    path.mkdir();
  }
  pathName+=File.separator + aAppelementName + File.separator+ aAppelementName;
  pathName=pathName.replace('/',File.separatorChar);
  return pathName;
}

Fixed version (ground truth):
/** 
 * Generates path and creates it.
 * @param aAppelementName Application element name.
 * @return Generated and created path name.
 */
protected String generatePath(String aAppelementName){
  String pathName=basePath + File.separator + String.valueOf(Math.abs(aAppelementName.hashCode()) % 100);
  File path=new File(pathName);
  if (!path.exists()) {
    path.mkdir();
  }
  pathName+=File.separator + aAppelementName;
  pathName=pathName.replace('/',File.separatorChar);
  return pathName;
}
Program: 145466
Project: 145466
Buggy source:
@Override public boolean enterFunctionNode(FunctionNode fn){
  if (scopeLevel == 1 && fn != jsRoot && !fn.isAnonymous()) {
    if (cx.functions == 0) {
      cx.result=fn;
    }
    cx.functions++;
  }
  return super.enterFunctionNode(fn);
}

Fixed version (ground truth):
@Override public boolean enterFunctionNode(FunctionNode fn){
  if (scopeLevel == 1 && fn != jsRoot && !fn.isAnonymous()) {
    if (cx.result == null) {
      cx.result=fn;
    }
    cx.functions++;
  }
  return super.enterFunctionNode(fn);
}
Program: 145467
Project: 145467
Buggy source:
/** 
 * Generates path and creates it.
 * @param aAppelementName Application element name.
 * @return Generated and created path name.
 */
protected String generatePath(String aAppelementName){
  String pathName=basePath + File.separator + String.valueOf(Math.abs(aAppelementName.hashCode()) % 100);
  File path=new File(pathName);
  if (!path.exists()) {
    path.mkdir();
  }
  pathName+=File.separator + aAppelementName;
  pathName=pathName.replace('/',File.separatorChar);
  return pathName;
}

Fixed version (ground truth):
/** 
 * Generates path and creates it.
 * @param aAppelementName Application element name.
 * @return Generated and created path name.
 */
protected String generatePath(String aAppelementName){
  String pathName=basePath + File.separator + String.valueOf(Math.abs(aAppelementName.hashCode()) % 100);
  File path=new File(pathName);
  if (!path.exists()) {
    path.mkdir();
  }
  pathName+=File.separator + aAppelementName + File.separator+ aAppelementName;
  pathName=pathName.replace('/',File.separatorChar);
  return pathName;
}
Program: 145468
Project: 145468
Buggy source:
@Override public String translateScriptPath(String aName) throws Exception {
  String res=calcSrcPath() + File.separator + aName;
  ApplicationElement appElement=get(aName);
  if (appElement != null && appElement.getType() != ClientConstants.ET_RESOURCE) {
    res+="String_Node_Str" + PlatypusFiles.JAVASCRIPT_EXTENSION;
  }
  return res;
}

Fixed version (ground truth):
@Override public String translateScriptPath(String aName) throws Exception {
  ApplicationElement appElement=get(aName);
  if (appElement != null && appElement.getType() != ClientConstants.ET_RESOURCE) {
    String path=id2Paths.get(aName).iterator().next();
    return path + "String_Node_Str" + PlatypusFiles.JAVASCRIPT_EXTENSION;
  }
 else {
    return calcSrcPath() + File.separator + aName;
  }
}
Program: 145469
Project: 145469
Buggy source:
@Override public String translateScriptPath(String aName) throws Exception {
  String res=generatePath(aName) + File.separator;
  ApplicationElement appElement=get(aName);
  if (appElement != null && appElement.getType() != ClientConstants.ET_RESOURCE) {
    res+="String_Node_Str" + PlatypusFiles.JAVASCRIPT_EXTENSION;
  }
  return res;
}

Fixed version (ground truth):
@Override public String translateScriptPath(String aName) throws Exception {
  String res=generatePath(aName);
  ApplicationElement appElement=get(aName);
  if (appElement != null && appElement.getType() != ClientConstants.ET_RESOURCE) {
    res+="String_Node_Str" + PlatypusFiles.JAVASCRIPT_EXTENSION;
  }
  return res;
}
Program: 145470
Project: 145470
Buggy source:
@Override protected void commentedFunction(FunctionNode fn,String aComment){
  JsDoc jsDoc=new JsDoc(aComment);
  if (jsDoc.containsModuleAnnotation()) {
    cx.result=fn;
    cx.annotatedConstructors++;
  }
}

Fixed version (ground truth):
@Override protected void commentedFunction(FunctionNode fn,String aComment){
  if (scopeLevel == 2) {
    JsDoc jsDoc=new JsDoc(aComment);
    if (jsDoc.containsModuleAnnotation()) {
      cx.result=fn;
      cx.annotatedConstructors++;
    }
  }
}
Program: 145472
Project: 145472
Buggy source:
@Override public boolean enterFunctionNode(FunctionNode fn){
  if (fn != jsRoot && !fn.isAnonymous()) {
    if (cx.functions == 0) {
      cx.result=fn;
    }
    cx.functions++;
  }
  return super.enterFunctionNode(fn);
}

Fixed version (ground truth):
@Override public boolean enterFunctionNode(FunctionNode fn){
  if (scopeLevel == 1 && fn != jsRoot && !fn.isAnonymous()) {
    if (cx.functions == 0) {
      cx.result=fn;
    }
    cx.functions++;
  }
  return super.enterFunctionNode(fn);
}
Program: 145473
Project: 145473
Buggy source:
@ScriptFunction(params={"String_Node_Str"},jsDoc="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str") public static String translateScriptPath(String aResourceId) throws Exception {
  if (aResourceId != null && !aResourceId.isEmpty()) {
    Matcher htppMatcher=pattern.matcher(aResourceId);
    if (htppMatcher.matches()) {
      return aResourceId;
    }
 else {
      if (cache == null) {
        throw new IllegalStateException("String_Node_Str");
      }
      String resourceId=normalizeResourcePath(aResourceId);
      String appElementCachedPath=cache.translateScriptPath(resourceId);
      if (appElementCachedPath != null) {
        return appElementCachedPath;
      }
 else {
        throw new IllegalArgumentException(String.format("String_Node_Str",aResourceId));
      }
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@ScriptFunction(params={"String_Node_Str"},jsDoc="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str") public static String translateScriptPath(String aResourceId) throws Exception {
  if (aResourceId != null && !aResourceId.isEmpty()) {
    Matcher httpMatcher=pattern.matcher(aResourceId);
    if (httpMatcher.matches()) {
      return aResourceId;
    }
 else {
      if (cache == null) {
        throw new IllegalStateException("String_Node_Str");
      }
      String resourceId=normalizeResourcePath(aResourceId);
      String appElementCachedPath=cache.translateScriptPath(resourceId);
      if (appElementCachedPath != null) {
        return appElementCachedPath;
      }
 else {
        throw new IllegalArgumentException(String.format("String_Node_Str",aResourceId));
      }
    }
  }
 else {
    return null;
  }
}
Program: 145475
Project: 145475
Buggy source:
@Override public Object run(Context cx) throws Exception {
  Function handler=handlers.get(aEventId);
  if (handler != null && eventThis != null) {
    return ScriptUtils.js2Java(handler.call(cx,eventThis,eventThis,new Object[]{anEvent}));
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Object run(Context cx) throws Exception {
  Function handler=handlers.get(aEventId);
  if (handler != null && eventThis != null) {
    return ScriptUtils.js2Java(handler.call(cx,handler,eventThis,new Object[]{anEvent}));
  }
 else {
    return null;
  }
}
Program: 145476
Project: 145476
Buggy source:
protected Object executeEvent(final int aEventId,final Object anEvent){
  try {
    return ScriptUtils.inContext(new ScriptAction(){
      @Override public Object run(      Context cx) throws Exception {
        Function handler=handlers.get(aEventId);
        if (handler != null && eventThis != null) {
          return ScriptUtils.js2Java(handler.call(cx,eventThis,eventThis,new Object[]{anEvent}));
        }
 else {
          return null;
        }
      }
    }
);
  }
 catch (  Exception ex) {
    Logger.getLogger(ControlEventsIProxy.class.getName()).log(Level.SEVERE,null,ex);
    return null;
  }
}

Fixed version (ground truth):
protected Object executeEvent(final int aEventId,final Object anEvent){
  try {
    return ScriptUtils.inContext(new ScriptAction(){
      @Override public Object run(      Context cx) throws Exception {
        Function handler=handlers.get(aEventId);
        if (handler != null && eventThis != null) {
          return ScriptUtils.js2Java(handler.call(cx,handler,eventThis,new Object[]{anEvent}));
        }
 else {
          return null;
        }
      }
    }
);
  }
 catch (  Exception ex) {
    Logger.getLogger(ControlEventsIProxy.class.getName()).log(Level.SEVERE,null,ex);
    return null;
  }
}
Program: 145478
Project: 145478
Buggy source:
@Override public int executeUpdate(SqlCompiledQuery aQuery) throws Exception {
  int rowsAffected=0;
  Converter converter=getDbMetadataCache(aQuery.getDatabaseId()).getConnectionDriver().getConverter();
  DataSource dataSource=obtainDataSource(aQuery.getDatabaseId());
  if (dataSource != null) {
    try (Connection connection=dataSource.getConnection();PreparedStatement stmt=connection.prepareStatement(aQuery.getSqlClause())){
      Parameters params=aQuery.getParameters();
      for (int i=1; i <= params.getParametersCount(); i++) {
        Parameter param=params.get(i);
        converter.convert2JdbcAndAssign(param.getValue(),param.getTypeInfo(),connection,i,stmt);
      }
      try {
        rowsAffected+=stmt.executeUpdate();
        connection.commit();
      }
 catch (      SQLException ex) {
        connection.rollback();
        throw ex;
      }
    }
   }
  return rowsAffected;
}

Fixed version (ground truth):
@Override public int executeUpdate(SqlCompiledQuery aQuery) throws Exception {
  int rowsAffected=0;
  Converter converter=getDbMetadataCache(aQuery.getDatabaseId()).getConnectionDriver().getConverter();
  DataSource dataSource=obtainDataSource(aQuery.getDatabaseId());
  if (dataSource != null) {
    try (Connection connection=dataSource.getConnection();PreparedStatement stmt=connection.prepareStatement(aQuery.getSqlClause())){
      connection.setAutoCommit(false);
      Parameters params=aQuery.getParameters();
      for (int i=1; i <= params.getParametersCount(); i++) {
        Parameter param=params.get(i);
        converter.convert2JdbcAndAssign(param.getValue(),param.getTypeInfo(),connection,i,stmt);
      }
      try {
        rowsAffected+=stmt.executeUpdate();
        connection.commit();
      }
 catch (      SQLException ex) {
        connection.rollback();
        throw ex;
      }
    }
   }
  return rowsAffected;
}
Program: 145479
Project: 145479
Buggy source:
/** 
 * Queries model's data for the first time.
 * @throws Exception 
 */
protected void doExecute() throws Exception {
  ScriptUtils.inContext(new ScriptAction(){
    @Override public Object run(    Context cx) throws Exception {
      model.setRuntime(true);
      return null;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Queries model's data for the first time.
 * @throws Exception
 */
protected void doExecute() throws Exception {
  ScriptUtils.inContext(new ScriptAction(){
    @Override public Object run(    Context cx) throws Exception {
      model.setRuntime(true);
      return null;
    }
  }
);
}
Program: 145480
Project: 145480
Buggy source:
/** 
 * Loads a script document from application database or filesystem and prepares it for execution and calls module's constructor.
 * @param aAppElementId Global module name (at application level) or path to executable js file.
 * @param args Js module's constructor arguments.
 * @throws Exception 
 */
public void loadApplicationElement(String aAppElementId,Object[] args) throws Exception {
}

Fixed version (ground truth):
/** 
 * Loads a script document from application database or filesystem and prepares it for execution and calls module's constructor.
 * @param aAppElementId Global module name (at application level) or path toexecutable js file.
 * @param args Js module's constructor arguments.
 * @throws Exception
 */
public void loadApplicationElement(String aAppElementId,Object[] args) throws Exception {
}
Program: 145481
Project: 145481
Buggy source:
/** 
 * Executes a plain js resource (file).
 * @param aResourceId
 * @throws Exception 
 */
public static void executeResource(final String aResourceId) throws Exception {
  final String resourceId=PlatypusScriptedResource.translateResourcePath(aResourceId);
  if (!executedScriptResources.contains(resourceId)) {
    try {
      ScriptUtils.inContext(new ScriptAction(){
        @Override public Object run(        Context cx) throws Exception {
          String source=PlatypusScriptedResource.loadText(resourceId);
          if (source != null) {
            cx.setOptimizationLevel(-1);
            Script lib=cx.compileString(source,resourceId,0,null);
            if (System.getProperty(DEBUG_PROPERTY) != null) {
              Breakpoints.getInstance().checkPendingBreakpoints();
            }
            lib.exec(cx,checkStandardObjects(cx));
          }
 else {
            throw new IllegalArgumentException("String_Node_Str" + resourceId + "String_Node_Str");
          }
          return null;
        }
      }
);
    }
 catch (    NotResourceException ex) {
      return;
    }
    executedScriptResources.add(resourceId);
  }
}

Fixed version (ground truth):
/** 
 * Executes a plain js resource (file).
 * @param aResourceId
 * @throws Exception
 */
public static void executeResource(final String aResourceId) throws Exception {
  final String resourceId=PlatypusScriptedResource.translateResourcePath(aResourceId);
  if (!executedScriptResources.contains(resourceId)) {
    try {
      ScriptUtils.inContext(new ScriptAction(){
        @Override public Object run(        Context cx) throws Exception {
          String source=PlatypusScriptedResource.loadText(resourceId);
          if (source != null) {
            cx.setOptimizationLevel(-1);
            Script lib=cx.compileString(source,resourceId,0,null);
            if (System.getProperty(DEBUG_PROPERTY) != null) {
              Breakpoints.getInstance().checkPendingBreakpoints();
            }
            lib.exec(cx,checkStandardObjects(cx));
          }
 else {
            throw new IllegalArgumentException("String_Node_Str" + resourceId + "String_Node_Str");
          }
          return null;
        }
      }
);
    }
 catch (    NotResourceException ex) {
      return;
    }
    executedScriptResources.add(resourceId);
  }
}
Program: 145482
Project: 145482
Buggy source:
/** 
 * Shrinks internal structures, allowing to reuse this instance of <code>ScriptRunner</code> with probably new content (hot reloading feature).
 * @see #refresh() 
 * @throws Exception 
 */
protected void shrink() throws Exception {
  model=null;
  functionAllowedRoles=null;
  moduleAllowedRoles=null;
  moduleAnnotations=null;
}

Fixed version (ground truth):
/** 
 * Shrinks internal structures, allowing to reuse this instance of <code>ScriptRunner</code> with probably new content (hot reloading feature).
 * @see #refresh()
 * @throws Exception
 */
protected void shrink() throws Exception {
  model=null;
  functionAllowedRoles=null;
  moduleAllowedRoles=null;
  moduleAnnotations=null;
}
Program: 145483
Project: 145483
Buggy source:
/** 
 * Injects platypus features into 'this' object, calls js module's constructor with arguments and finally resolves model'd entities' events handlers.
 * @param scriptDoc
 * @param args
 * @throws Exception 
 */
protected void prepareScript(final ScriptDocument scriptDoc,final Object[] args) throws Exception {
  ScriptUtils.inContext(new ScriptAction(){
    @Override public Object run(    Context cx) throws Exception {
      model.setScriptThis(ScriptRunner.this);
      if (scriptDoc.getFunction() != null) {
        Object[] jsArgs=new Object[args != null ? args.length : 0];
        for (int i=0; i < jsArgs.length; i++) {
          jsArgs[i]=ScriptUtils.javaToJS(args[i],ScriptUtils.getScope());
        }
        scriptDoc.getFunction().call(cx,getParentScope(),ScriptRunner.this,jsArgs);
      }
      model.resolveHandlers();
      return null;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Injects platypus features into 'this' object, calls js module's constructor with arguments and finally resolves model'd entities' events handlers.
 * @param scriptDoc
 * @param args
 * @throws Exception
 */
protected void prepareScript(final ScriptDocument scriptDoc,final Object[] args) throws Exception {
  ScriptUtils.inContext(new ScriptAction(){
    @Override public Object run(    Context cx) throws Exception {
      model.setScriptThis(ScriptRunner.this);
      if (scriptDoc.getFunction() != null) {
        Object[] jsArgs=new Object[args != null ? args.length : 0];
        for (int i=0; i < jsArgs.length; i++) {
          jsArgs[i]=ScriptUtils.javaToJS(args[i],ScriptUtils.getScope());
        }
        scriptDoc.getFunction().call(cx,getParentScope(),ScriptRunner.this,jsArgs);
      }
      model.resolveHandlers();
      return null;
    }
  }
);
}
Program: 145484
Project: 145484
Buggy source:
/** 
 * Ensures that model's data is queried and fetched from sources. (Note: in asynchronous clients data in not fetched here).
 * @throws Exception 
 */
public void execute() throws Exception {
  if (!executed) {
    executed=true;
    doExecute();
  }
}

Fixed version (ground truth):
/** 
 * Ensures that model's data is queried and fetched from sources. (Note: in asynchronous clients data in not fetched here).
 * @throws Exception
 */
public void execute() throws Exception {
  if (!executed) {
    executed=true;
    doExecute();
  }
}
Program: 145485
Project: 145485
Buggy source:
private void checkPrincipalPermission() throws AccessControlException {
  try {
    PlatypusPrincipal principal=_getPrincipal();
    if (functionAllowedRoles != null && functionAllowedRoles.get(name) != null && !functionAllowedRoles.get(name).isEmpty()) {
      if (principal != null && principal.hasAnyRole(functionAllowedRoles.get(name))) {
        return;
      }
      throw new AccessControlException(String.format("String_Node_Str",name,ScriptRunner.this.appElementId,principal != null ? principal.getName() : null));
    }
 else {
      ScriptRunner.this.checkPrincipalPermission();
    }
  }
 catch (  Exception ex) {
    if (ex instanceof AccessControlException) {
      throw (AccessControlException)ex;
    }
 else {
      throw new AccessControlException(ex.getMessage());
    }
  }
}

Fixed version (ground truth):
private void checkPrincipalPermission(Object[] args) throws AccessControlException {
  try {
    PlatypusPrincipal principal=_getPrincipal();
    if (functionAllowedRoles != null && functionAllowedRoles.get(name) != null && !functionAllowedRoles.get(name).isEmpty()) {
      Set<String> filteredRoles=filterRoles(functionAllowedRoles.get(name),args);
      if (principal != null && principal.hasAnyRole(filteredRoles)) {
        return;
      }
      throw new AccessControlException(String.format("String_Node_Str",name,ScriptRunner.this.appElementId,principal != null ? principal.getName() : null));
    }
 else {
      ScriptRunner.this.checkPrincipalPermission();
    }
  }
 catch (  Exception ex) {
    if (ex instanceof AccessControlException) {
      throw (AccessControlException)ex;
    }
 else {
      throw new AccessControlException(ex.getMessage());
    }
  }
}
Program: 145486
Project: 145486
Buggy source:
/** 
 * Imports a system library js resource (file) into global js space.
 * @param libResourceName Js resource (file) name (aka standardLib.js). See use cases for convenience.
 * @param aLibName Js virtual library name. See use cases for convenience.
 * @param currentContext
 * @param aScope
 * @return
 * @throws IOException 
 */
public static Script importScriptLibrary(String libResourceName,String aLibName,Context currentContext,Scriptable aScope) throws IOException {
  try (InputStream is=ScriptRunner.class.getResourceAsStream(libResourceName);InputStreamReader isr=new InputStreamReader(is)){
    Script compiled=currentContext.compileReader(isr,aLibName,0,null);
    compiled.exec(currentContext,aScope);
    return compiled;
  }
 }

Fixed version (ground truth):
/** 
 * Imports a system library js resource (file) into global js space.
 * @param libResourceName Js resource (file) name (aka standardLib.js). Seeuse cases for convenience.
 * @param aLibName Js virtual library name. See use cases for convenience.
 * @param currentContext
 * @param aScope
 * @return
 * @throws IOException
 */
public static Script importScriptLibrary(String libResourceName,String aLibName,Context currentContext,Scriptable aScope) throws IOException {
  try (InputStream is=ScriptRunner.class.getResourceAsStream(libResourceName);InputStreamReader isr=new InputStreamReader(is)){
    Script compiled=currentContext.compileReader(isr,aLibName,0,null);
    compiled.exec(currentContext,aScope);
    return compiled;
  }
 }
Program: 145487
Project: 145487
Buggy source:
/** 
 * Refreshs content of the script runner. Reloads it from application storage and re-executes new instance of model.
 * @see #shrink() 
 * @throws Exception
 */
public synchronized void refresh() throws Exception {
}

Fixed version (ground truth):
/** 
 * Refreshs content of the script runner. Reloads it from application storage and re-executes new instance of model.
 * @see #shrink()
 * @throws Exception
 */
public synchronized void refresh() throws Exception {
}
Program: 145488
Project: 145488
Buggy source:
/** 
 * Ensures that platypus standard script scope is constructed.
 * @param currentContext
 * @return
 * @throws Exception 
 * @see #get(java.lang.String,org.mozilla.javascript.Scriptable) 
 */
public static ScriptableObject checkStandardObjects(Context currentContext) throws Exception {
synchronized (standardObjectsScopeLock) {
    if (standardObjectsScope == null) {
      standardObjectsScope=new ScriptRunner(PlatypusScriptedResource.getClient(),ScriptUtils.getScope(),PlatypusScriptedResource.getPrincipalHost(),PlatypusScriptedResource.getScriptDocumentsHost());
    }
  }
  return standardObjectsScope;
}

Fixed version (ground truth):
/** 
 * Ensures that platypus standard script scope is constructed.
 * @param currentContext
 * @return
 * @throws Exception
 * @see #get(java.lang.String,org.mozilla.javascript.Scriptable)
 */
public static ScriptableObject checkStandardObjects(Context currentContext) throws Exception {
synchronized (standardObjectsScopeLock) {
    if (standardObjectsScope == null) {
      standardObjectsScope=new ScriptRunner(PlatypusScriptedResource.getClient(),ScriptUtils.getScope(),PlatypusScriptedResource.getPrincipalHost(),PlatypusScriptedResource.getScriptDocumentsHost());
    }
  }
  return standardObjectsScope;
}
Program: 145489
Project: 145489
Buggy source:
private void doWork() throws Exception {
  try {
    if (isDbParamsSetExplicitly()) {
      DbConnectionSettings settings=new DbConnectionSettings();
      settings.setUrl(url);
      settings.setUser(dbuser);
      settings.setPassword(dbpassword);
      GeneralResourceProvider.getInstance().registerDatasource(DEPLOY_TARGET_DATASOURCE,settings);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
switch (mode) {
case DEPLOY:
      initDeployer();
    deployer.deploy();
  break;
case UNDEPLOY:
initDeployer();
deployer.undeploy();
break;
case IMPORT:
initDeployer();
deployer.importApplication();
break;
case APPLY_MIGRATIONS:
initMigrator();
migrator.applyMigrations();
break;
case CREATE_MTD_SNAPSHOT:
initMigrator();
migrator.createDbMetadataMigration();
break;
case CREATE_SQL_BATCH:
initMigrator();
migrator.createSqlMigration();
break;
case CLEANUP:
initMigrator();
migrator.cleanup();
break;
case INITAPP:
initDeployer();
deployer.initApp();
break;
case INITUSERS:
initDeployer();
deployer.initUsersSpace();
break;
case INITVERSIONING:
initMigrator();
migrator.initVersioning();
break;
case GET_CURRENT_VERSION:
initMigrator();
printVersion();
break;
case SET_CURRENT_VERSION:
initMigrator();
setVersion();
break;
default :
printHelpMessage();
break;
}
}
 catch (Exception ex) {
System.out.println("String_Node_Str" + ex.getMessage());
}
}

Fixed version (ground truth):
private void doWork() throws Exception {
  try {
    if (isDbParamsSetExplicitly()) {
      DbConnectionSettings settings=new DbConnectionSettings();
      settings.setUrl(url);
      settings.setUser(dbuser);
      settings.setPassword(dbpassword);
      settings.setSchema(dbschema);
      GeneralResourceProvider.getInstance().registerDatasource(DEPLOY_TARGET_DATASOURCE,settings);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
switch (mode) {
case DEPLOY:
      initDeployer();
    deployer.deploy();
  break;
case UNDEPLOY:
initDeployer();
deployer.undeploy();
break;
case IMPORT:
initDeployer();
deployer.importApplication();
break;
case APPLY_MIGRATIONS:
initMigrator();
migrator.applyMigrations();
break;
case CREATE_MTD_SNAPSHOT:
initMigrator();
migrator.createDbMetadataMigration();
break;
case CREATE_SQL_BATCH:
initMigrator();
migrator.createSqlMigration();
break;
case CLEANUP:
initMigrator();
migrator.cleanup();
break;
case INITAPP:
initDeployer();
deployer.initApp();
break;
case INITUSERS:
initDeployer();
deployer.initUsersSpace();
break;
case INITVERSIONING:
initMigrator();
migrator.initVersioning();
break;
case GET_CURRENT_VERSION:
initMigrator();
printVersion();
break;
case SET_CURRENT_VERSION:
initMigrator();
setVersion();
break;
default :
printHelpMessage();
break;
}
}
 catch (Exception ex) {
System.out.println("String_Node_Str" + ex.getMessage());
}
}
Program: 145491
Project: 145491
Buggy source:
public String filterSource(String bodyPreCode,String bodyPostCode){
  String toInsert="String_Node_Str" + ScriptUtils.HANDLERS_PROP_NAME + "String_Node_Str"+ generateTopLevelNamedFunctionsContainer()+ "String_Node_Str";
  int functionsCaptureInsertAt=firstFunction.getAbsolutePosition() + firstFunction.getLength() - 1;
  if (bodyPreCode == null) {
    return scriptSource.substring(0,functionsCaptureInsertAt) + toInsert + (bodyPostCode != null ? bodyPostCode : "String_Node_Str")+ scriptSource.substring(functionsCaptureInsertAt,scriptSource.length());
  }
 else {
    AstNode body=firstFunction.getBody();
    int bodyPreCodeInsertAt=body.getAbsolutePosition() + 1;
    return scriptSource.substring(0,bodyPreCodeInsertAt) + bodyPreCode + scriptSource.substring(bodyPreCodeInsertAt,functionsCaptureInsertAt)+ toInsert+ (bodyPostCode != null ? bodyPostCode : "String_Node_Str")+ scriptSource.substring(functionsCaptureInsertAt,scriptSource.length());
  }
}

Fixed version (ground truth):
public String filterSource(String bodyPreCode,String bodyPostCode){
  String toInsert="String_Node_Str" + ScriptUtils.HANDLERS_PROP_NAME + "String_Node_Str"+ generateTopLevelNamedFunctionsContainer()+ "String_Node_Str";
  if (firstFunction == null) {
    throw new IllegalStateException("String_Node_Str" + String.valueOf(entityId) + "String_Node_Str");
  }
  int functionsCaptureInsertAt=firstFunction.getAbsolutePosition() + firstFunction.getLength() - 1;
  if (bodyPreCode == null) {
    return scriptSource.substring(0,functionsCaptureInsertAt) + toInsert + (bodyPostCode != null ? bodyPostCode : "String_Node_Str")+ scriptSource.substring(functionsCaptureInsertAt,scriptSource.length());
  }
 else {
    AstNode body=firstFunction.getBody();
    int bodyPreCodeInsertAt=body.getAbsolutePosition() + 1;
    return scriptSource.substring(0,bodyPreCodeInsertAt) + bodyPreCode + scriptSource.substring(bodyPreCodeInsertAt,functionsCaptureInsertAt)+ toInsert+ (bodyPostCode != null ? bodyPostCode : "String_Node_Str")+ scriptSource.substring(functionsCaptureInsertAt,scriptSource.length());
  }
}
Program: 145493
Project: 145493
Buggy source:
/** 
 * @param anAppCache
 * @param aDefaultDatasourceName
 * @param aAutoFillMetadata If true, metadatacache will be filled withtables, keys and other metadata in schema automatically. Otherwise it will query metadata table by table in each case. Default is true.
 * @param aScanCallback
 * @throws Exception
 */
public DatabasesClient(AppCache anAppCache,String aDefaultDatasourceName,boolean aAutoFillMetadata,ScanCallback aScanCallback) throws Exception {
  super();
  autoFillMetadata=aAutoFillMetadata;
  defaultDatasourceName=aDefaultDatasourceName;
  appCache=anAppCache;
  if (appCache != null) {
    queries=new StoredQueryFactory(this,appCache);
  }
}

Fixed version (ground truth):
/** 
 * @param anAppCache
 * @param aDefaultDatasourceName
 * @param aAutoFillMetadata If true, metadatacache will be filled withtables, keys and other metadata in schema automatically. Otherwise it will query metadata table by table in each case. Default is true.
 * @param aScanCallback
 * @throws Exception
 */
public DatabasesClient(AppCache anAppCache,String aDefaultDatasourceName,boolean aAutoFillMetadata) throws Exception {
  super();
  autoFillMetadata=aAutoFillMetadata;
  defaultDatasourceName=aDefaultDatasourceName;
  appCache=anAppCache;
  if (appCache != null) {
    queries=new StoredQueryFactory(this,appCache);
  }
}
Program: 145494
Project: 145494
Buggy source:
public static AppCache obtainTwoTierAppCache(String aApplicationUrl) throws Exception {
  AppCache appCache;
  if (aApplicationUrl.startsWith("String_Node_Str")) {
    appCache=new DatabaseAppCache(aApplicationUrl);
  }
 else {
    File f=new File(new URI(aApplicationUrl));
    if (f.exists() && f.isDirectory()) {
      FilesAppCache filesAppCache=new FilesAppCache(f.getPath());
      filesAppCache.watch();
      appCache=filesAppCache;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + aApplicationUrl + "String_Node_Str");
    }
  }
  return appCache;
}

Fixed version (ground truth):
public static AppCache obtainTwoTierAppCache(String aApplicationUrl,FilesAppCache.ScanCallback aCallBack) throws Exception {
  AppCache appCache;
  if (aApplicationUrl.startsWith("String_Node_Str")) {
    appCache=new DatabaseAppCache(aApplicationUrl);
  }
 else {
    File f=new File(new URI(aApplicationUrl));
    if (f.exists() && f.isDirectory()) {
      FilesAppCache filesAppCache=new FilesAppCache(f.getPath(),aCallBack);
      filesAppCache.watch();
      appCache=filesAppCache;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + aApplicationUrl + "String_Node_Str");
    }
  }
  return appCache;
}
Program: 145496
Project: 145496
Buggy source:
/** 
 * @inheritDoc
 */
public ScriptedDatabasesClient(AppCache anAppCache,String aDefaultDatasourceName,boolean aAutoFillMetadata,FilesAppCache.ScanCallback aScanCallback) throws Exception {
  super(anAppCache,aDefaultDatasourceName,aAutoFillMetadata,aScanCallback);
}

Fixed version (ground truth):
/** 
 * @inheritDoc
 */
public ScriptedDatabasesClient(AppCache anAppCache,String aDefaultDatasourceName,boolean aAutoFillMetadata) throws Exception {
  super(anAppCache,aDefaultDatasourceName,aAutoFillMetadata);
}
Program: 145497
Project: 145497
Buggy source:
/** 
 * @param args the command line arguments
 * @throws IOException
 * @throws Exception
 */
public static void main(String[] args) throws IOException, Exception {
  checkUserHome();
  Set<String> tasks=new HashSet<>();
  parseArgs(args,tasks);
  if (url == null || url.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  SSLContext ctx=createSSLContext();
  AppCache appCache=ClientFactory.obtainTwoTierAppCache(url);
  ScriptedDatabasesClient appDbClient=new ScriptedDatabasesClient(appCache,defDatasource,true,new ServerTasksScanner(tasks));
  if (System.getProperty(ScriptRunner.DEBUG_PROPERTY) != null) {
    Debugger debugger=Debugger.initialize(false);
    registerMBean(DebuggerMBean.DEBUGGER_MBEAN_NAME,debugger);
    registerMBean(Breakpoints.BREAKPOINTS_MBEAN_NAME,Breakpoints.getInstance());
  }
  PlatypusServer server=new PlatypusServer(appDbClient,ctx,getListenAddresses(),getPortsProtocols(),getPortsSessionIdleTimeouts(),getPortsSessionIdleCheckIntervals(),getPortsNumWorkerThreads(),tasks,appElement);
  server.setAnonymousEnabled(anonymousEnabled);
  appDbClient.setContextHost(server);
  appDbClient.setPrincipalHost(server);
  PlatypusScriptedResource.init(appDbClient,server,server);
  ScriptUtils.getScope().defineProperty(ServerScriptRunner.MODULES_SCRIPT_NAME,server.getScriptsCache(),ScriptableObject.READONLY);
  server.start();
}

Fixed version (ground truth):
/** 
 * @param args the command line arguments
 * @throws IOException
 * @throws Exception
 */
public static void main(String[] args) throws IOException, Exception {
  checkUserHome();
  Set<String> tasks=new HashSet<>();
  parseArgs(args,tasks);
  if (url == null || url.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  SSLContext ctx=createSSLContext();
  AppCache appCache=ClientFactory.obtainTwoTierAppCache(url,new ServerTasksScanner(tasks));
  ScriptedDatabasesClient appDbClient=new ScriptedDatabasesClient(appCache,defDatasource,true);
  if (System.getProperty(ScriptRunner.DEBUG_PROPERTY) != null) {
    Debugger debugger=Debugger.initialize(false);
    registerMBean(DebuggerMBean.DEBUGGER_MBEAN_NAME,debugger);
    registerMBean(Breakpoints.BREAKPOINTS_MBEAN_NAME,Breakpoints.getInstance());
  }
  PlatypusServer server=new PlatypusServer(appDbClient,ctx,getListenAddresses(),getPortsProtocols(),getPortsSessionIdleTimeouts(),getPortsSessionIdleCheckIntervals(),getPortsNumWorkerThreads(),tasks,appElement);
  server.setAnonymousEnabled(anonymousEnabled);
  appDbClient.setContextHost(server);
  appDbClient.setPrincipalHost(server);
  PlatypusScriptedResource.init(appDbClient,server,server);
  ScriptUtils.getScope().defineProperty(ServerScriptRunner.MODULES_SCRIPT_NAME,server.getScriptsCache(),ScriptableObject.READONLY);
  server.start();
}
Program: 145498
Project: 145498
Buggy source:
@Override public synchronized String format(LogRecord event){
  if (event.getLoggerName().toLowerCase().contains("String_Node_Str".toLowerCase())) {
    StringBuilder message=new StringBuilder();
    Date date=new Date(event.getMillis());
    message.append(dateFormat.format(date)).append("String_Node_Str");
    message.append(event.getLevel().getName()).append("String_Node_Str");
    if (event.getMessage() != null)     message.append(event.getMessage()).append("String_Node_Str").append("String_Node_Str");
    if (event.getThrown() != null && showStackTraces) {
      message.append(getStackTraceAsString(event.getThrown(),"String_Node_Str","String_Node_Str"));
    }
    return message.toString();
  }
 else {
    return super.format(event);
  }
}

Fixed version (ground truth):
@Override public synchronized String format(LogRecord event){
  StringBuilder message=new StringBuilder();
  Date date=new Date(event.getMillis());
  message.append(dateFormat.format(date)).append("String_Node_Str");
  message.append(event.getLevel().getName()).append("String_Node_Str");
  if (event.getMessage() != null)   message.append(event.getMessage()).append("String_Node_Str").append("String_Node_Str");
  if (event.getThrown() != null && showStackTraces) {
    message.append(getStackTraceAsString(event.getThrown(),"String_Node_Str","String_Node_Str"));
  }
  return message.toString();
}
Program: 145499
Project: 145499
Buggy source:
public static void require(JavaScriptObject aDeps,final JavaScriptObject aOnSuccess,final JavaScriptObject aOnFailure){
}

Fixed version (ground truth):
public static void require(final JavaScriptObject aDeps,final JavaScriptObject aOnSuccess,final JavaScriptObject aOnFailure){
}
Program: 145500
Project: 145500
Buggy source:
public void resolveField() throws Exception {
  if (entity != null) {
    if (entity instanceof ParametersEntity) {
      if (isField) {
        field=entity.getFields().get(fieldName);
      }
    }
 else     if (entity.getQuery() != null) {
      if (isField) {
        field=entity.getFields().get(fieldName);
      }
 else {
        field=entity.getQuery().getParameters().get(fieldName);
      }
    }
  }
}

Fixed version (ground truth):
public void resolveField() throws Exception {
  if (entity != null) {
    if (entity instanceof ParametersEntity) {
      if (isField) {
        field=entity.getFields().get(fieldName);
      }
    }
 else     if (entity.getQuery() != null) {
      if (isField) {
        field=entity.getFields().get(fieldName);
      }
 else {
        field=entity.getQuery().getParameters().get(fieldName);
      }
    }
  }
 else {
    Logger.getLogger(ModelElementRef.class.getName()).log(Level.SEVERE,"String_Node_Str" + entityId + "String_Node_Str"+ (isField ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ fieldName);
  }
}
Program: 145501
Project: 145501
Buggy source:
public ModelElementRef(Model aModel,String aEntityId,String aFieldName,boolean aIsField) throws Exception {
  super();
  model=aModel;
  entity=aModel.getEntityById(aEntityId);
  fieldName=aFieldName;
  isField=aIsField;
  tryResolveField();
}

Fixed version (ground truth):
public ModelElementRef(Model aModel,String aEntityId,String aFieldName,boolean aIsField) throws Exception {
  super();
  model=aModel;
  entityId=aEntityId;
  entity=aModel.getEntityById(entityId);
  fieldName=aFieldName;
  isField=aIsField;
  tryResolveField();
}
Program: 145502
Project: 145502
Buggy source:
public Point getGeoPosition() throws Exception {
  if (pane != null) {
    java.awt.Point.Double position=pane.getGeoPosition();
    return GisUtilities.createPoint(position.x,position.y);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Point getGeoPosition() throws Exception {
  if (pane != null) {
    java.awt.Point.Double position=pane.getGeoPosition();
    return GeometryUtils.createPoint(position.x,position.y);
  }
 else {
    return null;
  }
}
Program: 145503
Project: 145503
Buggy source:
public Point geo2Cartesian(Point aPt) throws FactoryException, TransformException {
  Point2D.Double res=pane.geo2Cartesian(new Point2D.Double(aPt.getX(),aPt.getY()));
  return GisUtilities.createPoint(res);
}

Fixed version (ground truth):
public Point geo2Cartesian(Point aPt) throws FactoryException, TransformException {
  Point2D.Double res=pane.geo2Cartesian(new Point2D.Double(aPt.getX(),aPt.getY()));
  return GeometryUtils.createPoint(res);
}
Program: 145504
Project: 145504
Buggy source:
public Point screen2Cartesian(Point aPt) throws NoninvertibleTransformException {
  Point2D.Double res=pane.screen2Cartesian(new java.awt.Point((int)Math.round(aPt.getX()),(int)Math.round(aPt.getY())));
  return GisUtilities.createPoint(res);
}

Fixed version (ground truth):
public Point screen2Cartesian(Point aPt) throws NoninvertibleTransformException {
  Point2D.Double res=pane.screen2Cartesian(new java.awt.Point((int)Math.round(aPt.getX()),(int)Math.round(aPt.getY())));
  return GeometryUtils.createPoint(res);
}
Program: 145505
Project: 145505
Buggy source:
public List<SelectionEntry> nonSelectableHit(Point aHitPoint) throws Exception {
  double bufferZoneWidth=calculateCurrentHitBuffer();
  Polygon hitPoly=GisUtilities.constructRectyPolygon(new Point2D.Double(aHitPoint.getX() - bufferZoneWidth,aHitPoint.getY() - bufferZoneWidth),new Point2D.Double(aHitPoint.getX() + bufferZoneWidth,aHitPoint.getY() + bufferZoneWidth));
  return hit(hitPoly,false);
}

Fixed version (ground truth):
public List<SelectionEntry> nonSelectableHit(Point aHitPoint) throws Exception {
  double bufferZoneWidth=calculateCurrentHitBuffer();
  Polygon hitPoly=GeometryUtils.constructRectyPolygon(new Point2D.Double(aHitPoint.getX() - bufferZoneWidth,aHitPoint.getY() - bufferZoneWidth),new Point2D.Double(aHitPoint.getX() + bufferZoneWidth,aHitPoint.getY() + bufferZoneWidth));
  return hit(hitPoly,false);
}
Program: 145506
Project: 145506
Buggy source:
/** 
 * Tests whether a point is on one of the selected geometries, rather than points
 * @param aPoint2HitWith Point to test selected geometries against. Thepoint must be in geo coordiantes.
 * @return True if hitted, false otherwise
 * @throws Exception
 */
public boolean selectedGeometryHitted(Point aPoint2HitWith) throws Exception {
  if (!getSelection().isEmpty()) {
    double bufferZoneWidth=calculateCurrentHitBuffer();
    Polygon hitPoly=GisUtilities.constructRectyPolygon(new Point2D.Double(aPoint2HitWith.getX() - bufferZoneWidth,aPoint2HitWith.getY() - bufferZoneWidth),new Point2D.Double(aPoint2HitWith.getX() + bufferZoneWidth,aPoint2HitWith.getY() + bufferZoneWidth));
    Set<Geometry> selectedGeometries=GisUtilities.convertSelectionEntries2Geometries(getSelection().getSelection());
    for (    Geometry geom : selectedGeometries) {
      if (geom.intersects(hitPoly)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Tests whether a point is on one of the selected geometries, rather than points
 * @param aPoint2HitWith Point to test selected geometries against. Thepoint must be in geo coordiantes.
 * @return True if hitted, false otherwise
 * @throws Exception
 */
public boolean selectedGeometryHitted(Point aPoint2HitWith) throws Exception {
  if (!getSelection().isEmpty()) {
    double bufferZoneWidth=calculateCurrentHitBuffer();
    Polygon hitPoly=GeometryUtils.constructRectyPolygon(new Point2D.Double(aPoint2HitWith.getX() - bufferZoneWidth,aPoint2HitWith.getY() - bufferZoneWidth),new Point2D.Double(aPoint2HitWith.getX() + bufferZoneWidth,aPoint2HitWith.getY() + bufferZoneWidth));
    Set<Geometry> selectedGeometries=GisUtilities.convertSelectionEntries2Geometries(getSelection().getSelection());
    for (    Geometry geom : selectedGeometries) {
      if (geom.intersects(hitPoly)) {
        return true;
      }
    }
  }
  return false;
}
Program: 145507
Project: 145507
Buggy source:
public Point cartesian2Geo(Point aPt) throws FactoryException, TransformException {
  Point2D.Double res=pane.cartesian2Geo(new Point2D.Double(aPt.getX(),aPt.getY()));
  return GisUtilities.createPoint(res);
}

Fixed version (ground truth):
public Point cartesian2Geo(Point aPt) throws FactoryException, TransformException {
  Point2D.Double res=pane.cartesian2Geo(new Point2D.Double(aPt.getX(),aPt.getY()));
  return GeometryUtils.createPoint(res);
}
Program: 145508
Project: 145508
Buggy source:
public Point cartesian2Screen(Point aPt) throws FactoryException, TransformException {
  java.awt.Point res=pane.cartesian2Screen(new Point2D.Double(aPt.getX(),aPt.getY()));
  return GisUtilities.createPoint(res.x,res.y);
}

Fixed version (ground truth):
public Point cartesian2Screen(Point aPt) throws FactoryException, TransformException {
  java.awt.Point res=pane.cartesian2Screen(new Point2D.Double(aPt.getX(),aPt.getY()));
  return GeometryUtils.createPoint(res.x,res.y);
}
Program: 145509
Project: 145509
Buggy source:
private Polygon[] processHoles(Map<Integer,List<Integer>> aHoles,Polygon[] aResultHoles){
  List<Polygon> holes=new ArrayList<>(Arrays.asList(aResultHoles));
  for (  Integer key : aHoles.keySet()) {
    List<Integer> deleteCoordinates=aHoles.get(key);
    Collections.sort(deleteCoordinates,new DescComparator());
    Coordinate[] coordinate=GisUtilities.deletePointsFromCoordinates(aResultHoles[key],deleteCoordinates);
    if (coordinate != null && GisUtilities.isValidGeometryDataSection(coordinate,Polygon.class)) {
      holes.set(key,(Polygon)GisUtilities.constructGeometry(coordinate,Polygon.class));
    }
 else {
      holes.remove(key.intValue());
    }
  }
  Polygon[] res=new Polygon[0];
  return holes.toArray(res);
}

Fixed version (ground truth):
private Polygon[] processHoles(Map<Integer,List<Integer>> aHoles,Polygon[] aResultHoles){
  List<Polygon> holes=new ArrayList<>(Arrays.asList(aResultHoles));
  for (  Integer key : aHoles.keySet()) {
    List<Integer> deleteCoordinates=aHoles.get(key);
    Collections.sort(deleteCoordinates,new DescComparator());
    Coordinate[] coordinate=GeometryUtils.deletePointsFromCoordinates(aResultHoles[key],deleteCoordinates);
    if (coordinate != null && GeometryUtils.isValidGeometryDataSection(coordinate,Polygon.class)) {
      holes.set(key,(Polygon)GeometryUtils.constructGeometry(coordinate,Polygon.class));
    }
 else {
      holes.remove(key.intValue());
    }
  }
  Polygon[] res=new Polygon[0];
  return holes.toArray(res);
}