Program: 15967
Project: 15967
Buggy source:
/** 
 * Pares the event expression. <p>There are several formats for the event expression: <ul> <li>onClick</li> <li>self.onClick</li> <li>id.onClick</li> <li>../id1/id2.onClick</li> <li>${elexpr}.onClick</li> </ul>
 * @param comp the component that the event expression is referenced to
 * @param evtexpr the event expression.
 * @param defaultComp the default component which is used whenevtexpr doesn't specify the component.
 * @param deferred whether to defer the conversion of the pathto a component. If true and EL not specified or evaluated to a string, it returns the path directly rather than converting it to a component.
 * @return a two element array. The first element is the componentif deferred is false or EL is evaluated to a component, or a path, otherwise. The second component is the event name.
 * @since 3.0.0
 */
public static Object[] parseEventExpression(Component comp,String evtexpr,Component defaultComp,boolean deferred) throws ComponentNotFoundException {
  final int j=evtexpr.lastIndexOf('.');
  final String evtnm;
  Object target;
  if (j >= 0) {
    evtnm=evtexpr.substring(j + 1).trim();
    String path=evtexpr.substring(0,j);
    if (path.length() > 0) {
      target=null;
      path=path.indexOf("String_Node_Str") >= 0 ? path : "String_Node_Str" + path + "String_Node_Str";
      final Object v=Executions.evaluate(comp,path,Object.class);
      if (v instanceof Component) {
        target=v;
      }
 else       if (v == null) {
        throw new ComponentNotFoundException("String_Node_Str" + path);
      }
 else {
        path=Objects.toString(v);
      }
      if (target == null) {
        path=path.trim();
        if ("String_Node_Str".equals(path))         path="String_Node_Str";
        target=deferred ? path : "String_Node_Str".equals(path) ? comp : Path.getComponent(comp.getSpaceOwner(),path);
        if (target == null && comp instanceof IdSpace && comp.getParent() != null) {
          target=Path.getComponent(comp.getParent().getSpaceOwner(),path);
        }
      }
    }
 else {
      target=defaultComp;
    }
  }
 else {
    evtnm=evtexpr.trim();
    target=defaultComp;
  }
  if (!Events.isValid(evtnm))   throw new UiException("String_Node_Str" + evtnm);
  return new Object[]{target,evtnm};
}

Fixed version (ground truth):
/** 
 * Pares the event expression. <p>There are several formats for the event expression: <ul> <li>onClick</li> <li>self.onClick</li> <li>id.onClick</li> <li>../id1/id2.onClick</li> <li>${elexpr}.onClick</li> </ul>
 * @param comp the component that the event expression is referenced to
 * @param evtexpr the event expression.
 * @param defaultComp the default component which is used whenevtexpr doesn't specify the component.
 * @param deferred whether to defer the conversion of the pathto a component. If true and EL not specified or evaluated to a string, it returns the path directly rather than converting it to a component.
 * @return a two element array. The first element is the componentif deferred is false or EL is evaluated to a component, or a path, otherwise. The second component is the event name.
 * @since 3.0.0
 */
public static Object[] parseEventExpression(Component comp,String evtexpr,Component defaultComp,boolean deferred) throws ComponentNotFoundException {
  final int j=evtexpr.lastIndexOf('.');
  final String evtnm;
  Object target;
  if (j >= 0) {
    evtnm=evtexpr.substring(j + 1).trim();
    String path=evtexpr.substring(0,j);
    if (path.length() > 0) {
      target=null;
      String el_path=path.indexOf("String_Node_Str") >= 0 ? path : "String_Node_Str" + path + "String_Node_Str";
      Object v=null;
      try {
        v=Executions.evaluate(comp,el_path,Object.class);
      }
 catch (      Exception e) {
      }
      if (v instanceof Component) {
        target=v;
      }
 else       if (v != null) {
        path=Objects.toString(v);
      }
      if (target == null) {
        path=path.trim();
        if ("String_Node_Str".equals(path))         path="String_Node_Str";
        target=deferred ? path : "String_Node_Str".equals(path) ? comp : Path.getComponent(comp.getSpaceOwner(),path);
        if (target == null && comp instanceof IdSpace && comp.getParent() != null) {
          target=Path.getComponent(comp.getParent().getSpaceOwner(),path);
        }
        if (target == null) {
          throw new ComponentNotFoundException("String_Node_Str" + path);
        }
      }
    }
 else {
      target=defaultComp;
    }
  }
 else {
    evtnm=evtexpr.trim();
    target=defaultComp;
  }
  if (!Events.isValid(evtnm))   throw new UiException("String_Node_Str" + evtnm);
  return new Object[]{target,evtnm};
}