List of usage examples for java.lang RuntimeException printStackTrace
public void printStackTrace()
From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java
private void setupUI() { setContentView(R.layout.running_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* w w w. j av a 2 s . com*/ mUriTextView = (TextView) findViewById(R.id.master_uri); mUriTextView.setText(mMasterUri); mRosLightImageView = (ImageView) findViewById(R.id.is_ros_ok_image); mTangoLightImageView = (ImageView) findViewById(R.id.is_tango_ok_image); mlogSwitch = (Switch) findViewById(R.id.log_switch); mlogSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { mDisplayLog = isChecked; mLogTextView.setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE); } }); mLogTextView = (TextView) findViewById(R.id.log_view); mLogTextView.setMovementMethod(new ScrollingMovementMethod()); mSaveMapButton = (Button) findViewById(R.id.save_map_button); mSaveMapButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showSaveMapDialog(); } }); mLoadOccupancyGridButton = (Button) findViewById(R.id.load_occupancy_grid_button); mLoadOccupancyGridButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mOccupancyGridNameList = new ArrayList<String>(); try { String directory = mParameterNode .getStringParam(getString(R.string.occupancy_grid_directory_key)); File occupancyGridDirectory = new File(directory); if (occupancyGridDirectory != null && occupancyGridDirectory.isDirectory()) { File[] files = occupancyGridDirectory.listFiles(); for (File file : files) { if (FilenameUtils.getExtension(file.getName()).equals("yaml")) { mOccupancyGridNameList.add(FilenameUtils.removeExtension(file.getName())); } } } showLoadOccupancyGridDialog(/* firstTry */ true, mOccupancyGridNameList); } catch (RuntimeException e) { e.printStackTrace(); } } }); updateLoadAndSaveMapButtons(); }
From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java
@Override public void onSaveMapServiceCallFinish(boolean success, final String message, final String mapName, final String mapUuid) { if (success) { mMapSaved = true;// ww w . j av a 2s. com displayToastMessage(R.string.save_map_success); saveUuidsNamestoHashMap(); runOnUiThread(new Runnable() { @Override public void run() { mSaveMapButton.setEnabled(!mMapSaved); mSnackbarLoadNewMap = Snackbar.make(findViewById(android.R.id.content), getString(R.string.snackbar_text_load_new_map), Snackbar.LENGTH_INDEFINITE); mSnackbarLoadNewMap.setAction(getString(R.string.snackbar_action_text_load_new_map), new View.OnClickListener() { @Override public void onClick(View view) { try { mParameterNode.changeSettingsToLocalizeInMap(mapUuid, getString(R.string.pref_create_new_map_key), getString(R.string.pref_localization_mode_key), getString(R.string.pref_localization_map_uuid_key)); restartTango(); } catch (RuntimeException e) { e.printStackTrace(); } } }); mSnackbarLoadNewMap.show(); } }); } else { Log.e(TAG, "Error while saving map: " + message); displayToastMessage(R.string.save_map_error); } }
From source file:com.sjc.cc.login.action.LoginAction.java
/** * ??/*from w w w . j a v a 2s. c o m*/ * * @return * @exception Exception can be thrown by subclasses. */ public String welBackcome() throws Exception { try { HttpServletRequest request = ServletActionContext.getRequest(); LoginUserInfo user = LoginUserInfoHolder.getInstance().getCurrentUser(); if (null != user) { LoginInfo loginInfo = backHomeService.getLoginInfo(user); request.setAttribute("loginInfo", loginInfo); } SystemInfo systemInfo = backHomeService.getSystemInfo(request); request.setAttribute("systemInfo", systemInfo); /* * TechnicalSupport technicalSupport = backHomeService * .getTechnicalSupport(); request.setAttribute("technicalSupport", * technicalSupport); */ ApplicationStatistics appStats = backHomeService.getApplicationStatistics(); request.setAttribute("appStats", appStats); TaskStatistics taskStats = backHomeService.getTaskStatistics(); request.setAttribute("taskStats", taskStats); ResourceStatistics resourceStats = backHomeService.getResourceStatistics(); request.setAttribute("resourceStats", resourceStats); } catch (RuntimeException e) { e.printStackTrace(); } return "welcomebackPage"; }
From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_CANCELED) { // Result code returned when back button is pressed. // Upload new settings to parameter server. if ((requestCode == StartSettingsActivityRequest.STANDARD_RUN || requestCode == StartSettingsActivityRequest.FIRST_RUN) && mParameterNode != null) { try { mParameterNode.uploadPreferencesToParameterServer(); } catch (RuntimeException e) { e.printStackTrace(); }/*from w ww. jav a 2 s. com*/ } if (data != null && data.getBooleanExtra(RESTART_TANGO, false)) { restartTango(); } if (requestCode == StartSettingsActivityRequest.FIRST_RUN) { mRunLocalMaster = mSharedPref.getBoolean(getString(R.string.pref_master_is_local_key), false); mMasterUri = mSharedPref.getString(getString(R.string.pref_master_uri_key), getResources().getString(R.string.pref_master_uri_default)); mUriTextView.setText(mMasterUri); String logFileName = mSharedPref.getString(getString(R.string.pref_log_file_key), getString(R.string.pref_log_file_default)); mLogger.setLogFileName(logFileName); mLogger.start(); getTangoPermission(EXTRA_VALUE_ADF, REQUEST_CODE_ADF_PERMISSION); getTangoPermission(EXTRA_VALUE_DATASET, REQUEST_CODE_DATASET_PERMISSION); updateLoadAndSaveMapButtons(); } else if (requestCode == StartSettingsActivityRequest.STANDARD_RUN) { // It is ok to change the log file name at runtime. String logFileName = mSharedPref.getString(getString(R.string.pref_log_file_key), getString(R.string.pref_log_file_default)); mLogger.setLogFileName(logFileName); if (mRosStatus == RosStatus.MASTER_NOT_CONNECTED && mSnackbarRosReconnection != null) { // Show snackbar with ROS reconnection button. // It was dismissed when switching to the SettingsActivity. mSnackbarRosReconnection.show(); } } } if (requestCode == REQUEST_CODE_ADF_PERMISSION || requestCode == REQUEST_CODE_DATASET_PERMISSION) { if (resultCode == RESULT_CANCELED) { // No Tango permissions granted by the user. displayToastMessage(R.string.tango_permission_denied); } if (requestCode == REQUEST_CODE_ADF_PERMISSION) { // The user answered the ADF permission popup (the permission has not been necessarily granted). mAdfPermissionHasBeenAnswered = true; } if (requestCode == REQUEST_CODE_DATASET_PERMISSION) { // The user answered the dataset permission popup (the permission has not been necessarily granted). mDatasetPermissionHasBeenAnswered = true; } if (mAdfPermissionHasBeenAnswered && mDatasetPermissionHasBeenAnswered) { // Both ADF and dataset permissions popup have been answered by the user, the node // can start. Log.i(TAG, "initAndStartRosJavaNode"); initAndStartRosJavaNode(); } } }
From source file:ai.grakn.test.graql.analytics.AnalyticsTest.java
@Test public void testNullResourceDoesntBreakAnalytics() throws GraknValidationException { // TODO: Fix on TinkerGraphComputer assumeFalse(usingTinker());//from ww w .j ava 2 s.c o m // make slightly odd graph String resourceTypeId = "degree"; EntityType thing = graph.putEntityType("thing"); graph.putResourceType(resourceTypeId, ResourceType.DataType.LONG); RoleType degreeOwner = graph.putRoleType(Schema.Resource.HAS_RESOURCE_OWNER.getName(resourceTypeId)); RoleType degreeValue = graph.putRoleType(Schema.Resource.HAS_RESOURCE_VALUE.getName(resourceTypeId)); RelationType relationType = graph.putRelationType(Schema.Resource.HAS_RESOURCE.getName(resourceTypeId)) .hasRole(degreeOwner).hasRole(degreeValue); thing.playsRole(degreeOwner); Entity thisThing = thing.addEntity(); relationType.addRelation().putRolePlayer(degreeOwner, thisThing); graph.commit(); Analytics analytics = new Analytics(graph.getKeyspace(), new HashSet<>(), new HashSet<>()); // the null role-player caused analytics to fail at some stage try { analytics.degreesAndPersist(); } catch (RuntimeException e) { e.printStackTrace(); fail(); } }
From source file:org.sakaiproject.tool.assessment.business.questionpool.QuestionPoolTreeImpl.java
/** * Constucts the representation of the tree of pools. * @param iter QuestionPoolIteratorFacade for the pools in question *//*from w w w . j a va 2s . c om*/ public QuestionPoolTreeImpl(QuestionPoolIteratorFacade iter) { // this is a table of pools by Id poolMap = new HashMap(); // this is a cross reference of pool ids by parent id // the pool ids in an Arraylist where the key is parent id poolFamilies = new HashMap(); try { while (iter.hasNext()) { QuestionPoolFacade pool = (QuestionPoolFacade) iter.next(); Long parentId = pool.getParentPoolId(); Long poolId = pool.getQuestionPoolId(); poolMap.put(poolId.toString(), pool); ArrayList childList = new ArrayList(); if (poolFamilies.containsKey(parentId.toString())) { childList = (ArrayList) poolFamilies.get(parentId.toString()); } childList.add(poolId); poolFamilies.put(parentId.toString(), childList); } // Now sort the sibling lists. Iterator iter2 = poolFamilies.keySet().iterator(); while (iter2.hasNext()) { String key = (String) iter2.next(); Iterator children = ((ArrayList) poolFamilies.get(key)).iterator(); Collection sortedList = new ArrayList(); while (children.hasNext()) { QuestionPoolFacade pool = (QuestionPoolFacade) poolMap.get(children.next().toString()); sortedList.add(pool.getData()); } BeanSort sort = new BeanSort(sortedList, sortString); sortedList = sort.sort(); ArrayList ids = new ArrayList(); Iterator siblings = sortedList.iterator(); while (siblings.hasNext()) { QuestionPoolData next = null; try { next = (QuestionPoolData) siblings.next(); if (poolMap != null) { // Add at 0 because we want a reverse list. if ("lastModified".equals(sortString)) { ids.add(0, ((QuestionPoolFacade) poolMap.get(next.getQuestionPoolId().toString())) .getQuestionPoolId()); } // Add to the end of list if not sorted by lastModified. else { ids.add(((QuestionPoolFacade) poolMap.get(next.getQuestionPoolId().toString())) .getQuestionPoolId()); } } else { log.error("poolMap is null"); } } catch (RuntimeException e) { log.error("Couldn't get ID " + next.getQuestionPoolId()); } } poolFamilies.put(key, ids); } } catch (SharedException se) { se.printStackTrace(); } catch (RuntimeException e) { e.printStackTrace(); } }
From source file:terse.vm.Terp.java
public void tick() { --tickCounter;// w ww . java2s .co m if (tickCounter < 1) { try { throw new RuntimeException("Going To Throw TooManyTicks"); } catch (RuntimeException ex) { ex.printStackTrace(); StringBuffer sb = new StringBuffer(ex.toString()); StackTraceElement[] elems = ex.getStackTrace(); for (StackTraceElement e : elems) { sb.append("\n * "); sb.append(e.toString()); } say(sb.toString()); } throw new TooManyTicks(); } }
From source file:com.sjc.cc.login.action.LoginAction.java
public String index() throws Exception { try {/*from w w w . ja v a2 s .c o m*/ HttpServletRequest request = ServletActionContext.getRequest(); LoginUserInfo loginUserInfo = LoginUserInfoHolder.getInstance().getCurrentUser(); List<FrontViewVO> list = new ArrayList<FrontViewVO>(); FrontViewVO vo = new FrontViewVO(); // List<Map<String, Long>> // maplist=loginService.validateUserRole(loginUserInfo.getUserPartyId()); List<FrontViewVO> flist = new ArrayList<FrontViewVO>(); List<ResrcreleaseVO> rlist = new ArrayList<ResrcreleaseVO>(); /** ?? ******************************************** */ TccRole tccRole = new TccRole(); tccRole = loginService.getRoleById(loginUserInfo.getCurrentRoleid()); if (null == tccRole) { return "callManagePage"; } List<RoleVO> roleList = loginUserInfo.getRoleList(); RoleVO roleVo = new RoleVO(); if (roleList != null && roleList.size() >= 1) { for (int k = 0; k < roleList.size(); k++) { roleVo = roleList.get(k); if (roleVo.getRoleTypeCd().equalsIgnoreCase(String.valueOf(tccRole.getRoleTypeCd()))) { roleList.remove(k); break; } } roleList.add(0, roleVo); } loginUserInfo.setRoleList(roleList); //TODO // tccRole = loginService.getTccRoleByUserID(loginUserInfo // .getUserPartyId()); if (tccRole.getRoleTypeCd() == null) { vo.setUserFlag("0"); } else { vo.setUserFlag(tccRole.getRoleTypeCd()); vo.setRoleID(tccRole.getRoleId()); } // ????? if ("112".equals(tccRole.getRoleTypeCd()) || "113".equals(tccRole.getRoleTypeCd())) { flist = loginService.getAppResource("2", loginUserInfo.getUserPartyId()); // list = loginService.getHostResource("2", loginUserInfo // .getUserPartyId()); } if ("111".equals(tccRole.getRoleTypeCd()) || "116".equals(tccRole.getRoleTypeCd()) || "115".equals(tccRole.getRoleTypeCd())) { flist = loginService.getAppResource("1", loginUserInfo.getUserPartyId()); // list = loginService.getHostResource("1", loginUserInfo // .getUserPartyId()); rlist = loginService.getProjectResource(loginUserInfo.getUserPartyId(), 5); } list = loginService.getHostResourceWithRole(tccRole.getRoleTypeCd(), loginUserInfo.getUserPartyId()); request.setAttribute("flist", flist); request.setAttribute("vo", vo); request.setAttribute("env", parametersValueService.getParametersValuesByClassficationId("135")); request.setAttribute("list", list); request.setAttribute("rlist", rlist); List list2 = actAssignmentService.getPersonalAndGrpActivityCount( LoginUserInfoHolder.getInstance().getCurrentUser().getUserPartyId()); ActivityAlertInfo activityAlertInfo = new ActivityAlertInfo(); if (null != list2) { activityAlertInfo.setGrpActCount(new Long(list2.get(0).toString())); activityAlertInfo.setPersonalStartActCount(new Long(list2.get(1).toString())); activityAlertInfo.setPersonalProcessActCount(new Long(list2.get(2).toString())); activityAlertInfo.setProcessiongSrtCount(new Long(list2.get(3).toString())); activityAlertInfo.setDoneSrtCount(new Long(list2.get(4).toString())); page = new ViewPage(); page.setPageSize(5);//?? if ("111".equals(tccRole.getRoleTypeCd())) { //?? page = resrcReleaseService.getReleaseOfResource3(page, "", "1", "3", loginUserInfo.getUserPartyId(), loginUserInfo.getCurrentRoleid(), 0); activityAlertInfo.setCreateApplyResource(new Long(page.getTotalSize())); page = resrcReleaseService.getReleaseOfResource3(page, "", "1", "0", loginUserInfo.getUserPartyId(), loginUserInfo.getCurrentRoleid(), 1); activityAlertInfo.setMyApplyResource(new Long(page.getTotalSize())); } else if ("113".equals(tccRole.getRoleTypeCd())) { //?? page = resrcReleaseService.getReleaseOfResource3(page, "", "0", "3", loginUserInfo.getUserPartyId(), loginUserInfo.getCurrentRoleid(), 0); activityAlertInfo.setCreateApplyResource(new Long(page.getTotalSize())); page = resrcReleaseService.getReleaseOfResource3(page, "", "0", "2", loginUserInfo.getUserPartyId(), loginUserInfo.getCurrentRoleid(), 0); activityAlertInfo.setReleaseApplyResource(new Long(page.getTotalSize())); } } /* //??? List<ResrcreleaseVO> vmList=new ArrayList<ResrcreleaseVO>(); if("111".equals(tccRole.getRoleTypeCd())||"113".equals(tccRole.getRoleTypeCd())){ //? ViewPage vmPage=new ViewPage(); vmPage.setPageSize(5);//?? vmPage=resrcReleaseService.getReleaseOfResource3(vmPage, "", "1", "", loginUserInfo.getUserPartyId(), loginUserInfo.getCurrentRoleid()); }*/ request.setAttribute("activityAlertInfo", activityAlertInfo); if ("112".equals(tccRole.getRoleTypeCd())) { request.setAttribute("analysisResult", getAnalysisResult()); } if ("112".equals(tccRole.getRoleTypeCd()) || "113".equals(tccRole.getRoleTypeCd()) || "111".equals(tccRole.getRoleTypeCd()) || "115".equals(tccRole.getRoleTypeCd()) || "116".equals(tccRole.getRoleTypeCd()) ) { return "welcomePage"; } else { return "callManagePage"; } } catch (RuntimeException e) { e.printStackTrace(); } return null; }
From source file:org.mycard.net.network.LoadListener.java
private void doRedirect() { // as cancel() can cancel the load before doRedirect() is // called through handleMessage, needs to check to see if we // are canceled before proceed if (mCancelled) { return;//w w w. java 2s . co m } String redirectTo = mHeaders.getLocation(); if (redirectTo.length() > 5 && redirectTo.substring(0, 5).compareToIgnoreCase("https") == 0) { HttpTaskEventArg arg = new HttpTaskEventArg(); arg.mErrorId = HttpTaskListener.ERROR_UNSUPPORTED_SCHEME; mTaskListener.onHttpTaskEvent(m_taskid, HttpTaskListener.HTTPTASK_EVENT_FAIL, arg); return; } // Do the same check for a redirect loop that // RequestHandle.setupRedirect does. if (mCacheRedirectCount >= RequestHandle.MAX_REDIRECT_COUNT) { return; } if (redirectTo != null) { // nativeRedirectedToUrl() may call cancel(), e.g. when redirect // from a https site to a http site, check mCancelled again if (mCancelled) { return; } if (redirectTo == null) { //Log.d(LOGTAG, "Redirection failed for " // + mHeaders.getLocation()); cancel(); return; } else if (!URLUtil.isNetworkUrl(redirectTo)) { clearNativeLoader(); return; } if (mOriginalUrl == null) { mOriginalUrl = mUrl; } // This will strip the anchor setUrl(redirectTo); // Redirect may be in the cache if (mRequestHeaders == null) { mRequestHeaders = new HashMap<String, String>(); } // mRequestHandle can be null when the request was satisfied // by the cache, and the cache returned a redirect if (mRequestHandle != null) { try { mRequestHandle.setupRedirect(mUrl, mStatusCode, mRequestHeaders); } catch (RuntimeException e) { e.printStackTrace(); HttpTaskEventArg arg = new HttpTaskEventArg(); arg.mErrorId = HttpTaskListener.ERROR_BAD_URL; mTaskListener.onHttpTaskEvent(m_taskid, HttpTaskListener.HTTPTASK_EVENT_FAIL, arg); } } else { // If the original request came from the cache, there is no // RequestHandle, we have to create a new one through // Network.requestURL. Network network = Network.getInstance(getContext()); if (!network.requestURL(mMethod, mRequestHeaders, mPostData, this)) { HttpTaskEventArg arg = new HttpTaskEventArg(); arg.mErrorId = HttpTaskListener.ERROR_BAD_URL; mTaskListener.onHttpTaskEvent(m_taskid, HttpTaskListener.HTTPTASK_EVENT_FAIL, arg); return; } } HttpTaskEventArg arg = new HttpTaskEventArg(); arg.buffer = mUrl.getBytes(); mTaskListener.onHttpTaskEvent(m_taskid, HttpTaskListener.HTTPTASK_EVENT_REDIRECT, arg); } else { commitHeaders(); commitLoad(); tearDown(); } }
From source file:com.cellbots.logger.LoggerActivity.java
private void cleanup() { boolean wasRecording = false; try {/* w ww .java2 s . c om*/ mGpsManager.shutdown(); synchronized (mIsRecording) { wasRecording = mIsRecording; if (!mIsRecording) { cleanupEmptyFiles(); } if (mCamcorderView != null) { if (mIsRecording) { mCamcorderView.stopRecording(); } mCamcorderView.releaseRecorder(); } if (mCameraView != null) { if (mIsRecording) { mCameraView.stop(); } mCameraView.releaseCamera(); } mIsRecording = false; } startRecTime = 0; ((ImageButton) findViewById(R.id.button_record)).setImageResource(R.drawable.rec_button_up); if (mRecTimeTextView != null) { mRecTimeTextView.setText(R.string.start_rec_time); } } catch (RuntimeException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { closeFiles(); if (wasRecording) { if (mRemoteControl != null) mRemoteControl.broadcastMessage("*** Recording Stopped ***\n"); showDialog(PROGRESS_ID); } } }