Source:
<code>private Object loadClass(String className, Class[] constructorSignature, Object[] constructorArgs, boolean isView) { Class<?> aClass = myLoadedClasses.get(className); int nestedOccurrences = 0; try { if (aClass != null) { checkModified(className); return createNewInstance(aClass, constructorSignature, constructorArgs, isView); } aClass = loadClass(className); if (aClass != null) { checkModified(className); nestedOccurrences = myLoadingClasses.count(aClass); myLoadingClasses.add(aClass); <START> if (nestedOccurrences > 100) { <END> throw new InstantiationException(className + " has infinite recursion."); } final Object viewObject = createNewInstance(aClass, constructorSignature, constructorArgs, isView); myLoadedClasses.put(className, aClass); return viewObject; } } catch (InconvertibleClassError e) { myLogger.addIncorrectFormatClass(e.getClassName(), e); } catch (LinkageError e) { myLogger.addBrokenClass(className, e); } catch (ClassNotFoundException e) { myLogger.addBrokenClass(className, e); } catch (InvocationTargetException e) { final Throwable cause = e.getCause(); if (cause instanceof InconvertibleClassError) { InconvertibleClassError error = (InconvertibleClassError)cause; myLogger.addIncorrectFormatClass(error.getClassName(), error); } else { myLogger.addBrokenClass(className, cause); } } catch (IllegalAccessException e) { myLogger.addBrokenClass(className, e); } catch (InstantiationException e) { myLogger.addBrokenClass(className, e); } catch (NoSuchMethodException e) { myLogger.addBrokenClass(className, e); } finally { if (nestedOccurrences != 0) { myLoadingClasses.remove(aClass); } } return null; }</code><technical_language>checking: 100 pretty large. deep do expected nesting in practice</technical_language>

Target:
private Object loadClass(String className, Class[] constructorSignature, Object[] constructorArgs, boolean isView) { Class<?> aClass = myLoadedClasses.get(className); try { if (aClass != null) { checkModified(className); return createNewInstance(aClass, constructorSignature, constructorArgs, isView); } aClass = loadClass(className); if (aClass != null) { checkModified(className); myLoadingClasses.add(aClass); if (myLoadingClasses.count(aClass) > 100) { throw new InstantiationException("The layout involves creation of " + className + " over 100 levels deep. Infinite recursion?"); } try { final Object viewObject = createNewInstance(aClass, constructorSignature, constructorArgs, isView); myLoadedClasses.put(className, aClass); return viewObject; } finally { myLoadingClasses.remove(aClass); } } } catch (InconvertibleClassError e) { myLogger.addIncorrectFormatClass(e.getClassName(), e); } catch (LinkageError e) { myLogger.addBrokenClass(className, e); } catch (ClassNotFoundException e) { myLogger.addBrokenClass(className, e); } catch (InvocationTargetException e) { final Throwable cause = e.getCause(); if (cause instanceof InconvertibleClassError) { InconvertibleClassError error = (InconvertibleClassError)cause; myLogger.addIncorrectFormatClass(error.getClassName(), error); } else { myLogger.addBrokenClass(className, cause); } } catch (IllegalAccessException e) { myLogger.addBrokenClass(className, e); } catch (InstantiationException e) { myLogger.addBrokenClass(className, e); } catch (NoSuchMethodException e) { myLogger.addBrokenClass(className, e); } return null; }