]> source.dussan.org Git - poi.git/commitdiff
Fix some Sonar issues and some IntelliJ warnings
authorDominik Stadler <centic@apache.org>
Thu, 2 Jun 2016 20:14:28 +0000 (20:14 +0000)
committerDominik Stadler <centic@apache.org>
Thu, 2 Jun 2016 20:14:28 +0000 (20:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1746627 13f79535-47bb-0310-9956-ffa450edef68

20 files changed:
src/examples/src/org/apache/poi/xssf/usermodel/examples/Outlining.java
src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java
src/excelant/java/org/apache/poi/ss/excelant/ExcelAntEvaluateCell.java
src/excelant/java/org/apache/poi/ss/excelant/ExcelAntSetDoubleCell.java
src/excelant/java/org/apache/poi/ss/excelant/ExcelAntSetStringCell.java
src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTest.java
src/excelant/java/org/apache/poi/ss/excelant/IExcelAntWorkbookHandler.java
src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java
src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilFactory.java
src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java
src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
src/java/org/apache/poi/ss/usermodel/ExtendedColor.java
src/ooxml/java/org/apache/poi/POIXMLDocument.java
src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java
src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java
src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java

index 71d63b1f5518a5402b94c75737e034d3d591995a..869316f087a4a585ba0aad823e2e000e547edf1a 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.xssf.usermodel.examples;
 
 import java.io.FileOutputStream;
+import java.io.OutputStream;
 
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -25,51 +26,56 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
 public class Outlining {
 
-    public static void main(String[]args) throws Exception{
-       Outlining o=new Outlining();
-       o.groupRowColumn();
-       o.collapseExpandRowColumn();
+    public static void main(String[] args) throws Exception {
+        Outlining o=new Outlining();
+        o.groupRowColumn();
+        o.collapseExpandRowColumn();
     }
 
 
-    private void groupRowColumn() throws Exception{
-       Workbook wb = new XSSFWorkbook();
-       Sheet sheet1 = wb.createSheet("new sheet");
+    private void groupRowColumn() throws Exception {
+        Workbook wb = new XSSFWorkbook();
+        Sheet sheet1 = wb.createSheet("new sheet");
 
-       sheet1.groupRow( 5, 14 );
-       sheet1.groupRow( 7, 14 );
-       sheet1.groupRow( 16, 19 );
+        sheet1.groupRow( 5, 14 );
+        sheet1.groupRow( 7, 14 );
+        sheet1.groupRow( 16, 19 );
 
-       sheet1.groupColumn( (short)4, (short)7 );
-       sheet1.groupColumn( (short)9, (short)12 );
-       sheet1.groupColumn( (short)10, (short)11 );
-
-       FileOutputStream fileOut = new FileOutputStream("outlining.xlsx");
-       wb.write(fileOut);
-       fileOut.close();
+        sheet1.groupColumn( (short)4, (short)7 );
+        sheet1.groupColumn( (short)9, (short)12 );
+        sheet1.groupColumn( (short)10, (short)11 );
 
+        OutputStream fileOut = new FileOutputStream("outlining.xlsx");
+        try {
+            wb.write(fileOut);
+        } finally {
+            fileOut.close();
+        }
     }
 
-    private void collapseExpandRowColumn()throws Exception{
-       Workbook wb2 = new XSSFWorkbook();
-       Sheet sheet2 = wb2.createSheet("new sheet");
-       sheet2.groupRow( 5, 14 );
-       sheet2.groupRow( 7, 14 );
-       sheet2.groupRow( 16, 19 );
-
-       sheet2.groupColumn( (short)4, (short)7 );
-       sheet2.groupColumn( (short)9, (short)12 );
-       sheet2.groupColumn( (short)10, (short)11 );
-       
-       
-       sheet2.setRowGroupCollapsed( 7, true );
-       //sheet1.setRowGroupCollapsed(7,false);
-       
-       sheet2.setColumnGroupCollapsed( (short)4, true );       
-       sheet2.setColumnGroupCollapsed( (short)4, false );
-       
-       FileOutputStream fileOut = new FileOutputStream("outlining_collapsed.xlsx");
-       wb2.write(fileOut);
-       fileOut.close();
+    private void collapseExpandRowColumn() throws Exception {
+        Workbook wb2 = new XSSFWorkbook();
+        Sheet sheet2 = wb2.createSheet("new sheet");
+        sheet2.groupRow( 5, 14 );
+        sheet2.groupRow( 7, 14 );
+        sheet2.groupRow( 16, 19 );
+
+        sheet2.groupColumn( (short)4, (short)7 );
+        sheet2.groupColumn( (short)9, (short)12 );
+        sheet2.groupColumn( (short)10, (short)11 );
+
+
+        sheet2.setRowGroupCollapsed( 7, true );
+        //sheet1.setRowGroupCollapsed(7,false);
+
+        sheet2.setColumnGroupCollapsed( (short)4, true );
+        sheet2.setColumnGroupCollapsed( (short)4, false );
+
+        OutputStream fileOut = new FileOutputStream("outlining_collapsed.xlsx");
+        try {
+            wb2.write(fileOut);
+        } finally {
+            fileOut.close();
+        }
     }
 }
index 5d07fe21641591f633661e048365c89d32d49547..387ab449b0dcc9784312b37dd423513b20ff47fd 100644 (file)
@@ -17,6 +17,7 @@
 package org.apache.poi.xwpf.usermodel;
 
 import java.io.FileOutputStream;
+import java.io.OutputStream;
 import java.math.BigInteger;
 import java.util.List;
 
@@ -62,32 +63,37 @@ public class SimpleTable {
     public static void createSimpleTable() throws Exception {
         XWPFDocument doc = new XWPFDocument();
 
-        XWPFTable table = doc.createTable(3, 3);
-
-        table.getRow(1).getCell(1).setText("EXAMPLE OF TABLE");
-
-        // table cells have a list of paragraphs; there is an initial
-        // paragraph created when the cell is created. If you create a
-        // paragraph in the document to put in the cell, it will also
-        // appear in the document following the table, which is probably
-        // not the desired result.
-        XWPFParagraph p1 = table.getRow(0).getCell(0).getParagraphs().get(0);
-
-        XWPFRun r1 = p1.createRun();
-        r1.setBold(true);
-        r1.setText("The quick brown fox");
-        r1.setItalic(true);
-        r1.setFontFamily("Courier");
-        r1.setUnderline(UnderlinePatterns.DOT_DOT_DASH);
-        r1.setTextPosition(100);
-
-        table.getRow(2).getCell(2).setText("only text");
-
-        FileOutputStream out = new FileOutputStream("simpleTable.docx");
-        doc.write(out);
-        out.close();
-        
-        doc.close();
+        try {
+            XWPFTable table = doc.createTable(3, 3);
+
+            table.getRow(1).getCell(1).setText("EXAMPLE OF TABLE");
+
+            // table cells have a list of paragraphs; there is an initial
+            // paragraph created when the cell is created. If you create a
+            // paragraph in the document to put in the cell, it will also
+            // appear in the document following the table, which is probably
+            // not the desired result.
+            XWPFParagraph p1 = table.getRow(0).getCell(0).getParagraphs().get(0);
+
+            XWPFRun r1 = p1.createRun();
+            r1.setBold(true);
+            r1.setText("The quick brown fox");
+            r1.setItalic(true);
+            r1.setFontFamily("Courier");
+            r1.setUnderline(UnderlinePatterns.DOT_DOT_DASH);
+            r1.setTextPosition(100);
+
+            table.getRow(2).getCell(2).setText("only text");
+
+            OutputStream out = new FileOutputStream("simpleTable.docx");
+            try {
+                doc.write(out);
+            } finally {
+                out.close();
+            }
+        } finally {
+            doc.close();
+        }
     }
 
     /**
@@ -107,92 +113,94 @@ public class SimpleTable {
     public static void createStyledTable() throws Exception {
        // Create a new document from scratch
         XWPFDocument doc = new XWPFDocument();
-       // -- OR --
-        // open an existing empty document with styles already defined
-        //XWPFDocument doc = new XWPFDocument(new FileInputStream("base_document.docx"));
-
-       // Create a new table with 6 rows and 3 columns
-       int nRows = 6;
-       int nCols = 3;
-        XWPFTable table = doc.createTable(nRows, nCols);
-
-        // Set the table style. If the style is not defined, the table style
-        // will become "Normal".
-        CTTblPr tblPr = table.getCTTbl().getTblPr();
-        CTString styleStr = tblPr.addNewTblStyle();
-        styleStr.setVal("StyledTable");
-
-        // Get a list of the rows in the table
-        List<XWPFTableRow> rows = table.getRows();
-        int rowCt = 0;
-        int colCt = 0;
-        for (XWPFTableRow row : rows) {
-               // get table row properties (trPr)
-               CTTrPr trPr = row.getCtRow().addNewTrPr();
-               // set row height; units = twentieth of a point, 360 = 0.25"
-               CTHeight ht = trPr.addNewTrHeight();
-               ht.setVal(BigInteger.valueOf(360));
-
-               // get the cells in this row
-               List<XWPFTableCell> cells = row.getTableCells();
-            // add content to each cell
-               for (XWPFTableCell cell : cells) {
-                       // get a table cell properties element (tcPr)
-                       CTTcPr tcpr = cell.getCTTc().addNewTcPr();
-                       // set vertical alignment to "center"
-                       CTVerticalJc va = tcpr.addNewVAlign();
-                       va.setVal(STVerticalJc.CENTER);
-
-                       // create cell color element
-                       CTShd ctshd = tcpr.addNewShd();
-                ctshd.setColor("auto");
-                ctshd.setVal(STShd.CLEAR);
-                if (rowCt == 0) {
-                       // header row
-                       ctshd.setFill("A7BFDE");
-                }
-               else if (rowCt % 2 == 0) {
-                       // even row
-                       ctshd.setFill("D3DFEE");
-               }
-               else {
-                       // odd row
-                       ctshd.setFill("EDF2F8");
-               }
-
-                // get 1st paragraph in cell's paragraph list
-                XWPFParagraph para = cell.getParagraphs().get(0);
-                // create a run to contain the content
-                XWPFRun rh = para.createRun();
-                // style cell as desired
-                if (colCt == nCols - 1) {
-                       // last column is 10pt Courier
-                       rh.setFontSize(10);
-                       rh.setFontFamily("Courier");
-                }
-                if (rowCt == 0) {
-                       // header row
-                    rh.setText("header row, col " + colCt);
-                       rh.setBold(true);
-                    para.setAlignment(ParagraphAlignment.CENTER);
-                }
-               else {
-                       // other rows
-                    rh.setText("row " + rowCt + ", col " + colCt);
-                    para.setAlignment(ParagraphAlignment.LEFT);
-               }
-                colCt++;
-               } // for cell
-               colCt = 0;
-               rowCt++;
-        } // for row
-
-        // write the file
-        FileOutputStream out = new FileOutputStream("styledTable.docx");
-        doc.write(out);
-        out.close();
-        
-        doc.close();
-    }
 
+        try {
+            // -- OR --
+            // open an existing empty document with styles already defined
+            //XWPFDocument doc = new XWPFDocument(new FileInputStream("base_document.docx"));
+
+            // Create a new table with 6 rows and 3 columns
+            int nRows = 6;
+            int nCols = 3;
+            XWPFTable table = doc.createTable(nRows, nCols);
+
+            // Set the table style. If the style is not defined, the table style
+            // will become "Normal".
+            CTTblPr tblPr = table.getCTTbl().getTblPr();
+            CTString styleStr = tblPr.addNewTblStyle();
+            styleStr.setVal("StyledTable");
+
+            // Get a list of the rows in the table
+            List<XWPFTableRow> rows = table.getRows();
+            int rowCt = 0;
+            int colCt = 0;
+            for (XWPFTableRow row : rows) {
+                // get table row properties (trPr)
+                CTTrPr trPr = row.getCtRow().addNewTrPr();
+                // set row height; units = twentieth of a point, 360 = 0.25"
+                CTHeight ht = trPr.addNewTrHeight();
+                ht.setVal(BigInteger.valueOf(360));
+
+                // get the cells in this row
+                List<XWPFTableCell> cells = row.getTableCells();
+                // add content to each cell
+                for (XWPFTableCell cell : cells) {
+                    // get a table cell properties element (tcPr)
+                    CTTcPr tcpr = cell.getCTTc().addNewTcPr();
+                    // set vertical alignment to "center"
+                    CTVerticalJc va = tcpr.addNewVAlign();
+                    va.setVal(STVerticalJc.CENTER);
+
+                    // create cell color element
+                    CTShd ctshd = tcpr.addNewShd();
+                    ctshd.setColor("auto");
+                    ctshd.setVal(STShd.CLEAR);
+                    if (rowCt == 0) {
+                        // header row
+                        ctshd.setFill("A7BFDE");
+                    } else if (rowCt % 2 == 0) {
+                        // even row
+                        ctshd.setFill("D3DFEE");
+                    } else {
+                        // odd row
+                        ctshd.setFill("EDF2F8");
+                    }
+
+                    // get 1st paragraph in cell's paragraph list
+                    XWPFParagraph para = cell.getParagraphs().get(0);
+                    // create a run to contain the content
+                    XWPFRun rh = para.createRun();
+                    // style cell as desired
+                    if (colCt == nCols - 1) {
+                        // last column is 10pt Courier
+                        rh.setFontSize(10);
+                        rh.setFontFamily("Courier");
+                    }
+                    if (rowCt == 0) {
+                        // header row
+                        rh.setText("header row, col " + colCt);
+                        rh.setBold(true);
+                        para.setAlignment(ParagraphAlignment.CENTER);
+                    } else {
+                        // other rows
+                        rh.setText("row " + rowCt + ", col " + colCt);
+                        para.setAlignment(ParagraphAlignment.LEFT);
+                    }
+                    colCt++;
+                } // for cell
+                colCt = 0;
+                rowCt++;
+            } // for row
+
+            // write the file
+            OutputStream out = new FileOutputStream("styledTable.docx");
+            try {
+                doc.write(out);
+            } finally {
+                out.close();
+            }
+        } finally {
+            doc.close();
+        }
+    }
 }
index d35cc6a7d8d76a898d0550fcfb779bc6328795bb..55e51975fe23fcfb2935d3bdcae7386eec83c688 100644 (file)
@@ -125,13 +125,13 @@ public class ExcelAntEvaluateCell extends Task {
                }
                result = wbUtil.evaluateCell(cell, expectedValue, precisionToUse ) ;
                
-               StringBuffer sb = new StringBuffer() ;
+               StringBuilder sb = new StringBuilder() ;
                sb.append( "evaluation of cell " ) ;
                sb.append( cell ) ; 
                sb.append( " resulted in " ) ;
                sb.append( result.getReturnValue() ) ;
-               if( showDelta == true ) {
-                       sb.append( " with a delta of " + result.getDelta() ) ;
+               if(showDelta) {
+                       sb.append(" with a delta of ").append(result.getDelta());
                }
                
                log( sb.toString(), Project.MSG_DEBUG) ;
@@ -141,6 +141,4 @@ public class ExcelAntEvaluateCell extends Task {
        public ExcelAntEvaluationResult getResult() {
                return result ;
        }
-       
-       
 }
index a1113509a23f1d1d5eefcbae50920e946a8db19d..3e6c4cd607f516bef5f4d9fceafb619bc783bd91 100644 (file)
@@ -29,15 +29,13 @@ import org.apache.tools.ant.Project;
  * 
  */
 public class ExcelAntSetDoubleCell extends ExcelAntSet {
-       
-       
-       private double cellValue ;
+       private double cellValue;
        
        public ExcelAntSetDoubleCell() {}
        
        /**
         * Set the value of the specified cell as the double passed in.
-        * @param value
+        * @param value The double-value that should be set when this task is executed.
         */
        public void setValue( double value ) {
                cellValue = value ;
@@ -45,14 +43,14 @@ public class ExcelAntSetDoubleCell extends ExcelAntSet {
 
        /**
         * Return the cell value as a double.
-        * @return
+        * @return The double-value of the cell as populated via setValue(), null
+        *              if the value was not set yet.
         */
        public double getCellValue() {
                return cellValue;
        }
        
        public void execute() throws BuildException {
-
                wbUtil.setDoubleValue(cellStr, cellValue ) ;
                
                log( "set cell " + cellStr + " to value " + cellValue + " as double.", Project.MSG_DEBUG ) ;
index 12221ee170345e60b3584e0d141d4b4d08b67ffc..047e544ea52dc64a2b8be3248e23215f57e62fd9 100644 (file)
@@ -29,17 +29,13 @@ import org.apache.tools.ant.Project;
  *
  */
 public class ExcelAntSetStringCell extends ExcelAntSet {
-       
-       
        private String stringValue ;
-       
-       
+
        public ExcelAntSetStringCell() {}
 
-       
        /**
         * Set the value of the cell to the String passed in.
-        * @param value
+        * @param value The string-value that should be set when this task is executed.
         */
        public void setValue(String value ) {
                stringValue = value ;
@@ -47,14 +43,14 @@ public class ExcelAntSetStringCell extends ExcelAntSet {
 
        /**
         * Return the value that will be set into the cell.
-        * @return
+        * @return The string-value of the cell as populated via setValue(), null
+        *              if the value was not set yet.
         */
        public String getCellValue() {
                return stringValue;
        }
        
        public void execute() throws BuildException {
-
                wbUtil.setStringValue(cellStr, stringValue ) ;
                
                log( "set cell " + cellStr + " to value " + stringValue + " as String.", Project.MSG_DEBUG ) ;
index ad0cf6b845e3decceaf936941d5b62f2d3c1cc5e..13271611b1cd0ce607071f1006340bc384f048ff 100644 (file)
 
 package org.apache.poi.ss.excelant;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Locale;
-
 import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
 import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -33,6 +25,13 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.Locale;
+
 /**
  * Ant task class for testing Excel workbook cells.
  * 
@@ -85,7 +84,7 @@ public class ExcelAntTask extends Task {
                int totalCount = 0 ;
                int successCount = 0 ;
                
-               StringBuffer versionBffr = new StringBuffer() ;
+               StringBuilder versionBffr = new StringBuilder() ;
                versionBffr.append(  "ExcelAnt version " ) ;
                versionBffr.append( VERSION ) ;
                versionBffr.append( " Copyright 2011" ) ;
@@ -107,43 +106,38 @@ public class ExcelAntTask extends Task {
                        return ;
                }
                if( tests.size() > 0 ) {
-                       
-                       Iterator<ExcelAntTest> testsIt = tests.iterator() ;
-                       while( testsIt.hasNext() ) {
-                               ExcelAntTest test = testsIt.next();
-                               
-                               log( "executing test: " + test.getName(), Project.MSG_DEBUG ) ;
-               
-                               workbookUtil = ExcelAntWorkbookUtilFactory.getInstance( excelFileName ) ;
-                               
-                               Iterator<ExcelAntUserDefinedFunction> functionsIt = functions.iterator() ;
-                               while( functionsIt.hasNext() ) {
-                                       ExcelAntUserDefinedFunction eaUdf = functionsIt.next() ;
+
+                       for (ExcelAntTest test : tests) {
+                               log("executing test: " + test.getName(), Project.MSG_DEBUG);
+
+                               workbookUtil = ExcelAntWorkbookUtilFactory.getInstance(excelFileName);
+
+                               for (ExcelAntUserDefinedFunction eaUdf : functions) {
                                        try {
-                                               workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName() ) ;
-                                       } catch ( Exception e) {
-                                               throw new BuildException( e.getMessage(), e ); 
+                                               workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName());
+                                       } catch (Exception e) {
+                                               throw new BuildException(e.getMessage(), e);
                                        }
                                }
-                               test.setWorkbookUtil( workbookUtil ) ;
-                               
-                               if( precision != null && precision.getValue() > 0 ) {
-                                       log( "setting precision for the test " + test.getName(), Project.MSG_VERBOSE ) ; 
-                                       test.setPrecision( precision.getValue() ) ;
+                               test.setWorkbookUtil(workbookUtil);
+
+                               if (precision != null && precision.getValue() > 0) {
+                                       log("setting precision for the test " + test.getName(), Project.MSG_VERBOSE);
+                                       test.setPrecision(precision.getValue());
                                }
-                               
-                               test.execute() ;
-                               
-                               if( test.didTestPass() ) {
-                                       successCount++ ;
+
+                               test.execute();
+
+                               if (test.didTestPass()) {
+                                       successCount++;
                                } else {
-                                       if( failOnError == true ) {
-                                               throw new BuildException( "Test " + test.getName() + " failed." ) ;
+                                       if (failOnError) {
+                                               throw new BuildException("Test " + test.getName() + " failed.");
                                        }
                                }
-                               totalCount++ ;
-                               
-                               workbookUtil = null ;
+                               totalCount++;
+
+                               workbookUtil = null;
                        }
                        log( successCount + "/" + totalCount + " tests passed.", Project.MSG_INFO ) ;
                        workbookUtil = null ;
index 719b05699cbf5abf2cd057fee1cd491e6a053354..36b9b6d9e0cf8a3df5b1e1655657f6094e61034e 100644 (file)
@@ -162,9 +162,9 @@ public class ExcelAntTest extends Task{
                    try {
                        eval.execute();
                        ExcelAntEvaluationResult result = eval.getResult();
-                       if( result.didTestPass() && 
-                               result.evaluationCompleteWithError() == false ) {
-                           if( showSuccessDetails == true ) {
+                       if( result.didTestPass() &&
+                                                       !result.evaluationCompleteWithError()) {
+                           if(showSuccessDetails) {
                                log("Succeeded when evaluating " + 
                                 result.getCellName() + ".  It evaluated to " + 
                              result.getReturnValue() + " when the value of " + 
@@ -172,7 +172,7 @@ public class ExcelAntTest extends Task{
                              eval.getPrecision(), Project.MSG_INFO );
                            }
                        } else {
-                           if( showFailureDetail == true ) {
+                           if(showFailureDetail) {
                                failureMessages.add( "\tFailed to evaluate cell " + 
                                 result.getCellName() + ".  It evaluated to " + 
                                 result.getReturnValue() + " when the value of " + 
@@ -183,7 +183,7 @@ public class ExcelAntTest extends Task{
                            passed = false;
                            failureCount++;
                            
-                           if( eval.requiredToPass() == true ) {
+                           if(eval.requiredToPass()) {
                                throw new BuildException( "\tFailed to evaluate cell " + 
                                        result.getCellName() + ".  It evaluated to " + 
                                        result.getReturnValue() + " when the value of " + 
@@ -200,15 +200,14 @@ public class ExcelAntTest extends Task{
                }
            }
  
-               if( passed == false ) {
+               if(!passed) {
                        log( "Test named " + name + " failed because " + failureCount + 
                                         " of " + testCount + " evaluations failed to " + 
                                         "evaluate correctly.", 
                                         Project.MSG_ERR );
-                       if( showFailureDetail == true && failureMessages.size() > 0 ) {
-                               Iterator<String> failures = failureMessages.iterator();
-                               while( failures.hasNext() ) {
-                                       log( failures.next(), Project.MSG_ERR );
+                       if(showFailureDetail && failureMessages.size() > 0 ) {
+                               for (String failureMessage : failureMessages) {
+                                       log(failureMessage, Project.MSG_ERR);
                                }
                        }
                }
index 3cd477abc861dcaf07f82726c9baa188edbb4f14..139e34c0d770be9a0ad552505781af3857af2708 100644 (file)
@@ -36,11 +36,7 @@ import org.apache.poi.ss.usermodel.Workbook;
  *\r
  */\r
 public interface IExcelAntWorkbookHandler {\r
-    \r
-    \r
     public void setWorkbook( Workbook workbook ) ;\r
     \r
     public void execute() ;\r
-    \r
-\r
 }\r
index 7d2fbe4fc38f0c72b3cb4bd1225c91aeed2b4ace..627493b291004e5c05e8b37256db34765ed785b2 100644 (file)
@@ -67,7 +67,8 @@ public class ExcelAntWorkbookUtil extends Typedef {
      * path of the Excel file. This constructor initializes a Workbook instance
      * based on that file name.
      *
-     * @param fName
+     * @param fName The fully qualified path of the Excel file.
+     * @throws BuildException If the workbook cannot be loaded.
      */
     protected ExcelAntWorkbookUtil(String fName) {
         excelFileName = fName;
@@ -78,7 +79,7 @@ public class ExcelAntWorkbookUtil extends Typedef {
     /**
      * Constructs an instance based on a Workbook instance.
      *
-     * @param wb
+     * @param wb The Workbook to use for this instance.
      */
     protected ExcelAntWorkbookUtil(Workbook wb) {
         workbook = wb;
@@ -86,7 +87,8 @@ public class ExcelAntWorkbookUtil extends Typedef {
 
     /**
      * Loads the member variable workbook based on the fileName variable.
-     * @return
+     * @return The opened Workbook-instance
+     * @throws BuildException If the workbook cannot be loaded.
      */
     private Workbook loadWorkbook() {
 
index e9d385146a8e72938a349da40a52f47602957074..08e7fb3d9876d19aa7aa9b4845fbdfcc46bb309c 100644 (file)
@@ -40,15 +40,16 @@ public final class ExcelAntWorkbookUtilFactory {
      * Using the fileName, check the internal map to see if an instance\r
      * of the WorkbookUtil exists.  If not, then add an instance to the map.\r
      *\r
-     * @param fileName\r
-     * @return\r
+     * @param fileName The filename to use as key to look for the ExcelAntWorkbookUtil.\r
+     * @return An instance of ExcelAntWorkbookUtil associated with the filename or\r
+     *          a freshly instantiated one if none did exist before.\r
      */\r
     public static ExcelAntWorkbookUtil getInstance(String fileName) {\r
         if(workbookUtilMap == null) {\r
             workbookUtilMap = new HashMap<String, ExcelAntWorkbookUtil>();\r
         }\r
-        if(workbookUtilMap != null &&\r
-                workbookUtilMap.containsKey(fileName)) {\r
+\r
+        if(workbookUtilMap.containsKey(fileName)) {\r
             return workbookUtilMap.get(fileName);\r
         }\r
 \r
index d39601b964de79dc6d18d89ac78986a89592825d..80203d43638c83c4a879e54ca13ed4e54949a37b 100644 (file)
@@ -61,11 +61,12 @@ public class EscherClientAnchorRecord
         int size           = 0;
 
         // Always find 4 two byte entries. Sometimes find 9
-        if (bytesRemaining == 4) // Word format only 4 bytes
+        /*if (bytesRemaining == 4) // Word format only 4 bytes
         {
             // Not sure exactly what the format is quite yet, likely a reference to a PLC
         }
-        else
+        else */
+        if (bytesRemaining != 4) // Word format only 4 bytes
         {
             field_1_flag   =  LittleEndian.getShort( data, pos + size );     size += 2;
             field_2_col1   =  LittleEndian.getShort( data, pos + size );     size += 2;
@@ -157,20 +158,18 @@ public class EscherClientAnchorRecord
     @Override
     public String toXml(String tab) {
         String extraData = HexDump.dump(this.remainingData, 0, 0).trim();
-        StringBuilder builder = new StringBuilder();
-        builder.append(tab).append(formatXmlRecordHeader(getClass().getSimpleName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance())))
-                .append(tab).append("\t").append("<Flag>").append(field_1_flag).append("</Flag>\n")
-                .append(tab).append("\t").append("<Col1>").append(field_2_col1).append("</Col1>\n")
-                .append(tab).append("\t").append("<DX1>").append(field_3_dx1).append("</DX1>\n")
-                .append(tab).append("\t").append("<Row1>").append(field_4_row1).append("</Row1>\n")
-                .append(tab).append("\t").append("<DY1>").append(field_5_dy1).append("</DY1>\n")
-                .append(tab).append("\t").append("<Col2>").append(field_6_col2).append("</Col2>\n")
-                .append(tab).append("\t").append("<DX2>").append(field_7_dx2).append("</DX2>\n")
-                .append(tab).append("\t").append("<Row2>").append(field_8_row2).append("</Row2>\n")
-                .append(tab).append("\t").append("<DY2>").append(field_9_dy2).append("</DY2>\n")
-                .append(tab).append("\t").append("<ExtraData>").append(extraData).append("</ExtraData>\n");
-        builder.append(tab).append("</").append(getClass().getSimpleName()).append(">\n");
-        return builder.toString();
+        return tab + formatXmlRecordHeader(getClass().getSimpleName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance())) +
+                tab + "\t" + "<Flag>" + field_1_flag + "</Flag>\n" +
+                tab + "\t" + "<Col1>" + field_2_col1 + "</Col1>\n" +
+                tab + "\t" + "<DX1>" + field_3_dx1 + "</DX1>\n" +
+                tab + "\t" + "<Row1>" + field_4_row1 + "</Row1>\n" +
+                tab + "\t" + "<DY1>" + field_5_dy1 + "</DY1>\n" +
+                tab + "\t" + "<Col2>" + field_6_col2 + "</Col2>\n" +
+                tab + "\t" + "<DX2>" + field_7_dx2 + "</DX2>\n" +
+                tab + "\t" + "<Row2>" + field_8_row2 + "</Row2>\n" +
+                tab + "\t" + "<DY2>" + field_9_dy2 + "</DY2>\n" +
+                tab + "\t" + "<ExtraData>" + extraData + "</ExtraData>\n" +
+                tab + "</" + getClass().getSimpleName() + ">\n";
     }
 
     /**
index a8cf33176d2064c7c210a80db7af872f7fb14258..a7063003a4057a3eb52f2938be3d7ef2f257100b 100644 (file)
@@ -179,9 +179,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
      * used internally to set the properties given a Sheet object
      */
     private void setPropertiesFromSheet(InternalSheet sheet) {
-
         RowRecord row = sheet.getNextRow();
-        boolean rowRecordsAlreadyPresent = row != null;
 
         while (row != null) {
             createRowFromRecord(row);
@@ -767,7 +765,6 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
     /**
      * Verify that none of the merged regions intersect a multi-cell array formula in this sheet
      *
-     * @param region
      * @throws IllegalStateException if candidate region intersects an existing array formula in this sheet
      */
     private void checkForMergedRegionsIntersectingArrayFormulas() {
@@ -1451,10 +1448,10 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
      * <p/>
      * TODO: MODE , this is only row specific
      *
-     * @param startRow
-     * @param endRow
-     * @param n
-     * @param isRow
+     * @param startRow the start-index of the rows to shift, zero-based
+     * @param endRow the end-index of the rows to shift, zero-based
+     * @param n how far to shift, negative to shift up
+     * @param isRow unused, kept for backwards compatibility
      */
     protected void shiftMerged(int startRow, int endRow, int n, boolean isRow) {
         List<CellRangeAddress> shiftedRegions = new ArrayList<CellRangeAddress>();
@@ -1483,10 +1480,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
         }
 
         //read so it doesn't get shifted again
-        Iterator<CellRangeAddress> iterator = shiftedRegions.iterator();
-        while (iterator.hasNext()) {
-            CellRangeAddress region = iterator.next();
-
+        for (CellRangeAddress region : shiftedRegions) {
             this.addMergedRegion(region);
         }
     }
@@ -1942,7 +1936,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
     /**
      * Removes a page break at the indicated column
      *
-     * @param column
+     * @param column The index of the column for which to remove a page-break, zero-based
      */
     @Override
     public void removeColumnBreak(int column) {
@@ -1952,7 +1946,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
     /**
      * Runs a bounds check for row numbers
      *
-     * @param row
+     * @param row the index of the row to validate, zero-based
      */
     protected void validateRow(int row) {
         int maxrow = SpreadsheetVersion.EXCEL97.getLastRowIndex();
@@ -1963,7 +1957,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
     /**
      * Runs a bounds check for column numbers
      *
-     * @param column
+     * @param column the index of the column to validate, zero-based
      */
     protected void validateColumn(int column) {
         int maxcol = SpreadsheetVersion.EXCEL97.getLastColumnIndex();
@@ -1980,8 +1974,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
 
         EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid);
         List<EscherRecord> escherRecords = r.getEscherRecords();
-        for (Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); ) {
-            EscherRecord escherRecord = iterator.next();
+        for (EscherRecord escherRecord : escherRecords) {
             if (fat) {
                 pw.println(escherRecord.toString());
             } else {
@@ -2013,8 +2006,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
         }
 
         // Grab our aggregate record, and wire it up
-        EscherAggregate agg = (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid);
-        return agg;
+        return (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid);
     }
 
     /**
@@ -2043,7 +2035,6 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
     }
 
     private HSSFPatriarch getPatriarch(boolean createIfMissing) {
-        HSSFPatriarch patriarch = null;
         if (_patriarch != null) {
             return _patriarch;
         }
@@ -2063,7 +2054,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
                 if (createIfMissing) {
                     pos = _sheet.aggregateDrawingRecords(dm, true);
                     agg = (EscherAggregate) _sheet.getRecords().get(pos);
-                    patriarch = new HSSFPatriarch(this, agg);
+                    HSSFPatriarch patriarch = new HSSFPatriarch(this, agg);
                     patriarch.afterCreate();
                     return patriarch;
                 } else {
@@ -2204,16 +2195,15 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
     /**
      * Get a Hyperlink in this sheet anchored at row, column
      *
-     * @param row
-     * @param column
+     * @param row The index of the row of the hyperlink, zero-based
+     * @param column the index of the column of the hyperlink, zero-based
      * @return hyperlink if there is a hyperlink anchored at row, column; otherwise returns null
      */
     @Override
     public HSSFHyperlink getHyperlink(int row, int column) {
-        for (Iterator<RecordBase> it = _sheet.getRecords().iterator(); it.hasNext(); ) {
-            RecordBase rec = it.next();
-            if (rec instanceof HyperlinkRecord){
-                HyperlinkRecord link = (HyperlinkRecord)rec;
+        for (RecordBase rec : _sheet.getRecords()) {
+            if (rec instanceof HyperlinkRecord) {
+                HyperlinkRecord link = (HyperlinkRecord) rec;
                 if (link.getFirstColumn() == column && link.getFirstRow() == row) {
                     return new HSSFHyperlink(link);
                 }
@@ -2230,10 +2220,9 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
     @Override
     public List<HSSFHyperlink> getHyperlinkList() {
         final List<HSSFHyperlink> hyperlinkList = new ArrayList<HSSFHyperlink>();
-        for (Iterator<RecordBase> it = _sheet.getRecords().iterator(); it.hasNext(); ) {
-            RecordBase rec = it.next();
-            if (rec instanceof HyperlinkRecord){
-                HyperlinkRecord link = (HyperlinkRecord)rec;
+        for (RecordBase rec : _sheet.getRecords()) {
+            if (rec instanceof HyperlinkRecord) {
+                HyperlinkRecord link = (HyperlinkRecord) rec;
                 hyperlinkList.add(new HSSFHyperlink(link));
             }
         }
@@ -2586,16 +2575,14 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
                 if (areaPtg.getFirstColumn() == 0
                         && areaPtg.getLastColumn() == maxColIndex) {
                     if (rows) {
-                        CellRangeAddress rowRange = new CellRangeAddress(
+                        return new CellRangeAddress(
                                 areaPtg.getFirstRow(), areaPtg.getLastRow(), -1, -1);
-                        return rowRange;
                     }
                 } else if (areaPtg.getFirstRow() == 0
                         && areaPtg.getLastRow() == maxRowIndex) {
                     if (!rows) {
-                        CellRangeAddress columnRange = new CellRangeAddress(-1, -1,
+                        return new CellRangeAddress(-1, -1,
                                 areaPtg.getFirstColumn(), areaPtg.getLastColumn());
-                        return columnRange;
                     }
                 }
 
index 7f65a40ef84a8d5083df613d6ece1e3286e8a087..414fbc40aa9ae4b5d3ba8db4ec894414d288c78a 100644 (file)
@@ -19,7 +19,6 @@ package org.apache.poi.ss.usermodel;
 import java.util.Locale;
 
 import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.ss.usermodel.Color;
 
 /**
  * Represents a XSSF-style color (based on either a
@@ -80,26 +79,23 @@ public abstract class ExtendedColor implements Color {
      * Sets the Red Green Blue or Alpha Red Green Blue
      */
     public abstract void setRGB(byte[] rgb);
-   
-    protected byte[] getRGBOrARGB() {
-        byte[] rgb = null;
 
+    protected byte[] getRGBOrARGB() {
         if (isIndexed() && getIndex() > 0) {
             int indexNum = getIndex();
             HSSFColor indexed = HSSFColor.getIndexHash().get(indexNum);
             if (indexed != null) {
-               rgb = new byte[3];
-               rgb[0] = (byte) indexed.getTriplet()[0];
-               rgb[1] = (byte) indexed.getTriplet()[1];
-               rgb[2] = (byte) indexed.getTriplet()[2];
-               return rgb;
+                byte[] rgb = new byte[3];
+                rgb[0] = (byte) indexed.getTriplet()[0];
+                rgb[1] = (byte) indexed.getTriplet()[1];
+                rgb[2] = (byte) indexed.getTriplet()[2];
+                return rgb;
             }
-         }
+        }
 
-         // Grab the colour
-         rgb = getStoredRBG();
-         return rgb;
-     }
+        // Grab the colour
+        return getStoredRBG();
+    }
 
     /**
      * Standard Red Green Blue ctColor value (RGB) with applied tint.
@@ -125,12 +121,13 @@ public abstract class ExtendedColor implements Color {
      * Works for both regular and indexed colours.
      */
     public String getARGBHex() {
-       StringBuffer sb = new StringBuffer();
        byte[] rgb = getARGB();
-       if(rgb == null) {
-          return null;
-       }
-       for(byte c : rgb) {
+        if(rgb == null) {
+            return null;
+        }
+
+        StringBuilder sb = new StringBuilder();
+        for(byte c : rgb) {
           int i = c & 0xff;
           String cs = Integer.toHexString(i);
           if(cs.length() == 1) {
index 5d5ceafa362f96d134c4c3bf3ed174165ba21a86..522773eb8b613d20a34c74325a72cea18648ba6f 100644 (file)
 ==================================================================== */
 package org.apache.poi;
 
-import java.io.Closeable;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PushbackInputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
-import org.apache.poi.openxml4j.opc.OPCPackage;
-import org.apache.poi.openxml4j.opc.PackageAccess;
-import org.apache.poi.openxml4j.opc.PackagePart;
-import org.apache.poi.openxml4j.opc.PackageRelationship;
-import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
-import org.apache.poi.poifs.common.POIFSConstants;
+import org.apache.poi.openxml4j.opc.*;
 import org.apache.poi.poifs.filesystem.DocumentFactoryHelper;
-import org.apache.poi.util.IOUtils;
 import org.apache.xmlbeans.impl.common.SystemCache;
 
+import java.io.*;
+import java.util.*;
+
 public abstract class POIXMLDocument extends POIXMLDocumentPart implements Closeable {
     public static final String DOCUMENT_CREATOR = "Apache POI";
 
index 9fd34914f40f1e00b41d681587a73af6b8c270a1..681a71208ac9dbb9b1828b594de5a5e9af6f1965 100644 (file)
@@ -229,7 +229,7 @@ public class POIXMLPropertiesTextExtractor extends POIXMLTextExtractor {
             }
          }
 
-         else if (property.isSetArray()) {
+         /*else if (property.isSetArray()) {
             // TODO Fetch the array values and output 
          }
          else if (property.isSetVector()) {
@@ -245,12 +245,9 @@ public class POIXMLPropertiesTextExtractor extends POIXMLTextExtractor {
          }
          else if (property.isSetStorage() || property.isSetOstorage()) {
             // TODO Decode, if possible
-         }
+         }*/
 
-         text.append(
-               property.getName() +
-               " = " + val + "\n"
-         );
+         text.append(property.getName()).append(" = ").append(val).append("\n");
       }
 
       return text.toString();
index 38cb5a833a9f2f37bb73e5b3b3de4c4d80de81ab..a57b57a7c14337e45e53679e06607a89b0ba3258 100644 (file)
@@ -355,12 +355,12 @@ public class ExtractorFactory {
         *  {@link POITextExtractor} for each embedded file.
         */
        public static POITextExtractor[] getEmbededDocsTextExtractors(POIOLE2TextExtractor ext) throws IOException, OpenXML4JException, XmlException {
-          // All the embded directories we spotted
+          // All the embedded directories we spotted
                ArrayList<Entry> dirs = new ArrayList<Entry>();
                // For anything else not directly held in as a POIFS directory
                ArrayList<InputStream> nonPOIFS = new ArrayList<InputStream>();
 
-      // Find all the embeded directories
+      // Find all the embedded directories
                DirectoryEntry root = ext.getRoot();
                if(root == null) {
                        throw new IllegalStateException("The extractor didn't know which POIFS it came from!");
@@ -390,7 +390,7 @@ public class ExtractorFactory {
                        } catch(FileNotFoundException e) {
                 // ignored here
             }
-               } else if(ext instanceof PowerPointExtractor) {
+               //} else if(ext instanceof PowerPointExtractor) {
                        // Tricky, not stored directly in poifs
                        // TODO
                } else if(ext instanceof OutlookTextExtactor) {
@@ -434,12 +434,12 @@ public class ExtractorFactory {
 
        /**
         * Returns an array of text extractors, one for each of
-        *  the embeded documents in the file (if there are any).
-        * If there are no embeded documents, you'll get back an
+        *  the embedded documents in the file (if there are any).
+        * If there are no embedded documents, you'll get back an
         *  empty array. Otherwise, you'll get one open
-        *  {@link POITextExtractor} for each embeded file.
+        *  {@link POITextExtractor} for each embedded file.
         */
-       public static POITextExtractor[] getEmbededDocsTextExtractors(POIXMLTextExtractor ext) {
+       public static POITextExtractor[] getEmbededDocsTextExtractors(@SuppressWarnings("UnusedParameters") POIXMLTextExtractor ext) {
                throw new IllegalStateException("Not yet supported");
        }
 }
index 17c8d0210388b609c68247f9675ea63f6caf0fc1..1d9be8d1aaa2c83da3e5e368127664f4c0de4b59 100644 (file)
@@ -77,10 +77,6 @@ public final class TestPOIXMLProperties {
                ctProps.setApplication(application);
                ctProps.setAppVersion(appVersion);
 
-               ctProps = null;
-               properties = null;
-               props = null;
-
                XSSFWorkbook newWorkbook =
                                XSSFTestDataSamples.writeOutAndReadBack(workbook);
                workbook.close();
index 067c0af1600a4f073beaf4d238185d5e0e55d21c..d975e730942bfd9569e22fd62ce51c2612d257f2 100644 (file)
@@ -134,7 +134,7 @@ public abstract class BitMaskTextProp extends TextProp implements Cloneable {
                    int i=0;
                    for (int mask : subPropMasks) {
                        if (!subPropMatches[i] && (val & mask) != 0) {
-                           sb.append(subPropNames[i]+",");
+                           sb.append(subPropNames[i]).append(",");
                        }
                        i++;
                    }
index ace62b49ba5e67131c84f7a02c66c3ea533bddc8..5c0f35bd03f716b01fc16355eb1e15a968ac9958 100644 (file)
@@ -110,12 +110,6 @@ public class HwmfGraphics {
     }\r
 \r
     protected BasicStroke getStroke() {\r
-        Rectangle2D view = prop.getViewport();\r
-        Rectangle2D win = prop.getWindow();\r
-        if (view == null) {\r
-            view = win;\r
-        }\r
-        \r
         // TODO: fix line width calculation\r
         float width = (float)prop.getPenWidth();\r
         if (width == 0) {\r
@@ -335,10 +329,10 @@ public class HwmfGraphics {
         int len = text.length();\r
         AttributedString as = new AttributedString(text);\r
         if (dx == null || dx.length == 0) {\r
-            addAttributes(as, font, 0, len);\r
+            addAttributes(as, font);\r
         } else {\r
             for (int i=0; i<len; i++) {\r
-                addAttributes(as, font, i, i+1);\r
+                addAttributes(as, font);\r
                 // Tracking works as a prefix/advance space on characters whereas\r
                 // dx[...] is the complete width of the current char\r
                 // therefore we need to add the additional/suffix width to the next char\r
@@ -368,7 +362,7 @@ public class HwmfGraphics {
         }\r
     }\r
     \r
-    private void addAttributes(AttributedString as, HwmfFont font, int start, int end) {\r
+    private void addAttributes(AttributedString as, HwmfFont font) {\r
         DrawFontManager fontHandler = (DrawFontManager)graphicsCtx.getRenderingHint(Drawable.FONT_HANDLER);\r
         String fontFamily = null;\r
         @SuppressWarnings("unchecked")\r
index 71d561758261df305e551fbc083d16807cb6890e..c19ac3249f20e4f11064202d8cb7ffd635e41c0a 100644 (file)
 
 package org.apache.poi.ss.usermodel;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.awt.font.FontRenderContext;
-import java.awt.font.TextAttribute;
-import java.awt.font.TextLayout;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.text.AttributedString;
-import java.util.HashMap;
-import java.util.Map;
-
-import java.awt.geom.Rectangle2D;
-
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.util.PaneInformation;
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.ITestDataProvider;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.util.CellRangeAddress;
@@ -47,6 +29,17 @@ import org.junit.Assume;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import java.awt.font.FontRenderContext;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextLayout;
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.text.AttributedString;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
 /**
  * A base class for bugzilla issues that can be described in terms of common ss interfaces.
  *