diff options
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
15 files changed, 759 insertions, 232 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java index 702fa6bb..a669803b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java @@ -68,6 +68,12 @@ public interface ConfigManipulator { public static final String PROXY_PORT_CONFIG = "PROXY_PORT"; //$NON-NLS-1$ /** + * The output folder config parameter + */ + public static final String OUTPUT_FOLDER_CONFIG = "OUTPUT_FOLDER"; //$NON-NLS-1$ + + + /** * Sets the default bku type * @param bku the bku type */ @@ -119,6 +125,12 @@ public interface ConfigManipulator { public void setConfigurationFile(String configurationFile); /** + * Sets the default output folder + * @param outputFolder the default output folder + */ + public void setDefaultOutputFolder(String outputFolder); + + /** * Saves the current configuration to the current configuration file * @throws IOException */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java index 8ada4d2d..1adc45a4 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java @@ -15,6 +15,9 @@ */ package at.asit.pdfover.gui.workflow; +import java.io.IOException; +import java.io.InputStream; + import at.asit.pdfover.signator.BKUs; import at.asit.pdfover.signator.SignaturePosition; @@ -25,6 +28,12 @@ public interface ConfigProvider { //TODO: define interface for config provider .... /** + * Regex for parsing signature position + */ + public static final String SIGN_POS_REGEX = "(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?);p=(\\d))|(auto)|(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?))"; //$NON-NLS-1$ + + + /** * Gets the configuration file * @return the configuration file */ @@ -71,4 +80,17 @@ public interface ConfigProvider { * @return the default configured SignaturePosition or null if not configured */ public SignaturePosition getDefaultSignaturePosition(); + + /** + * Gets the default output folder for signed documents + * @return the default output folder + */ + public String getDefaultOutputFolder(); + + /** + * Loads the current configuration to the current configuration file + * @param configSource + * @throws IOException + */ + public void loadConfiguration(InputStream configSource) throws IOException; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java index 6a128e73..529f9d5c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java @@ -19,7 +19,10 @@ package at.asit.pdfover.gui.workflow; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,36 +37,46 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { /** * SLF4J Logger instance **/ - @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(ConfigProviderImpl.class); - + private BKUs defaultBKU = BKUs.NONE; - + private SignaturePosition defaultSignaturePosition = null; - - private String defaultMobileNumber = null; - - private String defaultPassword = null; - - private String emblem = null; - - private String proxyHost = null; - + + /** + * An Emtpy property entry + */ + public static final String STRING_EMPTY = ""; //$NON-NLS-1$ + + private String defaultMobileNumber = STRING_EMPTY; + + private String defaultPassword = STRING_EMPTY; + + private String emblem = STRING_EMPTY; + + private String proxyHost = STRING_EMPTY; + private String configurationFile = ConfigManipulator.DEFAULT_CONFIG_FILE; - + private int proxyPort = -1; - + + private String outputFolder = STRING_EMPTY; + /** * Sets the default bku type - * @param bku the bku type + * + * @param bku + * the bku type */ @Override public void setDefaultBKU(BKUs bku) { this.defaultBKU = bku; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultBKU() */ @Override @@ -74,15 +87,19 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { /** * Sets the default signature position * - * @param signaturePosition the default signature position + * @param signaturePosition + * the default signature position */ @Override public void setDefaultSignaturePosition(SignaturePosition signaturePosition) { this.defaultSignaturePosition = signaturePosition; } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultSignaturePosition() + + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultSignaturePosition() */ @Override public SignaturePosition getDefaultSignaturePosition() { @@ -91,39 +108,47 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { /** * Sets the default mobile number - * @param number the default mobile number + * + * @param number + * the default mobile number */ @Override public void setDefaultMobileNumber(String number) { - if(number == null || number.trim().equals("")) { //$NON-NLS-1$ - this.defaultMobileNumber = null; + if (number == null || number.trim().equals("")) { //$NON-NLS-1$ + this.defaultMobileNumber = STRING_EMPTY; } else { this.defaultMobileNumber = number; } } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultMobileNumber() */ @Override public String getDefaultMobileNumber() { return this.defaultMobileNumber; } - + /** * Sets the default password - * @param password the default password + * + * @param password + * the default password */ @Override public void setDefaultPassword(String password) { - if(password == null || password.trim().equals("")) { //$NON-NLS-1$ - this.defaultPassword = null; + if (password == null || password.trim().equals("")) { //$NON-NLS-1$ + this.defaultPassword = STRING_EMPTY; } else { this.defaultPassword = password; } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultPassword() */ @Override @@ -134,18 +159,21 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { /** * Sets the default emblem * - * @param emblem the default emblem + * @param emblem + * the default emblem */ @Override public void setDefaultEmblem(String emblem) { - if(emblem == null || emblem.trim().equals("")) { //$NON-NLS-1$ - this.emblem = null; + if (emblem == null || emblem.trim().equals("")) { //$NON-NLS-1$ + this.emblem = STRING_EMPTY; } else { this.emblem = emblem; } } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultEmblem() */ @Override @@ -155,18 +183,22 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { /** * Sets the proxy host - * @param host the proxy host + * + * @param host + * the proxy host */ @Override public void setProxyHost(String host) { - if(host == null || host.trim().equals("")) { //$NON-NLS-1$ - this.emblem = null; + if (host == null || host.trim().equals("")) { //$NON-NLS-1$ + this.proxyHost = STRING_EMPTY; } else { - this.emblem = host; + this.proxyHost = host; } } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.ConfigProvider#getProxyHost() */ @Override @@ -177,14 +209,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { /** * Sets the proxy port * - * @param port the proxy port + * @param port + * the proxy port */ @Override public void setProxyPort(int port) { this.proxyPort = port; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.ConfigProvider#getProxyPort() */ @Override @@ -192,15 +227,21 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { return this.proxyPort; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigManipulator#setConfigurationFile(java.lang.String) + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.workflow.ConfigManipulator#setConfigurationFile(java + * .lang.String) */ @Override public void setConfigurationFile(String configurationFile) { this.configurationFile = configurationFile; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigurationFile() */ @Override @@ -208,41 +249,188 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { return this.configurationFile; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigManipulator#saveCurrentConfiguration() + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.workflow.ConfigManipulator#saveCurrentConfiguration() */ @Override - public void saveCurrentConfiguration() throws IOException{ + public void saveCurrentConfiguration() throws IOException { String filename = this.getConfigurationFile(); - + File configFile = new File(filename); - + Properties props = new Properties(); - + props.clear(); + props.setProperty(BKU_CONFIG, this.getDefaultBKU().toString()); props.setProperty(PROXY_HOST_CONFIG, this.getProxyHost()); - props.setProperty(PROXY_PORT_CONFIG, Integer.toString(this.getProxyPort())); + props.setProperty(PROXY_PORT_CONFIG, + Integer.toString(this.getProxyPort())); props.setProperty(EMBLEM_CONFIG, this.getDefaultEmblem()); props.setProperty(MOBILE_NUMBER_CONFIG, this.getDefaultMobileNumber()); - + props.setProperty(OUTPUT_FOLDER_CONFIG, this.getDefaultOutputFolder()); + SignaturePosition pos = this.getDefaultSignaturePosition(); - - if(pos == null) { + + if (pos == null) { props.setProperty(SIGNATURE_POSITION_CONFIG, ""); //$NON-NLS-1$ - } else if(pos.useAutoPositioning()) { + } else if (pos.useAutoPositioning()) { props.setProperty(SIGNATURE_POSITION_CONFIG, "auto"); //$NON-NLS-1$ } else { - props.setProperty(SIGNATURE_POSITION_CONFIG, - String.format("x=%f;y=%f;p=%d", //$NON-NLS-1$ - pos.getX(), - pos.getY(), - pos.getPage())); + props.setProperty(SIGNATURE_POSITION_CONFIG, + String.format("x=%f;y=%f;p=%d", //$NON-NLS-1$ + pos.getX(), pos.getY(), pos.getPage())); } - + FileOutputStream outputstream = new FileOutputStream(configFile, false); - + props.store(outputstream, "Configuration file was generated!"); //$NON-NLS-1$ + + log.info("Configuration file saved to " + configFile.getAbsolutePath()); //$NON-NLS-1$ + + } + + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.workflow.ConfigManipulator#setDefaultOutputFolder + * (java.lang.String) + */ + @Override + public void setDefaultOutputFolder(String outputFolder) { + this.outputFolder = outputFolder; + } + + /* + * (non-Javadoc) + * + * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultOutputFolder() + */ + @Override + public String getDefaultOutputFolder() { + return this.outputFolder; + } + + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.workflow.ConfigProvider#loadConfiguration(java.io + * .InputStream) + */ + @Override + public void loadConfiguration(InputStream configSource) throws IOException { + + Properties config = new Properties(); + config.load(configSource); + + // Set Emblem + this.setDefaultEmblem(config + .getProperty(ConfigManipulator.EMBLEM_CONFIG)); + + // Set Mobile Phone Number + this.setDefaultMobileNumber(config + .getProperty(ConfigManipulator.MOBILE_NUMBER_CONFIG)); + + // Set Proxy Host + this.setProxyHost(config + .getProperty(ConfigManipulator.PROXY_HOST_CONFIG)); + + // Set Output Folder + this.setDefaultOutputFolder(config + .getProperty(ConfigManipulator.OUTPUT_FOLDER_CONFIG)); + + // Set Proxy Port + String proxyPortString = config + .getProperty(ConfigManipulator.PROXY_PORT_CONFIG); + + if (proxyPortString != null && !proxyPortString.trim().equals("")) { //$NON-NLS-1$ + int port = Integer.parseInt(proxyPortString); + + if (port > 0 && port <= 0xFFFF) { + this.setProxyPort(port); + } else { + log.warn("Proxy port is out of range!: " + port); //$NON-NLS-1$ + } + } + + // Set Default BKU + String bkuString = config.getProperty(ConfigManipulator.BKU_CONFIG); + + BKUs defaultBKU = BKUs.NONE; + + try { + defaultBKU = BKUs.valueOf(bkuString); + } catch (IllegalArgumentException ex) { + log.error("Invalid BKU config value " + bkuString + " using none!"); //$NON-NLS-1$ //$NON-NLS-2$ + defaultBKU = BKUs.NONE; + } catch (NullPointerException ex) { + log.error("Invalid BKU config value " + bkuString + " using none!"); //$NON-NLS-1$ //$NON-NLS-2$ + defaultBKU = BKUs.NONE; + } + + this.setDefaultBKU(defaultBKU); + + // Set Signature Position + String signaturePosition = config + .getProperty(ConfigManipulator.SIGNATURE_POSITION_CONFIG); + + SignaturePosition position = null; + + if (signaturePosition != null && !signaturePosition.trim().equals("")) { //$NON-NLS-1$ + + signaturePosition = signaturePosition.trim().toLowerCase(); + + Pattern pattern = Pattern.compile(SIGN_POS_REGEX); + + Matcher matcher = pattern.matcher(signaturePosition); + + if (matcher.matches()) { + if (matcher.groupCount() == 8) { + if (matcher.group(1) != null) { + // we have format: x=..;y=..;p=... + try { + // group 2 = x value + float x = Float.parseFloat(matcher.group(2)); + + // group 3 = y value + float y = Float.parseFloat(matcher.group(3)); + + // group 4 = p value + int p = Integer.parseInt(matcher.group(3)); + + position = new SignaturePosition(x, y, p); + } catch (NumberFormatException ex) { + log.error( + "Signature Position read from config failed: Not a valid number", ex); //$NON-NLS-1$ + } + } else if (matcher.group(5) != null) { + // we have format auto + position = new SignaturePosition(); + } else if (matcher.group(6) != null) { + // we have format x=...;y=...; + // group 7 = x value + float x = Float.parseFloat(matcher.group(7)); + + // group 8 = y value + float y = Float.parseFloat(matcher.group(8)); + + position = new SignaturePosition(x, y); + } + } else { + log.error("Signature Position read from config failed: wrong group Count!"); //$NON-NLS-1$ + } + } else { + log.error("Signature Position read from config failed: not matching string"); //$NON-NLS-1$ + } + + } + + this.setDefaultSignaturePosition(position); } - + } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java new file mode 100644 index 00000000..796a4cec --- /dev/null +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java @@ -0,0 +1,120 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.gui.workflow; + +import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; +import at.asit.pdfover.gui.exceptions.InvalidNumberException; +import at.asit.pdfover.gui.exceptions.InvalidPortException; +import at.asit.pdfover.signator.BKUs; + +/** + * + */ +public interface ConfigurationContainer { + + /** + * Gets the configured emblem + * @return the configured emblem + */ + public String getEmblem(); + + /** + * Sets the emblem + * @param emblem the emblem + * @throws InvalidEmblemFile + */ + public void setEmblem(String emblem) throws InvalidEmblemFile; + + /** + * Gets the mobile phone number + * @return the mobile phone number + */ + public String getNumber(); + + /** + * Sets the mobile phone number + * @param number the mobile phone number + * @throws InvalidNumberException + */ + public void setNumber(String number) throws InvalidNumberException; + + /** + * Gets the proxy host + * @return the proxy host + */ + public String getProxyHost(); + + /** + * Sets the proxy host + * @param host the proxy host + */ + public void setProxyHost(String host); + + /** + * Gets the proxy port + * + * if port is -1 no port is selected + * + * @return the proxy port + */ + public int getProxyPort(); + + /** + * Sets the proxy port + * + * set to -1 for no port + * + * @param port the proxy port + * @throws InvalidPortException + */ + public void setProxyPort(int port) throws InvalidPortException; + + /** + * Gets the automatic position + * @return the automatic position + */ + public boolean getAutomaticPosition(); + + /** + * Sets the automatic position + * @param automatic the automatic position + */ + public void setAutomaticPosition(boolean automatic); + + /** + * Gets the default BKU + * @return the default BKU + */ + public BKUs getBKUSelection(); + + /** + * Sets the default BKU + * @param bkuSelection the default BKU + */ + public void setBKUSelection(BKUs bkuSelection); + + /** + * Gets the default output folder + * @return the default output folder + */ + public String getOutputFolder(); + + /** + * Sets the default output folder + * @param folder the default output folder + */ + public void setOutputFolder(String folder); +} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java new file mode 100644 index 00000000..081f4072 --- /dev/null +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java @@ -0,0 +1,237 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.gui.workflow; + +// Imports +import java.io.File; +import java.io.FileNotFoundException; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; +import at.asit.pdfover.gui.exceptions.InvalidNumberException; +import at.asit.pdfover.gui.exceptions.InvalidPortException; +import at.asit.pdfover.gui.workflow.states.mobilebku.ATrustHelper; +import at.asit.pdfover.signator.BKUs; + +/** + * + */ +public class ConfigurationContainerImpl implements ConfigurationContainer { + /** + * SLF4J Logger instance + **/ + @SuppressWarnings("unused") + private static final Logger log = LoggerFactory + .getLogger(ConfigurationContainerImpl.class); + + + /** + * the emblem File + */ + protected String emblemFile = null; + + /** + * The mobile phone number + */ + protected String mobileNumber = null; + + /** + * Holds the proxy Host + */ + protected String proxyHost = null; + + /** + * Holds the proxy port number + */ + protected int proxyPort = -1; + + /** + * Holds the output folder + */ + protected String folder = null; + + /** + * Holds the default BKU to use + */ + protected BKUs defaulBKU = BKUs.NONE; + + /** + * Holds the automatic positioning value + */ + protected boolean automaticPositioning = false; + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() + */ + @Override + public String getEmblem() { + return this.emblemFile; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setEmblem(java.lang.String) + */ + @Override + public void setEmblem(String emblemFile) throws InvalidEmblemFile { + if (emblemFile == null || emblemFile.trim().equals("")) { //$NON-NLS-1$ + // Ok to set no file ... + } else { + File imageFile = new File(emblemFile); + if (!imageFile.exists()) { + throw new InvalidEmblemFile(imageFile, + new FileNotFoundException(emblemFile)); + } + + try { + Image img = new Image(Display.getDefault(), new ImageData( + emblemFile)); + + img.dispose(); + } catch (Exception ex) { + throw new InvalidEmblemFile(imageFile, ex); + } + } + + this.emblemFile = emblemFile; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getNumber() + */ + @Override + public String getNumber() { + return this.mobileNumber; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setNumber(java.lang.String) + */ + @Override + public void setNumber(String number) throws InvalidNumberException { + if(number == null || number.trim().equals("")) { //$NON-NLS-1$ + this.mobileNumber = null; + return; + } + this.mobileNumber = ATrustHelper.normalizeMobileNumber(number); + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getProxyHost() + */ + @Override + public String getProxyHost() { + return this.proxyHost; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setProxyHost(java.lang.String) + */ + @Override + public void setProxyHost(String host) { + this.proxyHost = host; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getProxyPort() + */ + @Override + public int getProxyPort() { + return this.proxyPort; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setProxyPort(int) + */ + @Override + public void setProxyPort(int port) throws InvalidPortException { + if(port > 0 && port < 0xFFFF) { + this.proxyPort = port; + return; + } + if(port == -1) { + this.proxyPort = -1; + return; + } + throw new InvalidPortException(port); + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getAutomaticPosition() + */ + @Override + public boolean getAutomaticPosition() { + return this.automaticPositioning; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setAutomaticPosition(boolean) + */ + @Override + public void setAutomaticPosition(boolean automatic) { + this.automaticPositioning = automatic; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getBKUSelection() + */ + @Override + public BKUs getBKUSelection() { + return this.defaulBKU; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setBKUSelection(at.asit.pdfover.signator.BKUs) + */ + @Override + public void setBKUSelection(BKUs bkuSelection) { + this.defaulBKU = bkuSelection; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getOutputFolder() + */ + @Override + public String getOutputFolder() { + return this.folder; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setOutputFolder(java.lang.String) + */ + @Override + public void setOutputFolder(String folder) { + this.folder = folder; + } + +} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java index 4b468ad8..52dfb5c9 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java @@ -19,6 +19,9 @@ package at.asit.pdfover.gui.workflow.states; import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + +import at.asit.pdfover.gui.MainWindowBehavior; +import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.composites.ConfigurationComposite; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; @@ -30,6 +33,7 @@ public class ConfigurationUIState extends State { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(ConfigurationUIState.class); @@ -41,6 +45,7 @@ public class ConfigurationUIState extends State { this.configurationComposite = this.stateMachine.getGUIProvider().createComposite(ConfigurationComposite.class, SWT.RESIZE, this); this.configurationComposite.setConfigManipulator(this.stateMachine.getConfigManipulator()); + this.configurationComposite.setConfigProvider(this.stateMachine.getConfigProvider()); } return this.configurationComposite; @@ -88,6 +93,8 @@ public class ConfigurationUIState extends State { @Override public void updateMainWindowBehavior() { // Leave the state as it is + MainWindowBehavior behavior = this.stateMachine.getStatus().getBehavior(); + behavior.setMainBarVisible(false); } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java index 234cd215..f39deada 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java @@ -41,7 +41,7 @@ public class MobileBKUState extends State { */ public MobileBKUState(StateMachine stateMachine) { super(stateMachine); - this.status = new MobileBKUStatus(); + this.status = new MobileBKUStatus(this.stateMachine.getConfigProvider()); } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index 50aee387..2ebc3f39 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -16,6 +16,10 @@ package at.asit.pdfover.gui.workflow.states; //Imports +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,8 +27,10 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.composites.OutputComposite; +import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; +import at.asit.pdfover.signator.DocumentSource; /** * Procduces the output of the signature process. (save file, open file) @@ -42,48 +48,74 @@ public class OutputState extends State { * SFL4J Logger instance **/ @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(OutputState.class); - + private static final Logger log = LoggerFactory + .getLogger(OutputState.class); + private OutputComposite outputComposite = null; private OutputComposite getSelectionComposite() { if (this.outputComposite == null) { - this.outputComposite = - this.stateMachine.getGUIProvider().createComposite(OutputComposite.class, SWT.RESIZE, this); + this.outputComposite = this.stateMachine.getGUIProvider() + .createComposite(OutputComposite.class, SWT.RESIZE, this); } return this.outputComposite; } - + + private boolean saved = false; + @Override public void run() { // TODO Preform output operations ... end workflow - + Status status = this.stateMachine.getStatus(); - - if(status.getSignResult() != null) - { + + if (status.getSignResult() != null) { OutputComposite outputComposite = this.getSelectionComposite(); - outputComposite.setSignedDocument(status.getSignResult().getSignedDocument()); + outputComposite.setSignedDocument(status.getSignResult() + .getSignedDocument()); this.stateMachine.getGUIProvider().display(outputComposite); - - /*DocumentSource signedDocument = status.getSignResult().getSignedDocument(); - - FileOutputStream output; - try { - output = new FileOutputStream(new File("/tmp/test.pdf")); - output.write(signedDocument.getByteArray(), 0, signedDocument.getByteArray().length); - output.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - }*/ + + if (!this.saved) { + this.saved = true; + String outputFolder = this.stateMachine.getConfigProvider() + .getDefaultOutputFolder(); + String fileName = status.getDocument().getName(); + if (outputFolder != null && !outputFolder.trim().equals("")) { //$NON-NLS-1$ + DocumentSource signedDocument = status.getSignResult().getSignedDocument(); + FileOutputStream output; + try { + output = new FileOutputStream(new File(outputFolder + "/" + fileName + "_signed.pdf")); //$NON-NLS-1$ //$NON-NLS-2$ + output.write(signedDocument.getByteArray(), 0, + signedDocument.getByteArray().length); + output.close(); + } catch (IOException e) { + log.error("Failed to save signed document to configured output folder.", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(outputComposite.getShell(), SWT.NONE, "Failed to save signed document to configured output folder.", e); + dialog.open(); + } + } + } + + /* + * DocumentSource signedDocument = + * status.getSignResult().getSignedDocument(); + * + * FileOutputStream output; try { output = new FileOutputStream(new + * File("/tmp/test.pdf")); + * output.write(signedDocument.getByteArray(), 0, + * signedDocument.getByteArray().length); output.close(); } catch + * (IOException e) { // TODO Auto-generated catch block + * e.printStackTrace(); } + */ } - - //this.stateMachine.exit(); + + // this.stateMachine.exit(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.states.State#cleanUp() */ @Override @@ -92,12 +124,15 @@ public class OutputState extends State { this.outputComposite.dispose(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.workflow.states.State#setMainWindowBehavior() */ @Override public void updateMainWindowBehavior() { - MainWindowBehavior behavior = this.stateMachine.getStatus().getBehavior(); + MainWindowBehavior behavior = this.stateMachine.getStatus() + .getBehavior(); behavior.reset(); behavior.setEnabled(Buttons.CONFIG, true); behavior.setEnabled(Buttons.OPEN, true); @@ -110,7 +145,7 @@ public class OutputState extends State { } @Override - public String toString() { + public String toString() { return this.getClass().getName(); } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index b4b05318..a1de09d0 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -20,9 +20,6 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,9 +32,7 @@ import at.asit.pdfover.gui.cliarguments.PhoneNumberArgument; import at.asit.pdfover.gui.exceptions.InitializationException; import at.asit.pdfover.gui.workflow.ConfigManipulator; import at.asit.pdfover.gui.workflow.StateMachine; -import at.asit.pdfover.signator.BKUs; import at.asit.pdfover.signator.Signator; -import at.asit.pdfover.signator.SignaturePosition; /** * Starting state of workflow proccess @@ -46,11 +41,7 @@ import at.asit.pdfover.signator.SignaturePosition; */ public class PrepareConfigurationState extends State { - /** - * Regex for parsing signature position - */ - public static final String SIGN_POS_REGEX = "(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?);p=(\\d))|(auto)|(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?))"; //$NON-NLS-1$ - + /** * @param stateMachine */ @@ -81,10 +72,12 @@ public class PrepareConfigurationState extends State { private void initializeFromConfigurationFile(String filename) throws InitializationException { try { - Properties config = new Properties(); try { - config.load(new FileInputStream(filename)); + this.stateMachine.getConfigProvider().loadConfiguration(new FileInputStream(filename)); + + log.info("Loaded config from file : " + filename); //$NON-NLS-1$ + } catch (FileNotFoundException ex) { if (filename.equals(ConfigManipulator.DEFAULT_CONFIG_FILE)) { // we only check for resource config file if it is the @@ -92,7 +85,9 @@ public class PrepareConfigurationState extends State { try { InputStream is = this.getClass().getResourceAsStream( "/" + filename); //$NON-NLS-1$ - config.load(is); + this.stateMachine.getConfigProvider().loadConfiguration(is); + + log.info("Loaded config from resource : " + filename); //$NON-NLS-1$ } catch (Exception eex) { throw ex; } @@ -100,112 +95,7 @@ public class PrepareConfigurationState extends State { throw ex; } } - - // Load ok ... - ConfigManipulator configManipulator = this.stateMachine - .getConfigManipulator(); - - // Set Emblem - configManipulator.setDefaultEmblem(config - .getProperty(ConfigManipulator.EMBLEM_CONFIG)); - - // Set Mobile Phone Number - configManipulator.setDefaultMobileNumber(config - .getProperty(ConfigManipulator.MOBILE_NUMBER_CONFIG)); - - // Set Proxy Host - configManipulator.setProxyHost(config - .getProperty(ConfigManipulator.PROXY_HOST_CONFIG)); - - // Set Proxy Port - String proxyPortString = config - .getProperty(ConfigManipulator.PROXY_PORT_CONFIG); - - if (proxyPortString != null && !proxyPortString.trim().equals("")) { //$NON-NLS-1$ - int port = Integer.parseInt(proxyPortString); - - if (port > 0 && port <= 0xFFFF) { - configManipulator.setProxyPort(port); - } else { - log.warn("Proxy port is out of range!: " + port); //$NON-NLS-1$ - } - } - - // Set Default BKU - String bkuString = config.getProperty(ConfigManipulator.BKU_CONFIG); - - BKUs defaultBKU = BKUs.NONE; - - try { - defaultBKU = BKUs.valueOf(bkuString); - } catch (IllegalArgumentException ex) { - log.error("Invalid BKU config value " + bkuString + " using none!"); //$NON-NLS-1$ //$NON-NLS-2$ - defaultBKU = BKUs.NONE; - } catch (NullPointerException ex) { - log.error("Invalid BKU config value " + bkuString + " using none!"); //$NON-NLS-1$ //$NON-NLS-2$ - defaultBKU = BKUs.NONE; - } - - configManipulator.setDefaultBKU(defaultBKU); - - // Set Signature Position - String signaturePosition = config - .getProperty(ConfigManipulator.SIGNATURE_POSITION_CONFIG); - - SignaturePosition position = null; - - if (signaturePosition != null - && !signaturePosition.trim().equals("")) { //$NON-NLS-1$ - - signaturePosition = signaturePosition.trim().toLowerCase(); - - Pattern pattern = Pattern.compile(SIGN_POS_REGEX); - - Matcher matcher = pattern.matcher(signaturePosition); - - if (matcher.matches()) { - if (matcher.groupCount() == 8) { - if (matcher.group(1) != null) { - // we have format: x=..;y=..;p=... - try { - // group 2 = x value - float x = Float.parseFloat(matcher.group(2)); - - // group 3 = y value - float y = Float.parseFloat(matcher.group(3)); - - // group 4 = p value - int p = Integer.parseInt(matcher.group(3)); - - position = new SignaturePosition(x, y, p); - } catch (NumberFormatException ex) { - log.error( - "Signature Position read from config failed: Not a valid number", ex); //$NON-NLS-1$ - } - } else if (matcher.group(5) != null) { - // we have format auto - position = new SignaturePosition(); - } else if (matcher.group(6) != null) { - // we have format x=...;y=...; - // group 7 = x value - float x = Float.parseFloat(matcher.group(7)); - - // group 8 = y value - float y = Float.parseFloat(matcher.group(8)); - - position = new SignaturePosition(x, y); - } - } else { - log.error("Signature Position read from config failed: wrong group Count!"); //$NON-NLS-1$ - } - } else { - log.error("Signature Position read from config failed: not matching string"); //$NON-NLS-1$ - } - - } - - configManipulator.setDefaultSignaturePosition(position); - + } catch (IOException ex) { throw new InitializationException( "Failed to read configuration from config file", ex); //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index 1b7ed600..88acc84b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -23,9 +23,11 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.composites.WaitingComposite; +import at.asit.pdfover.gui.workflow.ConfigProvider; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.signator.BKUs; +import at.asit.pdfover.signator.FileNameEmlbem; import at.asit.pdfover.signator.PDFFileDocumentSource; import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.Signer; @@ -57,6 +59,11 @@ public class PrepareSigningState extends State { @Override public void run() { try { + + Status status = this.state.stateMachine.getStatus(); + + ConfigProvider configuration = this.state.stateMachine.getConfigProvider(); + if(this.state.signer == null) { this.state.signer = this.state.stateMachine.getPDFSigner().getPDFSigner(); } @@ -65,12 +72,15 @@ public class PrepareSigningState extends State { this.state.signatureParameter = this.state.signer.newParameter(); } - this.state.signatureParameter.setInputDocument(new PDFFileDocumentSource(this.state.stateMachine.getStatus().getDocument())); - this.state.signatureParameter.setSignatureDevice(this.state.stateMachine.getStatus().getBKU()); - this.state.signatureParameter.setSignaturePosition(this.state.stateMachine.getStatus().getSignaturePosition()); + this.state.signatureParameter.setInputDocument(new PDFFileDocumentSource(status.getDocument())); + this.state.signatureParameter.setSignatureDevice(status.getBKU()); + this.state.signatureParameter.setSignaturePosition(status.getSignaturePosition()); // TODO: Fill library specific signature Parameters ... - // TODO: setEmblem etc. + + if(configuration.getDefaultEmblem() != null && !configuration.getDefaultEmblem().equals("")) { //$NON-NLS-1$ + this.state.signatureParameter.setEmblem(new FileNameEmlbem(configuration.getDefaultEmblem())); + } this.state.signingState = this.state.signer.prepare(this.state.signatureParameter); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java index 1ea265ad..a1868462 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java @@ -22,7 +22,6 @@ import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.asit.pdfover.gui.composites.MobileBKUEnterNumberComposite; import at.asit.pdfover.gui.exceptions.InvalidNumberException; import at.asit.pdfover.gui.exceptions.InvalidPasswordException; import at.asit.pdfover.gui.exceptions.PasswordTooLongException; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java index 344eaf58..fe85d492 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java @@ -19,6 +19,8 @@ package at.asit.pdfover.gui.workflow.states.mobilebku; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.workflow.ConfigProvider; + /** * */ @@ -26,16 +28,22 @@ public class MobileBKUStatus { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MobileBKUStatus.class); + /** + * Maximum number of TAN tries! + */ public static final int MOBILE_MAX_TAN_TRIES = 3; /** * Constructor + * @param provider */ - public MobileBKUStatus() { - // TODO: Fill number and password with possible config values! + public MobileBKUStatus(ConfigProvider provider) { + this.setPhoneNumber(provider.getDefaultMobileNumber()); + this.setMobilePassword(provider.getDefaultPassword()); } String viewstate; @@ -122,7 +130,7 @@ public class MobileBKUStatus { } /** - * @param credentialsFormAction the credentialsFormAction to set + * @param baseURL */ public void setBaseURL(String baseURL) { this.baseURL = baseURL; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostCredentialsThread.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostCredentialsThread.java index df18c231..bfb6f66a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostCredentialsThread.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostCredentialsThread.java @@ -68,7 +68,7 @@ public class PostCredentialsThread implements Runnable { client.getParams().setParameter("http.useragent", //$NON-NLS-1$ LocalBKUState.PDF_OVER_USER_AGENT_STRING); - PostMethod method = new PostMethod(status.getBaseURL() + "/identification.aspx?sid=" + status.getSessionID()); + PostMethod method = new PostMethod(status.getBaseURL() + "/identification.aspx?sid=" + status.getSessionID()); //$NON-NLS-1$ method.addParameter("__VIEWSTATE", status.getViewstate()); //$NON-NLS-1$ method.addParameter("__EVENTVALIDATION", status.getEventvalidation()); //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java index f8f7eac2..bd2f5b53 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java @@ -70,10 +70,9 @@ public class PostSLRequestThread implements Runnable { client.getParams().setParameter("http.useragent", //$NON-NLS-1$ LocalBKUState.PDF_OVER_USER_AGENT_STRING); - // TODO: move URL to config!! - - //String url = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; - String url = "https://test1.a-trust.at/https-security-layer-request/default.aspx"; + // TODO: move URL to config? + String url = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$ + //String url = "https://test1.a-trust.at/https-security-layer-request/default.aspx"; PostMethod method = new PostMethod(url); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java index 5e9d8159..91aa6caa 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java @@ -46,7 +46,7 @@ public class TrustedSocketFactory implements ProtocolSocketFactory { private static final Logger log = LoggerFactory .getLogger(TrustedSocketFactory.class); - private SSLSocketFactory getFactory() throws NoSuchAlgorithmException, + private static SSLSocketFactory getFactory() throws NoSuchAlgorithmException, KeyManagementException, Exception { SSLContext sslContext = SSLContext.getInstance("TLS"); //$NON-NLS-1$ sslContext.init(null, new TrustManager[] { new ASITTrustManager() }, @@ -71,7 +71,7 @@ public class TrustedSocketFactory implements ProtocolSocketFactory { return sslSocket; } catch (Exception ex) { - log.error("TrustedSocketFactory: ", ex); + log.error("TrustedSocketFactory: ", ex); //$NON-NLS-1$ if (ex instanceof IOException) { throw (IOException) ex; } else if (ex instanceof UnknownHostException) { @@ -99,7 +99,7 @@ public class TrustedSocketFactory implements ProtocolSocketFactory { return sslSocket; } catch (Exception ex) { - log.error("TrustedSocketFactory: ", ex); + log.error("TrustedSocketFactory: ", ex); //$NON-NLS-1$ if (ex instanceof IOException) { throw (IOException) ex; } else if (ex instanceof UnknownHostException) { @@ -144,7 +144,7 @@ public class TrustedSocketFactory implements ProtocolSocketFactory { } return socket; } catch (Exception ex) { - log.error("TrustedSocketFactory: ", ex); + log.error("TrustedSocketFactory: ", ex); //$NON-NLS-1$ if (ex instanceof IOException) { throw (IOException) ex; } else if (ex instanceof UnknownHostException) { |