test_class.declarator: spreadsheetReader
test_class.modifier: private
test_class.original_string: private SpreadsheetReader spreadsheetReader;
test_class.type: SpreadsheetReader
test_class.var_name: spreadsheetReader
test_class.declarator: testFiles = new String[] {"/test-spreadsheet.xlsx" , "/test-spreadsheet.xls"}
test_class.modifier: private
test_class.original_string: private String[] testFiles = new String[] {"/test-spreadsheet.xlsx" , "/test-spreadsheet.xls"};
test_class.type: String[]
test_class.var_name: testFiles
test_class.file: taverna-spreadsheet-import-activity/src/test/java/org/apache/taverna/activities/spreadsheet/ExcelSpreadsheetReaderTest.java
test_class.identifier: ExcelSpreadsheetReaderTest
test_case.body: @Test(expected=SpreadsheetReadException.class)
  	public void testReadInvalidFormatException() throws Exception {
  		spreadsheetReader.read(getClass().getResourceAsStream("/test-spreadsheet.ods"), new Range(0,1), new Range(0,1), false, new SpreadsheetRowProcessor() {
  			public void processRow(int rowIndex, SortedMap<Integer, String> rowData) {				
  			}			
  		});
  	}
test_case.class_method_signature: ExcelSpreadsheetReaderTest.testReadInvalidFormatException()
test_case.full_signature: @Test(expected=SpreadsheetReadException.class) public void testReadInvalidFormatException()
test_case.identifier: testReadInvalidFormatException
test_case.invocations: read getResourceAsStream getClass
test_case.modifiers: @Test(expected=SpreadsheetReadException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadInvalidFormatException()
focal_class.declarator: logger = Logger.getLogger(ExcelSpreadsheetReader.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = Logger.getLogger(ExcelSpreadsheetReader.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: taverna-spreadsheet-import-activity/src/main/java/org/apache/taverna/activities/spreadsheet/ExcelSpreadsheetReader.java
focal_class.identifier: ExcelSpreadsheetReader
focal_class.interfaces: implements SpreadsheetReader
focal_class.class_method_signature: ExcelSpreadsheetReader.read(InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
focal_class.full_signature: public void read(InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
focal_class.identifier: read
focal_class.modifiers: public
focal_class.parameters: (InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
focal_class.return: void
focal_class.signature: void read(InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
focal_class.class_method_signature: ExcelSpreadsheetReader.getCellValue(Cell cell, DataFormatter dataFormatter)
focal_class.full_signature: private String getCellValue(Cell cell, DataFormatter dataFormatter)
focal_class.identifier: getCellValue
focal_class.modifiers: private
focal_class.parameters: (Cell cell, DataFormatter dataFormatter)
focal_class.return: String
focal_class.signature: String getCellValue(Cell cell, DataFormatter dataFormatter)
focal_method.body: public void read(InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
  			throws SpreadsheetReadException {
  		Workbook workbook;
  		try {
  			workbook = WorkbookFactory.create(inputStream);
  		} catch (InvalidFormatException e) {
  			throw new SpreadsheetReadException(
  					"The file does not have a compatible spreadsheet format", e);
  		} catch (IOException e) {
  			throw new SpreadsheetReadException("The spreadsheet stream could not be read", e);
  		} catch (IllegalArgumentException e) {
  			throw new SpreadsheetReadException("The spreadsheet stream could not be read", e);
  		}
  
  		DataFormatter dataFormatter = new DataFormatter();
  		
  		workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK);
  		Sheet sheet = workbook.getSheetAt(0);
  
  		if (rowRange.getEnd() < 0) {
  			rowRange.setEnd(sheet.getLastRowNum());
  			logger.debug("No end of row range specified, setting to " + rowRange.getEnd());
  		}
  
  		SortedMap<Integer, String> currentDataRow = new TreeMap<Integer, String>();
  
  		for (int rowIndex = rowRange.getStart(); rowIndex <= rowRange.getEnd(); rowIndex++) {
  			boolean blankRow = true;
  			if (rowRange.contains(rowIndex)) {
  				Row row = sheet.getRow(rowIndex);
  				for (int columnIndex = columnRange.getStart(); columnIndex <= columnRange.getEnd(); columnIndex++) {
  					if (columnRange.contains(columnIndex)) {
  						String value = null;
  						if (row != null) {
  							Cell cell = row.getCell(columnIndex);
  							if (cell != null) {
  								value = getCellValue(cell, dataFormatter);
  							}
  						}
  						if (value != null) {
  							blankRow = false;
  						}
  						currentDataRow.put(columnIndex, value);
  						if (columnIndex == columnRange.getEnd()) {
  							if (!ignoreBlankRows || !blankRow) {
  								rowProcessor.processRow(rowIndex, currentDataRow);
  							}
  							currentDataRow = new TreeMap<Integer, String>();
  						}
  					}
  				}
  			}
  		}
  
  	}
focal_method.class_method_signature: ExcelSpreadsheetReader.read(InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
focal_method.full_signature: public void read(InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
focal_method.identifier: read
focal_method.invocations: create setMissingCellPolicy getSheetAt getEnd setEnd getLastRowNum debug getEnd getStart getEnd contains getRow getStart getEnd contains getCell getCellValue put getEnd processRow
focal_method.modifiers: public
focal_method.parameters: (InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)
focal_method.return: void
focal_method.signature: void read(InputStream inputStream, Range rowRange, Range columnRange, boolean ignoreBlankRows, SpreadsheetRowProcessor rowProcessor)