Merge branch 'bug-1527'

This commit is contained in:
Andreas Dangel
2016-11-04 10:34:39 +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. 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 { options {
DEBUG_PARSER = false ; DEBUG_PARSER = false ;
@ -483,7 +491,9 @@ ASTProgramUnit ProgramUnit() :
| |
( (
DeclarativeSection() 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; package net.sourceforge.pmd.lang.plsql;
import org.apache.commons.io.IOUtils;
import org.junit.Test; 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" + "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

@ -48,6 +48,7 @@
* java-typeresolution/SignatureDeclareThrowsException * java-typeresolution/SignatureDeclareThrowsException
* [#1535](https://sourceforge.net/p/pmd/bugs/1535/): \[java] SignatureDeclareThrowsException: ClassCastException with Annotation * [#1535](https://sourceforge.net/p/pmd/bugs/1535/): \[java] SignatureDeclareThrowsException: ClassCastException with Annotation
* PLSQL * 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 * [#1531](https://sourceforge.net/p/pmd/bugs/1531/): \[plsql] OOM/Endless loop while parsing (PL)SQL
* General * General
* [#1506](https://sourceforge.net/p/pmd/bugs/1506/): \[core] When runing any RuleTst, start/end methods not called * [#1506](https://sourceforge.net/p/pmd/bugs/1506/): \[core] When runing any RuleTst, start/end methods not called