Skip to content

Commit

Permalink
DRY: inline redundant local variable
Browse files Browse the repository at this point in the history
Entfernt doppelt erzeugte Referenzen auf ein identisches Objekt.
  • Loading branch information
ruderphilipp committed Jan 23, 2022
1 parent d83e351 commit 6e4e0f2
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 21 deletions.
7 changes: 3 additions & 4 deletions src/de/willuhn/jameica/hbci/gui/input/AddressInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"));
}
Expand Down
3 changes: 1 addition & 2 deletions src/de/willuhn/jameica/hbci/io/AbstractSepaExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
Expand All @@ -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");
Expand Down
3 changes: 1 addition & 2 deletions src/de/willuhn/jameica/hbci/server/UmsatzTypImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 1 addition & 2 deletions src/de/willuhn/jameica/hbci/server/VersionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 6e4e0f2

Please sign in to comment.