Merge branch 'bug-1527' into pmd/5.4.x

This commit is contained in:
Andreas Dangel
2016-11-04 10:30:46 +01:00
4 changed files with 35 additions and 1 deletions

View File

@ -25,6 +25,14 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Adjusted ProgramUnit() to allow Pragma(), even though this is not
* valid syntax. See PMD Bug #1527.
*
* Andreas Dangel 11/2016
*/
//
options {
DEBUG_PARSER = false ;
@ -483,7 +491,9 @@ ASTProgramUnit ProgramUnit() :
|
(
DeclarativeSection()
<BEGIN> (Statement())* (ExceptionHandler())? <END> [ID()]
<BEGIN>
[Pragma()] // See PMD Bug #1527
(Statement())* (ExceptionHandler())? <END> [ID()]
)
)
]

View File

@ -3,6 +3,7 @@
*/
package net.sourceforge.pmd.lang.plsql;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
@ -44,4 +45,9 @@ public class PLSQLParserTest extends AbstractPLSQLParserTst {
"select \"CFT_ID\",\"CFR_ID\",\"CFT_NAME\",\"TCN\",\"LOG_MODULE\",\"LOG_USER\",\"LOG_DATE\",\"LOG_TIME\" from crm_function_role_types\n" +
"/");
}
@Test
public void testBug1527() throws Exception {
parsePLSQL(IOUtils.toString(PLSQLParserTest.class.getResourceAsStream("ast/InlinePragmaProcError.pls")));
}
}

View File

@ -0,0 +1,17 @@
create or replace package inline_praqma_error is
end;
/
create or replace package body inline_praqma_error is
procedure do_transaction(p_input_token in varchar(200)) is
begin
PRAGMA AUTONOMOUS_TRANSACTION;
bno74.log_hentglass_request(p_hentglass_request
,v_logging_req_seq_no);
COMMIT;
end do_transaction;
end inline_praqma_error;
/

View File

@ -37,6 +37,7 @@
* java-typeresolution/SignatureDeclareThrowsException
* [#1535](https://sourceforge.net/p/pmd/bugs/1535/): \[java] SignatureDeclareThrowsException: ClassCastException with Annotation
* PLSQL
* [#1527](https://sourceforge.net/p/pmd/bugs/1527/): \[plsql] PRAGMA AUTONOMOUS_TRANSACTION gives processing errors
* [#1531](https://sourceforge.net/p/pmd/bugs/1531/): \[plsql] OOM/Endless loop while parsing (PL)SQL
* General
* [#1499](https://sourceforge.net/p/pmd/bugs/1499/): \[core] CPD test break PMD 5.5.1 build on Windows