List of usage examples for java.lang IllegalArgumentException printStackTrace
public void printStackTrace()
From source file:bammerbom.ultimatecore.bukkit.resources.utils.BossbarUtil.java
public static Object getHandle(World world) { Object nms_entity = null;/* w ww. j a v a 2s . c om*/ Method entity_getHandle = getMethod(world.getClass(), "getHandle"); try { nms_entity = entity_getHandle.invoke(world, new Object[0]); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return nms_entity; }
From source file:bammerbom.ultimatecore.bukkit.resources.utils.BossbarUtil.java
public static Object getHandle(Entity entity) { Object nms_entity = null;//from w ww .ja v a 2 s.c om Method entity_getHandle = getMethod(entity.getClass(), "getHandle"); try { nms_entity = entity_getHandle.invoke(entity, new Object[0]); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return nms_entity; }
From source file:org.jgentleframework.context.JGentle.java
/** * Builds the context./*from w w w .j a va 2 s .com*/ * * @param serviceHandler * the aoh * @param serviceProvider * the service provider * @param configurations * the configurations * @return the context */ protected static Context buildContext(ServiceHandler serviceHandler, boolean serviceProvider, Configurable... configurations) { List<Map<String, Object>> OLArray = new ArrayList<Map<String, Object>>(); ArrayList<Configurable> cfgInstanceList = new ArrayList<Configurable>(); for (Configurable config : configurations) { try { config.setDefinitionManager(serviceHandler.getDefinitionManager()); // Thc thi cc x l c ch nh bi ATC config.initAnnotationConfig(); cfgInstanceList.add(config); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } OLArray.add(config.getOptionsList()); } Context result = null; if (!serviceProvider) { result = new ProviderCoreCreator(serviceHandler, OLArray); } else { result = new ServiceProviderImpl(serviceHandler, OLArray); } ((Provider) result).setConfigInstances(cfgInstanceList); return result; }
From source file:bammerbom.ultimatecore.bukkit.resources.utils.BossbarUtil.java
public static FakeDragon newDragon(String message, Location loc) { FakeDragon fakeDragon = null;/*from w w w . ja va2 s .co m*/ try { fakeDragon = FakeDragon.class.getConstructor(new Class[] { String.class, Location.class }) .newInstance(new Object[] { message, loc }); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } return fakeDragon; }
From source file:org.apache.jackrabbit.oak.run.SegmentUtils.java
private static void diff(File dir, String interval, boolean incremental, File out, String filter, boolean ignoreSNFEs) throws IOException { System.out.println("Store " + dir); System.out.println("Writing diff to " + out); String[] tokens = interval.trim().split("\\.\\."); if (tokens.length != 2) { System.out.println("Error parsing revision interval '" + interval + "'."); return;// w w w .j a v a 2 s . c o m } ReadOnlyStore store = FileStore.builder(dir).withBlobStore(newBasicReadOnlyBlobStore()).buildReadOnly(); RecordId idL = null; RecordId idR = null; try { if (tokens[0].equalsIgnoreCase("head")) { idL = store.getHead().getRecordId(); } else { idL = fromString(store.getTracker(), tokens[0]); } if (tokens[1].equalsIgnoreCase("head")) { idR = store.getHead().getRecordId(); } else { idR = fromString(store.getTracker(), tokens[1]); } } catch (IllegalArgumentException ex) { System.out.println("Error parsing revision interval '" + interval + "': " + ex.getMessage()); ex.printStackTrace(); return; } long start = System.currentTimeMillis(); PrintWriter pw = new PrintWriter(out); try { if (incremental) { List<String> revs = readRevisions(dir); System.out.println("Generating diff between " + idL + " and " + idR + " incrementally. Found " + revs.size() + " revisions."); int s = revs.indexOf(idL.toString10()); int e = revs.indexOf(idR.toString10()); if (s == -1 || e == -1) { System.out.println("Unable to match input revisions with FileStore."); return; } List<String> revDiffs = revs.subList(Math.min(s, e), Math.max(s, e) + 1); if (s > e) { // reverse list revDiffs = reverse(revDiffs); } if (revDiffs.size() < 2) { System.out.println("Nothing to diff: " + revDiffs); return; } Iterator<String> revDiffsIt = revDiffs.iterator(); RecordId idLt = fromString(store.getTracker(), revDiffsIt.next()); while (revDiffsIt.hasNext()) { RecordId idRt = fromString(store.getTracker(), revDiffsIt.next()); boolean good = diff(store, idLt, idRt, filter, pw); idLt = idRt; if (!good && !ignoreSNFEs) { break; } } } else { System.out.println("Generating diff between " + idL + " and " + idR); diff(store, idL, idR, filter, pw); } } finally { pw.close(); } long dur = System.currentTimeMillis() - start; System.out.println("Finished in " + dur + " ms."); }
From source file:org.erdc.cobie.shared.COBieUtility.java
public static <T extends Enum<T>> List<String> getEnumLiteralsAsStringList(Class<T> enumClass) { ArrayList<String> names = null; try {//from w w w . j a va2s . c om T[] items = enumClass.getEnumConstants(); Method accessor = enumClass.getMethod("getDisplayValue"); names = new ArrayList<String>(items.length); for (T item : items) { names.add(accessor.invoke(item).toString()); } } catch (NoSuchMethodException ex) { } catch (InvocationTargetException ex) { } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return names; }
From source file:com.visva.voicerecorder.utils.Utils.java
public static long getDurationTimeFromFile(String filePath) { if (StringUtility.isEmpty(filePath)) { AIOLog.e(MyCallRecorderConstant.TAG, "filePath is null"); return 0; }//w ww. ja v a2s .co m File file = new File(filePath); if (file == null || !file.exists()) { Log.d("KieuThang", "file it not exitsted!"); } MediaPlayer mediaPlayer = new MediaPlayer(); long duration = 0L; try { mediaPlayer.setDataSource(filePath); mediaPlayer.prepare(); duration = mediaPlayer.getDuration(); mediaPlayer.reset(); mediaPlayer.release(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } //the valid time we offer to save at least more than 1s if (duration > 1000) { AIOLog.d(MyCallRecorderConstant.TAG, "InValid time:" + duration); return duration; } AIOLog.d(MyCallRecorderConstant.TAG, "Valid time:" + duration); return 0; }
From source file:org.apache.jackrabbit.oak.run.SegmentTarUtils.java
private static void diff(File dir, String interval, boolean incremental, File out, String filter, boolean ignoreSNFEs) throws IOException { System.out.println("Store " + dir); System.out.println("Writing diff to " + out); String[] tokens = interval.trim().split("\\.\\."); if (tokens.length != 2) { System.out.println("Error parsing revision interval '" + interval + "'."); return;/*from ww w . j ava 2 s .co m*/ } ReadOnlyStore store = fileStoreBuilder(dir).withBlobStore(newBasicReadOnlyBlobStore()).buildReadOnly(); RecordId idL = null; RecordId idR = null; try { if (tokens[0].equalsIgnoreCase("head")) { idL = store.getRevisions().getHead(); } else { idL = fromString(store, tokens[0]); } if (tokens[1].equalsIgnoreCase("head")) { idR = store.getRevisions().getHead(); } else { idR = fromString(store, tokens[1]); } } catch (IllegalArgumentException ex) { System.out.println("Error parsing revision interval '" + interval + "': " + ex.getMessage()); ex.printStackTrace(); return; } long start = System.currentTimeMillis(); PrintWriter pw = new PrintWriter(out); try { if (incremental) { List<String> revs = readRevisions(dir); System.out.println("Generating diff between " + idL + " and " + idR + " incrementally. Found " + revs.size() + " revisions."); int s = revs.indexOf(idL.toString10()); int e = revs.indexOf(idR.toString10()); if (s == -1 || e == -1) { System.out.println("Unable to match input revisions with FileStore."); return; } List<String> revDiffs = revs.subList(Math.min(s, e), Math.max(s, e) + 1); if (s > e) { // reverse list revDiffs = reverse(revDiffs); } if (revDiffs.size() < 2) { System.out.println("Nothing to diff: " + revDiffs); return; } Iterator<String> revDiffsIt = revDiffs.iterator(); RecordId idLt = fromString(store, revDiffsIt.next()); while (revDiffsIt.hasNext()) { RecordId idRt = fromString(store, revDiffsIt.next()); boolean good = diff(store, idLt, idRt, filter, pw); idLt = idRt; if (!good && !ignoreSNFEs) { break; } } } else { System.out.println("Generating diff between " + idL + " and " + idR); diff(store, idL, idR, filter, pw); } } finally { pw.close(); } long dur = System.currentTimeMillis() - start; System.out.println("Finished in " + dur + " ms."); }
From source file:com.helpinput.utils.Utils.java
@SuppressWarnings("unchecked") public static <T> T getFieldValue(Object target, Field theField) { if (theField != null) { accessible(theField);//from www .j av a 2 s . co m try { return (T) theField.get(target); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } return null; }
From source file:com.helpinput.core.Utils.java
@SuppressWarnings("unchecked") public static <T> T getFieldValue(Object target, Field theField) { if (theField != null) { setAccess(theField);/* www . j a v a 2 s . c o m*/ try { return (T) theField.get(target); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } return null; }