List of usage examples for java.lang IllegalArgumentException printStackTrace
public void printStackTrace()
From source file:com.zetterstrom.android.soundboarder.MainActivity.java
public void playSound(AssetFileDescriptor afd) { if (mMediaPlayer != null) { try {// w ww . java2 s . c o m if (mMediaPlayer.isPlaying()) mMediaPlayer.stop(); mMediaPlayer.reset(); mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); mMediaPlayer.prepare(); mMediaPlayer.start(); } catch (IllegalArgumentException e) { Toast.makeText(this, "Error Playing Sound Byte", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (IllegalStateException e) { Toast.makeText(this, "Error Playing Sound Byte", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (IOException e) { Toast.makeText(this, "Error Playing Sound Byte", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } } else { Toast.makeText(this, "Error Playing Sound Byte", Toast.LENGTH_SHORT).show(); } }
From source file:com.example.prasadnr.traquad.TraQuad.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tra_quad); ConnectivityManager connManager = (ConnectivityManager) getSystemService(TraQuad.CONNECTIVITY_SERVICE); NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); Builder alert = new AlertDialog.Builder(TraQuad.this); WifiManager managerWifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); Method[] wmMethods = managerWifi.getClass().getDeclaredMethods(); for (Method method : wmMethods) { if (method.getName().equals("isWifiApEnabled")) { try { isWifiAPenabled = (boolean) method.invoke(managerWifi); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace();/*from w w w . j ava 2 s.co m*/ } catch (InvocationTargetException e) { e.printStackTrace(); } } } final ProgressDialog pDialog; MediaController mediaController = new MediaController(this); pDialog = new ProgressDialog(TraQuad.this); pDialog.setTitle("TraQuad app (Connecting...)"); pDialog.setMessage("Buffering...Please wait..."); pDialog.setCancelable(true); if (!isWifiAPenabled) { alert.setTitle("WiFi Hotspot Settings"); alert.setMessage("Can you please connect WiFi-hotspot?"); alert.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { irritation = true; startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); pDialog.show(); } }); alert.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //Dismiss AlertDialog pDialog.show(); Toast.makeText(getApplicationContext(), "Please connect your WiFi!", Toast.LENGTH_LONG).show(); } }); alert.setCancelable(false); AlertDialog alertDialog = alert.create(); alertDialog.show(); } WebView webView = (WebView) findViewById(R.id.webView); if (irritation == true | isWifiAPenabled) { pDialog.show(); } mediaController.setAnchorView(webView); mediaController.setVisibility(View.GONE); extra = getIntent().getStringExtra("VideosId"); webView = (WebView) findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setPluginState(WebSettings.PluginState.ON); final GlobalClass globalVariable = (GlobalClass) getApplicationContext(); final String IPaddressNew = globalVariable.getIP(); final String httpString = "http://"; final String commandPort = String.valueOf(1500); final String streamPort = String.valueOf(8080); final String IPaddressStream = httpString + IPaddressNew + ":" + streamPort; final String IPaddressCommand = httpString + IPaddressNew + ":" + commandPort; TextView sendCharacter = (TextView) findViewById(R.id.sendCharacter); try { webView.loadUrl(IPaddressStream); } catch (Exception e) { Toast.makeText(getApplicationContext(), IPaddressNew + ":Error!", Toast.LENGTH_LONG).show(); } webView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { pDialog.dismiss(); } }); final Button switchact = (Button) findViewById(R.id.btn2); switchact.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent act1 = new Intent(view.getContext(), Joypad.class); startActivity(act1); } }); final Button hometraquad = (Button) findViewById(R.id.button5); hometraquad.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent acthometraquad = new Intent(TraQuad.this, MainActivity.class); startActivity(acthometraquad); } }); }
From source file:com.polyvi.xface.extension.XSecurityExt.java
@Override public XExtensionResult exec(String action, JSONArray args, XCallbackContext callbackCtx) throws JSONException { XExtensionResult.Status status = XExtensionResult.Status.OK; String result = "Unsupported Operation: " + action; try {/*from w w w. j a v a2 s . c o m*/ if (action.equals(COMMAND_ENCRYPT)) { result = encrypt(args.getString(0), args.getString(1), args.optJSONObject(2)); } else if (action.equals(COMMAND_DECRYPT)) { result = decrypt(args.getString(0), args.getString(1), args.optJSONObject(2)); } else if (action.equals(COMMAND_ENCRYPT_FILE)) { result = encryptFile(mWebContext, args.getString(0), args.getString(1), args.getString(2)); } else if (action.equals(COMMAND_DECRYPT_FILE)) { result = decryptFile(mWebContext, args.getString(0), args.getString(1), args.getString(2)); } else if (action.equals(COMMAND_DIGEST)) { result = digest(args.getString(0)); } else { status = XExtensionResult.Status.INVALID_ACTION; } return new XExtensionResult(status, result); } catch (IllegalArgumentException e) { e.printStackTrace(); return new XExtensionResult(XExtensionResult.Status.ERROR, PATH_ERR); } catch (FileNotFoundException e) { e.printStackTrace(); XLog.e(CLASS_NAME, FILE_NOT_FOUND_ERROR, e); return new XExtensionResult(XExtensionResult.Status.ERROR, FILE_NOT_FOUND_ERR); } catch (XCryptionException e) { e.printStackTrace(); XLog.e(CLASS_NAME, CRYPTION_ERROR, e); return new XExtensionResult(XExtensionResult.Status.ERROR, OPERATION_ERR); } }
From source file:geogebra.kernel.statistics.AlgoTTest2.java
protected final void compute() { if (!(tail.getTextString().equals("<") || tail.getTextString().equals(">") || tail.getTextString().equals("!=") || tail.getTextString().equals(""))) { result.setUndefined();// w w w. ja va 2 s. c o m return; } double p, testStat; // sample data input if (input.length == 4) { int size0 = geoList0.size(); if (!geoList0.isDefined() || size0 < 2) { result.setUndefined(); return; } int size1 = geoList1.size(); if (!geoList1.isDefined() || size1 < 2) { result.setUndefined(); return; } val0 = new double[size0]; val1 = new double[size1]; // load array from first sample for (int i = 0; i < size0; i++) { GeoElement geo0 = geoList0.get(i); if (geo0.isNumberValue()) { NumberValue num = (NumberValue) geo0; val0[i] = num.getDouble(); } else { result.setUndefined(); return; } } // load array from second sample for (int i = 0; i < size1; i++) { GeoElement geo1 = geoList1.get(i); if (geo1.isNumberValue()) { NumberValue num = (NumberValue) geo1; val1[i] = num.getDouble(); } else { result.setUndefined(); return; } } try { // get the test statistic and p if (tTestImpl == null) tTestImpl = new TTestImpl(); if (pooled.getBoolean()) { testStat = tTestImpl.homoscedasticT(val0, val1); p = tTestImpl.homoscedasticTTest(val0, val1); p = adjustedPValue(p, testStat); } else { testStat = tTestImpl.t(val0, val1); p = tTestImpl.tTest(val0, val1); p = adjustedPValue(p, testStat); } // put these results into the output list result.clear(); result.add(new GeoNumeric(cons, p)); result.add(new GeoNumeric(cons, testStat)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (MathException e) { e.printStackTrace(); } // sample statistics input } else { // check for valid stand. deviation and sample size if (sd0.getDouble() < 0 || sd1.getDouble() < 0 || n0.getDouble() < 2 || n1.getDouble() < 2) { result.setUndefined(); return; } StatisticalSummaryValues sumStats0 = new StatisticalSummaryValues(mean0.getDouble(), sd0.getDouble() * sd0.getDouble(), (long) n0.getDouble(), -1, -1, -1); StatisticalSummaryValues sumStats1 = new StatisticalSummaryValues(mean1.getDouble(), sd1.getDouble() * sd1.getDouble(), (long) n1.getDouble(), -1, -1, -1); try { // get the test statistic and p if (tTestImpl == null) tTestImpl = new TTestImpl(); if (pooled.getBoolean()) { testStat = tTestImpl.homoscedasticT(sumStats0, sumStats1); p = tTestImpl.homoscedasticTTest(sumStats0, sumStats1); p = adjustedPValue(p, testStat); } else { testStat = tTestImpl.t(sumStats0, sumStats1); p = tTestImpl.tTest(sumStats0, sumStats1); p = adjustedPValue(p, testStat); } // put these results into the output list result.clear(); result.add(new GeoNumeric(cons, p)); result.add(new GeoNumeric(cons, testStat)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (MathException e) { e.printStackTrace(); } } }
From source file:org.evolizer.da4java.graph.data.EdgeGrouper.java
/** * Inserts the higher level edges between the node pairs of * <source>nodePairToEdgeMap</source> with a strength that corresponds the * number of aggregated lower level edges. * // w w w . j a v a 2s .co m * Lower level edges are remembered in the edge map of the higher level edge * and then removed from the graph (but not from the edge map). * * @param nodePairToEdgeMap Map of from/to nodes referring to the list of lower level * edges. * @param edgeType the edge type * * @return a list with the created higher level edges */ private List<Edge> createHighLevelEdges(Map<MultiKey, List<Edge>> nodePairToEdgeMap, String edgeType) { // use the second edge map to store aggregated edges EdgeMap aggregatedToContainedEdges = getAggregatedEdgeMap(); List<Edge> addedHighLevelEdges = new ArrayList<Edge>(); for (Entry<MultiKey, List<Edge>> entry : nodePairToEdgeMap.entrySet()) { Node source = (Node) entry.getKey().getKey(0); Node target = (Node) entry.getKey().getKey(1); List<Edge> lowLevelEdges = entry.getValue(); // insert a new edge with the strength corr. to the number of // aggregated edges Edge highLevelEdge = getHierarchyManager().createEdge(source, target); addedHighLevelEdges.add(highLevelEdge); aggregatedToContainedEdges.set(highLevelEdge, lowLevelEdges); for (Edge lowLevelEdge : lowLevelEdges) { try { getRootGraph().removeEdge(lowLevelEdge); } catch (IllegalArgumentException iae) { iae.printStackTrace(); sLogger.error("Error removing low level edge " + lowLevelEdge); } } fGraph.fireHighLevelEdgeCreated(highLevelEdge); } return addedHighLevelEdges; }
From source file:com.alibaba.doris.client.DataStoreTest.java
/** * Test Name: value. Expected Result: ?? *///from w w w . j a v a2s. c om public void testPut3() { String key = "key001"; String value = null; try { dataStore.put(key, value); } catch (IllegalArgumentException e) { e.printStackTrace(); fail("Null value!"); } }
From source file:com.sun.portal.rssportlet.FeedHelper.java
/** * Get the ROME SyndFeed object for the specified feed. The object may come * from a cache; the data in the feed may not be read at the time * this method is called.// w w w . ja va 2 s. co m * * The <code>RssPortletBean</code> object is used to identify the feed * of interest, and the timeout value to be used when managing this * feed's cached value. * * @param bean an <code>RssPortletBean</code> object that describes * the feed of interest, and the cache timeout value for the feed. * @return a ROME <code>SyndFeed</code> object encapsulating the * feed specified by the URL. */ public SyndFeed getFeed(SettingsBean bean, String selectedFeed) throws IOException, FeedException { SyndFeed feed = null; FeedElement feedElement = (FeedElement) feeds.get(selectedFeed); if (feedElement != null && !feedElement.isExpired()) { feed = feedElement.getFeed(); } else { GetMethod httpget = null; try { SyndFeedInput input = new SyndFeedInput(); HttpClient httpclient = new HttpClient(); httpclient.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECTION_TIMEOUT); // SO_TIMEOUT -- timeout for blocking reads httpclient.getHttpConnectionManager().getParams().setSoTimeout(SOCKET_TIMEOUT); httpget = new GetMethod(selectedFeed); //httpget.getParams().setParameter("http.socket.timeout", new Integer(20000)); // Internally the parameter collections will be linked together // by performing the following operations: // hostconfig.getParams().setDefaults(httpclient.getParams()); // httpget.getParams().setDefaults(hostconfig.getParams()); //httpclient.executeMethod(hostconfig, httpget); // Execute the method. int statusCode = httpclient.executeMethod(httpget); if (statusCode != HttpStatus.SC_OK) { log.info("Method failed: " + httpget.getStatusLine()); } // Read the response body. InputSource src = new InputSource(httpget.getResponseBodyAsStream()); // Deal with the response. // Use caution: ensure correct character encoding and is not binary data feed = input.build(src); // // only cache the feed if the cache timeout is not equal to 0 // a cache timeout of 0 means "don't cache" // int timeout = bean.getCacheTimeout(); if (timeout != 0) { putFeed(selectedFeed, feed, timeout); } } catch (MalformedURLException mfurlex) { log.info("MalformedURLException: " + mfurlex.getMessage()); mfurlex.printStackTrace(); throw new IOException("MalformedURLException: " + mfurlex.getMessage()); } catch (HttpException httpex) { log.info("Fatal protocol violation: " + httpex.getMessage()); httpex.printStackTrace(); throw new IOException("Fatal protocol violation: " + httpex.getMessage()); } catch (IllegalArgumentException iae) { log.info("IllegalArgumentException: " + iae.getMessage()); iae.printStackTrace(); throw new IOException("IllegalArgumentException: " + iae.getMessage()); } catch (IOException ioe) { log.info("Fatal transport error: " + ioe.getMessage()); ioe.printStackTrace(); throw new IOException("Fatal transport error: " + ioe.getMessage()); } catch (ParsingFeedException parsingfeedex) { log.info("ParsingFeedException: " + parsingfeedex.getMessage()); parsingfeedex.printStackTrace(); throw new FeedException("ParsingFeedException: " + parsingfeedex.getMessage()); } catch (FeedException feedex) { log.info("FeedException: " + feedex.getMessage()); feedex.printStackTrace(); throw new FeedException("FeedException: " + feedex.getMessage()); } catch (Exception ex) { log.info("Exception ERROR: " + ex.getMessage()); ex.printStackTrace(); } finally { // Release the connection. httpget.releaseConnection(); } } return feed; }
From source file:de.gobro.andreas.pa.pa_cleint_java.SendTouch.java
@Override public boolean onTouchEvent(MotionEvent ev) { final int action = MotionEventCompat.getActionMasked(ev); switch (action) { case MotionEvent.ACTION_DOWN: { Log.d("down", "action_down"); break;//from w w w.j a v a 2s . c o m } case MotionEvent.ACTION_MOVE: { for (Integer i = 0; (i < ev.getPointerCount()) && (i < maxPoints); i++) { //final Integer pointerIndex = MotionEventCompat.getActionIndex(ev); Integer id = ev.getPointerId(i); Log.d("ind", "pinterindex" + i.toString()); Log.d("ind", "ID" + id.toString()); Log.d("pos", "(" + String.valueOf(MotionEventCompat.getX(ev, i)) + ";" + String.valueOf(MotionEventCompat.getY(ev, i)) + ")"); Log.d("test", "action_move"); try { serializer.startTag("", "touch"); serializer.startTag("", "dx"); serializer.text(String.valueOf(MotionEventCompat.getX(ev, i) / size.x)); serializer.endTag("", "dx"); serializer.startTag("", "dy"); serializer.text(String.valueOf(MotionEventCompat.getY(ev, i) / size.y)); serializer.endTag("", "dy"); serializer.startTag("", "id"); serializer.text(id.toString()); serializer.endTag("", "id"); serializer.endTag("", "touch"); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RuntimeException e) { e.printStackTrace(); } // try { // writer.writeStartElement("touch"); // writer.writeStartElement("dx"); // writer.writeCharacters(String.valueOf(MotionEventCompat.getX(ev, i)/size.x)); // writer.writeEndElement(); // writer.writeStartElement("dy"); // writer.writeCharacters(String.valueOf(MotionEventCompat.getY(ev, i)/size.y)); // writer.writeEndElement(); // writer.writeStartElement("id"); // writer.writeCharacters(id.toString()); // writer.writeEndElement(); // writer.writeEndElement(); // } catch (XMLStreamException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } } //write the stuff to the network try { serializer.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); finish(); } break; } case MotionEvent.ACTION_UP: { Log.d("test", "action_up"); break; } case MotionEvent.ACTION_CANCEL: { Log.d("test", "action_cancel"); break; } case MotionEvent.ACTION_POINTER_DOWN: { Log.d("down", "action_p_down"); break; } case MotionEvent.ACTION_POINTER_UP: { Log.d("test", "action_p_up"); break; } } return true; }
From source file:geogebra.common.kernel.statistics.AlgoTTest2.java
@Override public final void compute() { if (!(StringUtil.isInequality(tail.getTextString()))) { result.setUndefined();/*from ww w .j av a2s.co m*/ return; } double p, testStat; // sample data input if (input.length == 4) { int size0 = geoList0.size(); if (!geoList0.isDefined() || size0 < 2) { result.setUndefined(); return; } int size1 = geoList1.size(); if (!geoList1.isDefined() || size1 < 2) { result.setUndefined(); return; } val0 = new double[size0]; val1 = new double[size1]; // load array from first sample for (int i = 0; i < size0; i++) { GeoElement geo0 = geoList0.get(i); if (geo0 instanceof NumberValue) { NumberValue num = (NumberValue) geo0; val0[i] = num.getDouble(); } else { result.setUndefined(); return; } } // load array from second sample for (int i = 0; i < size1; i++) { GeoElement geo1 = geoList1.get(i); if (geo1 instanceof NumberValue) { NumberValue num = (NumberValue) geo1; val1[i] = num.getDouble(); } else { result.setUndefined(); return; } } try { // get the test statistic and p if (tTestImpl == null) tTestImpl = new TTestImpl(); if (pooled.getBoolean()) { testStat = tTestImpl.homoscedasticT(val0, val1); p = tTestImpl.homoscedasticTTest(val0, val1); p = adjustedPValue(p, testStat); } else { testStat = tTestImpl.t(val0, val1); p = tTestImpl.tTest(val0, val1); p = adjustedPValue(p, testStat); } // put these results into the output list result.clear(); result.add(new GeoNumeric(cons, p)); result.add(new GeoNumeric(cons, testStat)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (MathException e) { e.printStackTrace(); } // sample statistics input } else { // check for valid stand. deviation and sample size if (sd0.getDouble() < 0 || sd1.getDouble() < 0 || n0.getDouble() < 2 || n1.getDouble() < 2) { result.setUndefined(); return; } StatisticalSummaryValues sumStats0 = new StatisticalSummaryValues(mean0.getDouble(), sd0.getDouble() * sd0.getDouble(), (long) n0.getDouble(), -1, -1, -1); StatisticalSummaryValues sumStats1 = new StatisticalSummaryValues(mean1.getDouble(), sd1.getDouble() * sd1.getDouble(), (long) n1.getDouble(), -1, -1, -1); try { // get the test statistic and p if (tTestImpl == null) tTestImpl = new TTestImpl(); if (pooled.getBoolean()) { testStat = tTestImpl.homoscedasticT(sumStats0, sumStats1); p = tTestImpl.homoscedasticTTest(sumStats0, sumStats1); p = adjustedPValue(p, testStat); } else { testStat = tTestImpl.t(sumStats0, sumStats1); p = tTestImpl.tTest(sumStats0, sumStats1); p = adjustedPValue(p, testStat); } // put these results into the output list result.clear(); result.add(new GeoNumeric(cons, p)); result.add(new GeoNumeric(cons, testStat)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (MathException e) { e.printStackTrace(); } } }
From source file:com.github.akinaru.bleanalyzer.activity.ScanActivity.java
@Override protected void onDestroy() { super.onDestroy(); Log.v(TAG, "onDestroy"); unregisterReceiver(mBluetoothReceiver); try {//from w ww . j ava2 s .c om if (mBound) { unbindService(mServiceConnection); mBound = false; } } catch (IllegalArgumentException e) { e.printStackTrace(); } }