From 27ed0a72faaa85ba456a24c8292735bbe2fa82ab Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Mon, 12 Jan 2015 18:59:30 +0100 Subject: JarLocation fix --- .../java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java | 2 +- .../java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'bkucommon/src/main/java/at/gv') diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java index fcaa1be6..98218e52 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java @@ -143,7 +143,7 @@ public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implement String signatureLayout = configuration .getString(ConfigurationFactoryBean.SIGNATURE_LAYOUT_PROPERTY); - if (getUseXAdES14() && signatureLayout.equals("1.0")) + if (getUseXAdES14() && "1.0".equals(signatureLayout)) signatureLayout = "1.1"; //bump SignatureLayout version to prevent PDF-AS from generating invalid signatures return signatureLayout; diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java index ce318876..47e1320a 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java @@ -46,6 +46,7 @@ import org.springframework.core.io.ResourceLoader; import at.gv.egiz.bku.conf.MoccaConfigurationException; import at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandImpl; +import at.gv.egiz.bku.utils.JarLocation; /** * This is a {@link FactoryBean} for the creation of a {@link Configuration}. @@ -140,10 +141,10 @@ public class ConfigurationFactoryBean implements FactoryBean, ResourceLoaderAwar // signature layout try { - String classContainer = CreateXMLSignatureCommandImpl.class.getProtectionDomain() - .getCodeSource().getLocation().toString(); + String classContainer = JarLocation.get(CreateXMLSignatureCommandImpl.class); URL manifestUrl = new URL("jar:" + classContainer + "!/META-INF/MANIFEST.MF"); + log.debug(manifestUrl.toString()); Manifest manifest = new Manifest(manifestUrl.openStream()); Attributes attributes = manifest.getMainAttributes(); String signatureLayout = attributes.getValue("SignatureLayout"); @@ -153,10 +154,8 @@ public class ConfigurationFactoryBean implements FactoryBean, ResourceLoaderAwar } catch (Exception e) { log.warn("Failed to get signature layout from manifest.", e); } - - + return new MapConfiguration(map); - } @Override -- cgit v1.2.3