/*
(non-Javadoc)

@see
edu.umd.cs.findbugs.anttask.AbstractFindBugsTask#configureFindbugsEngine
()
962209
@Override
    protected void configureFindbugsEngine() {
        addOption("-name", name);
        addOption("-timestamp", timestamp);
        addOption("-source", source);
        addOption("-findSource", findSource);
        addOption("-suppress", suppress);
        addBoolOption("-withMessages", withMessages);
        if (resetSource != null && "true".equals(resetSource)) {
            addArg("-resetSource");
        }
        addArg(inputFile);
        if (outputFile != null) {
            addArg(outputFile);
        }
    }
1028463
private void setFindBugsCommand(IProjectDescription description, ICommand newCommand) throws CoreException {
        ICommand[] oldCommands = description.getBuildSpec();
        ICommand oldFindBugsCommand = getFindBugsCommand(description);
        ICommand[] newCommands;
        if (oldFindBugsCommand == null) {
            // Add the FindBugs build spec AFTER all other builders
            newCommands = new ICommand[oldCommands.length + 1];
            System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length);
            newCommands[oldCommands.length] = newCommand;
        } else {
            for (int i = 0, max = oldCommands.length; i < max; i++) {
                if (oldCommands[i] == oldFindBugsCommand) {
                    oldCommands[i] = newCommand;
                    break;
                }
            }
            newCommands = oldCommands;
        }
        // Commit the spec change into the project
        description.setBuildSpec(newCommands);
        getProject().setDescription(description, null);
    }
1214254
@Trivial // disable autotrace because tracing of the JCache operations will include all of the useful information
    void configureMonitoring(String cacheName) {
        final boolean trace = TraceComponent.isAnyTracingEnabled();

        boolean enable = monitorRef.get() != null;

        if (trace && tc.isDebugEnabled())
            CacheHashMap.tcInvoke(tcCacheManager, "enableManagement", cacheName, enable);
        cacheManager.enableManagement(cacheName, enable);
        if (trace && tc.isDebugEnabled()) {
            CacheHashMap.tcReturn(tcCacheManager, "enableManagement");
            CacheHashMap.tcInvoke(tcCacheManager, "enableStatistics", cacheName, enable);
        }
        cacheManager.enableStatistics(cacheName, enable);
        if (trace && tc.isDebugEnabled())
            CacheHashMap.tcReturn(tcCacheManager, "enableStatistics");
    }
593218
protected ILaunchConfiguration findLaunchConfiguration(String projectName,
			ILaunchConfigurationType configType)
	{
		List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
		try
		{
			ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
			candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
			for (int i = 0; i < configs.length; i++)
			{
				ILaunchConfiguration config = configs[i];

				// String defaultModule = config.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_DEFAULT, "");
				String pName = config.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_PROJECT, "");
				// String operation = config.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_OPERATION, "");

				if (// defaultModule.equals(getModuleName(type).toString())
					// &&
				pName.equalsIgnoreCase(projectName)
				// && operation.equals(getOperationName(type) + "()")
				)
				{ //$NON-NLS-1$
					candidateConfigs.add(config);
				}
			}

		} catch (CoreException e)
		{
			// JDIDebugUIPlugin.log(e);
		}
		int candidateCount = candidateConfigs.size();
		if (candidateCount == 1)
		{
			return (ILaunchConfiguration) candidateConfigs.get(0);
		} else if (candidateCount > 1)
		{
			return chooseConfiguration(candidateConfigs);
			// return candidateConfigs.get(0);
		}
		return null;
	}
134815
private PBXObjectRef addProjectConfigurationList(final Map objects, final String baseDir,
      final List<DependencyDef> dependencies, final CommandLineCompilerConfiguration compilerConfig,
      final CommandLineLinkerConfiguration linkerConfig) {
    //
    // Create a configuration list with
    // two stock configurations: Debug and Release
    //
    final List configurations = new ArrayList();
    final Map<String, Object> debugSettings = new HashMap<>();
    debugSettings.put("GCC_WARN_ABOUT_RETURN_TYPE", "YES");
    debugSettings.put("GCC_WARN_UNUSED_VARIABLE", "YES");
    debugSettings.put("PREBINDING", "NO");
    debugSettings.put("SDKROOT", "/Developer/SDKs/MacOSX10.4u.sdk");

    final PBXObjectRef debugConfig = createXCBuildConfiguration("Debug", debugSettings);
    objects.put(debugConfig.getID(), debugConfig.getProperties());
    configurations.add(debugConfig);

    final Map<String, Object> releaseSettings = new HashMap<>();
    releaseSettings.put("GCC_WARN_ABOUT_RETURN_TYPE", "YES");
    releaseSettings.put("GCC_WARN_UNUSED_VARIABLE", "YES");
    releaseSettings.put("PREBINDING", "NO");
    releaseSettings.put("SDKROOT", "/Developer/SDKs/MacOSX10.4u.sdk");
    final PBXObjectRef releaseConfig = createXCBuildConfiguration("Release", releaseSettings);
    objects.put(releaseConfig.getID(), releaseConfig.getProperties());
    configurations.add(releaseConfig);
    final PBXObjectRef configurationList = createXCConfigurationList(configurations);
    final Map projectConfigurationListProperties = configurationList.getProperties();
    projectConfigurationListProperties.put("defaultConfigurationIsVisible", "0");
    projectConfigurationListProperties.put("defaultConfigurationName", "Debug");
    objects.put(configurationList.getID(), configurationList.getProperties());

    //
    // add include paths to both configurations
    //
    final File[] includeDirs = compilerConfig.getIncludePath();
    if (includeDirs.length > 0) {
      final List<String> includePaths = new ArrayList<>();
      final Map<String, String> includePathMap = new HashMap<>();
      for (final File includeDir : includeDirs) {
        if (!CUtil.isSystemPath(includeDir)) {
          final String absPath = includeDir.getAbsolutePath();
          if (!includePathMap.containsKey(absPath)) {
            if (absPath.startsWith("/usr/")) {
              includePaths.add(CUtil.toUnixPath(absPath));
            } else {
              final String relPath = CUtil.toUnixPath(CUtil.getRelativePath(baseDir, includeDir));
              includePaths.add(relPath);
            }
            includePathMap.put(absPath, absPath);
          }
        }
      }
      includePaths.add("${inherited)");
      debugSettings.put("HEADER_SEARCH_PATHS", includePaths);
      releaseSettings.put("HEADER_SEARCH_PATHS", includePaths);
    }

    //
    // add preprocessor definitions to both configurations
    //
    //
    final String[] preArgs = compilerConfig.getPreArguments();
    final List<String> defines = new ArrayList<>();
    for (final String preArg : preArgs) {
      if (preArg.startsWith("-D")) {
        defines.add(preArg.substring(2));
      }
    }
    if (defines.size() > 0) {
      defines.add("$(inherited)");
      debugSettings.put("GCC_PREPROCESSOR_DEFINITIONS", defines);
      releaseSettings.put("GCC_PREPROCESSOR_DEFINITIONS", defines);
    }

    if (linkerConfig != null) {
      final Map<String, String> librarySearchMap = new HashMap<>();
      final List<String> librarySearchPaths = new ArrayList<>();
      final List<String> otherLdFlags = new ArrayList<>();
      final String[] linkerArgs = linkerConfig.getEndArguments();
      for (final String linkerArg : linkerArgs) {
        if (linkerArg.startsWith("-L")) {
          final String libDir = linkerArg.substring(2);
          if (!librarySearchMap.containsKey(libDir)) {
            if (!libDir.equals("/usr/lib")) {
              librarySearchPaths.add(CUtil.toUnixPath(CUtil.getRelativePath(baseDir, new File(libDir))));
            }
            librarySearchMap.put(libDir, libDir);

          }
        } else if (linkerArg.startsWith("-l")) {
          //
          // check if library is in dependencies list
          //
          final String libName = linkerArg.substring(2);
          boolean found = false;
          for (final DependencyDef dependency : dependencies) {
            if (libName.startsWith(dependency.getName())) {
              final File dependencyFile = dependency.getFile();
              if (dependencyFile != null && new File(dependencyFile.getAbsolutePath() + ".xcodeproj").exists()) {
                found = true;
                break;
              }
            }
          }
          if (!found) {
            otherLdFlags.add(linkerArg);
          }
        }
      }

      debugSettings.put("LIBRARY_SEARCH_PATHS", librarySearchPaths);
      debugSettings.put("OTHER_LDFLAGS", otherLdFlags);
      releaseSettings.put("LIBRARY_SEARCH_PATHS", librarySearchPaths);
      releaseSettings.put("OTHER_LDFLAGS", otherLdFlags);
    }
    return configurationList;
  }
1236249
private void updateBugCollection(Project findBugsProject, Reporter bugReporter, boolean incremental) {
        SortedBugCollection newBugCollection = bugReporter.getBugCollection();
        try {
            st.newPoint("getBugCollection");
            SortedBugCollection oldBugCollection = FindbugsPlugin.getBugCollection(project, monitor);

            st.newPoint("mergeBugCollections");
            SortedBugCollection resultCollection = mergeBugCollections(oldBugCollection, newBugCollection, incremental);
             resultCollection.getProject().setGuiCallback(new EclipseGuiCallback(project));
            resultCollection.setTimestamp(System.currentTimeMillis());

            // will store bugs in the default FB file + Eclipse project session
            // props
            st.newPoint("storeBugCollection");
            FindbugsPlugin.storeBugCollection(project, resultCollection, monitor);
        } catch (IOException e) {
            FindbugsPlugin.getDefault().logException(e, "Error performing SpotBugs results update");
        } catch (CoreException e) {
            FindbugsPlugin.getDefault().logException(e, "Error performing SpotBugs results update");
        }

        // will store bugs as markers in Eclipse workspace
        st.newPoint("createMarkers");
        MarkerUtil.createMarkers(javaProject, newBugCollection, resource, monitor);
    }
1158939
public void addBug(BugInstance bug) {

        SourceLineAnnotation source = bug.getPrimarySourceLineAnnotation();
        PackageStats stat = getPackageStats(source.getPackageName());
        stat.addError(bug);
        ++totalErrors[0];
        int priority = bug.getPriority();
        if (priority >= 1) {
            ++totalErrors[Math.min(priority, totalErrors.length - 1)];
        }
    }
1298603
@PostConstruct
    public Object loadConfiguration(InvocationContext ic) throws Exception {

        Object target = ic.getTarget();
        Class targetClass = target.getClass();

        if (targetClassIsProxied(targetClass)) {
            targetClass = targetClass.getSuperclass();
        }

        ConfigBundle configBundleAnnotation = (ConfigBundle) targetClass.getDeclaredAnnotation(ConfigBundle.class);

        processConfigBundleBeanSetters(target, targetClass, getKeyPrefix(targetClass), new HashMap<>(),
                configBundleAnnotation.watch());

        return ic.proceed();
    }
365808
protected void createFindbugsEngine() {
        findbugsEngine = new Java();
        findbugsEngine.setProject(getProject());
        findbugsEngine.setTaskName(getTaskName());
        findbugsEngine.setFork(true);
        if (jvm.length() > 0) {
            findbugsEngine.setJvm(jvm);
        }
        findbugsEngine.setTimeout(timeout);

        if (debug) {
            jvmargs = jvmargs + " -Dfindbugs.debug=true";
        }
        jvmargs = jvmargs + " -Dfindbugs.hostApp=FBAntTask";
        findbugsEngine.createJvmarg().setLine(jvmargs);

        // Add JVM arguments for system properties
        for (SystemProperty systemProperty : systemPropertyList) {
            String jvmArg = "-D" + systemProperty.getName() + "=" + systemProperty.getValue();
            findbugsEngine.createJvmarg().setValue(jvmArg);
        }

        if (homeDir != null) {
            // Use findbugs.home to locate findbugs.jar and the standard
            // plugins. This is the usual means of initialization.
            File findbugsLib = new File(homeDir, "lib");
            if (!findbugsLib.exists() && "lib".equals(homeDir.getName())) {
                findbugsLib = homeDir;
                homeDir = homeDir.getParentFile();
            }
            File findbugsLibFindBugs = new File(findbugsLib, "spotbugs.jar");
            // log("executing using home dir [" + homeDir + "]");
            if (findbugsLibFindBugs.exists()) {
                findbugsEngine.setClasspath(new Path(getProject(), findbugsLibFindBugs.getPath()));
            } else {
                throw new IllegalArgumentException("Can't find spotbugs.jar in " + findbugsLib);
            }
            findbugsEngine.createJvmarg().setValue("-Dspotbugs.home=" + homeDir.getPath());
        } else {
            // Use an explicitly specified classpath and list of plugin Jars
            // to initialize. This is useful for other tools which may have
            // FindBugs installed using a non-standard directory layout.

            findbugsEngine.setClasspath(classpath);
        }
        if (pluginList != null) {
            addArg("-pluginList");
            addArg(pluginList.toString());
        }
        // Set the main class to be whatever the subclass's constructor
        // specified.
        findbugsEngine.setClassname(mainClass);
    }
1200848
private List<String> initializeLaunch(ILaunch launch,
			ILaunchConfiguration configuration, String mode,
			IProgressMonitor monitor) throws CoreException
	{
		List<String> commandList = null;

		Integer debugSessionId = Integer.valueOf(getSessionId());
		if (useRemoteDebug(configuration))
		{
			debugSessionId = 1;
		}

		commandList = new ArrayList<String>();

		IVdmProject vdmProject = getVdmProject(configuration);

		Assert.isNotNull(vdmProject, " Project not found: "
				+ configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_PROJECT, ""));

		if (vdmProject == null
				|| !VdmTypeCheckerUi.typeCheck(vdmProject, monitor))
		{
			abort("Cannot launch a project (" + vdmProject
					+ ") with type errors, please check the problems view", null);
		}

		String charSet = getProject(configuration).getDefaultCharset();

		commandList.add("-h");
		commandList.add("localhost");
		commandList.add("-p");
		int port = VdmDebugPlugin.getDefault().getDbgpService().getPort();

		// Hook for external tools to direct the debugger to listen on a specific port
		int overridePort = configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_OVERRIDE_PORT, IDebugPreferenceConstants.DBGP_AVAILABLE_PORT);
		if (overridePort != IDebugPreferenceConstants.DBGP_AVAILABLE_PORT)
		{
			port = VdmDebugPlugin.getDefault().getDbgpService(overridePort).getPort();
		}

		commandList.add(Integer.valueOf(port).toString());

		commandList.add("-k");
		commandList.add(debugSessionId.toString());
		commandList.add("-w");
		commandList.add("-q");
		commandList.add(vdmProject.getDialect().getArgstring());
		commandList.add("-r");
		commandList.add(vdmProject.getLanguageVersionName());
		// set disable interpreter settings
		if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_PRE_CHECKS, true))// vdmProject.hasPrechecks())
		{
			commandList.add("-pre");
		}
		if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_POST_CHECKS, true))// vdmProject.hasPostchecks())
		{
			commandList.add("-post");
		}
		if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_INV_CHECKS, true))// vdmProject.hasInvchecks())
		{
			commandList.add("-inv");
		}
		if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_DTC_CHECKS, true))// vdmProject.hasDynamictypechecks())
		{
			commandList.add("-dtc");
		}
		if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_MEASURE_CHECKS, true))// vdmProject.hasMeasurechecks())
		{
			commandList.add("-measures");
		}

		commandList.add("-c");
		commandList.add(charSet);
		if (!isRemoteControllerEnabled(configuration))
		{
			commandList.add("-e64");
			commandList.add(getExpressionBase64(configuration, charSet));
			String default64 = getDefaultBase64(configuration, charSet);
			if (default64.trim().length() > 0)
			{
				commandList.add("-default64");
				commandList.add(getDefaultBase64(configuration, charSet));
			}
		} else
		{
			// temp fix for commanline args of dbgreader
			commandList.add("-e64");
			commandList.add(Base64.encode("A".getBytes()).toString());
		}

		if (isRemoteControllerEnabled(configuration))
		{
			commandList.add("-remote");
			commandList.add(getRemoteControllerName(configuration));
		}

		if (hasTrace(configuration))
		{
			commandList.add("-t");
		}

		commandList.add("-consoleName");
		commandList.add("LaunchConfigurationExpression");

		commandList.addAll(getExtendedCommands(vdmProject, configuration));

		commandList.add("-baseDir");
		commandList.add(getProject(configuration).getLocationURI().toASCIIString());

		commandList.addAll(getSpecFiles(vdmProject));
		if (useRemoteDebug(configuration))
		{
			System.out.println("Debugger Arguments:\n"
					+ getArgumentString(commandList));
		}
		commandList.add(0, "java");
		commandList.add(1, IDebugConstants.DEBUG_ENGINE_CLASS);

		if (configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_SHOW_VM_SETTINGS, false))
		{
			commandList.addAll(1, Arrays.asList(new String[] { "-XshowSettings:all" }));
		}
		
		commandList.addAll(1, getVmArguments(configuration));

		if (useRemoteDebug(configuration))
		{
			System.out.println("Full Debugger Arguments:\n"
					+ getArgumentString(commandList));
		}

		VdmDebugTarget target = null;
		// Debug mode
		if (mode.equals(ILaunchManager.DEBUG_MODE))
		{
			IDbgpService service = VdmDebugPlugin.getDefault().getDbgpService();

			if (!service.available())
			{
				abort("Could not create DBGP Service", null);
			}

			DebugPlugin.getDefault().getBreakpointManager().setEnabled(true);

			target = new VdmDebugTarget(IDebugConstants.ID_VDM_DEBUG_MODEL, service, debugSessionId.toString(), launch, null);
			target.setVdmProject(vdmProject);
			launch.addDebugTarget(target);
			target.toggleClassVariables(true);
			target.toggleGlobalVariables(true);
			target.toggleLocalVariables(true);

		}
		// Run mode
		else if (mode.equals(ILaunchManager.RUN_MODE))
		{
			IDbgpService service = VdmDebugPlugin.getDefault().getDbgpService();

			if (!service.available())
			{
				abort("Could not create DBGP Service", null);
			}

			DebugPlugin.getDefault().getBreakpointManager().setEnabled(false);

			target = new VdmDebugTarget(IDebugConstants.ID_VDM_DEBUG_MODEL, service, debugSessionId.toString(), launch, null);
			target.setVdmProject(vdmProject);
			launch.addDebugTarget(target);

			target.toggleClassVariables(true);
			target.toggleGlobalVariables(true);
			target.toggleLocalVariables(true);

		}
		return commandList;
	}
46976
protected void configureMethodArgs(Injector injector) {

        Class<?>[] types = method.getParameterTypes();
        extractors = new ArgumentExtractor[types.length];
        patterns = new String[types.length];
        for (int i = 0; i < types.length; i++) {
            final Parameter parameter = method.getParameters()[i];
            final Class<? extends Collection> collectionType;
            final Class<?> objectType;
            if (Collection.class.isAssignableFrom(types[i])) {
                collectionType = (Class<? extends Collection>) types[i];
                objectType = getParameterGenericType(parameter);
            } else {
                collectionType = null;
                objectType = types[i];
            }

            // determine the appropriate extractor
            Class<? extends ArgumentExtractor> extractorType;
            if (FileItem.class == objectType) {
                extractorType = FileItemExtractor.class;
            } else {
                extractorType = ControllerUtil.getArgumentExtractor(parameter);
            }

            // instantiate the extractor
            extractors[i] = injector.getInstance(extractorType);

            // configure the extractor
            if (extractors[i] instanceof ConfigurableExtractor<?>) {
                ConfigurableExtractor extractor = (ConfigurableExtractor) extractors[i];
                Annotation annotation = ClassUtil.getAnnotation(parameter, extractor.getAnnotationClass());
                if (annotation != null) {
                    extractor.configure(annotation);
                }
            }

            if (extractors[i] instanceof SuffixExtractor) {
                // the last parameter can be assigned content type suffixes
                SuffixExtractor extractor = (SuffixExtractor) extractors[i];
                extractor.setSuffixes(contentTypeSuffixes);
            }

            if (collectionType != null) {
                if (extractors[i] instanceof CollectionExtractor) {
                    CollectionExtractor extractor = (CollectionExtractor) extractors[i];
                    extractor.setCollectionType(collectionType);
                } else {
                    throw new FatalException(
                            "Controller method '{}' parameter {} of type '{}' does not specify an argument extractor that supports collections!",
                            Util.toString(method), i + 1, Util.toString(collectionType, objectType));
                }
            }

            if (extractors[i] instanceof TypedExtractor) {
                TypedExtractor extractor = (TypedExtractor) extractors[i];
                extractor.setObjectType(objectType);
            }

            if (extractors[i] instanceof NamedExtractor) {
                // ensure that the extractor has a proper name
                NamedExtractor namedExtractor = (NamedExtractor) extractors[i];
                if (Strings.isNullOrEmpty(namedExtractor.getName())) {
                    // parameter is not named via annotation
                    // try looking for the parameter name in the compiled .class file
                    if (parameter.isNamePresent()) {
                        namedExtractor.setName(parameter.getName());
                    } else {
                        log.error("Properly annotate your controller methods OR specify the '-parameters' flag for your Java compiler!");
                        throw new FatalException(
                                "Controller method '{}' parameter {} of type '{}' does not specify a name!",
                                Util.toString(method), i + 1, Util.toString(collectionType, objectType));
                    }
                }
            }
        }
    }
875994
protected void configureFeature(Map<String, Object> configMap) {

        logger.debug(Messages.get("info.feature.register"));

        int suc = 0, fail = 0, beak = 0;

        Set<FeatureEntry> featureEntries = Sets.newTreeSet();

        for (String key : configMap.keySet()) {
            if (key.startsWith(REGISTER_CONF_PREFIX)) {
                String className = (String) configMap.get(key);
                if (StringUtils.isNotBlank(className)) {
                    String name = key.substring(REGISTER_CONF_PREFIX.length());

                    int sortSp = name.lastIndexOf(">");
                    Integer sortPriority = 1000;
                    if (sortSp != -1) {
                        String sortStr = name.substring(sortSp + 1);
                        sortSp = name.lastIndexOf("!");
                        if (sortSp != -1)
                            sortStr = sortStr.substring(0, sortSp);
                        if (sortStr.equalsIgnoreCase("last")) {
                            sortPriority = Integer.MAX_VALUE;
                        } else {
                            sortPriority = Ints.tryParse(sortStr);
                            if (sortPriority == null || sortPriority < 0 || sortPriority > Integer.MAX_VALUE) {
                                throw new ConfigErrorException(
                                        Messages.get("info.feature.key.priority.error", Integer.MAX_VALUE, key)
                                );
                            }
                        }
                    }

                    int prioritySp = name.lastIndexOf("!");
                    Integer diPriority = ContractProvider.NO_PRIORITY;
                    if (prioritySp != -1) {
                        diPriority = Ints.tryParse(name.substring(prioritySp + 1));
                        if (diPriority == null || diPriority < 0 || diPriority > Integer.MAX_VALUE) {
                            throw new ConfigErrorException(
                                    Messages.get("info.feature.key.priority.error", Integer.MAX_VALUE, key)
                            );
                        }
                    }

                    if (prioritySp != -1 || sortSp != -1) {
                        if (prioritySp > sortSp) {
                            name = name.substring(0, sortSp);
                        } else if (prioritySp < sortSp) {
                            if (prioritySp != -1) {
                                name = name.substring(0, prioritySp);
                            } else {
                                name = name.substring(0, sortSp);
                            }
                        }
                    }

                    featureEntries.add(new FeatureEntry(diPriority, sortPriority, className, name));
                }
            }
        }

        for (FeatureEntry entry : featureEntries) {
            try {
                logger.debug(Messages.get("info.feature.register.item", entry.name, entry.className));
                Class clazz = ClassUtils.getClass(entry.className);
                if (isRegistered(clazz)) {
                    beak++;
                    logger.warn(Messages.get("info.feature.exists", entry.name, clazz));
                    continue;
                }

                register(clazz, entry.diPriority);
                suc++;
            } catch (ClassNotFoundException e) {
                fail++;
                if (!entry.name.startsWith("default."))
                    logger.error(Messages.get("info.feature.sys.get.error"), e);
                else
                    logger.warn(Messages.get("info.feature.sys.not.found", entry.className), e);
            }
        }

        String registerStr = StringUtils.deleteWhitespace(
                StringUtils.defaultIfBlank((String) getProperty("registers"), ""));
        String[] registers;
        if (StringUtils.isNotBlank(registerStr)) {
            registers = registerStr.split(",");
            for (String register : registers) {
                try {
                    logger.debug(Messages.get("info.feature.register.item", "registers", register));
                    Class clazz = ClassUtils.getClass(register);
                    if (isRegistered(clazz)) {
                        beak++;
                        logger.warn(Messages.get("info.feature.exists", register));
                        continue;
                    }

                    register(clazz);
                    suc++;
                } catch (ClassNotFoundException e) {
                    fail++;
                    if (!register.startsWith("default."))
                        logger.error(Messages.get("info.feature.sys.get.error"), e);
                    else
                        logger.warn(Messages.get("info.feature.not.found.error", register), e);
                }
            }
        }

        logger.info(Messages.get("info.feature.collect", suc, fail, beak));
    }
738334
public void setEngineConfigMap(Map<String, Object> engineConfigMap) {
		if (engineConfigMap != null) {
			this.engineConfig.putAll(engineConfigMap);
		}
	}
1287477
private void addBugCategories(Set<String> bugCategorySet) {
        Element root = document.getRootElement();
        for (String category : bugCategorySet) {
            Element element = root.addElement("BugCategory");
            element.addAttribute("category", category);
            Element description = element.addElement("Description");
            description.setText(I18N.instance().getBugCategoryDescription(category));

            BugCategory bc = DetectorFactoryCollection.instance().getBugCategory(category);
            if (bc != null) { // shouldn't be null
                String s = bc.getAbbrev();
                if (s != null) {
                    Element abbrev = element.addElement("Abbreviation");
                    abbrev.setText(s);
                }
                s = bc.getDetailText();
                if (s != null) {
                    Element details = element.addElement("Details");
                    details.setText(s);
                }
            }
        }
    }
945691
protected void configureMpJwt(boolean doFeatureCheck) {

        if (doFeatureCheck && !MpJwtHelper.isMpJwtFeatureActive()) {
            return;
        }

        String annoName = "org.eclipse.microprofile.auth.LoginConfig";
        Set<String> annotatedClasses = null;
        InfoStore annosInfo = null;
        try {
            annotatedClasses = configurator.getWebAnnotations().getAnnotationTargets().getAnnotatedClasses(annoName);
            annosInfo = configurator.getWebAnnotations().getInfoStore();
        } catch (UnableToAdaptException e) { // ffdc and return
            return;
        }
        if (annotatedClasses.size() == 0) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "no annotated classes found, return");
            }
            return;
        }
        if (loginConfiguration != null && !loginConfiguration.isAuthenticationMethodDefaulted()) {
            // we already have something from web.xml, annos don't matter.
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "already have auth method determined, return");
            }
            return;
        }
        // we have an annotation and no DD, so check it out
        String className = annotatedClasses.iterator().next();
        ClassInfo ci = annosInfo.getDelayableClassInfo(className);
        boolean isValid = false;
        while (ci != null) {
            if ("javax.ws.rs.core.Application".equals(ci.getSuperclassName())) {
                isValid = true;
                break;
            }
            ci = ci.getSuperclass();
        }
        ci = annosInfo.getDelayableClassInfo(className);
        if (!isValid) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "loginConfig annotation  found, but on wrong class, " + ci.getSuperclassName() + ", return");
            }
            return;
        }
        AnnotationInfo ai = ci.getAnnotation(annoName);
        AnnotationValue authMethod, realmName;
        authMethod = ai.getValue("authMethod");
        realmName = ai.getValue("realmName");
        String authMethodString = authMethod == null ? null : authMethod.getStringValue();
        String realmNameString = realmName == null ? null : realmName.getStringValue();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "setting authMethod and realm to: "
                               + authMethodString + " " + realmNameString);
        }

        loginConfiguration = new LoginConfigurationImpl(authMethodString, realmNameString, null);
    }
187199
@Override
    public final IEngine createEngine() {
        IPluginRegistry pluginRegistry = createPluginRegistry();
        IDataEncrypter encrypter = createDataEncrypter(pluginRegistry);
        CurrentDataEncrypter.instance = encrypter;
        IRegistry registry = createRegistry(pluginRegistry, encrypter);
        IComponentRegistry componentRegistry = createComponentRegistry(pluginRegistry);
        IConnectorFactory cfactory = createConnectorFactory(pluginRegistry);
        IPolicyFactory pfactory = createPolicyFactory(pluginRegistry);
        IMetrics metrics = createMetrics(pluginRegistry);
        IDelegateFactory logFactory = createLoggerFactory(pluginRegistry);
        IApiRequestPathParser pathParser = createRequestPathParser(pluginRegistry);

        List<IGatewayInitializer> initializers = createInitializers(pluginRegistry);
        for (IGatewayInitializer initializer : initializers) {
            initializer.initialize();
        }

        complete();
        return new EngineImpl(registry, pluginRegistry, componentRegistry, cfactory, pfactory, metrics, logFactory, pathParser);
    }
1016135
@Override
    public <T> T getPluginDescriptor(final Class<T> targetDescriptor) {
        return targetDescriptor.cast(pluginDescriptors.get(targetDescriptor.getName()));
    }