/** * Returns the AlertInfo value of this AlertInfoHeader. * @return the URI representing the AlertInfo. */ public URI getAlertInfo() { URI alertInfoUri = null; if (this.uri != null) { alertInfoUri = (URI) this.uri; } else { try { alertInfoUri = (URI) new GenericURI(string); } catch (ParseException e) { ; // Eat the exception. } } return alertInfoUri; }
/** * Get the parameter value as a URI. * * @param parameterName -- the parameter name * * @return value of the parameter as a URI or null if the parameter * not present. */ protected GenericURI getParameterAsURI(String parameterName) { Object val = getParameterValue(parameterName); if (val instanceof GenericURI) return (GenericURI) val; else { try { return new GenericURI((String) val); } catch (ParseException ex) { //catch ( URISyntaxException ex) { return null; } } }
/** * Creates a URI based on given URI string. The URI string is parsed in * order to create the new URI instance. Depending on the scheme the * returned may or may not be a SipURI or TelURL cast as a URI. * * @param uri - the new string value of the URI. * @throws URISyntaxException if the URI string is malformed. */ public javax.sip.address.URI createURI(String uri) throws ParseException { if (uri == null) throw new NullPointerException("null arg"); try { URLParser urlParser = new URLParser(uri); String scheme = urlParser.peekScheme(); if (scheme == null) throw new ParseException("bad scheme", 0); if (scheme.equalsIgnoreCase("sip") || scheme.equalsIgnoreCase("sips")) { return this.createSipURI(uri); } else if (scheme.equalsIgnoreCase("tel")) { return this.createTelURL(uri); } // Issue 316 : the scheme should match ALPHA *(ALPHA / DIGIT / "+" / "-" / "." ) if(!SCHEME_PATTERN.matcher(scheme).matches()) { throw new ParseException("the scheme " + scheme + " from the following uri " + uri + " doesn't match ALPHA *(ALPHA / DIGIT / \"+\" / \"-\" / \".\" ) from RFC3261",0); } } catch (ParseException ex) { throw new ParseException(ex.getMessage(), 0); } return new gov.nist.javax.sip.address.GenericURI(uri); }
String urlString = uricString(); try { retval = new GenericURI(urlString); } catch (ParseException ex) { throw createParseException(ex.getMessage());
String urlString = uricString(); try { retval = new GenericURI(urlString); } catch (ParseException ex) { throw createParseException(ex.getMessage());