Some IntelliJ and Javadoc fixes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1825817 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2018-03-04 13:33:31 +00:00
parent f3addac5e0
commit fb2f23678f
5 changed files with 10 additions and 14 deletions

View File

@ -236,7 +236,7 @@ public final class PackagingURIHelper {
* @return the combined URI * @return the combined URI
*/ */
public static URI combine(URI prefix, URI suffix) { public static URI combine(URI prefix, URI suffix) {
URI retUri = null; URI retUri;
try { try {
retUri = new URI(combine(prefix.getPath(), suffix.getPath())); retUri = new URI(combine(prefix.getPath(), suffix.getPath()));
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
@ -694,7 +694,7 @@ public final class PackagingURIHelper {
*/ */
public static URI toURI(String value) throws URISyntaxException { public static URI toURI(String value) throws URISyntaxException {
//5. Convert all back slashes to forward slashes //5. Convert all back slashes to forward slashes
if (value.indexOf("\\") != -1) { if (value.contains("\\")) {
value = value.replace('\\', '/'); value = value.replace('\\', '/');
} }

View File

@ -31,7 +31,6 @@ import java.util.zip.ZipInputStream;
import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException; import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException;
import org.apache.poi.openxml4j.exceptions.OLE2NotOfficeXmlFileException; 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.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes; import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.openxml4j.opc.ZipPackage; import org.apache.poi.openxml4j.opc.ZipPackage;
@ -39,7 +38,6 @@ import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.openxml4j.util.ZipSecureFile.ThresholdInputStream; import org.apache.poi.openxml4j.util.ZipSecureFile.ThresholdInputStream;
import org.apache.poi.poifs.filesystem.FileMagic; import org.apache.poi.poifs.filesystem.FileMagic;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal;
@Internal @Internal
public final class ZipHelper { public final class ZipHelper {
@ -59,8 +57,9 @@ public final class ZipHelper {
/** /**
* Retrieve the zip entry of the core properties part. * Retrieve the zip entry of the core properties part.
* *
* @throws OpenXML4JException * @throws IllegalArgumentException If the relationship for
* Throws if internal error occurs. * core properties cannot be read or an invalid name is
* specified in the properties.
*/ */
public static ZipEntry getCorePropertiesZipEntry(ZipPackage pkg) { public static ZipEntry getCorePropertiesZipEntry(ZipPackage pkg) {
PackageRelationship corePropsRel = pkg.getRelationshipsByType( PackageRelationship corePropsRel = pkg.getRelationshipsByType(
@ -221,11 +220,8 @@ public final class ZipHelper {
} }
// Peek at the first few bytes to sanity check // Peek at the first few bytes to sanity check
FileInputStream input = new FileInputStream(file); try (FileInputStream input = new FileInputStream(file)) {
try {
verifyZipHeader(input); verifyZipHeader(input);
} finally {
input.close();
} }
// Open as a proper zip file // Open as a proper zip file

View File

@ -56,7 +56,7 @@ public class TestXWPFFootnotes extends TestCase {
for (IBodyElement e : fn.getBodyElements()) { for (IBodyElement e : fn.getBodyElements()) {
if (e instanceof XWPFParagraph) { if (e instanceof XWPFParagraph) {
String txt = ((XWPFParagraph) e).getText(); String txt = ((XWPFParagraph) e).getText();
if (txt.indexOf("Footnote_sdt") > -1) { if (txt.contains("Footnote_sdt")) {
hits++; hits++;
} }
} }

View File

@ -109,7 +109,7 @@ public final class TestEscherGraphics2d {
@Test @Test
public void testSetFont() { public void testSetFont() {
Font f = new Font("Helvetica", 0, 12); Font f = new Font("Helvetica", Font.PLAIN, 12);
graphics.setFont(f); graphics.setFont(f);
assertEquals(f, graphics.getFont()); assertEquals(f, graphics.getFont());
} }
@ -133,7 +133,7 @@ public final class TestEscherGraphics2d {
private boolean isDialogPresent() { private boolean isDialogPresent() {
String fontDebugStr = graphics.getFont().toString(); String fontDebugStr = graphics.getFont().toString();
return fontDebugStr.indexOf("dialog") != -1 || fontDebugStr.indexOf("Dialog") != -1; return fontDebugStr.contains("dialog") || fontDebugStr.contains("Dialog");
} }
@Test @Test

View File

@ -72,7 +72,7 @@ public class TestMissingWorkbook extends TestCase {
evaluator.evaluateFormulaCell(lA1Cell); evaluator.evaluateFormulaCell(lA1Cell);
fail("Missing external workbook reference exception expected!"); fail("Missing external workbook reference exception expected!");
}catch(RuntimeException re) { }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));
} }
} }