List of usage examples for java.lang Exception getStackTrace
public StackTraceElement[] getStackTrace()
From source file:net.sf.l2j.gameserver.model.entity.L2JOneoRusEvents.CTF.java
public static void showFlagHtml(L2PcInstance eventPlayer, String objectId, String teamName) { if (eventPlayer == null) return;/*from w ww. ja v a 2s . co m*/ try { NpcHtmlMessage adminReply = new NpcHtmlMessage(5); TextBuilder replyMSG = new TextBuilder("<html><head><body><center>"); replyMSG.append("CTF Flag<br><br>"); replyMSG.append("<font color=\"00FF00\">" + teamName + "'s Flag</font><br1>"); if (eventPlayer._teamNameCTF != null && eventPlayer._teamNameCTF.equals(teamName)) replyMSG.append("<font color=\"LEVEL\">This is your Flag</font><br1>"); else replyMSG.append("<font color=\"LEVEL\">Enemy Flag!</font><br1>"); if (_started) { processInFlagRange(eventPlayer); } else replyMSG.append("CTF match is not in progress yet.<br>Wait for a GM to start the event<br>"); replyMSG.append("</center></body></html>"); adminReply.setHtml(replyMSG.toString()); eventPlayer.sendPacket(adminReply); } catch (Exception e) { System.out.println("" + "CTF Engine[showEventHtlm(" + eventPlayer.getName() + ", " + objectId + ")]: exception: " + e.getStackTrace()); } }
From source file:br.liveo.searchliveo.SearchCardLiveo.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void showAnimation() { try {//from ww w . jav a2s . c o m if (getStatusBarShowColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarShowColor()); } else { mContext.getWindow() .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark)); } final Animator animator = ViewAnimationUtils.createCircularReveal(mCardSearch, mCardSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext), 0, (float) Math.hypot(mCardSearch.getWidth(), mCardSearch.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.setDuration(300); animator.start(); } catch (Exception e) { e.getStackTrace(); mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } mCardSearch.setVisibility(View.VISIBLE); }
From source file:br.liveo.searchliveo.SearchLiveo.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void showAnimation() { try {//from w w w .ja va2s . c om if (getStatusBarShowColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarShowColor()); } else { mContext.getWindow() .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark)); } final Animator animator = ViewAnimationUtils.createCircularReveal(mViewSearch, mViewSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext), 0, (float) Math.hypot(mViewSearch.getWidth(), mViewSearch.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.setDuration(300); animator.start(); } catch (Exception e) { e.getStackTrace(); mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } mViewSearch.setVisibility(View.VISIBLE); }
From source file:org.apache.falcon.regression.core.bundle.Bundle.java
public void deleteBundle(ColoHelper helper) { try {/*ww w . j av a 2s. c o m*/ helper.getProcessHelper().delete(getProcessData()); } catch (Exception e) { e.getStackTrace(); } for (String dataset : getDataSets()) { try { helper.getFeedHelper().delete(dataset); } catch (Exception e) { e.getStackTrace(); } } for (String cluster : this.getClusters()) { try { helper.getClusterHelper().delete(cluster); } catch (Exception e) { e.getStackTrace(); } } }
From source file:edu.arizona.kra.institutionalproposal.negotiationlog.service.NegotiationLogMigrationServiceImpl.java
/** * Saves a negotiation and all the related objects associated with it * TODO: Figure out if we need to save separately the associated detail(if any) and the negotiation document + workflow * @param negotiation/*from w w w. j a v a 2s . c o m*/ */ @Transactional private void saveNegotiation(final Negotiation negotiation) throws NegotiationMigrationException { LOG.debug("Start saveNegotiation " + negotiation.getNegotiationId()); try { negotiation.getNegotiationDocument().prepareForSave(); NegotiationDocument negotiationDocument = negotiation.getNegotiationDocument(); if (negotiationDocument.getDocumentHeader().getWorkflowDocument().isInitiated() || negotiationDocument.getDocumentHeader().getWorkflowDocument().isSaved()) { negotiationDocument = (NegotiationDocument) getDocumentService().routeDocument(negotiationDocument, "Route To Final", new ArrayList()); } getDocumentService().saveDocument(negotiationDocument); // } catch (Exception e){ // LOG.error("Error when saving migrated negotiation id "+ negotiation.getNegotiationId()+" \n"+ e.getMessage() +"\nStackTrace:\n"+Arrays.toString(e.getStackTrace())); // throw new NegotiationMigrationException( e.getMessage() ); // } // TransactionTemplate template = new TransactionTemplate(getTransactionManagerService()); // template.setPropagationBehavior(Propagation.REQUIRES_NEW.value()); // template.execute(new TransactionCallback() { // @SuppressWarnings("unchecked") // public Object doInTransaction(TransactionStatus status) { // try { getBusinessObjectService().save(negotiation); if (negotiation.getUnAssociatedDetail() != null) { getBusinessObjectService().save(negotiation.getUnAssociatedDetail()); //now that we have an ID after saving the detail obj, make sure we preserve it in the assocDocId negotiation.setAssociatedDocumentId( negotiation.getUnAssociatedDetail().getNegotiationUnassociatedDetailId().toString()); getBusinessObjectService().save(negotiation); } } catch (Exception e) { LOG.error("Error when saving migrated negotiation id " + negotiation.getNegotiationId() + " \n" + e.getMessage() + "\nStackTrace:\n" + Arrays.toString(e.getStackTrace())); throw new NegotiationMigrationException(e.getMessage()); } // return null; // } // }); LOG.debug("Finished saveNegotiation +" + negotiation.getNegotiationId()); }
From source file:com.example.wmgps.MainActivity.java
/** Called when the user clicks the Send button */ public void sendMessage(View view) { /*Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent);*///from w w w .j av a 2s .com /*EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); TextView output = (TextView) findViewById(R.id.welcome); output.setText(message);*/ /*Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(URL)); startActivity(browserIntent); */ TextView hiddenText = (TextView) findViewById(R.id.Hidden11); if (Misc.isNullTrimmedString(hiddenText.getText().toString())) { TextView output = (TextView) findViewById(R.id.welcome1); boolean without_connection = true; Map<String, ArrayList<String>> typeAndValueOfTag = new LinkedHashMap<String, ArrayList<String>>(); // Insertion order must be followed String response = Misc.EMPTY_STRING; String welcome1String = "*******************Connected*************************"; try { response = new RetrieveFeedTask().execute(new String[] {}).get(); } catch (Exception e) { response = Misc.EMPTY_STRING; Log.e("Exception ", e.getMessage()); Log.e("Exception ", e.getLocalizedMessage()); Log.e("Exception ", e.getStackTrace().toString()); } if (Misc.isNullTrimmedString(response)) { // welcome1String = "***Loading Static, couldn't connect***"; response = "{\"window\":{\"elements\":[{\"type\":\"hidden\",\"name\":\"sourceAction\"},{\"type\":\"label\",\"value\":\"Warehouse Management\"}," + "{\"type\":\"break\"},{\"type\":\"label\",\"value\":\"--------- ----------\"},{\"type\":\"break\"}, {\"type\":\"label\",\"value\":\" User ID: \"}," + "{\"type\":\"entry\",\"name\":\"j_username\",\"value\":\"\",\"maxLength\":15,\"dispLength\":10," + "\"setHidden\":[{\"hiddenName\":\"sourceAction\",\"hiddenValue\":\"username\"}],\"focus\":true}," + "{\"type\":\"break\"},{\"type\":\"label\",\"value\":\"Password: \"}," + "{\"type\":\"entry\",\"name\":\"j_password\",\"value\":\"\",\"hideInput\":true,\"maxLength\":14,\"dispLength\":10,\"focus\":false}," + "{\"type\":\"keybinding\",\"value\":\"CTRL-X\",\"URL\":\"\",\"keyDescription\":\"CTRL-X Exit\"}," + "{\"type\":\"keybinding\",\"value\":\"CTRL-L\",\"URL\":\"/scopeRF/RFLogin/RFLegal.jsp\",\"keyDescription\":\"CTRL-L License Agreement\"}]" + ",\"submit\":\"/scopeRF/RFLogin/ProcessLogin.jsp\"}}"; } StringBuffer finalEncodedString = new StringBuffer(Misc.EMPTY_STRING); int currentOutputTag = R.id.Hidden1; int currentInputTag = R.id.edit_message; // Renderer::decodeConfig() if (!Misc.isNullTrimmedString(response)) { try { JSONObject jsonObj = new JSONObject(response); for (Iterator iterator = jsonObj.keys(); iterator.hasNext();) { String name = (String) iterator.next(); JSONObject jsonObj1 = jsonObj.getJSONObject(name); for (Iterator iterator1 = jsonObj1.keys(); iterator1.hasNext();) { String name1 = (String) iterator1.next(); if ("elements".equals(name1)) { JSONArray jsonArr = jsonObj1.getJSONArray(name1); boolean userName = false; boolean password = false; for (int i = 0; i < jsonArr.length(); i++) { JSONObject temp = jsonArr.getJSONObject(i); String initialValue = null; String initialName = null; String initialLabel = null; if (!temp.isNull("name") && temp.getString("name").equals("j_password")) { initialName = "j_password"; } else if (!temp.isNull("name") && temp.getString("name").equals("j_username")) { initialName = "j_username"; } for (Iterator iterator2 = temp.keys(); iterator2.hasNext();) { String tempName = (String) iterator2.next(); String tempValue = (String) temp.getString(tempName); if (tempName.equals("type")) { if (tempValue.equals("label") || tempValue.equals("entry")) { initialLabel = tempValue; } } else if (tempName.equals("value")) { initialValue = tempValue; } /* if(tempName.equals("label")) { if(Misc.isNullTrimmedString(initialValue)) initialLabel = tempName; else { typeAndValueOfTag.put("output",initialValue); initialValue = Misc.EMPTY_STRING; continue; } } else if(tempName.equals("value")) { if(Misc.isNullTrimmedString(initialName) && Misc.isNullTrimmedString(initialLabel)) { initialValue = tempValue; } else if(!Misc.isNullTrimmedString(initialLabel) && initialLabel.equals("label")) { typeAndValueOfTag.put("output",tempValue); initialValue = Misc.EMPTY_STRING; continue; } else if(!Misc.isNullTrimmedString(initialLabel) && initialLabel.equals("entry")) { if(!Misc.isNullTrimmedString(initialName) && initialName.equals("name")) typeAndValueOfTag.put("input",tempValue); else initialValue = tempValue; } } else if(tempName.equals("entry")) { if(Misc.isNullTrimmedString(initialValue) || Misc.isNullTrimmedString(initialLabel)) { initialName = tempName; } else typeAndValueOfTag.put("input",initialValue); finalEncodedString.append(" " + tempName + " " + tempValue + " ----- "); }*/ } if (initialLabel != null) { if (initialLabel.equals("label")) { if (initialValue.equals(" User ID: ")) { TextView output1 = (TextView) findViewById(R.id.userNameText); output1.setText(initialValue); output1.setVisibility(View.VISIBLE); userName = true; password = false; } else if (initialValue.equals("Password: ")) { TextView output1 = (TextView) findViewById(R.id.passwordText); output1.setText(initialValue); output1.setVisibility(View.VISIBLE); password = true; userName = false; } else { TextView output1 = (TextView) findViewById(currentOutputTag++); output1.setText(initialValue); output1.setVisibility(View.VISIBLE); userName = false; password = false; } } else if (initialLabel.equals("entry")) { if ("j_password".equals(initialName)) { EditText input = ((EditText) findViewById(R.id.passwordEdit)); input.setVisibility(View.VISIBLE); if (Misc.isNullTrimmedString(initialValue)) { input.setText(""); input.setHint("Please enter password"); } } else if ("j_username".equals(initialName)) { EditText input = ((EditText) findViewById(R.id.userNameEdit)); input.setVisibility(View.VISIBLE); if (Misc.isNullTrimmedString(initialValue)) { input.setText(""); input.setHint("Please enter username"); } } else { EditText input = ((EditText) findViewById(currentInputTag++)); input.setVisibility(View.VISIBLE); if (Misc.isNullTrimmedString(initialValue)) { input.setText(""); input.setHint("Please enter value"); } else input.setText(initialValue); } } } /*if(initialLabel != null) { List<String> listOfValues; if(typeAndValueOfTag.containsKey(initialLabel)) { listOfValues = typeAndValueOfTag.get(initialLabel); listOfValues.add(initialValue); } typeAndValueOfTag.put(initialLabel,initialValue); }*/ } } else { // Here, just the URL would get processed. So don't use. // output.setText(" " + name + " " + jsonObj1.getString(name1)); } } } TextView welcome1 = (TextView) findViewById(R.id.welcome1); welcome1.setText(welcome1String); // processUIDisplay(typeAndValueOfTag); /*if(finalEncodedString.length() == 0) finalEncodedString.append("Could not process"); output.setText(finalEncodedString.toString()); TextView output2 = (TextView) findViewById(R.id.Hidden1); output2.setText("Hidden one is enabled"); output2.setVisibility(View.VISIBLE);*/ } catch (JSONException e) { Log.e("Exception ", e.getMessage()); Log.e("Exception ", e.getLocalizedMessage()); Log.e("Exception ", e.getStackTrace().toString()); } } hiddenText.setText("validated user"); /* {"window":{"elements":[{"type":"hidden","name":"sourceAction"},{"type":"label","value":"Warehouse Management"}, {"type":"break"},{"type":"label","value":"--------- ----------"},{"type":"break"}, {"type":"label","value":" User ID: "}, {"type":"entry","name":"j_username","value":"","maxLength":15,"dispLength":10, "setHidden":[{"hiddenName":"sourceAction","hiddenValue":"username"}],"focus":true}, {"type":"break"},{"type":"label","value":"Password: "}, {"type":"entry","name":"j_password","value":"","hideInput":true,"maxLength":14,"dispLength":10,"focus":false}, {"type":"keybinding","value":"CTRL-X","URL":"","keyDescription":"CTRL-X Exit"}, {"type":"keybinding","value":"CTRL-L","URL":"/scopeRF/RFLogin/RFLegal.jsp","keyDescription":"CTRL-L License Agreement"}] ,"submit":"/scopeRF/RFLogin/ProcessLogin.jsp"}}*/ } else { List outputList = verifyUser(); if (!Misc.isNullList(outputList)) { String sessionId = (String) outputList.get(0); String userType = (String) outputList.get(1); Intent intent = new Intent(this, MenuActivity.class); if (!Misc.isNullTrimmedString(sessionId) && !Misc.isNullTrimmedString(userType) && Integer.parseInt(sessionId) > 0) { if (userType.equals(Constants.WORKER)) { MenuActivity.sessionId = Misc.EMPTY_STRING; TextView error = (TextView) findViewById(R.id.ErrorText); error.setText(Misc.EMPTY_STRING); error.setVisibility(View.GONE); intent.putExtra(Constants.USER_TYPE, Constants.WORKER); intent.putExtra(Constants.SESSION_ID, sessionId); } else { TextView error = (TextView) findViewById(R.id.ErrorText); error.setText(Misc.EMPTY_STRING); error.setVisibility(View.GONE); intent.putExtra(Constants.USER_TYPE, Constants.SUPERVISOR); intent.putExtra(Constants.SESSION_ID, sessionId); } } // goto Maps screen // Get the message from the intent startActivity(intent); } else { TextView error = (TextView) findViewById(R.id.ErrorText); error.setText("Invalid Username/Password"); error.setVisibility(View.VISIBLE); } } return; }
From source file:com.esri.geoevent.solutions.processor.queryreport.QueryReportProcessor.java
private Geometry constructGeometry(MapGeometry geo) throws Exception { try {/* w w w. ja va 2 s .c o m*/ Geometry geoIn = geo.getGeometry(); return GeometryEngine.project(geoIn, srIn, srBuffer); } catch (Exception e) { LOG.error(e.getMessage()); LOG.error(e.getStackTrace()); throw (e); } }
From source file:cn.edu.buaa.act.petuumOnYarn.ApplicationMaster.java
private boolean getAvaliableNodes() { List<NodeReport> clusterNodeReports; try {//from w w w.j a v a2 s. c o m YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(conf); yarnClient.start(); clusterNodeReports = yarnClient.getNodeReports(NodeState.RUNNING); for (NodeReport node : clusterNodeReports) { LOG.info("node infos:" + node.getHttpAddress()); } avaliableNodeList = new ArrayList<NodeReport>(); if (numNodes <= clusterNodeReports.size()) { for (NodeReport node : clusterNodeReports) { if (node.getCapability().getMemory() >= containerMemory && node.getCapability().getVirtualCores() >= containerVirtualCores) { avaliableNodeList.add(node); } } if (avaliableNodeList.size() >= numNodes) numTotalContainers = numNodes; else { LOG.error("Resource isn't enough"); return false; } } else { LOG.error("cluster nodes isn't enough"); return false; } } catch (Exception e) { LOG.error(e.getMessage()); LOG.error(e.getStackTrace()); return false; } return true; }
From source file:edu.arizona.kra.institutionalproposal.negotiationlog.service.NegotiationLogMigrationServiceImpl.java
/** * Migrates all NegotiationLogs that have the specified status - true for opened or false - closed * Returns a list with the Id of the NegotiationLogs that could not be migrated *///from www. j a v a 2 s . c o m @Override public List<String> migrateNegotiationLogs(boolean completeStatus) throws NegotiationMigrationException { boolean isMigrationEnabled = NegotiationMigrationUtils.isNegotiationMigrationEnabled(); LOG.info("MIGRATION ENABLED=" + isMigrationEnabled); if (!isMigrationEnabled) { LOG.error("Negotiation Migration IS NOT ENABLED. Exiting...."); throw new NegotiationMigrationException("Negotiation Migration IS NOT ENABLED. Exiting...."); } ArrayList<String> failedNegLogIds = new ArrayList<String>(); ArrayList<String> succededNegLogIds = new ArrayList<String>(); LOG.info("Starting MigrateNegotiationLogs with status complete= " + completeStatus); try { Integer maxLogId = getNegotiationLogDao().findMaxNegotiationLogId(); LOG.debug("Max negotiation log id= " + maxLogId); Integer lastMigratedId = 1; while (lastMigratedId < maxLogId) { List<Integer> negotiationLogsToMigrate = getNegotiationLogDao() .findNegotiationLogIds(lastMigratedId + 1, MAX_RESULTS, completeStatus); if (!negotiationLogsToMigrate.isEmpty()) { Iterator negLogIdIterator = negotiationLogsToMigrate.iterator(); while (negLogIdIterator.hasNext()) { Integer currentNegotiationLogId = (Integer) negLogIdIterator.next(); LOG.info("Migrating negotiation log id= " + currentNegotiationLogId); if (lastMigratedId < currentNegotiationLogId) { lastMigratedId = currentNegotiationLogId; } try { migrateNegotiationLog(currentNegotiationLogId.toString()); succededNegLogIds.add(currentNegotiationLogId.toString()); } catch (Exception e) { LOG.error("Failed migrating negotiation log id=" + currentNegotiationLogId + " Exception:" + e.getMessage()); LOG.debug(Arrays.toString(e.getStackTrace())); failedNegLogIds.add(currentNegotiationLogId.toString()); } } } } } catch (Exception e) { e.printStackTrace(); LOG.error("Exception when trying to migrate negotiation logs: " + e.getMessage()); LOG.debug(Arrays.toString(e.getStackTrace())); throw new NegotiationMigrationException(e.getMessage()); } LOG.warn("Finishing MigrateNegotiationLogs with status complete= " + completeStatus); LOG.warn("Number of successfully migrated Negotiation Logs=" + succededNegLogIds.size()); LOG.warn("SUCCEEDED:\n" + Arrays.toString(succededNegLogIds.toArray())); LOG.warn("Number of FAILED migrated Negotiation Logs=" + failedNegLogIds.size()); LOG.warn("FAILED:\n" + Arrays.toString(failedNegLogIds.toArray())); return failedNegLogIds; }
From source file:no.ntnu.okse.protocol.wsn.WSNotificationServer.java
/** * This interface method should contain the main run loop initialization *//*from www.j av a2 s .c o m*/ @Override public void run() { try { WSNotificationServer.this._server.start(); WSNotificationServer.this._server.join(); } catch (Exception serverError) { totalErrors.incrementAndGet(); log.trace(serverError.getStackTrace()); } }