List of usage examples for java.lang Throwable getLocalizedMessage
public String getLocalizedMessage()
From source file:org.ebayopensource.turmeric.eclipse.core.logging.SOALogger.java
/** * Error.//from ww w .j a v a 2s. c o m * * @param cause The cause of the error * @see java.util.logging.Level#SEVERE */ public void error(Throwable cause) { StackTraceElement[] elements = new Throwable().getStackTrace(); logp(Level.SEVERE, elements[1].getClassName(), elements[1].getMethodName(), cause.getLocalizedMessage(), cause); }
From source file:com.example.parkhere.seeker.SeekerProfileVehicleFragment.java
public void addVehicle(final Vehicle vehicle) { Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); RequestInterface requestInterface = retrofit.create(RequestInterface.class); ServerRequest request = new ServerRequest(); request.setOperation(Constants.ADD_VEHICLE_OPERATION); request.setUser(user);/*w w w. j a v a 2 s . c o m*/ request.setVehicle(vehicle); Call<ServerResponse> response = requestInterface.operation(request); response.enqueue(new Callback<ServerResponse>() { @Override public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) { ServerResponse resp = response.body(); if (resp.getResult().equals(Constants.SUCCESS)) { TableRow tr = new TableRow(myContext); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.setTag(tag); tag++; tr.setClickable(true); tr.setOnClickListener(clickListener); TextView v_make = new TextView(myContext); v_make.setText(vehicle.getMake()); v_make.setLayoutParams(new TableRow.LayoutParams(300, 150)); tr.addView(v_make); TextView v_model = new TextView(myContext); v_model.setText(vehicle.getModel()); v_model.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_model); TextView v_license = new TextView(myContext); v_license.setText(vehicle.getLicensePlate()); v_license.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_license); tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); Vehicle[] arr = new Vehicle[vehicles.length + 1]; for (int i = 0; i < vehicles.length; i++) { arr[i] = vehicles[i]; } arr[vehicles.length] = vehicle; vehicles = arr; } Snackbar.make(rootView, resp.getMessage(), Snackbar.LENGTH_LONG).show(); } @Override public void onFailure(Call<ServerResponse> call, Throwable t) { Snackbar.make(rootView, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show(); } }); }
From source file:org.mc4j.ems.impl.jmx.connection.bean.attribute.DAttribute.java
protected void registerFailure(Throwable t) { if (failures == null) failures = new LinkedList<Throwable>(); failures.add(t);// w w w . j av a 2 s.c o m // Bounding this list to make sure memory doesn't grow if (failures.size() > 2) failures.removeFirst(); log.debug("Attribute access failure " + t.getLocalizedMessage(), t); }
From source file:org.fenixedu.qubdocs.ui.documenttemplates.AcademicServiceRequestTemplateController.java
@RequestMapping(value = _DELETETEMPLATE_URI + "{oid}", method = RequestMethod.POST) public String deletetemplate(@PathVariable("oid") AcademicServiceRequestTemplate academicServiceRequestTemplate, Model model, RedirectAttributes redirectAttributes) { setAcademicServiceRequestTemplate(academicServiceRequestTemplate, model); try {/* w w w .j a v a 2 s . c om*/ String templateName = academicServiceRequestTemplate.getName().getContent(); deleteAcademicServiceRequestTemplate(academicServiceRequestTemplate); addInfoMessage(BundleUtil.getString(FenixeduQubdocsReportsSpringConfiguration.BUNDLE, "label.info.documentTemplates.successfulDelete", templateName), model); return redirect("/qubdocsreports/documenttemplates/academicservicerequesttemplate/searchtemplates", model, redirectAttributes); } catch (Throwable ex) { addErrorMessage( BundleUtil.getString(FenixeduQubdocsReportsSpringConfiguration.BUNDLE, "label.error.delete") + ex.getLocalizedMessage(), model); return redirect("/qubdocsreports/documenttemplates/academicservicerequesttemplate/readtemplate" + "/" + academicServiceRequestTemplate.getExternalId(), model, redirectAttributes); } }
From source file:com.anrisoftware.prefdialog.miscswing.logwindowdock.LogWindowDock.java
public void addErrorMessage(final Object messageTitle, final Throwable ex) { invokeLater(new Runnable() { @Override//from w ww . ja va2 s .c o m public void run() { ErrorNode error; ErrorCategory category = getErrorCategory(); error = errorNodeFactory.create(category); error.setTitle(messageTitle.toString()); error.setDescription(ex.getLocalizedMessage()); error.setException(ex); addErrorMessage(error); } }); }
From source file:de.openali.odysseus.chart.factory.config.ChartLayerFactory.java
private IChartLayer[] build(final LayersType layersType, final ParametersType cascading, final ReferencableType... baseTypes) { final Set<IChartLayer> layers = new LinkedHashSet<>(); final Node node = layersType.getDomNode(); final NodeList childNodes = node.getChildNodes(); for (int index = 0; index < childNodes.getLength(); index++) { final Node child = childNodes.item(index); if (StringUtils.isEmpty(child.getLocalName())) { continue; }// w w w. j a va2s . c o m try { final IChartLayer layer = parse(child, cascading, baseTypes); if (layer != null) { layers.add(layer); } } catch (final Throwable t) { OdysseusChartFactory.getDefault().getLog() .log(new Status(IStatus.ERROR, OdysseusChartFactory.PLUGIN_ID, t.getLocalizedMessage(), t)); } } return layers.toArray(new IChartLayer[] {}); }
From source file:com.example.parkhere.seeker.SeekerProfileVehicleFragment.java
public void getCurrInfo() { tag = 1;/*from w ww .j av a2s. c om*/ Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); RequestInterface requestInterface = retrofit.create(RequestInterface.class); ServerRequest request = new ServerRequest(); request.setOperation(Constants.GET_SEEKER_PROFILE_OPERATION); request.setUser(user); Call<ServerResponse> response = requestInterface.operation(request); response.enqueue(new Callback<ServerResponse>() { @Override public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) { ServerResponse resp = response.body(); if (resp.getResult().equals(Constants.SUCCESS)) { vehicles = resp.getVehicles(); TableRow tr_head = new TableRow(myContext); tr_head.setBackgroundColor(Color.GRAY); tr_head.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); TextView make = new TextView(myContext); make.setText("MAKE"); make.setTextColor(Color.WHITE); make.setPadding(5, 5, 5, 5); tr_head.addView(make); TextView model = new TextView(myContext); model.setText("MODEL"); model.setTextColor(Color.WHITE); model.setPadding(5, 5, 5, 5); tr_head.addView(model); final TextView license = new TextView(myContext); license.setText("LICENSE PLATE"); license.setTextColor(Color.WHITE); license.setPadding(5, 5, 5, 5); tr_head.addView(license); tl.addView(tr_head, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); for (int i = 0; i < vehicles.length; i++) { if (vehicles[i].getDeletedWithHistory() == 1) { continue; } TableRow tr = new TableRow(myContext); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.setTag(tag); tag++; tr.setClickable(true); tr.setOnClickListener(clickListener); TextView v_make = new TextView(myContext); v_make.setText(vehicles[i].getMake()); v_make.setLayoutParams(new TableRow.LayoutParams(300, 150)); tr.addView(v_make); TextView v_model = new TextView(myContext); v_model.setText(vehicles[i].getModel()); v_model.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_model); TextView v_license = new TextView(myContext); v_license.setText(vehicles[i].getLicensePlate()); v_license.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_license); tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); } } } @Override public void onFailure(Call<ServerResponse> call, Throwable t) { Snackbar.make(rootView, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show(); } }); }
From source file:com.ibm.mobilefirstplatform.clientsdk.android.security.mca.internal.AuthorizationRequestManager.java
/** * Adds an expected challenge answer to collection of answers. * * @param answer Answer to add./*from w ww .j av a2 s . c o m*/ * @param realm Authentication realm for the answer. */ public void submitAnswer(JSONObject answer, String realm) { if (answers == null) { answers = new JSONObject(); } try { answers.put(realm, answer); if (isAnswersFilled()) { resendRequest(); } } catch (Throwable t) { logger.error("submitAnswer failed with exception: " + t.getLocalizedMessage(), t); } }
From source file:edu.harvard.iq.dataverse.HandlenetServiceBean.java
public Throwable registerNewHandle(Dataset dataset) { logger.log(Level.FINE, "registerNewHandle"); String handlePrefix = dataset.getAuthority(); String handle = getDatasetHandle(dataset); String datasetUrl = getRegistrationUrl(dataset); logger.info("Creating NEW handle " + handle); String authHandle = getHandleAuthority(dataset); PublicKeyAuthenticationInfo auth = getAuthInfo(handlePrefix); HandleResolver resolver = new HandleResolver(); try {//from w w w . j ava2 s . c o m AdminRecord admin = new AdminRecord(authHandle.getBytes("UTF8"), 300, true, true, true, true, true, true, true, true, true, true, true, true); int timestamp = (int) (System.currentTimeMillis() / 1000); HandleValue[] val = { new HandleValue(100, "HS_ADMIN".getBytes("UTF8"), Encoder.encodeAdminRecord(admin), HandleValue.TTL_TYPE_RELATIVE, 86400, timestamp, null, true, true, true, false), new HandleValue(1, "URL".getBytes("UTF8"), datasetUrl.getBytes(), HandleValue.TTL_TYPE_RELATIVE, 86400, timestamp, null, true, true, true, false) }; CreateHandleRequest req = new CreateHandleRequest(handle.getBytes("UTF8"), val, auth); resolver.traceMessages = true; AbstractResponse response = resolver.processRequest(req); if (response.responseCode == AbstractMessage.RC_SUCCESS) { logger.info("Success! Response: \n" + response); return null; } else { logger.log(Level.WARNING, "registerNewHandle failed"); logger.warning("Error response: \n" + response); return new Exception("registerNewHandle failed: " + response); } } catch (Throwable t) { logger.log(Level.WARNING, "registerNewHandle failed"); logger.log(Level.WARNING, "String {0}", t.toString()); logger.log(Level.WARNING, "localized message {0}", t.getLocalizedMessage()); logger.log(Level.WARNING, "cause", t.getCause()); logger.log(Level.WARNING, "message {0}", t.getMessage()); return t; } }
From source file:com.github.richardwilly98.esdms.services.AuthenticationProvider.java
@Override public Set<SessionImpl> getItems(String name) throws ServiceException { try {/*from w w w.j a v a 2 s .com*/ if (log.isTraceEnabled()) { log.trace(String.format("getItems - %s", name)); } Set<SessionImpl> items = new HashSet<SessionImpl>(); SearchResponse searchResponse = client.prepareSearch(index).setTypes(type) .setQuery(QueryBuilders.queryString(name)).execute().actionGet(); log.debug("totalHits: " + searchResponse.getHits().totalHits()); for (SearchHit hit : searchResponse.getHits().hits()) { String json = hit.getSourceAsString(); try { SessionImpl item = mapper.readValue(json, SessionImpl.class); items.add(item); } catch (Throwable t) { log.error("Json processing exception.", t); } } return items; } catch (Throwable t) { log.error("getItems failed", t); throw new ServiceException(t.getLocalizedMessage()); } }