1/*
2* Conditions Of Use
3*
4* This software was developed by employees of the National Institute of
5* Standards and Technology (NIST), an agency of the Federal Government.
6* Pursuant to title 15 Untied States Code Section 105, works of NIST
7* employees are not subject to copyright protection in the United States
8* and are considered to be in the public domain.  As a result, a formal
9* license is not needed to use the software.
10*
11* This software is provided by NIST as a service and is expressly
12* provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
13* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
15* AND DATA ACCURACY.  NIST does not warrant or make any representations
16* regarding the use of the software or the results thereof, including but
17* not limited to the correctness, accuracy, reliability or usefulness of
18* the software.
19*
20* Permission to use this software is contingent upon your acceptance
21* of the terms of this agreement
22*
23* .
24*
25*/
26package gov.nist.javax.sip.parser;
27
28import gov.nist.javax.sip.header.*;
29import gov.nist.javax.sip.address.*;
30import java.text.ParseException;
31
32/**
33 * Address parameters parser.
34 *
35 * @version 1.2 $Revision: 1.10 $ $Date: 2009/10/22 10:25:57 $
36 * @author M. Ranganathan
37 * @since 1.1
38 *
39 */
40public class AddressParametersParser extends ParametersParser {
41
42    protected AddressParametersParser(Lexer lexer) {
43        super(lexer);
44    }
45
46    protected AddressParametersParser(String buffer) {
47        super(buffer);
48    }
49
50    protected void parse(AddressParametersHeader addressParametersHeader)
51        throws ParseException {
52        dbg_enter("AddressParametersParser.parse");
53        try {
54            AddressParser addressParser = new AddressParser(this.getLexer());
55            AddressImpl addr = addressParser.address(false);
56            addressParametersHeader.setAddress(addr);
57            lexer.SPorHT();
58            char la = this.lexer.lookAhead(0);
59            if ( this.lexer.hasMoreChars() &&
60                 la != '\0' &&
61                 la != '\n' &&
62                 this.lexer.startsId()) {
63
64                 super.parseNameValueList(addressParametersHeader);
65
66
67            }  else super.parse(addressParametersHeader);
68
69        } catch (ParseException ex) {
70            throw ex;
71        } finally {
72            dbg_leave("AddressParametersParser.parse");
73        }
74    }
75}
76