MSOffice2007Parser extends FileParser { @Override protected ParseResult parse(File file, ParseContext context) throws ParseException { OPCPackage pkg = null; try { pkg = OPCPackage.open(file.getPath(), PackageAccess.READ); String contents = extractText(pkg); PackageProperties props = pkg.getPackageProperties(); String author = null; String defaultAuthor = props.getCreatorProperty().getValue(); String lastAuthor = props.getLastModifiedByProperty().getValue(); if (defaultAuthor == null) { if (lastAuthor != null) author = lastAuthor; } else if (lastAuthor == null) { author = defaultAuthor; } else { if (defaultAuthor.equals(lastAuthor)) author = defaultAuthor; else author = defaultAuthor + ", " + lastAuthor; } String description = props.getDescriptionProperty().getValue(); String keywords = props.getKeywordsProperty().getValue(); String subject = props.getSubjectProperty().getValue(); String title = props.getTitleProperty().getValue(); return new ParseResult(contents) .setTitle(title) .addAuthor(author) .addMiscMetadata(description) .addMiscMetadata(keywords) .addMiscMetadata(subject); } catch (NoClassDefFoundError e) { if (e.getMessage().contains("Could not initialize class")) { String msg = "Outdated Java version. Please upgrade to Java 1.6.0 Update 18 or newer."; throw new ParseException(msg, e); } else { throw e; } } catch (NoSuchMethodError e) { if (e.getMessage().contains("XMLEventFactory.newFactory")) { String msg = "Outdated Java version. Please upgrade to Java 1.6.0 Update 18 or newer."; throw new ParseException(msg, e); } else { throw e; } } catch (Exception e) { throw new ParseException(e); } finally { try { Closeables.closeQuietly(pkg); } catch (OpenXML4JRuntimeException e2) { } } } private  MSOffice2007Parser(	@NotNull String typeLabel,
								@NotNull String... extensions); final String getTypeLabel();  }
@Test public void testParse() throws Exception { File file = TestFiles.read_write_xls.get(); long lengthBefore = file.length(); long modBefore = file.lastModified(); ParseService.parse(new IndexingConfig(), file, file.getName(), new Path(file), IndexingReporter.nullReporter, Cancelable.nullCancelable); Assert.assertEquals(lengthBefore, file.length()); Assert.assertEquals(modBefore, file.lastModified()); }