Projects >> Ektorp >>84c67439f3a5a18abec65ee56312185b41c47254

Chunk
Conflicting content
import java.io.ByteArrayInputStream;
import java.io.IOException;

<<<<<<< HEAD
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.node.*;
=======
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.ObjectNode;
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662
import org.ektorp.util.Base64;
import org.ektorp.util.Exceptions;
Solution content
import java.io.ByteArrayInputStream;
import java.io.IOException;

import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.node.*;
import org.ektorp.util.Base64;
import org.ektorp.util.Exceptions;
File
PageRequest.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
					.decode(link, Base64.URL_SAFE)));

			KeyIdPair key = parseNextKey(n);
<<<<<<< HEAD
			Deque keyHistory = parseKeyHistory(n);
			int pageSize = n.get(PAGE_SIZE_FIELD_NAME).intValue();

			return new PageRequest(key, pageSize, keyHistory);
=======
			int pageSize = n.get(PAGE_SIZE_FIELD_NAME).getIntValue();
			boolean back = n.get(BACK_FIELD_NAME).asInt() == 1;
			int page = n.get(PAGE_FIELD_NAME).asInt();
			return new Builder()
						.nextKey(key)
						.pageSize(pageSize)
						.back(back)
						.page(page)
						.build();
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662
		} catch (Exception e) {
			throw Exceptions.propagate(e);
		}
Solution content
					.decode(link, Base64.URL_SAFE)));

			KeyIdPair key = parseNextKey(n);
			int pageSize = n.get(PAGE_SIZE_FIELD_NAME).getIntValue();
			boolean back = n.get(BACK_FIELD_NAME).asInt() == 1;
			int page = n.get(PAGE_FIELD_NAME).asInt();
			return new Builder()
						.nextKey(key)
						.pageSize(pageSize)
						.back(back)
						.page(page)
						.build();
		} catch (Exception e) {
			throw Exceptions.propagate(e);
		}
File
PageRequest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Return statement
Variable
Chunk
Conflicting content
		}
	}

<<<<<<< HEAD
	private static Deque parseKeyHistory(JsonNode n) {
		Deque keyHistory = new LinkedList();
		ArrayNode h = (ArrayNode) n.get(KEY_HISTORY_FIELD_NAME);
		if (h != null) {
			for (JsonNode hn : h) {
				String docId = hn.fieldNames().next();
				keyHistory.addFirst(new KeyIdPair(hn.get(docId), docId));
			}

		}
		return keyHistory;
=======
	private static KeyIdPair parseNextKey(JsonNode n) {
		return parseKey(NEXT_KEY_FIELD_NAME, n);
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662
	}

	private static KeyIdPair parseKey(String fieldName, JsonNode n) {
Solution content
		}
	}

	private static KeyIdPair parseNextKey(JsonNode n) {
		return parseKey(NEXT_KEY_FIELD_NAME, n);
	}

	private static KeyIdPair parseKey(String fieldName, JsonNode n) {
File
PageRequest.java
Developer's decision
Version 2
Kind of conflict
Attribute
Cast expression
If statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
					.build();
	}

<<<<<<< HEAD
	public PageRequest getNextPageRequest(Object nextStartKey,
			String nextStartDocId) {
		try {
			JsonNode keyNode = MAPPER.readTree(MAPPER
					.writeValueAsString(nextStartKey));

			Deque d = new LinkedList(keyHistory);
			d.addFirst(this.nextKey != null ? this.nextKey : FIRST_PAGE_NEXT_KEY_PLACEHOLDER);

			return new PageRequest(new KeyIdPair(keyNode, nextStartDocId), pageSize, d);
		} catch (IOException e) {
			throw Exceptions.propagate(e);
		}
=======
	
	public boolean isBack() {
		return back;
	}
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662

	@Override
	public String toString() {
Solution content
					.build();
	}

	
	public boolean isBack() {
		return back;
	}

	@Override
	public String toString() {
File
PageRequest.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Method signature
Try statement
Chunk
Conflicting content
import java.util.Collections;
import java.util.List;

<<<<<<< HEAD
import com.fasterxml.jackson.databind.ObjectMapper;
=======
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662
import org.ektorp.Page;
import org.ektorp.PageRequest;
import org.ektorp.http.HttpResponse;
Solution content
import java.util.Collections;
import java.util.List;

import org.codehaus.jackson.map.ObjectMapper;
import org.ektorp.Page;
import org.ektorp.PageRequest;
import org.ektorp.http.HttpResponse;
File
PageResponseHandler.java
Developer's decision
Combination
Kind of conflict
Import
Chunk
Conflicting content
					JsonNode error = jp.readValueAsTree();
					if (ignoreNotFound
							&& error.asText().equals("not_found")) {
<<<<<<< HEAD
                                            lastFieldName = null;
                                            state.inRow = false;
                                            jp.nextToken();
                                            jp.nextToken();
                                            continue;
					}
					throw new ViewResultException(state.lastKey,
							error.asText());
=======
						lastFieldName = null;
                        state.inRow = false;
                        jp.nextToken();
					} else {
						throw new ViewResultException(state.lastKey,
								error.asText());	
					}
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662
				} else if (isInField(fieldName, lastFieldName)) {
					if (jp.getCurrentToken() == JsonToken.VALUE_NULL) {
						state.fieldIsNull = true;
Solution content
					JsonNode error = jp.readValueAsTree();
					if (ignoreNotFound
							&& error.asText().equals("not_found")) {
						lastFieldName = null;
                        state.inRow = false;
                        jp.nextToken();
					} else {
						throw new ViewResultException(state.lastKey,
								error.asText());	
					}
				} else if (isInField(fieldName, lastFieldName)) {
					if (jp.getCurrentToken() == JsonToken.VALUE_NULL) {
						state.fieldIsNull = true;
File
QueryResultParser.java
Developer's decision
Version 2
Kind of conflict
Continue statement
Method invocation
Throw statement
Variable
Chunk
Conflicting content
	public boolean isNew() {
		return revision == null;
	}
<<<<<<< HEAD

	@JsonProperty("_attachments")
	public Map getAttachments() {
		return attachments;
	}

	@JsonProperty("_attachments")
=======
	
	@JsonProperty(ATTACHMENTS_NAME)
	public Map getAttachments() {
		return attachments;
	}
	
	@JsonProperty(ATTACHMENTS_NAME)
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662
	void setAttachments(Map attachments) {
		this.attachments = attachments;
	}
Solution content
	public boolean isNew() {
		return revision == null;
	}
	
	@JsonProperty(ATTACHMENTS_NAME)
	public Map getAttachments() {
		return attachments;
	}
	
	@JsonProperty(ATTACHMENTS_NAME)
	void setAttachments(Map attachments) {
		this.attachments = attachments;
	}
File
CouchDbDocument.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration
Method signature
Chunk
Conflicting content
		assertTrue(page.isHasNext());
		assertEquals("dcdaf08242a4be7da1a36e25f4f0b022", page.getNextPageRequest().getStartKeyDocId());
	}
<<<<<<< HEAD

	@Test
=======
	
	@Test @Ignore
>>>>>>> 1deb4eb362ff09efccf9f9a7f6d5ba463726f662
	public void given_previous_page_request_has_not_been_set_then_hasPrevious_should_be_false() throws Exception {
		handler = new PageResponseHandler(PageRequest.firstPage(5), TestDoc.class, new ObjectMapper());
		Page page = handler.success(ResponseOnFileStub.newInstance(200, "offset_view_result.json"));
Solution content
		assertTrue(page.isHasNext());
		assertEquals("dcdaf08242a4be7da1a36e25f4f0b022", page.getNextPageRequest().getStartKeyDocId());
	}
	
	@Test @Ignore
	public void given_previous_page_request_has_not_been_set_then_hasPrevious_should_be_false() throws Exception {
		handler = new PageResponseHandler(PageRequest.firstPage(5), TestDoc.class, new ObjectMapper());
		Page page = handler.success(ResponseOnFileStub.newInstance(200, "offset_view_result.json"));
File
PageResponseHandlerTest.java
Developer's decision
Version 2
Kind of conflict
Annotation