Example usage for java.lang NumberFormatException getLocalizedMessage

List of usage examples for java.lang NumberFormatException getLocalizedMessage

Introduction

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

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:com.nextgis.firereporter.SendReportActivity.java

public void onReport() {
    try {//from   www  .  j  a v  a 2s.  c o m
        double dfLat = Double.valueOf(edLatitude.getText().toString()).doubleValue();
        double dfLon = Double.valueOf(edLongitude.getText().toString()).doubleValue();
        double dfAz = frCompass.getOrientation();
        //double dfAz = Double.valueOf(edAzimuth.getText().toString()).doubleValue();
        double dfDist = Double.valueOf(edDistance.getText().toString()).doubleValue();
        String sComment = edComment.getText().toString();
        sComment.replace(System.getProperty("line.separator"), " | ");

        dbHelper = new ReportsDatabase(this.getApplicationContext());
        ReportsDB = dbHelper.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(ReportsDatabase.COLUMN_LAT, dfLat);
        values.put(ReportsDatabase.COLUMN_LON, dfLon);
        values.put(ReportsDatabase.COLUMN_AZIMUTH, dfAz);
        values.put(ReportsDatabase.COLUMN_DISTANCE, dfDist);
        values.put(ReportsDatabase.COLUMN_COMMENT, sComment);
        long nRowId = ReportsDB.insert(ReportsDatabase.TABLE_POS, null, values);

        ReportsDB.close();

        dbHelper.close();

        if (nRowId == -1) {
            Toast.makeText(SendReportActivity.this, getString(R.string.reportStoredFailed), Toast.LENGTH_LONG)
                    .show();
            finish();
            return;
        }

    } catch (NumberFormatException e) {
        Toast.makeText(SendReportActivity.this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
        finish();
        return;
    }
    //start or restart service
    startService(new Intent(ReporterService.ACTION_START));

    finish();
}

From source file:org.openestate.io.is24_csv.records.GewerbeGastronomieHotel.java

public BigDecimal getPreis() {
    try {/*from   ww  w  .ja  v a2 s.  c o m*/
        return Is24CsvFormat.parseDecimal(this.get(FIELD_PREIS));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Preis'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.is24_csv.records.HausKauf.java

public BigDecimal getZimmer() {
    try {//from  ww  w  .  j  a va 2  s.  c  o m
        return Is24CsvFormat.parseDecimal(this.get(FIELD_ZIMMER));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Zimmer'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.is24_csv.records.HausKauf.java

public Integer getEtagenzahl() {
    try {//from w w  w.j a  v a  2s  . c  om
        return Is24CsvFormat.parseInteger(this.get(FIELD_ETAGENZAHL));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Etagenzahl'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.is24_csv.records.GewerbeGastronomieHotel.java

public Integer getAnzahlBetten() {
    try {//  w w w. j a  v  a  2 s.  c o m
        return Is24CsvFormat.parseInteger(this.get(FIELD_ANZAHL_BETTEN));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Anzahl Betten'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.is24_csv.records.HausKauf.java

public BigDecimal getNutzflaeche() {
    try {/*from  ww  w . j  a  v  a 2 s. co m*/
        return Is24CsvFormat.parseDecimal(this.get(FIELD_NUTZFLAECHE));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Nutzflaeche'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.kalypso.model.wspm.tuhh.schema.simulation.BuildingPolygonReader.java

public void read(final File buildingFile) throws IOException {
    LineNumberReader reader = null;
    try {/*from w  w  w.j  a  va 2  s  . co m*/
        reader = new LineNumberReader(new FileReader(buildingFile));

        /* Ingore first line */
        if (reader.ready())
            reader.readLine();

        while (reader.ready()) {
            final String line = reader.readLine();
            if (line == null)
                break;

            try {
                readBuildingLine(line.trim(), buildingFile);
            } catch (final NumberFormatException nfe) {
                /* A good line but bad content. Give user a hint that something might be wrong. */
                m_log.log(false,
                        Messages.getString(
                                "org.kalypso.model.wspm.tuhh.schema.simulation.PolynomeProcessor.25"), //$NON-NLS-1$
                        buildingFile.getName(), reader.getLineNumber(), nfe.getLocalizedMessage());
            } catch (final Throwable e) {
                // should never happen
                m_log.log(e,
                        Messages.getString(
                                "org.kalypso.model.wspm.tuhh.schema.simulation.PolynomeProcessor.25"), //$NON-NLS-1$
                        buildingFile.getName(), reader.getLineNumber(), e.getLocalizedMessage());
            }

        }
        reader.close();
    } finally {
        IOUtils.closeQuietly(reader);
    }
}

From source file:org.openestate.io.is24_csv.records.HausKauf.java

public BigDecimal getStellplatzpreis() {
    try {// w w w. j  av a  2 s  . c om
        return Is24CsvFormat.parseDecimal(this.get(FIELD_STELLPLATZPREIS));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Stellplatzpreis'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.is24_csv.records.HausKauf.java

public Integer getAnzahlBadezimmer() {
    try {/*  w w  w.  ja  va 2s.co m*/
        return Is24CsvFormat.parseInteger(this.get(FIELD_ANZAHL_BADEZIMMER));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Anzahl Badezimmer'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.is24_csv.records.HausKauf.java

public Integer getAnzahlSchlafzimmer() {
    try {/*ww  w . ja  v  a2s .c o m*/
        return Is24CsvFormat.parseInteger(this.get(FIELD_ANZAHL_SCHLAFZIMMER));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Anzahl Schlafzimmer'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}