You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Stefano Bagnara (JIRA)" <mi...@james.apache.org> on 2011/04/18 11:35:05 UTC

[jira] [Created] (MIME4J-194) There is a regression when content type include empty parameters ";;"

There is a regression when content type include empty parameters ";;"
---------------------------------------------------------------------

                 Key: MIME4J-194
                 URL: https://issues.apache.org/jira/browse/MIME4J-194
             Project: JAMES Mime4j
          Issue Type: Bug
          Components: parser (core)
    Affects Versions: 0.7
            Reporter: Stefano Bagnara
             Fix For: 0.7


I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (MIME4J-194) ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"

Posted by "Stefano Bagnara (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020991#comment-13020991 ] 

Stefano Bagnara commented on MIME4J-194:
----------------------------------------

I just remembered about isValidField method: most time we parse a field but never check if the parsing failed (isValidField, getParseException). 

Maybe we should review the code and make sure we don't bring around invalid fields (don't like this too much because some times it is good to have access to original raw value), or at least (maybe better) we don't use them as if they were valid. Or maybe ContentTypeFieldImpl should return text/plain instead of multipart when boundary is not there or when the parsing fails otherwise (;;).

> ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"
> --------------------------------------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.6.1, 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.8
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Issue Comment Edited] (MIME4J-194) There is a regression when content type include empty parameters ";;"

Posted by "Oleg Kalnichevski (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020961#comment-13020961 ] 

Oleg Kalnichevski edited comment on MIME4J-194 at 4/18/11 10:09 AM:
--------------------------------------------------------------------

Stefano,
How exactly does this regression manifest itself? I added a unit test for this case [1]. What are your expectations about how this field should get parsed?

Oleg

[1] http://svn.apache.org/viewvc?rev=1094444&view=rev

      was (Author: olegk):
    Stefano,
How exactly this regression manifest itself? I added a unit test for this case [1]. What are your expectations about how this field should get parsed?

Oleg

[1] http://svn.apache.org/viewvc?rev=1094444&view=rev
  
> There is a regression when content type include empty parameters ";;"
> ---------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>    Affects Versions: 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.7
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (MIME4J-194) ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"

Posted by "Oleg Kalnichevski (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved MIME4J-194.
--------------------------------------

    Resolution: Fixed

Fixed in SVN trunk (see MIME-197 for details). One can now use more relaxed LenientFieldParser instead of DefaultFieldParser when parsing messages containing a content-type field with empty parameters.

Oleg

> ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"
> --------------------------------------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.6.1, 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.8
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (MIME4J-194) There is a regression when content type include empty parameters ";;"

Posted by "Stefano Bagnara (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefano Bagnara updated MIME4J-194:
-----------------------------------

    Attachment: contenttypeemptyparameters.msg

This file was correctly parsed previously

> There is a regression when content type include empty parameters ";;"
> ---------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>    Affects Versions: 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.7
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (MIME4J-194) ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"

Posted by "Oleg Kalnichevski (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated MIME4J-194:
-------------------------------------

    Affects Version/s:     (was: 0.7)
        Fix Version/s:     (was: 0.8)
                       0.7

> ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"
> --------------------------------------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.6.1
>            Reporter: Stefano Bagnara
>             Fix For: 0.7
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (MIME4J-194) ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"

Posted by "Oleg Kalnichevski (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated MIME4J-194:
-------------------------------------

          Component/s:     (was: parser (core))
                       dom
    Affects Version/s: 0.6.1
        Fix Version/s:     (was: 0.7)
                       0.8
              Summary: ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"  (was: There is a regression when content type include empty parameters ";;")

Yes, ContentTypeFieldImpl appears to be the culprit. I managed to reproduce the problem locally with a trivial test case similar to that I submitted for RawFieldParser. Apparently the field value is not compatible with the grammar defined in ContentTypeParser.jj and also likely to violate the strict interpretation of RFC 2045. 

I am completely helpless with JavaCC and will not be able to fix the problem for 0.7. I'll have to re-target it to 0.8 unless someone else volunteers.

Oleg

> ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"
> --------------------------------------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.6.1, 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.8
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (MIME4J-194) There is a regression when content type include empty parameters ";;"

Posted by "Stefano Bagnara (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020966#comment-13020966 ] 

Stefano Bagnara commented on MIME4J-194:
----------------------------------------

A collegue of mine just noticed that the error in in the roundtrip test and the problem may be in ContentTypeFieldImpl parsing logic and not in the new RawField parsing logic (I will check later).

> There is a regression when content type include empty parameters ";;"
> ---------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>    Affects Versions: 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.7
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (MIME4J-194) There is a regression when content type include empty parameters ";;"

Posted by "Stefano Bagnara (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020964#comment-13020964 ] 

Stefano Bagnara commented on MIME4J-194:
----------------------------------------

Hi Oleg, sorry I have no time to check this deeper. I just tried running my extended test suite and saw this error while parsing that message:
----------------
 java.lang.IllegalArgumentException: Multipart boundary not specified
	at org.apache.james.mime4j.message.MimeWriter.getBoundary(MimeWriter.java:269)
	at org.apache.james.mime4j.message.MimeWriter.writeMultipart(MimeWriter.java:152)
	at org.apache.james.mime4j.message.MimeWriter.writeBody(MimeWriter.java:82)
	at org.apache.james.mime4j.message.MimeWriter.writeEntity(MimeWriter.java:115)
	at org.apache.james.mime4j.message.MimeWriter.writeMessage(MimeWriter.java:134)
	at org.apache.james.mime4j.dom.ExampleMessagesRoundtripTest.runTest(ExampleMessagesRoundtripTest.java:67)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
------

I will check better ASAP.

> There is a regression when content type include empty parameters ";;"
> ---------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>    Affects Versions: 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.7
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (MIME4J-194) There is a regression when content type include empty parameters ";;"

Posted by "Oleg Kalnichevski (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020961#comment-13020961 ] 

Oleg Kalnichevski commented on MIME4J-194:
------------------------------------------

Stefano,
How exactly this regression manifest itself? I added a unit test for this case [1]. What are your expectations about how this field should get parsed?

Oleg

[1] http://svn.apache.org/viewvc?rev=1094444&view=rev

> There is a regression when content type include empty parameters ";;"
> ---------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>    Affects Versions: 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.7
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (MIME4J-194) ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"

Posted by "Oleg Kalnichevski (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020994#comment-13020994 ] 

Oleg Kalnichevski commented on MIME4J-194:
------------------------------------------

> That said I think this behaviour shows another issue with input files having weird Content-Types: if you parse a message having 
> Content-Type: multipart/mixed and no boundary parameter it seems that mime4j doesn't complaint about it while parsing but build 
> a bad object that will fail when written by the MimeWriter: am I right?

The low MIME parser always uses RawFieldParser to extract content-type, charset and boundary bits. RawFieldParser can handle empty parameters and other minor malformations just fine. The problem is when DOM is used some fields currently get parsed twice (once by CORE and once by DOM). See MIME4J-116. I am currently looking into ways of fixing it for 0.7.     

As far as RawFieldParser in CORE is concerned I can make it behave differently in strict vs lenient mode. I do not think there is much we can do about ContentTypeFieldImpl and friends in DOM without solving MIME4J-172 first. 

Oleg

> ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"
> --------------------------------------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.6.1, 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.8
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (MIME4J-194) ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"

Posted by "Stefano Bagnara (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020987#comment-13020987 ] 

Stefano Bagnara commented on MIME4J-194:
----------------------------------------

I suspected that ";;" was not rfc compliant, thank you for checking!
So, probably we should deal with this the same way we deal with "lenient"/"strict" parsing elsewhere (using Monitor object).

That said I think this behaviour shows another issue with input files having weird Content-Types: if you parse a message having Content-Type: multipart/mixed and no boundary parameter it seems that mime4j doesn't complaint about it while parsing but build a bad object that will fail when written by the MimeWriter: am I right? If this is right then we probably have to open a new bug for this. Expected valid behaviours:
1) fail parsing at all
2) ignore the Content-Type header as it is not valid and build a text/plain message instead.

WDYT?


> ContentTypeFieldImpl (and possibly other parsers in DOM) is unable to handle empty parameters ";;"
> --------------------------------------------------------------------------------------------------
>
>                 Key: MIME4J-194
>                 URL: https://issues.apache.org/jira/browse/MIME4J-194
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.6.1, 0.7
>            Reporter: Stefano Bagnara
>             Fix For: 0.8
>
>         Attachments: contenttypeemptyparameters.msg
>
>
> I guess this is a regression introduced with MIME4J-145. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira