List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:com.novartis.opensource.yada.util.YADAUtils.java
/** * Uses java reflection to determine if {@code yadaReq} contains a plugin of {@code type} * @param type the plugin scope//from www. j a va 2 s . co m * @param yadaReq YADA request configuration * @return {@code true} if the current config references a loadable plugin class */ private static boolean hasPlugin(String type, YADARequest yadaReq) { //TODO use this method to short-circuit to plugin processing String[] plugin = yadaReq.getPlugin(); if (plugin == null || plugin.length == 0) { return false; } Class<?> pluginClass = null; Class<?> pluginInterface = null; try { pluginClass = plugin[0].indexOf(YADARequest.PLUGIN_PKG) > -1 ? Class.forName(plugin[0]) : Class.forName(YADARequest.PLUGIN_PKG + "." + plugin[0]); pluginInterface = Class.forName(YADARequest.PLUGIN_PKG + "." + type); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (pluginClass != null && pluginInterface != null && pluginInterface.isAssignableFrom(pluginClass)) // this checks plugin type { return true; } return false; }
From source file:com.likya.myra.jef.utils.JobQueueOperations.java
public static JobImpl transformJobTypeToImpl(AbstractJobType abstractJobType) { String handlerUri = abstractJobType.getHandlerURI(); Class<?> abstractClass; try {//from ww w . j a v a 2 s . co m // abstractClass = Class.forName("com.likya.myra.jef.jobs.ExecuteInShell"); abstractClass = Class.forName(handlerUri); } catch (ClassNotFoundException e) { e.printStackTrace(); return null; } // levelize the initial state according to trigger value Management management = abstractJobType.getManagement(); JobHelper.evaluateTriggerType(abstractJobType, false); // remove the difference between borned and planned time management.getTimeManagement().getJsPlannedTime() .setStartTime(management.getTimeManagement().getBornedPlannedTime().getStartTime()); management.getTimeManagement().getJsPlannedTime() .setStopTime(management.getTimeManagement().getBornedPlannedTime().getStopTime()); JobRuntimeInterface jobRuntimeInterface = new JobRuntimeProperties(); JobImpl jobImpl = null; try { jobImpl = (JobImpl) abstractClass .getDeclaredConstructor(new Class[] { AbstractJobType.class, JobRuntimeInterface.class }) .newInstance(abstractJobType, jobRuntimeInterface); jobImpl.getJobInfo(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } // switch (jobType) { // case JobCommandType.INT_BATCH_PROCESS: // jobImpl = new ExecuteInShell(simpleProperties, jobRuntimeInterface); // ((ExecuteInShell) jobImpl).setShell(true); // break; // case JobCommandType.INT_SYSTEM_COMMAND: // jobImpl = new ExecuteInShell(simpleProperties, jobRuntimeInterface); // ((ExecuteInShell) jobImpl).setShell(false); // break; // case JobCommandType.INT_REMOTE_SHELL: // jobImpl = new ExecuteInShell(simpleProperties, jobRuntimeInterface); // break; // // default: // break; // } return jobImpl; }
From source file:com.tuplejump.stargate.lucene.AnalyzerFactory.java
public static Analyzer getAnalyzer(String analyzerName) { try {/*w w w . j av a 2 s . c om*/ Analyzers analyzer = Analyzers.valueOf(analyzerName); switch (analyzer) { case SimpleAnalyzer: { return new SimpleAnalyzer(); } case StandardAnalyzer: { return new StandardAnalyzer(); } case StopAnalyzer: { return new StopAnalyzer(); } case WhitespaceAnalyzer: { return new WhitespaceAnalyzer(); } case KeywordAnalyzer: { return new CaseInsensitiveKeywordAnalyzer(); } default: { return new StandardAnalyzer(); } } } catch (IllegalArgumentException e) { try { Class clazz = ClassUtils.getClass(analyzerName); return (Analyzer) clazz.newInstance(); } catch (ClassNotFoundException e1) { throw new IllegalArgumentException("No analyzer class found with name [" + analyzerName + "]"); } catch (InstantiationException e1) { throw new IllegalArgumentException("Could not construct an object of analyzer class with name [" + analyzerName + "]. " + "Unable to find no-args constructor"); } catch (IllegalAccessException e1) { e1.printStackTrace(); } } return null; }
From source file:com.airbop.library.simple.AirBopGCMIntentService.java
private static void generateNotification(Context context, String title, String message, String url, String large_icon) {// w ww.j a v a 2 s . co m //int icon = R.drawable.ic_stat_gcm; AirBopManifestSettings airBop_settings = CommonUtilities.loadDataFromManifest(context); int icon = airBop_settings.mNotificationIcon; long when = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); //if ((title == null) || (title.equals(""))) { if (title == null) { title = airBop_settings.mDefaultNotificationTitle; } Intent notificationIntent = null; if ((url == null) || (url.equals(""))) { //just bring up the app if (context != null) { ClassLoader class_loader = context.getClassLoader(); if (class_loader != null) { try { if (airBop_settings.mDefaultNotificationClass != null) { notificationIntent = new Intent(context, Class.forName(airBop_settings.mDefaultNotificationClass)); } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); //notificationIntent = new Intent(Intent.ACTION_VIEW); } } } } else { //Launch the URL notificationIntent = new Intent(Intent.ACTION_VIEW); notificationIntent.setData(Uri.parse(url)); notificationIntent.addCategory(Intent.CATEGORY_BROWSABLE); } PendingIntent intent = null; // set intent so it does not start a new activity if (notificationIntent != null) { notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent = PendingIntent.getActivity(context, 0, notificationIntent, 0); } Builder notificationBuilder = new NotificationCompat.Builder(context).setContentTitle(title) .setContentText(message).setLargeIcon(decodeImage(large_icon)).setWhen(when) .setStyle(new NotificationCompat.BigTextStyle().bigText(message)); if (intent != null) { notificationBuilder.setContentIntent(intent); } if (icon != 0) { notificationBuilder.setSmallIcon(icon); } Notification notification = notificationBuilder.build(); notification.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(0, notification); }
From source file:com.airbop.library.simple.AirBopGCMIntentService.java
private static void generateImageNotification(Context context, String title, String message, String url, String image_url, String large_icon) { // The bitmap to download Bitmap message_bitmap = null;/*from w w w . j ava 2s . c o m*/ // Should we download the image? if ((image_url != null) && (!image_url.equals(""))) { message_bitmap = AirBopImageDownloader.downloadBitmap(image_url, context); } // If we didn't get the image, we're out of here if (message_bitmap == null) { generateNotification(context, title, message, url, large_icon); return; } AirBopManifestSettings airBop_settings = CommonUtilities.loadDataFromManifest(context); int icon = airBop_settings.mNotificationIcon; long when = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); //if ((title == null) || (title.equals(""))) { if (title == null) { title = airBop_settings.mDefaultNotificationTitle; } Intent notificationIntent = null; if ((url == null) || (url.equals(""))) { //just bring up the app if (context != null) { ClassLoader class_loader = context.getClassLoader(); if (class_loader != null) { try { if (airBop_settings.mDefaultNotificationClass != null) { notificationIntent = new Intent(context, Class.forName(airBop_settings.mDefaultNotificationClass)); } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } else { //Launch the URL notificationIntent = new Intent(Intent.ACTION_VIEW); notificationIntent.setData(Uri.parse(url)); notificationIntent.addCategory(Intent.CATEGORY_BROWSABLE); } PendingIntent intent = null; // set intent so it does not start a new activity if (notificationIntent != null) { notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent = PendingIntent.getActivity(context, 0, notificationIntent, 0); } Builder notificationBuilder = new NotificationCompat.Builder(context).setContentTitle(title) .setContentText(message).setLargeIcon(decodeImage(large_icon)).setWhen(when) .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(message_bitmap)); if (intent != null) { notificationBuilder.setContentIntent(intent); } if (icon != 0) { notificationBuilder.setSmallIcon(icon); } Notification notification = notificationBuilder.build(); notification.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(0, notification); }
From source file:com.openteach.diamond.container.Container.java
@SuppressWarnings("unchecked") private static void initLifecycleListeners() { try {// w w w . j a v a 2s . co m Enumeration<URL> cUrls = Container.class.getClassLoader().getResources(DIAMOND_LIFECYCLE_FILE); while (cUrls.hasMoreElements()) { URL url = cUrls.nextElement(); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(url.openStream())); String line = null; while ((line = br.readLine()) != null) { try { Class clazz = Container.class.getClassLoader().loadClass(line.trim()); if (LifecycleListener.class.isAssignableFrom(clazz)) { lifecycleListeners.add((LifecycleListener) clazz.newInstance()); } } catch (ClassNotFoundException e) { System.err.println("?" + line); e.printStackTrace(); } //? break; } } catch (IOException e) { logger.error(e); } finally { if (null != br) { br.close(); } } } } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { System.err.println("?diamond! " + e.getMessage()); e.printStackTrace(); } }
From source file:org.peerfact.impl.service.aggregation.skyeye.visualization.SkyNetVisualization.java
private static void createLookAndFeel() { LookAndFeelInfo[] lfs = UIManager.getInstalledLookAndFeels(); boolean hasNimbus = false; boolean hasWindows = false; for (int i = 0; i < lfs.length; i++) { if (lfs[i].getClassName().equals("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel")) { hasNimbus = true;//from w w w.ja va 2 s . c o m } else if (lfs[i].getClassName().equals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")) { hasWindows = true; } } String lafName = null; if (hasNimbus) { lafName = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; } else if (hasWindows) { lafName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; } else { lafName = "javax.swing.plaf.metal.MetalLookAndFeel"; } try { UIManager.setLookAndFeel(lafName); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } }
From source file:me.piebridge.android.preference.PreferenceFragment.java
/** * return XmlPullParser//from www . j ava2s . c om * @param xml compiled XML encoded in base64 * @return XmlPullParser */ public static XmlPullParser getParser(String xml) { try { byte[] data = Base64.decode(xml, Base64.DEFAULT); // XmlBlock block = new XmlBlock(LAYOUT.getBytes("UTF-8")); Class<?> clazz = Class.forName("android.content.res.XmlBlock"); Constructor<?> constructor = clazz.getDeclaredConstructor(byte[].class); constructor.setAccessible(true); Object block = constructor.newInstance(data); // XmlPullParser parser = block.newParser(); Method method = clazz.getDeclaredMethod("newParser"); method.setAccessible(true); return (XmlPullParser) method.invoke(block); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return null; }
From source file:com.ngdata.hbaseindexer.indexer.SolrClientFactory.java
public static Sharder createSharder(Map<String, String> connectionParams, int numShards) throws SharderException { String sharderType = connectionParams.get(SolrConnectionParams.SHARDER_TYPE); if (sharderType == null || sharderType.equals("default")) { return new HashSharder(numShards); } else {/* w w w .ja v a 2 s .c om*/ try { return (Sharder) Class.forName(sharderType).getConstructor(Integer.TYPE).newInstance(numShards); } catch (ClassNotFoundException e) { throw new SharderException("failed to initialize sharder", e); } catch (InvocationTargetException e) { throw new SharderException("failed to initialize sharder", e); } catch (NoSuchMethodException e) { throw new SharderException("failed to initialize sharder", e); } catch (InstantiationException e) { throw new SharderException("failed to initialize sharder", e); } catch (IllegalAccessException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. throw new SharderException("failed to initialize sharder", e); } } }
From source file:org.cellprofiler.preferences.CellProfilerPreferences.java
/** * Get the preferences factory supplied by the JRE or * provided as a service./*from www . ja v a 2s . c o m*/ * * @return the default preferences factory. */ static private PreferencesFactory getJREPreferencesFactory() { synchronized (lock) { if (delegatePreferencesFactory == null) { do { /* * First, see if there is a PreferencesFactory * provided as a service. */ final ServiceLoader<PreferencesFactory> pfServiceLoader = ServiceLoader .loadInstalled(PreferencesFactory.class); final Iterator<PreferencesFactory> pfIter = pfServiceLoader.iterator(); if (pfIter.hasNext()) { delegatePreferencesFactory = pfIter.next(); break; } /* * Next, try the WindowsPreferencesFactory if OS is Windows. */ String pfName = (SystemUtils.IS_OS_WINDOWS) ? "java.util.prefs.WindowsPreferencesFactory" : "java.util.prefs.FilePreferencesFactory"; try { Class<?> pfClass = Class.forName("java.util.prefs.WindowsPreferencesFactory", false, null); Class<?> pfFuckYou = Class.forName("java.util.prefs.WindowsPreferences", true, null); Constructor<?>[] pfConstructors = pfClass.getDeclaredConstructors(); for (Constructor<?> c : pfConstructors) { if (c.getParameterTypes().length == 0) { /* * Bad boy - it's package-private AND I CALL IT ANYWAY BAH HA HA HA HA HA HA */ c.setAccessible(true); delegatePreferencesFactory = (PreferencesFactory) c.newInstance(new Object[0]); break; } } break; } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException 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(); } /* * And as a last resort, there's always our headless * preferences factory. */ delegatePreferencesFactory = new HeadlessPreferencesFactory(); } while (false); } } return delegatePreferencesFactory; }