ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From james-mas...@apache.org
Subject svn commit: r1500625 - /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cr/I2B2Challenge2010CollectionReader.java
Date Mon, 08 Jul 2013 09:25:48 GMT
Author: james-masanz
Date: Mon Jul  8 09:25:47 2013
New Revision: 1500625

URL: http://svn.apache.org/r1500625
Log:
throw ResourceInitializationException if input dir is not actually a directory for easier

Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cr/I2B2Challenge2010CollectionReader.java

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cr/I2B2Challenge2010CollectionReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cr/I2B2Challenge2010CollectionReader.java?rev=1500625&r1=1500624&r2=1500625&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cr/I2B2Challenge2010CollectionReader.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cr/I2B2Challenge2010CollectionReader.java
Mon Jul  8 09:25:47 2013
@@ -37,6 +37,7 @@ import org.apache.uima.cas.CASException;
 import org.apache.uima.collection.CollectionException;
 import org.apache.uima.collection.CollectionReader_ImplBase;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.util.Progress;
 import org.apache.uima.util.ProgressImpl;
 
@@ -59,13 +60,15 @@ public class I2B2Challenge2010Collection
 	
 	
 	@Override
-	public void initialize() throws org.apache.uima.resource.ResourceInitializationException
{
+	public void initialize() throws ResourceInitializationException {
 		String inputDir = (String) getConfigParameterValue(PARAM_INPUTDIR);
 		File docDir = new File(inputDir + File.separator + "txt");
 		match = (String) getConfigParameterValue(PARAM_FNMATCH);
 		if(match != null) fnMatch = true;
 		if(docDir.exists() && docDir.isDirectory()){
 			docs = docDir.listFiles(new FilenameFilter(){ public boolean accept(File dir, String name){
return (name.endsWith("txt") && (!fnMatch || name.contains(match)));}});
+		} else {
+			throw new ResourceInitializationException(new RuntimeException("Unable to get list of
files within " + docDir.getAbsolutePath()));
 		}
 //		conDir = new String(inputDir + File.separator + "concept");
 		astDir = new String(inputDir + File.separator + "ast");
@@ -179,6 +182,9 @@ public class I2B2Challenge2010Collection
 
 	@Override
 	public boolean hasNext() throws IOException, CollectionException {
+		if (docs==null) {
+			throw new RuntimeException("docs == null");
+		}
 		return (index < docs.length);
 	}
 



Mime
View raw message