Skip to content

Commit

Permalink
Issue number:
Browse files Browse the repository at this point in the history
Obtained from:
Submitted by:
Reviewed by:   mranga

compiles olk on my box!
  • Loading branch information
ranganathanm committed Oct 26, 2007
1 parent 063da2d commit 9efa119
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/gov/nist/javax/sip/header/SIPHeaderList.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* list are of the same class). We use this for building type homogeneous lists
* of SIPObjects that appear in SIPHeaders
*
* @version 1.2 $Revision: 1.10 $ $Date: 2005/10/09 18:47:53
* @version 1.2 $Revision: 1.11 $ $Date: 2005/10/09 18:47:53
*/
public abstract class SIPHeaderList<HDR extends SIPHeader> extends SIPHeader implements java.util.List<HDR>, Header {

Expand Down Expand Up @@ -653,7 +653,7 @@ public HDR set(int position, HDR sipHeader) {
}


@Override

public <T> T[] toArray(T[] array) {
return this.hlist.toArray(array);
}
Expand Down
10 changes: 5 additions & 5 deletions src/gov/nist/javax/sip/message/ListMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/**
* A map of which of the standard headers may appear as a list
*
* @version 1.2 $Revision: 1.11 $ $Date: 2007-02-12 20:00:37 $
* @version 1.2 $Revision: 1.12 $ $Date: 2007-10-26 15:54:51 $
* @since 1.1
*/
class ListMap {
Expand All @@ -45,7 +45,7 @@ class ListMap {
// (provided it has a list form). Note that under JAVA-5 we have
// typed collections which would render such a list obsolete. However,
// we are not using java 5.
private static Hashtable headerListTable;
private static Hashtable<Class<?>,Class<?>> headerListTable;

private static boolean initialized;
static {
Expand All @@ -57,7 +57,7 @@ static private void initializeListMap() {
* Build a table mapping between objects that have a list form and the
* class of such objects.
*/
headerListTable = new Hashtable();
headerListTable = new Hashtable<Class<?>, Class<?>>();
headerListTable.put(ExtensionHeaderImpl.class, ExtensionHeaderList.class);

headerListTable.put(Contact.class, ContactList.class);
Expand Down Expand Up @@ -169,8 +169,8 @@ static protected SIPHeaderList getList(SIPHeader sipHeader) {
if (!initialized)
initializeListMap();
try {
Class headerClass = sipHeader.getClass();
Class listClass = (Class) headerListTable.get(headerClass);
Class<? extends SIPHeader> headerClass = sipHeader.getClass();
Class<? extends SIPHeaderList<?>> listClass = (Class) headerListTable.get(headerClass);
SIPHeaderList shl = (SIPHeaderList) listClass.newInstance();
shl.setHeaderName(sipHeader.getName());
return shl;
Expand Down
23 changes: 12 additions & 11 deletions src/gov/nist/javax/sip/message/SIPMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* @see StringMsgParser
* @see PipelinedMsgParser
*
* @version 1.2 $Revision: 1.31 $ $Date: 2007-10-26 03:53:18 $
* @version 1.2 $Revision: 1.32 $ $Date: 2007-10-26 15:54:52 $
* @since 1.1
*
* @author M. Ranganathan <br/>
Expand All @@ -73,7 +73,7 @@ public abstract class SIPMessage extends MessageObject implements
/**
* unparsed headers
*/
protected LinkedList unrecognizedHeaders;
protected LinkedList<String> unrecognizedHeaders;

/**
* List of parsed headers (in the order they were added)
Expand Down Expand Up @@ -477,7 +477,7 @@ public String debugDump() {
* class.
*/
public SIPMessage() {
this.unrecognizedHeaders = new LinkedList<SIPHeader>();
this.unrecognizedHeaders = new LinkedList<String>();
this.headers = new ConcurrentLinkedQueue<SIPHeader>();
nameTable = new Hashtable<String,SIPHeader>();
try {
Expand Down Expand Up @@ -596,7 +596,7 @@ public void attachHeader(SIPHeader header, boolean replaceFlag, boolean top)

if (ListMap.hasList(header)
&& !SIPHeaderList.class.isAssignableFrom(header.getClass())) {
SIPHeaderList hdrList = ListMap.getList(header);
SIPHeaderList<SIPHeader> hdrList = ListMap.getList(header);
hdrList.add(header);
h = hdrList;
} else {
Expand Down Expand Up @@ -979,7 +979,7 @@ public void setVia(java.util.List viaList) {
* a headerList to set
*/

public void setHeader(SIPHeaderList sipHeaderList) {
public void setHeader(SIPHeaderList<Via> sipHeaderList) {
this.setHeader((Header) sipHeaderList);
}

Expand Down Expand Up @@ -1381,16 +1381,17 @@ public void removeContent() {
* is the name of the header to get.
* @return a header or header list that contians the retrieved header.
*/
public ListIterator getHeaders(String headerName) {
@SuppressWarnings("unchecked")
public ListIterator<SIPHeader> getHeaders(String headerName) {
if (headerName == null)
throw new NullPointerException("null headerName");
SIPHeader sipHeader = (SIPHeader) nameTable.get(SIPHeaderNamesCache
.toLowerCase(headerName));
// empty iterator
if (sipHeader == null)
return new LinkedList().listIterator();
return new LinkedList<SIPHeader>().listIterator();
if (sipHeader instanceof SIPHeaderList) {
return ((SIPHeaderList) sipHeader).listIterator();
return ((SIPHeaderList<SIPHeader>) sipHeader).listIterator();
} else {
return new HeaderIterator(this, sipHeader);
}
Expand All @@ -1413,8 +1414,8 @@ public String getHeaderAsFormattedString(String name) {
}
}

private SIPHeaderList<?> getSIPHeaderListLowerCase(String lowerCaseHeaderName) {
return (SIPHeaderList<?>) nameTable.get(lowerCaseHeaderName);
private SIPHeader getSIPHeaderListLowerCase(String lowerCaseHeaderName) {
return nameTable.get(lowerCaseHeaderName);
}

/**
Expand Down Expand Up @@ -1578,7 +1579,7 @@ public void addHeader(String sipHeader) {
*
* @return a linked list containing unrecongnized headers.
*/
public ListIterator getUnrecognizedHeaders() {
public ListIterator<String> getUnrecognizedHeaders() {
return this.unrecognizedHeaders.listIterator();
}

Expand Down

0 comments on commit 9efa119

Please sign in to comment.