You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2011/06/11 10:00:59 UTC
[jira] [Updated] (CAMEL-4083) MailBinding may drop characters from
content type when using determineContentType option
[ https://issues.apache.org/jira/browse/CAMEL-4083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-4083:
-------------------------------
Description:
The method "determineContentType" in the MailBinding class may drop characters from the end of the Content-Type header (specifically ending quotes).
Example:
Take the following SMINE enveloped data content type:
{code}
Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
{code}
When an incoming Exchange is processed by the mail Component with the above content type header, the resulting content type after the determineContentType is application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m (note the ending quote). This results in a parsing error later on the processing chain. The following simple unit test demonstrates the issue as it fails on the assertEquals call.
-----------------------------------------------------------------------------------------------------
{code}
package org.apache.camel.component.mail;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultExchange;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ContentTypeTest
{
@Test
public void testDetermineContentType_endingWithQuotes_assertContentMatches()
{
final String contentType = "application/pkcs7-mime; smime-type=enveloped-data; name=\"smime.p7m\"";
final MailConfiguration configuration = new MailConfiguration();
final MailBinding binding = new MailBinding();
final DefaultExchange exchange = new DefaultExchange((CamelContext)null);
exchange.getIn().setHeader("Content-Type", contentType);
String determinedType = binding.determineContentType(configuration, exchange);
assertEquals(contentType, determinedType);
}
}
{code}
was:
The method "determineContentType" in the MailBinding class may drop characters from the end of the Content-Type header (specifically ending quotes).
Example:
Take the following SMINE enveloped data content type:
Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
When an incoming Exchange is processed by the mail Component with the above content type header, the resulting content type after the determineContentType is application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m (note the ending quote). This results in a parsing error later on the processing chain. The following simple unit test demonstrates the issue as it fails on the assertEquals call.
-----------------------------------------------------------------------------------------------------
package org.apache.camel.component.mail;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultExchange;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ContentTypeTest
{
@Test
public void testDetermineContentType_endingWithQuotes_assertContentMatches()
{
final String contentType = "application/pkcs7-mime; smime-type=enveloped-data; name=\"smime.p7m\"";
final MailConfiguration configuration = new MailConfiguration();
final MailBinding binding = new MailBinding();
final DefaultExchange exchange = new DefaultExchange((CamelContext)null);
exchange.getIn().setHeader("Content-Type", contentType);
String determinedType = binding.determineContentType(configuration, exchange);
assertEquals(contentType, determinedType);
}
}
Fix Version/s: (was: 2.7.2)
2.9.0
2.8.0
Summary: MailBinding may drop characters from content type when using determineContentType option (was: MailBinding creating invalid content type)
> MailBinding may drop characters from content type when using determineContentType option
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-4083
> URL: https://issues.apache.org/jira/browse/CAMEL-4083
> Project: Camel
> Issue Type: Bug
> Components: camel-mail
> Affects Versions: 2.7.0
> Environment: JSE 1.6
> Reporter: Greg Meyer
> Priority: Minor
> Labels: content-type, mail, mime, smime
> Fix For: 2.8.0, 2.9.0
>
>
> The method "determineContentType" in the MailBinding class may drop characters from the end of the Content-Type header (specifically ending quotes).
> Example:
> Take the following SMINE enveloped data content type:
> {code}
> Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
> {code}
> When an incoming Exchange is processed by the mail Component with the above content type header, the resulting content type after the determineContentType is application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m (note the ending quote). This results in a parsing error later on the processing chain. The following simple unit test demonstrates the issue as it fails on the assertEquals call.
> -----------------------------------------------------------------------------------------------------
> {code}
> package org.apache.camel.component.mail;
> import org.apache.camel.CamelContext;
> import org.apache.camel.impl.DefaultExchange;
> import org.junit.Test;
> import static org.junit.Assert.assertEquals;
> public class ContentTypeTest
> {
> @Test
> public void testDetermineContentType_endingWithQuotes_assertContentMatches()
> {
> final String contentType = "application/pkcs7-mime; smime-type=enveloped-data; name=\"smime.p7m\"";
>
> final MailConfiguration configuration = new MailConfiguration();
> final MailBinding binding = new MailBinding();
>
> final DefaultExchange exchange = new DefaultExchange((CamelContext)null);
> exchange.getIn().setHeader("Content-Type", contentType);
>
>
> String determinedType = binding.determineContentType(configuration, exchange);
>
> assertEquals(contentType, determinedType);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira