List of usage examples for java.lang SecurityException printStackTrace
public void printStackTrace()
From source file:com.ecyrd.management.SimpleMBean.java
/** * Gets an attribute using reflection from the MBean. * /*from ww w .j a v a 2 s . c om*/ * @param name Name of the attribute to find. * @return The value returned by the corresponding getXXX() call * @throws AttributeNotFoundException If there is not such attribute * @throws MBeanException * @throws ReflectionException */ public Object getAttribute(String name) throws AttributeNotFoundException, MBeanException, ReflectionException { Method m; Object res = null; try { String mname = "get" + StringUtils.capitalize(name); m = findGetterSetter(getClass(), mname, null); if (m == null) throw new AttributeNotFoundException(name); res = m.invoke(this, (Object[]) null); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } return res; }
From source file:com.google.android.gms.location.sample.locationupdatespendingintent.MainActivity.java
/** * Handles the Request Updates button and requests start of location updates. *//* w w w . j a va 2s . c o m*/ public void requestLocationUpdates(View view) { try { Log.i(TAG, "Starting location updates"); Utils.setRequestingLocationUpdates(this, true); LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, getPendingIntent()); } catch (SecurityException e) { Utils.setRequestingLocationUpdates(this, false); e.printStackTrace(); } }
From source file:org.mitre.eren.action.ActionManager.java
public ActionManager(String[] args) { // parse the arguments int serverPort = 3737; String endpoint = "http://erenbus.mitre.org:3732/"; Abdera abdera = Abdera.getInstance(); factory = abdera.getFactory();/* w w w . j a v a 2 s . c o m*/ factory.registerExtension(new ActionExtensionFactory()); log.info("finished factory configuration"); try { Options options = new Options(); options.addOption("p", "port", true, "Server port to listen on for incoming HTTP messages from the bus"); options.addOption("u", "url", true, "Outbound URL to post HTTP messages to"); options.addOption("l", "log", true, "Path to logfiles"); options.addOption("f", "file", true, "location of action file to parse"); options.addOption("c", "class", true, "this is ignored"); options.addOption("h", "help", false, "Prints this help message"); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args, true); if (cmd.hasOption("h")) { HelpFormatter hf = new HelpFormatter(); hf.printHelp("ERENAction.jar", options); System.exit(1); } if (cmd.hasOption("p")) { serverPort = Integer.parseInt(cmd.getOptionValue("p")); } if (cmd.hasOption("u")) { endpoint = cmd.getOptionValue("u"); } if (cmd.hasOption("l")) { String logfile = cmd.getOptionValue("l"); FileHandler fh; try { fh = new FileHandler(logfile + "action%g.log", 10000000, 5); log.addHandler(fh); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (cmd.hasOption("f")) { String fileName = cmd.getOptionValue("f"); actionFile = readActionFile(fileName); } } catch (ParseException e) { // TODO Auto-generated catch block log.log(Level.WARNING, "Caught Exception", e); } catch (FileNotFoundException fnf) { log.log(Level.SEVERE, "Couldn't read ActionFile", fnf); fnf.printStackTrace(); } // Start the server messageProcessor = new InboundActionHttpController(this); // InboundHttpEndpoint server = new InboundHttpEndpoint(serverPort, new InboundMessageHandler(messageProcessor)); // Thread st = new Thread(server, "EREN HTTP Inbound Endpoint"); // //st.setDaemon(true); // st.start(); // client = new OutboundHttpEndpoint(endpoint); // client.registerExtension(new EDXLRMExtensionFactory()); // client.registerExtension(new StartupExtensionFactory()); if (actionFile != null) { log.log(Level.INFO, actionFile.toString()); } }
From source file:org.openhie.openempi.loader.configuration.ConfigurableFileLoader.java
private void processField(String fieldName, String stringValue, String formatString, Class personClass, Object personInstance) {/*www . ja v a 2s . c o m*/ if (fieldName.length() == 0) return; if (personClass == Person.class && fieldName.equals("idSequence")) { idSeq = stringValue; return; } String setMethodName = ConvertUtil.getSetMethodName(fieldName); Class[] paramTypes = new Class[1]; Field field = null; try { field = personClass.getDeclaredField(fieldName); } catch (SecurityException e1) { e1.printStackTrace(); } catch (NoSuchFieldException e1) { e1.printStackTrace(); } Object value = null; Date dateValue = null; Race raceValue = null; Gender genderValue = null; Class paramClass = field.getType(); if (paramClass == String.class) { value = stringValue; } else if (paramClass == Date.class) { SimpleDateFormat format = new SimpleDateFormat(formatString); try { dateValue = format.parse(stringValue); } catch (ParseException e) { e.printStackTrace(); } value = dateValue; } else if (paramClass == Race.class) { raceValue = findRaceByName(stringValue); value = raceValue; } else if (paramClass == Gender.class) { genderValue = findGenderByCode(stringValue); value = genderValue; } if (value == null) return; paramTypes[0] = paramClass; Method setMethod = null; try { setMethod = personClass.getDeclaredMethod(setMethodName, paramTypes); Object[] params = new Object[1]; params[0] = value; try { setMethod.invoke(personInstance, params); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e2) { e2.printStackTrace(); } catch (InvocationTargetException e3) { e3.printStackTrace(); } } catch (NoSuchMethodException e) { e.printStackTrace(); } }
From source file:org.example.xwalkembedded.LocationActivity.java
@Override protected void onStop() { super.onStop(); try {// ww w. j a va2 s . co m mLocationManager.removeUpdates(listener); } catch (SecurityException e) { e.printStackTrace(); } }
From source file:org.example.xwalkembedded.LocationActivity.java
@Override protected void onResume() { super.onResume(); setup();/*from ww w .ja v a 2 s . co m*/ try { mLocationManager.requestLocationUpdates("gps", TEN_SECONDS, TEN_METERS, listener); mLocationManager.requestLocationUpdates("network", TEN_SECONDS, TEN_METERS, listener); } catch (SecurityException e) { e.printStackTrace(); } }
From source file:org.example.xwalkembedded.LocationActivity.java
/** * Method to register location updates with a desired location provider. If the requested * provider is not available on the device, the app displays a Toast with a message referenced * by a resource id./*w ww.j a va 2 s .c om*/ * * @param provider Name of the requested provider. * @param errorResId Resource id for the string message to be displayed if the provider does * not exist on the device. * @return A previously returned {@link Location} from the requested provider, * if exists. */ private Location requestUpdatesFromProvider(final String provider, final int errorResId) { Location location = null; if (mLocationManager.isProviderEnabled(provider)) { Log.d("fujunwei", "=====enable " + provider); try { mLocationManager.requestLocationUpdates(provider, TEN_SECONDS, TEN_METERS, listener); location = mLocationManager.getLastKnownLocation(provider); } catch (SecurityException e) { e.printStackTrace(); } } else { Toast.makeText(this, errorResId, Toast.LENGTH_LONG).show(); } return location; }
From source file:tools.vlc.VLCControlTelnet.java
/** * Start VLC with the telnet interface opened. * //from ww w .ja va 2 s . c o m */ public void openVLC() { try { System.out.println("Starting VLC..."); // String befehl = "--intf qt --extraintf Telnet";//start vlc with // telnet port 4212 open String os = System.getProperty("os.name").toLowerCase(); if (os.startsWith("windows")) { String[] cmdarray = { VLC_PATH + "vlc.exe", "--intf", "qt", "--extraintf", "Telnet" }; Runtime.getRuntime().exec(cmdarray); } else { List<String> command = new ArrayList<String>(); command.add("vlc"); command.add("--intf"); command.add("qt"); command.add("--extraintf"); command.add("Telnet"); // ProcessBuilder pbtest = new ProcessBuilder(pfad); ProcessBuilder pb = new ProcessBuilder(command); pb.start(); } /* * InputStream errors = process.getErrorStream(); BufferedReader * bufferedReader = new BufferedReader(new * InputStreamReader(errors)); String line = null; while ((line = * bufferedReader.readLine()) != null) { System.out.println(line); } * bufferedReader.close(); errors.close(); */ } catch (IOException io) { System.out.println("Error while starting VLC!"); JOptionPane.showMessageDialog(null, "Error while starting VLC. If you use Windows please make sure that the path to the vlc.exe is right!"); io.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } }
From source file:org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.java
/** * Trying to resolve keyStorePath if it's not defined * according to the DEFAULT_KEYSTORE_TRUSTSTORE * * on NX environment it may look like:// ww w . j ava 2s.c o m * /home/mpastern/.ovirtsdk/ovirtsdk-keystore.truststore * * @return keyStorePath or original this.keyStorePath content */ private String resolveKeyStorePath() { if (this.keyStorePath == null) { String keyStorePathCandidate = System.getProperty("user.home") + File.separator + ".ovirtsdk" + File.separator + DEFAULT_KEYSTORE_TRUSTSTORE; try { if (new File(keyStorePathCandidate).exists()) { return keyStorePathCandidate; } } catch (SecurityException ex) { ex.printStackTrace(); // TODO: log error when exposed logger } } return this.keyStorePath; }