List of usage examples for java.lang IllegalArgumentException printStackTrace
public void printStackTrace()
From source file:eu.prestoprime.p4gui.connection.CommonConnection.java
public static USER_ROLE getUserRole(P4Service service) { String path = service.getURL() + "/checkrole"; try {// w w w . j a v a 2 s .co m P4HttpClient client = new P4HttpClient(service.getUserID()); HttpRequestBase request = new HttpGet(path); HttpResponse response = client.executeRequest(request); HttpEntity entity = response.getEntity(); BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent())); String line; if ((line = reader.readLine()) != null) { try { return USER_ROLE.valueOf(line); } catch (IllegalArgumentException e) { e.printStackTrace(); return USER_ROLE.guest; } } } catch (Exception e) { e.printStackTrace(); } return USER_ROLE.guest; }
From source file:org.alfresco.reporting.test.TestReporting.java
public static void processReport(String jndiName, String fromFile, String toFile) throws FileNotFoundException { System.out.println("Enter processReport"); ClassicEngineBoot.getInstance().start(); File outputFile = new File(toFile); FileOutputStream outputStream = new FileOutputStream(outputFile); System.out.println("processReport: Got the outputstream: " + outputStream); try {// w w w .java 2 s. c om generateReport(jndiName, OutputType.PDF, outputStream, fromFile); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (ReportProcessingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Exit processReport"); }
From source file:de.clusteval.data.randomizer.DataRandomizer.java
/** * Parses a dataconfig randomizer from string. * /*w w w . j ava 2 s . c o m*/ * @param repository * the repository * @param dataRandomizer * The simple name of the dataset randomizer class. * @return the clustering quality measure * @throws UnknownDataRandomizerException */ public static DataRandomizer parseFromString(final Repository repository, String dataRandomizer) throws UnknownDataRandomizerException { Class<? extends DataRandomizer> c = repository.getRegisteredClass(DataRandomizer.class, "de.clusteval.data.randomizer." + dataRandomizer); try { DataRandomizer generator = c.getConstructor(Repository.class, boolean.class, long.class, File.class) .newInstance(repository, false, System.currentTimeMillis(), new File(dataRandomizer)); return generator; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NullPointerException e) { } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (SecurityException e1) { e1.printStackTrace(); } catch (InvocationTargetException e1) { e1.printStackTrace(); } catch (NoSuchMethodException e1) { e1.printStackTrace(); } throw new UnknownDataRandomizerException("\"" + dataRandomizer + "\" is not a known data randomizer."); }
From source file:com.sample.common.util.CommonsUtil.java
/** * Metodo di utilita' per controllare che un'istanza di una classe abbia almeno un campo valorizzato * //from ww w . j a v a 2s .co m * @param instance * @return true se l'istanza ha almeno un campo valorizzato, false altrimenti */ public static <T> boolean isFilled(T instance) { boolean isFilled = false; if (instance != null) { Field[] fields = instance.getClass().getDeclaredFields(); for (Field field : fields) { if (field.getType().getCanonicalName().startsWith("java.lang")) { String getterMethodName = "get" + capitalize(field.getName()); Method method = findMethod(instance.getClass(), getterMethodName, new Class[] {}); if (method != null) { try { Object value = method.invoke(instance, new Object[] {}); if (field.getType().getSimpleName().equals("String")) { String valueStr = (String) value; if (value != null && valueStr.trim().length() > 0) { isFilled = true; break; } } else { if (value != null) { isFilled = true; break; } } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } } } return isFilled; }
From source file:de.clusteval.run.statistics.RunDataStatisticCalculator.java
/** * This method parses a string and maps it to a subclass of * {@link RunDataStatistic} looking it up in the given repository. * /*from w w w . j av a2s.c o m*/ * @param repository * The repository to look for the classes. * @param runDataStatistic * The string representation of a run data statistic subclass. * @return A subclass of {@link RunDataStatistic}. * @throws UnknownRunDataStatisticException */ public static RunDataStatistic parseFromString(final Repository repository, String runDataStatistic) throws UnknownRunDataStatisticException { Class<? extends RunDataStatistic> c = repository.getRegisteredClass(RunDataStatistic.class, "de.clusteval.run.statistics." + runDataStatistic); try { RunDataStatistic statistic = c.getConstructor(Repository.class, boolean.class, long.class, File.class) .newInstance(repository, true, System.currentTimeMillis(), new File(runDataStatistic)); return statistic; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NullPointerException e) { } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (SecurityException e1) { e1.printStackTrace(); } catch (InvocationTargetException e1) { e1.printStackTrace(); } catch (NoSuchMethodException e1) { e1.printStackTrace(); } throw new UnknownRunDataStatisticException( "\"" + runDataStatistic + "\" is not a known run data statistic."); }
From source file:com.camnter.easygank.views.PictureActivity.java
public static void startActivityByActivityOptionsCompat(Activity activity, String url, String title, View view) {//from ww w. ja va 2 s . co m Intent intent = createIntent(activity, url, title); ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat.makeScaleUpAnimation(view, view.getWidth() / 2, view.getHeight() / 2, view.getWidth(), view.getHeight()); try { ActivityCompat.startActivity(activity, intent, activityOptionsCompat.toBundle()); } catch (IllegalArgumentException e) { e.printStackTrace(); startActivity(activity, url, title); } }
From source file:it.sample.parser.util.CommonsUtil.java
/** * Metodo di utilita' per controllare che un'istanza di una classe abbia almeno un campo valorizzato * //from w w w . j av a 2 s .co m * @param instance * @return true se l'istanza ha almeno un campo valorizzato, false altrimenti */ public static <T> boolean isFilled(T instance) { boolean isFilled = false; Method[] methods = instance != null ? instance.getClass().getMethods() : new Method[] {}; for (Method method : methods) { if (isGetter(method)) { Class<?> returnType = method.getReturnType(); Object obj = null; try { obj = method.invoke(instance, new Object[] {}); if (obj != null && (returnType.getSimpleName().equals("String") && obj.toString().length() > 0)) { isFilled = true; break; } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } return isFilled; }
From source file:org.mskcc.cbio.portal.dao.DaoCnaEvent.java
public static List<CnaEvent.Event> getAllCnaEvents() throws DaoException { Connection con = null;//from w w w. j av a 2s .c o m PreparedStatement pstmt = null; ResultSet rs = null; try { con = JdbcUtil.getDbConnection(DaoCnaEvent.class); pstmt = con.prepareStatement("SELECT * FROM cna_event"); rs = pstmt.executeQuery(); List<CnaEvent.Event> events = new ArrayList<CnaEvent.Event>(); while (rs.next()) { try { CnaEvent.Event event = new CnaEvent.Event(); event.setEventId(rs.getLong("CNA_EVENT_ID")); event.setEntrezGeneId(rs.getLong("ENTREZ_GENE_ID")); event.setAlteration(rs.getShort("ALTERATION")); events.add(event); } catch (IllegalArgumentException e) { e.printStackTrace(); } } return events; } catch (SQLException e) { throw new DaoException(e); } finally { JdbcUtil.closeAll(DaoCnaEvent.class, con, pstmt, rs); } }
From source file:org.arkhamnetwork.playersync.utils.SerializationUtils.java
public static PotionEffect[] deserializePotionEffects(byte[] b) throws SerializationException, ParseException { if (b == null) { return null; }/*from w ww.java2 s . c om*/ Object o = JSONValue.parseWithException(new String(b)); try { if (o instanceof List) { final List<?> data = (List) o; ArrayList<PotionEffect> items = new ArrayList<>(data.size()); for (Object t : data) { if (t instanceof Map) { final Map<?, ?> mdata = (Map) t; final Map<String, Object> conv = new HashMap<>(mdata.size()); for (Map.Entry<?, ?> e : mdata.entrySet()) { conv.put(String.valueOf(e.getKey()), convert(e.getValue())); } items.add(new PotionEffect(conv)); } else { throw new IllegalArgumentException("Not a Map"); } } return items.toArray(new PotionEffect[items.size()]); } throw new IllegalArgumentException("Not a List"); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } return null; }
From source file:org.mskcc.cbio.portal.dao.DaoCnaEvent.java
public static List<CnaEvent> getCnaEvents(List<Integer> sampleIds, Collection<Long> entrezGeneIds, int profileId, Collection<Short> cnaLevels) throws DaoException { Connection con = null;//w w w . ja va 2 s . com PreparedStatement pstmt = null; ResultSet rs = null; try { con = JdbcUtil.getDbConnection(DaoCnaEvent.class); pstmt = con.prepareStatement("SELECT sample_cna_event.CNA_EVENT_ID, SAMPLE_ID, GENETIC_PROFILE_ID," + " ENTREZ_GENE_ID, ALTERATION FROM sample_cna_event, cna_event" + " WHERE `GENETIC_PROFILE_ID`=?" + " AND sample_cna_event.CNA_EVENT_ID=cna_event.CNA_EVENT_ID" + (entrezGeneIds == null ? "" : " AND ENTREZ_GENE_ID IN(" + StringUtils.join(entrezGeneIds, ",") + ")") + " AND ALTERATION IN (" + StringUtils.join(cnaLevels, ",") + ")" + " AND SAMPLE_ID in ('" + StringUtils.join(sampleIds, "','") + "')"); pstmt.setInt(1, profileId); rs = pstmt.executeQuery(); List<CnaEvent> events = new ArrayList<CnaEvent>(); while (rs.next()) { try { Sample sample = DaoSample.getSampleById(rs.getInt("SAMPLE_ID")); CnaEvent event = new CnaEvent(sample.getInternalId(), rs.getInt("GENETIC_PROFILE_ID"), rs.getLong("ENTREZ_GENE_ID"), rs.getShort("ALTERATION")); event.setEventId(rs.getLong("CNA_EVENT_ID")); events.add(event); } catch (IllegalArgumentException e) { e.printStackTrace(); } } return events; } catch (NullPointerException e) { throw new DaoException(e); } catch (SQLException e) { throw new DaoException(e); } finally { JdbcUtil.closeAll(DaoCnaEvent.class, con, pstmt, rs); } }