bitstreamName = bitstreamName.trim();
    private void processContentsFile(Context c, Item i, String path,            String filename) throws SQLException, IOException,            AuthorizeException    {        String contentspath = path + File.separatorChar + filename;        String line = "";        System.out.println("\tProcessing contents file: " + contentspath);        BufferedReader is = null;        try        {            is = new BufferedReader(new FileReader(contentspath));            while ((line = is.readLine()) != null)            {                if ("".equals(line.trim()))                {                    continue;                }            	//	1) registered into dspace (leading -r)            	//  2) imported conventionally into dspace (no -r)            	if (line.trim().startsWith("-r "))            	{            	    // line should be one of these two:            	    // -r -s n -f filepath            	    // -r -s n -f filepath\tbundle:bundlename            	    // where             	    //		n is the assetstore number            	    //  	filepath is the path of the file to be registered            	    //  	bundlename is an optional bundle name            	    String sRegistrationLine = line.trim();            	    int iAssetstore = -1;            	    String sFilePath = null;            	    String sBundle = null;                    StringTokenizer tokenizer =                         	new StringTokenizer(sRegistrationLine);                    while (tokenizer.hasMoreTokens())                    {                        String sToken = tokenizer.nextToken();                         if (sToken.equals("-r"))                        {                            continue;                        }                        else if (sToken.equals("-s") && tokenizer.hasMoreTokens())                        {                            try                            {                                iAssetstore =                                     Integer.parseInt(tokenizer.nextToken());                            }                             catch (NumberFormatException e)                            {                                // ignore - iAssetstore remains -1                            }                        }                        else if (sToken.equals("-f") && tokenizer.hasMoreTokens())                        {                            sFilePath = tokenizer.nextToken();                        }                        else if (sToken.startsWith("bundle:"))                        {                            sBundle = sToken.substring(7);                        }                        else                         {                            // unrecognized token - should be no problem                        }                    } // while                    if (iAssetstore == -1 || sFilePath == null)                     {                        System.out.println("\tERROR: invalid contents file line");                        System.out.println("\t\tSkipping line: "                                + sRegistrationLine);                        continue;                    }                    registerBitstream(c, i, iAssetstore, sFilePath, sBundle);                    System.out.println("\tRegistering Bitstream: " + sFilePath                            + "\tAssetstore: " + iAssetstore                             + "\tBundle: " + sBundle);                    continue;				// process next line in contents file            	}            	// look for a bundle name                String bundleMarker = "\tbundle:";                int markerIndex = line.indexOf(bundleMarker);                if (markerIndex == -1)                {                    // no bundle found                    processContentFileEntry(c, i, path, line, null);                    System.out.println("\tBitstream: " + line);                }                else                {                    // found bundle                    String bundleName = line.substring(markerIndex                            + bundleMarker.length());                    String bitstreamName = line.substring(0, markerIndex);                    processContentFileEntry(c, i, path, bitstreamName,                            bundleName);                    System.out.println("\tBitstream: " + bitstreamName                            + "\tBundle: " + bundleName);                }            }        }        finally        {            if (is != null)            {                is.close();            }        }    }