nus-yam/ex-repair huggingface dataset:
Program: 133735
Project: 133735
Buggy source:
/** 
 * <!-- begin-UML-doc --> <p> This operation creates a drop-down menu on the Composite. </p> <!-- end-UML-doc -->
 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
 */
private void createDropdown(){
  dropDown=new Combo(this,SWT.DROP_DOWN | SWT.SINGLE | SWT.V_SCROLL| SWT.H_SCROLL| SWT.READ_ONLY);
  dropDown.setBackground(getBackground());
  for (  String i : entry.getAllowedValues()) {
    dropDown.add(i);
  }
  dropDown.select(dropDown.indexOf(entry.getValue()));
  dropDown.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      notifyListeners(SWT.Selection,new Event());
      setEntryValue(dropDown.getItem(dropDown.getSelectionIndex()));
    }
  }
);
  return;
}

Fixed version (ground truth):
/** 
 * <!-- begin-UML-doc --> <p> This operation creates a drop-down menu on the Composite. </p> <!-- end-UML-doc -->
 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
 */
private void createDropdown(){
  dropDown=new Combo(this,SWT.DROP_DOWN | SWT.SINGLE | SWT.V_SCROLL| SWT.H_SCROLL| SWT.READ_ONLY);
  dropDown.setBackground(getBackground());
  String currentValue=entry.getValue();
  List<String> allowedValues=entry.getAllowedValues();
  for (int i=0; i < allowedValues.size(); i++) {
    String allowedValue=allowedValues.get(i);
    dropDown.add(allowedValue);
    if (allowedValue.equals(currentValue)) {
      dropDown.select(i);
    }
  }
  dropDown.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      notifyListeners(SWT.Selection,new Event());
      setEntryValue(dropDown.getItem(dropDown.getSelectionIndex()));
    }
  }
);
  return;
}
Program: 133737
Project: 133737
Buggy source:
/** 
 * Sets the orientation of the camera at once, as opposed to incremental orientation.
 * @param direction The new direction in which the camera will point. If null, an exception is thrown.
 * @param up The new up direction. If null or if it is not orthogonal to the camera direction, an exception is thrown.
 * @see #rollCamera(float)
 * @see #pitchCamera(float)
 * @see #yawCamera(float)
 */
public void setOrientation(Vector3f direction,Vector3f up){
  if (direction == null || up == null) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
 else   if (FastMath.abs(direction.dot(up)) > 1e-5f || direction.equals(up)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  this.up.set(up).cross(this.dir.set(direction),this.left);
  camera.setAxes(this.left,this.up,this.dir);
  return;
}

Fixed version (ground truth):
/** 
 * Sets the orientation of the camera at once, as opposed to incremental orientation.
 * @param direction The new direction in which the camera will point. If null, an exception is thrown.
 * @param up The new up direction. If null or if it is not orthogonal to the camera direction, an exception is thrown.
 * @see #rollCamera(float)
 * @see #pitchCamera(float)
 * @see #yawCamera(float)
 */
public void setOrientation(Vector3f direction,Vector3f up){
  if (direction == null || up == null) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
 else   if (FastMath.abs(direction.dot(up)) > 1e-5f || direction.equals(up)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  this.up.set(up).cross(this.dir.set(direction),this.left);
  dragUp.set(up);
  camera.setAxes(this.left,this.up,this.dir);
  return;
}
Program: 133738
Project: 133738
Buggy source:
/** 
 * Rotates the camera based on the provided angle and axis.   {@link #up},  {@link #left}, and   {@link #dir} are all updated in this method.
 * @param radians The angle to rotate.
 * @param axis The axis to rotate around.
 */
private void rotateCamera(float radians,Vector3f axis){
  Matrix3f matrix=new Matrix3f();
  matrix.fromAngleNormalAxis(radians,axis);
  matrix.mult(up,up);
  matrix.mult(left,left);
  matrix.mult(dir,dir);
  up.normalizeLocal();
  left.normalizeLocal();
  dir.normalizeLocal();
  camera.setAxes(left,up,dir);
}

Fixed version (ground truth):
/** 
 * Rotates the camera based on the provided angle and axis.   {@link #up},  {@link #left}, and   {@link #dir} are all updated in this method.
 * @param radians The angle to rotate.
 * @param axis The axis to rotate around.
 */
private void rotateCamera(float radians,Vector3f axis){
  Matrix3f matrix=new Matrix3f();
  matrix.fromAngleNormalAxis(radians,axis);
  matrix.multLocal(up).normalizeLocal();
  matrix.multLocal(left).normalizeLocal();
  matrix.multLocal(dir).normalizeLocal();
  camera.setAxes(left,up,dir);
}
Program: 133740
Project: 133740
Buggy source:
/** 
 * <!-- begin-UML-doc --> <p> Return a list of IPS files in the Caebat_Model folder of the project space or null if the folder doesn't exist </p> <!-- end-UML-doc -->
 * @return the list of input files
 */
private ArrayList<String> getProjectFiles(IFolder caebatFolder){
  ArrayList<String> files=null;
  if (project != null) {
    try {
      if (caebatFolder.exists()) {
        files=new ArrayList<String>();
        IResource[] resources=caebatFolder.members();
        for (        IResource resource : resources) {
          if (debuggingEnabled) {
            System.out.println("String_Node_Str" + "String_Node_Str" + resource.getLocationURI() + "String_Node_Str");
          }
          if (resource.getType() == IResource.FILE && resource.getProjectRelativePath().lastSegment().contains("String_Node_Str")) {
            files.add(resource.getName());
          }
        }
      }
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
  }
  return files;
}

Fixed version (ground truth):
/** 
 * <!-- begin-UML-doc --> <p> Return a list of IPS files in the Caebat_Model folder of the project space or null if the folder doesn't exist </p> <!-- end-UML-doc -->
 * @return the list of input files
 */
private ArrayList<String> getProjectFiles(IFolder caebatFolder){
  ArrayList<String> files=null;
  if (project != null) {
    try {
      project.refreshLocal(IResource.DEPTH_INFINITE,null);
      if (caebatFolder.exists()) {
        files=new ArrayList<String>();
        IResource[] resources=caebatFolder.members();
        for (        IResource resource : resources) {
          if (debuggingEnabled) {
            System.out.println("String_Node_Str" + "String_Node_Str" + resource.getLocationURI() + "String_Node_Str");
          }
          if (resource.getType() == IResource.FILE && resource.getProjectRelativePath().lastSegment().contains("String_Node_Str")) {
            files.add(resource.getName());
          }
        }
      }
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
  }
  return files;
}
Program: 133741
Project: 133741
Buggy source:
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  IWorkbenchWindow window=HandlerUtil.getActiveWorkbenchWindow(event);
  Shell shell=window.getShell();
  MOOSELauncher launcher=new MOOSELauncher(ResourcesPlugin.getWorkspace().getRoot().getProject("String_Node_Str"));
  System.out.println(((DataComponent)launcher.getForm().getComponent(5)).retrieveEntry("String_Node_Str").getValue());
  GenerateYAMLWizard wizard=new GenerateYAMLWizard();
  WizardDialog dialog=new WizardDialog(shell,wizard);
  dialog.open();
  ((DataComponent)launcher.getForm().getComponent(5)).retrieveEntry("String_Node_Str").setValue("String_Node_Str");
  ((TableComponent)launcher.getForm().getComponent(4)).getRow(0).get(0).setValue("String_Node_Str");
  ((TableComponent)launcher.getForm().getComponent(4)).getRow(0).get(2).setValue("String_Node_Str");
  launcher.submitForm(launcher.getForm());
  FormStatus status=launcher.process("String_Node_Str");
  if (status.equals(FormStatus.NeedsInfo)) {
    Form actionForm=launcher.getForm();
    launcher.submitForm(actionForm);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  Shell shell=HandlerUtil.getActiveWorkbenchWindow(event).getShell();
  wizard=new GenerateYAMLWizard();
  WizardDialog dialog=new WizardDialog(shell,wizard);
  launcher=new MOOSELauncher(ResourcesPlugin.getWorkspace().getRoot().getProject("String_Node_Str"));
  if (dialog.open() != 0) {
    return null;
  }
  ((DataComponent)launcher.getForm().getComponent(5)).retrieveEntry("String_Node_Str").setValue("String_Node_Str");
  ((TableComponent)launcher.getForm().getComponent(4)).getRow(0).get(0).setValue(wizard.getHostName());
  ((TableComponent)launcher.getForm().getComponent(4)).getRow(0).get(2).setValue(wizard.getExecPath());
  launcher.submitForm(launcher.getForm());
  Thread thread=new Thread(this);
  thread.start();
  return null;
}
Program: 133742
Project: 133742
Buggy source:
@Override public boolean performFinish(){
  host_name_password=new ArrayList<String>();
  host_name_password.add(page.getHostName());
  host_name_password.add(page.getUsername());
  host_name_password.add(page.getPassword());
  return true;
}

Fixed version (ground truth):
/** 
 */
@Override public boolean performFinish(){
  launchData=new ArrayList<String>();
  launchData.add(page.getHostName());
  launchData.add(page.getExecPath());
  launchData.add(page.getUsername());
  launchData.add(page.getPassword());
  return true;
}
Program: 133743
Project: 133743
Buggy source:
/** 
 * <!-- begin-UML-doc --> <p> This operation launches the job on the local machine. </p> <!-- end-UML-doc -->
 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
 */
protected void launchLocally(){
  FormStatus launchStatus;
  for (int i=0; i < splitCMD.size(); i++) {
    if (cancelled.get()) {
      break;
    }
    launchStatus=launchStageLocally(splitCMD.get(i),stdOut,stdErr);
    monitorJob();
    if (launchStatus.equals(FormStatus.InfoError)) {
      status=FormStatus.InfoError;
      return;
    }
  }
  status=FormStatus.Processed;
  return;
}

Fixed version (ground truth):
/** 
 * <!-- begin-UML-doc --> <p> This operation launches the job on the local machine. </p> <!-- end-UML-doc -->
 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
 */
protected void launchLocally(){
  FormStatus launchStatus;
  String separator=System.getProperty("String_Node_Str");
  String userHome=System.getProperty("String_Node_Str");
  String localProjectDir=userHome + separator + "String_Node_Str"+ separator+ "String_Node_Str";
  File workingDirectory=new File(execDictionary.get("String_Node_Str"));
  for (int i=0; i < splitCMD.size(); i++) {
    if (cancelled.get()) {
      break;
    }
    launchStatus=launchStageLocally(splitCMD.get(i),stdOut,stdErr);
    monitorJob();
    if (launchStatus.equals(FormStatus.InfoError)) {
      status=FormStatus.InfoError;
      return;
    }
  }
  for (  File file : workingDirectory.listFiles()) {
    if (!fileMap.keySet().contains(file.getName())) {
      try {
        Files.copy(Paths.get(file.getAbsolutePath()),Paths.get(localProjectDir + separator + file.getName()));
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  status=FormStatus.Processed;
  return;
}
Program: 133748
Project: 133748
Buggy source:
/** 
 * This operation creates a standard header that contains information about the job being launched. It is used primarily by the run() operation.
 * @param logName The name that should be used to identify the log in its header.
 * @return The header.
 */
private String createOutputHeader(String logName){
  String header=null, localHostname=null;
  try {
    InetAddress addr=InetAddress.getLocalHost();
    localHostname=addr.getHostName();
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
  }
  header="String_Node_Str";
  header+=new SimpleDateFormat("String_Node_Str").format(Calendar.getInstance().getTime()) + "String_Node_Str";
  header+="String_Node_Str" + localHostname + "String_Node_Str";
  header+="String_Node_Str" + execDictionary.get("String_Node_Str") + "String_Node_Str";
  header+="String_Node_Str" + fullCMD + "String_Node_Str";
  if (uploadInput) {
    header+="String_Node_Str" + execDictionary.get("String_Node_Str") + "String_Node_Str";
  }
  header+="String_Node_Str" + execDictionary.get("String_Node_Str") + "String_Node_Str";
  header+="String_Node_Str";
  return header;
}

Fixed version (ground truth):
/** 
 * This operation creates a standard header that contains information about the job being launched. It is used primarily by the run() operation.
 * @param logName The name that should be used to identify the log in its header.
 * @return The header.
 */
private String createOutputHeader(String logName){
  String header=null, localHostname=null;
  try {
    InetAddress addr=InetAddress.getLocalHost();
    localHostname=addr.getHostName();
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
  }
  header="String_Node_Str";
  header+=new SimpleDateFormat("String_Node_Str").format(Calendar.getInstance().getTime()) + "String_Node_Str";
  header+="String_Node_Str" + localHostname + "String_Node_Str";
  header+="String_Node_Str" + execDictionary.get("String_Node_Str") + "String_Node_Str";
  header+="String_Node_Str" + fullCMD.replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  if (uploadInput) {
    header+="String_Node_Str" + execDictionary.get("String_Node_Str") + "String_Node_Str";
  }
  header+="String_Node_Str" + execDictionary.get("String_Node_Str") + "String_Node_Str";
  header+="String_Node_Str";
  return header;
}
Program: 133750
Project: 133750
Buggy source:
/** 
 * Overriding setupForm to set the executable names and host information.
 */
@Override protected void setupForm(){
  String localInstallDir="String_Node_Str";
  String remoteInstallDir="String_Node_Str";
  ArrayList<String> executables=new ArrayList<String>();
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add(yamlSyntaxGenerator);
  addExecutables(executables);
  super.setupForm();
  DataComponent inputFilesComp=(DataComponent)form.getComponent(1);
  inputFilesComp.deleteEntry("String_Node_Str");
  addInputType("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  addHost("String_Node_Str","String_Node_Str",localInstallDir);
  addHost("String_Node_Str","String_Node_Str",remoteInstallDir);
  enableMPI(1,10000,1);
  enableTBB(1,256,1);
  return;
}

Fixed version (ground truth):
/** 
 * Overriding setupForm to set the executable names and host information.
 */
@Override protected void setupForm(){
  String userHome=System.getProperty("String_Node_Str");
  String separator=System.getProperty("String_Node_Str");
  String localInstallDir=userHome + separator + "String_Node_Str";
  String remoteInstallDir="String_Node_Str";
  ArrayList<String> executables=new ArrayList<String>();
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add("String_Node_Str");
  executables.add(yamlSyntaxGenerator);
  addExecutables(executables);
  super.setupForm();
  DataComponent inputFilesComp=(DataComponent)form.getComponent(1);
  inputFilesComp.deleteEntry("String_Node_Str");
  addInputType("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  addHost("String_Node_Str","String_Node_Str",localInstallDir);
  addHost("String_Node_Str","String_Node_Str",remoteInstallDir);
  enableMPI(1,10000,1);
  enableTBB(1,256,1);
  return;
}
Program: 133752
Project: 133752
Buggy source:
@Override public String getSql(){
  return sql;
}

Fixed version (ground truth):
@Override public String getSql(){
  return sql + "String_Node_Str" + getFilterCriteria(sql);
}
Program: 133753
Project: 133753
Buggy source:
@Override public String prepareSql(Integer first,Integer count,String sortBy,boolean isAscending){
  String sql=getSql();
  StringBuilder sb=new StringBuilder(sql.length() * 2);
  boolean wrapForSkip=containExpand && first != null;
  if (wrapForSkip)   sb.append("String_Node_Str");
  sb.append(sql);
  if (!managers.isEmpty()) {
    String filter=applyFilters();
    if (!Strings.isNullOrEmpty(filter)) {
      boolean containsWhere=sql.toUpperCase().contains("String_Node_Str");
      if (containsWhere)       sb.append("String_Node_Str");
 else       sb.append("String_Node_Str");
      sb.append(filter);
      if (containsWhere)       sb.append("String_Node_Str");
    }
  }
  if (sortBy != null)   sb.append("String_Node_Str" + sortBy + (isAscending ? "String_Node_Str" : "String_Node_Str"));
  if (wrapForSkip)   sb.append("String_Node_Str");
  if (first != null)   sb.append("String_Node_Str" + first);
  if (count != null && count > 0)   sb.append("String_Node_Str" + count);
  return sb.toString();
}

Fixed version (ground truth):
@Override public String prepareSql(Integer first,Integer count,String sortBy,boolean isAscending){
  String sql=getSql();
  StringBuilder sb=new StringBuilder(sql.length() * 2);
  boolean wrapForSkip=containExpand && first != null;
  if (wrapForSkip)   sb.append("String_Node_Str");
  sb.append(sql);
  sb.append(getFilterCriteria(sql));
  if (sortBy != null)   sb.append("String_Node_Str" + sortBy + (isAscending ? "String_Node_Str" : "String_Node_Str"));
  if (wrapForSkip)   sb.append("String_Node_Str");
  if (first != null)   sb.append("String_Node_Str" + first);
  if (count != null && count > 0)   sb.append("String_Node_Str" + count);
  return sb.toString();
}
Program: 133754
Project: 133754
Buggy source:
@Override public String getCountSql(){
  return countSql;
}

Fixed version (ground truth):
@Override public String getCountSql(){
  return countSql + "String_Node_Str" + getFilterCriteria(countSql);
}
Program: 133755
Project: 133755
Buggy source:
@Override public IRequestHandler onException(RequestCycle cycle,Exception ex){
  Throwable th=null;
  if ((th=Exceptions.findCause(ex,OSecurityException.class)) != null || (th=Exceptions.findCause(ex,OValidationException.class)) != null || (th=Exceptions.findCause(ex,OSchemaException.class)) != null || (th=Exceptions.findCause(ex,IllegalStateException.class)) != null && Exceptions.findCause(ex,WicketRuntimeException.class) == null) {
    Page page=extractCurrentPage();
    if (page == null)     return null;
    OrientDbWebSession.get().error(th.getMessage());
    return new RenderPageRequestHandler(new PageProvider(page),RenderPageRequestHandler.RedirectPolicy.ALWAYS_REDIRECT);
  }
 else   if ((th=Exceptions.findCause(ex,UnauthorizedActionException.class)) != null) {
    final UnauthorizedActionException unauthorizedActionException=(UnauthorizedActionException)th;
    return new IRequestHandler(){
      @Override public void respond(      IRequestCycle requestCycle){
        OrientDbWebApplication.get().onUnauthorizedInstantiation(unauthorizedActionException.getComponent());
      }
      @Override public void detach(      IRequestCycle requestCycle){
      }
    }
;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public IRequestHandler onException(RequestCycle cycle,Exception ex){
  Throwable th=null;
  if ((th=Exceptions.findCause(ex,OSecurityException.class)) != null || (th=Exceptions.findCause(ex,OValidationException.class)) != null || (th=Exceptions.findCause(ex,OSchemaException.class)) != null || (th=Exceptions.findCause(ex,IllegalStateException.class)) != null && Exceptions.findCause(ex,WicketRuntimeException.class) == null) {
    Page page=extractCurrentPage(false);
    if (page == null) {
      return th instanceof OSecurityException ? new UnauthorizedInstantiationHandler(extractCurrentPage(true)) : null;
    }
    OrientDbWebSession.get().error(th.getMessage());
    return new RenderPageRequestHandler(new PageProvider(page),RenderPageRequestHandler.RedirectPolicy.ALWAYS_REDIRECT);
  }
 else   if ((th=Exceptions.findCause(ex,UnauthorizedActionException.class)) != null) {
    final UnauthorizedActionException unauthorizedActionException=(UnauthorizedActionException)th;
    return new UnauthorizedInstantiationHandler(unauthorizedActionException.getComponent());
  }
 else {
    return null;
  }
}
Program: 133756
Project: 133756
Buggy source:
private Page extractCurrentPage(){
  final RequestCycle requestCycle=RequestCycle.get();
  IRequestHandler handler=requestCycle.getActiveRequestHandler();
  if (handler == null) {
    handler=requestCycle.getRequestHandlerScheduledAfterCurrent();
  }
  if (handler instanceof IPageRequestHandler) {
    IPageRequestHandler pageRequestHandler=(IPageRequestHandler)handler;
    return (Page)pageRequestHandler.getPage();
  }
  return null;
}

Fixed version (ground truth):
private Page extractCurrentPage(boolean fullSearch){
  final RequestCycle requestCycle=RequestCycle.get();
  IRequestHandler handler=requestCycle.getActiveRequestHandler();
  if (handler == null) {
    handler=requestCycle.getRequestHandlerScheduledAfterCurrent();
    if (handler == null && fullSearch) {
      handler=OrientDbWebApplication.get().getRootRequestMapper().mapRequest(requestCycle.getRequest());
    }
  }
  if (handler instanceof IPageRequestHandler) {
    IPageRequestHandler pageRequestHandler=(IPageRequestHandler)handler;
    return (Page)pageRequestHandler.getPage();
  }
  return null;
}
Program: 133757
Project: 133757
Buggy source:
@Override public void respond(IRequestCycle requestCycle){
  OrientDbWebApplication.get().onUnauthorizedInstantiation(unauthorizedActionException.getComponent());
}

Fixed version (ground truth):
@Override public void respond(IRequestCycle requestCycle){
  OrientDbWebApplication.get().onUnauthorizedInstantiation(component);
}
Program: 133758
Project: 133758
Buggy source:
/** 
 * Tranform name to   {@link ORule.ResourceGeneric}
 * @param name name to transform
 * @return {@link ORule.ResourceGeneric} or null
 */
public static ORule.ResourceGeneric getResourceGeneric(String name){
  ORule.ResourceGeneric value=ORule.ResourceGeneric.valueOf(name);
  if (value == null)   value=ORule.mapLegacyResourceToGenericResource(name);
  return value;
}

Fixed version (ground truth):
/** 
 * Transform name to   {@link ORule.ResourceGeneric}
 * @param name name to transform
 * @return {@link ORule.ResourceGeneric} or null
 */
public static ORule.ResourceGeneric getResourceGeneric(String name){
  String shortName=Strings.beforeFirst(name,'.');
  if (Strings.isEmpty(shortName))   shortName=name;
  ORule.ResourceGeneric value=ORule.ResourceGeneric.valueOf(shortName);
  if (value == null)   value=ORule.mapLegacyResourceToGenericResource(name);
  return value;
}
Program: 133759
Project: 133759
Buggy source:
/** 
 * Check that current user has access to mentioned resource
 * @param resource resource check
 * @param action {@link Action} to check for
 * @param permissions {@link OrientPermission}s to check
 * @return true if access is allowed
 */
public boolean checkResource(String resource,Action action,OrientPermission[] permissions){
  String actionName=action.getName();
  if (resource.indexOf(':') > 0) {
    if (!(resource.endsWith(actionName) && resource.length() > actionName.length() && resource.charAt(resource.length() - actionName.length() - 1) == ':'))     return true;
  }
 else   if (!Component.RENDER.equals(action))   return true;
  OUser user=OrientDbWebSession.get().getUser();
  if (user == null)   return false;
  ORule.ResourceGeneric generic=OSecurityHelper.getResourceGeneric(resource);
  if (generic == null)   generic=ORule.mapLegacyResourceToGenericResource(resource);
  String specific=ORule.mapLegacyResourceToSpecificResource(resource);
  return user != null ? user.checkIfAllowed(generic,specific,OrientPermission.combinedPermission(permissions)) != null : false;
}

Fixed version (ground truth):
/** 
 * Check that current user has access to mentioned resource
 * @param resource resource check
 * @param action {@link Action} to check for
 * @param permissions {@link OrientPermission}s to check
 * @return true if access is allowed
 */
public boolean checkResource(String resource,Action action,OrientPermission[] permissions){
  String actionName=action.getName();
  int actionIndx=resource.indexOf(':');
  if (actionIndx > 0) {
    if (!(resource.endsWith(actionName) && resource.length() > actionName.length() && resource.charAt(resource.length() - actionName.length() - 1) == ':'))     return true;
 else     resource=resource.substring(0,actionIndx);
  }
 else   if (!Component.RENDER.equals(action))   return true;
  OUser user=OrientDbWebSession.get().getUser();
  if (user == null)   return false;
  ORule.ResourceGeneric generic=OSecurityHelper.getResourceGeneric(resource);
  String specific=OSecurityHelper.getResourceSpecific(resource);
  return user != null ? user.checkIfAllowed(generic,specific,OrientPermission.combinedPermission(permissions)) != null : false;
}
Program: 133760
Project: 133760
Buggy source:
public DynamicPropertyValueModel(IModel<ODocument> docModel,IModel<OProperty> propertyModel){
  Args.notNull(docModel,"String_Node_Str");
  this.docModel=docModel;
  this.propertyModel=propertyModel;
}

Fixed version (ground truth):
public DynamicPropertyValueModel(IModel<ODocument> docModel,IModel<OProperty> propertyModel,Class<? extends T> valueType){
  Args.notNull(docModel,"String_Node_Str");
  this.docModel=docModel;
  this.propertyModel=propertyModel;
  this.valueType=valueType;
}
Program: 133761
Project: 133761
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected T load(){
  ODocument doc=docModel.getObject();
  OProperty prop=propertyModel != null ? propertyModel.getObject() : null;
  if (doc == null)   return null;
  if (prop == null)   return (T)doc;
  return (T)doc.field(prop.getName());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected T load(){
  ODocument doc=docModel.getObject();
  OProperty prop=propertyModel != null ? propertyModel.getObject() : null;
  if (doc == null)   return null;
  if (prop == null)   return (T)doc;
  if (valueType == null) {
    return (T)doc.field(prop.getName());
  }
 else {
    Object ret=doc.field(prop.getName(),valueType);
    if (ORecord.class.isAssignableFrom(valueType) && ret instanceof ORID) {
      ret=((ORID)ret).getRecord();
    }
    return (T)ret;
  }
}
Program: 133762
Project: 133762
Buggy source:
public ODocumentModel(ORID iRID){
  this.orid=iRID;
}

Fixed version (ground truth):
public ODocumentModel(OIdentifiable identifiable){
  super(identifiable != null ? (ODocument)identifiable.getRecord() : null);
  if (identifiable != null)   this.orid=identifiable.getIdentity();
}
Program: 133765
Project: 133765
Buggy source:
/** 
 * @param oClassName name of the subject {@link OClass} for security check
 * @param action action to be secured for
 * @param permissions required permissions for access {@link OClass}
 * @return array of {@link RequiredOrientResource} for rights setup emulation
 */
public static RequiredOrientResource[] requireOClass(final String oClassName,final Action action,final OrientPermission... permissions){
  return requireResource(ORule.ResourceGeneric.CLASS,oClassName,action,permissions);
}

Fixed version (ground truth):
/** 
 * @param oClassName name of the subject {@link OClass} for security check
 * @param action action to be secured for
 * @param permissions required permissions for access {@link OClass}
 * @return array of {@link RequiredOrientResource} for rights setup emulation
 */
public static RequiredOrientResource[] requireOClass(final String oClassName,final Action action,final OrientPermission... permissions){
  return oClassName != null ? requireResource(ORule.ResourceGeneric.CLASS,oClassName,action,permissions) : new RequiredOrientResource[0];
}
Program: 133767
Project: 133767
Buggy source:
@Override public boolean authenticate(String username,String password){
  try {
    ODatabaseDocument currentDB=getDatabase();
    boolean inTransaction=currentDB.getTransaction().isActive();
    IOrientDbSettings settings=OrientDbWebApplication.get().getOrientDbSettings();
    ODatabaseDocument newDB=settings.getDatabasePoolFactory().get(settings.getDBUrl(),username,password).acquire();
    if (newDB != currentDB) {
      currentDB.activateOnCurrentThread();
      currentDB.commit();
      currentDB.close();
      newDB.activateOnCurrentThread();
    }
    setUser(username,password);
    user=newDB.getMetadata().getSecurity().getUser(username);
    newDB.setUser(user);
    if (inTransaction && !newDB.getTransaction().isActive())     newDB.begin();
    return true;
  }
 catch (  OSecurityAccessException e) {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean authenticate(String username,String password){
  ODatabaseDocument currentDB=getDatabase();
  try {
    boolean inTransaction=currentDB.getTransaction().isActive();
    IOrientDbSettings settings=OrientDbWebApplication.get().getOrientDbSettings();
    ODatabaseDocument newDB=settings.getDatabasePoolFactory().get(settings.getDBUrl(),username,password).acquire();
    if (newDB != currentDB) {
      currentDB.activateOnCurrentThread();
      currentDB.commit();
      currentDB.close();
      newDB.activateOnCurrentThread();
    }
    setUser(username,password);
    user=newDB.getMetadata().getSecurity().getUser(username);
    newDB.setUser(user);
    if (inTransaction && !newDB.getTransaction().isActive())     newDB.begin();
    return true;
  }
 catch (  OSecurityAccessException e) {
    currentDB.activateOnCurrentThread();
    return false;
  }
}
Program: 133768
Project: 133768
Buggy source:
@Override public IRequestHandler onException(RequestCycle cycle,Exception ex){
  OrientDbWebSession session=OrientDbWebSession.get();
  session.getDatabase().rollback();
  return null;
}

Fixed version (ground truth):
@Override public IRequestHandler onException(RequestCycle cycle,Exception ex){
  ODatabaseDocument db=ODatabaseRecordThreadLocal.INSTANCE.get();
  if (!db.isClosed())   db.rollback();
  return null;
}
Program: 133769
Project: 133769
Buggy source:
@Override public void onConfigure(Component component){
  Object object=component.getDefaultModelObject();
  component.setEnabled(component.isEnabled() && !(object instanceof IPrototype));
}

Fixed version (ground truth):
@Override public void onConfigure(Component component){
  Object object=component.getDefaultModelObject();
  component.setEnabled(!(object instanceof IPrototype));
}
Program: 133770
Project: 133770
Buggy source:
public OSchemaHelper linkedClass(String className){
  checkOProperty();
  OClass linkedToClass=schema.getClass(className);
  if (linkedToClass == null)   throw new IllegalArgumentException("String_Node_Str" + className + "String_Node_Str");
  if (!Objects.equals(linkedToClass,lastProperty.getLinkedClass())) {
    lastProperty.setLinkedClass(linkedToClass);
  }
  return this;
}

Fixed version (ground truth):
public OSchemaHelper linkedClass(String className){
  checkOProperty();
  OClass linkedToClass=schema.getClass(className);
  if (linkedToClass == null)   throw new IllegalArgumentException("String_Node_Str" + className + "String_Node_Str");
  if (!Objects.equal(linkedToClass,lastProperty.getLinkedClass())) {
    lastProperty.setLinkedClass(linkedToClass);
  }
  return this;
}
Program: 133772
Project: 133772
Buggy source:
public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource,WebApplication app){
  app.getSharedResources().add(ORIENT_DB_KEY,resource);
  app.mountResource(MOUNT_PATH,new SharedResourceReference(ORIENT_DB_KEY));
  Authenticator.setDefault(new Authenticator(){
    @Override protected PasswordAuthentication getPasswordAuthentication(){
      String username;
      String password;
      OrientDbWebSession session=OrientDbWebSession.get();
      if (session.isSignedIn()) {
        username=session.getUsername();
        password=session.getPassword();
      }
 else {
        IOrientDbSettings settings=OrientDbWebApplication.get().getOrientDbSettings();
        username=settings.getDBUserName();
        password=settings.getDBUserPassword();
      }
      return new PasswordAuthentication(username,password.toCharArray());
    }
  }
);
  CookieHandler.setDefault(new PersonalCookieManager());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource,WebApplication app){
  app.getSharedResources().add(ORIENT_DB_KEY,resource);
  app.mountResource(MOUNT_PATH,new SharedResourceReference(ORIENT_DB_KEY));
  Authenticator.setDefault(new Authenticator(){
    @Override protected PasswordAuthentication getPasswordAuthentication(){
      String username;
      String password;
      OrientDbWebSession session=OrientDbWebSession.get();
      if (session.isSignedIn()) {
        username=session.getUsername();
        password=session.getPassword();
      }
 else {
        IOrientDbSettings settings=OrientDbWebApplication.get().getOrientDbSettings();
        username=settings.getDBUserName();
        password=settings.getDBUserPassword();
      }
      return new PasswordAuthentication(username,password.toCharArray());
    }
  }
);
  CookieHandler.setDefault(new PersonalCookieManager());
  sun.net.www.protocol.http.AuthCacheValue.setAuthCache(new MultiUserCache());
}
Program: 133774
Project: 133774
Buggy source:
protected T handleRealize(T proxy){
  T ret=createInstance(proxy);
  PropertyResolverConverter prc=getPropertyResolverConverter();
  for (  Map.Entry<String,Object> entry : values.entrySet()) {
    try {
      PropertyResolver.setValue(entry.getKey(),ret,entry.getValue(),prc);
    }
 catch (    WicketRuntimeException e) {
    }
  }
  realized=ret;
  return ret;
}

Fixed version (ground truth):
protected T handleRealize(T proxy){
  T ret=createInstance(proxy);
  PropertyResolverConverter prc=getPropertyResolverConverter();
  for (  Map.Entry<String,Object> entry : values.entrySet()) {
    String propertyName=entry.getKey();
    Object value=entry.getValue();
    int mappedIndicatorIndx=propertyName.indexOf(':');
    if (mappedIndicatorIndx < 0) {
      try {
        PropertyResolver.setValue(propertyName,ret,value,prc);
      }
 catch (      WicketRuntimeException e) {
        e.printStackTrace();
      }
    }
 else {
      String propertyExp=propertyName.substring(0,mappedIndicatorIndx);
      String fieldExp=propertyName.substring(mappedIndicatorIndx + 1);
      Object object=ret;
      int subObject=propertyExp.lastIndexOf('.');
      if (subObject >= 0) {
        object=PropertyResolver.getValue(propertyExp.substring(0,subObject),object);
        propertyExp=propertyExp.substring(subObject + 1);
      }
      if (object != null) {
        String methodName="String_Node_Str" + propertyExp.substring(0,1).toUpperCase() + propertyExp.substring(1);
        Method[] methods=object.getClass().getMethods();
        try {
          for (          Method method : methods) {
            if (method.getName().equals(methodName)) {
              Class<?>[] paramTypes=method.getParameterTypes();
              if (paramTypes.length == 2 && paramTypes[0].isAssignableFrom(String.class) && (value == null || paramTypes[1].isInstance(value))) {
                method.invoke(object,fieldExp,value);
                break;
              }
            }
          }
        }
 catch (        Exception e) {
        }
      }
    }
  }
  realized=ret;
  return ret;
}
Program: 133775
Project: 133775
Buggy source:
@Override protected void installData(OrientDbWebApplication app,ODatabaseRecord db){
  OSchema schema=db.getMetadata().getSchema();
  OClass classA=schema.createClass("String_Node_Str");
  classA.createProperty("String_Node_Str",OType.STRING);
  classA.createProperty("String_Node_Str",OType.STRING);
  OClass classB=schema.createClass("String_Node_Str");
  classB.createProperty("String_Node_Str",OType.STRING);
  classB.createProperty("String_Node_Str",OType.STRING);
}

Fixed version (ground truth):
@Override protected void installData(OrientDbWebApplication app,ODatabaseRecord db){
  OSchema schema=db.getMetadata().getSchema();
  OClass classA=schema.createClass("String_Node_Str");
  classA.createProperty("String_Node_Str",OType.STRING);
  classA.createProperty("String_Node_Str",OType.STRING);
  OClass classB=schema.createClass("String_Node_Str");
  classB.createProperty("String_Node_Str",OType.STRING);
  classB.createProperty("String_Node_Str",OType.STRING);
  new ODocument("String_Node_Str").field("String_Node_Str","String_Node_Str").save();
  new ODocument("String_Node_Str").field("String_Node_Str","String_Node_Str").save();
  new ODocument("String_Node_Str").field("String_Node_Str","String_Node_Str").save();
}
Program: 133776
Project: 133776
Buggy source:
@Override public void setCustom(String param,Object value){
  custom.put(name,value);
}

Fixed version (ground truth):
@Override public void setCustom(String param,Object value){
  customMap.put(param,value);
}
Program: 133777
Project: 133777
Buggy source:
@Override public Object getCustom(String param){
  return custom.get(param);
}

Fixed version (ground truth):
@Override public Object getCustom(String param){
  return customMap.get(param);
}
Program: 133778
Project: 133778
Buggy source:
@Test public void testMappedPropertiesPrototyper() throws Exception {
  IMyBean bean=MyBeanPrototyper.newPrototype();
  assertTrue(bean instanceof IPrototype<?>);
  assertTrue(bean instanceof Serializable);
  bean.setCustom("String_Node_Str","String_Node_Str");
  bean.setCustom("String_Node_Str",-1);
  assertEquals("String_Node_Str",bean.getCustom("String_Node_Str"));
  assertEquals(Integer.valueOf(-1),bean.getCustom("String_Node_Str"));
  IPrototype<IMyBean> proto=(IPrototype<IMyBean>)bean;
  assertTrue(proto instanceof IMyBean);
  assertFalse(proto.isPrototypeRealized());
  bean=proto.realizePrototype();
  assertEquals("String_Node_Str",bean.getCustom("String_Node_Str"));
  assertEquals(Integer.valueOf(-1),bean.getCustom("String_Node_Str"));
  assertEquals("String_Node_Str",bean.getSignature());
  assertTrue(proto.isPrototypeRealized());
  assertEquals("String_Node_Str",((IMyBean)proto).getSignature());
}

Fixed version (ground truth):
@Test public void testMappedPropertiesPrototyper() throws Exception {
  IMyBean bean=MyBeanPrototyper.newPrototype();
  assertTrue(bean instanceof IPrototype<?>);
  assertTrue(bean instanceof Serializable);
  bean.setCustom("String_Node_Str","String_Node_Str");
  bean.setCustom("String_Node_Str",-1);
  bean.setCustomString("String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",bean.getCustom("String_Node_Str"));
  assertEquals(Integer.valueOf(-1),bean.getCustom("String_Node_Str"));
  assertEquals("String_Node_Str",bean.getCustomString("String_Node_Str"));
  IPrototype<IMyBean> proto=(IPrototype<IMyBean>)bean;
  assertTrue(proto instanceof IMyBean);
  assertFalse(proto.isPrototypeRealized());
  bean=proto.realizePrototype();
  assertEquals("String_Node_Str",bean.getCustom("String_Node_Str"));
  assertEquals(Integer.valueOf(-1),bean.getCustom("String_Node_Str"));
  assertEquals("String_Node_Str",bean.getCustomString("String_Node_Str"));
  assertEquals("String_Node_Str",bean.getSignature());
  assertTrue(proto.isPrototypeRealized());
  assertEquals("String_Node_Str",((IMyBean)proto).getSignature());
}
Program: 133779
Project: 133779
Buggy source:
@Test public void testOPropertyPrototyper() throws Exception {
  OClass newClass=getSchema().createClass("String_Node_Str");
  OProperty newProperty=OPropertyPrototyper.newPrototype("String_Node_Str");
  assertNull(newClass.getProperty("String_Node_Str"));
  newProperty.setName("String_Node_Str");
  assertEquals("String_Node_Str",newProperty.getName());
  assertNull(newClass.getProperty("String_Node_Str"));
  newProperty.setType(OType.STRING);
  assertEquals(OType.STRING,newProperty.getType());
  assertTrue(newProperty instanceof IPrototype);
  OProperty realizedNewProperty=((IPrototype<OProperty>)newProperty).realizePrototype();
  assertEquals(newClass.getProperty("String_Node_Str"),realizedNewProperty);
  getSchema().dropClass(newClass.getName());
}

Fixed version (ground truth):
@Test public void testOPropertyPrototyper() throws Exception {
  OClass newClass=getSchema().createClass("String_Node_Str");
  try {
    OProperty newProperty=OPropertyPrototyper.newPrototype("String_Node_Str");
    assertNull(newClass.getProperty("String_Node_Str"));
    newProperty.setName("String_Node_Str");
    assertEquals("String_Node_Str",newProperty.getName());
    assertNull(newClass.getProperty("String_Node_Str"));
    newProperty.setType(OType.STRING);
    assertEquals(OType.STRING,newProperty.getType());
    newProperty.setCustom("String_Node_Str","String_Node_Str");
    assertEquals("String_Node_Str",newProperty.getCustom("String_Node_Str"));
    assertTrue(newProperty instanceof IPrototype);
    OProperty realizedNewProperty=((IPrototype<OProperty>)newProperty).realizePrototype();
    assertEquals(newClass.getProperty("String_Node_Str"),realizedNewProperty);
    assertEquals("String_Node_Str",realizedNewProperty.getCustom("String_Node_Str"));
  }
  finally {
    getSchema().dropClass(newClass.getName());
  }
}
Program: 133780
Project: 133780
Buggy source:
protected void validateType(final IValidatable<T> validatable,final OProperty p,final Object value){
  if (value != null)   if (OType.convert(value,p.getLinkedType().getDefaultJavaType()) == null)   validatable.error(newValidationError("String_Node_Str"));
}

Fixed version (ground truth):
protected void validateType(final IValidatable<T> validatable,final OProperty p,final Object value){
  if (value != null)   if (OType.convert(value,p.getLinkedType().getDefaultJavaType()) == null)   validatable.error(newValidationError("String_Node_Str","String_Node_Str",p.getLinkedType().toString()));
}
Program: 133781
Project: 133781
Buggy source:
protected void validateEmbedded(final IValidatable<T> validatable,final OProperty p,final Object fieldValue){
  if (fieldValue instanceof ORecordId) {
    validatable.error(newValidationError("String_Node_Str"));
    return;
  }
 else   if (fieldValue instanceof OIdentifiable) {
    if (((OIdentifiable)fieldValue).getIdentity().isValid()) {
      validatable.error(newValidationError("String_Node_Str"));
      return;
    }
    final OClass embeddedClass=p.getLinkedClass();
    if (embeddedClass != null) {
      final ORecord<?> rec=((OIdentifiable)fieldValue).getRecord();
      if (!(rec instanceof ODocument)) {
        validatable.error(newValidationError("String_Node_Str"));
        return;
      }
      final ODocument doc=(ODocument)rec;
      if (doc.getSchemaClass() == null || !(doc.getSchemaClass().isSubClassOf(embeddedClass))) {
        validatable.error(newValidationError("String_Node_Str"));
        return;
      }
    }
  }
 else {
    validatable.error(newValidationError("String_Node_Str"));
    return;
  }
}

Fixed version (ground truth):
protected void validateEmbedded(final IValidatable<T> validatable,final OProperty p,final Object fieldValue){
  if (fieldValue instanceof ORecordId) {
    validatable.error(newValidationError("String_Node_Str"));
    return;
  }
 else   if (fieldValue instanceof OIdentifiable) {
    if (((OIdentifiable)fieldValue).getIdentity().isValid()) {
      validatable.error(newValidationError("String_Node_Str"));
      return;
    }
    final OClass embeddedClass=p.getLinkedClass();
    if (embeddedClass != null) {
      final ORecord<?> rec=((OIdentifiable)fieldValue).getRecord();
      if (!(rec instanceof ODocument)) {
        validatable.error(newValidationError("String_Node_Str"));
        return;
      }
      final ODocument doc=(ODocument)rec;
      if (doc.getSchemaClass() == null || !(doc.getSchemaClass().isSubClassOf(embeddedClass))) {
        validatable.error(newValidationError("String_Node_Str","String_Node_Str",embeddedClass.getName()));
        return;
      }
    }
  }
 else {
    validatable.error(newValidationError("String_Node_Str"));
    return;
  }
}
Program: 133783
Project: 133783
Buggy source:
/** 
 * @see org.apache.wicket.Application#init()
 */
@Override public void init(){
  super.init();
  getApplicationListeners().add(new EmbeddOrientDbApplicationListener(WicketApplication.class.getResource("String_Node_Str")){
    @Override public void onAfterServerStartupAndActivation() throws Exception {
      OServerAdmin serverAdmin=new OServerAdmin("String_Node_Str" + DB_NAME).connect("String_Node_Str","String_Node_Str");
      if (!serverAdmin.existsDatabase())       serverAdmin.createDatabase(DB_NAME,"String_Node_Str","String_Node_Str");
    }
  }
);
  getOrientDbSettings().setDBUrl("String_Node_Str" + DB_NAME);
  getOrientDbSettings().setDefaultUserName("String_Node_Str");
  getOrientDbSettings().setDefaultUserPassword("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @see org.apache.wicket.Application#init()
 */
@Override public void init(){
  super.init();
  getApplicationListeners().add(new EmbeddOrientDbApplicationListener(WicketApplication.class.getResource("String_Node_Str")){
    @Override public void onAfterServerStartupAndActivation() throws Exception {
      OServerAdmin serverAdmin=new OServerAdmin("String_Node_Str" + DB_NAME).connect("String_Node_Str","String_Node_Str");
      if (!serverAdmin.existsDatabase())       serverAdmin.createDatabase(DB_NAME,"String_Node_Str","String_Node_Str");
    }
  }
);
  getOrientDbSettings().setDBUrl("String_Node_Str" + DB_NAME);
  getOrientDbSettings().setDBUserName("String_Node_Str");
  getOrientDbSettings().setDBUserPassword("String_Node_Str");
}
Program: 133784
Project: 133784
Buggy source:
public byte[] getFileDataBytes(String name){
  System.out.println("String_Node_Str" + name);
  try {
    InputStream is=getInputStreamForAsset(name);
    if (is == null) {
      Log.e("String_Node_Str","String_Node_Str");
      return null;
    }
    ByteArrayOutputStream bout=new ByteArrayOutputStream();
    byte[] buffer=new byte[1024];
    while (true) {
      int len=is.read(buffer);
      if (len < 0) {
        break;
      }
      bout.write(buffer,0,len);
    }
    byte[] retval=bout.toByteArray();
    return retval;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
public byte[] getFileDataBytes(String name){
  System.out.println("String_Node_Str" + name);
  try {
    if (name.isEmpty())     return null;
    InputStream is=null;
    if (name.charAt(0) == '/')     is=new FileInputStream(new File(name));
 else     is=getInputStreamForAsset(name);
    if (is == null) {
      Log.e("String_Node_Str","String_Node_Str");
      return null;
    }
    ByteArrayOutputStream bout=new ByteArrayOutputStream();
    byte[] buffer=new byte[1024];
    while (true) {
      int len=is.read(buffer);
      if (len < 0) {
        break;
      }
      bout.write(buffer,0,len);
    }
    byte[] retval=bout.toByteArray();
    return retval;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}
Program: 133785
Project: 133785
Buggy source:
protected InputStream getLocalInputStreamForAsset(String name){
  InputStream is=null;
  try {
    try {
      is=apkContext.getAssets().open(name);
    }
 catch (    Exception e) {
      e.printStackTrace();
      is=getAssets().open(name);
    }
    if (is == null) {
      System.out.println("String_Node_Str");
      is=getAssets().open(name);
    }
    return is;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
protected InputStream getLocalInputStreamForAsset(String name){
  InputStream is=null;
  try {
    try {
      if (name.charAt(0) == '/')       is=new FileInputStream(new File(name));
 else       is=apkContext.getAssets().open(name);
    }
 catch (    Exception e) {
      e.printStackTrace();
      is=getAssets().open(name);
    }
    if (is == null) {
      System.out.println("String_Node_Str");
      is=getAssets().open(name);
    }
    return is;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}