List of usage examples for java.lang IllegalArgumentException printStackTrace
public void printStackTrace()
From source file:mtmo.test.mediadrm.MainActivity.java
private void setupDrmProcessButton(final int appMode) { final Button btnRegistration = (Button) findViewById(R.id.btn_registration); final Button btnSaveLicense = (Button) findViewById(R.id.btn_license); final Button btnDeregistration = (Button) findViewById(R.id.btn_deregistration); final Button btnCheckRights = (Button) findViewById(R.id.btn_check_rights); final Button btnRemoveRights = (Button) findViewById(R.id.btn_remove_rights); final Button btnStatus = (Button) findViewById(R.id.btn_check_regist); if (btnRegistration != null) { btnRegistration.setOnClickListener(new OnClickListener() { @Override/*from ww w. j a v a 2s. c om*/ public void onClick(View v) { mLogger.enter("requeseted registration..."); final TaskInfo taskInfo = new TaskInfo(TaskType.REGISTRATION, mAccountId, mServiceId, mCurrentATKNFilePath); mHandler.post(new TaskStarter(taskInfo)); } }); } if (btnSaveLicense != null) { btnSaveLicense.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mLogger.d("requeseted getting License..."); final TaskInfo taskInfo = new TaskInfo(TaskType.LICENSE, mAccountId, mServiceId, mCurrentATKNFilePath); mHandler.post(new TaskStarter(taskInfo)); } }); } if (btnDeregistration != null) { btnDeregistration.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mLogger.d("requeseted deregistration..."); final TaskInfo taskInfo = new TaskInfo(TaskType.DEREGISTRATION, mAccountId, mServiceId, mCurrentATKNFilePath); mHandler.post(new TaskStarter(taskInfo)); } }); } if (btnCheckRights != null) { btnCheckRights.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mLogger.d("requeseted check License..."); TextView log = (TextView) findViewById(R.id.log); byte[] sessionId = null; MediaDrm mediaDrm = null; byte[] contentData = null; log.setText(""); try { mediaDrm = new MediaDrm(Constants.MBB_UUID); sessionId = mediaDrm.openSession(); switch (appMode) { case Constants.APP_MODE_ABS: ABSContentInfo absContentInfo = getABSContentInfo(); contentData = Utils.readPsshDataFromFile(true); mediaDrm.restoreKeys(sessionId, InitData.getPSSHTableForAndroid(contentData, absContentInfo.getVideoKid())); break; case Constants.APP_MODE_OFFLINE: contentData = Utils.readIPMPDataFromFile(true); mediaDrm.restoreKeys(sessionId, InitData.getIPMPTableForAndroid(contentData)); break; default: Toast.makeText(mContext, "Unknown App Mode", Toast.LENGTH_SHORT).show(); return; } HashMap<String, String> infoMap = mediaDrm.queryKeyStatus(sessionId); if (infoMap != null && infoMap.size() > 0) { StringBuilder sb = new StringBuilder(); Iterator<String> iterator = infoMap.keySet().iterator(); log.setText(""); Time time = new Time(); while (iterator.hasNext()) { String name = iterator.next(); time.set(Long.valueOf(infoMap.get(name))); mLogger.d("\t" + name + " = " + infoMap.get(name) + " [" + time.format2445() + "]"); sb.append( "\n\t" + name + " = " + infoMap.get(name) + " [" + time.format2445() + "]"); } log.append(sb); } mediaDrm.closeSession(sessionId); sessionId = null; Toast.makeText(MainActivity.this, "queryKeyStatus finished", Toast.LENGTH_LONG).show(); return; } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (UnsupportedSchemeException e) { e.printStackTrace(); } catch (NotProvisionedException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } mediaDrm.closeSession(sessionId); sessionId = null; Toast.makeText(MainActivity.this, "Failure", Toast.LENGTH_LONG).show(); } }); } if (btnRemoveRights != null) { btnRemoveRights.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mLogger.d("requeseted removing License..."); Toast.makeText(MainActivity.this, "Not implementation", Toast.LENGTH_LONG).show(); } }); } if (btnStatus != null) { btnStatus.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mLogger.enter("Check registration Status..."); RequestParser parser = null; MediaDrm mediaDrm = null; byte[] sessionid = null; HashMap<String, String> optionalParameters = null; try { mediaDrm = new MediaDrm(Constants.MBB_UUID); sessionid = mediaDrm.openSession(); KeyRequest keyRequest = mediaDrm.getKeyRequest(sessionid, InitData.getPropertyTableForAndroid(Constants.QUERY_NAME_REGISTERED_STATE, Utils.accountIdToMarlinFormat(mAccountId), mServiceId), Constants.REQUEST_MIMETYPE_QUERY_PROPERTY, MediaDrm.KEY_TYPE_OFFLINE, optionalParameters); parser = new RequestParser(keyRequest.getData()); if (parser.parse()) { Toast.makeText(MainActivity.this, parser.getProperty(), Toast.LENGTH_LONG).show(); } else { Toast.makeText(MainActivity.this, "Failure", Toast.LENGTH_LONG).show(); } return; } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (UnsupportedSchemeException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } catch (NotProvisionedException e) { e.printStackTrace(); } Toast.makeText(MainActivity.this, "Failure", Toast.LENGTH_LONG).show(); } }); } }
From source file:oracle.kv.hadoop.table.TableRecordReaderBase.java
/** * Constructs a PrimaryKey for iteration from the given String property. * This method assumes that the value of the given prop parameter is a * list of name:value pairs in JSON FORMAT like the following: * <code>/*from w ww . j av a2s .c o m*/ * -Doracle.kv.primaryKey="{\"name\":\"stringVal\",\"name\":floatVal}" * </code> * For example, * <code> * -Doracle.kv.primaryKey="{\"make"\":\"ford\",\"price\":23450.23}" * </code> * where the list itself is enclosed in un-escaped double quotes and * corresponding curly brace; and each field name component -- as well * as each STRING type field value component -- is enclosed in ESCAPED * double quotes. * * Note that the double quotes that encapsulate the string values * referenced by each field name and each string type field value * MUST BE ESCAPED; otherwise, a parsing error will occur. This is * because the hadoop command interpreter strips off the double quotes * surrounding the name and value components before passing the system * property on to the Java VM in which the MapReduce job executes. * Escaping the double quotes in the way described above preserves * the double quotes so that the value of the system property is in * valid JSON format when parsed by this method below. */ private PrimaryKey getPrimaryKey(final Table table, final String prop) { PrimaryKey retKey = table.createPrimaryKey(); if (prop == null) { /* Send wildcard if the property is null. */ return retKey; } final String warnStr = "Invalid JSON in property [" + ParamConstant.PRIMARY_KEY.getName() + "=" + prop + "]: " + "must be a list of name:value pairs in JSON format having " + "the form -D" + ParamConstant.PRIMARY_KEY.getName() + "=" + "\"{\\\"fieldName\\\":\\\"stringValue\\\"," + "\\\"fieldName\\\":floatValue, ... }\"; where the list " + "is enclosed in un-escaped double quotes and curly braces, " + "and each fieldName component and each STRING type fieldValue " + "component is enclosed in ESCAPED double quotes. "; final String proceedStr = "Proceeding with full PrimaryKey wildcard."; try { retKey = table.createPrimaryKeyFromJson(prop, false); } catch (IllegalArgumentException e) { LOG.warn(warnStr + proceedStr); e.printStackTrace(); } return retKey; }
From source file:de.geeksfactory.opacclient.apis.Heidi.java
@Override public AccountData account(Account account) throws IOException, JSONException, OpacErrorException { login(account);//from w w w . j a v a2s . com String html; Document doc; AccountData adata = new AccountData(account.getId()); DateTimeFormatter fmt = DateTimeFormat.forPattern("dd.MM.yyyy").withLocale(Locale.GERMAN); html = httpGet(opac_url + "/konto.cgi?sess=" + sessid, getDefaultEncoding()); doc = Jsoup.parse(html); doc.setBaseUri(opac_url + "/"); for (Element td : doc.select("table.konto td")) { if (td.text().contains("Offene")) { String text = td.text().trim().replaceAll( "Offene[^0-9]+Geb.+hren:[^0-9]+([0-9.," + "]+)[^0-9A-Z]*(|EUR|CHF|Fr.)", "$1 $2"); adata.setPendingFees(text); } } List<LentItem> lent = new ArrayList<>(); for (Element tr : doc.select("table.kontopos tr")) { LentItem item = new LentItem(); Element desc = tr.child(1).select("label").first(); String dates = tr.child(2).text().trim(); if (tr.child(1).select("a").size() > 0) { String kk = getQueryParamsFirst(tr.child(1).select("a").first().absUrl("href")).get("katkey"); item.setId(kk); } int i = 0; for (Node node : desc.childNodes()) { if (node instanceof TextNode) { String text = ((TextNode) node).text().trim(); if (i == 0) { item.setAuthor(text); } else if (i == 1) { item.setTitle(text); } else if (text.contains("Mediennummer")) { item.setBarcode(text.replace("Mediennummer: ", "")); } i++; } } if (tr.child(0).select("input").size() == 1) { item.setProlongData(tr.child(0).select("input").first().val()); item.setRenewable(true); } else { item.setProlongData("" + tr.child(0).select("span").first().attr("class")); item.setRenewable(false); } String todate = dates; if (todate.contains("-")) { String[] datesplit = todate.split("-"); todate = datesplit[1].trim(); } try { item.setDeadline(fmt.parseLocalDate(todate.substring(0, 10))); } catch (IllegalArgumentException e) { e.printStackTrace(); } lent.add(item); } adata.setLent(lent); List<ReservedItem> reservations = new ArrayList<>(); html = httpGet(opac_url + "/konto.cgi?konto=v&sess=" + sessid, getDefaultEncoding()); reservations.addAll(parse_reservations(html)); html = httpGet(opac_url + "/konto.cgi?konto=b&sess=" + sessid, getDefaultEncoding()); reservations.addAll(parse_reservations(html)); adata.setReservations(reservations); return adata; }
From source file:oracle.kv.hadoop.table.TableRecordReaderBase.java
/** * Constructs a FieldRange to use in a table iteration from the given * String property. This method assumes that the value of the given * rangeFieldProp parameter is a list of name:value pairs in JSON FORMAT * like the following://from w w w . j a v a 2 s . com * <code> * -Doracle.kv.fieldRange="{\"name\":\"fieldName\", * \"start\":\"startVal\",[\"startInclusive\":true|false], * \"end\"\"endVal\",[\"endInclusive\":true|false]}" * </code> * For example, if the PrimaryKey is specified using the fields, * 'primary-key -field type -field make -field model -field color', then * one might specify a field range with the following system properties: * <code> * -Doracle.kv.primaryKey="{\"type\":\"truck\"}" * -Doracle.kv.fieldRange="{\"name\":\"make\", * \"start\":\"Chrysler\",\"startInclusive\":true, * \"end\"\"GM\",\"endInclusive\":false}" * </code> * Note that the list itself is enclosed in un-escaped double quotes and * corresponding curly brace, but each name component -- as well as each * STRING type value component -- is enclosed in ESCAPED double quotes. * * Note also that the double quotes that encapsulate the string values * referenced by each name and each string type value MUST BE ESCAPED; * otherwise, a parsing error will occur. This is because the hadoop * command interpreter strips off the double quotes surrounding the name * and value components before passing the system property on to the * Java VM in which the MapReduce job executes. Escaping the double * quotes in the way described above preserves the double quotes so that * the value of the system property is in valid JSON format when parsed * by this method below. */ private FieldRange getFieldRange(final Table table, final String rangeFieldProp) { FieldRange retRange = null; if (rangeFieldProp == null) { return retRange; } final String warnStr = "Invalid JSON in property [" + ParamConstant.FIELD_RANGE.getName() + "=" + rangeFieldProp + "]: must be a list of name:value pairs in JSON format having " + "the form -D" + ParamConstant.FIELD_RANGE.getName() + "=" + "\"{\\\"name\\\":\\\"fieldName\\\"," + "\\\"start\\\":\\\"stringStartVal\\\"|scalarStartVal," + "[\\\"startInclusive\\\":true|false]," + "\\\"end\\\":\\\"stringEndVal\\\"|scalarEndVal," + "[\\\"endInclusive\\\":true|false]}\"; where the list " + "is enclosed in un-escaped double quotes and curly braces, " + "and each name component and each STRING type value component " + "is enclosed in ESCAPED double quotes. "; final String proceedStr = "Proceeding with full range of values " + "for the PrimaryKey rather than a sub-range "; try { /* TODO: replace the call to the createFieldRange method from this * class with Table.createFieldRange(rangeFieldProp) once * that method is added to oracle.kv.table.Table; that is, * * retRange = table.createFieldRange(rangeFieldProp); */ retRange = createFieldRange(table, rangeFieldProp); } catch (IllegalArgumentException e) { LOG.warn(warnStr + proceedStr); e.printStackTrace(); } return retRange; }
From source file:org.kalypsodeegree_impl.model.feature.Feature_Impl.java
/** * Returns a property that is represented by an enumeration. *///from w w w. j a v a 2 s . c o m protected <T extends Enum<T>> T getEnumProperty(final QName propertyName, final Class<T> enumType, final T defaultValue) { final String value = getProperty(propertyName, String.class); if (StringUtils.isBlank(value)) return defaultValue; try { return Enum.valueOf(enumType, value); } catch (final IllegalArgumentException e) { e.printStackTrace(); return defaultValue; } }
From source file:me.repository.common.CommonDao.java
/** * ?/*from w w w. j a v a 2 s . co m*/ * @param entity */ public void save(T entity) { try { // ?? Object id = null; for (Method method : entity.getClass().getMethods()) { Id idAnn = method.getAnnotation(Id.class); if (idAnn != null) { id = method.invoke(entity); break; } } // ?? // if (StringUtils.isBlank((String)id)){ if (id == null) { //idLong for (Method method : entity.getClass().getMethods()) { PrePersist pp = method.getAnnotation(PrePersist.class); if (pp != null) { method.invoke(entity); break; } } } // ? else { for (Method method : entity.getClass().getMethods()) { PreUpdate pu = method.getAnnotation(PreUpdate.class); if (pu != null) { method.invoke(entity); break; } } } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } // catch (Exception e) { //catch? ? // e.printStackTrace(); // } getSession().saveOrUpdate(entity); }
From source file:com.datastax.loader.CqlDelimLoad.java
private boolean setup() throws IOException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException, CertificateException, UnrecoverableKeyException { // Connect to Cassandra Session tsession = null;/*from www . j a v a 2 s. co m*/ try { PoolingOptions pOpts = new PoolingOptions(); pOpts.setMaxConnectionsPerHost(HostDistance.LOCAL, 8); pOpts.setCoreConnectionsPerHost(HostDistance.LOCAL, 8); Cluster.Builder clusterBuilder = Cluster.builder().addContactPoint(host).withPort(port) //.withCompression(ProtocolOptions.Compression.LZ4) .withPoolingOptions(pOpts) .withLoadBalancingPolicy(new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().build())); if (null != username) clusterBuilder = clusterBuilder.withCredentials(username, password); if (null != truststorePath) clusterBuilder = clusterBuilder.withSSL(createSSLOptions()); cluster = clusterBuilder.build(); if (null == cluster) { throw new IOException("Could not create cluster"); } tsession = cluster.connect(); } catch (IllegalArgumentException e) { System.err.println("Could not connect to the cluster, check your hosts"); //e.printStackTrace(); return false; } catch (Exception e) { System.err.println(e.getStackTrace()); e.printStackTrace(); return false; } if ((0 > cluster.getConfiguration().getProtocolOptions().getProtocolVersion().compareTo(ProtocolVersion.V4)) && nullsUnset) { System.err.println("Cannot use nullsUnset with ProtocolVersion less than V4 (prior to Cassandra 3.0"); cleanup(); return false; } if (null != rateFile) { if (STDERR.equalsIgnoreCase(rateFile)) { rateStream = System.err; } else { rateStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(rateFile)), true); } } Metrics metrics = cluster.getMetrics(); com.codahale.metrics.Timer timer = metrics.getRequestsTimer(); rateLimiter = new RateLimiter(rate, progressRate, timer, rateStream); //rateLimiter = new Latency999RateLimiter(rate, progressRate, 3000, 200, 10, 0.5, 0.1, cluster, false); session = new RateLimitedSession(tsession, rateLimiter); return true; }
From source file:me.repository.common.CommonDao.java
/** * ?????dao//from ww w .ja v a 2 s.c o m * @author wj * @param cur */ public <E> void saveme(E cur) { try { // ?? Object id = null; for (Method method : cur.getClass().getMethods()) { Id idAnn = method.getAnnotation(Id.class); if (idAnn != null) { id = method.invoke(cur); break; } } // ?? // if (StringUtils.isBlank((String)id)){ if (id == null) { //idLong for (Method method : cur.getClass().getMethods()) { PrePersist pp = method.getAnnotation(PrePersist.class); if (pp != null) { method.invoke(cur); break; } } } // ? else { for (Method method : cur.getClass().getMethods()) { PreUpdate pu = method.getAnnotation(PreUpdate.class); if (pu != null) { method.invoke(cur); break; } } } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } // catch (Exception e) { //catch? ? // e.printStackTrace(); // } getSession().saveOrUpdate(cur); }
From source file:ch.bfh.fbi.mobicomp.geofence.MainActivity.java
/** * Called when the user clicks the "Remove geofence 1" button * @param view The view that triggered this callback *//*from w w w. j a v a2s . c om*/ public void onUnregisterGeofence1Clicked(View view) { /* * Remove the geofence by creating a List of geofences to * remove and sending it to Location Services. The List * contains the id of geofence 1 ("1"). * The removal happens asynchronously; Location Services calls * onRemoveGeofencesByPendingIntentResult() (implemented in * the current Activity) when the removal is done. */ // Create a List of 1 Geofence with the ID "1" and store it in the global list geofenceIdsToRemove = Collections.singletonList("1"); /* * Record the removal as remove by list. If a connection error occurs, * the app can automatically restart the removal if Google Play services * can fix the error */ removeType = GeofenceUtils.REMOVE_TYPE.LIST; /* * Check for Google Play services. Do this after * setting the request type. If connecting to Google Play services * fails, onActivityResult is eventually called, and it needs to * know what type of request was in progress. */ if (!servicesConnected()) { return; } // Try to remove the geofence try { mGeofenceRemover.removeGeofencesById(geofenceIdsToRemove); // Catch errors with the provided geofence IDs } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (UnsupportedOperationException e) { // Notify user that previous request hasn't finished. Toast.makeText(this, R.string.remove_geofences_already_requested_error, Toast.LENGTH_LONG).show(); } }
From source file:ch.bfh.fbi.mobicomp.geofence.MainActivity.java
/** * Called when the user clicks the "Remove geofence 2" button * @param view The view that triggered this callback *///from w ww.j a v a 2s.c om public void onUnregisterGeofence2Clicked(View view) { /* * Remove the geofence by creating a List of geofences to * remove and sending it to Location Services. The List * contains the id of geofence 2, which is "2". * The removal happens asynchronously; Location Services calls * onRemoveGeofencesByPendingIntentResult() (implemented in * the current Activity) when the removal is done. */ /* * Record the removal as remove by list. If a connection error occurs, * the app can automatically restart the removal if Google Play services * can fix the error */ removeType = GeofenceUtils.REMOVE_TYPE.LIST; // Create a List of 1 Geofence with the ID "2" and store it in the global list geofenceIdsToRemove = Collections.singletonList("2"); /* * Check for Google Play services. Do this after * setting the request type. If connecting to Google Play services * fails, onActivityResult is eventually called, and it needs to * know what type of request was in progress. */ if (!servicesConnected()) { return; } // Try to remove the geofence try { mGeofenceRemover.removeGeofencesById(geofenceIdsToRemove); // Catch errors with the provided geofence IDs } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (UnsupportedOperationException e) { // Notify user that previous request hasn't finished. Toast.makeText(this, R.string.remove_geofences_already_requested_error, Toast.LENGTH_LONG).show(); } }