Program: 72953
Project: 72953
Buggy source:
/** 
 * Register the script content for current script handler.
 * @param sScriptContent This is either the JavaSciprt code content or a full class name which has implemented <code>IChartItemScriptHandler</code>
 */
public void register(String sScriptName,String sScriptContent,ClassLoader contextLoader) throws CrosstabException {
  try {
    logger.log(Level.INFO,Messages.getString("String_Node_Str"));
    Class<?> handlerClass=null;
    try {
      handlerClass=Class.forName(sScriptContent);
    }
 catch (    ClassNotFoundException ex) {
      if (contextLoader != null) {
        handlerClass=contextLoader.loadClass(sScriptContent);
      }
 else {
        throw ex;
      }
    }
    if (ICrosstabEventHandler.class.isAssignableFrom(handlerClass)) {
      try {
        javahandler=(ICrosstabEventHandler)handlerClass.newInstance();
      }
 catch (      InstantiationException e) {
        throw new CrosstabException(e);
      }
catch (      IllegalAccessException e) {
        throw new CrosstabException(e);
      }
      logger.log(Level.INFO,Messages.getString("String_Node_Str",handlerClass));
    }
 else {
      logger.log(Level.WARNING,Messages.getString("String_Node_Str",handlerClass));
    }
  }
 catch (  ClassNotFoundException e) {
    javahandler=null;
    logger.log(Level.INFO,Messages.getString("String_Node_Str"));
    final Context cx=Context.enter();
    try {
      cx.evaluateString(scope,sScriptContent,sScriptName == null ? "String_Node_Str" : sScriptName,1,null);
      logger.log(Level.INFO,Messages.getString("String_Node_Str"));
      Object[] objs=scope.getIds();
      if (objs != null) {
        javaScriptFunctionNamesCache=new ArrayList<String>();
        for (int i=0; i < objs.length; i++) {
          javaScriptFunctionNamesCache.add(String.valueOf(objs[i]));
        }
      }
 else {
        javaScriptFunctionNamesCache=null;
      }
    }
 catch (    RhinoException jsx) {
      throw convertException(jsx);
    }
 finally {
      Context.exit();
    }
  }
}

Fixed version (ground truth):
/** 
 * Register the script content for current script handler.
 * @param sScriptContent This is either the JavaSciprt code content or a full class name which has implemented <code>IChartItemScriptHandler</code>
 */
public void register(String sScriptName,String sScriptContent,ClassLoader contextLoader) throws CrosstabException {
  try {
    logger.log(Level.INFO,Messages.getString("String_Node_Str"));
    Class<?> handlerClass=loadJavaHandlerClass(sScriptContent,contextLoader);
    if (ICrosstabEventHandler.class.isAssignableFrom(handlerClass)) {
      try {
        javahandler=(ICrosstabEventHandler)handlerClass.newInstance();
      }
 catch (      InstantiationException e) {
        throw new CrosstabException(e);
      }
catch (      IllegalAccessException e) {
        throw new CrosstabException(e);
      }
      logger.log(Level.INFO,Messages.getString("String_Node_Str",handlerClass));
    }
 else {
      logger.log(Level.WARNING,Messages.getString("String_Node_Str",handlerClass));
    }
  }
 catch (  ClassNotFoundException e) {
    javahandler=null;
    logger.log(Level.INFO,Messages.getString("String_Node_Str"));
    final Context cx=Context.enter();
    try {
      cx.evaluateString(scope,sScriptContent,sScriptName == null ? "String_Node_Str" : sScriptName,1,null);
      logger.log(Level.INFO,Messages.getString("String_Node_Str"));
      Object[] objs=scope.getIds();
      if (objs != null) {
        javaScriptFunctionNamesCache=new ArrayList<String>();
        for (int i=0; i < objs.length; i++) {
          javaScriptFunctionNamesCache.add(String.valueOf(objs[i]));
        }
      }
 else {
        javaScriptFunctionNamesCache=null;
      }
    }
 catch (    RhinoException jsx) {
      throw convertException(jsx);
    }
 finally {
      Context.exit();
    }
  }
}