/** * <p>sanitizeString</p> * * @param raw an array of {@link java.lang.String} objects. * @return an array of {@link java.lang.String} objects. */ public static String[] sanitizeString(String[] raw) { for (int i = 0; i < raw.length; i++) { raw[i] = sanitizeString(raw[i]); } return raw; }
private OnmsMonitoredService findService(String ifServiceIdString) { int ifServiceId; try { ifServiceId = WebSecurityUtils.safeParseInt(ifServiceIdString); } catch (NumberFormatException e) { throw new IllegalArgumentException("parameter ifserviceid '" + ifServiceIdString + "' is not an integer"); } OnmsMonitoredService service = m_monitoredServiceDao.get(ifServiceId); if (service == null) { throw new IllegalArgumentException("monitored service with " + "id of " + ifServiceId + " could not be found"); } return service; }
/** * <p>sanitizeString</p> * * @param raw a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ public static String sanitizeString(String raw) { return sanitizeString(raw, false); }
private OnmsMonitoredService findService(String ifServiceIdString) { int ifServiceId; try { ifServiceId = WebSecurityUtils.safeParseInt(ifServiceIdString); } catch (NumberFormatException e) { throw new IllegalArgumentException("parameter ifserviceid '" + ifServiceIdString + "' is not an integer"); } OnmsMonitoredService service = m_monitoredServiceDao.get(ifServiceId); if (service == null) { throw new IllegalArgumentException("monitored service with " + "id of " + ifServiceId + " could not be found"); } return service; }
private static Map<String, String[]> sanitizeParamMap(Map<String, String[]> raw) { Map<String, String[]> res = new HashMap<String, String[]>(); if (raw==null) { return res; } for (final Entry<String, String[]> entry : raw.entrySet()) { final String key = entry.getKey(); final String[] rawVals = entry.getValue(); final String[] snzVals = new String[rawVals.length]; for (int i=0; i < rawVals.length; i++) { snzVals[i] = WebSecurityUtils.sanitizeString(rawVals[i]); } res.put(key, snzVals); } return res; }
private OnmsCategory findCategory(String name) { int categoryId = -1; try { categoryId = WebSecurityUtils.safeParseInt(name); } catch (NumberFormatException e) { throw new IllegalArgumentException("parameter 'categoryid' " + "with value '" + name + "' could not be parsed " + "as an integer"); } OnmsCategory category = m_categoryDao.get(categoryId); if (category == null) { throw new IllegalArgumentException("Could not find category " + "with category ID " + categoryId); } return category; }
private static Map<String, String[]> sanitizeParamMap(Map<String, String[]> raw) { Map<String, String[]> res = new HashMap<String, String[]>(); if (raw==null) { return res; } for (final Entry<String, String[]> entry : raw.entrySet()) { final String key = entry.getKey(); final String[] rawVals = entry.getValue(); final String[] snzVals = new String[rawVals.length]; for (int i=0; i < rawVals.length; i++) { snzVals[i] = WebSecurityUtils.sanitizeString(rawVals[i]); } res.put(key, snzVals); } return res; }
private OnmsCategory findCategory(String name) { int categoryId = -1; try { categoryId = WebSecurityUtils.safeParseInt(name); } catch (NumberFormatException e) { throw new IllegalArgumentException("parameter 'categoryid' " + "with value '" + name + "' could not be parsed " + "as an integer"); } OnmsCategory category = m_categoryDao.get(categoryId); if (category == null) { throw new IllegalArgumentException("Could not find category " + "with category ID " + categoryId); } return category; }
for (final String value : values) { buffer.append("<input type=\"hidden\" name=\""); buffer.append(WebSecurityUtils.sanitizeString(name)); buffer.append("\" value=\""); buffer.append(WebSecurityUtils.sanitizeString(value)); buffer.append("\" />"); buffer.append("\n"); for (final String value : values) { buffer.append("<input type=\"hidden\" name=\""); buffer.append(WebSecurityUtils.sanitizeString(name)); buffer.append("\" value=\""); buffer.append(WebSecurityUtils.sanitizeString(value)); buffer.append("\" />"); buffer.append("\n");
private OnmsNode findNode(String nodeIdString) { final int nodeId; try { nodeId = WebSecurityUtils.safeParseInt(nodeIdString); } catch (final NumberFormatException e) { throw new IllegalArgumentException("parameter 'node' with value '" + nodeIdString + "' could not be parsed as an integer"); } return getNodeDao().get(nodeId); }
for (final String value : values) { buffer.append("<input type=\"hidden\" name=\""); buffer.append(WebSecurityUtils.sanitizeString(name)); buffer.append("\" value=\""); buffer.append(WebSecurityUtils.sanitizeString(value)); buffer.append("\" />"); buffer.append("\n"); for (final String value : values) { buffer.append("<input type=\"hidden\" name=\""); buffer.append(WebSecurityUtils.sanitizeString(name)); buffer.append("\" value=\""); buffer.append(WebSecurityUtils.sanitizeString(value)); buffer.append("\" />"); buffer.append("\n");
private OnmsNode findNode(String nodeIdString) { final int nodeId; try { nodeId = WebSecurityUtils.safeParseInt(nodeIdString); } catch (final NumberFormatException e) { throw new IllegalArgumentException("parameter 'node' with value '" + nodeIdString + "' could not be parsed as an integer"); } return getNodeDao().get(nodeId); }
@Override public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) { if (event.hasNodeid()) { try { String foreignSource = eventUtil.getForeignSource(event.getNodeid()); if (foreignSource != null) { return WebSecurityUtils.sanitizeString(foreignSource); } } catch (SQLException ex) { // do nothing LoggerFactory.getLogger(getClass()).info("ForeignSource unavailable for node with id:", event.getNodeid(), ex); } } return ""; }
/** * <p>findApplication</p> * * @param name a {@link java.lang.String} object. * @return a {@link org.opennms.netmgt.model.OnmsApplication} object. */ public OnmsApplication findApplication(String name) { int applicationId = -1; try { applicationId = WebSecurityUtils.safeParseInt(name); } catch (NumberFormatException e) { throw new IllegalArgumentException("parameter 'applicationid' " + "with value '" + name + "' could not be parsed " + "as an integer"); } OnmsApplication application = m_applicationDao.get(applicationId); if (application == null) { throw new IllegalArgumentException("Could not find application " + "with application ID " + applicationId); } return application; }
@Override public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) { if (event.hasNodeid()) { try { String foreignSource = eventUtil.getForeignSource(event.getNodeid()); if (foreignSource != null) { return WebSecurityUtils.sanitizeString(foreignSource); } } catch (SQLException ex) { // do nothing LoggerFactory.getLogger(getClass()).info("ForeignSource unavailable for node with id:", event.getNodeid(), ex); } } return ""; }
/** * <p>findApplication</p> * * @param name a {@link java.lang.String} object. * @return a {@link org.opennms.netmgt.model.OnmsApplication} object. */ public OnmsApplication findApplication(String name) { int applicationId = -1; try { applicationId = WebSecurityUtils.safeParseInt(name); } catch (NumberFormatException e) { throw new IllegalArgumentException("parameter 'applicationid' " + "with value '" + name + "' could not be parsed " + "as an integer"); } OnmsApplication application = m_applicationDao.get(applicationId); if (application == null) { throw new IllegalArgumentException("Could not find application " + "with application ID " + applicationId); } return application; }
@Override public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) { if (event.hasNodeid()) { try { String foreignId = eventUtil.getForeignId(event.getNodeid()); if (foreignId != null) { return WebSecurityUtils.sanitizeString(foreignId); } } catch (SQLException ex) { // do nothing LoggerFactory.getLogger(getClass()).info("ForeignId unavailable for node with id:", event.getNodeid(), ex); } } return ""; }
Integer id; try { id = WebSecurityUtils.safeParseInt(idString); } catch (NumberFormatException e) { throw new IllegalArgumentException("toAdd element '" Integer id; try { id = WebSecurityUtils.safeParseInt(idString); } catch (NumberFormatException e) { throw new IllegalArgumentException("toDelete element '"
@Override public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) { if (event.hasNodeid()) { try { String foreignId = eventUtil.getForeignId(event.getNodeid()); if (foreignId != null) { return WebSecurityUtils.sanitizeString(foreignId); } } catch (SQLException ex) { // do nothing LoggerFactory.getLogger(getClass()).info("ForeignId unavailable for node with id:", event.getNodeid(), ex); } } return ""; }
Integer id; try { id = WebSecurityUtils.safeParseInt(idString); } catch (NumberFormatException e) { throw new IllegalArgumentException("toAdd element '" Integer id; try { id = WebSecurityUtils.safeParseInt(idString); } catch (NumberFormatException e) { throw new IllegalArgumentException("toDelete element '"