CFCatch Java Exceptions
Did you know that you can catch java exceptions by class name with
cfcatch? It's not documented on the
cfcatch tag documentation (as of CF8), but it works... Here's an example:
<cftry> <cfset list = CreateObject("java", "java.util.LinkedList")> <cfset list.get(5)> <cfcatch type="java.lang.IndexOutOfBoundsException"> Index outta bounds </cfcatch> </cftry>
There is one special exception that Mark Mandel has blogged about, and that is if the exception is caused by a class that was loaded by a different classloader, cfcatch won't be able to catch it by type. Perhaps that's why this feature is undocumented?
- Docker Container exited with code 137
- Why is my cron.daily script not running?
- Announcing FuseGuard Version 3
- CFSummit 2017
- Java Unlimited Strength Crypto Policy for Java 9 or 1.8.0_151
- Java 9 Security Enhancements
- Upcoming CFML Conferences in April 2017
- CFSummit 2016 Slides