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:org.openestate.io.is24_csv.records.GewerbeBueroPraxis.java

public BigDecimal getNebenflaeche() {
    try {// ww  w .jav  a  2  s  .  com
        return Is24CsvFormat.parseDecimal(this.get(FIELD_NEBENFLAECHE));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Nebenflaeche'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:controller.CLI.java

private String parseDual(String[] args) {
    int prec = stdPrec;
    if (args.length == 3) {
        try {//from   ww w  .  j  a  va  2s  .  co  m
            prec = Integer.parseInt(args[2]);
        } catch (NumberFormatException e) {
            return Data.SYNTAX.get(Data.showDual);
        }
    }

    try {
        return Output.dual(lps.get(p - 1), prec);
    } catch (IllegalArgumentException e) {
        return e.getLocalizedMessage();
    }
}

From source file:controller.CLI.java

private String parsePrimal(String[] args) {
    int prec = stdPrec;
    if (args.length == 3) {
        try {//from   w w  w  . ja  v  a 2 s. c o  m
            prec = Integer.parseInt(args[2]);
        } catch (NumberFormatException e) {
            return Data.SYNTAX.get(Data.showPrimal);
        }
    }

    try {
        return Output.primal(lps.get(p - 1), prec);
    } catch (IllegalArgumentException e) {
        return e.getLocalizedMessage();
    }
}

From source file:org.apache.openaz.xacml.std.pip.engines.csv.CSVEngine.java

/**
 * Helper to read the top-level propertied for the CSV file as-a-whole
 *
 * @param id/*from  ww w.  j  ava2  s. c  o m*/
 * @param properties
 * @throws org.apache.openaz.xacml.api.pip.PIPException
 */
private void readCSVFileConfiguration(String id, Properties properties) throws PIPException {

    String prefix = id + ".";
    //
    // Is there a max filesize to read into memory?
    //
    String maxSize = properties.getProperty(prefix + PROP_MAXSIZE,
            Long.toString(DEFAULT_MAX_FILE_SIZE_FOR_READALL));
    try {
        this.maximumSize = Long.parseLong(maxSize);
    } catch (NumberFormatException e) {
        String message = this.getName() + ": The maximum size specified is NOT parseable: "
                + e.getLocalizedMessage();
        this.logger.error(message);
        this.maximumSize = DEFAULT_MAX_FILE_SIZE_FOR_READALL;
    }
    //
    // Get the file source
    //
    String sourcePathString = properties.getProperty(prefix + PROP_SOURCE);
    if (sourcePathString == null || sourcePathString.length() == 0) {
        String message = this.getName() + ": No csv.source parameter given";
        logger.error(message);
        throw new PIPException(message);
    }
    //
    // Now check the size of that file (and if it exists)
    //
    csvSourceFile = new File(sourcePathString);
    if (!csvSourceFile.exists() || csvSourceFile.length() == 0) {
        String message = this.getName() + ": The csv.source '" + csvSourceFile.getAbsolutePath()
                + "' does not exist or has no content";
        logger.error(message);
        throw new PIPException(message);
    }
    if (csvSourceFile.length() > this.maximumSize) {
        if (logger.isDebugEnabled()) {
            logger.debug("File size is greater than max allowed (" + this.maximumSize + "): "
                    + csvSourceFile.length());
        }
        fileIsBig = true;
    }
    //
    // Get the properties for CSVReader
    //
    String tmpString = properties.getProperty(prefix + PROP_DELIMITER);
    if (tmpString == null || tmpString.length() != 1) {
        String message = this.getName() + ": The csv.delimiter must exist and be exactly 1 character";
        logger.error(message);
        throw new PIPException(message);
    }
    csvDelimiter = tmpString.charAt(0);

    tmpString = properties.getProperty(prefix + PROP_QUOTE);
    if (tmpString == null || tmpString.length() != 1) {
        String message = this.getName() + ": The csv.quote must exist and be exactly 1 character";
        logger.error(message);
        throw new PIPException(message);
    }
    csvQuote = tmpString.charAt(0);

    tmpString = properties.getProperty(prefix + PROP_SKIP);
    if (tmpString == null) {
        String message = this.getName() + ": The csv.skip must be set";
        logger.error(message);
        throw new PIPException(message);
    }
    try {
        csvSkip = Integer.parseInt(tmpString);
    } catch (NumberFormatException e) {
        String message = this.getName() + ": The csv.skip value of '" + tmpString
                + "' cannot be converted to integer";
        logger.error(message);
        throw new PIPException(message);
    }
}

From source file:org.opencms.ui.dialogs.availability.CmsAvailabilityDialog.java

/**
 * Actually performs the availability change.<p>
 *
 * @return the ids of the changed resources
 *
 * @throws CmsException if something goes wrong
 *//*  ww w .  j  a  va  2s. c om*/
protected List<CmsUUID> changeAvailability() throws CmsException {

    Date released = m_releasedField.getValue();
    Date expired = m_expiredField.getValue();
    boolean resetReleased = m_resetReleased.getValue().booleanValue();
    boolean resetExpired = m_resetExpired.getValue().booleanValue();
    boolean modifySubresources = m_subresourceModificationField.getValue().booleanValue();
    List<CmsUUID> changedIds = new ArrayList<CmsUUID>();
    for (CmsResource resource : m_dialogContext.getResources()) {
        changeAvailability(resource, released, resetReleased, expired, resetExpired, modifySubresources);
        changedIds.add(resource.getStructureId());
    }

    String notificationInterval = m_notificationIntervalField.getValue().trim();
    int notificationIntervalInt = 0;
    try {
        notificationIntervalInt = Integer.parseInt(notificationInterval);
    } catch (NumberFormatException e) {
        LOG.warn(e.getLocalizedMessage(), e);
    }
    Boolean notificationEnabled = m_notificationEnabledField.getValue();
    boolean notificationSettingsUnchanged = notificationInterval.equals(m_initialNotificationInterval)
            && notificationEnabled.equals(m_initialNotificationEnabled);

    CmsObject cms = A_CmsUI.getCmsObject();
    if (!notificationSettingsUnchanged) {
        for (CmsResource resource : m_dialogContext.getResources()) {
            performSingleResourceNotification(A_CmsUI.getCmsObject(), cms.getSitePath(resource),
                    notificationEnabled.booleanValue(), notificationIntervalInt,
                    m_modifySiblingsField.getValue().booleanValue());
        }

    }
    return changedIds;
}

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

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

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

public BigDecimal getSchaufensterfront() {
    try {//from  w  w w  . ja v a  2  s.  c o m
        return Is24CsvFormat.parseDecimal(this.get(FIELD_SCHAUFENSTERFRONT));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Schaufensterfront'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.richfaces.component.UIDatascroller.java

public int getPageForFacet(String facetName) {
    if (facetName == null) {
        throw new NullPointerException();
    }// www.j  a  va 2s .c  o  m

    int newPage = 1;
    int pageCount = getPageCount();

    if (FIRST_FACET_NAME.equals(facetName)) {
        newPage = 1;
    } else if (PREVIOUS_FACET_NAME.equals(facetName)) {
        newPage = getPage() - 1;
    } else if (NEXT_FACET_NAME.equals(facetName)) {
        newPage = getPage() + 1;
    } else if (LAST_FACET_NAME.equals(facetName)) {
        newPage = pageCount > 0 ? pageCount : 1;
    } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
        newPage = getPage() + getFastStepOrDefault();
    } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
        newPage = getPage() - getFastStepOrDefault();
    } else {
        try {
            newPage = Integer.parseInt(facetName.toString());
        } catch (NumberFormatException e) {
            throw new FacesException(e.getLocalizedMessage(), e);
        }
    }

    if (newPage >= 1 && newPage <= pageCount) {
        return newPage;
    } else {
        return 0;
    }
}

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

public BigDecimal getLastenaufzugTragkraft() {
    try {//  w  ww  .  j  av  a2s  . co  m
        return Is24CsvFormat.parseDecimal(this.get(FIELD_LASTENAUFZUG_TRAGKRAFT));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read 'Lastenaufzug Tragkraft'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

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

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