Adjust some missing/incorrec throws and related javadoc

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1773662 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-12-11 21:13:46 +00:00
parent 8003ad78f4
commit 2f0fc06f0f
3 changed files with 27 additions and 26 deletions

View File

@ -126,6 +126,7 @@ public class XLSX2CSV {
// Number or string? // Number or string?
try { try {
//noinspection ResultOfMethodCallIgnored
Double.parseDouble(formattedValue); Double.parseDouble(formattedValue);
output.append(formattedValue); output.append(formattedValue);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
@ -173,16 +174,20 @@ public class XLSX2CSV {
* Parses and shows the content of one sheet * Parses and shows the content of one sheet
* using the specified styles and shared-strings tables. * using the specified styles and shared-strings tables.
* *
* @param styles * @param styles The table of styles that may be referenced by cells in the sheet
* @param strings * @param strings The table of strings that may be referenced by cells in the sheet
* @param sheetInputStream * @param sheetInputStream The stream to read the sheet-data from.
* @exception java.io.IOException An IO exception from the parser,
* possibly from a byte stream or character stream
* supplied by the application.
* @throws SAXException if parsing the XML data fails.
*/ */
public void processSheet( public void processSheet(
StylesTable styles, StylesTable styles,
ReadOnlySharedStringsTable strings, ReadOnlySharedStringsTable strings,
SheetContentsHandler sheetHandler, SheetContentsHandler sheetHandler,
InputStream sheetInputStream) InputStream sheetInputStream) throws IOException, SAXException {
throws IOException, ParserConfigurationException, SAXException {
DataFormatter formatter = new DataFormatter(); DataFormatter formatter = new DataFormatter();
InputSource sheetSource = new InputSource(sheetInputStream); InputSource sheetSource = new InputSource(sheetInputStream);
try { try {
@ -199,13 +204,10 @@ public class XLSX2CSV {
/** /**
* Initiates the processing of the XLS workbook file to CSV. * Initiates the processing of the XLS workbook file to CSV.
* *
* @throws IOException * @throws IOException If reading the data from the package fails.
* @throws OpenXML4JException * @throws SAXException if parsing the XML data fails.
* @throws ParserConfigurationException
* @throws SAXException
*/ */
public void process() public void process() throws IOException, OpenXML4JException, SAXException {
throws IOException, OpenXML4JException, ParserConfigurationException, SAXException {
ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(this.xlsxPackage); ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(this.xlsxPackage);
XSSFReader xssfReader = new XSSFReader(this.xlsxPackage); XSSFReader xssfReader = new XSSFReader(this.xlsxPackage);
StylesTable styles = xssfReader.getStylesTable(); StylesTable styles = xssfReader.getStylesTable();

View File

@ -228,8 +228,6 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
* @throws InvalidOperationException * @throws InvalidOperationException
* If a writing operation is done on a read only package or * If a writing operation is done on a read only package or
* invalid nested relations are created. * invalid nested relations are created.
* @throws InvalidFormatException
* If the URI point to a relationship part URI.
* @throws IllegalArgumentException if targetPartName, targetMode * @throws IllegalArgumentException if targetPartName, targetMode
* or relationshipType are passed as null * or relationshipType are passed as null
* @see org.apache.poi.openxml4j.opc.RelationshipSource#addRelationship(org.apache.poi.openxml4j.opc.PackagePartName, * @see org.apache.poi.openxml4j.opc.RelationshipSource#addRelationship(org.apache.poi.openxml4j.opc.PackagePartName,
@ -300,7 +298,7 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
* Relationship unique id. * Relationship unique id.
* @return The newly created and added relationship * @return The newly created and added relationship
* *
* @throws InvalidFormatException * @throws InvalidOperationException
* If the URI point to a relationship part URI. * If the URI point to a relationship part URI.
* @see org.apache.poi.openxml4j.opc.RelationshipSource#addRelationship(org.apache.poi.openxml4j.opc.PackagePartName, * @see org.apache.poi.openxml4j.opc.RelationshipSource#addRelationship(org.apache.poi.openxml4j.opc.PackagePartName,
* org.apache.poi.openxml4j.opc.TargetMode, java.lang.String, java.lang.String) * org.apache.poi.openxml4j.opc.TargetMode, java.lang.String, java.lang.String)
@ -361,7 +359,8 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
* Retrieve all the relationships attached to this part. * Retrieve all the relationships attached to this part.
* *
* @return This part's relationships. * @return This part's relationships.
* @throws OpenXML4JException * @throws InvalidOperationException
* Throws if the package is open en write only mode.
* @see org.apache.poi.openxml4j.opc.RelationshipSource#getRelationships() * @see org.apache.poi.openxml4j.opc.RelationshipSource#getRelationships()
*/ */
public PackageRelationshipCollection getRelationships() public PackageRelationshipCollection getRelationships()
@ -491,6 +490,8 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
* *
* @return The input stream of the content of this part, else * @return The input stream of the content of this part, else
* <code>null</code>. * <code>null</code>.
*
* @throws IOException If creating the input-stream fails.
*/ */
public InputStream getInputStream() throws IOException { public InputStream getInputStream() throws IOException {
InputStream inStream = this.getInputStreamImpl(); InputStream inStream = this.getInputStreamImpl();
@ -503,7 +504,7 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
/** /**
* Get the output stream of this part. If the part is originally embedded in * Get the output stream of this part. If the part is originally embedded in
* Zip package, it'll be transform intot a <i>MemoryPackagePart</i> in * Zip package, it'll be transform into a <i>MemoryPackagePart</i> in
* order to write inside (the standard Java API doesn't allow to write in * order to write inside (the standard Java API doesn't allow to write in
* the file) * the file)
* *
@ -643,7 +644,7 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
@Override @Override
public String toString() { public String toString() {
return "Name: " + this._partName + " - Content Type: " return "Name: " + this._partName + " - Content Type: "
+ this._contentType.toString(); + this._contentType;
} }
/** /**
@ -662,7 +663,7 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
/*-------------- Abstract methods ------------- */ /*-------------- Abstract methods ------------- */
/** /**
* Abtract method that get the input stream of this part. * Abstract method that get the input stream of this part.
* *
* @exception IOException * @exception IOException
* Throws if an IO Exception occur in the implementation * Throws if an IO Exception occur in the implementation

View File

@ -96,10 +96,9 @@ public class ReadOnlySharedStringsTable extends DefaultHandler {
private List<String> strings; private List<String> strings;
/** /**
* @param pkg * @param pkg The {@link OPCPackage} to use as basis for the shared-strings table.
* @throws IOException * @throws IOException If reading the data from the package fails.
* @throws SAXException * @throws SAXException if parsing the XML data fails.
* @throws ParserConfigurationException
*/ */
public ReadOnlySharedStringsTable(OPCPackage pkg) public ReadOnlySharedStringsTable(OPCPackage pkg)
throws IOException, SAXException { throws IOException, SAXException {
@ -127,8 +126,7 @@ public class ReadOnlySharedStringsTable extends DefaultHandler {
* *
* @param is The input stream containing the XML document. * @param is The input stream containing the XML document.
* @throws IOException if an error occurs while reading. * @throws IOException if an error occurs while reading.
* @throws SAXException * @throws SAXException if parsing the XML data fails.
* @throws ParserConfigurationException
*/ */
public void readFrom(InputStream is) throws IOException, SAXException { public void readFrom(InputStream is) throws IOException, SAXException {
// test if the file is empty, otherwise parse it // test if the file is empty, otherwise parse it