From 6e4e0f22310b9515ca3a87719a68b58bc3faf958 Mon Sep 17 00:00:00 2001 From: Philipp Riemer Date: Sun, 28 Nov 2021 16:24:12 +0100 Subject: [PATCH] DRY: inline redundant local variable Entfernt doppelt erzeugte Referenzen auf ein identisches Objekt. --- src/de/willuhn/jameica/hbci/gui/input/AddressInput.java | 7 +++---- .../jameica/hbci/gui/parts/AbstractSammelTransferList.java | 6 ++---- .../hbci/gui/parts/AbstractSepaSammelTransferList.java | 5 ++--- src/de/willuhn/jameica/hbci/io/AbstractSepaExporter.java | 3 +-- .../jameica/hbci/passports/rdh/SelectSizEntryDialog.java | 6 ++---- src/de/willuhn/jameica/hbci/server/UmsatzTypImpl.java | 3 +-- src/de/willuhn/jameica/hbci/server/VersionUtil.java | 3 +-- 7 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/de/willuhn/jameica/hbci/gui/input/AddressInput.java b/src/de/willuhn/jameica/hbci/gui/input/AddressInput.java index c830f96a9..c1f27af78 100644 --- a/src/de/willuhn/jameica/hbci/gui/input/AddressInput.java +++ b/src/de/willuhn/jameica/hbci/gui/input/AddressInput.java @@ -348,11 +348,10 @@ public void handleEvent(Event event) */ public void setText(String s) { - String before = s; - String after = HBCIProperties.clean(s,validChars); // Alle Zeichen rauswerfen, die nicht zulaessig sind. - super.setText(after); - if (before != null && !before.equals(after)) + String cleaned = HBCIProperties.clean(s,validChars); + super.setText(cleaned); + if (s != null && !s.equals(cleaned)) GUI.getView().setErrorText(i18n.tr("Im Namen wurden nicht zulässige Zeichen entfernt")); } diff --git a/src/de/willuhn/jameica/hbci/gui/parts/AbstractSammelTransferList.java b/src/de/willuhn/jameica/hbci/gui/parts/AbstractSammelTransferList.java index 9513a7376..7444ef50d 100644 --- a/src/de/willuhn/jameica/hbci/gui/parts/AbstractSammelTransferList.java +++ b/src/de/willuhn/jameica/hbci/gui/parts/AbstractSammelTransferList.java @@ -45,7 +45,6 @@ import de.willuhn.jameica.hbci.messaging.ObjectMessage; import de.willuhn.jameica.hbci.reminder.ReminderStorageProviderHibiscus; import de.willuhn.jameica.hbci.rmi.HBCIDBService; -import de.willuhn.jameica.hbci.rmi.HibiscusDBObject; import de.willuhn.jameica.hbci.rmi.Konto; import de.willuhn.jameica.hbci.rmi.SammelTransfer; import de.willuhn.jameica.hbci.rmi.SammelTransferBuchung; @@ -95,8 +94,7 @@ else if (l.ausgefuehrt()) item.setForeground(Color.COMMENT.getSWTColor()); // Checken, ob der Auftrag einen Reminder hat oder ob es ein geclonter Auftrag ist - HibiscusDBObject o = (HibiscusDBObject) l; - String uuid = MetaKey.REMINDER_UUID.get(o); + String uuid = MetaKey.REMINDER_UUID.get(l); if (uuid != null) { try @@ -110,7 +108,7 @@ else if (l.ausgefuehrt()) Logger.error("unable to determine reminder",e); } } - else if (MetaKey.REMINDER_TEMPLATE.get(o) != null) + else if (MetaKey.REMINDER_TEMPLATE.get(l) != null) { item.setImage(4,SWTUtil.getImage("edit-copy.png")); } diff --git a/src/de/willuhn/jameica/hbci/gui/parts/AbstractSepaSammelTransferList.java b/src/de/willuhn/jameica/hbci/gui/parts/AbstractSepaSammelTransferList.java index 0270856bb..8ba22e151 100644 --- a/src/de/willuhn/jameica/hbci/gui/parts/AbstractSepaSammelTransferList.java +++ b/src/de/willuhn/jameica/hbci/gui/parts/AbstractSepaSammelTransferList.java @@ -116,8 +116,7 @@ public void format(TableItem item) { item.setForeground(Color.COMMENT.getSWTColor()); // Checken, ob der Auftrag einen Reminder hat oder ob es ein geclonter Auftrag ist - HibiscusDBObject o = (HibiscusDBObject) l; - String uuid = MetaKey.REMINDER_UUID.get(o); + String uuid = MetaKey.REMINDER_UUID.get(l); if (uuid != null) { try @@ -131,7 +130,7 @@ public void format(TableItem item) { Logger.error("unable to determine reminder",e); } } - else if (MetaKey.REMINDER_TEMPLATE.get(o) != null) + else if (MetaKey.REMINDER_TEMPLATE.get(l) != null) { item.setImage(4,SWTUtil.getImage("edit-copy.png")); } diff --git a/src/de/willuhn/jameica/hbci/io/AbstractSepaExporter.java b/src/de/willuhn/jameica/hbci/io/AbstractSepaExporter.java index 489da1ecc..c2e4fcec0 100644 --- a/src/de/willuhn/jameica/hbci/io/AbstractSepaExporter.java +++ b/src/de/willuhn/jameica/hbci/io/AbstractSepaExporter.java @@ -107,8 +107,7 @@ void setup(Object[] objects, IOFormat format, OutputStream os, ProgressMonitor m // User nach der SEPA-Version fragen, die verwendet werden soll. PainVersionDialog d = new PainVersionDialog(this.getPainType()); - SepaVersion version = (SepaVersion) d.open(); - ctx.version = version; + ctx.version = (SepaVersion) d.open(); // Header-Infos zuweisen ctx.props.setProperty("src.bic", StringUtils.trimToEmpty(konto.getBic())); diff --git a/src/de/willuhn/jameica/hbci/passports/rdh/SelectSizEntryDialog.java b/src/de/willuhn/jameica/hbci/passports/rdh/SelectSizEntryDialog.java index dc6f32327..bb17a7011 100644 --- a/src/de/willuhn/jameica/hbci/passports/rdh/SelectSizEntryDialog.java +++ b/src/de/willuhn/jameica/hbci/passports/rdh/SelectSizEntryDialog.java @@ -73,8 +73,7 @@ public void handleAction(Object context) throws ApplicationException { if (context == null || !(context instanceof Entry)) return; - Entry e = (Entry) context; - selected = e; + selected = (Entry) context; close(); } }); @@ -92,8 +91,7 @@ public void handleAction(Object context) throws ApplicationException if (o == null || !(o instanceof Entry)) return; - Entry e = (Entry) context; - selected = e; + selected = (Entry) context; close(); } },null,false,"ok.png"); diff --git a/src/de/willuhn/jameica/hbci/server/UmsatzTypImpl.java b/src/de/willuhn/jameica/hbci/server/UmsatzTypImpl.java index 577e16cb1..2e403ed98 100644 --- a/src/de/willuhn/jameica/hbci/server/UmsatzTypImpl.java +++ b/src/de/willuhn/jameica/hbci/server/UmsatzTypImpl.java @@ -497,8 +497,7 @@ public Object getAttribute(String arg0) throws RemoteException return null; try { - Integer i = new Integer(n); - return i; + return new Integer(n); } catch (Exception e) { diff --git a/src/de/willuhn/jameica/hbci/server/VersionUtil.java b/src/de/willuhn/jameica/hbci/server/VersionUtil.java index 86d90e32b..5470c3f5e 100644 --- a/src/de/willuhn/jameica/hbci/server/VersionUtil.java +++ b/src/de/willuhn/jameica/hbci/server/VersionUtil.java @@ -84,7 +84,6 @@ public static int delete(HBCIDBService service, String name) throws RemoteExcept if (name == null || name.length() == 0) throw new RemoteException("no name given"); - int i = service.executeUpdate("delete from version where name = ?",name); - return i; + return service.executeUpdate("delete from version where name = ?",name); } }