List of usage examples for java.lang SecurityException printStackTrace
public void printStackTrace(PrintStream s)
From source file:com.alvermont.javascript.tools.shell.ShellMain.java
/** * ShellMain entry point.//from w w w .j a v a 2s. c o m * * Process arguments as would a normal Java program. Also * create a new Context and associate it with the current thread. * Then set up the execution environment and begin to * execute scripts. */ public static void main(String[] args) { try { if (Boolean.getBoolean("rhino.use_java_policy_security")) { initJavaPolicySecuritySupport(); } } catch (SecurityException ex) { ex.printStackTrace(System.err); } final int result = exec(args); if (result != 0) { System.exit(result); } }
From source file:volumesculptor.shell.Main.java
/** * Main entry point./*www. j ava 2s. co m*/ * <p/> * Process arguments as would a normal Java program. Also * create a new Context and associate it with the current thread. * Then set up the execution environment and begin to * execute scripts. */ public static void main(String args[]) { try { printf("Initializing Java security model"); initJavaPolicySecuritySupport(); } catch (SecurityException ex) { ex.printStackTrace(System.err); } int result = exec(args); if (result != 0) { System.out.println("main. Not calling exit"); //System.exit(result); } }
From source file:com.moneydance.modules.features.importlist.util.Helper.java
public static void loadLoggerConfiguration() { try {/*from w ww . j av a2 s .c om*/ InputStream inputStream = getInputStreamFromResource( Helper.INSTANCE.getSettings().getLoggingPropertiesResource()); LogManager.getLogManager().readConfiguration(inputStream); } catch (SecurityException e) { e.printStackTrace(System.err); } catch (IOException e) { e.printStackTrace(System.err); } }
From source file:hudson.plugins.testlink.util.TestLinkHelper.java
/** * Maybe adds a system property if it is in format <key>=<value>. * /*from w ww. j av a 2 s .c om*/ * @param systemProperty System property entry in format <key>=<value>. * @param listener Jenkins Build listener */ public static void maybeAddSystemProperty(String systemProperty, BuildListener listener) { final StringTokenizer tokenizer = new StringTokenizer(systemProperty, "=:"); if (tokenizer.countTokens() == 2) { final String key = tokenizer.nextToken(); final String value = tokenizer.nextToken(); if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) { if (key.contains(BASIC_HTTP_PASSWORD)) { listener.getLogger().println(Messages.TestLinkBuilder_SettingSystemProperty(key, "********")); } else { listener.getLogger().println(Messages.TestLinkBuilder_SettingSystemProperty(key, value)); } try { System.setProperty(key, value); } catch (SecurityException se) { se.printStackTrace(listener.getLogger()); } } } }
From source file:jenkins.plugins.testopia.TestopiaBuilder.java
/** * Maybe adds a system property if it is in format <key>=<value>. * /*from ww w .j a va 2 s.c om*/ * @param systemProperty System property entry in format <key>=<value>. * @param listener Jenkins Build listener */ public static void maybeAddSystemProperty(String systemProperty, BuildListener listener) { final StringTokenizer tokenizer = new StringTokenizer(systemProperty, "=:"); if (tokenizer.countTokens() == 2) { final String key = tokenizer.nextToken(); final String value = tokenizer.nextToken(); if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) { if (key.contains(BASIC_HTTP_PASSWORD)) { listener.getLogger().println(Messages.Testopia_Builder_Password(key)); } else { listener.getLogger().println(Messages.Testopia_Builder_Setting(key, value)); } try { System.setProperty(key, value); } catch (SecurityException se) { se.printStackTrace(listener.getLogger()); } } } }
From source file:uk.ac.ucl.excites.sapelli.shared.io.FileHelpers.java
/** * @param file/*from w w w .j a v a 2 s .c o m*/ * @return true if the file object is not null and represents an existing, readable file, false otherwise */ static public boolean isReadableFile(File file) { try { return file != null && file.exists() && file.isFile() && file.canRead(); } catch (SecurityException se) { se.printStackTrace(System.err); return false; } }
From source file:uk.ac.ucl.excites.sapelli.shared.io.FileHelpers.java
/** * @param file//from w w w . ja v a 2 s. com * @return true if the file object is not null and represents an existing, read/writable directory, false otherwise */ static public boolean isReadableWritableDirectory(File directory) { try { return directory != null && directory.exists() && directory.isDirectory() && directory.canRead() && directory.canWrite(); } catch (SecurityException se) { se.printStackTrace(System.err); return false; } }
From source file:uk.ac.ucl.excites.sapelli.shared.io.FileHelpers.java
/** * Attempts to create the necessary (containing) directory/ies for a given path * /*w ww . j av a 2 s . c om*/ * @param directory * @return success, i.e. whether the directory exists now (as a directory, *not* as a file), or existed already */ public static boolean createDirectory(File directory) { if (directory == null) return false; try { if (!directory.exists()) return directory.mkdirs(); return directory.isDirectory(); } catch (SecurityException se) { se.printStackTrace(System.err); return false; } }
From source file:MailHandlerDemo.java
/** * Gets a formatting string describing the given handler. * * @param prefix the output prefix./*ww w. j a v a2 s . c o m*/ * @param err the error stream. * @param h the handler. * @return the formatted string. */ private static String toString(String prefix, PrintStream err, Handler h) { StringBuilder buf = new StringBuilder(); buf.append(h.getClass().getName()); try { if (h instanceof MailHandler) { MailHandler mh = (MailHandler) h; buf.append(", ").append(mh.getSubject()); } } catch (SecurityException error) { err.print(prefix + ": "); error.printStackTrace(err); } try { buf.append(", ").append(h.getFormatter()); } catch (SecurityException error) { err.print(prefix + ": "); error.printStackTrace(err); } try { if (h instanceof MailHandler) { MailHandler mh = (MailHandler) h; buf.append(", ").append(Arrays.toString(mh.getAttachmentFormatters())); } } catch (SecurityException error) { err.print(prefix + ": "); error.printStackTrace(err); } try { buf.append(", ").append(h.getLevel()); } catch (SecurityException error) { err.print(prefix + ": "); error.printStackTrace(err); } try { buf.append(", ").append(h.getFilter()); } catch (SecurityException error) { err.print(prefix + ": "); error.printStackTrace(err); } try { buf.append(", ").append(h.getErrorManager()); } catch (SecurityException error) { err.print(prefix + ": "); error.printStackTrace(err); } buf.append(", ").append(toString(h.getClass().getClassLoader())); return buf.toString(); }
From source file:org.vle.aid.medline.DownloadMedline.java
private void download(int i, File targetDir) { File targetFile = new File(targetDir, mServerFileNames[i]); OutputStream out = null;//from ww w. ja v a2s. c o m BufferedOutputStream bufOut = null; try { out = new FileOutputStream(targetFile); bufOut = new BufferedOutputStream(out); mFTPClient.retrieveFile(mServerFileNames[i], bufOut); } catch (SocketException e) { System.out.println("SocketException=" + e); System.out.println(); System.out.println("Reconnecting to server."); reconnectFTPClient(); printLastReply("Server reply from Retrieve file=" + mServerFileNames[i]); } catch (IOException e) { // includes connection closed exception printLastReply("Server reply from Retrieve file=" + mServerFileNames[i]); System.out.println("Download IOException. Stack trace follows."); e.printStackTrace(System.out); try { targetFile.delete(); } catch (SecurityException e2) { System.out.println("Could not remove file=" + targetFile); System.out.println("Security exception. Stack trace follows."); e2.printStackTrace(System.out); } } finally { Streams.closeOutputStream(bufOut); Streams.closeOutputStream(out); } }