From 5b2342a9e89b6a92f13ba24ad28a47c2d613ee5e Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:26:55 +0000 Subject: Some more String.isEmpty() replacements Also fixes header comparison error git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@327 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../java/at/asit/pdfover/gui/composites/OutputComposite.java | 2 +- .../pdfover/gui/composites/SimpleConfigurationComposite.java | 10 +++++----- .../asit/pdfover/gui/workflow/ConfigurationContainerImpl.java | 4 ++-- .../at/asit/pdfover/gui/workflow/states/LocalBKUState.java | 8 ++++---- .../at/asit/pdfover/gui/workflow/states/MobileBKUState.java | 10 +++++----- .../at/asit/pdfover/gui/workflow/states/PositioningState.java | 2 +- .../asit/pdfover/gui/workflow/states/PrepareSigningState.java | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index e55a6b86..492e9f9f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -214,7 +214,7 @@ public class OutputComposite extends StateComposite { String outputFileName; String outputFolder = getOutputDir(); - if (!this.saveFailed && outputFolder != null && !outputFolder.trim().equals("")) { //$NON-NLS-1$ + if (!this.saveFailed && outputFolder != null && !outputFolder.trim().isEmpty()) { // Output folder configured, try to save there if(!outputFolder.endsWith(File.separator)) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 7c127e04..403d5ffc 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -798,11 +798,11 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { try { - if (image == null || image.trim().equals("")) { //$NON-NLS-1$ + if (image == null || image.trim().isEmpty()) { if (this.signer != null) { SignatureParameter param = this.signer.getPDFSigner() .newParameter(); - if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().equals("")) { //$NON-NLS-1$ + if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) { param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); //$NON-NLS-1$ } @@ -816,7 +816,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { if (this.signer != null) { SignatureParameter param = this.signer.getPDFSigner() .newParameter(); - if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().equals("")) { //$NON-NLS-1$ + if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) { param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); //$NON-NLS-1$ } @@ -958,7 +958,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { private void plainProxyPortSetter() throws InvalidPortException { String portString = this.txtProxyPort.getText(); int port = -1; - if (portString == null || portString.trim().equals("")) { //$NON-NLS-1$ + if (portString == null || portString.trim().isEmpty()) { port = -1; } else { try { @@ -1012,7 +1012,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } String emblemFile = this.configurationContainer.getEmblem(); - if (emblemFile != null && !emblemFile.trim().equals("")) { //$NON-NLS-1$ + if (emblemFile != null && !emblemFile.trim().isEmpty()) { // this.txtEmblemFile.setText(emblemFile); this.logoFile = emblemFile; try { 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 index 8f1b1f9b..e7359c64 100644 --- 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 @@ -114,7 +114,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { */ @Override public void setEmblem(String emblemFile) throws InvalidEmblemFile { - if (emblemFile == null || emblemFile.trim().equals("")) { //$NON-NLS-1$ + if (emblemFile == null || emblemFile.trim().isEmpty()) { // Ok to set no file ... } else { File imageFile = new File(emblemFile); @@ -151,7 +151,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { */ @Override public void setNumber(String number) throws InvalidNumberException { - if(number == null || number.trim().equals("")) { //$NON-NLS-1$ + if(number == null || number.trim().isEmpty()) { this.mobileNumber = null; return; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java index 2f498a98..908ed244 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java @@ -96,14 +96,14 @@ public class LocalBKUState extends State { String server = ""; //$NON-NLS-1$ String userAgent = ""; //$NON-NLS-1$ String signatureLayout = null; - if (method.getResponseHeader(BKU_RESPONSE_HEADER_SERVER) != null&& - !method.getResponseHeader(BKU_RESPONSE_HEADER_SERVER).equals("")) { //$NON-NLS-1$ + if (method.getResponseHeader(BKU_RESPONSE_HEADER_SERVER) != null && + !method.getResponseHeader(BKU_RESPONSE_HEADER_SERVER).getValue().isEmpty()) { server = method.getResponseHeader( BKU_RESPONSE_HEADER_SERVER).getValue(); } if (method.getResponseHeader(BKU_RESPONSE_HEADER_USERAGENT) != null && - !method.getResponseHeader(BKU_RESPONSE_HEADER_USERAGENT).equals("")) { //$NON-NLS-1$ + !method.getResponseHeader(BKU_RESPONSE_HEADER_USERAGENT).getValue().isEmpty()) { userAgent = method.getResponseHeader( BKU_RESPONSE_HEADER_USERAGENT).getValue(); } @@ -111,7 +111,7 @@ public class LocalBKUState extends State { if (method .getResponseHeader(BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT) != null && !method - .getResponseHeader(BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT).equals("")) { //$NON-NLS-1$ + .getResponseHeader(BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT).getValue().isEmpty()) { signatureLayout = method.getResponseHeader( BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT).getValue(); } 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 1a13c794..bc831766 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 @@ -177,9 +177,9 @@ public class MobileBKUState extends State { // check if we have everything we need! if (mobileStatus.getPhoneNumber() != null - && !mobileStatus.getPhoneNumber().equals("") //$NON-NLS-1$ + && !mobileStatus.getPhoneNumber().isEmpty() && mobileStatus.getMobilePassword() != null - && !mobileStatus.getMobilePassword().equals("")) { //$NON-NLS-1$ + && !mobileStatus.getMobilePassword().isEmpty()) { // post to bku Thread postCredentialsThread = new Thread( new PostCredentialsThread(this)); @@ -212,7 +212,7 @@ public class MobileBKUState extends State { // We need number and password => show UI! if (mobileStatus.getErrorMessage() != null - && !mobileStatus.getErrorMessage().equals("")) { //$NON-NLS-1$ + && !mobileStatus.getErrorMessage().isEmpty()) { // set possible error message ui.setErrorMessage(mobileStatus.getErrorMessage()); mobileStatus.setErrorMessage(null); @@ -220,13 +220,13 @@ public class MobileBKUState extends State { if (ui.getMobileNumber() == null - || ui.getMobileNumber().equals("")) { //$NON-NLS-1$ + || ui.getMobileNumber().isEmpty()) { // set possible phone number ui.setMobileNumber(mobileStatus.getPhoneNumber()); } if (ui.getMobilePassword() == null - || ui.getMobilePassword().equals("")) { //$NON-NLS-1$ + || ui.getMobilePassword().isEmpty()) { // set possible password ui.setMobilePassword(mobileStatus.getMobilePassword()); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 2d610f24..dbd70fce 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -68,7 +68,7 @@ public class PositioningState extends State { SignatureParameter param = this.stateMachine.getPDFSigner().getPDFSigner().newParameter(); Emblem emblem = new FileNameEmblem(this.stateMachine.getConfigProvider().getDefaultEmblem()); param.setEmblem(emblem); - if(this.stateMachine.getConfigProvider().getSignatureNote() != null && !this.stateMachine.getConfigProvider().getSignatureNote().equals("")) { //$NON-NLS-1$ + if(this.stateMachine.getConfigProvider().getSignatureNote() != null && !this.stateMachine.getConfigProvider().getSignatureNote().isEmpty()) { param.setProperty("SIG_NOTE", this.stateMachine.getConfigProvider().getSignatureNote()); //$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 c58417ac..1fdc4228 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 @@ -76,7 +76,7 @@ public class PrepareSigningState extends State { System.setProperty("https.proxyPort", Integer.toString(proxyPort)); //$NON-NLS-1$ } - if(proxyHost != null && !proxyHost.equals("")) { //$NON-NLS-1$ + if(proxyHost != null && !proxyHost.isEmpty()) { System.setProperty("http.proxyHost", proxyHost); //$NON-NLS-1$ System.setProperty("https.proxyHost", proxyHost); //$NON-NLS-1$ } @@ -93,11 +93,11 @@ public class PrepareSigningState extends State { this.state.signatureParameter.setSignatureDevice(status.getBKU()); this.state.signatureParameter.setSignaturePosition(status.getSignaturePosition()); - if(configuration.getDefaultEmblem() != null && !configuration.getDefaultEmblem().equals("")) { //$NON-NLS-1$ + if(configuration.getDefaultEmblem() != null && !configuration.getDefaultEmblem().isEmpty()) { this.state.signatureParameter.setEmblem(new FileNameEmblem(configuration.getDefaultEmblem())); } - if(configuration.getSignatureNote() != null && !configuration.getSignatureNote().equals("")) { //$NON-NLS-1$ + if(configuration.getSignatureNote() != null && !configuration.getSignatureNote().isEmpty()) { this.state.signatureParameter.setProperty("SIG_NOTE", configuration.getSignatureNote()); //$NON-NLS-1$ } -- cgit v1.2.3