aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java13
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java10
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java2
3 files changed, 10 insertions, 15 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java
index 5888732c47..2764644812 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java
@@ -26,7 +26,6 @@ import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.PrivateKey;
-import java.security.Provider;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
@@ -52,14 +51,11 @@ import javax.xml.crypto.URIDereferencer;
import javax.xml.crypto.dsig.CanonicalizationMethod;
import javax.xml.crypto.dsig.DigestMethod;
import javax.xml.crypto.dsig.Transform;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.hpsf.ClassID;
-import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.poifs.crypt.dsig.facets.KeyInfoSignatureFacet;
import org.apache.poi.poifs.crypt.dsig.facets.OOXMLSignatureFacet;
@@ -73,7 +69,6 @@ import org.apache.poi.poifs.crypt.dsig.services.TimeStampHttpClient;
import org.apache.poi.poifs.crypt.dsig.services.TimeStampService;
import org.apache.poi.poifs.crypt.dsig.services.TimeStampServiceValidator;
import org.apache.poi.poifs.crypt.dsig.services.TimeStampSimpleHttpClient;
-import org.apache.poi.util.Internal;
import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.Removal;
import org.apache.xml.security.signature.XMLSignature;
@@ -382,7 +377,7 @@ public class SignatureConfig {
* @since POI 4.0.0
*/
public void setExecutionTime(String executionTime) {
- if (executionTime != null && !"".equals(executionTime)){
+ if (executionTime != null && !executionTime.isEmpty()){
final DateFormat fmt = new SimpleDateFormat(SIGNATURE_TIME_FORMAT, Locale.ROOT);
fmt.setTimeZone(LocaleUtil.TIMEZONE_UTC);
try {
@@ -992,12 +987,12 @@ public class SignatureConfig {
* <li>the JDK xmlsec provider</li>
* </ol>
*
- * @return a list of possible XMLSEC provider class names
+ * @return an array of possible XMLSEC provider class names
*/
public static String[] getProviderNames() {
// need to check every time, as the system property might have been changed in the meantime
String sysProp = System.getProperty("jsr105Provider");
- return (sysProp == null || "".equals(sysProp))
+ return (sysProp == null || sysProp.isEmpty())
? new String[]{XMLSEC_SANTUARIO, XMLSEC_JDK}
: new String[]{sysProp, XMLSEC_SANTUARIO, XMLSEC_JDK};
}
@@ -1031,7 +1026,7 @@ public class SignatureConfig {
/**
* The signature config can be updated if a document is succesful validated.
- * This flag is used for activating this modifications.
+ * This flag is used for activating these modifications.
* Defaults to {@code false}
*
* @param updateConfigOnValidate if true, update config on validate
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java
index f6c5570003..7580745404 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java
@@ -19,6 +19,7 @@ package org.apache.poi.xslf.usermodel;
import static org.apache.poi.sl.usermodel.BaseTestSlideShow.getColor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -467,21 +468,21 @@ class TestXSLFTextParagraph {
attributes = iterator.getAttributes();
}
- if ("This is a".equals(sb.toString())) {
+ if ("This is a".contentEquals(sb)) {
// Should be no background.
assertNotNull(attributes);
Object background = attributes.get(TextAttribute.BACKGROUND);
assertNull(background);
}
- if ("highlight".equals(sb.toString())) {
+ if ("highlight".contentEquals(sb)) {
// Should be yellow background.
assertNotNull(attributes);
Object background = attributes.get(TextAttribute.BACKGROUND);
assertNotNull(background);
- assertTrue(background instanceof Color);
+ assertInstanceOf(Color.class, background);
assertEquals(Color.yellow, background);
}
- if (" test".equals(sb.toString())) {
+ if (" test".contentEquals(sb)) {
// Should be no background.
assertNotNull(attributes);
Object background = attributes.get(TextAttribute.BACKGROUND);
@@ -494,5 +495,4 @@ class TestXSLFTextParagraph {
ppt.getSlides().get(0).draw(dgfx);
}
}
-
}
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
index 7901b438d7..ae2f3c37f2 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
@@ -3331,7 +3331,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
LOG.atInfo().log(between(start, now()));
assertTrue(between(start, now()).getSeconds() < 25,
- "Had start: " + start + ", now: " + now() +
+ "Expected to have less than 25s duration for test, but had start: " + start + ", now: " + now() +
", diff: " + Duration.between(start, now()).getSeconds());
}
}