Thanks for reporting this, Vincent. You're right, the latest JAIN SIP 
build is resulting in this behavior. I have posted to the nist sip list 
about it (below). The sipunit libraries don't have the latest nist sip 
load so that's why the problem doesn't happen with it. After they fix 
the problem, I'll update the libraries.

I am also in the process of updating the jiplet project with the jain 
sip 1.2 version and will get the sdp jar updated there ASAP with the 
latest from the jain-sip project.

Thanks again for reporting these-
Becky

Vincent Nonnenmacher wrote:

>I found a problem when replacing jainsip1.2 lib build from the last CVS source.
>
>when running the first sipunit test I got a 
>StringIndexOutOfBoundsException catched by the 
>'eat-all' exception in the first test 
>testSendInviteWithRouteHeader of TestNoProxy 
>class, when trying to build a SIP request like 
>this :
>
>  Request invite = 
>ua.getParent().getMessageFactory().createRequest( 
>"INVITE sip:[EMAIL PROTECTED] SIP/2.0");
>
>The culprit seems to be in the parseSIPMessage method in JainSip :
>
>public SIPMessage parseSIPMessage(String 
>msgString) throws ParseException { 
>       if (msgString == null || 
>msgString.length() == 0) 
>       return null;            rawStringMessage 
>= msgString;           int i = 0; 
>       // Squeeze out any leading control 
>character.             try { 
>       while (msgString.charAt(i) < 0x20) 
>                       i++;            } 
>       catch (ArrayIndexOutOfBoundsException e) 
>{                      // Array contains only 
>control char, return null. 
>       return null;            } 
>       // Iterate thru the request/status line 
>and headers.           String currentLine = 
>null;          String currentHeader = null; 
>       boolean isFirstLine = true; 
>       SIPMessage message = null; 
>       do              { 
>       int lineStart = i; 
>       // Find the length of the line. 
>               try { 
>       char c = msgString.charAt(i); 
>               while (c != '\r' && c != '\n') 
>                               c = 
>msgString.charAt(++i);                 } 
>               catch 
>(ArrayIndexOutOfBoundsException e) { 
>               // End of the message. 
>               break;                  }
>
>the ArrayIndexOutOfBoundsException aren't raised 
>as the exception are 
>StringIndexOutOfBoundsException so the method 
>exit immediately.
>
>If I stay with the librairies provided with sipunit all seems to work fine
>
>(but jiplet container has problems with the 
>nist-sdp-1.0 librairie but work fine with last 
>build version from java-dev cvs).
>
>  
>
Hi,

There's a line of my code that has worked for a long time:
      messageFactory.createRequest("INVITE sip:[EMAIL PROTECTED] SIP/2.0");

But now (with the latest from jain-sip CVS repository) it results in a 
StringIndexOutOfBoundsException.

It seems to come from here (instead of ArrayIndexOutOfBoundsException, 
the StringIndexOutOfBoundsException happens):

          gov.nist.javax.sip.parser.StringMsgParser.parseSIPMessage()  
(line 270)

           // Find the length of the line.
           try {
               char c = msgString.charAt(i);
               while (c != '\r' && c != '\n')
                   c = msgString.charAt(++i);
           }
           catch (ArrayIndexOutOfBoundsException e) {
               // End of the message.
               break;
           }

When the problem might have been introduced wasn't obvious from looking 
at the cvs repository. I tried replacing the catch of 
ArrayIndexOutOfBoundsException with catch of IndexOutOfBoundsException 
but then the method throws a null pointer exception, so the fix wasn't 
real obvious.

Regards,
Becky

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cafesip-sipunit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cafesip-sipunit

Reply via email to