Example usage for java.lang RuntimeException printStackTrace

List of usage examples for java.lang RuntimeException printStackTrace

Introduction

In this page you can find the example usage for java.lang RuntimeException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.vaadin.tori.util.ToriScheduler.java

private void executeCommands(final Collection<ScheduledCommand> commands) {
    final Collection<ScheduledCommand> executableCommands = new ArrayList<ScheduledCommand>(commands);
    commands.clear();//from   w  w  w . java2s.  c  o  m

    for (ScheduledCommand command : executableCommands) {
        try {
            command.execute();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
}

From source file:br.com.brunogrossi.MediaScannerPlugin.MediaScannerPlugin.java

@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    try {//w  w  w  . j a v  a 2 s.  com
        if (action.equals("scanFile")) {
            String fileUri = args.optString(0);
            if (fileUri != null && !fileUri.equals("")) {
                Uri contentUri = Uri.parse(fileUri);

                Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
                mediaScanIntent.setData(contentUri);
                this.cordova.getActivity().sendBroadcast(mediaScanIntent);

                callbackContext.success();

                return true;
            } else {
                Log.w(TAG, "No action param provided: " + action);
                callbackContext.error("No action param provided: " + action);
                return false;
            }
        } else {
            Log.w(TAG, "Wrong action was provided: " + action);
            return false;
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
        callbackContext.error(e.getMessage());
        return false;
    }
}

From source file:com.phonegap.plugins.databasepath.DatabasePath.java

@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {

    try {/*  ww w .java2s . c o m*/
        if (action.equals("getDatabasePath")) {
            //String databasePath = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
            //String databasePath = this.cordova.getActivity().getDatabasePath("ClinidataPHR_DB").getAbsolutePath();
            String databasePath = "";
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                databasePath = "file:///data/data/" + webView.getContext().getPackageName()
                        + "/app_database/file__0/0000000000000001.db";
            } else {
                databasePath = "file:///data/data/" + webView.getContext().getPackageName()
                        + "/app_webview/databases/file__0/1";
            }
            callbackContext.success(databasePath);
            return true;
        }
    } catch (RuntimeException e) { // KLUDGE for Activity Not Found
        e.printStackTrace();
        callbackContext.error(e.getMessage());
    }
    return false;
}

From source file:org.jugvale.peoplemanagement.client.service.RESTPersonService.java

private void handle(java.lang.RuntimeException e, Consumer<String> onFail) {
    e.printStackTrace();
    onFail.accept("Error: " + e.getMessage() + "; Exception: " + e.getClass().getSimpleName());
}

From source file:de.micromata.genome.gwiki.page.impl.wiki.parser.WeditWikiUtilsTest.java

License:asdf

void testConvert(String html, String wiki) {
    GWikiTestBuilder tb = new GWikiTestBuilder();
    GWikiContext ctx = tb.createWikiContext();
    try {// w  w w . j  ava  2 s. c  o  m
        String ret = rteToWiki(ctx, html);
        System.out.println("html:\n" + html + "\nwiki:\n[" + ret + "]");
        if (StringUtils.equals(wiki, ret) == false) {
            System.out.println("expect wiki:\n[" + wiki + "]");
        }
        Assert.assertEquals(wiki, ret);
    } catch (RuntimeException ex) {
        ex.printStackTrace();
        throw ex;
    }
}

From source file:de.micromata.genome.gwiki.page.impl.wiki.parser.WeditWikiUtilsTest.java

License:asdf

@Test
public void test2() {
    String html = "<html><body><p>&nbsp;</p>\r\n" + "<div class=\"mceNonEditable weditmacroframe\">\r\n"
            + "<div class=\"mceNonEditable weditmacrohead\" data-macrohead=\"code:lang=java\" data-macroname=\"code\"><span class=\"weditmacrn\">code:lang=java</span></div>\r\n"
            + "<div class=\"mceEditable weditmacrobody editmacrobd_pre\" tabindex=\"-1\">\r\n"
            + "<pre>&nbsp;class X {\r\n" + "String foo()\r\n" + "{\r\n" + "  return \"asdf\";\r\n" + "}\r\n"
            + "}</pre>\r\n" + "</div>\r\n" + "</div>\r\n" + "<p>noch was:</p></body></html>";
    GWikiTestBuilder tb = new GWikiTestBuilder();
    GWikiContext ctx = tb.createWikiContext();
    try {/* w w  w .  j a v a 2 s .  c  o  m*/
        String ret = rteToWiki(ctx, html);
        System.out.println("wiki:\n" + ret);
    } catch (RuntimeException ex) {
        ex.printStackTrace();
        throw ex;
    }
}

From source file:com.dngames.mobilewebcam.PhotoSettings.java

public static int getEditInt(Context c, SharedPreferences prefs, String name, int d)
        throws NumberFormatException {
    int i = 0;/*from   w ww .  j a  v a 2 s .c o m*/
    try {
        i = getEditInt(prefs, name, d);
    } catch (NumberFormatException e) {
        String msg = e.toString();
        if (e.getMessage() != null)
            msg = e.getMessage();
        if (MobileWebCam.gIsRunning) {
            try {
                Toast.makeText(c, msg, Toast.LENGTH_LONG).show();
            } catch (RuntimeException er) {
                er.printStackTrace();
            }
        } else
            MobileWebCam.LogE(msg);
    }
    return i;
}

From source file:com.dngames.mobilewebcam.PhotoSettings.java

public static float getEditFloat(Context c, SharedPreferences prefs, String name, float d)
        throws NumberFormatException {
    float f = 0.0f;
    try {/*  ww w.j  a  v a 2  s . c  o m*/
        f = getEditFloat(prefs, name, d);
    } catch (NumberFormatException e) {
        String msg = e.toString();
        if (e.getMessage() != null)
            msg = e.getMessage();
        if (MobileWebCam.gIsRunning) {
            try {
                Toast.makeText(c, msg, Toast.LENGTH_LONG).show();
            } catch (RuntimeException er) {
                er.printStackTrace();
            }
        } else
            MobileWebCam.LogE(msg);
    }
    return f;
}

From source file:com.utest.webservice.auth.UtestWSS4JInInterceptor.java

@SuppressWarnings("unchecked")
@Override//from www  .j  a v a  2  s .co m
public void handleMessage(final SoapMessage message) throws Fault {
    try {
        super.handleMessage(message);
        final Vector<WSHandlerResult> result = (Vector<WSHandlerResult>) message
                .getContextualProperty(WSHandlerConstants.RECV_RESULTS);
        if ((result != null) && !result.isEmpty()) {
            for (final WSHandlerResult res : result) {
                // loop through security engine results
                for (final WSSecurityEngineResult securityResult : (Vector<WSSecurityEngineResult>) res
                        .getResults()) {
                    final int action = (Integer) securityResult.get(WSSecurityEngineResult.TAG_ACTION);
                    // determine if the action was a username token
                    if ((action & WSConstants.UT) > 0) {
                        // get the principal object
                        final WSUsernameTokenPrincipal principal = (WSUsernameTokenPrincipal) securityResult
                                .get(WSSecurityEngineResult.TAG_PRINCIPAL);
                        if (principal.getPassword() == null) {
                            principal.setPassword("");
                        }
                        Authentication authentication = new UsernamePasswordAuthenticationToken(
                                principal.getName(), principal.getPassword());
                        authentication = authenticationProvider.authenticate(authentication);
                        if (!authentication.isAuthenticated()) {
                            System.out.println("This user is not authentic.");
                        }
                        SecurityContextHolder.getContext().setAuthentication(authentication);
                    }
                }
            }
        }
    } catch (final RuntimeException ex) {
        ex.printStackTrace();
        throw ex;
    }
}

From source file:edu.upc.tutorial.jaxrs.android.data.LibraryResteasyClient.java

@Override
public List<Book> getBooks() {
    List<Book> result = new ArrayList<Book>();
    try {//from www. j  a  va  2s  .c o  m
        result = getLibraryClient().getBooks();
    } catch (RuntimeException ex) {
        ex.printStackTrace();
    }
    Log.i(LOG_TAG, "getBooks: " + result);
    return result;
}