[plsql] Fix TomKytesDespair for more complex exception handlers
Fixes #5132
This commit is contained in:
parent
39750cf158
commit
44d25c41e1
@ -15,6 +15,8 @@ This is a {{ site.pmd.release_type }} release.
|
||||
### 🚀 New and noteworthy
|
||||
|
||||
### 🐛 Fixed Issues
|
||||
* plsql-bestpractices
|
||||
* [#5132](https://github.com/pmd/pmd/issues/5132): \[plsql] TomKytesDespair - exception for more complex exception handler
|
||||
|
||||
### 🚨 API Changes
|
||||
|
||||
|
@ -24,7 +24,9 @@ Rules which enforce generally accepted best practices.
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//ExceptionHandler[QualifiedName/@Image='OTHERS' and upper-case(Statement/UnlabelledStatement/Expression/@Image)='NULL']
|
||||
//ExceptionHandler[QualifiedName/@Image='OTHERS']
|
||||
[count(Statement)=1]
|
||||
[Statement/UnlabelledStatement/Expression/PrimaryPrefix/Literal/NullLiteral]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -98,4 +98,26 @@ END update_planned_hrs;
|
||||
/
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#5132 [plsql] TomKytesDespair - exception for more complex exception handler</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
create or replace procedure x
|
||||
is
|
||||
v_cursor number;
|
||||
begin
|
||||
v_cursor := DBMS_SQL.open_cursor;
|
||||
dbms_output.put_line('Blah');
|
||||
exception
|
||||
WHEN OTHERS THEN
|
||||
IF DBMS_SQL.is_open(v_cursor) THEN
|
||||
DBMS_SQL.close_cursor(v_cursor);
|
||||
END IF;
|
||||
DBMS_OUTPUT.Put_Line('Blah');
|
||||
DBMS_OUTPUT.Put_Line(SQLERRM);
|
||||
end;
|
||||
/
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user