Changed CRLF to LF in ooxml/java. Minor fixes for compiler warnings and formatting

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@776607 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2009-05-20 08:02:35 +00:00
parent 54a729eb7d
commit 7b5b57423f
56 changed files with 7716 additions and 7713 deletions

View File

@ -21,7 +21,7 @@ package org.apache.poi;
*
* @author Yegor Kozlov
*/
public class POIXMLException extends RuntimeException{
public final class POIXMLException extends RuntimeException{
/**
* Create a new <code>POIXMLException</code> with no
* detail mesage.

View File

@ -19,7 +19,6 @@ package org.apache.poi;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackagePart;
/**
* Defines a factory API that enables sub-classes to create instances of <code>POIXMLDocumentPart</code>
*

View File

@ -101,7 +101,7 @@ public abstract class POIXMLRelation {
/**
* Returns the filename for the nth one of these,
* eg /xl/comments4.xml
* e.g. /xl/comments4.xml
*/
public String getFileName(int index) {
if(_defaultName.indexOf("#") == -1) {

View File

@ -13,13 +13,12 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
====================================================================
*/
==================================================================== */
package org.apache.poi.openxml4j.exceptions;
@SuppressWarnings("serial")
public class InvalidFormatException extends OpenXML4JException{
public final class InvalidFormatException extends OpenXML4JException{
public InvalidFormatException(String message){
super(message);

View File

@ -24,7 +24,7 @@ package org.apache.poi.openxml4j.exceptions;
* @version 1.0
*/
@SuppressWarnings("serial")
public class InvalidOperationException extends OpenXML4JRuntimeException{
public final class InvalidOperationException extends OpenXML4JRuntimeException{
public InvalidOperationException(String message){
super(message);

View File

@ -21,7 +21,6 @@ package org.apache.poi.openxml4j.opc;
* Specifies the location where the X.509 certificate that is used in signing is stored.
*
* @author Julien Chable
* @version 1.0
*/
public enum CertificateEmbeddingOption {
/** The certificate is embedded in its own PackagePart. */

View File

@ -26,7 +26,7 @@ import java.io.File;
* @author CDubettier, Julen Chable
* @version 1.0
*/
public class Configuration {
public final class Configuration {
// TODO configuration by default. should be clearly stated that it should be
// changed to match installation path
// as schemas dir is needed in runtime

View File

@ -22,9 +22,8 @@ package org.apache.poi.openxml4j.opc;
* and Content Types).
*
* @author CDubettier define some constants, Julien Chable
* @version 0.1
*/
public class ContentTypes {
public final class ContentTypes {
/*
* Open Packaging Convention (Annex F : Standard Namespaces and Content

View File

@ -27,7 +27,6 @@ import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
* An immutable Open Packaging Convention compliant part name.
*
* @author Julien Chable
* @version 0.1
*
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">http://www.ietf.org/rfc/rfc3986.txt</a>
*/
@ -267,9 +266,7 @@ public final class PackagePartName implements Comparable<PackagePartName> {
+ partUri.getPath());
}
/*
* Check for rule M1.6, M1.7, M1.8
*/
// Check for rule M1.6, M1.7, M1.8
checkPCharCompliance(seg);
}
}

View File

@ -21,7 +21,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -49,7 +48,6 @@ import org.apache.poi.util.POILogFactory;
* Physical zip package.
*
* @author Julien Chable
* @version 0.2
*/
public final class ZipPackage extends Package {
@ -127,7 +125,7 @@ public final class ZipPackage extends Package {
if (this.zipArchive == null) {
return this.partList.values().toArray(
new PackagePart[this.partList.values().size()]);
} else {
}
// First we need to parse the content type part
Enumeration<? extends ZipEntry> entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
@ -156,7 +154,7 @@ public final class ZipPackage extends Package {
// its relationship exists, and then it won't tie up)
entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
ZipEntry entry = entries.nextElement();
PackagePartName partName = buildPartName(entry);
if(partName == null) continue;
@ -175,7 +173,7 @@ public final class ZipPackage extends Package {
// Then we can go through all the other parts
entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
ZipEntry entry = entries.nextElement();
PackagePartName partName = buildPartName(entry);
if(partName == null) continue;
@ -199,9 +197,7 @@ public final class ZipPackage extends Package {
}
}
return (ZipPackagePart[]) partList.values().toArray(
new ZipPackagePart[partList.size()]);
}
return partList.values().toArray(new ZipPackagePart[partList.size()]);
}
/**
@ -215,10 +211,9 @@ public final class ZipPackage extends Package {
if (entry.getName().equals(
ContentTypeManager.CONTENT_TYPES_PART_NAME)) {
return null;
} else {
}
return PackagingURIHelper.createPartName(ZipHelper
.getOPCNameFromZipItemName(entry.getName()));
}
} catch (Exception e) {
// We assume we can continue, even in degraded mode ...
logger.log(POILogger.WARN,"Entry "

View File

@ -30,7 +30,7 @@ import org.apache.poi.openxml4j.opc.internal.PartMarshaller;
* @version 1.0
* @see PartMarshaller
*/
public class DefaultMarshaller implements PartMarshaller {
public final class DefaultMarshaller implements PartMarshaller {
/**
* Save part in the output stream by using the save() method of the part.

View File

@ -33,7 +33,6 @@ import org.apache.poi.openxml4j.opc.internal.PartMarshaller;
* Package properties marshaller.
*
* @author CDubet, Julien Chable
* @version 1.0
*/
public class PackagePropertiesMarshaller implements PartMarshaller {

View File

@ -31,9 +31,8 @@ import org.apache.poi.openxml4j.opc.internal.ZipHelper;
* Package core properties marshaller specialized for zipped package.
*
* @author Julien Chable
* @version 1.0
*/
public class ZipPackagePropertiesMarshaller extends PackagePropertiesMarshaller {
public final class ZipPackagePropertiesMarshaller extends PackagePropertiesMarshaller {
@Override
public boolean marshall(PackagePart part, OutputStream out)

View File

@ -47,9 +47,8 @@ import org.apache.poi.util.POILogFactory;
* Zip part marshaller. This marshaller is use to save any part in a zip stream.
*
* @author Julien Chable
* @version 0.1
*/
public class ZipPartMarshaller implements PartMarshaller {
public final class ZipPartMarshaller implements PartMarshaller {
private static POILogger logger = POILogFactory.getLogger(ZipPartMarshaller.class);
/**
@ -63,7 +62,7 @@ public class ZipPartMarshaller implements PartMarshaller {
if (!(os instanceof ZipOutputStream)) {
logger.log(POILogger.ERROR,"Unexpected class " + os.getClass().getName());
throw new OpenXML4JException("ZipOutputStream expected !");
// Normally should happen only in developpement phase, so just throw
// Normally should happen only in developement phase, so just throw
// exception
}
@ -83,9 +82,8 @@ public class ZipPartMarshaller implements PartMarshaller {
if (resultRead == -1) {
// End of file reached
break;
} else {
zos.write(buff, 0, resultRead);
}
zos.write(buff, 0, resultRead);
}
zos.closeEntry();
} catch (IOException ioe) {

View File

@ -23,6 +23,6 @@ package org.apache.poi.openxml4j.opc.internal.signature;
* @author Julien Chable
* @version 0.1
*/
public class DigitalSignatureOriginPart {
public final class DigitalSignatureOriginPart {
}

View File

@ -46,7 +46,7 @@ import org.apache.poi.openxml4j.opc.internal.ZipHelper;
* @author Julien Chable
* @version 1.0
*/
public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
public final class PackagePropertiesUnmarshaller implements PartUnmarshaller {
private final static Namespace namespaceDC = new Namespace("dc",
PackageProperties.NAMESPACE_DC);
@ -165,146 +165,146 @@ public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
private String loadCategory(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CATEGORY, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadContentStatus(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CONTENT_STATUS, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadContentType(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CONTENT_TYPE, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadCreated(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CREATED, namespaceDcTerms));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadCreator(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CREATOR, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadDescription(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_DESCRIPTION, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadIdentifier(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_IDENTIFIER, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadKeywords(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_KEYWORDS, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadLanguage(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_LANGUAGE, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadLastModifiedBy(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_LAST_MODIFIED_BY, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadLastPrinted(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_LAST_PRINTED, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadModified(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_MODIFIED, namespaceDcTerms));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadRevision(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_REVISION, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadSubject(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_SUBJECT, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadTitle(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_TITLE, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadVersion(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_VERSION, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
/* OPC Compliance methods */
@ -334,10 +334,11 @@ public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
public void checkElementForOPCCompliance(Element el)
throws InvalidFormatException {
// Check the current element
List declaredNamespaces = el.declaredNamespaces();
Iterator itNS = declaredNamespaces.iterator();
@SuppressWarnings("unchecked")
List<Namespace> declaredNamespaces = el.declaredNamespaces();
Iterator<Namespace> itNS = declaredNamespaces.iterator();
while (itNS.hasNext()) {
Namespace ns = (Namespace) itNS.next();
Namespace ns = itNS.next();
// Rule M4.2
if (ns.getURI().equals(PackageNamespaces.MARKUP_COMPATIBILITY))
@ -384,8 +385,9 @@ public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
}
// Check its children
Iterator itChildren = el.elementIterator();
@SuppressWarnings("unchecked")
Iterator<Element> itChildren = el.elementIterator();
while (itChildren.hasNext())
checkElementForOPCCompliance((Element) itChildren.next());
checkElementForOPCCompliance(itChildren.next());
}
}

View File

@ -26,7 +26,7 @@ import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.internal.ContentType;
public class PackageDigitalSignature extends PackagePart {
public final class PackageDigitalSignature extends PackagePart {
public PackageDigitalSignature() throws InvalidFormatException {
super(null, null, new ContentType(""));

View File

@ -17,6 +17,6 @@
package org.apache.poi.openxml4j.opc.signature;
public class PackageDigitalSignatureManager {
public final class PackageDigitalSignatureManager {
}

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.openxml4j.util;
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.dev;
import org.apache.xmlbeans.XmlObject;
@ -31,7 +32,7 @@ import java.util.Enumeration;
*
* @author Yegor Kozlov
*/
public class XSSFDump {
public final class XSSFDump {
public static void main(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) {

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.dev;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -26,7 +27,7 @@ import java.io.FileOutputStream;
*
* @author Yegor Kozlov
*/
public class XSSFSave {
public final class XSSFSave {
public static void main(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) {
XSSFWorkbook wb = new XSSFWorkbook(args[i]);

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
@ -23,7 +24,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
/**
* @author Yegor Kozlov
*/
public class XSSFChildAnchor extends XSSFAnchor {
public final class XSSFChildAnchor extends XSSFAnchor {
private CTTransform2D t2d;
public XSSFChildAnchor(int x, int y, int cx, int cy) {

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
@ -25,7 +26,7 @@ import org.apache.poi.ss.usermodel.ClientAnchor;
*
* @author Yegor Kozlov
*/
public class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
public final class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
private int anchorType;
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -25,7 +26,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.*;
*
* @author Yegor Kozlov
*/
public class XSSFConnector extends XSSFShape {
public final class XSSFConnector extends XSSFShape {
private static CTConnector prototype = null;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.apache.poi.POIXMLDocumentPart;
@ -36,7 +37,7 @@ import java.util.HashMap;
*
* @author Yegor Kozlov
*/
public class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
/**
* Root element of the SpreadsheetML Drawing part
*/

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.apache.poi.POIXMLDocumentPart;
@ -32,7 +33,7 @@ import java.lang.reflect.Constructor;
*
* @author Yegor Kozlov
*/
public class XSSFFactory extends POIXMLFactory {
public final class XSSFFactory extends POIXMLFactory {
private static POILogger logger = POILogFactory.getLogger(XSSFFactory.class);
private XSSFFactory(){

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -41,7 +42,7 @@ import java.util.Iterator;
*
* @author Yegor Kozlov
*/
public class XSSFPicture extends XSSFShape implements Picture {
public final class XSSFPicture extends XSSFShape implements Picture {
private static final POILogger logger = POILogFactory.getLogger(XSSFPicture.class);
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.main.*;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -28,7 +29,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationship;
*
* @author Yegor Kozlov
*/
public class XSSFShapeGroup extends XSSFShape {
public final class XSSFShapeGroup extends XSSFShape {
private static CTGroupShape prototype = null;
private CTGroupShape ctGroup;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape;
@ -27,7 +28,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
*
* @author Yegor Kozlov
*/
public class XSSFSimpleShape extends XSSFShape {
public class XSSFSimpleShape extends XSSFShape { // TODO - instantiable superclass
/**
* A default instance of CTShape used for creating new shapes.
*/

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -23,10 +24,9 @@ import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
*
* @author Yegor Kozlov
*/
public class XSSFTextBox extends XSSFSimpleShape {
public final class XSSFTextBox extends XSSFSimpleShape {
protected XSSFTextBox(XSSFDrawing drawing, CTShape ctShape) {
super(drawing, ctShape);
}
}

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel.helpers;
import org.apache.poi.xssf.usermodel.*;
@ -34,7 +35,7 @@ import java.util.ArrayList;
/**
* @author Yegor Kozlov
*/
public class XSSFRowShifter {
public final class XSSFRowShifter {
private final XSSFSheet sheet;
public XSSFRowShifter(XSSFSheet sh) {

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import java.util.HashMap;
@ -611,16 +612,15 @@ public enum Borders {
private static Map<Integer, Borders> imap = new HashMap<Integer, Borders>();
static {
for (Borders p : values()) {
imap.put(p.getValue(), p);
imap.put(new Integer(p.getValue()), p);
}
}
public static Borders valueOf(int type) {
Borders pBorder = imap.get(type);
if (pBorder == null)
throw new IllegalArgumentException("Unknown paragraph border: "
+ type);
Borders pBorder = imap.get(new Integer(type));
if (pBorder == null) {
throw new IllegalArgumentException("Unknown paragraph border: " + type);
}
return pBorder;
}
}

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import java.util.Map;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import org.apache.poi.POIXMLFactory;
@ -30,7 +31,7 @@ import java.lang.reflect.Constructor;
/**
* @author Yegor Kozlov
*/
public class XWPFFactory extends POIXMLFactory {
public final class XWPFFactory extends POIXMLFactory {
private static POILogger logger = POILogFactory.getLogger(XWPFFactory.class);

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import org.apache.poi.POIXMLRelation;
@ -25,7 +26,7 @@ import java.util.HashMap;
/**
* @author Yegor Kozlov
*/
public class XWPFRelation extends POIXMLRelation {
public final class XWPFRelation extends POIXMLRelation {
/**
* A map to lookup POIXMLRelation by its relation type