what javamail expects in param list?

View: New views
4 Messages — Rating Filter:   Alert me  

what javamail expects in param list?

by Oleg Sukhodolsky-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have got exception while parsing the following Content-Disposition:

Content-Disposition: attachment;
filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=

javamail says:
javax.mail.internet.ParseException: Expected parameter value, got "="
at javax.mail.internet.ParameterList.<init>(ParameterList.java:253)

here is a test for this problem:

import javax.mail.internet.ParameterList;
import javax.mail.internet.ParseException;

public class Crm673 {
    public static void main(String[] args) throws ParseException {
        String params = "; filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=";
        final ParameterList pl = new ParameterList(params);
        System.out.println(pl.get("filename"));
    }
}

As far as I understand the code, javamail expects either ATOM or
QUOTEDSTRING after "filename=" but found
"=".  So, what kind of quoted string it expect here?  Is there any way
to help/force javamail to understand
this file name?

BTW I'm using latest snapshot of 1.4.2

Thanks in advance, Oleg.

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".

Re: what javamail expects in param list?

by Bill Shannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oleg Sukhodolsky wrote:

> Hi,
>
> I have got exception while parsing the following Content-Disposition:
>
> Content-Disposition: attachment;
> filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=
>
> javamail says:
> javax.mail.internet.ParseException: Expected parameter value, got "="
> at javax.mail.internet.ParameterList.<init>(ParameterList.java:253)
>
> here is a test for this problem:
>
> import javax.mail.internet.ParameterList;
> import javax.mail.internet.ParseException;
>
> public class Crm673 {
>     public static void main(String[] args) throws ParseException {
>         String params = "; filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=";
>         final ParameterList pl = new ParameterList(params);
>         System.out.println(pl.get("filename"));
>     }
> }
>
> As far as I understand the code, javamail expects either ATOM or
> QUOTEDSTRING after "filename=" but found
> "=".  So, what kind of quoted string it expect here?  Is there any way
> to help/force javamail to understand
> this file name?

Right, that's an illegal header.  The software that produced it is broken
and you should report this bug to the owner of that software, if possible.

Try setting the System property "mail.mime.parameters.strict" to "false".
That might allow JavaMail to parse the header.  You'll need to decode the
value yourself, using the MimeUtility methods, or set the
"mail.mime.decodefilename" System property to "true".

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".

Parent Message unknown Re: what javamail expects in param list?

by Bill Shannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, you're right.  Thanks for the example.  I updated the JavaMail 1.4.2
snapshot to fix this.  Give it a try.


Oleg Sukhodolsky wrote:

> Hi Bill,
>
> thank you for your suggestions.  Unfortunately none of these properties helps :(
> Anyway now I know that this is a bug in client's mailer and will try
> to workaround it.
>
> Thanks,  Oleg.
>
> On Sat, Dec 6, 2008 at 10:47 AM, Bill Shannon <bill.shannon@...> wrote:
>> Oleg Sukhodolsky wrote:
>>> Hi,
>>>
>>> I have got exception while parsing the following Content-Disposition:
>>>
>>> Content-Disposition: attachment;
>>> filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=
>>>
>>> javamail says:
>>> javax.mail.internet.ParseException: Expected parameter value, got "="
>>> at javax.mail.internet.ParameterList.<init>(ParameterList.java:253)
>>>
>>> here is a test for this problem:
>>>
>>> import javax.mail.internet.ParameterList;
>>> import javax.mail.internet.ParseException;
>>>
>>> public class Crm673 {
>>>    public static void main(String[] args) throws ParseException {
>>>        String params = ";
>>> filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=";
>>>        final ParameterList pl = new ParameterList(params);
>>>        System.out.println(pl.get("filename"));
>>>    }
>>> }
>>>
>>> As far as I understand the code, javamail expects either ATOM or
>>> QUOTEDSTRING after "filename=" but found
>>> "=".  So, what kind of quoted string it expect here?  Is there any way
>>> to help/force javamail to understand
>>> this file name?
>> Right, that's an illegal header.  The software that produced it is broken
>> and you should report this bug to the owner of that software, if possible.
>>
>> Try setting the System property "mail.mime.parameters.strict" to "false".
>> That might allow JavaMail to parse the header.  You'll need to decode the
>> value yourself, using the MimeUtility methods, or set the
>> "mail.mime.decodefilename" System property to "true".
>>
>>

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".

Re: what javamail expects in param list?

by Oleg Sukhodolsky-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks a lot.  The new snapshot works perfectly :)

On Wed, Dec 10, 2008 at 3:09 AM, Bill Shannon <bill.shannon@...> wrote:

> Yes, you're right.  Thanks for the example.  I updated the JavaMail 1.4.2
> snapshot to fix this.  Give it a try.
>
>
> Oleg Sukhodolsky wrote:
>>
>> Hi Bill,
>>
>> thank you for your suggestions.  Unfortunately none of these properties
>> helps :(
>> Anyway now I know that this is a bug in client's mailer and will try
>> to workaround it.
>>
>> Thanks,  Oleg.
>>
>> On Sat, Dec 6, 2008 at 10:47 AM, Bill Shannon <bill.shannon@...>
>> wrote:
>>>
>>> Oleg Sukhodolsky wrote:
>>>>
>>>> Hi,
>>>>
>>>> I have got exception while parsing the following Content-Disposition:
>>>>
>>>> Content-Disposition: attachment;
>>>> filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=
>>>>
>>>> javamail says:
>>>> javax.mail.internet.ParseException: Expected parameter value, got "="
>>>> at javax.mail.internet.ParameterList.<init>(ParameterList.java:253)
>>>>
>>>> here is a test for this problem:
>>>>
>>>> import javax.mail.internet.ParameterList;
>>>> import javax.mail.internet.ParseException;
>>>>
>>>> public class Crm673 {
>>>>   public static void main(String[] args) throws ParseException {
>>>>       String params = ";
>>>> filename==?Windows-1251?B?8OXq4ujn6PL7IMjPLmRvYw?=";
>>>>       final ParameterList pl = new ParameterList(params);
>>>>       System.out.println(pl.get("filename"));
>>>>   }
>>>> }
>>>>
>>>> As far as I understand the code, javamail expects either ATOM or
>>>> QUOTEDSTRING after "filename=" but found
>>>> "=".  So, what kind of quoted string it expect here?  Is there any way
>>>> to help/force javamail to understand
>>>> this file name?
>>>
>>> Right, that's an illegal header.  The software that produced it is broken
>>> and you should report this bug to the owner of that software, if
>>> possible.
>>>
>>> Try setting the System property "mail.mime.parameters.strict" to "false".
>>> That might allow JavaMail to parse the header.  You'll need to decode the
>>> value yourself, using the MimeUtility methods, or set the
>>> "mail.mime.decodefilename" System property to "true".
>>>
>>>
>
>

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".