summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java12
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java14
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidNumberException.java42
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java35
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java12
6 files changed, 18 insertions, 101 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
index ee291b51..8decae83 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
@@ -31,7 +31,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.bku.BKUHelper;
-import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.exceptions.InvalidPasswordException;
import at.asit.pdfover.gui.exceptions.PasswordTooLongException;
import at.asit.pdfover.gui.exceptions.PasswordTooShortException;
@@ -201,10 +200,8 @@ public class MobileBKUHelper {
*
* @param number
* @return the normalized Phone number
- * @throws InvalidNumberException
*/
- public static String normalizeMobileNumber(String number)
- throws InvalidNumberException {
+ public static String normalizeMobileNumber(String number) {
// Verify number and normalize
number = number.replaceAll("\\s","");
@@ -212,12 +209,11 @@ public class MobileBKUHelper {
Pattern pattern = Pattern.compile(NUMBER_REGEX);
Matcher matcher = pattern.matcher(number);
- if (!matcher.find()) {
- throw new InvalidNumberException();
- }
+ if (!matcher.find())
+ return number; /* might be an idA username, return unchanged */
if (matcher.groupCount() != 6) {
- throw new InvalidNumberException();
+ return number;
}
String countryCode = matcher.group(1);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
index 2f2fef0e..a2973c3d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
@@ -62,7 +62,6 @@ import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.controls.ErrorMarker;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
-import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.utils.ImageConverter;
import at.asit.pdfover.gui.workflow.config.ConfigManipulator;
import at.asit.pdfover.gui.workflow.config.ConfigurationContainer;
@@ -585,10 +584,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
this.setSignatureProfileSetting();
}
- /**
- * @throws InvalidNumberException
- */
- private void plainMobileNumberSetter() throws InvalidNumberException {
+ private void plainMobileNumberSetter() {
String number = this.txtMobileNumber.getText();
this.configurationContainer.setMobileNumber(number);
number = this.configurationContainer.getMobileNumber();
@@ -620,12 +616,8 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
*/
@Override
public void initConfiguration(PersistentConfigProvider provider) {
- try {
- this.configurationContainer.setMobileNumber(
- provider.getDefaultMobileNumberPersistent());
- } catch (InvalidNumberException e) {
- log.error("Failed to set mobile phone number!", e); //$NON-NLS-1$
- }
+ this.configurationContainer.setMobileNumber(
+ provider.getDefaultMobileNumberPersistent());
try {
this.configurationContainer.setEmblem(
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidNumberException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidNumberException.java
deleted file mode 100644
index 63b7f034..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidNumberException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.exceptions;
-
-// Imports
-
-/**
- *
- */
-public class InvalidNumberException extends PDFOverGUIException {
- /**
- *
- */
- private static final long serialVersionUID = -4201886410518715443L;
-
- /**
- * Empty constructor
- */
- public InvalidNumberException() {
- }
-
- /**
- * Constructor with a message parameter
- * @param msg Error message
- */
- public InvalidNumberException(String msg) {
- super(msg);
- }
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java
index 952bd137..a744cf72 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java
@@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
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.utils.LocaleSerializer;
import at.asit.pdfover.commons.Messages;
@@ -568,19 +567,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator,
*/
@Override
public void setDefaultMobileNumber(String number) {
- try {
- if (number == null || number.trim().isEmpty()) {
- this.configuration.setMobileNumber(STRING_EMPTY);
- } else {
- this.configuration.setMobileNumber(number);
- }
- } catch (InvalidNumberException e) {
- log.error("Error setting mobile number", e); //$NON-NLS-1$
- try {
- this.configuration.setMobileNumber(STRING_EMPTY);
- } catch (InvalidNumberException e1) {
- // Ignore
- }
+ if (number == null || number.trim().isEmpty()) {
+ this.configuration.setMobileNumber(STRING_EMPTY);
+ } else {
+ this.configuration.setMobileNumber(number);
}
}
@@ -589,19 +579,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator,
*/
@Override
public void setDefaultMobileNumberOverlay(String number) {
- try {
- if (number == null || number.trim().isEmpty()) {
- this.configurationOverlay.setMobileNumber(STRING_EMPTY);
- } else {
- this.configurationOverlay.setMobileNumber(number);
- }
- } catch (InvalidNumberException e) {
- log.error("Error setting mobile number", e); //$NON-NLS-1$
- try {
- this.configurationOverlay.setMobileNumber(STRING_EMPTY);
- } catch (InvalidNumberException e1) {
- // Ignore
- }
+ if (number == null || number.trim().isEmpty()) {
+ this.configurationOverlay.setMobileNumber(STRING_EMPTY);
+ } else {
+ this.configurationOverlay.setMobileNumber(number);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java
index 14383913..e2381a6f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java
@@ -22,7 +22,6 @@ import org.eclipse.swt.graphics.Point;
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
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;
import at.asit.pdfover.signator.SignaturePosition;
@@ -53,9 +52,8 @@ public interface ConfigurationContainer {
/**
* Sets the mobile phone number
* @param number the mobile phone number
- * @throws InvalidNumberException
*/
- public void setMobileNumber(String number) throws InvalidNumberException;
+ public void setMobileNumber(String number);
/**
* Gets the mobile phone number
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java
index 92153fb4..c989d59f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java
@@ -32,9 +32,7 @@ import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper;
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
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.commons.Messages;
import at.asit.pdfover.signator.BKUs;
import at.asit.pdfover.signator.SignaturePosition;
@@ -200,18 +198,12 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#setNumber(java.lang.String)
*/
@Override
- public void setMobileNumber(String number) throws InvalidNumberException {
+ public void setMobileNumber(String number) {
if(number == null || number.trim().isEmpty()) {
this.mobileNumber = null;
return;
}
- try {
- this.mobileNumber = MobileBKUHelper.normalizeMobileNumber(number);
- } catch (InvalidNumberException e) {
- // assume this is a username for ID-Austria
- // todo: re-evaluate this (cf. #88)
- this.mobileNumber = number;
- }
+ this.mobileNumber = MobileBKUHelper.normalizeMobileNumber(number);
}