nus-yam/ex-repair huggingface dataset:
Program: 52479
Project: 52479
Buggy source:
public static DSpaceIdentifier resolve(Context context,String str){
  DSpaceIdentifier dsi=null;
  if (dsi == null) {
    dsi=IdentifierFactory.resolveAsURLSubstring(context,str);
  }
  if (dsi == null) {
    dsi=IdentifierFactory.resolve(context,str);
  }
  return dsi;
}

Fixed version (ground truth):
public static DSpaceIdentifier resolve(Context context,String str){
  DSpaceIdentifier dsi=null;
  if (dsi == null) {
    dsi=IdentifierFactory.resolveAsURLSubstring(context,str);
  }
  if (dsi == null) {
    dsi=IdentifierFactory.resolveCanonical(context,str);
  }
  return dsi;
}
Program: 52480
Project: 52480
Buggy source:
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      TableRow row=DatabaseManager.create(context,"String_Node_Str");
      row.setColumn("String_Node_Str",itemID);
      row.setColumn("String_Node_Str",commID[i]);
      DatabaseManager.update(context,row);
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}

Fixed version (ground truth):
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      if (isFirstOccurrence(commID,i)) {
        TableRow row=DatabaseManager.create(context,"String_Node_Str");
        row.setColumn("String_Node_Str",itemID);
        row.setColumn("String_Node_Str",commID[i]);
        DatabaseManager.update(context,row);
      }
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}
Program: 52481
Project: 52481
Buggy source:
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      TableRow row=DatabaseManager.create(context,"String_Node_Str");
      row.setColumn("String_Node_Str",itemID);
      row.setColumn("String_Node_Str",commID[i]);
      DatabaseManager.update(context,row);
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}

Fixed version (ground truth):
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      if (isFirstOccurrence(commID,i)) {
        TableRow row=DatabaseManager.create(context,"String_Node_Str");
        row.setColumn("String_Node_Str",itemID);
        row.setColumn("String_Node_Str",commID[i]);
        DatabaseManager.update(context,row);
      }
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}
Program: 52482
Project: 52482
Buggy source:
/** 
 * @deprecated
 * @return
 * @throws BrowseException
 */
public static String[] tables() throws BrowseException {
  BrowseIndex[] bis=getBrowseIndices();
  String[] returnTables=new String[bis.length + 1];
  for (int i=0; i < bis.length; i++) {
    returnTables[i]=bis[i].getTableName();
  }
  returnTables[bis.length]="String_Node_Str";
  return returnTables;
}

Fixed version (ground truth):
/** 
 * @deprecated
 * @return
 * @throws BrowseException
 */
public static String[] tables() throws BrowseException {
  BrowseIndex[] bis=getBrowseIndices();
  String[] returnTables=new String[bis.length];
  for (int i=0; i < bis.length; i++) {
    returnTables[i]=bis[i].getTableName();
  }
  return returnTables;
}
Program: 52483
Project: 52483
Buggy source:
public boolean itemRemoved(int itemID) throws BrowseException {
  for (int i=0; i < bis.length; i++) {
    log.debug("String_Node_Str" + itemID + "String_Node_Str"+ bis[i].getTableName());
    removeIndex(itemID,bis[i]);
  }
  removeIndex(itemID,BrowseIndex.getItemBrowseIndex().getTableName());
  removeIndex(itemID,BrowseIndex.getWithdrawnBrowseIndex().getTableName());
  pruneIndexes();
  return true;
}

Fixed version (ground truth):
public boolean itemRemoved(int itemID) throws BrowseException {
  for (int i=0; i < bis.length; i++) {
    log.debug("String_Node_Str" + itemID + "String_Node_Str"+ bis[i].getTableName());
    removeIndex(itemID,bis[i]);
  }
  removeIndex(itemID,BrowseIndex.getItemBrowseIndex().getTableName());
  removeIndex(itemID,BrowseIndex.getWithdrawnBrowseIndex().getTableName());
  dao.deleteCommunityMappings(itemID);
  pruneIndexes();
  return true;
}
Program: 52489
Project: 52489
Buggy source:
protected void doDSGet(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  String extraPathInfo=null;
  DSpaceObject dso=null;
  String path=request.getPathInfo();
  DSpaceIdentifier di=IdentifierFactory.resolve(context,path);
  if (di == null) {
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + path));
    JSPManager.showInvalidIDError(request,response,path,-1);
  }
 else {
    String urlForm=di.getURLForm();
    int index=path.indexOf(urlForm);
    int startFrom=index + urlForm.length();
    if (startFrom < path.length()) {
      extraPathInfo=path.substring(startFrom);
    }
    dso=di.getObject(context);
    processDSpaceObject(context,request,response,dso,extraPathInfo);
  }
}

Fixed version (ground truth):
protected void doDSGet(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  String extraPathInfo=null;
  DSpaceObject dso=null;
  String path=request.getPathInfo();
  DSpaceIdentifier di=IdentifierFactory.resolve(context,path);
  if (di != null) {
    dso=di.getObject(context);
  }
  if (dso == null) {
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + path));
    JSPManager.showInvalidIDError(request,response,path,-1);
  }
 else {
    String urlForm=di.getURLForm();
    int index=path.indexOf(urlForm);
    int startFrom=index + urlForm.length();
    if (startFrom < path.length()) {
      extraPathInfo=path.substring(startFrom);
    }
    processDSpaceObject(context,request,response,dso,extraPathInfo);
  }
}
Program: 52490
Project: 52490
Buggy source:
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      TableRow row=DatabaseManager.create(context,"String_Node_Str");
      row.setColumn("String_Node_Str",itemID);
      row.setColumn("String_Node_Str",commID[i]);
      DatabaseManager.update(context,row);
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}

Fixed version (ground truth):
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      if (isFirstOccurrence(commID,i)) {
        TableRow row=DatabaseManager.create(context,"String_Node_Str");
        row.setColumn("String_Node_Str",itemID);
        row.setColumn("String_Node_Str",commID[i]);
        DatabaseManager.update(context,row);
      }
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}
Program: 52491
Project: 52491
Buggy source:
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      TableRow row=DatabaseManager.create(context,"String_Node_Str");
      row.setColumn("String_Node_Str",itemID);
      row.setColumn("String_Node_Str",commID[i]);
      DatabaseManager.update(context,row);
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}

Fixed version (ground truth):
public void insertCommunityMappings(int itemID) throws BrowseException {
  try {
    int[] commID=getAllCommunityIDs(itemID);
    for (int i=0; i < commID.length; i++) {
      if (isFirstOccurrence(commID,i)) {
        TableRow row=DatabaseManager.create(context,"String_Node_Str");
        row.setColumn("String_Node_Str",itemID);
        row.setColumn("String_Node_Str",commID[i]);
        DatabaseManager.update(context,row);
      }
    }
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new BrowseException(e);
  }
}
Program: 52492
Project: 52492
Buggy source:
/** 
 * Setup the AspectGenerator. 
 */
public void setup(SourceResolver resolver,Map objectModel,String src,Parameters par) throws ProcessingException, SAXException, IOException {
  Request request=ObjectModelHelper.getRequest(objectModel);
  Integer aspectID=(Integer)request.getAttribute(ASPECT_ID);
  if (aspectID == null)   aspectID=0;
  aspectID++;
  request.setAttribute(ASPECT_ID,aspectID);
  String path=request.getServletPath();
  if (path.startsWith(PREFIX)) {
    path=path.substring(PREFIX.length());
  }
  String aspectPath=PROTOCOL + "String_Node_Str" + PREFIX+ aspectID+ "String_Node_Str"+ path;
  getLogger().debug("String_Node_Str" + aspectPath);
  super.setup(resolver,objectModel,aspectPath,par);
}

Fixed version (ground truth):
/** 
 * Setup the AspectGenerator. 
 */
public void setup(SourceResolver resolver,Map objectModel,String src,Parameters par) throws ProcessingException, SAXException, IOException {
  Request request=ObjectModelHelper.getRequest(objectModel);
  Integer aspectID=(Integer)request.getAttribute(ASPECT_ID);
  if (aspectID == null)   aspectID=0;
  aspectID++;
  request.setAttribute(ASPECT_ID,aspectID);
  String path=request.getSitemapURI();
  String aspectPath=PROTOCOL + "String_Node_Str" + PREFIX+ aspectID+ "String_Node_Str"+ path;
  getLogger().debug("String_Node_Str" + aspectPath);
  super.setup(resolver,objectModel,aspectPath,par);
}
Program: 52493
Project: 52493
Buggy source:
/** 
 * @deprecated
 * @return
 * @throws BrowseException
 */
public static String[] tables() throws BrowseException {
  BrowseIndex[] bis=getBrowseIndices();
  String[] returnTables=new String[bis.length + 1];
  for (int i=0; i < bis.length; i++) {
    returnTables[i]=bis[i].getTableName();
  }
  returnTables[bis.length]="String_Node_Str";
  return returnTables;
}

Fixed version (ground truth):
/** 
 * @deprecated
 * @return
 * @throws BrowseException
 */
public static String[] tables() throws BrowseException {
  BrowseIndex[] bis=getBrowseIndices();
  String[] returnTables=new String[bis.length];
  for (int i=0; i < bis.length; i++) {
    returnTables[i]=bis[i].getTableName();
  }
  return returnTables;
}
Program: 52496
Project: 52496
Buggy source:
/** 
 * Get the count of the items in the given container.  If the configuration value webui.strengths.cache is equal to 'true' this will return the cached value if it exists.  If it is equal to 'false' it will count the number of items in the container in real time
 * @param dso
 * @return
 * @throws ItemCountException
 * @throws SQLException 
 */
public int getCount(DSpaceObject dso) throws ItemCountException {
  boolean useCache=ConfigurationManager.getBooleanProperty("String_Node_Str");
  if (useCache) {
    return dao.getCount(dso);
  }
  if (dso instanceof Collection) {
    try {
      return ((Collection)dso).countItems();
    }
 catch (    SQLException e) {
      log.error("String_Node_Str",e);
      throw new ItemCountException(e);
    }
  }
  if (dso instanceof Community) {
    try {
      return ((Collection)dso).countItems();
    }
 catch (    SQLException e) {
      log.error("String_Node_Str",e);
      throw new ItemCountException(e);
    }
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Get the count of the items in the given container.  If the configuration value webui.strengths.cache is equal to 'true' this will return the cached value if it exists.  If it is equal to 'false' it will count the number of items in the container in real time
 * @param dso
 * @return
 * @throws ItemCountException
 * @throws SQLException 
 */
public int getCount(DSpaceObject dso) throws ItemCountException {
  boolean useCache=ConfigurationManager.getBooleanProperty("String_Node_Str");
  if (useCache) {
    return dao.getCount(dso);
  }
  if (dso instanceof Collection) {
    try {
      return ((Collection)dso).countItems();
    }
 catch (    SQLException e) {
      log.error("String_Node_Str",e);
      throw new ItemCountException(e);
    }
  }
  if (dso instanceof Community) {
    try {
      return ((Community)dso).countItems();
    }
 catch (    SQLException e) {
      log.error("String_Node_Str",e);
      throw new ItemCountException(e);
    }
  }
  return 0;
}
Program: 52497
Project: 52497
Buggy source:
/** 
 * Get the style using the owning collection handle
 */
public String getStyleForItem(Item item) throws SQLException {
  Collection c=item.getOwningCollection();
  return getFromMap(c.getHandle());
}

Fixed version (ground truth):
/** 
 * Get the style using the owning collection handle
 */
public String getStyleForItem(Item item) throws SQLException {
  Collection c=item.getOwningCollection();
  if (c != null) {
    return getFromMap(c.getHandle());
  }
 else   return "String_Node_Str";
}
Program: 52498
Project: 52498
Buggy source:
public Map act(Redirector redirector,SourceResolver resolver,Map objectModel,String source,Parameters parameters) throws Exception {
  final HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
  final HttpServletRequest httpRequest=(HttpServletRequest)objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);
  final Iterator authMethods=AuthenticationManager.authenticationMethodIterator();
  final String url=((AuthenticationMethod)authMethods.next()).loginPageURL(ContextUtil.obtainContext(objectModel),httpRequest,httpResponse);
  if (authMethods.hasNext()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (ConfigurationManager.getBooleanProperty("String_Node_Str")) {
    if (!httpRequest.isSecure()) {
      StringBuffer location=new StringBuffer("String_Node_Str");
      location.append(ConfigurationManager.getProperty("String_Node_Str")).append(url).append(httpRequest.getQueryString() == null ? "String_Node_Str" : ("String_Node_Str" + httpRequest.getQueryString()));
      httpResponse.sendRedirect(location.toString());
    }
  }
 else {
    httpResponse.sendRedirect(url);
  }
  return new HashMap();
}

Fixed version (ground truth):
public Map act(Redirector redirector,SourceResolver resolver,Map objectModel,String source,Parameters parameters) throws Exception {
  final HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
  final HttpServletRequest httpRequest=(HttpServletRequest)objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);
  final Iterator authMethods=AuthenticationManager.authenticationMethodIterator();
  final String url=((AuthenticationMethod)authMethods.next()).loginPageURL(ContextUtil.obtainContext(objectModel),httpRequest,httpResponse);
  if (authMethods.hasNext()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (ConfigurationManager.getBooleanProperty("String_Node_Str")) {
    if (!httpRequest.isSecure()) {
      StringBuffer location=new StringBuffer("String_Node_Str");
      location.append(ConfigurationManager.getProperty("String_Node_Str")).append(url).append(httpRequest.getQueryString() == null ? "String_Node_Str" : ("String_Node_Str" + httpRequest.getQueryString()));
      httpResponse.sendRedirect(location.toString());
    }
 else {
      httpResponse.sendRedirect(url);
    }
  }
 else {
    httpResponse.sendRedirect(url);
  }
  return new HashMap();
}
Program: 52499
Project: 52499
Buggy source:
/** 
 * Return a normalized focus value. If there is no normalization that can be performed, return the focus value that is passed in.
 * @param value a focus value to normalize
 * @return  the normalized focus value
 * @throws BrowseException
 */
private String normalizeJumpToValue(String value) throws BrowseException {
  if (scope.hasJumpToValue()) {
    return BrowseOrder.makeSortString(scope.getJumpToValue(),scope.setJumpToValueLang(),scope.getBrowseIndex().getDataType());
  }
  return value;
}

Fixed version (ground truth):
/** 
 * Return a normalized focus value. If there is no normalization that can be performed, return the focus value that is passed in.
 * @param value a focus value to normalize
 * @return  the normalized focus value
 * @throws BrowseException
 */
private String normalizeJumpToValue(String value) throws BrowseException {
  if (scope.hasJumpToValue()) {
    return BrowseOrder.makeSortString(scope.getJumpToValue(),scope.setJumpToValueLang(),scope.getBrowseIndex().getDataType());
  }
 else   if (scope.hasStartsWith()) {
    return BrowseOrder.makeSortString(scope.getStartsWith(),null,scope.getBrowseIndex().getDataType());
  }
  return value;
}
Program: 52501
Project: 52501
Buggy source:
/** 
 * Load Submission Configuration for a specific user interface(UI). The submission configuration file name is formatted as follows: item-submission-UIName.xml <P> E.g. for a value of "XMLUI", uses the config file named item-submission-XMLUI.xml
 * @param UIName the name of the UI to load the Submission configuration for
 */
public SubmissionConfigReader(String UIName) throws ServletException {
  buildInputs(configDir + SUBMIT_DEF_FILE_PREFIX + "String_Node_Str"+ UIName+ SUBMIT_DEF_FILE_SUFFIX);
}

Fixed version (ground truth):
/** 
 * Load Submission Configuration for a specific user interface(UI). The submission configuration file name is formatted as follows: item-submission-UIName.xml <P> E.g. for a value of "XMLUI", uses the config file named item-submission-XMLUI.xml
 * @param UIName the name of the UI to load the Submission configuration for
 */
public SubmissionConfigReader(String UIName) throws ServletException {
  this.UIName=UIName;
  buildInputs(configDir + SUBMIT_DEF_FILE_PREFIX + "String_Node_Str"+ UIName+ SUBMIT_DEF_FILE_SUFFIX);
}
Program: 52504
Project: 52504
Buggy source:
/** 
 * A sanity check that ensures a given element and qualifier are unique within a given schema. The check happens in code as we cannot use a database constraint.
 * @param context dspace context
 * @param schemaID
 * @param element
 * @param qualifier
 * @return true if unique
 * @throws AuthorizeException
 * @throws SQLException
 * @throws IOException
 */
private boolean unique(Context context,int schemaID,String element,String qualifier) throws IOException, SQLException, AuthorizeException {
  Connection con=context.getDBConnection();
  TableRow reg=DatabaseManager.row("String_Node_Str");
  String query="String_Node_Str" + reg.getTable() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  PreparedStatement statement=con.prepareStatement(query);
  statement.setInt(1,schemaID);
  statement.setInt(2,fieldID);
  statement.setString(3,element);
  statement.setString(4,qualifier);
  ResultSet rs=statement.executeQuery();
  int count=0;
  if (rs.next()) {
    count=rs.getInt(1);
  }
  return (count == 0);
}

Fixed version (ground truth):
/** 
 * A sanity check that ensures a given element and qualifier are unique within a given schema. The check happens in code as we cannot use a database constraint.
 * @param context dspace context
 * @param schemaID
 * @param element
 * @param qualifier
 * @return true if unique
 * @throws AuthorizeException
 * @throws SQLException
 * @throws IOException
 */
private boolean unique(Context context,int schemaID,String element,String qualifier) throws IOException, SQLException, AuthorizeException {
  Connection con=context.getDBConnection();
  TableRow reg=DatabaseManager.row("String_Node_Str");
  String qualifierClause="String_Node_Str";
  if (qualifier == null) {
    qualifierClause="String_Node_Str";
  }
 else {
    qualifierClause="String_Node_Str";
  }
  String query="String_Node_Str" + reg.getTable() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ qualifierClause;
  PreparedStatement statement=con.prepareStatement(query);
  statement.setInt(1,schemaID);
  statement.setInt(2,fieldID);
  statement.setString(3,element);
  if (qualifier != null) {
    statement.setString(4,qualifier);
  }
  ResultSet rs=statement.executeQuery();
  int count=0;
  if (rs.next()) {
    count=rs.getInt(1);
  }
  return (count == 0);
}
Program: 52505
Project: 52505
Buggy source:
/** 
 * Return true if there are more rows, false otherwise
 * @return - true if there are more rows, false otherwise
 * @exception SQLException -If a database error occurs while fetching values
 */
public boolean hasNext() throws SQLException {
  if (results == null) {
    return false;
  }
  if (hasAdvanced) {
    return hasNext;
  }
  hasAdvanced=true;
  hasNext=results.next();
  if (!hasNext) {
    close();
  }
  return hasNext;
}

Fixed version (ground truth):
/** 
 * Return true if there are more rows, false otherwise
 * @return - true if there are more rows, false otherwise
 * @exception SQLException -If a database error occurs while fetching values
 */
public boolean hasNext() throws SQLException {
  if (results == null) {
    close();
    return false;
  }
  if (hasAdvanced) {
    return hasNext;
  }
  hasAdvanced=true;
  hasNext=results.next();
  if (!hasNext) {
    close();
  }
  return hasNext;
}
Program: 52506
Project: 52506
Buggy source:
/** 
 * Close the Iterator and release any associated resources
 */
public void close(){
  try {
    results.close();
    if (results != null)     results.close();
  }
 catch (  SQLException sqle) {
  }
  try {
    if (statemt != null)     statemt.close();
    statemt=null;
  }
 catch (  SQLException sqle) {
  }
}

Fixed version (ground truth):
/** 
 * Close the Iterator and release any associated resources
 */
public void close(){
  try {
    if (results != null) {
      results.close();
      results=null;
    }
  }
 catch (  SQLException sqle) {
  }
  try {
    if (statemt != null) {
      statemt.close();
      statemt=null;
    }
  }
 catch (  SQLException sqle) {
  }
}
Program: 52507
Project: 52507
Buggy source:
/** 
 * get Set of Integers all of the group memberships for an eperson
 * @param c
 * @param e
 * @return Set of Integer groupIDs
 * @throws SQLException
 */
public static Set allMemberGroupIDs(Context c,EPerson e) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str",e.getID());
  Set groupIDs=new HashSet();
  while (tri.hasNext()) {
    TableRow row=tri.next();
    int childID=row.getIntColumn("String_Node_Str");
    groupIDs.add(new Integer(childID));
  }
  tri.close();
  String groupQuery="String_Node_Str";
  Iterator i=groupIDs.iterator();
  Object[] parameters=new Object[groupIDs.size()];
  int idx=0;
  while (i.hasNext()) {
    int groupID=((Integer)i.next()).intValue();
    parameters[idx++]=new Integer(groupID);
    groupQuery+="String_Node_Str";
    if (i.hasNext())     groupQuery+="String_Node_Str";
  }
  if ("String_Node_Str".equals(groupQuery)) {
    return groupIDs;
  }
  tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str" + groupQuery,parameters);
  while (tri.hasNext()) {
    TableRow row=tri.next();
    int parentID=row.getIntColumn("String_Node_Str");
    groupIDs.add(new Integer(parentID));
  }
  tri.close();
  return groupIDs;
}

Fixed version (ground truth):
/** 
 * get Set of Integers all of the group memberships for an eperson
 * @param c
 * @param e
 * @return Set of Integer groupIDs
 * @throws SQLException
 */
public static Set allMemberGroupIDs(Context c,EPerson e) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str",e.getID());
  Set groupIDs=new HashSet();
  while (tri.hasNext()) {
    TableRow row=tri.next();
    int childID=row.getIntColumn("String_Node_Str");
    groupIDs.add(new Integer(childID));
  }
  tri.close();
  Group[] specialGroups=c.getSpecialGroups();
  for (int j=0; j < specialGroups.length; j++)   groupIDs.add(new Integer(specialGroups[j].getID()));
  String groupQuery="String_Node_Str";
  Iterator i=groupIDs.iterator();
  Object[] parameters=new Object[groupIDs.size()];
  int idx=0;
  while (i.hasNext()) {
    int groupID=((Integer)i.next()).intValue();
    parameters[idx++]=new Integer(groupID);
    groupQuery+="String_Node_Str";
    if (i.hasNext())     groupQuery+="String_Node_Str";
  }
  if ("String_Node_Str".equals(groupQuery)) {
    return groupIDs;
  }
  tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str" + groupQuery,parameters);
  while (tri.hasNext()) {
    TableRow row=tri.next();
    int parentID=row.getIntColumn("String_Node_Str");
    groupIDs.add(new Integer(parentID));
  }
  tri.close();
  return groupIDs;
}
Program: 52509
Project: 52509
Buggy source:
/** 
 * Retrieve all e-person records from the database, sorted by a particular field. Fields are: <<<<<<< EPerson.java <ul> <li><code>ID</code></li> <li><code>LASTNAME</code></li> <li><code>EMAIL</code></li> <li><code>NETID</code></li> </ul> ======= <UL> <LI><code>ID</code></LI> <LI><code>LASTNAME</code></LI> <LI><code>EMAIL</code></LI> <LI><code>NETID</code></LI> </UL>
 * @return array of EPerson objects >>>>>>> 1.27
 */
public static EPerson[] findAll(Context context,int sortField) throws SQLException {
  String s;
switch (sortField) {
case ID:
    s="String_Node_Str";
  break;
case EMAIL:
s="String_Node_Str";
break;
case NETID:
s="String_Node_Str";
break;
default :
s="String_Node_Str";
}
TableRowIterator rows=DatabaseManager.query(context,"String_Node_Str" + s);
List epeopleRows=rows.toList();
EPerson[] epeople=new EPerson[epeopleRows.size()];
for (int i=0; i < epeopleRows.size(); i++) {
TableRow row=(TableRow)epeopleRows.get(i);
EPerson fromCache=(EPerson)context.fromCache(EPerson.class,row.getIntColumn("String_Node_Str"));
if (fromCache != null) {
epeople[i]=fromCache;
}
 else {
epeople[i]=new EPerson(context,row);
}
}
return epeople;
}

Fixed version (ground truth):
/** 
 * Retrieve all e-person records from the database, sorted by a particular field. Fields are: <ul> <li><code>ID</code></li> <li><code>LASTNAME</code></li> <li><code>EMAIL</code></li> <li><code>NETID</code></li> </ul>
 * @return array of EPerson objects
 */
public static EPerson[] findAll(Context context,int sortField) throws SQLException {
  String s;
switch (sortField) {
case ID:
    s="String_Node_Str";
  break;
case EMAIL:
s="String_Node_Str";
break;
case NETID:
s="String_Node_Str";
break;
default :
s="String_Node_Str";
}
TableRowIterator rows=DatabaseManager.query(context,"String_Node_Str" + s);
List epeopleRows=rows.toList();
EPerson[] epeople=new EPerson[epeopleRows.size()];
for (int i=0; i < epeopleRows.size(); i++) {
TableRow row=(TableRow)epeopleRows.get(i);
EPerson fromCache=(EPerson)context.fromCache(EPerson.class,row.getIntColumn("String_Node_Str"));
if (fromCache != null) {
epeople[i]=fromCache;
}
 else {
epeople[i]=new EPerson(context,row);
}
}
return epeople;
}
Program: 52510
Project: 52510
Buggy source:
/** 
 * Prune the history records from the database.
 * @param interests set of results and the duration of time before they are removed from the database
 * @return number of bitstreams deleted
 */
public int prune(Map interests){
  Connection conn=null;
  try {
    conn=DatabaseManager.getConnection();
    long now=System.currentTimeMillis();
    int count=0;
    for (Iterator iter=interests.keySet().iterator(); iter.hasNext(); ) {
      String result=(String)iter.next();
      Long dur=(Long)interests.get(result);
      count+=deleteHistoryByDateAndCode(new Date(now - dur.longValue()),result,conn);
    }
    return count;
  }
 catch (  SQLException e) {
    LOG.error("String_Node_Str" + e.getMessage(),e);
    throw new RuntimeException("String_Node_Str" + e.getMessage(),e);
  }
 finally {
    DatabaseManager.freeConnection(conn);
  }
}

Fixed version (ground truth):
/** 
 * Prune the history records from the database.
 * @param interests set of results and the duration of time before they are removed from the database
 * @return number of bitstreams deleted
 */
public int prune(Map interests){
  Connection conn=null;
  try {
    conn=DatabaseManager.getConnection();
    long now=System.currentTimeMillis();
    int count=0;
    for (Iterator iter=interests.keySet().iterator(); iter.hasNext(); ) {
      String result=(String)iter.next();
      Long dur=(Long)interests.get(result);
      count+=deleteHistoryByDateAndCode(new Date(now - dur.longValue()),result,conn);
      conn.commit();
    }
    return count;
  }
 catch (  SQLException e) {
    LOG.error("String_Node_Str" + e.getMessage(),e);
    throw new RuntimeException("String_Node_Str" + e.getMessage(),e);
  }
 finally {
    DatabaseManager.freeConnection(conn);
  }
}
Program: 52511
Project: 52511
Buggy source:
private static boolean cacheMe(Class implClass){
  if (cacheMeCache.containsKey(implClass))   return ((Boolean)cacheMeCache.get(implClass)).booleanValue();
 else {
    boolean reusable=true;
    String key=REUSABLE_PREFIX + implClass.getName();
    if (ConfigurationManager.getProperty(key) != null)     reusable=ConfigurationManager.getBooleanProperty(key);
    cacheMeCache.put(implClass,new Boolean(reusable));
    return reusable;
  }
}

Fixed version (ground truth):
private static boolean cacheMe(Class implClass){
  if (cacheMeCache.containsKey(implClass)) {
    return ((Boolean)cacheMeCache.get(implClass)).booleanValue();
  }
 else {
    String key=REUSABLE_PREFIX + implClass.getName();
    boolean reusable=ConfigurationManager.getBooleanProperty(key,true);
    cacheMeCache.put(implClass,new Boolean(reusable));
    return reusable;
  }
}
Program: 52512
Project: 52512
Buggy source:
private static Object getAnonymousPlugin(String classname) throws PluginInstantiationException {
  try {
    Class pluginClass=Class.forName(classname);
    if (cacheMe(pluginClass)) {
      Object cached=anonymousInstanceCache.get(pluginClass);
      if (cached == null) {
        cached=pluginClass.newInstance();
        anonymousInstanceCache.put(pluginClass,cached);
      }
      return cached;
    }
 else     return pluginClass.newInstance();
  }
 catch (  ClassNotFoundException e) {
    throw new PluginInstantiationException("String_Node_Str",e);
  }
catch (  InstantiationException e) {
    throw new PluginInstantiationException(e);
  }
catch (  IllegalAccessException e) {
    throw new PluginInstantiationException(e);
  }
}

Fixed version (ground truth):
private static Object getAnonymousPlugin(String classname) throws PluginInstantiationException {
  try {
    Class pluginClass=Class.forName(classname);
    if (cacheMe(pluginClass)) {
      Object cached=anonymousInstanceCache.get(pluginClass);
      if (cached == null) {
        cached=pluginClass.newInstance();
        anonymousInstanceCache.put(pluginClass,cached);
      }
      return cached;
    }
 else     return pluginClass.newInstance();
  }
 catch (  ClassNotFoundException e) {
    throw new PluginInstantiationException("String_Node_Str" + e.toString(),e);
  }
catch (  InstantiationException e) {
    throw new PluginInstantiationException(e);
  }
catch (  IllegalAccessException e) {
    throw new PluginInstantiationException(e);
  }
}
Program: 52517
Project: 52517
Buggy source:
public void init(){
  String config=getServletContext().getInitParameter("String_Node_Str");
  ConfigurationManager.loadConfig(config);
  String log4jConfProp=ConfigurationManager.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
  String log4jConfXml=ConfigurationManager.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
  File xmlFile=new File(log4jConfXml);
  if (xmlFile.exists()) {
    try {
      DOMConfigurator.configure(xmlFile.toURL());
      log.info("String_Node_Str");
    }
 catch (    MalformedURLException e) {
      PropertyConfigurator.configure(log4jConfProp);
      log.error("String_Node_Str" + "String_Node_Str" + e);
    }
  }
 else {
    PropertyConfigurator.configure(log4jConfProp);
    log.info("String_Node_Str");
  }
}

Fixed version (ground truth):
public void init(){
  String config=getServletContext().getInitParameter("String_Node_Str");
  ConfigurationManager.loadConfig(config);
}
Program: 52518
Project: 52518
Buggy source:
/** 
 * Create a PreparedStatement to run the correct query for scope.
 * @param scope The Browse scope
 * @param subqueryValue If the focus is an item, this is its value in the browse index (its title, author, date, etc). Otherwise null.
 * @param after If true, create SQL to find the items after the focus. Otherwise create SQL to find the items before the focus.
 * @param isCount If true, create SQL to count the number of matches for the query. Otherwise just the query.
 * @return a prepared statement
 * @throws SQLException
 */
private static PreparedStatement createSql(BrowseScope scope,String subqueryValue,boolean after,boolean isCount) throws SQLException {
  String sqli=createSqlInternal(scope,subqueryValue,isCount);
  String sql=formatSql(scope,sqli,subqueryValue,after);
  PreparedStatement statement=createStatement(scope,sql);
  if (scope.hasFocus()) {
    String value=(subqueryValue != null) ? subqueryValue : (String)scope.getFocus();
    statement.setString(1,value);
    if (subqueryValue != null) {
      statement.setString(2,value);
    }
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + sql + "String_Node_Str");
  }
  return statement;
}

Fixed version (ground truth):
/** 
 * Create a PreparedStatement to run the correct query for scope.
 * @param scope The Browse scope
 * @param subqueryValue If the focus is an item, this is its value in the browse index (its title, author, date, etc). Otherwise null.
 * @param after If true, create SQL to find the items after the focus. Otherwise create SQL to find the items before the focus.
 * @param isCount If true, create SQL to count the number of matches for the query. Otherwise just the query.
 * @return a prepared statement
 * @throws SQLException
 */
private static PreparedStatement createSql(BrowseScope scope,String subqueryValue,boolean after,boolean isCount) throws SQLException {
  String sqli=createSqlInternal(scope,subqueryValue,isCount);
  String sql=formatSql(scope,sqli,subqueryValue,after);
  PreparedStatement statement=createStatement(scope,sql);
  if (scope.hasFocus()) {
    String value=subqueryValue;
    if (value == null && scope.getFocus() instanceof String) {
      value=(String)scope.getFocus();
    }
    statement.setString(1,value);
    if (subqueryValue != null) {
      statement.setString(2,value);
    }
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + sql + "String_Node_Str");
  }
  return statement;
}
Program: 52519
Project: 52519
Buggy source:
/** 
 * Create a list of the found history records.
 * @param history the list of history records to be iterated over.
 * @param osw the output stream writer to write to.
 * @throws IOException if io error occurs
 */
private void printHistoryRecords(List history,OutputStreamWriter osw) throws IOException {
  Iterator iter=history.iterator();
  while (iter.hasNext()) {
    ChecksumHistory historyInfo=(ChecksumHistory)iter.next();
    StringBuilder buf=new StringBuilder(1000);
    buf.append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getBitstreamId()).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(DATE_FORMAT_MAX.format(historyInfo.getProcessStartDate())).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(DATE_FORMAT_MAX.format(historyInfo.getProcessEndDate())).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getChecksumExpected()).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getChecksumCalculated()).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getResult()).append("String_Node_Str");
    buf.append("String_Node_Str");
    osw.write(buf.toString());
  }
}

Fixed version (ground truth):
/** 
 * Create a list of the found history records.
 * @param history the list of history records to be iterated over.
 * @param osw the output stream writer to write to.
 * @throws IOException if io error occurs
 */
private void printHistoryRecords(List history,OutputStreamWriter osw) throws IOException {
  Iterator iter=history.iterator();
  while (iter.hasNext()) {
    ChecksumHistory historyInfo=(ChecksumHistory)iter.next();
    StringBuffer buf=new StringBuffer(1000);
    buf.append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getBitstreamId()).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(DATE_FORMAT_MAX.format(historyInfo.getProcessStartDate())).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(DATE_FORMAT_MAX.format(historyInfo.getProcessEndDate())).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getChecksumExpected()).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getChecksumCalculated()).append("String_Node_Str");
    buf.append(msg("String_Node_Str")).append("String_Node_Str").append(historyInfo.getResult()).append("String_Node_Str");
    buf.append("String_Node_Str");
    osw.write(buf.toString());
  }
}
Program: 52521
Project: 52521
Buggy source:
/** 
 * Slightly convenient method that appends together a msg key and a class name together and retrieves the corresponding message from Messages.properties
 * @param msg final part of message key, omitting fully qualified class name
 * @param classname fully qualified class name.
 * @return Localized message
 */
public String getMessage(String msg,String classname){
  return messages.getString(new StringBuilder(50).append(classname).append("String_Node_Str").append(msg).toString());
}

Fixed version (ground truth):
/** 
 * <p> Convenience method to get localized messages in code. Usage will be of the form: - </p> <pre> I18N.message(&quot;my-key&quot;, this); </pre> <p> N.B. That this method uses the runtime type of the object, and hence should only be used in final classes. </p>
 * @param msg Key for the message, omitting the fully qualified class name
 * @param obj the calling object
 * @return Localized message 
 */
public String getMessage(String msg,Object obj){
  return getMessage(msg,obj.getClass());
}
Program: 52522
Project: 52522
Buggy source:
/** 
 * Return true if an index has changed
 * @param key
 * @return
 * @throws SQLException
 */
public static boolean indexHasChanged(BrowseScope key) throws SQLException {
  Context context=null;
  try {
    context=new Context();
    TableRow results=countAndMax(context,key);
    long count=-1;
    int max=-1;
    if (results != null) {
      count=results.getLongColumn("String_Node_Str");
      max=results.getIntColumn("String_Node_Str");
    }
    context.complete();
    if ((count == getCount(key)) && (max == getMaximum(key))) {
      return false;
    }
    setMaximum(key,max);
    setCount(key,count);
    return true;
  }
 catch (  SQLException sqle) {
    if (context != null) {
      context.abort();
    }
    throw sqle;
  }
}

Fixed version (ground truth):
/** 
 * Return true if an index has changed
 * @param key
 * @return
 * @throws SQLException
 */
public static boolean indexHasChanged(BrowseScope key) throws SQLException {
  Context context=null;
  try {
    context=new Context();
    TableRow results=countAndMax(context,key);
    long count=-1;
    int max=-1;
    if (results != null) {
      if ("String_Node_Str".equals(ConfigurationManager.getProperty("String_Node_Str"))) {
        count=results.getIntColumn("String_Node_Str");
      }
 else {
        count=results.getLongColumn("String_Node_Str");
      }
      max=results.getIntColumn("String_Node_Str");
    }
    context.complete();
    if ((count == getCount(key)) && (max == getMaximum(key))) {
      return false;
    }
    setMaximum(key,max);
    setCount(key,count);
    return true;
  }
 catch (  SQLException sqle) {
    if (context != null) {
      context.abort();
    }
    throw sqle;
  }
}
Program: 52524
Project: 52524
Buggy source:
/** 
 * counts items in this community
 * @return  total items
 */
public int countItems() throws SQLException {
  int collitems=0;
  int commitems=0;
  Collection[] cols=getCollections();
  if (cols.length > 0) {
    for (int j=0; j < cols.length; j++) {
      collitems=cols[j].countItems();
      commitems+=collitems;
    }
  }
  return commitems;
}

Fixed version (ground truth):
/** 
 * counts items in this community
 * @return  total items
 */
public int countItems() throws SQLException {
  int total=0;
  Collection[] cols=getCollections();
  for (int i=0; i < cols.length; i++) {
    total+=cols[i].countItems();
  }
  Community[] comms=getSubcommunities();
  for (int j=0; j < comms.length; j++) {
    total+=comms[j].countItems();
  }
  return total;
}
Program: 52527
Project: 52527
Buggy source:
private void replaceItems(Context c,Collection[] mycollections,String sourceDir,String mapFile) throws Exception {
  File d=new java.io.File(sourceDir);
  if (d == null) {
    System.out.println("String_Node_Str" + sourceDir);
    System.exit(1);
  }
  Map myhash=readMapFile(mapFile);
  Iterator i=myhash.keySet().iterator();
  ArrayList itemsToDelete=new ArrayList();
  while (i.hasNext()) {
    String newItemName=(String)i.next();
    String oldHandle=(String)myhash.get(newItemName);
    Item oldItem=null;
    Item newItem=null;
    if (oldHandle.indexOf('/') != -1) {
      System.out.println("String_Node_Str" + oldHandle);
      oldItem=(Item)HandleManager.resolveToObject(c,oldHandle);
    }
 else {
      oldItem=Item.find(c,Integer.parseInt(oldHandle));
    }
    newItem=addItem(c,mycollections,sourceDir,newItemName,null);
    itemsToDelete.add(oldItem);
  }
  i=itemsToDelete.iterator();
  while (i.hasNext()) {
    deleteItem(c,(Item)i.next());
  }
}

Fixed version (ground truth):
private void replaceItems(Context c,Collection[] mycollections,String sourceDir,String mapFile) throws Exception {
  File d=new java.io.File(sourceDir);
  if (d == null) {
    System.out.println("String_Node_Str" + sourceDir);
    System.exit(1);
  }
  Map myhash=readMapFile(mapFile);
  Iterator i=myhash.keySet().iterator();
  ArrayList itemsToDelete=new ArrayList();
  while (i.hasNext()) {
    String newItemName=(String)i.next();
    String oldHandle=(String)myhash.get(newItemName);
    Item oldItem=null;
    Item newItem=null;
    if (oldHandle.indexOf('/') != -1) {
      System.out.println("String_Node_Str" + oldHandle);
      oldItem=(Item)HandleManager.resolveToObject(c,oldHandle);
    }
 else {
      oldItem=Item.find(c,Integer.parseInt(oldHandle));
    }
    File handleFile=new File(sourceDir + File.separatorChar + newItemName+ File.separatorChar+ "String_Node_Str");
    PrintWriter handleOut=new PrintWriter(new FileWriter(handleFile,true));
    if (handleOut == null) {
      throw new Exception("String_Node_Str" + handleFile.getCanonicalPath());
    }
    handleOut.println(oldHandle);
    handleOut.close();
    deleteItem(c,oldItem);
    newItem=addItem(c,mycollections,sourceDir,newItemName,null);
  }
}
Program: 52528
Project: 52528
Buggy source:
/** 
 * Set the short description of the bitstream format
 * @param s the new short description
 */
public void setShortDescription(String s) throws SQLException {
  BitstreamFormat unknown=findUnknown(bfContext);
  if (unknown.getID() != getID())   bfRow.setColumn("String_Node_Str",s);
}

Fixed version (ground truth):
/** 
 * Set the short description of the bitstream format
 * @param s the new short description
 */
public void setShortDescription(String s) throws SQLException {
  BitstreamFormat unknown=null;
  ;
  try {
    unknown=findUnknown(bfContext);
  }
 catch (  IllegalStateException e) {
  }
  if (unknown == null || unknown.getID() != getID()) {
    bfRow.setColumn("String_Node_Str",s);
  }
}
Program: 52529
Project: 52529
Buggy source:
public String buildHTTPQuery(HttpServletRequest request){
  String querystring="String_Node_Str";
  HashMap queryHash=buildQueryHash(request);
  Iterator i=queryHash.keySet().iterator();
  while (i.hasNext()) {
    String key=(String)i.next();
    String value=(String)queryHash.get(key);
    querystring=querystring + "String_Node_Str" + key+ "String_Node_Str"+ value;
  }
  return (querystring);
}

Fixed version (ground truth):
public String buildHTTPQuery(HttpServletRequest request) throws UnsupportedEncodingException {
  String querystring="String_Node_Str";
  HashMap queryHash=buildQueryHash(request);
  Iterator i=queryHash.keySet().iterator();
  while (i.hasNext()) {
    String key=(String)i.next();
    String value=(String)queryHash.get(key);
    querystring=querystring + "String_Node_Str" + key+ "String_Node_Str"+ URLEncoder.encode(value,Constants.DEFAULT_ENCODING);
  }
  return (querystring);
}
Program: 52533
Project: 52533
Buggy source:
private void getThumbSettings(){
  showThumbs=ConfigurationManager.getBooleanProperty("String_Node_Str");
  if (showThumbs) {
    thumbItemListMaxHeight=ConfigurationManager.getIntProperty("String_Node_Str");
    thumbItemListMaxWidth=ConfigurationManager.getIntProperty("String_Node_Str");
    thumbMaxHeight=ConfigurationManager.getIntProperty("String_Node_Str");
    thumbMaxWidth=ConfigurationManager.getIntProperty("String_Node_Str");
  }
}

Fixed version (ground truth):
private void getThumbSettings(){
  showThumbs=ConfigurationManager.getBooleanProperty("String_Node_Str");
  if (showThumbs) {
    thumbItemListMaxHeight=ConfigurationManager.getIntProperty("String_Node_Str");
    if (thumbItemListMaxHeight == 0) {
      thumbItemListMaxHeight=ConfigurationManager.getIntProperty("String_Node_Str");
    }
    thumbItemListMaxWidth=ConfigurationManager.getIntProperty("String_Node_Str");
    if (thumbItemListMaxWidth == 0) {
      thumbItemListMaxWidth=ConfigurationManager.getIntProperty("String_Node_Str");
    }
  }
}
Program: 52534
Project: 52534
Buggy source:
/** 
 * Attempt to filter a bitstream An exception will be thrown if the media filter class cannot be instantiated, exceptions from filtering will be logged to STDOUT and swallowed.
 */
public static void filterBitstream(Context c,Item myItem,Bitstream myBitstream) throws Exception {
  Integer formatID=new Integer(myBitstream.getFormat().getID());
  if (filterNames.containsKey(formatID)) {
    if (!filterCache.containsKey(formatID)) {
      Class f=Class.forName((String)filterNames.get(formatID));
      MediaFilter myFilter=(MediaFilter)f.newInstance();
      filterCache.put(formatID,myFilter);
    }
    MediaFilter myFilter=(MediaFilter)filterCache.get(formatID);
    try {
      myFilter.processBitstream(c,myItem,myBitstream);
      myItem.update();
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str" + myBitstream.getID() + "String_Node_Str"+ e);
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Attempt to filter a bitstream An exception will be thrown if the media filter class cannot be instantiated, exceptions from filtering will be logged to STDOUT and swallowed.
 */
public static void filterBitstream(Context c,Item myItem,Bitstream myBitstream) throws Exception {
  Integer formatID=new Integer(myBitstream.getFormat().getID());
  if (filterNames.containsKey(formatID)) {
    if (!filterCache.containsKey(formatID)) {
      Class f=Class.forName((String)filterNames.get(formatID));
      MediaFilter myFilter=(MediaFilter)f.newInstance();
      filterCache.put(formatID,myFilter);
    }
    MediaFilter myFilter=(MediaFilter)filterCache.get(formatID);
    try {
      if (myFilter.processBitstream(c,myItem,myBitstream)) {
        myItem.update();
      }
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str" + myBitstream.getID() + "String_Node_Str"+ e);
      e.printStackTrace();
    }
  }
}