auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String getMessageFromValue(final int value) { switch (value) { case INVALID_DATE: return "Can only access during valid times:"; case INVALID_PERMISSION: return "Can only perform task with valid permission"; case NO_AUTH_SENT: return "No Authentication Information was received"; default: break; } <START> return null; <END> }</code><technical_language>save a lines moving return null default case instead of break</technical_language>

Target:
public static String getMessageFromValue(final int value) { switch (value) { case INVALID_DATE: return "Can only access during valid times:"; case INVALID_PERMISSION: return "Can only perform task with valid permission"; case NO_AUTH_SENT: return "No Authentication Information was received"; default: return null; } }
Source:
<code>private Predicate<Map.Entry<UserName, Collection<GameId>>> playerIsInGame(final String gameId) { <START> return entry -> entry.getValue().stream().anyMatch(id -> id.getId().equals(gameId)); <END> }</code><technical_language>suggestion return entry -> entry.getValue().stream().map(GameId::getId).anyMatch(gameId::equals);</technical_language>

Target:
private Predicate<Map.Entry<UserName, Collection<GameId>>> playerIsInGame(final String gameId) { return entry -> entry.getValue().stream().map(GameId::getId).anyMatch(gameId::equals); }
Source:
<code>private void removeTransactionInfoRemotely(LocalTransaction localTransaction, GlobalTransaction gtx) { <START> if (mayHaveRemoteLocks(localTransaction) && !isSecondPhaseAsync && partitionHandlingManager.isTransactionPartiallyRolledBack(gtx)) { <END> final TxCompletionNotificationCommand command = commandsFactory.buildTxCompletionNotificationCommand(null, gtx); final Collection<Address> owners = clusteringLogic.getOwners(filterDeltaCompositeKeys(localTransaction.getAffectedKeys())); Collection<Address> commitNodes = localTransaction.getCommitNodes(owners, rpcManager.getTopologyId(), rpcManager.getMembers()); log.tracef("About to invoke tx completion notification on commitNodes: %s", commitNodes); rpcManager.invokeRemotely(commitNodes, command, rpcManager.getDefaultRpcOptions(false, DeliverOrder.NONE)); } }</code><technical_language>This read well, if partition handling is disabled I expect partially rolled txs. Edit: I remember a discussion names of some of methods, I hope convinced this name :)</technical_language>

Target:
private void removeTransactionInfoRemotely(LocalTransaction localTransaction, GlobalTransaction gtx) { if (mayHaveRemoteLocks(localTransaction) && !isSecondPhaseAsync && !partitionHandlingManager.isTransactionPartiallyCommitted(gtx)) { final TxCompletionNotificationCommand command = commandsFactory.buildTxCompletionNotificationCommand(null, gtx); final Collection<Address> owners = clusteringLogic.getOwners(filterDeltaCompositeKeys(localTransaction.getAffectedKeys())); Collection<Address> commitNodes = localTransaction.getCommitNodes(owners, rpcManager.getTopologyId(), rpcManager.getMembers()); log.tracef("About to invoke tx completion notification on commitNodes: %s", commitNodes); rpcManager.invokeRemotely(commitNodes, command, rpcManager.getDefaultRpcOptions(false, DeliverOrder.NONE)); } }
Source:
<code>public Response validateTopology (@PathParam("id") Long topologyId) { try { Topology result = catalogService.getTopology(topologyId); if (result != null) { <START> catalogService.validateTopology(SCHEMA, topologyId); <END> return WSUtils.respond(OK, SUCCESS, result); } } catch (BadTopologyLayoutException ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND, topologyId.toString()); }</code><technical_language>I do need send schema URL time is a single schema for topology. JsonNode schemaNode = JsonLoader.fromURL(jsonSchema); JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); JsonSchema schema = factory.getJsonSchema(schemaNode); schema instance cached pass API</technical_language>

Target:
public Response validateTopology (@PathParam("id") Long topologyId) { try { Topology result = catalogService.getTopology(topologyId); if (result != null) { catalogService.validateTopology(SCHEMA, topologyId); return WSUtils.respond(OK, SUCCESS, result); } } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND, topologyId.toString()); }
Source:
<code>public static String listObjectToString(ArrayList<String> objectList) { <START> return objectList == null ? null : new Gson().toJson(objectList); <END> }</code><technical_language>/** * Gson objects heavy. app ideally instance of instead of creating new instances everywhere. * @return returns a singleton Gson instance */ @Provides @Singleton public Gson provideGson() { return GsonUtil.getDefaultGson(); } handy if create Gsons I this class is instantiated room</technical_language>

Target:
public static String listObjectToString(ArrayList<String> objectList) { return objectList == null ? null : getGson().toJson(objectList); }
Source:
<code>private VoidResult doAddReviewers(final Set<Id> reviewerIds, final Change.Id id, final ReviewDb db, final Transaction txn) throws OrmException { final List<ApprovalType> allTypes = Common.getGerritConfig().getApprovalTypes(); final ApprovalCategory.Id ac = allTypes.get(allTypes.size() - 1).getCategory().getId(); for (Account.Id reviewer : reviewerIds) { <START> if (db.changeApprovals().byChangeUser(id, reviewer).iterator().hasNext() == false) { <END> ChangeApproval myca = new ChangeApproval(new ChangeApproval.Key(id, reviewer, ac), (short) 0); db.changeApprovals().insert(Collections.singleton(myca), txn); } } return VoidResult.INSTANCE; }</code><technical_language>Minor nit, "!" in front easier type read " == false" end</technical_language>

Target:
private VoidResult doAddReviewers(final Set<Id> reviewerIds, final Change.Id id, final ReviewDb db, final Transaction txn) throws OrmException { final List<ApprovalType> allTypes = Common.getGerritConfig().getApprovalTypes(); final ApprovalCategory.Id ac = allTypes.get(allTypes.size() - 1).getCategory().getId(); for (Account.Id reviewer : reviewerIds) { if (!db.changeApprovals().byChangeUser(id, reviewer).iterator().hasNext()) { ChangeApproval myca = new ChangeApproval(new ChangeApproval.Key(id, reviewer, ac), (short) 0); db.changeApprovals().insert(Collections.singleton(myca), txn); } } return VoidResult.INSTANCE; }
Source:
<code>public void testGetRequiredTokens() { final AnnotationLocationCheck checkObj = new AnnotationLocationCheck(); assertArrayEquals( <START> "AnnotationLocationCheck#getRequiredtokens should return empty array by default", <END> CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); }</code><technical_language>tokens capital T? of follow this pattern</technical_language>

Target:
public void testGetRequiredTokens() { final AnnotationLocationCheck checkObj = new AnnotationLocationCheck(); assertArrayEquals( "AnnotationLocationCheck#getRequiredTokens should return empty array by default", CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); }
Source:
<code><START> public String encodeUnicodeString(String str) { <END> str = str == null ? "" : str; String tmp; StringBuilder sb = new StringBuilder(); char c; int i, j; sb.setLength(0); for (i = 0; i < str.length(); i++) { c = str.charAt(i); sb.append("%u"); j = (c >>>8); tmp = Integer.toHexString(j); if (tmp.length() == 1) sb.append('0'); sb.append(tmp); j = (c & 0xFF); tmp = Integer.toHexString(j); if (tmp.length() == 1) sb.append('0'); sb.append(tmp); } return (sb.toString()); }</code><technical_language>(encode/decode method) private static</technical_language>

Target:
private static String encodeUnicodeString(String str) { str = str == null ? "" : str; String tmp; StringBuilder sb = new StringBuilder(); char c; int i, j; sb.setLength(0); for (i = 0; i < str.length(); i++) { c = str.charAt(i); sb.append("%u"); j = (c >>>8); tmp = Integer.toHexString(j); if (tmp.length() == 1) sb.append('0'); sb.append(tmp); j = (c & 0xFF); tmp = Integer.toHexString(j); if (tmp.length() == 1) sb.append('0'); sb.append(tmp); } return (sb.toString()); }
Source:
<code>private static String[] getFieldArray(String field) { StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); <START> } else if (charAt == BACKSLASH && i < field.length() - 1 && field.charAt(i + 1) == SLASH) { <END> sb.append(SLASH); i++; } else { sb.append(charAt); } } list.add(sb.toString()); String[] array = new String[list.size()]; list.toArray(array); return array; }</code><technical_language>I prefer some brackets logic elements for readability</technical_language>

Target:
private static String[] getFieldArray(String field) { StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); } else if ((charAt == BACKSLASH) && (i < field.length() - 1) && (field.charAt(i + 1) == SLASH)) { sb.append(SLASH); i++; } else { sb.append(charAt); } } list.add(sb.toString()); String[] array = new String[list.size()]; list.toArray(array); return array; }
Source:
<code>protected void checkReferenceType(Set<SwaggerError> errors, AbstractNode node) { if (JsonReference.isReference(node)) { Model model = node.getModel(); TypeDefinition type = node.getType(); if (type instanceof ReferenceTypeDefinition) { type = ((ReferenceTypeDefinition) type).resolve(); } AbstractNode nodeValue = node.get(JsonReference.PROPERTY); AbstractNode valueNode = model.find((String) nodeValue.asValue().getValue()); if (valueNode != null && type.getPointer() != null && valueNode.getType() != null && !type.getPointer().equals(valueNode.getType().getPointer())) { <START> errors.add(error(nodeValue, IMarker.SEVERITY_ERROR, Messages.error_invalid_reference_type)); <END> } } }</code><technical_language>**really** helpful provide type is expected. valueNode.getType().getPointer() provide this info</technical_language>

Target:
protected void checkReferenceType(Set<SwaggerError> errors, AbstractNode node) { if (JsonReference.isReference(node)) { Model model = node.getModel(); TypeDefinition type = node.getType(); AbstractNode nodeValue = node.get(JsonReference.PROPERTY); AbstractNode valueNode = model.find((String) nodeValue.asValue().getValue()); if (valueNode == null) { return; } if (!type.validate(valueNode)) { errors.add(error(nodeValue, IMarker.SEVERITY_WARNING, Messages.error_invalid_reference_type)); } } }
Source:
<code>public void onPlayerCastsSpell(ManaChangeEvent event) { player = dPlayer.mirrorBukkitPlayer(event.getPlayer()); new_mana = event.getNewAmount(); old_mana = event.getOldAmount(); max_mana = event.getMaxMana(); reason = new Element(event.getReason().name()); this.event = event; <START> fire(); <END> event.setNewAmount(new_mana); }</code><technical_language>fire(event); for EventHandler based events</technical_language>

Target:
public void onPlayerCastsSpell(ManaChangeEvent event) { player = dPlayer.mirrorBukkitPlayer(event.getPlayer()); new_mana = event.getNewAmount(); old_mana = event.getOldAmount(); max_mana = event.getMaxMana(); reason = new Element(event.getReason().name()); this.event = event; fire(event); event.setNewAmount(new_mana); }
Source:
<code>public void onEvent(Event event, Object source, Object data) { XWikiContext context = (XWikiContext) data; XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference(doc.getDocumentReference().getWikiReference().getName(), Constants.CODE_SPACE, "PatientClass")); if (patientRecordObj == null) { return; } List<BaseObject> existingVersionObjects = doc.getXObjects(VERSION_RECORDER_REFERENCE); try { for (Map.Entry<String, String> versionType : this.versionTypes().entrySet()) { boolean skip = false; if (existingVersionObjects != null) { for (BaseObject existingVersionObject : existingVersionObjects) { <START> String name = existingVersionObject.getField(NAME_FIELD).toFormString(); <END> if (name.equalsIgnoreCase(versionType.getKey())) { skip = true; break; } } if (skip) { continue; } } BaseObject versionObject = doc.newXObject(VERSION_RECORDER_REFERENCE, context); versionObject.set(NAME_FIELD, versionType.getKey(), context); versionObject.set("version", versionType.getValue(), context); } } catch (XWikiException ex) { } }</code><technical_language>existingVersionObject.getStringValue(NAME_FIELD)</technical_language>

Target:
public void onEvent(Event event, Object source, Object data) { XWikiContext context = (XWikiContext) data; XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference(doc.getDocumentReference().getWikiReference().getName(), Constants.CODE_SPACE, "PatientClass")); if (patientRecordObj == null) { return; } List<BaseObject> existingVersionObjects = doc.getXObjects(VERSION_RECORDER_REFERENCE); try { for (Map.Entry<String, String> versionType : this.getOntologiesVersions().entrySet()) { boolean skip = false; if (existingVersionObjects != null) { for (BaseObject existingVersionObject : existingVersionObjects) { String name = existingVersionObject.getStringValue(NAME_FIELD); if (StringUtils.equalsIgnoreCase(name, versionType.getKey())) { existingVersionObject.set(VERSION_FIELD, versionType.getValue(), context); skip = true; break; } } if (skip) { continue; } } BaseObject versionObject = doc.newXObject(VERSION_RECORDER_REFERENCE, context); versionObject.set(NAME_FIELD, versionType.getKey(), context); versionObject.set(VERSION_FIELD, versionType.getValue(), context); } } catch (XWikiException ex) { } }
Source:
<code>public void flush() { Map<String, Object>[] vmInfos = getVmInfo(vdsId, getVmsToProcess()); if (vmInfos != null) { for (Map<String, Object> vmInfo : vmInfos) { processFullList(vmInfo); } } for (VmDevice deviceToUpdate : getDevicesToProcess()) { <START> processDeviceUpdate(this, <END> deviceToUpdate); } saveDevicesToDb(this); unlockTouchedVms(); }</code><technical_language>I this renamed processDevice -the device added updated</technical_language>

Target:
public void flush() { Map<String, Object>[] vmInfos = getVmInfo(vdsId, getVmsToProcess()); if (vmInfos != null) { for (Map<String, Object> vmInfo : vmInfos) { processFullList(vmInfo); } } for (VmDevice deviceToProcess : getDevicesToProcess()) { processDevice(this, deviceToProcess); } saveDevicesToDb(this); unlockTouchedVms(); }
Source:
<code>private RiakConnection getConnection(int attempts) throws IOException { try { if (permits.tryAcquire(connectionWaitTimeoutMillis, TimeUnit.MILLISECONDS)) { RiakConnection c = available.poll(); if (c == null) { try { c = new RiakConnection(host, port, bufferSizeKb, this); } catch (IOException e) { permits.release(); throw e; } } inUse.offer(c); return c; } else { <START> throw new AcquireConnectionTimeoutException("timeout aquiring connection permit from pool"); <END> } } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (attempts > 0) { return getConnection(attempts - 1); } else { throw new IOException("interrupted whilst waiting to acquire connection"); } } }</code><technical_language>s/aquiring/acquiring</technical_language>

Target:
private RiakConnection getConnection(int attempts) throws IOException { try { if (permits.tryAcquire(connectionWaitTimeoutMillis, TimeUnit.MILLISECONDS)) { RiakConnection c = available.poll(); if (c == null) { try { c = new RiakConnection(host, port, bufferSizeKb, this); } catch (IOException e) { permits.release(); throw e; } } inUse.offer(c); return c; } else { throw new AcquireConnectionTimeoutException("timeout acquiring connection permit from pool"); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (attempts > 0) { return getConnection(attempts - 1); } else { throw new IOException("interrupted whilst waiting to acquire connection"); } } }
Source:
<code>public Channel attach(String handle, final Map<String, String> parameters) { if (log.isDebugEnabled()) { <START> log.debug("attach: [ " + handle + " ] with parameters: " + parameters); <END> } Channel channel = new TransportChannel(transportConnection); HashMap<String, String> request = new HashMap<String, String>(parameters); request.putAll(buildParams("type", "attach", "handle", handle)); transportConnection.sendMessage(channel, request); return channel; }</code><technical_language>again: java log.debug("attach: parameters: {}", handle, parameters);</technical_language>

Target:
public Channel attach(String handle, final Map<String, String> parameters) { log.debug("attach: [ ] with parameters: {}", handle, parameters); Channel channel = new TransportChannel(transportConnection); Map<String, String> request = new HashMap<String, String>(parameters); request.put("type", "attach"); request.put("handle", handle); transportConnection.sendMessage(channel, request); return channel; }
Source:
<code>public static Slice stLineString(@SqlType("array(" + GEOMETRY_TYPE_NAME + ")") Block input) { <START> int addedPoints = 0; <END> MultiPath multipath = new Polyline(); OGCPoint previousPoint = null; for (int i = 0; i < input.getPositionCount(); i++) { Slice slice = GEOMETRY.getSlice(input, i); if (slice.getInput().available() == 0) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_LineString: null at index %s", i + 1)); } OGCGeometry geometry = deserialize(slice); if (!(geometry instanceof OGCPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("ST_LineString takes only an array of valid points, %s was passed", geometry.geometryType())); } OGCPoint point = (OGCPoint) geometry; if (point.isEmpty()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_LineString: empty point found at index %s", i + 1)); } if (addedPoints == 0) { previousPoint = point; multipath.startPath(point.X(), point.Y()); } else { if(point.Equals(previousPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("ST_LineString doesn't take array with consecutive duplicate points, duplicates found at index %s", i + 1)); } previousPoint = point; multipath.lineTo(point.X(), point.Y()); } addedPoints++; } OGCLineString linestring = new OGCLineString(multipath, 0, null); return serialize(linestring); }</code><technical_language>this variable is longer need. if (addedPoints == 0) check replaced if (previousPoint == null)</technical_language>

Target:
public static Slice stLineString(@SqlType("array(" + GEOMETRY_TYPE_NAME + ")") Block input) { MultiPath multipath = new Polyline(); OGCPoint previousPoint = null; for (int i = 0; i < input.getPositionCount(); i++) { Slice slice = GEOMETRY.getSlice(input, i); if (slice.getInput().available() == 0) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_LineString: null point at index %s", i + 1)); } OGCGeometry geometry = deserialize(slice); if (!(geometry instanceof OGCPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("ST_LineString takes only an array of valid points, %s was passed", geometry.geometryType())); } OGCPoint point = (OGCPoint) geometry; if (point.isEmpty()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_LineString: empty point at index %s", i + 1)); } if (previousPoint == null) { multipath.startPath(point.X(), point.Y()); } else { if (point.Equals(previousPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_LineString: consecutive duplicate points at index %s", i + 1)); } multipath.lineTo(point.X(), point.Y()); } previousPoint = point; } OGCLineString linestring = new OGCLineString(multipath, 0, null); return serialize(linestring); }
Source:
<code>public void testEnglishLanguage() { WebElement webElement = browser.findElement(By.linkText("Take a Tour!")); webElement.click(); WindowFragment windowFragment = Console.withBrowser(browser).openedWindow(); if (windowFragment != null) { WebElement iFrame = browser.findElement(ByJQuery.selector("iframe.gwt-Frame")); WebElement content = browser.switchTo().frame(iFrame).findElement(By.tagName("body")); String text = content.findElement(By.className("text-1")).getText(); <START> Assert.assertTrue("Take a tour window doesn't contain English text (Enable, disable, and view the ...)", text.contains("Enable, disable, and view the")); <END> } }</code><technical_language>Is please add a reference upstream jira in assert message</technical_language>

Target:
public void testEnglishLanguage() { WebElement webElement = browser.findElement(By.linkText("Take a Tour!")); webElement.click(); WindowFragment windowFragment = Console.withBrowser(browser).openedWindow(); if (windowFragment != null) { WebElement iFrame = browser.findElement(ByJQuery.selector("iframe.gwt-Frame")); WebElement content = browser.switchTo().frame(iFrame).findElement(By.tagName("body")); String text = content.findElement(By.className("text-1")).getText(); Assert.assertTrue("Take a tour window doesn't contain English text (Enable, disable, and view the ...). Probably due to <LINK_0>", text.contains("Enable, disable, and view the")); } }
Source:
<code>public Map<String, NoteInfo> list(AuthenticationInfo subject) throws IOException { Map<String, NoteInfo> infos = new HashMap<>(); Document match = new Document("$match", new Document(Fields.IS_DIR, false)); Document graphLookup = new Document("$graphLookup" <START> , new Document("from", folderName) <END> .append("startWith", "$" + Fields.PID) .append("connectFromField", Fields.PID) .append("connectToField", Fields.ID) .append("as", "fullPath")); ArrayList<Document> list = Lists.newArrayList(match, graphLookup); AggregateIterable<Document> aggregate = folders.aggregate(list); for (Document document : aggregate) { String id = document.getString(Fields.ID); String name = document.getString(Fields.NAME); List<Document> fullPath = document.get("fullPath", List.class); StringBuilder sb = new StringBuilder(); for (Document pathNode : fullPath) { sb.append("/").append(pathNode.getString(Fields.NAME)); } String fullPathStr = sb.append("/").append(name).toString(); NoteInfo noteInfo = new NoteInfo(id, fullPathStr); infos.put(id, noteInfo); } return infos; }</code><technical_language>this format is a bit strange? consider , line above, indent .append</technical_language>

Target:
public Map<String, NoteInfo> list(AuthenticationInfo subject) throws IOException { LOG.debug("list repo."); Map<String, NoteInfo> infos = new HashMap<>(); Document match = new Document("$match", new Document(Fields.IS_DIR, false)); Document graphLookup = new Document("$graphLookup", new Document("from", folderName) .append("startWith", "$" + Fields.PID) .append("connectFromField", Fields.PID) .append("connectToField", Fields.ID) .append("as", Fields.FULL_PATH)); try (AutoLock autoLock = lock.lockForRead()) { ArrayList<Document> list = Lists.newArrayList(match, graphLookup); AggregateIterable<Document> aggregate = folders.aggregate(list); for (Document document : aggregate) { String id = document.getString(Fields.ID); String name = document.getString(Fields.NAME); List<Document> fullPath = document.get(Fields.FULL_PATH, List.class); StringBuilder sb = new StringBuilder(); for (Document pathNode : fullPath) { sb.append("/").append(pathNode.getString(Fields.NAME)); } String fullPathStr = sb.append("/").append(name).toString(); NoteInfo noteInfo = new NoteInfo(id, fullPathStr); infos.put(id, noteInfo); } } return infos; }
Source:
<code>public void updateNonValidSupportLevel() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); context.restoreAuthSystemState(); BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); bitstreamFormatRest.setSupportLevel("NONVALID SUPPORT LEVEL"); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) <START> .andExpect(status().isBadRequest()); <END> }</code><technical_language>double check changes occur. I recommend test changes valid (like a description change related unvalid support level) changes persisted</technical_language>

Target:
public void updateNonValidSupportLevel() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .withSupportLevel(BitstreamFormat.SUPPORTED) .build(); context.restoreAuthSystemState(); BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); bitstreamFormatRest.setSupportLevel("NONVALID SUPPORT LEVEL"); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.is( BitstreamFormatMatcher .matchBitstreamFormat(bitstreamFormat.getID(), bitstreamFormat.getMIMEType(), bitstreamFormat.getDescription(), bitstreamFormat.getShortDescription(), bitstreamFormatService .getSupportLevelText(bitstreamFormat)) ))); }
Source:
<code>public void testGetDeclaredFieldPrivate() throws NoSuchFieldException { exceptionGrabber.expect(NoSuchFieldException.class); Class<?> privateString = ReflectionUtil.getDeclaredField("private", TestClass.class); assertThat((privateString == String.class), is(true)); }</code><technical_language>fix this</technical_language>

Target:
public void testGetDeclaredFieldPrivate() throws NoSuchFieldException { exceptionGrabber.expect(NoSuchFieldException.class); ReflectionUtil.getDeclaredField("private", TestClass.class); }
Source:
<code>private String validateNewBulkBranchName(String newBranchName, Repository[] repositories) { for (Repository repo : repositories) { IStatus status = Utils.validateNewRefName(newBranchName, repo, Constants.R_HEADS, true); if (status.getException() != null) { Activator.handleStatus(status, false); } if (!status.isOK()) { <START> return status.getMessage(); <END> } } return null; }</code><technical_language>prefix repo name here, user in repo branch exists already. Anyway, if branch exists in some repos, simply create check out</technical_language>

Target:
private String validateNewBulkBranchName(String newBranchName, Repository[] repositories) { for (Repository repo : repositories) { IStatus status = Utils.validateNewRefName(newBranchName, repo, Constants.R_HEADS, true); if (status.getException() != null) { Activator.handleStatus(status, false); } if (!status.isOK()) { return Activator.getDefault().getRepositoryUtil() .getRepositoryName(repo) + ": " + status.getMessage(); } } return null; }
Source:
<code>public void taskDataUpdated(TaskDataManagerEvent event) { if (event.getToken() != null && event.getTaskDataChanged()) { recordNotificationText(event); if <START> (isEnabled()) { <END> return; } if (PresentationFilter.getInstance().isInVisibleQuery(event.getTask())) { AbstractRepositoryConnectorUi connectorUi = TasksUi .getRepositoryConnectorUi(event.getTaskData().getConnectorKind()); if (!connectorUi.hasCustomNotifications()) { TaskListNotification notification = getNotification(event.getTask(), event.getToken()); if (notification != null) { synchronized (notificationQueue) { if (enabled) { notificationQueue.add(notification); } } } } } } }</code><technical_language>this is</technical_language>

Target:
public void taskDataUpdated(TaskDataManagerEvent event) { if (event.getToken() != null && event.getTaskDataChanged()) { recordNotificationText(event); if (isEnabled()) { if (PresentationFilter.getInstance().isInVisibleQuery(event.getTask())) { AbstractRepositoryConnectorUi connectorUi = TasksUi .getRepositoryConnectorUi(event.getTaskData().getConnectorKind()); if (!connectorUi.hasCustomNotifications()) { TaskListNotification notification = getNotification(event.getTask(), event.getToken()); if (notification != null) { synchronized (notificationQueue) { if (enabled) { notificationQueue.add(notification); } } } } } } } }
Source:
<code>protected void handleModelOpenUri(BinaryResource res, IOpenUriAction openUriAction) { String filename = ObjectUtility.nvl(res.getFilename(), "binaryData"); String filenameWithCounter = filename; long counter = RESOURCE_COUNTER.getAndIncrement(); <START> filenameWithCounter = counter + "/" + filenameWithCounter; <END> BinaryResourceHolder holder = new BinaryResourceHolder(res); if (openUriAction == OpenUriAction.DOWNLOAD) { holder.addHttpResponseInterceptor(new DownloadHttpResponseInterceptor(res.getFilename())); } m_downloads.put(filenameWithCounter, holder, openUriAction); String downloadUrl = BinaryResourceUrlUtility.createDynamicAdapterResourceUrl(this, filenameWithCounter); handleModelOpenUri(downloadUrl, openUriAction); }</code><technical_language>define variable here: String filenameWithCounter = counter + "/" + filename;</technical_language>

Target:
protected void handleModelOpenUri(BinaryResource res, IOpenUriAction openUriAction) { long counter = RESOURCE_COUNTER.getAndIncrement(); String filenameWithCounter = counter + "/" + ObjectUtility.nvl(res.getFilename(), "binaryData"); BinaryResourceHolder holder = new BinaryResourceHolder(res); if (openUriAction == OpenUriAction.DOWNLOAD) { holder.addHttpResponseInterceptor(new DownloadHttpResponseInterceptor(res.getFilename())); } m_downloads.put(filenameWithCounter, holder, openUriAction); String downloadUrl = BinaryResourceUrlUtility.createDynamicAdapterResourceUrl(this, filenameWithCounter); handleModelOpenUri(downloadUrl, openUriAction); }
Source:
<code>boolean attackUrl() { <START> String urlStr = this.getUrlField().getSelectedItem().toString(); <END> URL url; try { url = new URL(urlStr); new URI(urlStr, true); } catch (Exception e) { getExtensionQuickStart().getView() .showWarningDialog(Constant.messages.getString("quickstart.url.warning.invalid")); this.getUrlField().requestFocusInWindow(); return false; } this.getExtensionQuickStart().getQuickStartParam().addRecentUrl(urlStr); getAttackButton().setEnabled(false); getStopButton().setEnabled(true); getExtensionQuickStart().attack(url, spiderCheckBox.isSelected()); return true; }</code><technical_language>This needs check for null (no item selected): 211221 [AWT-EventQueue-1] ERROR org.zaproxy.zap.ZAP$UncaughtExceptionLogger - Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException org.zaproxy.zap.extension.quickstart.AttackPanel.attackUrl(AttackPanel.java:324) org.zaproxy.zap.extension.quickstart.AttackPanel$3.actionPerformed(AttackPanel.java:295)</technical_language>

Target:
boolean attackUrl() { Object item = this.getUrlField().getSelectedItem(); if (item == null || DEFAULT_VALUE_URL_FIELD.equals(item.toString())) { getExtensionQuickStart().getView() .showWarningDialog(Constant.messages.getString("quickstart.url.warning.invalid")); this.getUrlField().requestFocusInWindow(); return false; } String urlStr = item.toString(); URL url; try { url = new URL(urlStr); new URI(urlStr, true); } catch (Exception e) { getExtensionQuickStart().getView() .showWarningDialog(Constant.messages.getString("quickstart.url.warning.invalid")); this.getUrlField().requestFocusInWindow(); return false; } this.getExtensionQuickStart().getQuickStartParam().addRecentUrl(urlStr); getAttackButton().setEnabled(false); getStopButton().setEnabled(true); getExtensionQuickStart().attack(url, spiderCheckBox.isSelected()); return true; }
Source:
<code>private ClientCache initClient() { try { clientCache = new ClientCacheFactory().addPoolLocator(getLocatorHost(), getLocatorPort()).create(); } catch (CacheClosedException ex) { <START> LOG.info("error initiating client ", ex); <END> } return clientCache; }</code><technical_language>Throw exception instead of logging</technical_language>

Target:
private ClientCache initClient() { try { clientCache = new ClientCacheFactory().addPoolLocator(getLocatorHost(), getLocatorPort()).create(); } catch (CacheClosedException ex) { throw new RuntimeException("Exception while creating cache", ex); } return clientCache; }
Source:
<code>private Topic resolveOrCreateDbpediaTopic(String title, Topic.Type topicType, String namespace, String value, Publisher publisher) { Maybe<Topic> resolved = topicStore.topicFor(namespace, value); if (resolved.hasValue()) { Topic topic = resolved.requireValue(); topic.setPublisher(publisher); topic.setTitle(title); topic.setType(topicType); topicStore.write(topic); return topic; } throw new IllegalStateException(String.format( <START> "Topic store failed to createDefault Topic with namespace %s and value %s", <END> namespace, value )); }</code><technical_language>Rename error</technical_language>

Target:
private Topic resolveOrCreateDbpediaTopic(String title, Topic.Type topicType, String namespace, String value, Publisher publisher) { Maybe<Topic> resolved = topicStore.topicFor(namespace, value); if (resolved.hasValue()) { Topic topic = resolved.requireValue(); topic.setPublisher(publisher); topic.setTitle(title); topic.setType(topicType); topicStore.write(topic); return topic; } throw new IllegalStateException(String.format( "Topic store failed to create Topic with namespace %s and value %s", namespace, value )); }
Source:
<code>public void testResetWhenLongSessionTimeoutConfiguredWithForceOption() throws Exception { appID = testId + "-with-force-option"; streamsConfig.put(StreamsConfig.APPLICATION_ID_CONFIG, appID); <START> streamsConfig.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "" + STREAMS_CONSUMER_TIMEOUT * 100); <END> streams = new KafkaStreams(setupTopologyWithoutIntermediateUserTopic(), streamsConfig); streams.start(); final List<KeyValue<Long, Long>> result = IntegrationTestUtils.waitUntilMinKeyValueRecordsReceived(resultConsumerConfig, OUTPUT_TOPIC, 10); streams.close(); streams = new KafkaStreams(setupTopologyWithoutIntermediateUserTopic(), streamsConfig); streams.cleanUp(); int exitCode = tryCleanGlobal(false, null, null); Assert.assertEquals(1, exitCode); exitCode = tryCleanGlobal(false, "--force", null); Assert.assertEquals(0, exitCode); waitForEmptyConsumerGroup(adminClient, appID, TIMEOUT_MULTIPLIER * CLEANUP_CONSUMER_TIMEOUT); assertInternalTopicsGotDeleted(null); streams.start(); final List<KeyValue<Long, Long>> resultRerun = IntegrationTestUtils.waitUntilMinKeyValueRecordsReceived(resultConsumerConfig, OUTPUT_TOPIC, 10); streams.close(); assertThat(resultRerun, equalTo(result)); tryCleanGlobal(false, "--force", null); }</code><technical_language>"" + mean</technical_language>

Target:
public void testResetWhenLongSessionTimeoutConfiguredWithForceOption() throws Exception { appID = testId + "-with-force-option"; streamsConfig.put(StreamsConfig.APPLICATION_ID_CONFIG, appID); streamsConfig.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "" + STREAMS_CONSUMER_TIMEOUT * 100); streams = new KafkaStreams(setupTopologyWithoutIntermediateUserTopic(), streamsConfig); streams.start(); final List<KeyValue<Long, Long>> result = IntegrationTestUtils.waitUntilMinKeyValueRecordsReceived(resultConsumerConfig, OUTPUT_TOPIC, 10); streams.close(); streams = new KafkaStreams(setupTopologyWithoutIntermediateUserTopic(), streamsConfig); streams.cleanUp(); final boolean cleanResult = tryCleanGlobal(false, null, null); Assert.assertEquals(false, cleanResult); cleanGlobal(false, "--force", null); assertThat("Group is not empty after cleanGlobal", isEmptyConsumerGroup(adminClient, appID)); assertInternalTopicsGotDeleted(null); streams.start(); final List<KeyValue<Long, Long>> resultRerun = IntegrationTestUtils.waitUntilMinKeyValueRecordsReceived(resultConsumerConfig, OUTPUT_TOPIC, 10); streams.close(); assertThat(resultRerun, equalTo(result)); cleanGlobal(false, "--force", null); }
Source:
<code>static boolean checkStartObject(JsonParser parser, boolean shouldThrow) throws IOException { try { JsonToken currentToken = parser.currentToken(); if (currentToken == null) currentToken = parser.nextToken(); if (currentToken == JsonToken.START_OBJECT) return true; if (shouldThrow) { throw new IllegalArgumentException("Expected start object, was " + currentToken); } return false; <START> } catch (JsonParseException e) { END> if (shouldThrow) throw e; return false; } }</code><technical_language>catch Throwable? methods throw, shouldThrow is false here, easy end a hang exception type changed</technical_language>

Target:
static boolean checkStartObject(JsonParser parser, boolean shouldThrow) throws IOException { try { JsonToken currentToken = parser.currentToken(); if (currentToken == null) currentToken = parser.nextToken(); if (currentToken == JsonToken.START_OBJECT) return true; if (shouldThrow) { throw new IllegalArgumentException("Expected start object, was " + currentToken); } return false; } catch (Throwable e) { if (shouldThrow) throw e; return false; } }
Source:
<code>public CleanupTaskProvisioner(TopLevelItem tli, List<Node> nodes) { this.tli = tli; this.nodes = new LinkedList<>(nodes); if (threadLimit > 0) { LOGGER.log(Level.INFO, "ThreadLimit Loaded from Environment : {0}", threadLimit); } <START> if (threadLimit > 0) { LOGGER.log(Level.INFO, "ThreadLimit Loaded from Environment : {0}", threadLimit); } if (threadLimit > 0) { LOGGER.log(Level.INFO, "ThreadLimit Loaded from Environment : {0}", threadLimit); } if (threadLimit > 0) { LOGGER.log(Level.INFO, "ThreadLimit Loaded from Environment : {0}", threadLimit); } if (threadLimit > 0) { LOGGER.log(Level.INFO, "ThreadLimit Loaded from Environment : {0}", threadLimit); } <END> }</code><technical_language>suggestion</technical_language>

Target:
public CleanupTaskProvisioner(TopLevelItem tli, List<Node> nodes) { this.tli = tli; this.nodes = new LinkedList<>(nodes); if (threadLimit > 0) { LOGGER.log(Level.INFO, "ThreadLimit Loaded from Environment : {0}", threadLimit); } }
Source:
<code>private List<Map<String, String>> getVolumesToDisconnect(VirtualMachine vm) { List<Map<String, String>> volumesToDisconnect = new ArrayList<>(); List<VolumeVO> volumes = _volsDao.findByInstance(vm.getId()); <START> if (volumes != null) { <END> for (VolumeVO volume : volumes) { StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); if (storagePool != null && storagePool.isManaged()) { Map<String, String> info = new HashMap<>(3); info.put(DiskTO.STORAGE_HOST, storagePool.getHostAddress()); info.put(DiskTO.STORAGE_PORT, String.valueOf(storagePool.getPort())); info.put(DiskTO.IQN, volume.get_iScsiName()); volumesToDisconnect.add(info); } } } return volumesToDisconnect; }</code><technical_language>do same, if volumes is empty, return right empty volumesToDisconnect, removing next operations a IF statement</technical_language>

Target:
private List<Map<String, String>> getVolumesToDisconnect(VirtualMachine vm) { List<Map<String, String>> volumesToDisconnect = new ArrayList<>(); List<VolumeVO> volumes = _volsDao.findByInstance(vm.getId()); if (CollectionUtils.isEmpty(volumes)) { return volumesToDisconnect; } for (VolumeVO volume : volumes) { StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); if (storagePool != null && storagePool.isManaged()) { Map<String, String> info = new HashMap<>(3); info.put(DiskTO.STORAGE_HOST, storagePool.getHostAddress()); info.put(DiskTO.STORAGE_PORT, String.valueOf(storagePool.getPort())); info.put(DiskTO.IQN, volume.get_iScsiName()); volumesToDisconnect.add(info); } } return volumesToDisconnect; }
Source:
<code>public RebalanceProtocol rebalanceProtocol() { final String upgradeFrom = streamsConfig.getString(StreamsConfig.UPGRADE_FROM_CONFIG); if (upgradeFrom != null) { switch (upgradeFrom) { case StreamsConfig.UPGRADE_FROM_0100: case StreamsConfig.UPGRADE_FROM_0101: case StreamsConfig.UPGRADE_FROM_0102: case StreamsConfig.UPGRADE_FROM_0110: case StreamsConfig.UPGRADE_FROM_10: case StreamsConfig.UPGRADE_FROM_11: case StreamsConfig.UPGRADE_FROM_20: case StreamsConfig.UPGRADE_FROM_21: case StreamsConfig.UPGRADE_FROM_22: case StreamsConfig.UPGRADE_FROM_23: log.info("Turning off cooperative rebalancing for upgrade from {}.x", upgradeFrom); return RebalanceProtocol.EAGER; default: throw new IllegalArgumentException("Unknown configuration value for parameter 'upgrade.from': " + upgradeFrom); } } <START> return StreamsPartitionAssignor.DEFAULT_REBALANCE_PROTOCOL; <END> }</code><technical_language>This a weird me. this method's job is pick protocol, is deferring StreamsPartitionAssignor's constant pick protocol. This is usage of field. inline it, in place protocol is get used</technical_language>

Target:
public RebalanceProtocol rebalanceProtocol() { final String upgradeFrom = streamsConfig.getString(StreamsConfig.UPGRADE_FROM_CONFIG); if (upgradeFrom != null) { switch (upgradeFrom) { case StreamsConfig.UPGRADE_FROM_0100: case StreamsConfig.UPGRADE_FROM_0101: case StreamsConfig.UPGRADE_FROM_0102: case StreamsConfig.UPGRADE_FROM_0110: case StreamsConfig.UPGRADE_FROM_10: case StreamsConfig.UPGRADE_FROM_11: case StreamsConfig.UPGRADE_FROM_20: case StreamsConfig.UPGRADE_FROM_21: case StreamsConfig.UPGRADE_FROM_22: case StreamsConfig.UPGRADE_FROM_23: log.info("Turning off cooperative rebalancing for upgrade from {}.x", upgradeFrom); return RebalanceProtocol.EAGER; default: throw new IllegalArgumentException("Unknown configuration value for parameter 'upgrade.from': " + upgradeFrom); } } return RebalanceProtocol.EAGER; }
Source:
<code>private boolean isAbsolutePath(String uri) { <START> return !(uri.startsWith("jndi") | uri.startsWith("file")); <END> }</code><technical_language>This is a bitwise ... this a boolean (||)</technical_language>

Target:
private boolean isAbsolutePath(String uri) { return !(uri.startsWith("jndi") || uri.startsWith("file")); }
Source:
<code>private static boolean isUserNameOrRoomNameValid(Context context, EditText editText, String text, boolean isName) { int counterSymbols = 0; char[] fullNameTextToCharArray = text.toCharArray(); char[] symbols = {'<', '>', ';', '^'}; <START> for (int i = 0; i < fullNameTextToCharArray.length; i++) { <END> for (int j = 0; j < symbols.length; j++) { if (fullNameTextToCharArray[i] == symbols[j]) { counterSymbols++; break; } } } if (!text.isEmpty()) { if (text.length() < 3) { editText.setError(String.format( context.getString(R.string.error_name_must_be_more_than_2_characters_from_app), context.getString(isName ? R.string.field_name_user_name : R.string.field_name_chat_room_name))); return false; } else if (text.length() > 50){ editText.setError(String.format( context.getString(R.string.error_is_too_long_maximum_is_50_characters_from_app), context.getString(isName ? R.string.field_name_user_name : R.string.field_name_chat_room_name))); return false; } else if (counterSymbols != 0) { editText.setError(String.format( context.getString(R.string.error_name_must_do_not_contain_special_characters_from_app), context.getString(isName ? R.string.field_name_user_name : R.string.field_name_chat_room_name))); return false; } else { return true; } } else { editText.setError(String.format( context.getString(R.string.dlg_not_fullname_field_entered), context.getString(isName ? R.string.field_name_user_name : R.string.field_name_chat_room_name))); return false; } }</code><technical_language>regEx</technical_language>

Target:
private static boolean isUserNameOrRoomNameValid(Context context, EditText editText, String text, boolean isName) { boolean isCorrect; Pattern p = Pattern.compile("\\A[^><;]{3,50}\\z"); Matcher m = p.matcher(text); isCorrect = m.matches(); if (!isCorrect) { editText.setError(String.format( context.getString(R.string.error_name_must_do_not_contain_special_characters_from_app), context.getString(isName ? R.string.field_name_user_name : R.string.field_name_chat_room_name))); return false; } else { return true; } }
Source:
<code>private DefaultEdge unpackEdge(final Edge<V> input) { if (!(input instanceof JGraphTEdgeAdapter<?>)) { <START> throw new IllegalArgumentException("Wrong edge type!"); <END> } JGraphTEdgeAdapter<V> edge = (JGraphTEdgeAdapter<V>) input; return edge.getInternalEdge(); }</code><technical_language>exclamation marks</technical_language>

Target:
private DefaultEdge unpackEdge(final Edge<V> input) { if (!(input instanceof JGraphTEdgeAdapter<?>)) { throw new IllegalArgumentException("Wrong edge type."); } JGraphTEdgeAdapter<V> edge = (JGraphTEdgeAdapter<V>) input; return edge.getInternalEdge(); }
Source:
<code><START> public String toString() { <END> return "Pill: " + this.pillID + ", Account:" + this.accountId + ", Date: " + this.dateHourUTC + ", Offset: " + this.timeZoneOffset + ", Score: " + this.totalHourScore + ", Agitation_Num: " + this.agitationNum + ", Agitation_Tot: " + this.agitationTot; }</code><technical_language>Guava Objects.ToStringHelper() nicer</technical_language>

Target:
public String toString() { return Objects.toStringHelper(SleepScore.class) .add("pill", pillID) .add("account", accountId) .add("date_bucket_utc", dateBucketUTC) .add("tz_offset", timeZoneOffset) .add("score", this.bucketScore) .add("agitation_num", agitationNum) .add("agitation_tot", agitationTot) .toString(); }
Source:
<code>private List<String> formatChatMessage(final LogRecord record) { <START> return Arrays.asList(getFormatter().format(record).trim().split("\n")); <END> }</code><technical_language>I this error-prone violation String#split behaves weird for inputs</technical_language>

Target:
private List<String> formatChatMessage(final LogRecord record) { return Arrays.asList(getFormatter().format(record).trim().split("\\n")); }
Source:
<code>public static Flux<ByteBuffer> convertStreamToByteBuffer(InputStream data, int blockSize) { final long length; try { length = data.available(); } catch (IOException e) { <START> throw LOGGER.logExceptionAsError(new RuntimeException("I/O errors occurs. Error deatils: " <END> + e.getMessage())); } return convertStreamToByteBuffer(data, length, blockSize); }</code><technical_language>typo: details tense: occurred "I/O errors occurred. Error details:"</technical_language>

Target:
public static Flux<ByteBuffer> convertStreamToByteBuffer(InputStream data, int blockSize) { Pair pair = new Pair(); return Flux.just(true) .repeat() .map(ignore -> { byte[] buffer = new byte[blockSize]; try { int numBytes = data.read(buffer); if (numBytes > 0) { return pair.buffer(ByteBuffer.wrap(buffer, 0, numBytes)).readBytes(numBytes); } else { return pair.buffer(null).readBytes(numBytes); } } catch (IOException e) { throw LOGGER.logExceptionAsError(new RuntimeException("I/O errors occurs. Error details: " + e.getMessage())); } }) .takeUntil(p -> p.readBytes() == -1) .filter(p -> p.readBytes() > 0) .map(Pair::buffer); }
Source:
<code>public void updateHandler_queryString() { final String oldValue = "foo"; <START> final String newValue = "foo bar"; <END> Response response = db.save(new Foo(null, oldValue)); String query = "field=title&value=" + newValue; String output = db.invokeUpdateHandler("example/example_update", response.getId(), query); Foo foo = db.find(Foo.class, response.getId()); assertNotNull(output); assertEquals(foo.getTitle(), newValue); }</code><technical_language>in update master, wrong version of this line setting newValue taken</technical_language>

Target:
public void updateHandler_queryString() { final String oldValue = "foo"; final String newValue = "foo bar+plus=equals&ampersand"; Response response = db.save(new Foo(null, oldValue)); Params params = new Params() .addParam("field", "title") .addParam("value", newValue); String output = db.invokeUpdateHandler("example/example_update", response.getId(), params); Foo foo = db.find(Foo.class, response.getId()); assertNotNull(output); assertEquals(foo.getTitle(), newValue); }
Source:
<code>public Diamond3iIterable.Builder start(int start) { <START> this.startDistance = start + 1; <END> return this; }</code><technical_language>+/- 1 confusion: suggestion this.startDistance = start; one</technical_language>

Target:
public Diamond3iIterable.Builder start(int start) { this.startDistance = start; return this; }