Skip to content

Commit

Permalink
@C Wenn ein Plugin inkompatibel zu Jameica ist, laesst es sich
Browse files Browse the repository at this point in the history
jetzt wenigstens noch ueber den Plugin-Manager auf eine aktuelle Version
updaten. Bisher hing sich Jameica da komplett auf.
  • Loading branch information
willuhn committed Aug 9, 2012
1 parent 8063e55 commit c65522e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Expand Up @@ -100,6 +100,8 @@ public void paint(Composite parent) throws RemoteException

// Rechte Spalte mit den Eigenschaften
{
Throwable error = Application.getPluginLoader().getInitError(manifest);

// Name
{
Label title = new Label(this.comp,SWT.NONE);
Expand All @@ -112,8 +114,7 @@ public void paint(Composite parent) throws RemoteException
title.setForeground(comment);

// Checken, ob wir eine Fehlermeldung haben
Throwable t = Application.getPluginLoader().getInitError(manifest);
text = i18n.tr("{0} ({1})",text, (t != null ? t.getMessage() : i18n.tr("Neustart erforderlich")));
text = i18n.tr("{0} ({1})",text, (error != null ? error.getMessage() : i18n.tr("Neustart erforderlich")));
}
title.setText(text);
}
Expand Down Expand Up @@ -171,7 +172,7 @@ public void widgetSelected(SelectionEvent e)

// Update und oeffnen gibt es nicht bei neuen Installationen
open.setEnabled(manifest.isInstalled());
update.setEnabled(manifest.isInstalled());
update.setEnabled(manifest.isInstalled() || error != null); // Update auch bei Fehler erlauben

// Checken, ob es installiert/deinstalliert werden kann
try
Expand Down
4 changes: 4 additions & 0 deletions src/de/willuhn/jameica/plugin/PluginLoader.java
Expand Up @@ -186,6 +186,10 @@ else if ((t instanceof OperationCanceledException))
else
Logger.error("unable to init plugin " + name, t);

// Das ist ein bisschen "best guess", um die Fehlermeldung bei inkompatiblen Plugins schoener aussehen zu lassen,
if (t instanceof NoSuchMethodError)
t = new ApplicationException(Application.getI18n().tr("Inkompatibel mit aktueller Jameica-Version"),t);

this.initErrors.put(mf,t);
if (!(t instanceof OperationCanceledException)) // nur anzeigen, wenn es kein Abbruch durch das Plugin selbst war
Application.addWelcomeMessage(Application.getI18n().tr("Plugin \"{0}\" kann nicht initialisiert werden. {1}",name, t.getMessage()));
Expand Down
6 changes: 3 additions & 3 deletions src/de/willuhn/jameica/services/BeanService.java
Expand Up @@ -161,10 +161,10 @@ else if (lct == Type.SESSION)
{
throw je;
}
catch (Exception e)
catch (Throwable t)
{
Logger.error("unable to create instance of " + type,e);
throw new JameicaException(Application.getI18n().tr("{0} kann nicht erstellt werden: {1}",type.getSimpleName(),e.getMessage()));
Logger.error("unable to create instance of " + type,t);
throw new JameicaException(Application.getI18n().tr("{0} kann nicht erstellt werden: {1}",type.getSimpleName(),t.getMessage()));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/de/willuhn/jameica/services/ReminderService.java
Expand Up @@ -206,9 +206,9 @@ public void run()
}
}
}
catch (Exception e)
catch (Throwable t)
{
Logger.error("unable to send reminder messages for provider " + provider.getClass().getName(),e);
Logger.error("unable to send reminder messages for provider " + provider.getClass().getName(),t);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/de/willuhn/jameica/services/SearchService.java
Expand Up @@ -64,9 +64,9 @@ public void init(BootLoader loader, Bootable caller) throws SkipServiceException
this.providers.add(p);
count++;
}
catch (Exception e)
catch (Throwable t)
{
Logger.error("unable to load search provider " + providers[i].getName(),e);
Logger.error("unable to load search provider " + providers[i].getName(),t);
}
}
Logger.info("loaded " + count + " search providers");
Expand Down

0 comments on commit c65522e

Please sign in to comment.