Details
-
Story
-
Status: Closed
-
Minor
-
Resolution: Completed
-
6.1.30 EE GA3, 6.2.0 CE M6
-
None
-
6.1.x
-
Committed
Description
Using exception throwing to do execution flow control is a very bad practice. Because creating exception needs to capture the current thread's call stack info, when the execution stack is very deep, capturing this info could cause significant overhead.
For Portal/System Exception, things could get even worse, because we by default doing a transaction rollback at service layer on seeing them. You may actually rollback a tx even without knowing it, until later you can not see the data you just tried to save to database.
This source formatting change won't be smart enough to catch all bad usage of throwing exception, but it can handle one typical scenario, that is you catch a portal/system exception, without any processing logic, just swallow it. This bad usage after this ticket is forbidden.
Attachments
Issue Links
- causes
-
LPS-69167 No checkbox for selecting web content folder
- Closed
- relates
-
LPS-36287 Fix cases of swallowed exceptions
- Closed
-
LPS-52675 Ensure all Liferay exceptions are processed correctly
-
- Closed
-
-
LPS-72606 When throwing a new Exception inside a catch statement, we should pass the caught exception
-
- Closed
-
-
LPE-9326 Improve source formatter to flag exceptions that are caught but not processed
-
- Closed
-