You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Thomas Söhngen <th...@tgconsulting.de> on 2015/01/13 16:53:11 UTC

[PATCH] PatternSyntaxException in MailboxQuery

Hi all,

I encountered a bug in the MailboxQuery class, posted as the following 
ticket: https://issues.apache.org/jira/browse/JAMES-1566 . It occures 
for folder names which contain unclosed parentheses (like 
"Folder.foo(bar") and will raise the following exception:

java.util.regex.PatternSyntaxException: Unclosed group near index 13
Folder.foo(bar
                         ^
     at java.util.regex.Pattern.error(Pattern.java:1955)
     at java.util.regex.Pattern.accept(Pattern.java:1813)
     at java.util.regex.Pattern.group0(Pattern.java:2908)
     at java.util.regex.Pattern.sequence(Pattern.java:2051)
     at java.util.regex.Pattern.expr(Pattern.java:1996)
     at java.util.regex.Pattern.compile(Pattern.java:1696)
     at java.util.regex.Pattern.<init>(Pattern.java:1351)
     at java.util.regex.Pattern.compile(Pattern.java:1028)
     at 
org.apache.james.mailbox.model.MailboxQuery.<init>(MailboxQuery.java:72)
     at 
org.apache.james.imap.processor.ListProcessor.doProcess(ListProcessor.java:175)
[...]

A possible workaround is to always treat the whole folder name literally 
and only replace the wildcard characters. I made a patch which should 
solve the problem.

Best regards
Thomas

Re: [PATCH] PatternSyntaxException in MailboxQuery

Posted by Eric Charles <er...@apache.org>.
Thx. Can you upload your patch on
https://issues.apache.org/jira/browse/JAMES-1566


On 01/13/2015 04:53 PM, Thomas Söhngen wrote:
> Hi all,
>
> I encountered a bug in the MailboxQuery class, posted as the following
> ticket: https://issues.apache.org/jira/browse/JAMES-1566 . It occures
> for folder names which contain unclosed parentheses (like
> "Folder.foo(bar") and will raise the following exception:
>
> java.util.regex.PatternSyntaxException: Unclosed group near index 13
> Folder.foo(bar
>                         ^
>     at java.util.regex.Pattern.error(Pattern.java:1955)
>     at java.util.regex.Pattern.accept(Pattern.java:1813)
>     at java.util.regex.Pattern.group0(Pattern.java:2908)
>     at java.util.regex.Pattern.sequence(Pattern.java:2051)
>     at java.util.regex.Pattern.expr(Pattern.java:1996)
>     at java.util.regex.Pattern.compile(Pattern.java:1696)
>     at java.util.regex.Pattern.<init>(Pattern.java:1351)
>     at java.util.regex.Pattern.compile(Pattern.java:1028)
>     at
> org.apache.james.mailbox.model.MailboxQuery.<init>(MailboxQuery.java:72)
>     at
> org.apache.james.imap.processor.ListProcessor.doProcess(ListProcessor.java:175)
> [...]
>
> A possible workaround is to always treat the whole folder name
> literally and only replace the wildcard characters. I made a patch
> which should solve the problem.
>
> Best regards
> Thomas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org