poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r806426 - in /poi/trunk/src: ooxml/java/org/apache/poi/ ooxml/java/org/apache/poi/openxml4j/opc/ ooxml/java/org/apache/poi/openxml4j/opc/internal/ ooxml/java/org/apache/poi/xssf/dev/ ooxml/java/org/apache/poi/xssf/extractor/ ooxml/java/org/...
Date Fri, 21 Aug 2009 06:08:32 GMT
Author: yegor
Date: Fri Aug 21 06:08:31 2009
New Revision: 806426

URL: http://svn.apache.org/viewvc?rev=806426&view=rev
Log:
fixes and misc refactorings suggested by Intellij

Removed:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/XSSFChildContainingModel.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/XSSFModel.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/XSSFWritableModel.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFActiveXData.java
Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/dev/XSSFDump.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java Fri Aug 21 06:08:31 2009
@@ -28,7 +28,7 @@
 
     /**
      * Create a POIXMLDocumentPart from existing package part and relation. This method is
called
-     * from {@link POIXMLDocumentPart#read(POIXMLFactory)} when parsing a document
+     * from {@link POIXMLDocument#load(POIXMLFactory)} when parsing a document
      *
      * @param rel   the package part relationship
      * @param part  the PackagePart representing the created instance

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java Fri Aug 21
06:08:31 2009
@@ -48,7 +48,7 @@
 	/**
 	 * Returns the core document properties, eg author
 	 */
-	public String getCorePropertiesText() throws IOException, OpenXML4JException, XmlException
{
+	public String getCorePropertiesText() {
 		StringBuffer text = new StringBuffer();
 		PackagePropertiesPart props =
 			document.getProperties().getCoreProperties().getUnderlyingProperties();
@@ -79,7 +79,7 @@
 	 * Returns the extended document properties, eg
 	 *  application
 	 */
-	public String getExtendedPropertiesText() throws IOException, OpenXML4JException, XmlException
{
+	public String getExtendedPropertiesText() {
 		StringBuffer text = new StringBuffer();
 		org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties
 			props = document.getProperties().getExtendedProperties().getUnderlyingProperties();
@@ -106,7 +106,7 @@
 	 * Returns the custom document properties, if 
 	 *  there are any
 	 */
-	public String getCustomPropertiesText() throws IOException, OpenXML4JException, XmlException
{
+	public String getCustomPropertiesText() {
 		StringBuffer text = new StringBuffer();
 		org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties
 			props = document.getProperties().getCustomProperties().getUnderlyingProperties();

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java Fri Aug 21 06:08:31 2009
@@ -38,19 +38,19 @@
 	/**
 	 * Returns the core document properties
 	 */
-	public CoreProperties getCoreProperties() throws IOException, OpenXML4JException, XmlException
{
+	public CoreProperties getCoreProperties() {
 		 return document.getProperties().getCoreProperties();
 	}
 	/**
 	 * Returns the extended document properties
 	 */
-	public ExtendedProperties getExtendedProperties() throws IOException, OpenXML4JException,
XmlException {
+	public ExtendedProperties getExtendedProperties() {
 		return document.getProperties().getExtendedProperties();
 	}
 	/**
 	 * Returns the custom document properties
 	 */
-	public CustomProperties getCustomProperties() throws IOException, OpenXML4JException, XmlException
{
+	public CustomProperties getCustomProperties() {
 		return document.getProperties().getCustomProperties();
 	}
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java Fri Aug 21 06:08:31
2009
@@ -682,7 +682,7 @@
 			throw new IllegalArgumentException("partName");
 		}
 
-		if (contentType == null || contentType == "") {
+		if (contentType == null || contentType.equals("")) {
 			throw new IllegalArgumentException("contentType");
 		}
 
@@ -703,7 +703,7 @@
 		// A format consumer shall consider more than one core properties
 		// relationship for a package to be an error. If present, the
 		// relationship shall target the Core Properties part.
-		if (contentType == ContentTypes.CORE_PROPERTIES_PART) {
+		if (contentType.equals(ContentTypes.CORE_PROPERTIES_PART)) {
 			if (this.packageProperties != null)
 				throw new InvalidOperationException(
 						"OPC Compliance error [M4.1]: you try to add more than one core properties relationship
in the package !");
@@ -1200,16 +1200,12 @@
 	/**
 	 * @see org.apache.poi.openxml4j.opc.RelationshipSource#isRelationshipExists(org.apache.poi.openxml4j.opc.PackageRelationship)
 	 */
-	@SuppressWarnings("finally")
 	public boolean isRelationshipExists(PackageRelationship rel) {
-		try {
-			for (PackageRelationship r : this.getRelationships()) {
-				if (r == rel)
-					return true;
-			}
-		} finally {
-			return false;
-		}
+        for (PackageRelationship r : this.getRelationships()) {
+            if (r == rel)
+                return true;
+        }
+        return false;
 	}
 
 	/**

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java Fri Aug 21 06:08:31
2009
@@ -444,16 +444,16 @@
 	 *         else returns <b>false</b>
 	 * @see org.apache.poi.openxml4j.opc.RelationshipSource#isRelationshipExists(org.apache.poi.openxml4j.opc.PackageRelationship)
 	 */
-	@SuppressWarnings("finally")
 	public boolean isRelationshipExists(PackageRelationship rel) {
-		try {
-			for (PackageRelationship r : this.getRelationships()) {
-				if (r == rel)
-					return true;
-			}
-		} finally {
-			return false;
-		}
+        try {
+            for (PackageRelationship r : this.getRelationships()) {
+                if (r == rel)
+                    return true;
+            }
+        } catch (InvalidFormatException e){
+            ;
+        }
+        return false;
 	}
 
 	/**

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java Fri Aug 21
06:08:31 2009
@@ -233,7 +233,7 @@
 	 */
 	private static void throwExceptionIfPartNameHaveInvalidSegments(URI partUri)
 			throws InvalidFormatException {
-		if (partUri == null || "".equals(partUri)) {
+		if (partUri == null) {
 			throw new IllegalArgumentException("partUri");
 		}
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java Fri Aug
21 06:08:31 2009
@@ -120,8 +120,8 @@
 			return false;
 		}
 		PackageRelationship rel = (PackageRelationship) obj;
-		return (this.id == rel.id
-				&& this.relationshipType == rel.relationshipType
+		return (this.id.equals(rel.id)
+				&& this.relationshipType.equals(rel.relationshipType)
 				&& (rel.source != null ? rel.source.equals(this.source) : true)
 				&& this.targetMode == rel.targetMode && this.targetUri
 				.equals(rel.targetUri));
@@ -217,7 +217,7 @@
 		sb.append(container == null ? " - container=null" : " - container="
 				+ container.toString());
 		sb.append(relationshipType == null ? " - relationshipType=null"
-				: " - relationshipType=" + relationshipType.toString());
+				: " - relationshipType=" + relationshipType);
 		sb.append(source == null ? " - source=null" : " - source="
 				+ getSourceURI().toASCIIString());
 		sb.append(targetUri == null ? " - target=null" : " - target="

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java Fri Aug
21 06:08:31 2009
@@ -620,8 +620,8 @@
 		if (partName == null)
 			throw new IllegalArgumentException("partName");
 
-		if (PackagingURIHelper.PACKAGE_ROOT_URI.getPath() == partName.getURI()
-				.getPath())
+		if (PackagingURIHelper.PACKAGE_ROOT_URI.getPath().equals(
+                partName.getURI().getPath()) )
 			return PackagingURIHelper.PACKAGE_RELATIONSHIPS_ROOT_PART_NAME;
 
 		if (partName.isRelationshipPartURI())

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
Fri Aug 21 06:08:31 2009
@@ -574,10 +574,10 @@
 	 * @param d
 	 *            The Date to convert.
 	 * @return The formated date or null.
-	 * @see java.util.SimpleDateFormat
+	 * @see java.text.SimpleDateFormat
 	 */
 	private String getDateValue(Nullable<Date> d) {
-		if (d == null || d.equals("")) {
+		if (d == null) {
 			return "";
 		}
 		SimpleDateFormat df = new SimpleDateFormat(

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java Fri Aug
21 06:08:31 2009
@@ -113,7 +113,7 @@
 		if (opcItemName == null)
 			throw new IllegalArgumentException("opcItemName");
 
-		String retVal = new String(opcItemName);
+		String retVal = opcItemName;
 		while (retVal.startsWith(FORWARD_SLASH))
 			retVal = retVal.substring(1);
 		return retVal;
@@ -131,7 +131,7 @@
 		if (opcItemName == null)
 			throw new IllegalArgumentException("opcItemName");
 
-		String retVal = new String(opcItemName);
+		String retVal = opcItemName;
 		while (retVal.startsWith(FORWARD_SLASH))
 			retVal = retVal.substring(1);
 		try {

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/dev/XSSFDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/dev/XSSFDump.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/dev/XSSFDump.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/dev/XSSFDump.java Fri Aug 21 06:08:31 2009
@@ -20,8 +20,6 @@
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
 import java.io.*;
 import java.util.zip.ZipFile;
 import java.util.zip.ZipEntry;
@@ -43,9 +41,6 @@
     }
 
     public static void dump(ZipFile zip) throws Exception {
-        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        DocumentBuilder builder = factory.newDocumentBuilder();
-
         String zipname = zip.getName();
         int sep = zipname.lastIndexOf('.');
         File root = new File(zipname.substring(0, sep));

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java Fri Aug
21 06:08:31 2009
@@ -99,7 +99,7 @@
 		for(int i=0; i<workbook.getNumberOfSheets(); i++) {
 			XSSFSheet sheet = workbook.getSheetAt(i);
 			if(includeSheetNames) {
-				text.append(workbook.getSheetName(i) + "\n");
+				text.append(workbook.getSheetName(i)).append("\n");
 			}
 
 			// Header(s), if present
@@ -137,7 +137,7 @@
 					    // Replace any newlines with spaces, otherwise it
 					    //  breaks the output
 					    String commentText = comment.getString().getString().replace('\n', ' ');
-					    text.append(" Comment by "+comment.getAuthor()+": "+commentText);
+					    text.append(" Comment by ").append(comment.getAuthor()).append(": ").append(commentText);
 					}
 
 					if(ri.hasNext())

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java Fri Aug 21 06:08:31
2009
@@ -121,19 +121,14 @@
 			for (CTBorder border : doc.getStyleSheet().getBorders().getBorderArray()) {
 				borders.add(new XSSFCellBorder(border));
 			}
-			if(doc.getStyleSheet().getCellXfs() != null)
-			for (CTXf xf : doc.getStyleSheet().getCellXfs().getXfArray()) {
-				xfs.add(xf);
-			}
-			if(doc.getStyleSheet().getCellStyleXfs() != null)
-			for (CTXf xf : doc.getStyleSheet().getCellStyleXfs().getXfArray()) {
-				styleXfs.add(xf);
-			}
-			// dxf
-			if(doc.getStyleSheet().getDxfs() != null)
-			for (CTDxf dxf : doc.getStyleSheet().getDxfs().getDxfArray()) {
-				dxfs.add(dxf);
-			}
+            CTCellXfs cellXfs = doc.getStyleSheet().getCellXfs();
+            if(cellXfs != null) xfs.addAll(Arrays.asList(cellXfs.getXfArray()));
+
+            CTCellStyleXfs cellStyleXfs = doc.getStyleSheet().getCellStyleXfs();
+            if(cellStyleXfs != null) styleXfs.addAll(Arrays.asList(cellStyleXfs.getXfArray()));
+
+            CTDxfs styleDxfs = doc.getStyleSheet().getDxfs();
+			if(styleDxfs != null) dxfs.addAll(Arrays.asList(styleDxfs.getDxfArray()));
 
 		} catch (XmlException e) {
 			throw new IOException(e.getLocalizedMessage());

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java Fri Aug 21 06:08:31
2009
@@ -857,7 +857,7 @@
                 int sstIndex = Integer.parseInt(_cell.getV());
                 XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
                 String text = rt.getString();
-                return Boolean.valueOf(text).booleanValue();
+                return Boolean.valueOf(text);
             case CELL_TYPE_NUMERIC:
                 return Double.parseDouble(_cell.getV()) != 0;
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java Fri Aug 21 06:08:31
2009
@@ -311,7 +311,7 @@
      */
     public short getBottomBorderColor() {
         XSSFColor clr = getBottomBorderXSSFColor();
-        return clr == null ? IndexedColors.BLACK.getIndex() : (short)clr.getIndexed();
+        return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
     }
 
     /**
@@ -359,7 +359,7 @@
      */
     public short getFillBackgroundColor() {
         XSSFColor clr = getFillBackgroundXSSFColor();
-        return clr == null ? IndexedColors.AUTOMATIC.getIndex() : (short)clr.getIndexed();
+        return clr == null ? IndexedColors.AUTOMATIC.getIndex() : clr.getIndexed();
     }
 
     /**
@@ -391,7 +391,7 @@
      */
     public short getFillForegroundColor() {
         XSSFColor clr = getFillForegroundXSSFColor();
-        return clr == null ? IndexedColors.AUTOMATIC.getIndex() : (short)clr.getIndexed();
+        return clr == null ? IndexedColors.AUTOMATIC.getIndex() : clr.getIndexed();
     }
 
     /**
@@ -508,7 +508,7 @@
      */
     public short getLeftBorderColor() {
         XSSFColor clr = getLeftBorderXSSFColor();
-        return clr == null ? IndexedColors.BLACK.getIndex() : (short)clr.getIndexed();
+        return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
     }
 
     /**
@@ -543,7 +543,7 @@
      */
     public short getRightBorderColor() {
         XSSFColor clr = getRightBorderXSSFColor();
-        return clr == null ? IndexedColors.BLACK.getIndex() : (short)clr.getIndexed();
+        return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
     }
     /**
      * Get the color to use for the right border
@@ -586,7 +586,7 @@
      */
     public short getTopBorderColor() {
         XSSFColor clr = getTopBorderXSSFColor();
-        return clr == null ? IndexedColors.BLACK.getIndex() : (short)clr.getIndexed();
+        return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
     }
 
     /**

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Fri Aug 21 06:08:31
2009
@@ -1369,13 +1369,13 @@
     	}
 
     	boolean styleChanged = style != null
-    	&& ci.getStyle() != style.intValue();
+    	&& ci.getStyle() != style;
     	boolean levelChanged = level != null
-    	&& ci.getOutlineLevel() != level.intValue();
+    	&& ci.getOutlineLevel() != level;
     	boolean hiddenChanged = hidden != null
-    	&& ci.getHidden() != hidden.booleanValue();
+    	&& ci.getHidden() != hidden;
     	boolean collapsedChanged = collapsed != null
-    	&& ci.getCollapsed() != collapsed.booleanValue();
+    	&& ci.getCollapsed() != collapsed;
     	boolean columnChanged = levelChanged || hiddenChanged
     	|| collapsedChanged || styleChanged;
     	if (!columnChanged) {
@@ -1828,11 +1828,10 @@
     }
 
     /**
-     * @param rowIndex the zero based row index to expand
+     * @param rowNumber the zero based row index to expand
      */
     private void expandRow(int rowNumber) {
-    	int idx = rowNumber;
-    	if (idx == -1)
+    	if (rowNumber == -1)
     		return;
     	XSSFRow row = getRow(rowNumber);
     	// If it is already expanded do nothing.
@@ -1840,10 +1839,10 @@
     		return;
 
     	// Find the start of the group.
-    	int startIdx = findStartOfRowOutlineGroup(idx);
+    	int startIdx = findStartOfRowOutlineGroup(rowNumber);
 
     	// Find the end of the group.
-    	int endIdx = findEndOfRowOutlineGroup(idx);
+    	int endIdx = findEndOfRowOutlineGroup(rowNumber);
 
     	// expand:
     	// collapsed must be unset
@@ -1856,7 +1855,7 @@
     	// is the enclosing group
     	// hidden bit only is altered for this outline level. ie. don't
     	// un-collapse contained groups
-    	if (!isRowGroupHiddenByParent(idx)) {
+    	if (!isRowGroupHiddenByParent(rowNumber)) {
     		for (int i = startIdx; i < endIdx; i++) {
     			if (row.getCTRow().getOutlineLevel() == getRow(i).getCTRow()
     					.getOutlineLevel()) {
@@ -1871,7 +1870,7 @@
     }
 
     /**
-     * @param rowIndex the zero based row index to find from
+     * @param row the zero based row index to find from
      */
     public int findEndOfRowOutlineGroup(int row) {
     	int level = getRow(row).getCTRow().getOutlineLevel();
@@ -1886,7 +1885,7 @@
     }
 
     /**
-     * @param rowIndex the zero based row index to find from
+     * @param row the zero based row index to find from
      */
     private boolean isRowGroupHiddenByParent(int row) {
     	// Look out outline details of end
@@ -1922,7 +1921,7 @@
     }
 
     /**
-     * @param rowIndex the zero based row index to find from
+     * @param row the zero based row index to find from
      */
     private boolean isRowGroupCollapsed(int row) {
     	int collapseRow = findEndOfRowOutlineGroup(row) + 1;

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java Fri Aug 21 06:08:31
2009
@@ -28,6 +28,7 @@
 import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.XWPFTestDataSamples;
 
 /**
  * Test setting extended and custom OOXML properties
@@ -37,15 +38,7 @@
 	private CoreProperties _coreProperties;
 
 	public void setUp() throws Exception{
-		File sampleFile = new File(
-				System.getProperty("HWPF.testdata.path") +
-				File.separator + "documentProperties.docx"
-		);
-		assertTrue(sampleFile.exists());
-		XWPFDocument sampleDoc;
-		sampleDoc = new XWPFDocument(
-				POIXMLDocument.openPackage(sampleFile.toString())
-		);
+        XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("documentProperties.docx");
 		_props = sampleDoc.getProperties();
 		_coreProperties = _props.getCoreProperties();
 		assertNotNull(_props);

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java?rev=806426&r1=806425&r2=806426&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java Fri Aug 21 06:08:31 2009
@@ -696,7 +696,6 @@
      */
     private void testRecreate(final File f)
     {
-        System.out.println("Recreating file \"" + f + "\"");
         try
         {
             /* Read the POI filesystem's property set streams: */



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message