aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2023-02-11 11:51:13 +0000
committerPJ Fanning <fanningpj@apache.org>2023-02-11 11:51:13 +0000
commit28a26d9cb23c8534b08987ee005a2df5fa61da9d (patch)
tree114ae194a764f3baf4cfdb0f8fb1d24b0350d169 /poi-ooxml
parentdc91cdbaaa94862a2c7dc1af83017bb042744a72 (diff)
downloadpoi-28a26d9cb23c8534b08987ee005a2df5fa61da9d.tar.gz
poi-28a26d9cb23c8534b08987ee005a2df5fa61da9d.zip
[bug-66475] SignatureConfig: remove ThreadLocals and deprecated code associated with them
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907579 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java96
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java23
2 files changed, 4 insertions, 115 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 b7ce3c014f..c87fb8e7c8 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
@@ -125,12 +125,6 @@ public class SignatureConfig {
Office2010SignatureFacet::new
);
-
- private final ThreadLocal<OPCPackage> opcPackage = new ThreadLocal<>();
- private final ThreadLocal<XMLSignatureFactory> signatureFactory = new ThreadLocal<>();
- private final ThreadLocal<KeyInfoFactory> keyInfoFactory = new ThreadLocal<>();
- private final ThreadLocal<Provider> provider = new ThreadLocal<>();
-
private List<SignatureFacet> signatureFacets = new ArrayList<>();
private HashAlgorithm digestAlgo = HashAlgorithm.sha256;
private Date executionTime = new Date();
@@ -325,28 +319,6 @@ public class SignatureConfig {
}
/**
- * @return the opc package to be used by this thread, stored as thread-local
- *
- * @deprecated in POI 5.0.0 - use {@link SignatureInfo#setOpcPackage(OPCPackage)} instead
- */
- @Deprecated
- @Removal(version = "5.0.0")
- public OPCPackage getOpcPackage() {
- return opcPackage.get();
- }
-
- /**
- * @param opcPackage the opc package to be handled by this thread, stored as thread-local
- *
- * @deprecated in POI 5.0.0 - use {@link SignatureInfo#setOpcPackage(OPCPackage)} instead
- */
- @Deprecated
- @Removal(version = "5.0.0")
- public void setOpcPackage(OPCPackage opcPackage) {
- this.opcPackage.set(opcPackage);
- }
-
- /**
* @return the private key
*/
public PrivateKey getKey() {
@@ -1011,74 +983,6 @@ public class SignatureConfig {
}
}
-
- /**
- * @param signatureFactory the xml signature factory, saved as thread-local
- *
- * @deprecated in POI 5.0.0 - use {@link SignatureInfo#setSignatureFactory(XMLSignatureFactory)}
- */
- @Deprecated
- @Removal(version = "5.0.0")
- public void setSignatureFactory(XMLSignatureFactory signatureFactory) {
- this.signatureFactory.set(signatureFactory);
- }
-
- /**
- * @return the xml signature factory (thread-local)
- *
- * @deprecated in POI 5.0.0 - will be handled by SignatureInfo internally
- */
- @Deprecated
- @Removal(version = "5.0.0")
- public XMLSignatureFactory getSignatureFactory() {
- return signatureFactory.get();
- }
-
- /**
- * @param keyInfoFactory the key factory, saved as thread-local
- *
- * @deprecated in POI 5.0.0 - use {@link SignatureInfo#setKeyInfoFactory(KeyInfoFactory)}
- */
- @Deprecated
- @Removal(version = "5.0.0")
- public void setKeyInfoFactory(KeyInfoFactory keyInfoFactory) {
- this.keyInfoFactory.set(keyInfoFactory);
- }
-
- /**
- * @return the key factory (thread-local)
- *
- * @deprecated in POI 5.0.0 - will be handled by SignatureInfo internally
- */
- @Deprecated
- @Removal(version = "5.0.0")
- public KeyInfoFactory getKeyInfoFactory() {
- return keyInfoFactory.get();
- }
-
- /**
- * Helper method to set provider
- * @param provider the provider
- * @deprecated in POI 5.0.0 - use {@link SignatureInfo#setProvider(Provider)}
- */
- @Internal
- @Deprecated
- @Removal(version = "5.0.0")
- public void setProvider(Provider provider) {
- this.provider.set(provider);
- }
-
- /**
- * @return the cached provider or null if not set before
- *
- * @deprecated in POI 5.0.0 - will be handled by SignatureInfo internally
- */
- @Deprecated
- @Removal(version = "5.0.0")
- public Provider getProvider() {
- return provider.get();
- }
-
/**
* Determine the possible classes for XMLSEC.
* The order is
diff --git a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
index 782f72b4f3..0941621d61 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
@@ -626,32 +626,17 @@ public class SignatureInfo {
*/
@SuppressWarnings("deprecation")
protected void initXmlProvider() {
- if (opcPackage == null) {
- opcPackage = signatureConfig.getOpcPackage();
- }
if (provider == null) {
- provider = signatureConfig.getProvider();
- if (provider == null) {
- provider = XmlProviderInitSingleton.getInstance().findProvider();
- }
+ provider = XmlProviderInitSingleton.getInstance().findProvider();
}
if (signatureFactory == null) {
- signatureFactory = signatureConfig.getSignatureFactory();
- if (signatureFactory == null) {
- signatureFactory = XMLSignatureFactory.getInstance("DOM", provider);
- }
+ signatureFactory = XMLSignatureFactory.getInstance("DOM", provider);
}
if (keyInfoFactory == null) {
- keyInfoFactory = signatureConfig.getKeyInfoFactory();
- if (keyInfoFactory == null) {
- keyInfoFactory = KeyInfoFactory.getInstance("DOM", provider);
- }
+ keyInfoFactory = KeyInfoFactory.getInstance("DOM", provider);
}
if (uriDereferencer == null) {
- uriDereferencer = signatureConfig.getUriDereferencer();
- if (uriDereferencer == null) {
- uriDereferencer = new OOXMLURIDereferencer();
- }
+ uriDereferencer = new OOXMLURIDereferencer();
}
if (uriDereferencer instanceof OOXMLURIDereferencer) {
((OOXMLURIDereferencer)uriDereferencer).setSignatureInfo(this);