List of usage examples for java.lang IllegalArgumentException printStackTrace
public void printStackTrace()
From source file:com.mobiperf.speedometer.Checkin.java
public List<MeasurementTask> checkin() throws IOException { Logger.i("Checkin.checkin() called"); boolean checkinSuccess = false; try {//w w w . ja v a 2 s . c o m JSONObject status = new JSONObject(); DeviceInfo info = phoneUtils.getDeviceInfo(); // TODO(Wenjie): There is duplicated info here, such as device ID. status.put("id", info.deviceId); status.put("manufacturer", info.manufacturer); status.put("model", info.model); status.put("os", info.os); status.put("properties", MeasurementJsonConvertor.encodeToJson(phoneUtils.getDeviceProperty())); Logger.d(status.toString()); sendStringMsg("Checking in"); String result = speedometerServiceRequest("checkin", status.toString()); Logger.d("Checkin result: " + result); // Parse the result Vector<MeasurementTask> schedule = new Vector<MeasurementTask>(); JSONArray jsonArray = new JSONArray(result); sendStringMsg("Checkin got " + jsonArray.length() + " tasks."); for (int i = 0; i < jsonArray.length(); i++) { Logger.d("Parsing index " + i); JSONObject json = jsonArray.optJSONObject(i); Logger.d("Value is " + json); if (json != null) { try { MeasurementTask task = MeasurementJsonConvertor.makeMeasurementTaskFromJson(json, this.context); Logger.i(MeasurementJsonConvertor.toJsonString(task.measurementDesc)); if (task instanceof MobiBedTask) { // TODO String url = task.getContribUrl(); Logger.v("contrib_url: " + url); if (url != null && url != "null") httpGetContrib(url); } schedule.add(task); } catch (IllegalArgumentException e) { Logger.w("Could not create task from JSON: " + e); // Just skip it, and try the next one e.printStackTrace(); } } } this.lastCheckin = new Date(); Logger.i("Checkin complete, got " + schedule.size() + " new tasks"); checkinSuccess = true; return schedule; } catch (JSONException e) { Logger.e("Got exception during checkin", e); throw new IOException("There is exception during checkin()"); } catch (IOException e) { Logger.e("Got exception during checkin", e); throw e; } finally { if (!checkinSuccess) { // Failure probably due to authToken expiration. Will // authenticate upon next checkin. this.accountSelector.setAuthImmediately(true); this.authCookie = null; } } }
From source file:dk.ciid.android.infobooth.activities.IntroductionActivity.java
private void initMediaPlayer() { String PATH_TO_FILE = voice1; mediaPlayer = new MediaPlayer(); try {// w w w. j a va 2s . c om mediaPlayer.setDataSource(PATH_TO_FILE); mediaPlayer.prepare(); //Toast.makeText(this, PATH_TO_FILE, Toast.LENGTH_LONG).show(); stateMediaPlayer = stateMP_NotStarter; } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); //Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); stateMediaPlayer = stateMP_Error; } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); //Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); stateMediaPlayer = stateMP_Error; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); //Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); stateMediaPlayer = stateMP_Error; } }
From source file:br.upe.ecomp.dosa.view.wizard.WizardAction.java
private void addAlgorithms() { algorithmComboBox.setModel(new DefaultComboBoxModel()); algorithmComboBox.addItem(""); for (Class<? extends Algorithm> algorithm : applicationContext.getAlgorithmList()) { try {/*w w w.j a v a 2 s. c o m*/ algorithmComboBox.addItem(algorithm.getConstructors()[0].newInstance()); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException 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(); } } }
From source file:br.upe.ecomp.dosa.view.wizard.WizardAction.java
private void addProblems() { problemComboBox.setModel(new DefaultComboBoxModel()); problemComboBox.addItem(""); for (Class<? extends Problem> problem : applicationContext.getProblemList()) { try {// w w w . ja v a 2 s.c o m problemComboBox.addItem(problem.getConstructors()[0].newInstance()); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException 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(); } } }
From source file:br.upe.ecomp.dosa.view.wizard.WizardAction.java
private void addStopConditions() { stopConditionAvailableList.setModel(new DefaultListModel()); for (Class<? extends StopCondition> stopCondition : applicationContext.getStopConditionList()) { try {//from w w w . ja va2s . c o m ((DefaultListModel) stopConditionAvailableList.getModel()) .addElement(stopCondition.getConstructors()[0].newInstance()); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException 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(); } } }
From source file:br.upe.ecomp.dosa.view.wizard.WizardAction.java
private void addMeasurements() { measurementAvailableList.setModel(new DefaultListModel()); for (Class<? extends Measurement> measurement : applicationContext.getMeasurementList()) { try {/*from w w w. j a v a 2 s .c o m*/ ((DefaultListModel) measurementAvailableList.getModel()) .addElement(measurement.getConstructors()[0].newInstance()); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException 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(); } } }
From source file:com.code.android.vibevault.ShowDetailsScreen.java
/** Bookkeeping method to deal with dialogs over orientation changes. * *//* w ww. ja v a 2 s .c o m*/ private void onTaskCompleted() { if (dialogShown) { try { dismissDialog(VibeVault.LOADING_DIALOG_ID); } catch (IllegalArgumentException e) { e.printStackTrace(); } dialogShown = false; refreshScreenTitle(); refreshTrackList(); // If this is from an Intent where a song was selected, play it. if (selectedPos != -1) { playShow(selectedPos); Intent i = new Intent(ShowDetailsScreen.this, NowPlayingScreen.class); startActivity(i); } } }
From source file:cs.umass.edu.prepare.view.activities.CalendarActivity.java
@Override protected void onStop() { LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this); try {/*from w ww. jav a2 s . c om*/ broadcastManager.unregisterReceiver(receiver); } catch (IllegalArgumentException e) { e.printStackTrace(); } super.onStop(); }
From source file:org.loklak.api.server.ImportProfileServlet.java
private void doUpdate(RemoteAccess.Post post, HttpServletResponse response) throws IOException { String callback = post.get("callback", null); boolean jsonp = callback != null && callback.length() > 0; String data = post.get("data", ""); if (data == null || data.length() == 0) { response.sendError(400, "your request must contain a data object."); return;/* w w w. j a v a 2s . co m*/ } // parse the json data boolean success; try { XContentParser parser = JsonXContent.jsonXContent.createParser(data); Map<String, Object> map = parser.map(); if (map.get("id_str") == null) { throw new IOException("id_str field missing"); } if (map.get("source_type") == null) { throw new IOException("source_type field missing"); } ImportProfileEntry i = DAO.SearchLocalImportProfiles((String) map.get("id_str")); if (i == null) { throw new IOException("import profile id_str field '" + map.get("id_str") + "' not found"); } ImportProfileEntry importProfileEntry; try { importProfileEntry = new ImportProfileEntry(map); } catch (IllegalArgumentException e) { response.sendError(400, "Error updating import profile : " + e.getMessage()); return; } importProfileEntry.setLastModified(new Date()); success = DAO.writeImportProfile(importProfileEntry, true); } catch (IOException | NullPointerException e) { response.sendError(400, "submitted data is invalid : " + e.getMessage()); e.printStackTrace(); return; } post.setResponse(response, "application/javascript"); XContentBuilder json = XContentFactory.jsonBuilder().prettyPrint().lfAtEnd(); json.startObject(); json.field("status", "ok"); json.field("records", success ? 1 : 0); json.field("message", "updated"); json.endObject(); // write json response.setCharacterEncoding("UTF-8"); PrintWriter sos = response.getWriter(); if (jsonp) sos.print(callback + "("); sos.print(json.string()); if (jsonp) sos.println(");"); sos.println(); post.finalize(); }
From source file:com.aegamesi.steamtrade.MainActivity.java
private void disconnectWithDialog(final Context context, final String message) { class SteamDisconnectTask extends AsyncTask<Void, Void, Void> { private ProgressDialog dialog; @Override//from w w w . j a v a 2s . c om protected Void doInBackground(Void... params) { // this is really goddamn slow steamUser.logOff(); SteamService.singleton.steamClient.disconnect(); SteamService.attemptReconnect = false; if (SteamService.singleton != null) SteamService.singleton.disconnect(); return null; } @Override protected void onPreExecute() { super.onPreExecute(); dialog = new ProgressDialog(context); dialog.setCancelable(false); dialog.setMessage(message); dialog.show(); } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); try { dialog.dismiss(); } catch (IllegalArgumentException e) { e.printStackTrace(); } // go back to login screen Intent intent = new Intent(MainActivity.this, LoginActivity.class); MainActivity.this.startActivity(intent); Toast.makeText(MainActivity.this, R.string.signed_out, Toast.LENGTH_LONG).show(); finish(); } } new SteamDisconnectTask().execute(); }