aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-03-16 22:27:56 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-03-16 22:27:56 +0000
commit89c8c772c9643c6f371fe296574ba3a852108d28 (patch)
tree264ae22494f155b27967e5b74c814eb49712a696 /src
parent5499c36019fb445253800404ea850ce64c658651 (diff)
downloadpoi-89c8c772c9643c6f371fe296574ba3a852108d28.tar.gz
poi-89c8c772c9643c6f371fe296574ba3a852108d28.zip
sonar fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1735321 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java3
-rw-r--r--src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java2
-rw-r--r--src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java11
3 files changed, 8 insertions, 8 deletions
diff --git a/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java b/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java
index ffa2891fd0..f2ceb5e1d4 100644
--- a/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java
+++ b/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java
@@ -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() {
diff --git a/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java b/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java
index 6607beb3fc..e7aeaaac11 100644
--- a/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java
+++ b/src/examples/src/org/apache/poi/xssf/usermodel/examples/WorkingWithPictures.java
@@ -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);
diff --git a/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java b/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java
index 5f049ba0ac..5d07fe2164 100644
--- a/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java
+++ b/src/examples/src/org/apache/poi/xwpf/usermodel/SimpleTable.java
@@ -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();
}
}