Login  Register

[jira] Commented: (OFBIZ-70) EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1

Posted by Nicolas Malin (Jira) on Jun 30, 2006; 5:50am
URL: http://ofbiz.116.s1.nabble.com/jira-Created-OFBIZ-70-EmailServices-storeIncomingEmail-EmailServices-java-643-String-index-out-of-ra1-tp169170p169177.html

    [ http://issues.apache.org/jira/browse/OFBIZ-70?page=comments#action_12418566 ]

BJ Freeman commented on OFBIZ-70:
---------------------------------


fix one

                                idx = contentTypeRaw.indexOf(";");
                                if (idx==-1)
                                {
                    contentType = contentTypeRaw.substring(0, idx);
                                }else
                    {
                    contentType = contentTypeRaw;
                    }

fix two create a seperate class for dealing with all the parculiarites of Content type including add ones not found to the Type list.



MimeContentType(String) for a constructor


> EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1
> ----------------------------------------------------------------------------------------
>
>          Key: OFBIZ-70
>          URL: http://issues.apache.org/jira/browse/OFBIZ-70
>      Project: The Open For Business Project
>         Type: Bug

>   Components: content
>     Reporter: BJ Freeman

>
>  46701852[   ServiceMcaAction.java:69 :ERROR] String index out of range: -1
> 346702033[      EmailServices.java:747:ERROR]
> ---- runtime exception report --------------------------------------------------
> Exception: java.lang.StringIndexOutOfBoundsException
> Message: String index out of range: -1
> ---- stack trace ---------------------------------------------------------------
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.String.substring(String.java:1444)
> com.businessesnetwork.communications.EmailServices.storeIncomingEmail(EmailServices.java:643)
> sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:324)
>  l       int idx = contentTypeRaw.indexOf(";");
>  ine 643              contentType = contentTypeRaw.substring(0, idx);
> email being evaluated
> Content-Type: text/plain
> Content-Disposition: inline
> Content-Transfer-Encoding: 7bit
> MIME-Version: 1.0
> I think the indexof for a semicoln will  set idx to null
> so line 643 fails.
> should test for null then
> contentType = contentTypeRaw;

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira