| Chunk |
|---|
| Conflicting content |
|---|
public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000;
public static final int DEFAULT_READ_TIMEOUT = 2 * 60 * 1000;
<<<<<<< HEAD
final long timeout = 1000;
=======
public static final int NO_TIMEOUT = -1;
>>>>>>> 7ad5ff3fb37325c785ea390cb51f8022eec62bc8
public void setUserAgent(String userAgent);
public String getUserAgent(); |
| Solution content |
|---|
public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000;
public static final int DEFAULT_READ_TIMEOUT = 2 * 60 * 1000;
public static final int NO_TIMEOUT = -1;
public void setUserAgent(String userAgent);
public String getUserAgent(); |
| File |
|---|
| IHttpClient.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
private static final Logger LOGGER = LoggerFactory.getLogger(UrlConnectionHttpClient.class);
<<<<<<< HEAD
private static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000;
private static final int DEFAULT_READ_TIMEOUT = 2 * 60 * 1000;
private static final int NO_TIMEOUT = -1;
=======
>>>>>>> 7ad5ff3fb37325c785ea390cb51f8022eec62bc8
private static final String SYSPROP_OPENSHIFT_CONNECT_TIMEOUT = "com.openshift.httpclient.timeout";
private static final String SYSPROP_DEFAULT_CONNECT_TIMEOUT = "sun.net.client.defaultConnectTimeout";
private static final String SYSPROP_DEFAULT_READ_TIMEOUT = "sun.net.client.defaultReadTimeout"; |
| Solution content |
|---|
private static final Logger LOGGER = LoggerFactory.getLogger(UrlConnectionHttpClient.class); private static final String SYSPROP_OPENSHIFT_CONNECT_TIMEOUT = "com.openshift.httpclient.timeout"; private static final String SYSPROP_DEFAULT_CONNECT_TIMEOUT = "sun.net.client.defaultConnectTimeout"; private static final String SYSPROP_DEFAULT_READ_TIMEOUT = "sun.net.client.defaultReadTimeout"; |
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
}
public String get(URL url) throws HttpClientException, SocketTimeoutException {
<<<<<<< HEAD
return this.get(url, NO_TIMEOUT);
}
@Override
public String get(URL url, int timeout) throws HttpClientException, SocketTimeoutException {
HttpURLConnection connection = null;
try {
return write(null, HttpMethod.GET.toString(), url, timeout);
} catch (SocketTimeoutException e){
throw e;
}
catch (IOException e) {
throw createException(e, connection);
} finally {
disconnect(connection);
}
}
public void setUserAgent(String userAgent) {
=======
return get(url, NO_TIMEOUT);
}
@Override
public String get(URL url, int timeout) throws HttpClientException, SocketTimeoutException {
HttpURLConnection connection = null;
try {
return write(null, HttpMethod.GET.toString(), url, timeout);
} catch (SocketTimeoutException e) {
throw e;
/* TODO: cleanup exception handling */
} catch (IOException e) {
throw createException(e, connection);
} finally {
disconnect(connection);
}
}
public void setUserAgent(String userAgent) {
>>>>>>> 7ad5ff3fb37325c785ea390cb51f8022eec62bc8
this.userAgent = userAgent;
}
|
| Solution content |
|---|
}
public String get(URL url) throws HttpClientException, SocketTimeoutException {
return get(url, NO_TIMEOUT);
}
@Override
public String get(URL url, int timeout) throws HttpClientException, SocketTimeoutException {
HttpURLConnection connection = null;
try {
return write(null, HttpMethod.GET.toString(), url, timeout);
} catch (SocketTimeoutException e) {
throw e;
/* TODO: cleanup exception handling */
} catch (IOException e) {
throw createException(e, connection);
} finally {
disconnect(connection);
}
}
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
|
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
return put(requestMediaType.encodeParameters(parameters), url);
}
<<<<<<< HEAD
@Override
public String put(Map |
| Solution content |
|---|
return put(requestMediaType.encodeParameters(parameters), url); } @Override public String put(Map |
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Method declaration |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
protected String post(String data, URL url) throws HttpClientException, SocketTimeoutException {
return write(data, HttpMethod.POST.toString(), url, NO_TIMEOUT);
<<<<<<< HEAD
=======
}
public String post(Map |
| Solution content |
|---|
protected String post(String data, URL url) throws HttpClientException, SocketTimeoutException {
return write(data, HttpMethod.POST.toString(), url, NO_TIMEOUT);
}
public String post(Map |
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Method signature |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
return delete(requestMediaType.encodeParameters(parameters), url);
}
<<<<<<< HEAD
@Override
public String delete(Map |
| Solution content |
|---|
return delete(requestMediaType.encodeParameters(parameters), url); } @Override public String delete(Map |
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Method declaration |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
StreamUtils.writeTo(data.getBytes(), connection.getOutputStream());
}
return StreamUtils.readToString(connection.getInputStream());
<<<<<<< HEAD
}
catch (SocketTimeoutException e){
throw e;
}
catch (IOException e) {
=======
} catch (SocketTimeoutException e) {
throw e;
} catch (IOException e) {
>>>>>>> 7ad5ff3fb37325c785ea390cb51f8022eec62bc8
throw createException(e, connection);
} finally {
disconnect(connection); |
| Solution content |
|---|
StreamUtils.writeTo(data.getBytes(), connection.getOutputStream());
}
return StreamUtils.readToString(connection.getInputStream());
} catch (SocketTimeoutException e) {
throw e;
} catch (IOException e) {
throw createException(e, connection);
} finally {
disconnect(connection); |
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Catch clause |
| Chunk |
|---|
| Conflicting content |
|---|
throws IOException {
return createConnection(username, password, null, null, userAgent, url, NO_TIMEOUT);
}
<<<<<<< HEAD
protected HttpURLConnection createConnection(String username, String password, String authKey, String authIV,
String userAgent, URL url, int timeout) throws IOException {
=======
protected HttpURLConnection createConnection(String username, String password, String authKey, String authIV,
String userAgent, URL url, int timeout) throws IOException {
>>>>>>> 7ad5ff3fb37325c785ea390cb51f8022eec62bc8
LOGGER.trace(
"creating connection to {} using username \"{}\" and password \"{}\"", new Object[] { url, username,
password }); |
| Solution content |
|---|
throws IOException {
return createConnection(username, password, null, null, userAgent, url, NO_TIMEOUT);
}
protected HttpURLConnection createConnection(String username, String password, String authKey, String authIV,
String userAgent, URL url, int timeout) throws IOException {
LOGGER.trace(
"creating connection to {} using username \"{}\" and password \"{}\"", new Object[] { url, username,
password }); |
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
}
private void setConnectTimeout(URLConnection connection) {
<<<<<<< HEAD
int timeout = getSystemPropertyInteger(SYSPROP_OPENSHIFT_CONNECT_TIMEOUT);
if (timeout > NO_TIMEOUT) {
connection.setConnectTimeout(timeout);
return;
}
timeout = getSystemPropertyInteger(SYSPROP_DEFAULT_CONNECT_TIMEOUT);
if (timeout == NO_TIMEOUT) {
connection.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
}
}
private void setReadTimeout(int timeout, URLConnection connection) {
if(timeout > NO_TIMEOUT){
connection.setReadTimeout(timeout);
return;
}
timeout = getSystemPropertyInteger(SYSPROP_DEFAULT_READ_TIMEOUT);
if (timeout == NO_TIMEOUT) {
connection.setReadTimeout(DEFAULT_READ_TIMEOUT);
=======
int timeout = getTimeout(
getSystemPropertyInteger(SYSPROP_OPENSHIFT_CONNECT_TIMEOUT),
getSystemPropertyInteger(SYSPROP_DEFAULT_CONNECT_TIMEOUT),
DEFAULT_CONNECT_TIMEOUT);
connection.setConnectTimeout(timeout);
}
private void setReadTimeout(int timeout, URLConnection connection) {
timeout = getTimeout(timeout, getSystemPropertyInteger(SYSPROP_DEFAULT_READ_TIMEOUT), DEFAULT_READ_TIMEOUT);
connection.setReadTimeout(timeout);
}
private int getTimeout(int timeout, int systemPropertyTimeout, int defaultTimeout) {
if (timeout == NO_TIMEOUT) {
timeout = systemPropertyTimeout;
if (timeout == NO_TIMEOUT) {
timeout = defaultTimeout;
}
>>>>>>> 7ad5ff3fb37325c785ea390cb51f8022eec62bc8
}
return timeout;
} |
| Solution content |
|---|
}
private void setConnectTimeout(URLConnection connection) {
int timeout = getTimeout(
getSystemPropertyInteger(SYSPROP_OPENSHIFT_CONNECT_TIMEOUT),
getSystemPropertyInteger(SYSPROP_DEFAULT_CONNECT_TIMEOUT),
DEFAULT_CONNECT_TIMEOUT);
connection.setConnectTimeout(timeout);
}
private void setReadTimeout(int timeout, URLConnection connection) {
timeout = getTimeout(timeout, getSystemPropertyInteger(SYSPROP_DEFAULT_READ_TIMEOUT), DEFAULT_READ_TIMEOUT);
connection.setReadTimeout(timeout);
}
private int getTimeout(int timeout, int systemPropertyTimeout, int defaultTimeout) {
if (timeout == NO_TIMEOUT) {
timeout = systemPropertyTimeout;
if (timeout == NO_TIMEOUT) {
timeout = defaultTimeout;
}
}
return timeout;
} |
| File |
|---|
| UrlConnectionHttpClient.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
}
<<<<<<< HEAD
@Test
public void shouldRespectGivenTimeoutPOST() throws Throwable{
final int timeout = 1000;
final int serverDelay = timeout * 4;
// pre-conditions
assertThat(timeout).isLessThan(IHttpClient.DEFAULT_READ_TIMEOUT);
WaitingHttpServerFake serverFake = this.startWaitingHttpServerFake(serverDelay);
Map |
| Solution content |
|---|
}
}
@Test
public void shouldRespectGivenTimeoutPOST() throws Throwable {
// pre-conditions
final int timeout = 1000;
final int serverDelay = timeout * 4;
assertThat(timeout).isLessThan(IHttpClient.DEFAULT_READ_TIMEOUT);
WaitingHttpServerFake serverFake = this.startWaitingHttpServerFake(serverDelay);
long startTime = System.currentTimeMillis();
// operations
try {
httpClient.post(Collections. |
| File |
|---|
| HttpClientTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
return serverFake;
}
<<<<<<< HEAD
protected WaitingHttpServerFake startWaitingHttpServerFake(int delay) throws IOException{
WaitingHttpServerFake serverFake = new WaitingHttpServerFake(delay);
serverFake.start();
return serverFake;
}
=======
protected WaitingHttpServerFake startWaitingHttpServerFake(int delay) throws IOException {
WaitingHttpServerFake serverFake = new WaitingHttpServerFake(delay);
serverFake.start();
return serverFake;
}
>>>>>>> 7ad5ff3fb37325c785ea390cb51f8022eec62bc8
} |
| Solution content |
|---|
return serverFake;
}
protected WaitingHttpServerFake startWaitingHttpServerFake(int delay) throws IOException {
WaitingHttpServerFake serverFake = new WaitingHttpServerFake(delay);
serverFake.start();
return serverFake;
}
} |
| File |
|---|
| HttpClientTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |