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.idx.IdxRecord.java

public Integer getDistanceShop() {
    try {/* ww  w.  j av  a 2 s  .  c o  m*/
        return IdxFormat.parseInteger(this.get(FIELD_DISTANCE_SHOP));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read distance to shopping!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public BigDecimal getNumberOfApartments() {
    try {/*from  www  .  j a v a 2  s .co  m*/
        return IdxFormat.parseDecimal(this.get(FIELD_NUMBER_OF_APARTMENTS));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read number of apartments!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public BigDecimal getMaximalFloorLoading() {
    try {/*from   w  w  w.  j  ava  2  s .  c  om*/
        return IdxFormat.parseDecimal(this.get(FIELD_MAXIMAL_FLOOR_LOADING));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read maximal floor loading!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public Integer getDistanceKindergarten() {
    try {//from   ww  w .  j  a  v a2 s . com
        return IdxFormat.parseInteger(this.get(FIELD_DISTANCE_KINDERGARTEN));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read distance to kindergarten!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public Integer getDistanceSchool1() {
    try {// www  .  j  ava  2  s  . c  o  m
        return IdxFormat.parseInteger(this.get(FIELD_DISTANCE_SCHOOL1));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read distance to primary school!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public Integer getDistancePublicTransport() {
    try {/*from w  w w. j a v a  2  s  .c om*/
        return IdxFormat.parseInteger(this.get(FIELD_DISTANCE_PUBLIC_TRANSPORT));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read distance to public transport!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public Integer getDistanceSchool2() {
    try {//from  ww  w .j a  va 2  s .  com
        return IdxFormat.parseInteger(this.get(FIELD_DISTANCE_SCHOOL2));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read distance to secondary school!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public BigDecimal getCarryingCapacityCrane() {
    try {//  w w w . j a  v a 2  s.  c  om
        return IdxFormat.parseDecimal(this.get(FIELD_CARRYING_CAPACITY_CRANE));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read carrying capacity for the crane!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public BigDecimal getCarryingCapacityElevator() {
    try {//from  ww  w.java 2 s  .c o  m
        return IdxFormat.parseDecimal(this.get(FIELD_CARRYING_CAPACITY_ELEVATOR));
    } catch (NumberFormatException ex) {
        LOGGER.warn("Can't read carrying capacity for the elevator!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.infoscoop.request.filter.RssFilter.java

public static byte[] process(ProxyRequest request, InputStream responseStream) throws IOException {

    String dateTimeFormat = request.getRequestHeader("X-IS-DATETIMEFORMAT");
    if (dateTimeFormat != null) {
        dateTimeFormat = URLDecoder.decode(dateTimeFormat, "UTF-8");
    }/*from ww w . j a va 2  s.  c o  m*/
    String freshTime = request.getRequestHeader("X-IS-FRESHTIME");
    String maxCountString = request.getRequestHeader("X-IS-RSSMAXCOUNT");
    int maxCount = Integer.MAX_VALUE;
    if (maxCountString != null) {
        try {
            int paramMaxCount = Integer.parseInt(maxCountString);
            if (paramMaxCount > 0) {
                maxCount = paramMaxCount;
            }
        } catch (NumberFormatException e) {
            log.warn("rssmaxcount \"" + maxCountString + "\" isn't integer value.");
        }
    }

    // Filtering
    String titleFilter = request.getRequestHeader("X-IS-TITLEFILTER");
    if (titleFilter != null)
        titleFilter = URLDecoder.decode(titleFilter, "UTF-8");
    String creatorFilter = request.getRequestHeader("X-IS-CREATORFILTER");
    if (creatorFilter != null)
        creatorFilter = URLDecoder.decode(creatorFilter, "UTF-8");
    String categoryFilter = request.getRequestHeader("X-IS-CATEGORYFILTER");
    if (categoryFilter != null)
        categoryFilter = URLDecoder.decode(categoryFilter, "UTF-8");

    //      String freshDays = request.getRequestHeader("_freshdays");
    //      String logoffDateTime = request.getRequestHeader("_logoffdatetime");

    BufferedInputStream bis = new BufferedInputStream(responseStream);

    boolean isAtom = isAtom(bis);

    XMLFilter.skipEmptyLine(bis);

    String pageSizeStr = request.getRequestHeader("X-IS-PAGESIZE");
    int pageSize = -1;
    if (pageSizeStr != null) {
        try {
            pageSize = Integer.parseInt(pageSizeStr);
        } catch (NumberFormatException ex) {
            log.warn("init parameter \"rssPageSize\" has illegal value");
        }
    }
    //if( pageSize < 0 )
    //   pageSize = 20;

    long start = System.currentTimeMillis();
    RssResultBuilder resultBuilder = new RssJsonResultBuilder(pageSize);
    RssHandler handler;
    if (isAtom) {
        handler = new AtomHandler(resultBuilder, dateTimeFormat, freshTime, maxCount, titleFilter,
                creatorFilter, categoryFilter);
    } else {
        handler = new RssHandler(resultBuilder, dateTimeFormat, freshTime, maxCount, titleFilter, creatorFilter,
                categoryFilter);
    }
    try {
        XMLReader reader = factory.newSAXParser().getXMLReader();
        reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
        reader.setEntityResolver(NoOpEntityResolver.getInstance());
        reader.setContentHandler(handler);
        reader.parse(new InputSource(bis));

        if (log.isDebugEnabled()) {
            long end = System.currentTimeMillis();
            log.debug("Rss parse duration:" + (end - start));
        }
        int pageCount = resultBuilder.getPageCount();
        if (pageCount > 1) {
            String uid = request.getPortalUid();
            if (uid == null)
                uid = request.getRequestHeader("MSDPortal-SessionId");
            for (int pageNum = 0; pageNum < pageCount; pageNum++) {
                RssCacheDAO.newInstance().insertCache(uid, request.getTargetURL(), pageNum,
                        resultBuilder.getResult(pageNum));
            }
        }

        return resultBuilder.getResult(0).getBytes("UTF-8");
    } catch (SAXException e) {
        log.error("Xml file at URL [ " + request.getTargetURL() + "] is failed to be analysed.["
                + e.getLocalizedMessage() + "]", e);
        resultBuilder.setStatusCode(1);
        resultBuilder.setMessage("Failed to analyse xml.: " + e.getLocalizedMessage());
        return resultBuilder.getResult().getBytes("UTF-8");
    } catch (IOException e) {
        log.error("Xml file at URL [ " + request.getTargetURL() + "] is failed to be analysed.["
                + e.getLocalizedMessage() + "]", e);
        resultBuilder.setStatusCode(1);
        resultBuilder.setMessage("Failed to analyse xml.: " + e.getLocalizedMessage());
        return resultBuilder.getResult().getBytes("UTF-8");
    } catch (ParserConfigurationException e) {
        log.error("Xml file at URL [ " + request.getTargetURL() + "] is failed to be analysed.["
                + e.getLocalizedMessage() + "]", e);
        resultBuilder.setStatusCode(1);
        resultBuilder.setMessage("Failed to analyse xml.: " + e.getLocalizedMessage());
        return resultBuilder.getResult().getBytes("UTF-8");
    } finally {
        bis.close();
    }

}