Example usage for java.lang Throwable getLocalizedMessage

List of usage examples for java.lang Throwable getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang Throwable getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.sindice.analytics.servlet.JsonResponseWriter.java

@Override
public String createErrorAnswer(RecommendationType type, Throwable e) {
    String msg = e.getLocalizedMessage();
    return "{\"results\":{\"bindings\":[]},\"" + ResponseStructure.STATUS + "\": \"" + ResponseStructure.ERROR
            + "\",\"" + ResponseStructure.MESSAGE + "\":\""
            + StringEscapeUtils.escapeJava(msg.substring(msg.indexOf(':') + 2)) + "\"}";
}

From source file:de.metas.ui.web.config.WebuiExceptionHandler.java

private void addErrorMessage(final Map<String, Object> errorAttributes, final Throwable error) {
    errorAttributes.put(ATTR_Message, error.getLocalizedMessage());
}

From source file:com.example.parkhere.provider.ParkingSpaceReservationDetailsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    user = (User) getArguments().getSerializable(USER_KEY);
    parkingSpace = (ParkingSpace) getArguments().getSerializable(PARKING_SPACE_KEY);
    providerReservation = (ProviderReservation) getArguments().getSerializable(PROVIDER_RESERVATION_KEY);

    rootView = inflater.inflate(R.layout.fragment_parking_space_reservation_details, container, false);

    ps_resdet_resid = (TextView) rootView.findViewById(R.id.ps_resdet_resid);
    ps_resdet_address = (TextView) rootView.findViewById(R.id.ps_resdet_address);
    ps_resdet_dateres = (TextView) rootView.findViewById(R.id.ps_resdet_dateres);
    ps_resdet_time = (TextView) rootView.findViewById(R.id.ps_resdet_time);
    ps_resdet_price = (TextView) rootView.findViewById(R.id.ps_resdet_price);
    ps_resdet_seeker = (TextView) rootView.findViewById(R.id.ps_resdet_seeker);

    ps_resdet_resid.setText(Integer.toString(providerReservation.getId()));
    ps_resdet_address.setText(parkingSpace.getAddress() + " " + parkingSpace.getCity() + ", "
            + parkingSpace.getState() + " " + parkingSpace.getZipCode() + " " + parkingSpace.getCountry());
    ps_resdet_dateres.setText(providerReservation.getDateReserved());
    ps_resdet_time.setText("Start: " + providerReservation.getStartDate() + " "
            + getTime(providerReservation.getStartHour()) + "\n" + "End: " + providerReservation.getEndDate()
            + " " + getTime(providerReservation.getEndHour()));
    ps_resdet_price.setText("Total Price: $" + Double.toString(providerReservation.getTotalPrice()) + "\n"
            + "Total Paid to You: $" + providerReservation.getTotalPrice() * 0.90 + "\n"
            + "Direct Deposit Information: " + "\n" + providerReservation.getProviderPayment().getBank() + "\n"
            + providerReservation.getProviderPayment().getAccountType() + "\n" + "Account Number Ending in "
            + providerReservation.getProviderPayment().getAccountNumber() + "\n" + "Routing Number Ending in "
            + providerReservation.getProviderPayment().getRoutingNumber());

    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_CURRENT_TIME_OPERATION);
    Call<ServerResponse> response = requestInterface.operation(request);

    response.enqueue(new Callback<ServerResponse>() {
        @Override/*  w  w w  .j a  va2 s.c  o  m*/
        public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) {
            ServerResponse resp = response.body();
            try {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
                Date currentDate = sdf.parse(resp.getMessage());
                Date endDate = sdf.parse(
                        providerReservation.getEndDate() + " " + getTime(providerReservation.getEndHour()));
                upcoming = endDate.after(currentDate);

                if (upcoming == true) {
                    ps_resdet_seeker.setText(providerReservation.getSeeker().getFirstName() + "\n"
                            + providerReservation.getSeeker().getEmail() + "\n"
                            + providerReservation.getSeeker().getPhoneNumber() + "\n" + "\n" + "Seeker Vehicle"
                            + "\n" + providerReservation.getSeekerVehicle().getMake() + " "
                            + providerReservation.getSeekerVehicle().getModel() + " "
                            + providerReservation.getSeekerVehicle().getYear() + "\n"
                            + providerReservation.getSeekerVehicle().getColor() + "\n"
                            + providerReservation.getSeekerVehicle().getLicensePlate());
                } else {
                    ps_resdet_seeker.setText(providerReservation.getSeeker().getFirstName() + "\n"
                            + providerReservation.getSeeker().getEmail() + "\n"
                            + providerReservation.getSeeker().getPhoneNumber());
                }
            } catch (ParseException e) {
                System.out.println("Parse Exception " + e.getLocalizedMessage());
            }
        }

        @Override
        public void onFailure(Call<ServerResponse> call, Throwable t) {
            Snackbar.make(rootView, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
        }
    });

    return rootView;
}

From source file:hadoopInstaller.logging.MessageFormattingLog.java

public void info(Throwable t, String format, Object... arguments) {
    this.log.info(
            MessageFormat.format(Messages.getString(format), arguments) + " - " + t.getLocalizedMessage());
    this.log.trace("trace", t);
}

From source file:hadoopInstaller.logging.MessageFormattingLog.java

public void trace(Throwable t, String format, Object... arguments) {
    this.log.trace(
            MessageFormat.format(Messages.getString(format), arguments) + " - " + t.getLocalizedMessage(), t);
}

From source file:hadoopInstaller.logging.MessageFormattingLog.java

public void warn(Throwable t, String format, Object... arguments) {
    this.log.warn(
            MessageFormat.format(Messages.getString(format), arguments) + " - " + t.getLocalizedMessage());
    this.log.trace("trace", t);
}

From source file:hadoopInstaller.logging.MessageFormattingLog.java

public void debug(Throwable t, String format, Object... arguments) {
    this.log.debug(
            MessageFormat.format(Messages.getString(format), arguments) + " - " + t.getLocalizedMessage());
    this.log.trace("trace", t);
}

From source file:hadoopInstaller.logging.MessageFormattingLog.java

public void error(Throwable t, String format, Object... arguments) {
    this.log.error(
            MessageFormat.format(Messages.getString(format), arguments) + " - " + t.getLocalizedMessage());
    this.log.trace("trace", t);
}

From source file:hadoopInstaller.logging.MessageFormattingLog.java

public void fatal(Throwable t, String format, Object... arguments) {
    this.log.fatal(
            MessageFormat.format(Messages.getString(format), arguments) + " - " + t.getLocalizedMessage());
    this.log.trace("trace", t);
}

From source file:com.anrisoftware.prefdialog.miscswing.actions.AbstractAppActionListener.java

@Override
public final void propertyChange(PropertyChangeEvent evt) {
    notNull(getStatusBar(), "statusBar");
    notNull(getLogWindowDock(), "logWindowDock");
    try {/*  www  . j  ava  2 s  .  c  o m*/
        doPropertyChange(evt);
    } catch (Throwable e) {
        log.logException(e, application_error_description, CAUSE_MESSAGE_ARG, e.getLocalizedMessage());
    }
}