From 80133892f2340793abca26ee65f352a7899bbf98 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 ++--- .../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 +-- 6 files changed, 11 insertions(+), 19 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 1880ef46c..d04408d52 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 f9efdda53..960ad8a26 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/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 9405a772b..c15842469 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 = Integer.valueOf(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); } }