Author: centic
Date: Sun Mar 4 13:33:31 2018
New Revision: 1825817
URL: http://svn.apache.org/viewvc?rev=1825817&view=rev
Log:
Some IntelliJ and Javadoc fixes
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java
poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java
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=1825817&r1=1825816&r2=1825817&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
Sun Mar 4 13:33:31 2018
@@ -236,7 +236,7 @@ public final class PackagingURIHelper {
* @return the combined URI
*/
public static URI combine(URI prefix, URI suffix) {
- URI retUri = null;
+ URI retUri;
try {
retUri = new URI(combine(prefix.getPath(),
suffix.getPath()));
} catch (URISyntaxException e) {
@@ -694,7 +694,7 @@ public final class PackagingURIHelper {
*/
public static URI toURI(String value) throws URISyntaxException {
//5. Convert all back slashes to forward slashes
- if (value.indexOf("\\") != -1) {
+ if (value.contains("\\")) {
value = value.replace('\\', '/');
}
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=1825817&r1=1825816&r2=1825817&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
Sun Mar 4 13:33:31 2018
@@ -31,7 +31,6 @@ import java.util.zip.ZipInputStream;
import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException;
import org.apache.poi.openxml4j.exceptions.OLE2NotOfficeXmlFileException;
-import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.openxml4j.opc.ZipPackage;
@@ -39,7 +38,6 @@ import org.apache.poi.openxml4j.util.Zip
import org.apache.poi.openxml4j.util.ZipSecureFile.ThresholdInputStream;
import org.apache.poi.poifs.filesystem.FileMagic;
import org.apache.poi.util.Internal;
-import org.apache.poi.util.Removal;
@Internal
public final class ZipHelper {
@@ -59,8 +57,9 @@ public final class ZipHelper {
/**
* Retrieve the zip entry of the core properties part.
*
- * @throws OpenXML4JException
- * Throws if internal error occurs.
+ * @throws IllegalArgumentException If the relationship for
+ * core properties cannot be read or an invalid name is
+ * specified in the properties.
*/
public static ZipEntry getCorePropertiesZipEntry(ZipPackage pkg) {
PackageRelationship corePropsRel = pkg.getRelationshipsByType(
@@ -221,11 +220,8 @@ public final class ZipHelper {
}
// Peek at the first few bytes to sanity check
- FileInputStream input = new FileInputStream(file);
- try {
+ try (FileInputStream input = new FileInputStream(file)) {
verifyZipHeader(input);
- } finally {
- input.close();
}
// Open as a proper zip file
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java?rev=1825817&r1=1825816&r2=1825817&view=diff
==============================================================================
---
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java
(original)
+++
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java
Sun Mar 4 13:33:31 2018
@@ -56,7 +56,7 @@ public class TestXWPFFootnotes extends T
for (IBodyElement e : fn.getBodyElements()) {
if (e instanceof XWPFParagraph) {
String txt = ((XWPFParagraph) e).getText();
- if (txt.indexOf("Footnote_sdt") > -1) {
+ if (txt.contains("Footnote_sdt")) {
hits++;
}
}
Modified:
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java?rev=1825817&r1=1825816&r2=1825817&view=diff
==============================================================================
---
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
(original)
+++
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
Sun Mar 4 13:33:31 2018
@@ -109,7 +109,7 @@ public final class TestEscherGraphics2d
@Test
public void testSetFont() {
- Font f = new Font("Helvetica", 0, 12);
+ Font f = new Font("Helvetica", Font.PLAIN, 12);
graphics.setFont(f);
assertEquals(f, graphics.getFont());
}
@@ -133,7 +133,7 @@ public final class TestEscherGraphics2d
private boolean isDialogPresent() {
String fontDebugStr = graphics.getFont().toString();
- return fontDebugStr.indexOf("dialog") != -1 ||
fontDebugStr.indexOf("Dialog") != -1;
+ return fontDebugStr.contains("dialog") ||
fontDebugStr.contains("Dialog");
}
@Test
Modified:
poi/trunk/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java?rev=1825817&r1=1825816&r2=1825817&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java
Sun Mar 4 13:33:31 2018
@@ -72,7 +72,7 @@ public class TestMissingWorkbook extends
evaluator.evaluateFormulaCell(lA1Cell);
fail("Missing external workbook reference exception
expected!");
}catch(RuntimeException re) {
- assertTrue("Unexpected exception: " + re,
re.getMessage().indexOf(SOURCE_DUMMY_WORKBOOK_FILENAME) != -1);
+ assertTrue("Unexpected exception: " + re,
re.getMessage().contains(SOURCE_DUMMY_WORKBOOK_FILENAME));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]