/** * The actual printStackTrace() implementation. * * @param str the message to print. * @param t the throwable to print a stack trace for. */ private void printStackTrace0(final String str, final Throwable t) { System.err.println("## DEBUG: " + str); t.printStackTrace(); if (t instanceof BundleException) { final Throwable n = ((BundleException)t).getNestedException(); if (n != null) { System.err.println("Nested bundle exception:"); n.printStackTrace(); } } }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
protected void doLog(ServiceReference sr, int level, String msg, Throwable throwable) { String s = (sr == null) ? null : "SvcRef " + sr; s = (s == null) ? msg : s + " " + msg; s = (throwable == null) ? s : s + " (" + throwable + ")"; switch (level) { case LOG_DEBUG: System.out.println("DEBUG: " + s); break; case LOG_ERROR: System.out.println("ERROR: " + s); if (throwable != null) { if ((throwable instanceof BundleException) && (((BundleException) throwable).getNestedException() != null)) { throwable = ((BundleException) throwable).getNestedException(); } throwable.printStackTrace(); } break; case LOG_INFO: System.out.println("INFO: " + s); break; case LOG_WARNING: System.out.println("WARNING: " + s); break; default: System.out.println("UNKNOWN[" + level + "]: " + s); } }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
protected void doLogOut(int level, String s, Throwable throwable) { switch (level) { case LOG_DEBUG: System.out.println("DEBUG: " + s); break; case LOG_ERROR: System.out.println("ERROR: " + s); if (throwable != null) { if ((throwable instanceof BundleException) && (((BundleException) throwable).getNestedException() != null)) { throwable = ((BundleException) throwable).getNestedException(); } throwable.printStackTrace(); } break; case LOG_INFO: System.out.println("INFO: " + s); break; case LOG_WARNING: System.out.println("WARNING: " + s); break; default: System.out.println("UNKNOWN[" + level + "]: " + s); } }
private Throwable getRoot(Throwable t) { Throwable root = null; if (t instanceof BundleException) root = ((BundleException) t).getNestedException(); if (t instanceof InvocationTargetException) root = ((InvocationTargetException) t).getTargetException(); // skip inner InvocationTargetExceptions and BundleExceptions if (root instanceof InvocationTargetException || root instanceof BundleException) { Throwable deeplyNested = getRoot(root); if (deeplyNested != null) // if we have something more specific, use it, otherwise keep what we have root = deeplyNested; } return root; }
protected Bundle install(String location, PrintWriter out, PrintWriter err) { try { return getBundleContext().installBundle(location, null); } catch (IllegalStateException ex) { err.println(ex.toString()); } catch (BundleException ex) { if (ex.getNestedException() != null) { err.println(ex.getNestedException().toString()); } else { err.println(ex.toString()); } } catch (Exception ex) { err.println(ex.toString()); } return null; }
@Descriptor("update bundle") public String update(@Descriptor("target bundle") Bundle bundle) { if (bundle == null) { return "Must specify a bundle."; } try { bundle.update(); return null; } catch (BundleException ex) { if (ex.getNestedException() != null) { return ex.getNestedException().toString(); } return ex.toString(); } catch (Exception ex) { return ex.toString(); } }
protected Bundle install(String location) { try { return getBundleContext().installBundle(location, null); } catch (BundleException ex) { if (ex.getNestedException() != null) { println(ex.getNestedException().toString()); } else { println(ex.toString()); } } catch (Exception ex) { println(ex.toString()); } return null; } }
protected Bundle install(String location) { try { return getBundleContext().installBundle(location, null); } catch (BundleException ex) { if (ex.getNestedException() != null) { println(ex.getNestedException().toString()); } else { println(ex.toString()); } } catch (Exception ex) { println(ex.toString()); } return null; } }
/** * Stops the system bundle */ private void stopSystemBundle() { try { framework.systemBundle.context.stop(); } catch (BundleException sbe) { if (Debug.DEBUG_STARTLEVEL) { Debug.println("SLL: Bundle suspend exception: " + sbe.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(sbe.getNestedException() == null ? sbe : sbe.getNestedException()); } framework.publishFrameworkEvent(FrameworkEvent.ERROR, framework.systemBundle, sbe); } framework.systemBundle.state = Bundle.RESOLVED; framework.publishBundleEvent(BundleEvent.STOPPED, framework.systemBundle); }
/** * Resume a bundle. * * @param bundle * Bundle to resume. */ protected void resumeBundle(AbstractBundle bundle) { if (bundle.isActive()) { // if bundle is active. return; } try { if (Debug.DEBUG_GENERAL) { Debug.println("Trying to resume bundle " + bundle); //$NON-NLS-1$ } bundle.resume(); } catch (BundleException be) { if (Debug.DEBUG_GENERAL) { Debug.println("Bundle resume exception: " + be.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(be.getNestedException() == null ? be : be.getNestedException()); } publishFrameworkEvent(FrameworkEvent.ERROR, bundle, be); } }
/** * Resume a bundle. * * @param bundle * Bundle to resume. */ protected void resumeBundle(AbstractBundle bundle) { if (bundle.isActive()) { // if bundle is active. return; } try { if (Debug.DEBUG_GENERAL) { Debug.println("Trying to resume bundle " + bundle); //$NON-NLS-1$ } bundle.resume(); } catch (BundleException be) { if (Debug.DEBUG_GENERAL) { Debug.println("Bundle resume exception: " + be.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(be.getNestedException() == null ? be : be.getNestedException()); } publishFrameworkEvent(FrameworkEvent.ERROR, bundle, be); } }
/** * Start the SystemBundle. * This method launches the framework. * */ protected void resume() { /* initialize the startlevel service */ framework.startLevelManager.initialize(); /* Load all installed bundles */ loadInstalledBundles(framework.startLevelManager.getInstalledBundles(framework.bundles, false)); /* Start the system bundle */ try { framework.systemBundle.state = Bundle.STARTING; framework.systemBundle.context.start(); framework.publishBundleEvent(BundleEvent.STARTING, framework.systemBundle); } catch (BundleException be) { if (Debug.DEBUG_STARTLEVEL) { Debug.println("SLL: Bundle resume exception: " + be.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(be.getNestedException() == null ? be : be.getNestedException()); } framework.publishFrameworkEvent(FrameworkEvent.ERROR, framework.systemBundle, be); throw new RuntimeException(be.getMessage(), be); } }
/** * Start the SystemBundle. * This method launches the framework. * */ protected void resume() { /* initialize the startlevel service */ framework.startLevelManager.initialize(); /* Load all installed bundles */ loadInstalledBundles(framework.startLevelManager.getInstalledBundles(framework.bundles, false)); /* Start the system bundle */ try { framework.systemBundle.state = Bundle.STARTING; framework.systemBundle.context.start(); framework.publishBundleEvent(BundleEvent.STARTING, framework.systemBundle); } catch (BundleException be) { if (Debug.DEBUG_STARTLEVEL) { Debug.println("SLL: Bundle resume exception: " + be.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(be.getNestedException() == null ? be : be.getNestedException()); } framework.publishFrameworkEvent(FrameworkEvent.ERROR, framework.systemBundle, be); throw new RuntimeException(be.getMessage(), be); } }