Program: 73754
Project: 73754
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 final void register(String sScriptContent) throws ChartException {
  try {
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    Class handlerClass=null;
    try {
      handlerClass=Class.forName(sScriptContent);
    }
 catch (    ClassNotFoundException ex) {
      if (iscl != null) {
        handlerClass=iscl.loadClass(sScriptContent,ScriptHandler.class.getClassLoader());
      }
 else {
        throw ex;
      }
    }
    if (IChartEventHandler.class.isAssignableFrom(handlerClass)) {
      try {
        javahandler=(IChartEventHandler)handlerClass.newInstance();
      }
 catch (      InstantiationException e) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.ERROR,e);
      }
catch (      IllegalAccessException e) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.ERROR,e);
      }
      logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",handlerClass,ULocale.getDefault()));
    }
 else {
      logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",handlerClass,ULocale.getDefault()));
    }
  }
 catch (  ClassNotFoundException e) {
    javahandler=null;
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    final Context cx=Context.enter();
    try {
      cx.evaluateString(scope,sScriptContent,"String_Node_Str",1,null);
      logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
      Object[] objs=scope.getIds();
      if (objs != null) {
        javaScriptFunctionNamesCache=new ArrayList();
        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 final void register(String sScriptName,String sScriptContent) throws ChartException {
  try {
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    Class handlerClass=null;
    try {
      handlerClass=Class.forName(sScriptContent);
    }
 catch (    ClassNotFoundException ex) {
      if (iscl != null) {
        handlerClass=iscl.loadClass(sScriptContent,ScriptHandler.class.getClassLoader());
      }
 else {
        throw ex;
      }
    }
    if (IChartEventHandler.class.isAssignableFrom(handlerClass)) {
      try {
        javahandler=(IChartEventHandler)handlerClass.newInstance();
      }
 catch (      InstantiationException e) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.ERROR,e);
      }
catch (      IllegalAccessException e) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.ERROR,e);
      }
      logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",handlerClass,ULocale.getDefault()));
    }
 else {
      logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",handlerClass,ULocale.getDefault()));
    }
  }
 catch (  ClassNotFoundException e) {
    javahandler=null;
    logger.log(ILogger.INFORMATION,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(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
      Object[] objs=scope.getIds();
      if (objs != null) {
        javaScriptFunctionNamesCache=new ArrayList();
        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();
    }
  }
}