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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
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

Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
    [ 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

Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-70?page=comments#action_12424308 ]
           
BJ Freeman commented on OFBIZ-70:
---------------------------------

thefirst  patch in
http://issues.apache.org/jira/browse/OFBIZ-56
includes this one.


> EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-70
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-70
>             Project: OFBiz (The Open for Business Project)
>          Issue 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

       
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-70?page=comments#action_12424340 ]
           
BJ Freeman commented on OFBIZ-70:
---------------------------------

It appears that there is differnt handling of the IMAP and POP# email content.


Also I believe some of these if not all are effecting the service.

From
http://java.sun.com/products/javamail/FAQ.html

Q: The IMAP provider seems to lose data when I fetch messages with large attachments.
A: This is due to bugs in the partial fetch implementation of your IMAP server. To workaround this server bug, set the "mail.imap.partialfetch" property to "false". Refer to NOTES.txt from the JavaMail package for more information.

Q: Why do I get the UnsupportedDataTypeException when I invoke getContent() on a bodypart?
A: The getContent() method returns a Java object that represents the bodypart content. For this to work, a JAF DataContentHandler corresponding to the content's MIME type must be registered. Otherwise, the UnsupportedDataTypeException will be thrown. In this case, you can use the getInputStream() method to retrieve the content as a stream of bytes. See the JAF docs for details on how to create and register your own DataContentHandlers.

Q: Why do I get the UnsupportedEncodingException when I invoke getContent() on a bodypart that contains text data?
A: Textual bodyparts (i.e., bodyparts whose type is "text/plain", "text/html", or "text/xml") return Unicode String objects when getContent() is used. Typically, such bodyparts internally hold their textual data in some non Unicode charset. JavaMail (through the corresponding DataContentHandler) attempts to convert that data into a Unicode string. The underlying JDK's charset converters are used to do this. If the JDK does not support a particular charset, then the UnsupportedEncodingException is thrown. In this case, you can use the getInputStream() method to retrieve the content as a stream of bytes. Example:
 String s;
    if (part.isMimeType("text/plain")) {
        try {
            s = part.getContent();
        } catch (UnsupportedEncodingException uex) {
            InputStream is = part.getInputStream();
            /*
             * Read the input stream into a byte array.
             * Choose a charset in some heuristic manner, use
             * that charset in the java.lang.String constructor
             * to convert the byte array into a String.
             */
            s = convert_to_string(is);
        } catch (Exception ex) {
            // Handle other exceptions appropriately
        }
    }




> EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-70
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-70
>             Project: OFBiz (The Open for Business Project)
>          Issue 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

       
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-70?page=comments#action_12424343 ]
           
BJ Freeman commented on OFBIZ-70:
---------------------------------

some dontent types and dispositons not handled.
Note some are not as important as others.

Content-Type: multipart/report; report-type=disposition-notification;

this is important for locale
Content-Type: text/plain; charset=ISO-8859-1
Content-Type: text/plain; charset=us-ascii


Content-Type: message/disposition-notification; name="MDNPart2.txt"
Disposition: manual-action/MDN-sent-manually; displayed
Content-Type: text/plain; charset=UTF-8; format=flowed

Content-Type: multipart/mixed;
Content-Type: multipart/alternative;

Content-Disposition: attachment; filename="somefile.ext "
Content-Type: message/disposition-notification

Content-Type: multipart/related;
Content-Type: image/jpeg; <--image object

Content-Type: application/vnd.ms-excel; name="somefile.xls"  <-note the vnd.

> EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-70
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-70
>             Project: OFBiz (The Open for Business Project)
>          Issue 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

       
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-70?page=comments#action_12424344 ]
           
BJ Freeman commented on OFBIZ-70:
---------------------------------

oops thought i was putting this in
http://issues.apache.org/jira/browse/OFBIZ-56


> EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-70
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-70
>             Project: OFBiz (The Open for Business Project)
>          Issue 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

       
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-70?page=comments#action_12425960 ]
           
BJ Freeman commented on OFBIZ-70:
---------------------------------

this is svn 422871
it can be closed.


> EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-70
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-70
>             Project: OFBiz (The Open for Business Project)
>          Issue 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

       
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
     [ http://issues.apache.org/jira/browse/OFBIZ-70?page=all ]

Jacopo Cappellato closed OFBIZ-70.
----------------------------------

    Resolution: Fixed

> EmailServices.storeIncomingEmail(EmailServices.java:643)-- String index out of range: -1
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-70
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-70
>             Project: OFBiz (The Open for Business Project)
>          Issue 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