/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package exceptionbug; public class ExceptionBug { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here criticalMethod("foo"); } private static void criticalMethod(String importantString){ System.out.println(importantString.getClass().getName()); String criticalResult = importantString.trim(); System.out.println(criticalResult.getClass().getName()); if (criticalResult.isEmpty()){ return; } throw new UnsupportedOperationException("Kaboom!"); } }