Source:
<code>public Configuration getConfiguration(ServletContext servletContext) { String packageFilters = servletContext.getInitParameter(CONFIG_BASE_PACKAGES); boolean scanClassesDir = true; <START> String jarConfig = servletContext.getInitParameter(CONFIG_SCAN_CLASSES_DIR); <END> if ((jarConfig != null) && jarConfig.trim().equalsIgnoreCase("false")) { scanClassesDir = false; } boolean scanLibDir = false; jarConfig = servletContext.getInitParameter(CONFIG_SCAN_LIB_DIR); if ((jarConfig != null) && jarConfig.trim().equalsIgnoreCase("true")) { scanLibDir = true; } if ((packageFilters != null) && packageFilters.trim().equalsIgnoreCase("none")) { log.debug("Annotation scanning is disabled!"); return null; } Set<Class<? extends Annotation>> annotationType = new LinkedHashSet<Class<? extends Annotation>>(); List<AnnotationHandler<Annotation>> annotationHandlers = new ArrayList<AnnotationHandler<Annotation>>(); @SuppressWarnings("unchecked") Iterator<AnnotationHandler<Annotation>> handlerIterator = ServiceLoader.load(AnnotationHandler.class).iterator(); while (handlerIterator.hasNext()) { AnnotationHandler<Annotation> handler = handlerIterator.next(); annotationHandlers.add(handler); annotationType.add(handler.handles()); } ByteCodeFilter byteCodeFilter = new ByteCodeFilter(annotationType); PackageFilter packageFilter = new PackageFilter(packageFilters); ClassVisitorImpl classVisitor = new ClassVisitorImpl(annotationHandlers, servletContext); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); if (classloader == null) { classloader = this.getClass().getClassLoader(); } List<ClassFinder> classFinders = new ArrayList<ClassFinder>(); if (scanClassesDir) { classFinders.add(new WebClassesFinder(servletContext, classloader, packageFilter, byteCodeFilter)); } if (scanLibDir) { classFinders.add(new WebLibFinder(servletContext, classloader, packageFilter, byteCodeFilter)); } for (ClassFinder finder : classFinders) { finder.findClasses(classVisitor); } return classVisitor; }</code><technical_language>Reusing variables is bad practice. create a separate variable classesConfig here</technical_language>

Target:
public Configuration getConfiguration(ServletContext servletContext) { String packageFilters = servletContext.getInitParameter(CONFIG_BASE_PACKAGES); boolean scanClassesDir = true; String classesConfig = servletContext.getInitParameter(CONFIG_SCAN_CLASSES_DIR); if ((classesConfig != null) && classesConfig.trim().equalsIgnoreCase("false")) { scanClassesDir = false; } boolean scanLibDir = false; String libConfig = servletContext.getInitParameter(CONFIG_SCAN_LIB_DIR); if ((libConfig != null) && libConfig.trim().equalsIgnoreCase("true")) { scanLibDir = true; } if ((packageFilters != null) && packageFilters.trim().equalsIgnoreCase("none")) { log.debug("Annotation scanning is disabled!"); return null; } Set<Class<? extends Annotation>> annotationType = new LinkedHashSet<Class<? extends Annotation>>(); List<AnnotationHandler<Annotation>> annotationHandlers = new ArrayList<AnnotationHandler<Annotation>>(); @SuppressWarnings("unchecked") Iterator<AnnotationHandler<Annotation>> handlerIterator = ServiceLoader.load(AnnotationHandler.class).iterator(); while (handlerIterator.hasNext()) { AnnotationHandler<Annotation> handler = handlerIterator.next(); annotationHandlers.add(handler); annotationType.add(handler.handles()); } ByteCodeFilter byteCodeFilter = new ByteCodeFilter(annotationType); PackageFilter packageFilter = new PackageFilter(packageFilters); ClassVisitorImpl classVisitor = new ClassVisitorImpl(annotationHandlers, servletContext); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); if (classloader == null) { classloader = this.getClass().getClassLoader(); } List<ClassFinder> classFinders = new ArrayList<ClassFinder>(); if (scanClassesDir) { classFinders.add(new WebClassesFinder(servletContext, classloader, packageFilter, byteCodeFilter)); } if (scanLibDir) { classFinders.add(new WebLibFinder(servletContext, classloader, packageFilter, byteCodeFilter)); } for (ClassFinder finder : classFinders) { finder.findClasses(classVisitor); } return classVisitor; }