List of usage examples for java.lang RuntimeException printStackTrace
public void printStackTrace()
From source file:com.mbv.web.rest.controller.VpGdnController.java
/** * @????/*from ww w .j ava2s. c om*/ * @author gel * @2015827 * @param * @version * @throws Exception */ @RequestMapping(value = "/saveVpGdn", method = RequestMethod.POST) @ResponseBody public void addSysParam(@RequestBody VpGdnVo vo, HttpServletResponse response) throws Exception { // vo if (vo == null) { throw new MbvException("???"); } // ?? VpGdnEntity VpGdnEntity = vo.getEntity(); if (VpGdnEntity == null) { throw new MbvException("???"); } try { // ?? String errMessage = vpGdnService.validate(VpGdnEntity); if (errMessage != null && !"".equals(errMessage)) { throw new MbvException(errMessage); } List<VpGdnDtlEntity> details = vo.getDetails(); // ???? errMessage = vpGdnService.validateDetail(VpGdnEntity, details); if (errMessage != null && !"".equals(errMessage)) { throw new MbvException(errMessage); } // service? boolean isSuccess = vpGdnService.addVpGdn(VpGdnEntity, details, null); Map<String, Object> map = new HashMap<String, Object>(); map.put("result", isSuccess); // ?? returnSuccess(response, map); } catch (MbvException me) { me.printStackTrace(); throw new MbvException(me.getMessage()); } catch (RuntimeException re) { re.printStackTrace(); throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP); } catch (Exception e) { e.printStackTrace(); throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP); } }
From source file:org.alfresco.repo.tagging.UpdateTagScopesActionExecuter.java
/** * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) */// w w w. j av a 2 s . com @Override @SuppressWarnings("unchecked") protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) { try { // Grab the list of tag scopes to work on List<NodeRef> tagScopeNodes = (List<NodeRef>) action.getParameterValue(PARAM_TAG_SCOPES); if (logger.isDebugEnabled()) { logger.debug("About to process tag scope updates for scopes " + tagScopeNodes); } // Process each tag scope in turn for (NodeRef tmpTagScope : tagScopeNodes) { final NodeRef tagScope = tmpTagScope; // Try for an exclusive tagging lock on the tag scope // If someone else already has the lock, then we don't need // to worry as they'll handle the update for us! try { String lock = lockTagScope(tagScope); // If we got here, we're the only thread currently // processing this tag scope if (logger.isDebugEnabled()) { logger.debug("Locked tag scope " + tagScope + " for updates"); } // Grab all the pending work in chunks, and process AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() { public Void doWork() throws Exception { final MutableInt updatesRemain = new MutableInt(1); while (updatesRemain.intValue() > 0) { transactionService.getRetryingTransactionHelper() .doInTransaction(new RetryingTransactionCallback<Void>() { public Void execute() throws Throwable { // Search for updates Map<String, Integer> updates = new HashMap<String, Integer>(); List<Long> entryIds = searchForUpdates(tagScope, updates); // Log what we found if (logger.isDebugEnabled()) { if (updates.size() > 0) { logger.debug("Found updates for tag scope " + tagScope + " : " + updates); } else if (updatesRemain.intValue() > 1) { logger.debug("All updates now processed for tag scope " + tagScope); } else { logger.debug("No updates needed for tag scope " + tagScope); } } // Does any work remain? if (entryIds.size() == 0) { updatesRemain.setValue(0); return null; } updatesRemain.setValue(updatesRemain.intValue() + 1); // Update the tags performUpdates(tagScope, updates); // Mark these entries as finished with markUpdatesPerformed(entryIds); // Done for now return null; } }, false, true); } // We're done searching+updating for this tag scope return null; } }, AuthenticationUtil.getSystemUserName()); // We're done with this tag scope unlockTagScope(tagScope, lock); } catch (LockAcquisitionException e) { if (logger.isDebugEnabled()) { logger.debug("Tag scope " + tagScope + " is already being processed by another action, skipping"); } } // Now proceed to the next tag scope } } catch (RuntimeException exception) { exception.printStackTrace(); throw new RuntimeException("Unable to update the tag scopes.", exception); } }
From source file:com.maogousoft.wuliu.controller.DriverController.java
/** * /*from w ww . j ava 2s .c om*/ * @description ?? * @author shevliu * @email shevliu@gmail.com * Mar 17, 2013 5:01:12 PM */ public void queryValidList() { try { query(Driver.STATUS_VALID); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.umit.icm.mobile.gui.ControlActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.controlactivity); WebsiteSuggestButton = (Button) this.findViewById(R.id.suggestWebsite); ServiceSuggestButton = (Button) this.findViewById(R.id.suggestService); scanButton = (Button) this.findViewById(R.id.scanButton); // filterButton = (Button) this.findViewById(R.id.filterButton); // servicesFilterButton = (Button) this.findViewById(R.id.serviceFilterButton); mapSelectionButton = (Button) this.findViewById(R.id.mapSelectionButton); enableTwitterButton = (Button) this.findViewById(R.id.enableTwitterButton); bugReportButton = (Button) this.findViewById(R.id.bugReportButton); aboutButton = (Button) this.findViewById(R.id.aboutButton); scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_off)); try {//from www . ja v a 2 s.com if (Globals.runtimeParameters.getTwitter().equals("Off")) { enableTwitterButton.setText(getString(R.string.enable_twitter_button)); } else { enableTwitterButton.setText(getString(R.string.disable_twitter_button)); } } catch (RuntimeException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals("org.umit.icm.mobile.CONTROL_ACTIVITY")) { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_on)); } } }; registerReceiver(receiver, new IntentFilter("org.umit.icm.mobile.CONTROL_ACTIVITY")); WebsiteSuggestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { WebsiteSuggestionDialog websiteSuggestionDialog = new WebsiteSuggestionDialog(ControlActivity.this, "", new OnReadyListener()); websiteSuggestionDialog.show(); } }); ServiceSuggestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { ServiceSuggestionDialog suggestionDialog = new ServiceSuggestionDialog(ControlActivity.this, "", new OnReadyListener()); suggestionDialog.show(); } }); enableTwitterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { if (Globals.runtimeParameters.getTwitter().equals("Off")) { progressDialog = ProgressDialog.show(ControlActivity.this, getString(R.string.loading), getString(R.string.retrieving_website), true, false); new LaunchBrowser().execute(); TwitterDialog twitterDialog = new TwitterDialog(ControlActivity.this, ""); twitterDialog.show(); enableTwitterButton.setText(getString(R.string.disable_twitter_button)); } else { Globals.runtimeParameters.setTwitter("Off"); enableTwitterButton.setText(getString(R.string.enable_twitter_button)); } } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); mapSelectionButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { MapSelectionDialog MapSelectionDialog = new MapSelectionDialog(ControlActivity.this, ""); MapSelectionDialog.show(); } }); /* filterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, WebsiteFilterActivity.class); startActivity(intent); } } ); servicesFilterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, ServiceFilterActivity.class); startActivity(intent); } } );*/ bugReportButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, BugReportActivity.class); startActivity(intent); } }); aboutButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { String msg = getString(R.string.about_text) + "\n" + getString(R.string.link_to_open_monitor) + "\n" + getString(R.string.link_to_umit) + "\n" + getString(R.string.icons_by); final SpannableString spannableString = new SpannableString(msg); Linkify.addLinks(spannableString, Linkify.ALL); AlertDialog alertDialog = new AlertDialog.Builder(ControlActivity.this).create(); alertDialog.setTitle(getString(R.string.about_button)); alertDialog.setMessage(spannableString); alertDialog.setIcon(R.drawable.umit_128); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); } }); scanButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (Globals.scanStatus.equalsIgnoreCase(getString(R.string.scan_on))) { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_on)); Globals.scanStatus = getString(R.string.scan_off); stopService(new Intent(ControlActivity.this, ConnectivityService.class)); } else { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_off)); Globals.scanStatus = getString(R.string.scan_on); startService(new Intent(ControlActivity.this, ConnectivityService.class)); } try { Globals.runtimeParameters.setScanStatus(Globals.scanStatus); } catch (RuntimeException e) { e.printStackTrace(); } Context context = getApplicationContext(); CharSequence text = getString(R.string.toast_scan_change) + " " + Globals.scanStatus; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); }
From source file:tf.nox.wifisetup.WifiSetup.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.logon);// w w w. j ava 2 s. c o m flipper = (ViewFlipper) findViewById(R.id.viewflipper); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); check5g = (CheckBox) findViewById(R.id.check5g); check5g.setChecked(true); /* TextView label5g = (TextView) findViewById(R.id.label5g); if (android.os.Build.VERSION.SDK_INT >= 21) { check5g.setChecked(get5G()); label5g.setText("(autodetected value)"); } else { check5g.setChecked(true); label5g.setText("(Android 5.0 is needed to autodetect this)"); } */ ImageView img = (ImageView) findViewById(R.id.logo); img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { logoclicks++; if (logoclicks == 4) { toastText("You're cute!"); } if (logoclicks == 6) { toastText("Stop that!"); } if (logoclicks == 7) { View logindata = findViewById(R.id.logindata); logindata.setVisibility(View.VISIBLE); } } }); btn = (Button) findViewById(R.id.button1); if (btn == null) throw new RuntimeException("button1 not found. Odd"); btn.setOnClickListener(new Button.OnClickListener() { public void onClick(View _v) { if (busy) { return; } busy = true; _v.setClickable(false); // Most of this stuff runs in the background Thread t = new Thread() { @Override public void run() { try { if (android.os.Build.VERSION.SDK_INT >= 18) { saveWifiConfig(); resultStatus(true, "You should now have a wifi connection entry with correct security settings and certificate verification.\n\nMake sure to actually use it!"); // Clear the password field in the UI thread /* mHandler.post(new Runnable() { @Override public void run() { password.setText(""); }; }); */ } else { throw new RuntimeException("What version is this?! API Mismatch"); } } catch (RuntimeException e) { resultStatus(false, "Something went wrong: " + e.getMessage()); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } busy = false; mHandler.post(new Runnable() { @Override public void run() { btn.setClickable(true); }; }); } }; t.start(); } }); }
From source file:com.l2jfree.network.mmocore.ReadWriteThread.java
private void closeConnectionImpl(T con, boolean forced) { try {/* w w w. j a va2s . c om*/ if (forced) con.onForcedDisconnection(); } catch (RuntimeException e) { e.printStackTrace(); } try { // notify connection con.onDisconnection(); } catch (RuntimeException e) { e.printStackTrace(); } finally { try { // close socket and the SocketChannel IOUtils.closeQuietly(con.getSocket()); } finally { con.releaseBuffers(); // clear attachment con.getSelectionKey().attach(null); // cancel key con.getSelectionKey().cancel(); } } }
From source file:com.mbv.web.rest.controller.VpGdnController.java
/** * @??//from ww w . jav a2s. com * @201596 * @param * @version * @throws MbvException */ @RequestMapping(value = "/queryByParams", method = RequestMethod.POST) @ResponseBody public JqGridBaseEntityVo<VpGdnEntity> queryByParams(JqGridBaseEntityVo<VpGdnEntity> entity, VpGdnVo vo, HttpServletRequest request, HttpServletResponse response) throws MbvException { String warehCode = request.getSession().getAttribute(MbvConstant.WAREH_CODE).toString(); String unitCode = request.getSession().getAttribute(MbvConstant.UNIT_CODE).toString(); if (unitCode == null || "".equals(unitCode) || warehCode == null || "".equals(warehCode)) { throw new MbvException("Session?????"); } if (vo == null) { vo = new VpGdnVo(); VpGdnBean bean = new VpGdnBean(); bean.setWarehCode(warehCode); bean.setUnitCode(unitCode); vo.setBean(bean); } else { if (vo.getBean() == null) { VpGdnBean bean = new VpGdnBean(); bean.setWarehCode(warehCode); bean.setUnitCode(unitCode); vo.setBean(bean); } else { vo.getBean().setWarehCode(warehCode); vo.getBean().setUnitCode(unitCode); } } String dispTime1 = vo.getBean().getDispTime1(); String dispTime2 = vo.getBean().getDispTime2(); if (StringUtils.isNotEmpty(dispTime1) && StringUtils.isNotEmpty(dispTime2)) { vo.getBean().setDispTime2(dispTime2 + " 23:59:59"); } else if (StringUtils.isNotEmpty(dispTime1) && StringUtils.isEmpty(dispTime2)) { if (dispTime1.length() == 7) { vo.getBean().setQueryMonth(dispTime1); } else if (dispTime1.length() == 10) { vo.getBean().setQueryDay(dispTime1); } } else if (StringUtils.isNotEmpty(dispTime2) && StringUtils.isEmpty(dispTime1)) { if (dispTime2.length() == 7) { vo.getBean().setQueryMonth(dispTime2); vo.getBean().setDispTime2(""); } else if (dispTime2.length() == 10) { vo.getBean().setQueryDay(dispTime2); vo.getBean().setDispTime2(""); } } log.info("dispTime1:" + vo.getBean().getDispTime1()); log.info("dispTime2:" + vo.getBean().getDispTime2()); List<VpGdnEntity> list = new ArrayList<VpGdnEntity>(); try { // ? int totalCount = this.vpGdnService.queryByParamsCount(vo.getBean()); log.info("totalCount:" + totalCount); // ? if (totalCount > 0) { // ? int offset = (entity.getPage() - 1) * entity.getRows(); int limit = entity.getRows(); // ?? list = this.vpGdnService.queryByParams(vo.getBean(), offset, limit); // ? JqGridPagesUtils.setPagingParams(entity, list, totalCount); } // return entity; } catch (MbvException me) { me.printStackTrace(); throw new MbvException(me.getMessage()); } catch (RuntimeException re) { re.printStackTrace(); throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP); } catch (Exception e) { e.printStackTrace(); throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP); } }
From source file:com.addthis.hydra.data.query.QueryElementNode.java
public Iterator<DataTreeNode> getNodes(LinkedList<DataTreeNode> stack) { List<DataTreeNode> ret = null; if (up()) {// w w w.j a v a 2 s . co m ret = new ArrayList<>(1); ret.add(stack.get(1)); return ret.iterator(); } DataTreeNode parent = stack.peek(); DataTreeNode defaultNode = null; if (defaultValue != null) { defaultNode = new VirtualTreeNode(defaultValue, defaultHits); } try { DataTreeNode tmp; if (path != null) { DataTreeNode refnode = followPath(parent.getTreeRoot(), path); return refnode != null ? new ReferencePathIterator(refnode, parent) : null; } if (trap != null) { for (String name : trap) { for (ClosableIterator<DataTreeNode> iter = parent.getIterator(); iter.hasNext();) { tmp = iter.next(); if (regex()) { if (tmp.getName().matches(name)) { iter.close(); return null; } } else { if (tmp.getName().equals(name)) { iter.close(); return null; } } } } } if ((match == null) && (regex == null) && (data == null)) { Iterator<DataTreeNode> result = parent.getIterator(); if (result.hasNext() || (defaultNode == null)) { return result; } else { return Iterators.singletonIterator(defaultNode); } } ret = new LinkedList<>(); if (match != null) { if (regex()) { if (regexPatterns == null) { regexPatterns = new Pattern[match.length]; for (int i = 0; i < match.length; i++) { regexPatterns[i] = Pattern.compile(match[i]); } } for (Iterator<DataTreeNode> iter = parent.getIterator(); iter.hasNext();) { tmp = iter.next(); for (Pattern name : regexPatterns) { if (name.matcher(tmp.getName()).matches() ^ not()) { ret.add(tmp); } } } } else if (range()) { if (match.length == 0) { return parent.getIterator(); } else if (match.length == 1) { return parent.getIterator(match[0]); } else { ArrayList<Iterator<DataTreeNode>> metaIterator = new ArrayList<>(); for (String name : match) { metaIterator.add(parent.getIterator(name)); } return Iterators.concat(metaIterator.iterator()); } } else if (rangeStrict()) { return parent.getIterator(match.length > 0 ? match[0] : null, match.length > 1 ? match[1] : null); } else if (data == null) { return new LazyNodeMatch(parent, match, defaultNode); } else { for (String name : match) { DataTreeNode find = parent.getNode(name); if (find != null) { ret.add(find); } } } } if (data != null) { if (regex()) { if (parent.getDataMap() != null) { for (Map.Entry<String, TreeNodeData> actor : parent.getDataMap().entrySet()) { int memSize = CodecBin2.encodeBytes(actor.getValue()).length; ReadTreeNode memNode = new ReadTreeNode(actor.getKey(), memSize); ret.add(memNode); } } } else { DataTreeNodeActor actor = parent.getData(data); if (actor != null) { Collection<DataTreeNode> nodes = actor.onNodeQuery(dataKey); if (nodes != null) { ret.addAll(nodes); } } } } } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { ex.printStackTrace(); } if ((ret.size() == 0) && (defaultNode != null)) { return Iterators.singletonIterator(defaultNode); } else { return ret.iterator(); } }
From source file:com.pushwoosh.plugin.pushnotifications.PushNotifications.java
private boolean internalRegister(JSONArray data, CallbackContext callbackContext) { try {/*from ww w. java 2s . c o m*/ callbackIds.put("registerDevice", callbackContext); mPushManager.registerForPushNotifications(); } catch (java.lang.RuntimeException e) { callbackIds.remove("registerDevice"); e.printStackTrace(); callbackContext.error(e.getMessage()); return true; } checkMessage(cordova.getActivity().getIntent()); return true; }
From source file:org.corpus_tools.pepper.impl.BeforeAfterAction.java
/** * Renames all annotations matching the search template to the new * namespace, name or value. To rename an annotation, use the following * syntax://from w w w .j av a 2 s . c om * "old_namespace::old_name=old_value := new_namespace::new_name=new_value", * determining the name is mandatory whereas the namespace and value are * optional. For instance a pos annotation can be renamed as follows: * "salt::pos:=part-of-speech". A list of renamings must be separated with * ";". * * @param id * identifying the current object */ public void renameAnnotations(Identifier id, String renameTemplate) { if (id != null && id.getIdentifiableElement() != null) { try { Map<String[], String[]> renamingMap = new HashMap<>(); // split all single renaming strings String[] renamings = renameTemplate.split(";"); for (String renaming : renamings) { String[] parts = renaming.split(":="); if (parts.length == 2) { renamingMap.put(SaltUtil.unmarshalAnnotation(parts[0]).iterator().next(), SaltUtil.unmarshalAnnotation(parts[1]).iterator().next()); } else if (parts.length == 1) { renamingMap.put(SaltUtil.unmarshalAnnotation(parts[0]).iterator().next(), null); } } SDocument document = (SDocument) id.getIdentifiableElement(); // rename all annotations of nodes Iterator<SAnnotationContainer> it = (Iterator<SAnnotationContainer>) (Iterator<? extends SAnnotationContainer>) document .getDocumentGraph().getNodes().iterator(); rename(it, renamingMap); // rename all annotations of relations it = (Iterator<SAnnotationContainer>) (Iterator<? extends SAnnotationContainer>) document .getDocumentGraph().getRelations().iterator(); rename(it, renamingMap); } catch (RuntimeException e) { e.printStackTrace(); logger.warn("Cannot rename labels in object '{}', because of a nested exeption '{}'. ", id, e.getMessage()); } } }