Commits

Kevin A. Archie  committed dd4dd47

more findbugs-induced cleanup

  • Participants
  • Parent commits 68425ab

Comments (0)

Files changed (9)

File src/main/java/org/nrg/ecat/EcatSession.java

+/**
+ * Copyright (c) 2009 Washington University
+ */
+package org.nrg.ecat;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.netbeans.spi.wizard.ResultProgressHandle;
+import org.netbeans.spi.wizard.Summary;
+import org.nrg.net.HttpURLConnectionProcessor;
+import org.nrg.net.RestServer;
+import org.nrg.net.StringResponseProcessor;
+import org.nrg.upload.data.Project;
+import org.nrg.upload.data.Session;
+import org.nrg.upload.data.SessionVariable;
+import org.nrg.upload.data.Subject;
+import org.nrg.upload.ui.AssignSessionVariablesPage;
+import org.nrg.upload.ui.SelectProjectPage;
+import org.nrg.upload.ui.SelectSubjectPage;
+import org.nrg.upload.ui.UploadResultPanel;
+import org.nrg.xnat.XnatVariable;
+
+/**
+ * @author Kevin A. Archie <karchie@npg.wustl.edu>
+ *
+ */
+public final class EcatSession implements Session {
+	private static final String URL_ENCODE_SCHEME = "UTF-8";
+	private static final String FORMAT = "ECAT";
+	private static final String MODALITY = "PET";
+	
+	private final Logger logger = Logger.getLogger(EcatSession.class);
+	private final MatrixDataFile first;
+	private final Collection<MatrixDataFile> data;
+	private long size = 0;
+	
+	@SuppressWarnings("unchecked")
+	public EcatSession(final Collection<MatrixDataFile> files) {
+		final List<MatrixDataFile> list = new ArrayList<MatrixDataFile>(files);
+		Collections.sort(list);
+		this.first = files.isEmpty() ? null : list.get(0);
+		this.data = Collections.unmodifiableCollection(list);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getAccession()
+	 */
+	public String getAccession() { return null; }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getDateTime()
+	 */
+	public Date getDateTime() { return first.getDate(); }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getDescription()
+	 */
+	public String getDescription() { return first.getDescription(); }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getFileCount()
+	 */
+	public int getFileCount() { return data.size(); }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getFormat()
+	 */
+	public String getFormat() { return FORMAT; }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getID()
+	 */
+	public String getID() { return first.getPatientID(); }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getModalities()
+	 */
+	public Set<String> getModalities() { return Collections.singleton(MODALITY); }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getScanCount()
+	 */
+	public int getScanCount() { return data.size(); }
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getSize()
+	 */
+	public long getSize() {
+		if (0 == size) {
+			for (final MatrixDataFile f : data){
+				size += f.getSize();
+			}
+		}
+		return size;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#getVariables(java.util.Map)
+	 */
+	public List<SessionVariable> getVariables(Map<?,?> params) {
+		return Collections.emptyList();
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.nrg.upload.data.Session#uploadTo(java.util.Map, org.netbeans.spi.wizard.ResultProgressHandle)
+	 */
+	public boolean uploadTo(final Map<?,?> params, final ResultProgressHandle progress) {
+		if (data.isEmpty()) {
+			progress.failed("No ECAT files available to upload", true);
+			return false;
+		}
+		
+		final Project project = (Project)params.get(SelectProjectPage.PRODUCT_NAME);
+		final Subject subject = (Subject)params.get(SelectSubjectPage.PRODUCT_NAME);
+		final SessionVariable session = (SessionVariable)params.get("session");
+		
+		final RestServer xnat = project.getRestServer();
+		
+		final String sessionLabel = session.getValue();
+		progress.setBusy("Creating session " + sessionLabel);
+		final String path = String.format("REST/projects/%s/subjects/%s/experiments/%s",
+				project, subject, sessionLabel);
+		
+		// create session
+		final String sessionID;
+		try {
+			final StringResponseProcessor processor = new StringResponseProcessor();
+			xnat.doPut(path + "?xsiType=xnat:petSessionData", processor);
+			sessionID = processor.toString();
+		} catch (Exception e) {
+			e.printStackTrace();
+			progress.failed(e.getMessage(), true);	// TODO: try again?
+			return false;
+		}
+
+		final Map<File,Exception> failures = new LinkedHashMap<File,Exception>();
+		
+		// add scans to session, and the data file to each scan
+		int i = 0;
+		final int size = data.size();
+		for (final MatrixDataFile mdf : data) {
+			try {
+				final String scan = String.format("%s/scans/%d", path, ++i);
+				progress.setBusy(String.format("Creating scan %d/%d", i, size));
+				xnat.doPut(scan + "?xsiType=xnat:petScanData");
+				final File f = mdf.getFile();
+				progress.setProgress(String.format("Uploading scan %d/%d", i, data.size()),
+						i - 1, data.size());
+				final HttpURLConnectionProcessor processor = new ModifyingUploadProcessor(f,
+						progress, project.toString(), subject.getLabel(), session.getValue());
+				xnat.doPut(String.format("%s/files/%s?inbody=true&format=ECAT&content=RAW",
+						scan, f.getName()), processor);
+			} catch (Exception e) {	// TODO: retry?
+				failures.put(mdf.getFile(), e);
+			}
+		}
+		
+		if (!failures.isEmpty()) {
+			for (final Map.Entry<File,Exception> me : failures.entrySet()) {
+				System.out.println(me.getKey() + " failed: ");
+				me.getValue().printStackTrace();
+			}
+			progress.failed("Some files failed to upload", true);	// TODO: better
+			return false;
+		}
+		
+		// Commit session
+		try {
+			progress.setBusy(String.format("Committing session %s (%s)", sessionLabel, sessionID));
+			xnat.doPut(path + "?pullDataFromHeaders=true");
+			
+			final Map<String,String> result = Collections.singletonMap(UploadResultPanel.URL,
+					String.format("%s/REST/experiments/%s?format=html", xnat.getURL(), sessionID));
+			final UploadResultPanel urp = new UploadResultPanel(session.getValue(), failures, result);
+			if (urp.isSuccessful()) {
+				final StringBuilder setValuesURL = new StringBuilder(path);
+				boolean paramsAdded = false;
+				final Collection<?> vars = (Collection<?>)params.get(AssignSessionVariablesPage.PRODUCT_NAME);
+				if (null == vars) {
+					logger.error("session variables not assigned: " + params);
+				} else {
+				for (final Object v : vars) {
+					logger.trace("checking session variable " + v);
+					if (v instanceof XnatVariable) {
+						if (paramsAdded) {
+							setValuesURL.append("&");
+						} else {
+							setValuesURL.append("?");
+							paramsAdded = true;
+						}
+						final XnatVariable xv = (XnatVariable)v;
+						setValuesURL.append(xv.getFieldPath());
+						setValuesURL.append("=");
+						setValuesURL.append(URLEncoder.encode(xv.getValue(), URL_ENCODE_SCHEME));
+					}
+				}
+				}
+				if (paramsAdded) {
+					logger.trace("Setting variables: " + setValuesURL);
+					xnat.doPut(setValuesURL.toString());
+				}
+				
+				progress.finished(Summary.create(urp, null));
+				return true;
+			} else {
+				progress.failed("Some files failed to upload", false);	// TODO: do better
+				return false;
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+			progress.failed(e.getMessage(), true);	// TODO: try again?
+			return false;
+		}
+	}
+}

File src/main/java/org/nrg/ecat/Session.java

-/**
- * Copyright (c) 2009 Washington University
- */
-package org.nrg.ecat;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import org.netbeans.spi.wizard.ResultProgressHandle;
-import org.netbeans.spi.wizard.Summary;
-import org.nrg.net.HttpURLConnectionProcessor;
-import org.nrg.net.RestServer;
-import org.nrg.net.StringResponseProcessor;
-import org.nrg.upload.data.Project;
-import org.nrg.upload.data.SessionVariable;
-import org.nrg.upload.data.Subject;
-import org.nrg.upload.ui.AssignSessionVariablesPage;
-import org.nrg.upload.ui.SelectProjectPage;
-import org.nrg.upload.ui.SelectSubjectPage;
-import org.nrg.upload.ui.UploadResultPanel;
-import org.nrg.xnat.XnatVariable;
-
-/**
- * @author Kevin A. Archie <karchie@npg.wustl.edu>
- *
- */
-public final class Session implements org.nrg.upload.data.Session {
-	private static final String URL_ENCODE_SCHEME = "UTF-8";
-	private static final String FORMAT = "ECAT";
-	private static final String MODALITY = "PET";
-	
-	private final Logger logger = Logger.getLogger(Session.class);
-	private final MatrixDataFile first;
-	private final Collection<MatrixDataFile> data;
-	private long size = 0;
-	
-	@SuppressWarnings("unchecked")
-	public Session(final Collection<MatrixDataFile> files) {
-		final List<MatrixDataFile> list = new ArrayList<MatrixDataFile>(files);
-		Collections.sort(list);
-		this.first = files.isEmpty() ? null : list.get(0);
-		this.data = Collections.unmodifiableCollection(list);
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getAccession()
-	 */
-	public String getAccession() { return null; }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getDateTime()
-	 */
-	public Date getDateTime() { return first.getDate(); }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getDescription()
-	 */
-	public String getDescription() { return first.getDescription(); }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getFileCount()
-	 */
-	public int getFileCount() { return data.size(); }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getFormat()
-	 */
-	public String getFormat() { return FORMAT; }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getID()
-	 */
-	public String getID() { return first.getPatientID(); }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getModalities()
-	 */
-	public Set<String> getModalities() { return Collections.singleton(MODALITY); }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getScanCount()
-	 */
-	public int getScanCount() { return data.size(); }
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getSize()
-	 */
-	public long getSize() {
-		if (0 == size) {
-			for (final MatrixDataFile f : data){
-				size += f.getSize();
-			}
-		}
-		return size;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#getVariables(java.util.Map)
-	 */
-	public List<SessionVariable> getVariables(Map<?,?> params) {
-		return Collections.emptyList();
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.nrg.upload.data.Session#uploadTo(java.util.Map, org.netbeans.spi.wizard.ResultProgressHandle)
-	 */
-	public boolean uploadTo(final Map<?,?> params, final ResultProgressHandle progress) {
-		if (data.isEmpty()) {
-			progress.failed("No ECAT files available to upload", true);
-			return false;
-		}
-		
-		final Project project = (Project)params.get(SelectProjectPage.PRODUCT_NAME);
-		final Subject subject = (Subject)params.get(SelectSubjectPage.PRODUCT_NAME);
-		final SessionVariable session = (SessionVariable)params.get("session");
-		
-		final RestServer xnat = project.getRestServer();
-		
-		final String sessionLabel = session.getValue();
-		progress.setBusy("Creating session " + sessionLabel);
-		final String path = String.format("REST/projects/%s/subjects/%s/experiments/%s",
-				project, subject, sessionLabel);
-		
-		// create session
-		final String sessionID;
-		try {
-			final StringResponseProcessor processor = new StringResponseProcessor();
-			xnat.doPut(path + "?xsiType=xnat:petSessionData", processor);
-			sessionID = processor.toString();
-		} catch (Exception e) {
-			e.printStackTrace();
-			progress.failed(e.getMessage(), true);	// TODO: try again?
-			return false;
-		}
-
-		final Map<File,Exception> failures = new LinkedHashMap<File,Exception>();
-		
-		// add scans to session, and the data file to each scan
-		int i = 0;
-		final int size = data.size();
-		for (final MatrixDataFile mdf : data) {
-			try {
-				final String scan = String.format("%s/scans/%d", path, ++i);
-				progress.setBusy(String.format("Creating scan %d/%d", i, size));
-				xnat.doPut(scan + "?xsiType=xnat:petScanData");
-				final File f = mdf.getFile();
-				progress.setProgress(String.format("Uploading scan %d/%d", i, data.size()),
-						i - 1, data.size());
-				final HttpURLConnectionProcessor processor = new ModifyingUploadProcessor(f,
-						progress, project.toString(), subject.getLabel(), session.getValue());
-				xnat.doPut(String.format("%s/files/%s?inbody=true&format=ECAT&content=RAW",
-						scan, f.getName()), processor);
-			} catch (Exception e) {	// TODO: retry?
-				failures.put(mdf.getFile(), e);
-			}
-		}
-		
-		if (!failures.isEmpty()) {
-			for (final Map.Entry<File,Exception> me : failures.entrySet()) {
-				System.out.println(me.getKey() + " failed: ");
-				me.getValue().printStackTrace();
-			}
-			progress.failed("Some files failed to upload", true);	// TODO: better
-			return false;
-		}
-		
-		// Commit session
-		try {
-			progress.setBusy(String.format("Committing session %s (%s)", sessionLabel, sessionID));
-			xnat.doPut(path + "?pullDataFromHeaders=true");
-			
-			final Map<String,String> result = Collections.singletonMap(UploadResultPanel.URL,
-					String.format("%s/REST/experiments/%s?format=html", xnat.getURL(), sessionID));
-			final UploadResultPanel urp = new UploadResultPanel(session.getValue(), failures, result);
-			if (urp.isSuccessful()) {
-				final StringBuilder setValuesURL = new StringBuilder(path);
-				boolean paramsAdded = false;
-				final Collection<?> vars = (Collection<?>)params.get(AssignSessionVariablesPage.PRODUCT_NAME);
-				if (null == vars) {
-					logger.error("session variables not assigned: " + params);
-				} else {
-				for (final Object v : vars) {
-					logger.trace("checking session variable " + v);
-					if (v instanceof XnatVariable) {
-						if (paramsAdded) {
-							setValuesURL.append("&");
-						} else {
-							setValuesURL.append("?");
-							paramsAdded = true;
-						}
-						final XnatVariable xv = (XnatVariable)v;
-						setValuesURL.append(xv.getFieldPath());
-						setValuesURL.append("=");
-						setValuesURL.append(URLEncoder.encode(xv.getValue(), URL_ENCODE_SCHEME));
-					}
-				}
-				}
-				if (paramsAdded) {
-					logger.trace("Setting variables: " + setValuesURL);
-					xnat.doPut(setValuesURL.toString());
-				}
-				
-				progress.finished(Summary.create(urp, null));
-				return true;
-			} else {
-				progress.failed("Some files failed to upload", false);	// TODO: do better
-				return false;
-			}
-		} catch (IOException e) {
-			e.printStackTrace();
-			progress.failed(e.getMessage(), true);	// TODO: try again?
-			return false;
-		}
-	}
-}

File src/main/java/org/nrg/ecat/SessionUploadTool.java

 				}
 			}
 		}
-		server.addAuthentication(url, new PasswordAuthentication(user, null == password ? null : password.toCharArray()));
+		server.addAuthentication(url, new PasswordAuthentication(user,
+				null == password ? new char[0] : password.toCharArray()));
 	}
 	
 	
 			}
 		}
 
-		final Session session = new Session(mdfs);
+		final EcatSession session = new EcatSession(mdfs);
 		final Map<String,Object> params = new HashMap<String,Object>();
 		params.put("project", new Project(project, xnat));
 		params.put("subject", new Subject(subject, null));

File src/main/java/org/nrg/io/MasterTrawler.java

 public class MasterTrawler implements Callable<List<Session>> {
 	// TODO: hard-coded? configurable?
 	private final Trawler[] trawlers = {
-			new org.nrg.io.dcm.Trawler(),
-			new org.nrg.io.ecat.Trawler(),
+			new org.nrg.io.dcm.DicomTrawler(),
+			new org.nrg.io.ecat.EcatTrawler(),
 	};
 	private final Collection<File> roots;
 

File src/main/java/org/nrg/io/dcm/DicomTrawler.java

+/**
+ * Copyright (c) 2009 Washington University
+ */
+package org.nrg.io.dcm;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.dcm4che2.data.DicomObject;
+import org.dcm4che2.data.Tag;
+import org.nrg.dcm.Study;
+import org.nrg.dcm.edit.DicomUtils;
+import org.nrg.dcm.edit.DicomUtils.DicomObjectException;
+import org.nrg.io.Trawler;
+import org.nrg.upload.data.Session;
+import org.nrg.util.MapRegistry;
+import org.nrg.util.Registry;
+
+/**
+ * @author Kevin A. Archie <karchie@npg.wustl.edu>
+ *
+ */
+public final class DicomTrawler implements Trawler {
+	/* (non-Javadoc)
+	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator)
+	 */
+	public Collection<Session> trawl(final Iterator<File> files) {
+		return trawl(files, null);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator, java.util.Collection)
+	 */
+	public Collection<Session> trawl(final Iterator<File> files,
+			final Collection<File> remaining) {
+		final Registry<Study> studies = new MapRegistry<Study>();
+		while (files.hasNext()) {
+			final File f = files.next();
+			if (f.isFile()) {
+				final DicomObject o;
+				try {
+					o = DicomUtils.read(f, 0x0020ffff);	// nothing needed higher than group 20
+				} catch (DicomObjectException e) {
+					remaining.add(f);
+					continue;
+				} catch (IOException e) {
+					remaining.add(f);
+					continue;
+				} catch (Exception e) {
+					remaining.add(f);
+					continue;
+				}
+				assert null != o.getString(Tag.SOPClassUID);
+				
+				final Study study = studies.get(new Study(o));
+				study.getSeries(o, f);
+			}
+		}
+		
+		return new ArrayList<Session>(studies.getAll());
+	}
+}

File src/main/java/org/nrg/io/dcm/Trawler.java

-/**
- * Copyright (c) 2009 Washington University
- */
-package org.nrg.io.dcm;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.dcm4che2.data.DicomObject;
-import org.dcm4che2.data.Tag;
-import org.nrg.dcm.Study;
-import org.nrg.dcm.edit.DicomUtils;
-import org.nrg.dcm.edit.DicomUtils.DicomObjectException;
-import org.nrg.upload.data.Session;
-import org.nrg.util.MapRegistry;
-import org.nrg.util.Registry;
-
-/**
- * @author Kevin A. Archie <karchie@npg.wustl.edu>
- *
- */
-public final class Trawler implements org.nrg.io.Trawler {
-	/* (non-Javadoc)
-	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator)
-	 */
-	public Collection<Session> trawl(final Iterator<File> files) {
-		return trawl(files, null);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator, java.util.Collection)
-	 */
-	public Collection<Session> trawl(final Iterator<File> files,
-			final Collection<File> remaining) {
-		final Registry<Study> studies = new MapRegistry<Study>();
-		while (files.hasNext()) {
-			final File f = files.next();
-			if (f.isFile()) {
-				final DicomObject o;
-				try {
-					o = DicomUtils.read(f, 0x0020ffff);	// nothing needed higher than group 20
-				} catch (DicomObjectException e) {
-					remaining.add(f);
-					continue;
-				} catch (IOException e) {
-					remaining.add(f);
-					continue;
-				} catch (Exception e) {
-					remaining.add(f);
-					continue;
-				}
-				assert null != o.getString(Tag.SOPClassUID);
-				
-				final Study study = studies.get(new Study(o));
-				study.getSeries(o, f);
-			}
-		}
-		
-		return new ArrayList<Session>(studies.getAll());
-	}
-}

File src/main/java/org/nrg/io/ecat/EcatTrawler.java

+/**
+ * Copyright (c) 2009 Washington University
+ */
+package org.nrg.io.ecat;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.nrg.upload.data.Session;
+import org.nrg.ecat.MatrixDataFile;
+import org.nrg.io.Trawler;
+
+/**
+ * @author Kevin A. Archie <karchie@npg.wustl.edu>
+ *
+ */
+public final class EcatTrawler implements Trawler {
+	/* (non-Javadoc)
+	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator)
+	 */
+	public Collection<Session> trawl(final Iterator<File> files) {
+		return trawl(files, null);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator, java.util.Collection)
+	 */
+	public Collection<Session> trawl(final Iterator<File> files,
+			final Collection<File> remaining) {
+		final Map<String,SortedSet<MatrixDataFile>> filesets = new LinkedHashMap<String,SortedSet<MatrixDataFile>>();
+		while (files.hasNext()) {
+			final File f = files.next();
+			try {
+				final MatrixDataFile mdf = new MatrixDataFile(f);
+				final String sessionLabel = mdf.getPatientID();
+				final SortedSet<MatrixDataFile> mdfs = filesets.get(sessionLabel);
+				if (null == mdfs) {
+					filesets.put(sessionLabel, new TreeSet<MatrixDataFile>(Collections.singleton(mdf)));
+				} else {
+					mdfs.add(mdf);
+				}
+			} catch (IOException e) {
+				if (null != remaining) { remaining.add(f); }
+			}
+		}
+		
+		final ArrayList<Session> sessions = new ArrayList<Session>(filesets.size());
+		for (final Map.Entry<String,SortedSet<MatrixDataFile>> me : filesets.entrySet()) {
+			sessions.add(new org.nrg.ecat.EcatSession(me.getValue()));
+		}
+		return sessions;
+	}
+}

File src/main/java/org/nrg/io/ecat/Trawler.java

-/**
- * Copyright (c) 2009 Washington University
- */
-package org.nrg.io.ecat;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.nrg.upload.data.Session;
-import org.nrg.ecat.MatrixDataFile;
-
-/**
- * @author Kevin A. Archie <karchie@npg.wustl.edu>
- *
- */
-public final class Trawler implements org.nrg.io.Trawler {
-	/* (non-Javadoc)
-	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator)
-	 */
-	public Collection<Session> trawl(final Iterator<File> files) {
-		return trawl(files, null);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.nrg.io.Trawler#trawl(java.util.Iterator, java.util.Collection)
-	 */
-	public Collection<Session> trawl(final Iterator<File> files,
-			final Collection<File> remaining) {
-		final Map<String,SortedSet<MatrixDataFile>> filesets = new LinkedHashMap<String,SortedSet<MatrixDataFile>>();
-		while (files.hasNext()) {
-			final File f = files.next();
-			try {
-				final MatrixDataFile mdf = new MatrixDataFile(f);
-				final String sessionLabel = mdf.getPatientID();
-				final SortedSet<MatrixDataFile> mdfs = filesets.get(sessionLabel);
-				if (null == mdfs) {
-					filesets.put(sessionLabel, new TreeSet<MatrixDataFile>(Collections.singleton(mdf)));
-				} else {
-					mdfs.add(mdf);
-				}
-			} catch (IOException e) {
-				if (null != remaining) { remaining.add(f); }
-			}
-		}
-		
-		final ArrayList<Session> sessions = new ArrayList<Session>(filesets.size());
-		for (final Map.Entry<String,SortedSet<MatrixDataFile>> me : filesets.entrySet()) {
-			sessions.add(new org.nrg.ecat.Session(me.getValue()));
-		}
-		return sessions;
-	}
-}

File src/main/java/org/nrg/upload/ui/SelectProjectPage.java

 	 */
 	public String toString() {
 		final Project old = (Project)getWizardData(PRODUCT_NAME);
-		return null == old ? null : old.toString();
+		return null == old ? "" : old.toString();
 	}
 }