Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DFE8E200BE9 for ; Mon, 12 Dec 2016 03:00:23 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DE8AF160B2C; Mon, 12 Dec 2016 02:00:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 316C3160B20 for ; Mon, 12 Dec 2016 03:00:23 +0100 (CET) Received: (qmail 28290 invoked by uid 500); 12 Dec 2016 02:00:22 -0000 Mailing-List: contact notifications-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list notifications@asterixdb.apache.org Received: (qmail 28281 invoked by uid 99); 12 Dec 2016 02:00:22 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Dec 2016 02:00:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id DBA5EC02F7 for ; Mon, 12 Dec 2016 02:00:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.919 X-Spam-Level: X-Spam-Status: No, score=0.919 tagged_above=-999 required=6.31 tests=[SPF_FAIL=0.919] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id k7-EyzVtb5oX for ; Mon, 12 Dec 2016 02:00:19 +0000 (UTC) Received: from unhygienix.ics.uci.edu (unhygienix.ics.uci.edu [128.195.14.130]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id D9B8D5FC25 for ; Mon, 12 Dec 2016 02:00:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by unhygienix.ics.uci.edu (Postfix) with ESMTP id D3BD0240C57; Sun, 11 Dec 2016 18:00:16 -0800 (PST) Date: Sun, 11 Dec 2016 18:00:16 -0800 From: "Till Westmann (Code Review)" Message-ID: Reply-To: tillw@apache.org X-Gerrit-MessageType: newchange Subject: Change in asterixdb[master]: ASTERIXDB-1749: fix breaking of lines using '\r' X-Gerrit-Change-Id: Ica5ce0b82f1d2c6f2033be2ce20bf56a563fb57b X-Gerrit-ChangeURL: X-Gerrit-Commit: b90363b022616b736c376efe023fe6040cccf43e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.8.4 To: undisclosed-recipients:; archived-at: Mon, 12 Dec 2016 02:00:24 -0000 Till Westmann has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/1382 Change subject: ASTERIXDB-1749: fix breaking of lines using '\r' ...................................................................... ASTERIXDB-1749: fix breaking of lines using '\r' Change-Id: Ica5ce0b82f1d2c6f2033be2ce20bf56a563fb57b --- M asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java A asterixdb/asterix-lang-sqlpp/src/test/java/org/apache/asterix/lang/sqlpp/parser/ParserTest.java 2 files changed, 55 insertions(+), 1 deletion(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/82/1382/1 diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java index 767eacb..1195d37 100644 --- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java +++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java @@ -51,7 +51,7 @@ } protected void setInput(String s) { - inputLines = s.split("\n"); + inputLines = s.split("\n|\r\n?"); } // Forbidden scopes are used to disallow, in a limit clause, variables diff --git a/asterixdb/asterix-lang-sqlpp/src/test/java/org/apache/asterix/lang/sqlpp/parser/ParserTest.java b/asterixdb/asterix-lang-sqlpp/src/test/java/org/apache/asterix/lang/sqlpp/parser/ParserTest.java new file mode 100644 index 0000000..27679a9 --- /dev/null +++ b/asterixdb/asterix-lang-sqlpp/src/test/java/org/apache/asterix/lang/sqlpp/parser/ParserTest.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.asterix.lang.sqlpp.parser; + +import org.apache.asterix.common.exceptions.AsterixException; +import org.apache.asterix.lang.common.base.IParser; +import org.apache.asterix.lang.common.base.IParserFactory; +import org.junit.Test; + +public class ParserTest { + + protected void testLineEnding(String query) throws Exception { + IParserFactory factory = new SqlppParserFactory(); + IParser parser = factory.createParser(query); + try { + parser.parse(); + } catch (AsterixException e) { + if (!e.getMessage().contains("Syntax error: In line 3")) { + throw new Exception("Unexpected error", e); + } + } + } + + @Test + public void testCR() throws Exception { + testLineEnding("select\rvalue\r1"); + } + + @Test + public void testCRLF() throws Exception { + testLineEnding("select\r\nvalue\r\n1"); + } + + @Test + public void testLF() throws Exception { + testLineEnding("select\nvalue\n1"); + } +} -- To view, visit https://asterix-gerrit.ics.uci.edu/1382 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ica5ce0b82f1d2c6f2033be2ce20bf56a563fb57b Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Till Westmann