aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2015-10-05 00:28:54 +0000
committerAndreas Beeker <kiwiwings@apache.org>2015-10-05 00:28:54 +0000
commit461375359cb24e15591f414a6c05b63729268a7b (patch)
tree96d512e055f759be9766462d65f774de56776963 /src/java/org/apache/poi
parent43db87198bb1374bda4d3c58af26561174566023 (diff)
downloadpoi-461375359cb24e15591f414a6c05b63729268a7b.tar.gz
poi-461375359cb24e15591f414a6c05b63729268a7b.zip
fixed sonar issues and eclipse warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1706742 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r--src/java/org/apache/poi/hpsf/MutableSection.java3
-rw-r--r--src/java/org/apache/poi/poifs/dev/POIFSViewer.java38
-rw-r--r--src/java/org/apache/poi/sl/usermodel/TextRun.java6
3 files changed, 20 insertions, 27 deletions
diff --git a/src/java/org/apache/poi/hpsf/MutableSection.java b/src/java/org/apache/poi/hpsf/MutableSection.java
index a1b3824666..cb864fa8b1 100644
--- a/src/java/org/apache/poi/hpsf/MutableSection.java
+++ b/src/java/org/apache/poi/hpsf/MutableSection.java
@@ -514,8 +514,9 @@ public class MutableSection extends Section
{
/* Write the dictionary item in Unicode. */
int sLength = value.length() + 1;
- if (sLength % 2 == 1)
+ if ((sLength & 1) == 1) {
sLength++;
+ }
length += TypeWriter.writeUIntToStream(out, key.longValue());
length += TypeWriter.writeUIntToStream(out, sLength);
final byte[] ca = CodePageUtil.getBytesInCodePage(value, codepage);
diff --git a/src/java/org/apache/poi/poifs/dev/POIFSViewer.java b/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
index 4614376db2..cf98c0147b 100644
--- a/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
+++ b/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
@@ -21,7 +21,6 @@ package org.apache.poi.poifs.dev;
import java.io.File;
import java.io.IOException;
-import java.util.Iterator;
import java.util.List;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
@@ -41,10 +40,8 @@ public class POIFSViewer
* @param args the names of the files to be displayed
*/
- public static void main(final String args[])
- {
- if (args.length < 0)
- {
+ public static void main(final String args[]) {
+ if (args.length == 0) {
System.err.println("Must specify at least one file to view");
System.exit(1);
}
@@ -56,16 +53,12 @@ public class POIFSViewer
}
}
- private static void viewFile(final String filename,
- final boolean printName)
- {
- if (printName)
- {
+ private static void viewFile(String filename, boolean printName) {
+ if (printName) {
StringBuffer flowerbox = new StringBuffer();
flowerbox.append(".");
- for (int j = 0; j < filename.length(); j++)
- {
+ for (int j = 0; j < filename.length(); j++) {
flowerbox.append("-");
}
flowerbox.append(".");
@@ -73,21 +66,14 @@ public class POIFSViewer
System.out.println("|" + filename + "|");
System.out.println(flowerbox);
}
- try
- {
- POIFSViewable fs =
- new NPOIFSFileSystem(new File(filename));
- List<String> strings = POIFSViewEngine.inspectViewable(fs, true,
- 0, " ");
- Iterator<String> iter = strings.iterator();
-
- while (iter.hasNext())
- {
- System.out.print(iter.next());
+ try {
+ NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(filename));
+ List<String> strings = POIFSViewEngine.inspectViewable(fs, true, 0, " ");
+ for (String s : strings) {
+ System.out.print(s);
}
- }
- catch (IOException e)
- {
+ fs.close();
+ } catch (IOException e) {
System.out.println(e.getMessage());
}
}
diff --git a/src/java/org/apache/poi/sl/usermodel/TextRun.java b/src/java/org/apache/poi/sl/usermodel/TextRun.java
index ff76a98e08..bd0164c275 100644
--- a/src/java/org/apache/poi/sl/usermodel/TextRun.java
+++ b/src/java/org/apache/poi/sl/usermodel/TextRun.java
@@ -66,11 +66,17 @@ public interface TextRun {
/**
+ * Returns the font size which is either set directly on this text run or
+ * given from the slide layout
+ *
* @return font size in points or null if font size is not set.
*/
Double getFontSize();
/**
+ * Sets the font size directly on this text run, if null is given, the
+ * font size defaults to the values given from the slide layout
+ *
* @param fontSize font size in points, if null the underlying fontsize will be unset
*/
void setFontSize(Double fontSize);