Example usage for java.lang NumberFormatException getMessage

List of usage examples for java.lang NumberFormatException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java

public ModelAndView removeGenetic(HttpServletRequest request, Object command, Errors errors) {
    ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command;
    List<GeneticIntervention> bs = cmd.getAeReport().getGeneticInterventions();

    int index;//from   w ww . j a v  a 2  s.  c o  m
    try {
        index = Integer.parseInt(request.getParameter("index"));
    } catch (NumberFormatException e) {
        index = -1;
        log.debug("Wrong <index> for <genetics> list: " + e.getMessage());
    }

    if (bs.size() - 1 < index) {
        log.debug("Wrong <index> for genetics> list.");
    } else if (index >= 0) {
        GeneticIntervention object = (GeneticIntervention) bs.get(index);
        bs.remove(object);
        deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command);
    }

    int size = bs.size();
    Integer[] indexes = new Integer[size];
    for (int i = 0; i < size; i++) {
        indexes[i] = size - (i + 1);
    }
    ModelAndView modelAndView = new ModelAndView("ae/ajax/geneticInterventionFormSection");
    modelAndView.getModel().put("genetics", bs);
    modelAndView.getModel().put("indexes", indexes);

    return modelAndView;
}

From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java

public ModelAndView removeSurgery(HttpServletRequest request, Object command, Errors errors) {
    ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command;
    List<SurgeryIntervention> surgeries = cmd.getAeReport().getSurgeryInterventions();

    int index;/*ww w .  j  av a 2s. c  o m*/
    try {
        index = Integer.parseInt(request.getParameter("index"));
    } catch (NumberFormatException e) {
        index = -1;
        log.debug("Wrong <index> for <surgeries> list: " + e.getMessage());
    }

    if (surgeries.size() - 1 < index) {
        log.debug("Wrong <index> for <surgeries> list.");
    } else if (index >= 0) {
        SurgeryIntervention object = (SurgeryIntervention) surgeries.get(index);
        surgeries.remove(object);
        deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command);
    }

    int size = surgeries.size();
    Integer[] indexes = new Integer[size];
    for (int i = 0; i < size; i++) {
        indexes[i] = size - (i + 1);
    }
    ModelAndView modelAndView = new ModelAndView("ae/ajax/surgeryInterventionFormSection");
    modelAndView.getModel().put("surgeries", surgeries);
    modelAndView.getModel().put("indexes", indexes);

    return modelAndView;
}

From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java

public ModelAndView removeDietary(HttpServletRequest request, Object command, Errors errors) {
    ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command;
    List<DietarySupplementIntervention> bs = cmd.getAeReport().getDietaryInterventions();

    int index;//www .j a v  a 2  s . com
    try {
        index = Integer.parseInt(request.getParameter("index"));
    } catch (NumberFormatException e) {
        index = -1;
        log.debug("Wrong <index> for <dietaries> list: " + e.getMessage());
    }

    if (bs.size() - 1 < index) {
        log.debug("Wrong <index> for <dietaries> list.");
    } else if (index >= 0) {
        DietarySupplementIntervention object = (DietarySupplementIntervention) bs.get(index);
        bs.remove(object);
        deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command);
    }

    int size = bs.size();
    Integer[] indexes = new Integer[size];
    for (int i = 0; i < size; i++) {
        indexes[i] = size - (i + 1);
    }
    ModelAndView modelAndView = new ModelAndView("ae/ajax/dietaryInterventionFormSection");
    modelAndView.getModel().put("dietaries", bs);
    modelAndView.getModel().put("indexes", indexes);

    return modelAndView;
}

From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java

public ModelAndView removeRadiation(HttpServletRequest request, Object command, Errors errors) {
    ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command;
    List<RadiationIntervention> radiations = cmd.getAeReport().getRadiationInterventions();

    int index;/* ww  w.  j  ava  2  s .  co m*/
    try {
        index = Integer.parseInt(request.getParameter("index"));
    } catch (NumberFormatException e) {
        index = -1;
        log.debug("Wrong <index> for <radiations> list: " + e.getMessage());
    }

    if (radiations.size() - 1 < index) {
        log.debug("Wrong <index> for <radiations> list.");
    } else if (index >= 0) {
        RadiationIntervention object = (RadiationIntervention) radiations.get(index);
        radiations.remove(object);
        deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command);
    }

    int size = radiations.size();
    Integer[] indexes = new Integer[size];
    for (int i = 0; i < size; i++) {
        indexes[i] = size - (i + 1);
    }
    ModelAndView modelAndView = new ModelAndView("ae/ajax/radiationInterventionFormSection");
    modelAndView.getModel().put("radiations", radiations);
    modelAndView.getModel().put("indexes", indexes);

    return modelAndView;
}

From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java

public ModelAndView removeBehavioral(HttpServletRequest request, Object command, Errors errors) {
    ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command;
    List<BehavioralIntervention> bs = cmd.getAeReport().getBehavioralInterventions();

    int index;/*from   w w  w .j a  va  2s .c  om*/
    try {
        index = Integer.parseInt(request.getParameter("index"));
    } catch (NumberFormatException e) {
        index = -1;
        log.debug("Wrong <index> for <behaviorals> list: " + e.getMessage());
    }

    if (bs.size() - 1 < index) {
        log.debug("Wrong <index> for <behaviorals> list.");
    } else if (index >= 0) {
        BehavioralIntervention object = (BehavioralIntervention) bs.get(index);
        bs.remove(object);
        deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command);
    }

    int size = bs.size();
    Integer[] indexes = new Integer[size];
    for (int i = 0; i < size; i++) {
        indexes[i] = size - (i + 1);
    }
    ModelAndView modelAndView = new ModelAndView("ae/ajax/behavioralInterventionFormSection");
    modelAndView.getModel().put("behaviorals", bs);
    modelAndView.getModel().put("indexes", indexes);

    return modelAndView;
}

From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java

public ModelAndView removeBiological(HttpServletRequest request, Object command, Errors errors) {
    ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command;
    List<BiologicalIntervention> bs = cmd.getAeReport().getBiologicalInterventions();

    int index;/*ww  w  .jav  a 2 s  . com*/
    try {
        index = Integer.parseInt(request.getParameter("index"));
    } catch (NumberFormatException e) {
        index = -1;
        log.debug("Wrong <index> for <biologicals> list: " + e.getMessage());
    }

    if (bs.size() - 1 < index) {
        log.debug("Wrong <index> for <biologicals> list.");
    } else if (index >= 0) {
        BiologicalIntervention object = (BiologicalIntervention) bs.get(index);
        bs.remove(object);
        deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command);
    }

    int size = bs.size();
    Integer[] indexes = new Integer[size];
    for (int i = 0; i < size; i++) {
        indexes[i] = size - (i + 1);
    }
    ModelAndView modelAndView = new ModelAndView("ae/ajax/biologicalInterventionFormSection");
    modelAndView.getModel().put("biologicals", bs);
    modelAndView.getModel().put("indexes", indexes);

    return modelAndView;
}

From source file:com.microsoft.tfs.core.httpclient.cookie.CookieSpecBase.java

/**
 * Parse the cookie attribute and update the corresponsing {@link Cookie}
 * properties.// w  ww.j  a  v a  2s .c  o m
 *
 * @param attribute
 *        {@link HeaderElement} cookie attribute from the
 *        <tt>Set- Cookie</tt>
 * @param cookie
 *        {@link Cookie} to be updated
 * @throws MalformedCookieException
 *         if an exception occurs during parsing
 */

@Override
public void parseAttribute(final NameValuePair attribute, final Cookie cookie) throws MalformedCookieException {

    if (attribute == null) {
        throw new IllegalArgumentException("Attribute may not be null.");
    }
    if (cookie == null) {
        throw new IllegalArgumentException("Cookie may not be null.");
    }
    final String paramName = attribute.getName().toLowerCase();
    String paramValue = attribute.getValue();

    if (paramName.equals("path")) {

        if ((paramValue == null) || (paramValue.trim().equals(""))) {
            paramValue = "/";
        }
        cookie.setPath(paramValue);
        cookie.setPathAttributeSpecified(true);

    } else if (paramName.equals("domain")) {

        if (paramValue == null) {
            throw new MalformedCookieException("Missing value for domain attribute");
        }
        if (paramValue.trim().equals("")) {
            throw new MalformedCookieException("Blank value for domain attribute");
        }
        cookie.setDomain(paramValue);
        cookie.setDomainAttributeSpecified(true);

    } else if (paramName.equals("max-age")) {

        if (paramValue == null) {
            throw new MalformedCookieException("Missing value for max-age attribute");
        }
        int age;
        try {
            age = Integer.parseInt(paramValue);
        } catch (final NumberFormatException e) {
            throw new MalformedCookieException("Invalid max-age " + "attribute: " + e.getMessage());
        }
        cookie.setExpiryDate(new Date(System.currentTimeMillis() + age * 1000L));

    } else if (paramName.equals("secure")) {

        cookie.setSecure(true);

    } else if (paramName.equals("comment")) {

        cookie.setComment(paramValue);

    } else if (paramName.equals("expires")) {

        if (paramValue == null) {
            throw new MalformedCookieException("Missing value for expires attribute");
        }

        try {
            cookie.setExpiryDate(DateUtil.parseDate(paramValue, datepatterns));
        } catch (final DateParseException dpe) {
            LOG.debug("Error parsing cookie date", dpe);
            throw new MalformedCookieException("Unable to parse expiration date parameter: " + paramValue);
        }
    } else {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Unrecognized cookie attribute: " + attribute.toString());
        }
    }
}

From source file:tema11.GUI.java

private void ValueButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ValueButton2MouseClicked

    TxRes.setText(" ");

    String p2 = new String();
    p2 = TxPol2.getText();//from w  w w .ja v  a2s. c  o  m
    int g2;
    int[] pol;
    double x;

    try {
        x = Double.parseDouble(TxValue.getText());

        g2 = Integer.parseInt(TxGrad2.getText());

        pol = PolinomOperations.parseString(p2, g2);

        TxRes.setText(String.valueOf(PolinomOperations.findValue(pol, x)));
    } catch (NumberFormatException e) {
        JOptionPane.showMessageDialog(this, "Introduceti o valoare numerica pentru X", "Polinom Error",
                JOptionPane.ERROR_MESSAGE);

    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, e.getMessage(), "Polinom Error", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java

public ModelAndView removeOtherAE(HttpServletRequest request, Object command, Errors errors) {
    ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command;
    List<OtherAEIntervention> bs = cmd.getAeReport().getOtherAEInterventions();

    int index;//from w w w .  j  a  v  a2  s .c  o  m
    try {
        index = Integer.parseInt(request.getParameter("index"));
    } catch (NumberFormatException e) {
        index = -1;
        log.debug("Wrong <index> for <otherAEinterventions> list: " + e.getMessage());
    }

    if (bs.size() - 1 < index) {
        log.debug("Wrong <index> for genetics> list.");
    } else if (index >= 0) {
        OtherAEIntervention object = (OtherAEIntervention) bs.get(index);
        bs.remove(object);
        deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command);
    }

    int size = bs.size();
    Integer[] indexes = new Integer[size];
    for (int i = 0; i < size; i++) {
        indexes[i] = size - (i + 1);
    }
    ModelAndView modelAndView = new ModelAndView("ae/ajax/otherAEInterventionFormSection");
    modelAndView.getModel().put("otherAEInterventions", bs);
    modelAndView.getModel().put("indexes", indexes);

    return modelAndView;
}

From source file:tema11.GUI.java

private void ValueButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ValueButton1MouseClicked

    TxRes.setText(" ");

    String p1 = new String();
    p1 = TxPol1.getText();/*from w  w  w .  j  a v a 2  s .c om*/
    int g1;
    int[] pol;
    double x;

    try {
        x = Double.parseDouble(TxValue.getText());

        g1 = Integer.parseInt(TxGrad1.getText());

        pol = PolinomOperations.parseString(p1, g1);

        TxRes.setText(String.valueOf(PolinomOperations.findValue(pol, x)));

        System.out.println(PolinomOperations.findValue(pol, x));
    } catch (NumberFormatException e) {
        JOptionPane.showMessageDialog(this, "Introduceti o valoare numerica pentru X", "Polinom Error",
                JOptionPane.ERROR_MESSAGE);

    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, e.getMessage(), "Polinom Error", JOptionPane.ERROR_MESSAGE);
    }
}