Merge pull request #5135 from adangel/issue-5132-plsql-tomkytesdespair
[plsql] Fix TomKytesDespair for more complex exception handlers
This commit is contained in:
@ -15,6 +15,8 @@ This is a {{ site.pmd.release_type }} release.
|
|||||||
### 🚀 New and noteworthy
|
### 🚀 New and noteworthy
|
||||||
|
|
||||||
### 🐛 Fixed Issues
|
### 🐛 Fixed Issues
|
||||||
|
* plsql-bestpractices
|
||||||
|
* [#5132](https://github.com/pmd/pmd/issues/5132): \[plsql] TomKytesDespair - exception for more complex exception handler
|
||||||
|
|
||||||
### 🚨 API Changes
|
### 🚨 API Changes
|
||||||
* pmd-jsp
|
* pmd-jsp
|
||||||
|
@ -24,7 +24,9 @@ Rules which enforce generally accepted best practices.
|
|||||||
<property name="xpath">
|
<property name="xpath">
|
||||||
<value>
|
<value>
|
||||||
<![CDATA[
|
<![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>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
|
@ -98,4 +98,26 @@ END update_planned_hrs;
|
|||||||
/
|
/
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-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>
|
</test-data>
|
||||||
|
Reference in New Issue
Block a user