Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 12703 invoked from network); 22 Jun 2007 12:58:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Jun 2007 12:58:49 -0000 Received: (qmail 44019 invoked by uid 500); 22 Jun 2007 12:58:52 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 43991 invoked by uid 500); 22 Jun 2007 12:58:51 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 43980 invoked by uid 99); 22 Jun 2007 12:58:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jun 2007 05:58:51 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jun 2007 05:58:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 376F341800A for ; Fri, 22 Jun 2007 05:58:26 -0700 (PDT) Message-ID: <21137221.1182517106225.JavaMail.jira@brutus> Date: Fri, 22 Jun 2007 05:58:26 -0700 (PDT) From: "Tim Ellison (JIRA)" To: commits@harmony.apache.org Subject: [jira] Assigned: (HARMONY-4248) [classlib][regex] java.util.regex.Pattern.compile(regex, flags) throws unexpected exceptions on certain pattern In-Reply-To: <20467501.1182341248785.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-4248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tim Ellison reassigned HARMONY-4248: ------------------------------------ Assignee: Tim Ellison > [classlib][regex] java.util.regex.Pattern.compile(regex, flags) throws unexpected exceptions on certain pattern > --------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-4248 > URL: https://issues.apache.org/jira/browse/HARMONY-4248 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Elena Sayapina > Assignee: Tim Ellison > Attachments: H-4248-test.patch, H-4248.patch > > > Pattern.compile("(?x:a?):", flag); throws PatternSyntaxException or NullPointerException if flag bit values other than those corresponding to the defined match flags are set in flags > Please, consider the following code: > import java.util.regex.Pattern; > public class patternTest { > > static Pattern p; > > public static void main(String[] args) { > > try { > System.out.println("Pattern.compile(\"(?x:a?):\", 1 << 8)"); > p = Pattern.compile("(?x:a?):", 1 << 8); > System.out.println("Test passed"); > } catch (Exception e) { > e.printStackTrace(); > System.out.println("Test Failed"); > } > > try { > System.out.println("Pattern.compile(\"(?x:a?):\", (1 << 8) | (1 << 7) | (1 << 6) |(1 << 5) | (1 << 4) | (1<< 2))"); > p = Pattern.compile("(?x:a?):", (1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4) | (1<< 2)); > System.out.println("Test passed"); > } catch (Exception e) { > e.printStackTrace(); > System.out.println("Test Failed"); > } > } > } > Output on Harmony-r548930: > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, > as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r548930, (Jun 20 2007), Windows/ia32/msvc 1310, release build > http://harmony.apache.org > Pattern.compile("(?x:a?):", 1 << 8) > java.util.regex.PatternSyntaxException: unmatched ) near index: 6 > (?x:a?): > ^ > at java.util.regex.Pattern.processSubExpression(Pattern.java:584) > at java.util.regex.Pattern.processSubExpression(Pattern.java:600) > at java.util.regex.Pattern.processExpression(Pattern.java:378) > at java.util.regex.Pattern.compileImpl(Pattern.java:283) > at java.util.regex.Pattern.compile(Pattern.java:264) > at patternTest.main(patternTest.java:11) > Test Failed > Pattern.compile("(?x:a?):", (1 << 8) | (1 << 7) | (1 << 6) |(1 << 5) | (1 << 4) | (1<< 2)) > java.lang.NullPointerException > at java.util.regex.Lexer.isDecomposedCharBoundary(Lexer.java:1290) > at java.util.regex.Pattern.processDecomposedChar(Pattern.java:536) > at java.util.regex.Pattern.processSubExpression(Pattern.java:566) > at java.util.regex.Pattern.processExpression(Pattern.java:378) > at java.util.regex.Pattern.compileImpl(Pattern.java:283) > at java.util.regex.Pattern.compile(Pattern.java:264) > at patternTest.main(patternTest.java:20) > Test Failed > Output on RI: > java version "1.5.0_11" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03) > Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode) > Pattern.compile("(?x:a?):", 1 << 8) > Test passed > Pattern.compile("(?x:a?):", (1 << 8) | (1 << 7) | (1 << 6) |(1 << 5) | (1 << 4) | (1<< 2)) > Test passed > Note that RI throws no exception but according to the Java API Spec 1.5 it should throw IllegalArgumentException: > "public static Pattern compile(String regex, int flags) > ... > flags - Match flags, a bit mask that may include CASE_INSENSITIVE, MULTILINE, DOTALL, UNICODE_CASE, and CANON_EQ > Throws: > IllegalArgumentException - If bit values other than those corresponding to the defined match flags are set in flags ..." -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.