if (isRegisteredBitstream(row.getStringColumn("internal_id"))) { continue; }
    public static void cleanup() throws SQLException, IOException    {        Context context = null;        try        {            context = new Context();            String myQuery = null;            if ("oracle".equals(ConfigurationManager.getProperty("db.name")))            {                myQuery = "select * from Bitstream where deleted = 1";            }            else            {                // postgres                myQuery = "select * from Bitstream where deleted = 't'";            }            List storage = DatabaseManager.query(context, "Bitstream", myQuery)                    .toList();            for (Iterator iterator = storage.iterator(); iterator.hasNext();)            {                TableRow row = (TableRow) iterator.next();                int bid = row.getIntColumn("bitstream_id");                File file = getFile(row);                // Make sure entries which do not exist are removed                if (file == null)                {                    DatabaseManager.delete(context, "Bitstream", bid);                    continue;                }                // This is a small chance that this is a file which is                // being stored -- get it next time.                if (isRecent(file))                {                    continue;                }                DatabaseManager.delete(context, "Bitstream", bid);                boolean success = file.delete();                if (log.isDebugEnabled())                {                    log.debug("Deleted bitstream " + bid + " (file "                            + file.getAbsolutePath() + ") with result "                            + success);                }                deleteParents(file);            }            context.complete();        }        // Aborting will leave the DB objects around, even if the        // bitstreams are deleted. This is OK; deleting them next        // time around will be a no-op.        catch (SQLException sqle)        {            context.abort();            throw sqle;        }        catch (IOException ioe)        {            context.abort();            throw ioe;        }    }