aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2009-08-22 05:50:32 +0000
committerJosh Micich <josh@apache.org>2009-08-22 05:50:32 +0000
commite8b5f3670405426c04e3e2fb12400fceb375c8d2 (patch)
treecf89077ca9ec6fee830a93173cf2abf63a294840 /src/ooxml/java/org
parentf8a0d4bb517fb0302f8ac3823e9bd65a303ffea2 (diff)
downloadpoi-e8b5f3670405426c04e3e2fb12400fceb375c8d2.tar.gz
poi-e8b5f3670405426c04e3e2fb12400fceb375c8d2.zip
fixing compiler warnings - unused imports, declared exceptions not thrown
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@806789 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org')
-rw-r--r--src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java33
-rw-r--r--src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java37
2 files changed, 33 insertions, 37 deletions
diff --git a/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java b/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
index 480a71ad9b..47fe05ed91 100644
--- a/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
+++ b/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
@@ -14,19 +14,16 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
-import java.io.IOException;
+package org.apache.poi;
-import org.apache.xmlbeans.XmlException;
-import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
/**
* A {@link POITextExtractor} for returning the textual
* content of the OOXML file properties, eg author
- * and title.
+ * and title.
*/
public class POIXMLPropertiesTextExtractor extends POIXMLTextExtractor {
/**
@@ -42,17 +39,17 @@ public class POIXMLPropertiesTextExtractor extends POIXMLTextExtractor {
* working on.
*/
public POIXMLPropertiesTextExtractor(POIXMLTextExtractor otherExtractor) {
- super(otherExtractor.document);
+ super(otherExtractor.getDocument());
}
-
+
/**
* Returns the core document properties, eg author
*/
public String getCorePropertiesText() {
StringBuffer text = new StringBuffer();
PackagePropertiesPart props =
- document.getProperties().getCoreProperties().getUnderlyingProperties();
-
+ getDocument().getProperties().getCoreProperties().getUnderlyingProperties();
+
text.append("Category = " + props.getCategoryProperty().getValue() + "\n");
text.append("ContentStatus = " + props.getContentStatusProperty().getValue() + "\n");
text.append("ContentType = " + props.getContentTypeProperty().getValue() + "\n");
@@ -82,7 +79,7 @@ public class POIXMLPropertiesTextExtractor extends POIXMLTextExtractor {
public String getExtendedPropertiesText() {
StringBuffer text = new StringBuffer();
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties
- props = document.getProperties().getExtendedProperties().getUnderlyingProperties();
+ props = getDocument().getProperties().getExtendedProperties().getUnderlyingProperties();
text.append("Application = " + props.getApplication() + "\n");
text.append("AppVersion = " + props.getAppVersion() + "\n");
@@ -99,36 +96,36 @@ public class POIXMLPropertiesTextExtractor extends POIXMLTextExtractor {
text.append("PresentationFormat = " + props.getPresentationFormat() + "\n");
text.append("Template = " + props.getTemplate() + "\n");
text.append("TotalTime = " + props.getTotalTime() + "\n");
-
+
return text.toString();
}
/**
- * Returns the custom document properties, if
+ * Returns the custom document properties, if
* there are any
*/
public String getCustomPropertiesText() {
StringBuffer text = new StringBuffer();
org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties
- props = document.getProperties().getCustomProperties().getUnderlyingProperties();
-
+ props = getDocument().getProperties().getCustomProperties().getUnderlyingProperties();
+
CTProperty[] properties = props.getPropertyArray();
for(int i = 0; i<properties.length; i++) {
// TODO - finish off
String val = "(not implemented!)";
-
+
text.append(
properties[i].getName() +
" = " + val + "\n"
);
}
-
+
return text.toString();
}
public String getText() {
try {
- return
- getCorePropertiesText() +
+ return
+ getCorePropertiesText() +
getExtendedPropertiesText() +
getCustomPropertiesText();
} catch(Exception e) {
diff --git a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java b/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
index 3f66ee5391..b3c4182d59 100644
--- a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
+++ b/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
@@ -14,59 +14,58 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
-import java.io.IOException;
+package org.apache.poi;
-import org.apache.poi.POIXMLProperties.*;
-import org.apache.xmlbeans.XmlException;
-import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
+import org.apache.poi.POIXMLProperties.CoreProperties;
+import org.apache.poi.POIXMLProperties.CustomProperties;
+import org.apache.poi.POIXMLProperties.ExtendedProperties;
public abstract class POIXMLTextExtractor extends POITextExtractor {
/** The POIXMLDocument that's open */
- protected POIXMLDocument document;
+ private final POIXMLDocument _document;
/**
* Creates a new text extractor for the given document
*/
public POIXMLTextExtractor(POIXMLDocument document) {
super((POIDocument)null);
-
- this.document = document;
+
+ _document = document;
}
-
+
/**
* Returns the core document properties
*/
public CoreProperties getCoreProperties() {
- return document.getProperties().getCoreProperties();
+ return _document.getProperties().getCoreProperties();
}
/**
* Returns the extended document properties
*/
public ExtendedProperties getExtendedProperties() {
- return document.getProperties().getExtendedProperties();
+ return _document.getProperties().getExtendedProperties();
}
/**
* Returns the custom document properties
*/
public CustomProperties getCustomProperties() {
- return document.getProperties().getCustomProperties();
+ return _document.getProperties().getCustomProperties();
}
/**
- * Returns opened document
+ * Returns opened document
*/
- public POIXMLDocument getDocument(){
- return document;
+ public final POIXMLDocument getDocument(){
+ return _document;
}
-
-
+
+
/**
- * Returns an OOXML properties text extractor for the
+ * Returns an OOXML properties text extractor for the
* document properties metadata, such as title and author.
*/
public POIXMLPropertiesTextExtractor getMetadataTextExtractor() {
- return new POIXMLPropertiesTextExtractor(document);
+ return new POIXMLPropertiesTextExtractor(_document);
}
}