Projects >> jolokia >>43fddfaf49972c6d499ac0a332d841d5c5c5897d

Chunk
Conflicting content
 */
public final class Version {

<<<<<<< HEAD
    private static final String VERSION = "1.1.4-SNAPSHOT";
=======
    private static final String VERSION = "1.1.4";
>>>>>>> 9270475dad166c8407da7a265a1ddff90b66ddc3

    // Major.Minor version of protocol
    private static final String PROTOCOL = "7.0";
Solution content
 */
public final class Version {

    private static final String VERSION = "1.1.4";

    // Major.Minor version of protocol
    private static final String PROTOCOL = "7.0";
File
Version.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
 */
public class TomcatDetector extends AbstractServerDetector {

<<<<<<< HEAD
    private static final Pattern SERVER_INFO_PATTERN = Pattern.compile("^\\s*([^/]+)\\s*/\\s*([\\d\\.]+)");

    /**
     * Create a server detector
     *
     * @param pOrder of the detector (within the list of detectors)
     */
    public TomcatDetector(int pOrder) {
        super(pOrder);
    }

=======
    private static final Pattern SERVER_INFO_PATTERN =
            Pattern.compile("^\\s*([^/]+)\\s*/\\s*([\\d\\.]+(-RC\\d+)?)",Pattern.CASE_INSENSITIVE);
>>>>>>> 9270475dad166c8407da7a265a1ddff90b66ddc3

    /** {@inheritDoc}
     * @param pMBeanServerExecutor*/
Solution content
    /** {@inheritDoc}
 */
public class TomcatDetector extends AbstractServerDetector {

    private static final Pattern SERVER_INFO_PATTERN =
            Pattern.compile("^\\s*([^/]+)\\s*/\\s*([\\d\\.]+(-RC\\d+)?)",Pattern.CASE_INSENSITIVE);


    /**
     * Create a server detector
     *
     * @param pOrder of the detector (within the list of detectors)
     */
    public TomcatDetector(int pOrder) {
        super(pOrder);
    }


     * @param pMBeanServerExecutor*/
File
TomcatDetector.java
Developer's decision
Combination
Kind of conflict
Attribute
Comment
Method declaration
Method invocation
Chunk
Conflicting content
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.UnknownHostException;
<<<<<<< HEAD
import java.util.*;

import com.sun.net.httpserver.Authenticator;
import org.jolokia.config.*;
=======
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
>>>>>>> 9270475dad166c8407da7a265a1ddff90b66ddc3

/**
 * Configuration required for the JolokiaServer
Solution content
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;

import com.sun.net.httpserver.Authenticator;
import org.jolokia.config.*;

/**
 * Configuration required for the JolokiaServer
File
JolokiaServerConfig.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    }

    private void initAuthenticator() {
<<<<<<< HEAD
        String user = jolokiaConfig.getConfig(ConfigKey.USER);
        String password = jolokiaConfig.getConfig(ConfigKey.PASSWORD);
=======
        initCustomAuthenticator();
        if (authenticator == null) {
            initDefaultAuthenticator();
        }
    }

    private void initCustomAuthenticator() {
        String authenticatorClass = jolokiaConfig.get(ConfigKey.AUTHENTICATOR_CLASS);

        if (authenticatorClass != null) {
            try {
                Class authClass = Class.forName(authenticatorClass);
                if (!Authenticator.class.isAssignableFrom(authClass)) {
                    throw new IllegalArgumentException("Provided authenticator class [" + authenticatorClass +
                            "] is not a subclass of Authenticator");
                }

                try {
                    // prefer constructor that takes configuration
                    try {
                        Constructor constructorThatTakesConfiguration = authClass.getConstructor(Configuration.class);
                        authenticator = (Authenticator) constructorThatTakesConfiguration.newInstance(this.jolokiaConfig);
                    } catch (NoSuchMethodException ignore) {

                        // fallback to default constructor
                        try {
                            Constructor defaultConstructor = authClass.getConstructor();
                            authenticator = (Authenticator) defaultConstructor.newInstance();
                        } catch (NoSuchMethodException e) {
                            throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e);
                        } catch (InvocationTargetException e) {
                            throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e);
                        }

                    } catch (InvocationTargetException e) {
                        throw new IllegalArgumentException("Cannot create an instance of custom authenticator class with configuration", e);
                    }
                } catch (InstantiationException e) {
                    throw new IllegalArgumentException("Cannot create an instance of custom authenticator class", e);
                } catch (IllegalAccessException e) {
                    throw new IllegalArgumentException("Cannot create an instance of custom authenticator class", e);
                }
            } catch (ClassNotFoundException e) {
                throw new IllegalArgumentException("Cannot find authenticator class", e);
            }
        }
    }

    private void initDefaultAuthenticator() {
        String user = jolokiaConfig.get(ConfigKey.USER);
        String password = jolokiaConfig.get(ConfigKey.PASSWORD);
>>>>>>> 9270475dad166c8407da7a265a1ddff90b66ddc3

        authenticator = (user != null && password != null) ?
                new UserPasswordAuthenticator(user,password) :
Solution content
    }

    private void initAuthenticator() {
        initCustomAuthenticator();
        if (authenticator == null) {
            initDefaultAuthenticator();
        }
    }

    private void initCustomAuthenticator() {
        String authenticatorClass = jolokiaConfig.getConfig(ConfigKey.AUTHENTICATOR_CLASS);

        if (authenticatorClass != null) {
            try {
                Class authClass = Class.forName(authenticatorClass);
                if (!Authenticator.class.isAssignableFrom(authClass)) {
                    throw new IllegalArgumentException("Provided authenticator class [" + authenticatorClass +
                            "] is not a subclass of Authenticator");
                }

                try {
                    // prefer constructor that takes configuration
                    try {
                        Constructor constructorThatTakesConfiguration = authClass.getConstructor(Configuration.class);
                        authenticator = (Authenticator) constructorThatTakesConfiguration.newInstance(this.jolokiaConfig);
                    } catch (NoSuchMethodException ignore) {

                        // fallback to default constructor
                        try {
                            Constructor defaultConstructor = authClass.getConstructor();
                            authenticator = (Authenticator) defaultConstructor.newInstance();
                        } catch (NoSuchMethodException e) {
                            throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e);
                        } catch (InvocationTargetException e) {
                            throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e);
                        }

                    } catch (InvocationTargetException e) {
                        throw new IllegalArgumentException("Cannot create an instance of custom authenticator class with configuration", e);
                    }
                } catch (InstantiationException e) {
                    throw new IllegalArgumentException("Cannot create an instance of custom authenticator class", e);
                } catch (IllegalAccessException e) {
                    throw new IllegalArgumentException("Cannot create an instance of custom authenticator class", e);
                }
            } catch (ClassNotFoundException e) {
                throw new IllegalArgumentException("Cannot find authenticator class", e);
            }
        }
    }

    private void initDefaultAuthenticator() {
        String user = jolokiaConfig.getConfig(ConfigKey.USER);
        String password = jolokiaConfig.getConfig(ConfigKey.PASSWORD);

        authenticator = (user != null && password != null) ?
                new UserPasswordAuthenticator(user,password) :
File
JolokiaServerConfig.java
Developer's decision
Manual
Kind of conflict
If statement
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
import java.util.regex.Matcher;

import com.sun.net.httpserver.Authenticator;
<<<<<<< HEAD
import org.jolokia.config.*;
=======
import org.jolokia.config.ConfigKey;
import org.jolokia.config.Configuration;
import org.jolokia.util.EscapeUtil;
>>>>>>> 9270475dad166c8407da7a265a1ddff90b66ddc3
import org.testng.annotations.Test;

import static org.testng.Assert.*;
Solution content
import java.util.regex.Matcher;

import com.sun.net.httpserver.Authenticator;
import org.jolokia.config.ConfigKey;
import org.jolokia.config.Configuration;
import org.jolokia.util.EscapeUtil;
import org.testng.annotations.Test;

import static org.testng.Assert.*;
File
JvmAgentConfigTest.java
Developer's decision
Version 2
Kind of conflict
Import