Skip to content

Commit

Permalink
Try/Catch Handling angepasst (#112)
Browse files Browse the repository at this point in the history
* Try/Catch Handling angepasst

Try/Catch Handling entsprechend dem Kommentar von willuhn aus Pull request #104 commit d8cebbf angepasst

* Und wieder import java.rmi.RemoteException entfernt
  • Loading branch information
JohannMaierhofer authored Jan 22, 2024
1 parent fbae72a commit 3b891c4
Showing 1 changed file with 44 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package de.jost_net.JVerein.gui.action;

import java.rmi.RemoteException;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.control.BuchungsControl;
import de.jost_net.JVerein.gui.dialogs.MitgliedskontoAuswahlDialog;
Expand Down Expand Up @@ -76,71 +74,62 @@ public void handleAction(Object context) throws ApplicationException
{
return;
}
try
MitgliedskontoAuswahlDialog mkaz = new MitgliedskontoAuswahlDialog(b[0]);
Object open = mkaz.open();
Mitgliedskonto mk = null;

if (!mkaz.getAbort())
{
MitgliedskontoAuswahlDialog mkaz = new MitgliedskontoAuswahlDialog(b[0]);
Object open = mkaz.open();
Mitgliedskonto mk = null;

if (!mkaz.getAbort())
if (open instanceof Mitgliedskonto)
{
if (open instanceof Mitgliedskonto)
{
mk = (Mitgliedskonto) open;
}
else if (open instanceof Mitglied)
{
Mitglied m = (Mitglied) open;
mk = (Mitgliedskonto) Einstellungen.getDBService().createObject(
Mitgliedskonto.class, null);

Double betrag = 0d;
for (Buchung buchung : b)
{
betrag += buchung.getBetrag();
}

mk.setBetrag(betrag);
mk.setDatum(b[0].getDatum());
mk.setMitglied(m);
mk.setZahlungsweg(Zahlungsweg.ÜBERWEISUNG);
mk.setZweck1(b[0].getZweck());
mk.store();
}
mk = (Mitgliedskonto) open;
}
else if (open instanceof Mitglied)
{
Mitglied m = (Mitglied) open;
mk = (Mitgliedskonto) Einstellungen.getDBService().createObject(
Mitgliedskonto.class, null);

Double betrag = 0d;
for (Buchung buchung : b)
{
buchung.setMitgliedskonto(mk);
buchung.store();
}
control.getBuchungsList();

if (mk == null)
{
GUI.getStatusBar().setSuccessText("Mitgliedskonto gelöscht");
}
else
{
GUI.getStatusBar().setSuccessText("Mitgliedskonto zugeordnet");
betrag += buchung.getBetrag();
}

mk.setBetrag(betrag);
mk.setDatum(b[0].getDatum());
mk.setMitglied(m);
mk.setZahlungsweg(Zahlungsweg.ÜBERWEISUNG);
mk.setZweck1(b[0].getZweck());
mk.store();
}
}
catch (Exception e)
{
if (!(e instanceof OperationCanceledException))

for (Buchung buchung : b)
{
Logger.error("Fehler", e);
GUI.getStatusBar().setErrorText(
"Fehler bei der Zuordnung des Mitgliedskontos");
buchung.setMitgliedskonto(mk);
buchung.store();
}
control.getBuchungsList();

if (mk == null)
{
GUI.getStatusBar().setSuccessText("Mitgliedskonto gelöscht");
}
else
{
GUI.getStatusBar().setSuccessText("Mitgliedskonto zugeordnet");
}
return;
}
}
catch (RemoteException e)
catch (OperationCanceledException oce)
{
throw oce;
}
catch (Exception e)
{
String fehler = "Fehler beim Speichern.";
GUI.getStatusBar().setErrorText(fehler);
Logger.error(fehler, e);
Logger.error("Fehler", e);
GUI.getStatusBar().setErrorText(
"Fehler bei der Zuordnung des Mitgliedskontos");
}
}
}

0 comments on commit 3b891c4

Please sign in to comment.