filterFormats.put(filterName, Arrays.asList(formats.split(",")));
filterFormats.put(filterName, Arrays.asList(formats.split(",[\\s]*")));
    public static void main(String[] argv) throws Exception    {        // set headless for non-gui workstations        System.setProperty("java.awt.headless", "true");        // create an options object and populate it        CommandLineParser parser = new PosixParser();        Options options = new Options();                options.addOption("v", "verbose", false,                "print all extracted text and other details to STDOUT");        options.addOption("f", "force", false,                "force all bitstreams to be processed");        options.addOption("n", "noindex", false,                "do NOT re-create search index after filtering bitstreams");        options.addOption("i", "identifier", true,        		"ONLY process bitstreams belonging to identifier");        options.addOption("m", "maximum", true,				"process no more than maximum items");        options.addOption("h", "help", false, "help");        CommandLine line = parser.parse(options, argv);        if (line.hasOption('h'))        {            HelpFormatter myhelp = new HelpFormatter();            myhelp.printHelp("MediaFilter\n", options);            System.exit(0);        }        if (line.hasOption('v'))        {            isVerbose = true;        }        if (line.hasOption('n'))        {            createIndex = false;        }        if (line.hasOption('f'))        {            isForce = true;        }                if (line.hasOption('i'))        {        	identifier = line.getOptionValue('i');        }                if (line.hasOption('m'))        {        	max2Process = Integer.parseInt(line.getOptionValue('m'));        	if (max2Process <= 1)        	{        		System.out.println("Invalid maximum value '" +         				     		line.getOptionValue('m') + "' - ignoring");        		max2Process = Integer.MAX_VALUE;        	}        }        // set up filters        filterClasses =        	(MediaFilter[])PluginManager.getPluginSequence(MediaFilter.class);        for (int i = 0; i < filterClasses.length; i++)        {        	String filterName = filterClasses[i].getClass().getName();        	String formats = ConfigurationManager.getProperty(         					"filter." + filterName + ".inputFormats");        	if (formats != null)        	{        		filterFormats.put(filterName, Arrays.asList(formats.split(",")));        	}        }                Context c = null;        try        {            c = new Context();            // have to be super-user to do the filtering            c.setIgnoreAuthorization(true);            // now apply the filters            if (identifier == null)            {            	applyFiltersAllItems(c);            }            else  // restrict application scope to identifier            {            	DSpaceObject dso = HandleManager.resolveToObject(c, identifier);            	if (dso == null)            	{            		throw new IllegalArgumentException("Cannot resolve "                                + identifier + " to a DSpace object");            	}            	            	switch (dso.getType())            	{            		case Constants.COMMUNITY:            						applyFiltersCommunity(c, (Community)dso);            						break;					            		case Constants.COLLECTION:            						applyFiltersCollection(c, (Collection)dso);            						break;						            		case Constants.ITEM:            						applyFiltersItem(c, (Item)dso);            						break;            	}            }                      // create search index?            if (createIndex)            {                System.out.println("Creating search index:");                DSIndexer.createIndex(c);            }            c.complete();            c = null;        }        finally        {            if (c != null)            {                c.abort();            }        }    }