Author: kiwiwings
Date: Wed Mar 16 22:27:56 2016
New Revision: 1735321

URL: http://svn.apache.org/viewvc?rev=1735321&view=rev
Log:
sonar fixes

Modified:
    
poi/trunk/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java
    
poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java
    poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java

Modified: 
poi/trunk/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java?rev=1735321&r1=1735320&r2=1735321&view=diff
==============================================================================
--- 
poi/trunk/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java
 (original)
+++ 
poi/trunk/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java
 Wed Mar 16 22:27:56 2016
@@ -39,7 +39,7 @@ public class HybridStreaming {
     private static final String SHEET_TO_STREAM = "large sheet";
 
     public static void main(String[] args) throws IOException, SAXException {
-        InputStream sourceBytes = new 
FileInputStream("/path/too/workbook.xlsx");
+        InputStream sourceBytes = new FileInputStream("workbook.xlsx");
         XSSFWorkbook workbook = new XSSFWorkbook(sourceBytes) {
             /** Avoid DOM parse of large sheet */
             public void parseSheet(java.util.Map<String,XSSFSheet> shIdMap, 
CTSheet ctSheet) {
@@ -53,6 +53,7 @@ public class HybridStreaming {
         ReadOnlySharedStringsTable strings = new 
ReadOnlySharedStringsTable(workbook.getPackage());
         new XSSFSheetXMLHandler(workbook.getStylesSource(), strings, 
createSheetContentsHandler(), false);
         workbook.close();
+        sourceBytes.close();
     }
 
     private static SheetContentsHandler createSheetContentsHandler() {

Modified: 
poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java?rev=1735321&r1=1735320&r2=1735321&view=diff
==============================================================================
--- 
poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java
 (original)
+++ 
poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java
 Wed Mar 16 22:27:56 2016
@@ -63,7 +63,7 @@ public class WorkingWithPictures {
     
             //save workbook
             String file = "picture.xls";
-            if(wb instanceof XSSFWorkbook) file += "x";
+            if(wb instanceof XSSFWorkbook) file += "x"; // NOSONAR
             OutputStream fileOut = new FileOutputStream(file);
             try {
                 wb.write(fileOut);

Modified: 
poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java?rev=1735321&r1=1735320&r2=1735321&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java 
(original)
+++ poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java 
Wed Mar 16 22:27:56 2016
@@ -86,6 +86,8 @@ public class SimpleTable {
         FileOutputStream out = new FileOutputStream("simpleTable.docx");
         doc.write(out);
         out.close();
+        
+        doc.close();
     }
 
     /**
@@ -174,13 +176,8 @@ public class SimpleTable {
                        rh.setBold(true);
                     para.setAlignment(ParagraphAlignment.CENTER);
                 }
-               else if (rowCt % 2 == 0) {
-                       // even row
-                    rh.setText("row " + rowCt + ", col " + colCt);
-                    para.setAlignment(ParagraphAlignment.LEFT);
-               }
                else {
-                       // odd row
+                       // other rows
                     rh.setText("row " + rowCt + ", col " + colCt);
                     para.setAlignment(ParagraphAlignment.LEFT);
                }
@@ -194,6 +191,8 @@ public class SimpleTable {
         FileOutputStream out = new FileOutputStream("styledTable.docx");
         doc.write(out);
         out.close();
+        
+        doc.close();
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to