auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String postText(String recordId, String title, String body, String resultsUrl) throws IOException, XMLStreamException, FactoryConfigurationError { establishSession(); <START> String pid = recordId == null || recordId.length() == 0 ? session.userId : recordId; <END> try { return createSoapFeedPost(pid, title, resultsUrl, body); } catch (SoapFaultException ex) { if (ex.getFaultCode().toLowerCase().contains("session")) { SessionCache.get().revoke(credentials); return postText(recordId, title, resultsUrl, body); } throw ex; } }</code><technical_language>want trim recordId here</technical_language>

Target:
public String postText(String recordId, String title, String body, String resultsUrl) throws IOException, XMLStreamException, FactoryConfigurationError { establishSession(); String trimmedRecordId = StringUtils.trim(recordId); String recordIdForPost = StringUtils.isEmpty(trimmedRecordId) ? session.userId : trimmedRecordId; try { return createSoapFeedPost(recordIdForPost, title, resultsUrl, body); } catch (SoapFaultException ex) { if (ex.getFaultCode().toLowerCase().contains("session")) { SessionCache.get().revoke(credentials); return postText(recordId, title, resultsUrl, body); } throw ex; } }
Source:
<code>private String parseErrorMessage(List<String> messages) { for(String messgae: messages) { if (messgae.startsWith("$message")) { <START> return messgae.substring(9); <END> } } return ""; }</code><technical_language>chance this more robust? :)</technical_language>

Target:
private String parseErrorMessage(List<String> messages) { for(String message: messages) { Matcher matcher = msgRegEx.matcher(message); if (matcher.matches()) { return matcher.group("error"); } } return ""; }
Source:
<code><START> public List<Entry> findMyEntries(long userId) { <END> return list(namedQuery("io.dockstore.webservice.core." + typeOfT.getSimpleName() + ".getEntriesByUserId").setParameter("userId", userId)); }</code><technical_language>I this return a List<T> intstead of List<Entry>. need do casts in UserResource</technical_language>

Target:
public List<T> findMyEntries(long userId) { return list(namedQuery("io.dockstore.webservice.core." + typeOfT.getSimpleName() + ".getEntriesByUserId").setParameter("userId", userId)); }
Source:
<code>public boolean equals(Object o) { <START> if (o instanceof CustomMethods == false) { <END> return reverseEquals; } CustomMethods other = (CustomMethods) o; if (isValid() == other.isValid() && other.name.equals(name)) { return !reverseEquals; } else { return reverseEquals; } }</code><technical_language>shorter (!(o instanceof CustomMethods))</technical_language>

Target:
public boolean equals(Object o) { if (!(o instanceof CustomMethods)) { return reverseEquals; } CustomMethods other = (CustomMethods) o; if (isValid() == other.isValid() && other.name.equals(name)) { return !reverseEquals; } else { return reverseEquals; } }
Source:
<code>public void placeRadiologyOrder_shouldCreateRadiologyOrderEncounterWithOrdererAndAttachedToExistingActiveVisitIfPatientHasActiveVisit() throws Exception { RadiologyOrder radiologyOrder = getUnsavedRadiologyOrder(); radiologyOrder.setPatient(patientService.getPatient(PATIENT_ID_WITH_NO_RADIOLOGY_ORDER_AND_NO_EXISTIG_ENCOUNTER_AND_ACTIVE_VISIT)); assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()), is(empty())); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()), is(not(empty()))); assertThat(radiologyOrder.getEncounter(), is(nullValue())); radiologyOrder = radiologyService.placeRadiologyOrder(radiologyOrder); Encounter encounter = radiologyOrder.getEncounter(); assertThat(encounter, is(not(nullValue()))); assertThat(encounter.getEncounterProviders() .size(), is(1)); Iterator<EncounterProvider> encounterProviderIterator = encounter.getEncounterProviders() .iterator(); <START> while (encounterProviderIterator.hasNext()) { <END> EncounterProvider encounterProvider = encounterProviderIterator.next(); assertThat(encounterProvider.getProvider(), is(radiologyOrder.getOrderer())); } assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(orderService.getAllOrdersByPatient(radiologyOrder.getPatient()) .size(), is(1)); }</code><technical_language>@bgeVam do need loop, size is 1. get(0)</technical_language>

Target:
public void placeRadiologyOrder_shouldCreateRadiologyOrderEncounterWithOrdererAndAttachedToExistingActiveVisitIfPatientHasActiveVisit() throws Exception { RadiologyOrder radiologyOrder = getUnsavedRadiologyOrder(); radiologyOrder.setPatient(patientService.getPatient(PATIENT_ID_WITH_NO_RADIOLOGY_ORDER_AND_NO_EXISTIG_ENCOUNTER_AND_ACTIVE_VISIT)); assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()), is(empty())); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()), is(not(empty()))); Visit preExistingVisit = visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()) .get(0); assertThat(radiologyOrder.getEncounter(), is(nullValue())); radiologyOrder = radiologyService.placeRadiologyOrder(radiologyOrder); Encounter encounter = radiologyOrder.getEncounter(); assertThat(encounter, is(not(nullValue()))); assertThat(encounter.getEncounterProviders() .size(), is(1)); assertThat(encounter.getEncounterProviders() .iterator() .next() .getProvider(), is(radiologyOrder.getOrderer())); assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()) .get(0), is(preExistingVisit)); assertThat(orderService.getAllOrdersByPatient(radiologyOrder.getPatient()) .size(), is(1)); }
Source:
<code>private void populateSampleClasses(ModelMap model) throws IOException { List<SampleClass> sampleClasses = new ArrayList<>(); List<SampleClass> tissueClasses = new ArrayList<>(); for (SampleClass sc : sampleClassService.getAll()) { if (SampleTissue.CATEGORY_NAME.equals(sc.getSampleCategory())) { tissueClasses.add(sc); } else if (SampleStock.CATEGORY_NAME.equals(sc.getSampleCategory())) { <START> tissueClasses.add(sc); <END> } } Collections.sort(sampleClasses, new Comparator<SampleClass>() { @Override public int compare(SampleClass o1, SampleClass o2) { return o1.getAlias().compareTo(o2.getAlias()); } }); model.put("sampleClasses", sampleClasses); model.put("tissueClasses", tissueClasses); }</code><technical_language>Stock classes added tissueClasses, non-stock/tissue classes removed sampleClasses (as happening before). sampleClasses = SampleClasses received (created /sample/new) tissueClasses = Tissue classes (used for defining ghost tissue if a stock is created)</technical_language>

Target:
private void populateSampleClasses(ModelMap model) throws IOException { List<SampleClass> sampleClasses = new ArrayList<>(); List<SampleClass> tissueClasses = new ArrayList<>(); for (SampleClass sc : sampleClassService.getAll()) { if (SampleTissue.CATEGORY_NAME.equals(sc.getSampleCategory())) { tissueClasses.add(sc); sampleClasses.add(sc); } else if (SampleStock.CATEGORY_NAME.equals(sc.getSampleCategory())) { sampleClasses.add(sc); } } Collections.sort(sampleClasses, SAMPLECLASS_ALIAS); Collections.sort(tissueClasses, SAMPLECLASS_ALIAS); model.put("sampleClasses", sampleClasses); model.put("tissueClasses", tissueClasses); }
Source:
<code>private byte[] idBufferBlob(final Entry e) { try { final InputStream raw = e.openInputStream(); if (raw == null) return zeroid; try { initializeDigestAndReadBuffer(); contentDigest.reset(); contentDigest.update(hblob); contentDigest.update((byte) ' '); final boolean canonicalizeEols; if (canonicalizeEolsForIdCalculation) { final InputStream is = e.openInputStream(); try { canonicalizeEols = !RawText.isBinary(is); } finally { is.close(); } } <START> else { <END> canonicalizeEols = false; } final long blobLength; if (!canonicalizeEols) { blobLength = e.getLength(); } else { final InputStream is = e.openInputStream(); try { blobLength = determineCanonicalizedLength(is); } finally { is.close(); } } long sz = blobLength; if (sz == 0) { contentDigest.update((byte) '0'); } else { final int bufn = contentReadBuffer.length; int p = bufn; do { contentReadBuffer[--p] = digits[(int) (sz % 10)]; sz /= 10; } while (sz > 0); contentDigest.update(contentReadBuffer, p, bufn - p); } contentDigest.update((byte) 0); final InputStream is = canonicalizeEols ? new EolCanonicalizingInputStream(raw) : raw; for (;;) { final int r = is.read(contentReadBuffer); if (r <= 0) break; contentDigest.update(contentReadBuffer, 0, r); sz += r; } if (sz != blobLength) return zeroid; return contentDigest.digest(); } finally { try { raw.close(); } catch (IOException err2) { } } } catch (IOException err) { return zeroid; } }</code><technical_language>Style-nit: cuddle else line closing }</technical_language>

Target:
private byte[] idBufferBlob(final Entry e) { try { final InputStream is = e.openInputStream(); if (is == null) return zeroid; try { initializeDigestAndReadBuffer(); final long length = e.getLength(); if (!options.isAutocrlf()) return calculateHash(is, length); if (length <= MAXIMUM_FILE_SIZE_TO_READ_FULLY) { final byte[] bytes = IO.readFully(is, (int) length); if (RawText.isBinary(new ByteArrayInputStream(bytes))) return calculateHash(new ByteArrayInputStream(bytes), length); final long canonicalLength = determineCanonicalizedLength(new ByteArrayInputStream( bytes)); return calculateHash(new EolCanonicalizingInputStream( new ByteArrayInputStream(bytes)), canonicalLength); } final InputStream binaryIs = e.openInputStream(); try { if (RawText.isBinary(binaryIs)) return calculateHash(is, length); } finally { binaryIs.close(); } final long canonicalLength; final InputStream lengthIs = e.openInputStream(); try { canonicalLength = determineCanonicalizedLength(lengthIs); } finally { lengthIs.close(); } return calculateHash(new EolCanonicalizingInputStream(is), canonicalLength); } finally { try { is.close(); } catch (IOException err2) { } } } catch (IOException err) { return zeroid; } }
Source:
<code>protected void linkToCatchBlocks(Block block, List<Block> catches) { if (block.exitBlock != null && block.exitBlock.isFinallyBlock) { <START> for (Block catchBlock : catches) { <END> block.exitBlock.addSuccessor(catchBlock); } } else { for (Block catchBlock : catches) { block.addSuccessor(catchBlock); } } }</code><technical_language>Matter of style, I choose block if loop for add successors</technical_language>

Target:
protected void linkToCatchBlocks(Block block, List<Block> catches) { Block blockForSuccessor = block; if (block.exitBlock != null && block.exitBlock.isFinallyBlock) { blockForSuccessor = block.exitBlock; } for (Block catchBlock : catches) { blockForSuccessor.addSuccessor(catchBlock); } }
Source:
<code>public void createContainerWithPortBindings() throws DockerException { <START> int baseport = dockerRule.getKind().equals("jersey")? 11000: 12000; <END> ExposedPort tcp22 = ExposedPort.tcp(22); ExposedPort tcp23 = ExposedPort.tcp(23); Ports portBindings = new Ports(); portBindings.bind(tcp22, Binding.bindPort(baseport + 22)); portBindings.bind(tcp23, Binding.bindPort(baseport + 23)); portBindings.bind(tcp23, Binding.bindPort(baseport + 24)); CreateContainerResponse container = dockerRule.getClient().createContainerCmd(DEFAULT_IMAGE).withCmd("true") .withExposedPorts(tcp22, tcp23).withPortBindings(portBindings).exec(); LOG.info("Created container {}", container.toString()); assertThat(container.getId(), not(isEmptyString())); InspectContainerResponse inspectContainerResponse = dockerRule.getClient().inspectContainerCmd(container.getId()).exec(); assertThat(Arrays.asList(inspectContainerResponse.getConfig().getExposedPorts()), contains(tcp22, tcp23)); assertThat(inspectContainerResponse.getHostConfig().getPortBindings().getBindings().get(tcp22)[0], is(equalTo(Binding.bindPort(baseport + 22)))); assertThat(inspectContainerResponse.getHostConfig().getPortBindings().getBindings().get(tcp23)[0], is(equalTo(Binding.bindPort(baseport + 23)))); assertThat(inspectContainerResponse.getHostConfig().getPortBindings().getBindings().get(tcp23)[1], is(equalTo(Binding.bindPort(baseport + 24)))); }</code><technical_language>getKind() is string value, test is parametrized enum, do easy getFactoryType() == JERSEY</technical_language>

Target:
public void createContainerWithPortBindings() throws DockerException { int baseport = getFactoryType() == FactoryType.JERSEY? 11000: 12000; ExposedPort tcp22 = ExposedPort.tcp(22); ExposedPort tcp23 = ExposedPort.tcp(23); Ports portBindings = new Ports(); portBindings.bind(tcp22, Binding.bindPort(baseport + 22)); portBindings.bind(tcp23, Binding.bindPort(baseport + 23)); portBindings.bind(tcp23, Binding.bindPort(baseport + 24)); CreateContainerResponse container = dockerRule.getClient().createContainerCmd(DEFAULT_IMAGE).withCmd("true") .withExposedPorts(tcp22, tcp23).withPortBindings(portBindings).exec(); LOG.info("Created container {}", container.toString()); assertThat(container.getId(), not(isEmptyString())); InspectContainerResponse inspectContainerResponse = dockerRule.getClient().inspectContainerCmd(container.getId()).exec(); assertThat(Arrays.asList(inspectContainerResponse.getConfig().getExposedPorts()), contains(tcp22, tcp23)); assertThat(inspectContainerResponse.getHostConfig().getPortBindings().getBindings().get(tcp22)[0], is(equalTo(Binding.bindPort(baseport + 22)))); assertThat(inspectContainerResponse.getHostConfig().getPortBindings().getBindings().get(tcp23)[0], is(equalTo(Binding.bindPort(baseport + 23)))); assertThat(inspectContainerResponse.getHostConfig().getPortBindings().getBindings().get(tcp23)[1], is(equalTo(Binding.bindPort(baseport + 24)))); }
Source:
<code>public String toString() { <START> return "Binary{" + length() + " bytes, " + Arrays.toString(getBytesUnsafe()) + "}"; <END> }</code><technical_language>This flag binary is reused</technical_language>

Target:
public String toString() { return "Binary{" + length() + (isBackingBytesReused ? " reused": " constant") + " bytes, " + Arrays.toString(getBytesUnsafe()) + "}"; }
Source:
<code>public boolean isActive() { <START> return disabled == false; <END> }</code><technical_language>Nitpicking this change - this antipattern</technical_language>

Target:
public boolean isActive() { return !disabled; }
Source:
<code>private void addStorageResource() { String storageAccountName = name.replaceAll("[^A-Za-z0-9 ]", "") + "stor"; String storageName = template.getImage().getName(); <START> if (storageName.substring(0, CUSTOM_IMAGE_PREFIX.length()).equals(CUSTOM_IMAGE_PREFIX)) { <END> storageAccountName = storageName.substring(CUSTOM_IMAGE_PREFIX.length()); } variables.put("storageAccountName", storageAccountName); ResourceDefinition storageAccount = ResourceDefinition.builder() .name("[variables('storageAccountName')]") .type("Microsoft.Storage/storageAccounts") .location(location) .apiVersion(STORAGE_API_VERSION) .properties( StorageServiceProperties.builder() .accountType(StorageService.AccountType.Standard_LRS) .build() ) .build(); resources.add(storageAccount); }</code><technical_language>startsWith</technical_language>

Target:
private void addStorageResource() { String storageAccountName = name.replaceAll("[^A-Za-z0-9 ]", "") + "stor"; String storageName = template.getImage().getName(); if (storageName.startsWith(CUSTOM_IMAGE_PREFIX)) { storageAccountName = storageName.substring(CUSTOM_IMAGE_PREFIX.length()); } variables.put("storageAccountName", storageAccountName); ResourceDefinition storageAccount = ResourceDefinition.builder() .name("[variables('storageAccountName')]") .type("Microsoft.Storage/storageAccounts") .location(location) .apiVersion(STORAGE_API_VERSION) .properties( StorageServiceProperties.builder() .accountType(StorageService.AccountType.Standard_LRS) .build() ) .build(); resources.add(storageAccount); }
Source:
<code>public boolean isItemVisible(VirtualItem item) { for (VirtualItem element : fSelection) { <START> VirtualItem selectionItem = element; <END> while (selectionItem != null) { if (item.equals(selectionItem)) { return true; } selectionItem = selectionItem.getParent(); } } return false; }</code><technical_language>loopvar</technical_language>

Target:
public boolean isItemVisible(VirtualItem item) { for (VirtualItem selectionItem : fSelection) { while (selectionItem != null) { if (item.equals(selectionItem)) { return true; } selectionItem = selectionItem.getParent(); } } return false; }
Source:
<code>private void checkSecureCall(MethodInvocationTree mit) { if (isSetSecureCall(mit) && mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { ExpressionTree methodObject = ((MemberSelectExpressionTree) mit.methodSelect()).expression(); Boolean secureArgument = getBooleanValue(mit.arguments().get(0)); <START> Boolean isFalse = secureArgument != null && !secureArgument; <END> if (methodObject.is(Tree.Kind.IDENTIFIER)) { IdentifierTree identifierTree = (IdentifierTree) methodObject; if (!isFalse) { unsecuredCookies.remove(identifierTree.symbol()); } else if (identifierTree.symbol().owner().isMethodSymbol()) { unsecuredCookies.add((Symbol.VariableSymbol) identifierTree.symbol()); } } else if (isFalse) { unsecuredSetters.add(mit); } } }</code><technical_language>isFalse a type "boolean" "null"</technical_language>

Target:
private void checkSecureCall(MethodInvocationTree mit) { if (isSetSecureCall(mit) && mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { ExpressionTree methodObject = ((MemberSelectExpressionTree) mit.methodSelect()).expression(); Boolean secureArgument = getBooleanValue(mit.arguments().get(0)); boolean isFalse = secureArgument != null && !secureArgument; if (methodObject.is(Tree.Kind.IDENTIFIER)) { IdentifierTree identifierTree = (IdentifierTree) methodObject; if (!isFalse) { unsecuredCookies.remove(identifierTree.symbol()); } else if (identifierTree.symbol().owner().isMethodSymbol()) { unsecuredCookies.add((Symbol.VariableSymbol) identifierTree.symbol()); } } else if (isFalse) { unsecuredSetters.add(mit); } } }
Source:
<code>} catch (NoSuchAlgorithmException e) { <START> new RuntimeException("Unable to generate KeyPair", e); <END> }</code><technical_language>Is throw RuntimeException static block</technical_language>

Target:
} catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
Source:
<code>public void setEstimatedTimes(Map<Integer, Number> estimatedTimes) { for (int i = 0; i < actions.size(); i++) { <START> if (estimatedTimes.containsKey(i)) { Optional<Number> estimate = Optional.of(estimatedTimes.get(i)); actions.get(i).setEstimatedTime(estimate); } else { actions.get(i).setEstimatedTime(Optional.empty()); <END> } } }</code><technical_language>simplify Optional.ofNullable</technical_language>

Target:
public void setEstimatedTimes(Map<Integer, Number> estimatedTimes) { for (int i = 0; i < actions.size(); i++) { actions.get(i).setEstimatedTime(Optional.ofNullable(estimatedTimes.get(i))); } }
Source:
<code>public static <T> CompletableFuture<List<T>> sequence(List<CompletableFuture<T>> futures) { <START> return CompletableFuture <END> .allOf(futures.toArray(new CompletableFuture<?>[futures.size()])) .thenApply(x -> futures.stream() .map(CompletableFuture::join) .collect(Collectors.toList())); }</code><technical_language>I implemented allOf in CfUtils, it: return allOf(futures).thenApply(x -> futures.stream() .map(CompletableFuture::join) .collect(Collectors.toList()));</technical_language>

Target:
public static <T> CompletableFuture<List<T>> sequence(List<CompletableFuture<T>> futures) { return allOf(futures).thenCompose(empty -> { CompletableFuture<List<T>> aggregated = CompletableFuture .completedFuture(new ArrayList<>()); for (CompletableFuture<T> future : futures) { aggregated = aggregated.thenCombine(future, (List<T> list, T value) -> { list.add(value); return list; }); } return aggregated; } ); }
Source:
<code>public void write(DataOutput output) throws IOException { WritableUtils.writeVInt(output, returnCode.ordinal()); output.writeLong(mutationTime); output.writeBoolean(table != null); if (table != null) { table.write(output); } <START> output.writeBoolean(column != null); <END> if (column != null) { column.write(output); } if(tableNamesToDelete != null && tableNamesToDelete.size() > 0 ) { output.writeBoolean(true); output.writeInt(tableNamesToDelete.size()); for(byte[] tableName : tableNamesToDelete) { Bytes.writeByteArray(output,tableName); } } else { output.writeBoolean(false); } }</code><technical_language>write columnName (and need writeBoolean), this: Bytes.writeByteArray(output, columnName == null ? ByteUtil.EMPTY_BYTE_ARRAY : columnName); if (columnName != null) { Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName); }</technical_language>

Target:
public void write(DataOutput output) throws IOException { WritableUtils.writeVInt(output, returnCode.ordinal()); output.writeLong(mutationTime); output.writeBoolean(table != null); if (table != null) { table.write(output); } Bytes.writeByteArray(output, columnName == null ? ByteUtil.EMPTY_BYTE_ARRAY : columnName); if (columnName != null) { Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName); } if(tableNamesToDelete != null && tableNamesToDelete.size() > 0 ) { output.writeBoolean(true); output.writeInt(tableNamesToDelete.size()); for(byte[] tableName : tableNamesToDelete) { Bytes.writeByteArray(output,tableName); } } else { output.writeBoolean(false); } }
Source:
<code>private void setSegmentDuration(LiveStreamPacketizerCupertino cupertinoPacketizer, IMediaStream stream) { String streamName = stream.getName(); int segmentDuration = Constants.DEFAULT_CHUNK_DURATION_MILLISECONDS; boolean durationUpdated = false; String entryId = Utils.getEntryIdFromStreamName(streamName); try { KalturaLiveEntry liveEntry = Utils.getLiveEntryFromStream(stream); durationUpdated = isValidSegmentDuration(liveEntry.segmentDuration); if (durationUpdated) { segmentDuration = liveEntry.segmentDuration; logger.debug("(" + streamName + ") successfully set \"cupertinoChunkDurationTarget\" to " + segmentDuration + " milliseconds"); } else { logger.error("(" + streamName + ") failed to get \"segmentDuration\". Using default value, " + Constants.DEFAULT_CHUNK_DURATION_MILLISECONDS + " milliseconds. Call developer."); } } catch (Exception e) { <START> if (!(e instanceof NullPointerException)) { <END> logger.error("stream [" + streamName + "] failed to get segmentDuration. Using default value, \" + Constants.DEFAULT_CHUNK_DURATION_MILLISECONDS + \" milliseconds. Call developer." + e); } } cupertinoPacketizer.getProperties().setProperty("cupertinoChunkDurationTarget", segmentDuration); }</code><technical_language>fix</technical_language>

Target:
private void setSegmentDuration(LiveStreamPacketizerCupertino cupertinoPacketizer, IMediaStream stream) { String streamName = stream.getName(); int segmentDuration = Constants.DEFAULT_CHUNK_DURATION_MILLISECONDS; try { KalturaLiveEntry liveEntry = Utils.getLiveEntryFromStream(stream); if (isValidSegmentDuration(liveEntry.segmentDuration)) { segmentDuration = liveEntry.segmentDuration; logger.debug("(" + streamName + ") successfully set \"cupertinoChunkDurationTarget\" to " + segmentDuration + " milliseconds"); } else { logger.error("(" + streamName + ") failed to get \"segmentDuration\". Using default value, " + Constants.DEFAULT_CHUNK_DURATION_MILLISECONDS + " milliseconds. Call developer."); } } catch (Exception e) { logger.error("stream [" + streamName + "] failed to get segmentDuration. Using default value, \" + Constants.DEFAULT_CHUNK_DURATION_MILLISECONDS + \" milliseconds. Call developer." + e); } cupertinoPacketizer.getProperties().setProperty("cupertinoChunkDurationTarget", segmentDuration); }
Source:
<code>public void delete(List<Delete> deletes) throws IOException { if (tx == null) { throw new IOException("Transaction not started"); } <START> List<Delete> transactionalizedDeletes = new ArrayList<Delete>(deletes.size()); <END> for (Delete delete : deletes) { Delete txDelete = transactionalizeAction(delete); transactionalizedDeletes.add(txDelete); } hTable.delete(transactionalizedDeletes); }</code><technical_language>new ArrayList<></technical_language>

Target:
public void delete(List<Delete> deletes) throws IOException { if (tx == null) { throw new IOException("Transaction not started"); } List<Delete> transactionalizedDeletes = new ArrayList<>(deletes.size()); for (Delete delete : deletes) { Delete txDelete = transactionalizeAction(delete); transactionalizedDeletes.add(txDelete); } hTable.delete(transactionalizedDeletes); }
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (senderIsConsole) { if (args.length == 0) { sender.sendMessage("When sending this command through console you must specify a player."); return true; } } Player player; if (args.length == 0) { player = sender_p; } else { if (args[0].equalsIgnoreCase("-a")) { if (!TFM_AdminList.isSuperAdmin(sender)) { sender.sendMessage(TFM_Command.MSG_NO_PERMS); return true; } for (Player targetPlayer : server.getOnlinePlayers()) { <START> targetPlayer.setGameMode(GameMode.CREATIVE); <END> } TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to spectator mode.", false); return true; } if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender))) { playerMsg("Only superadmins can change other user's gamemode."); return true; } player = getPlayer(args[0]); if (player == null) { sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND); return true; } } playerMsg("Setting " + player.getName() + " to game mode 'Spectator Mode'."); playerMsg(player, sender.getName() + " set your game mode to 'Spectator Mode'."); player.setGameMode(GameMode.SPECTATOR); return true; }</code><technical_language>Wrong gamemode</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (senderIsConsole) { if (args.length == 0) { sender.sendMessage("When sending this command through console you must specify a player."); return true; } } Player player; if (args.length == 0) { player = sender_p; } else { if (args[0].equalsIgnoreCase("-a")) { if (!TFM_AdminList.isSuperAdmin(sender)) { sender.sendMessage(TFM_Command.MSG_NO_PERMS); return true; } for (Player targetPlayer : server.getOnlinePlayers()) { targetPlayer.setGameMode(GameMode.SPECTATOR); } TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to spectator mode.", false); return true; } if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender))) { playerMsg("Only superadmins can change other user's gamemode."); return true; } player = getPlayer(args[0]); if (player == null) { sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND); return true; } } playerMsg("Setting " + player.getName() + " to game mode 'Spectator Mode'."); playerMsg(player, sender.getName() + " set your game mode to 'Spectator Mode'."); player.setGameMode(GameMode.SPECTATOR); return true; }
Source:
<code>public void test() throws Exception { <START> testDataFormat("asn1"); <END> }</code><technical_language>This testDataFormat(COMPONENT); Please other tests for sample</technical_language>

Target:
public void test() throws Exception { testDataFormat(COMPONENT); }
Source:
<code>public CommonProfileDefinition() { primary(EMAIL, Converters.STRING); primary(FIRST_NAME, Converters.STRING); primary(FAMILY_NAME, Converters.STRING); primary(DISPLAY_NAME, Converters.STRING); primary(GENDER, Converters.GENDER); primary(LOCALE, Converters.LOCALE); primary(PICTURE_URL, Converters.URL); primary(PROFILE_URL, Converters.URL); primary(LOCATION, Converters.STRING); <START> primary(USERNAME, Converters.STRING); <END> }</code><technical_language>Pac4jConstants.USERNAME instead of creating a new one..</technical_language>

Target:
public CommonProfileDefinition() { primary(EMAIL, Converters.STRING); primary(FIRST_NAME, Converters.STRING); primary(FAMILY_NAME, Converters.STRING); primary(DISPLAY_NAME, Converters.STRING); primary(GENDER, Converters.GENDER); primary(LOCALE, Converters.LOCALE); primary(PICTURE_URL, Converters.URL); primary(PROFILE_URL, Converters.URL); primary(LOCATION, Converters.STRING); primary(Pac4jConstants.USERNAME, Converters.STRING); }
Source:
<code><START> protected void recognizeArguments(CommandContext ctx) throws CommandFormatException { <END> ModelNode op = new ModelNode(); op.get("operation").set("read-operation-description"); op.get("name").set("read-attribute"); OperationRequestAddress address = getOperationRequestAddress(ctx); op = getAddressNode(ctx, address, op); ModelNode returnVal = new ModelNode(); try { if( ctx.getModelControllerClient() != null ) { returnVal = ctx.getModelControllerClient().execute(op); } } catch (IOException e) { throw new CommandFormatException("Failed to read resource: " + e.getLocalizedMessage(), e); } final ParsedCommandLine parsedCmd = ctx.getParsedCommandLine(); if( returnVal.hasDefined("outcome") && returnVal.get("outcome").asString().equals("success")){ ModelNode result = returnVal.get("result"); if(result.hasDefined("request-properties")){ ModelNode properties = result.get("request-properties"); if( !properties.hasDefined("resolve-expressions") && resolve.isPresent(parsedCmd)) { throw new OperationFormatException("Resolve Expression argument not available at this location."); } } } }</code><technical_language>super.recognizeArguments(ctx) called, this is validate other arguments present command line. Then, suggest check resolve.isPresent(parsedCmd) is true if check allowed for path, read-operation-description executed for entered ls if user ask resolve expressions. (The for ReadAttributeHandler)</technical_language>

Target:
protected void recognizeArguments(CommandContext ctx) throws CommandFormatException { super.recognizeArguments(ctx); final ParsedCommandLine parsedCmd = ctx.getParsedCommandLine(); if(resolve.isPresent(parsedCmd)) { ModelNode op = new ModelNode(); op.get("operation").set("read-operation-description"); op.get("name").set("read-attribute"); OperationRequestAddress address = getOperationRequestAddress(ctx); op = getAddressNode(ctx, address, op); ModelNode returnVal = new ModelNode(); try { if (ctx.getModelControllerClient() != null) { returnVal = ctx.getModelControllerClient().execute(op); } } catch (IOException e) { throw new CommandFormatException("Failed to read resource: " + e.getLocalizedMessage(), e); } if (returnVal.hasDefined("outcome") && returnVal.get("outcome").asString().equals("success")) { ModelNode result = returnVal.get("result"); if (result.hasDefined("request-properties")) { ModelNode properties = result.get("request-properties"); if (!properties.hasDefined("resolve-expressions") && resolve.isPresent(parsedCmd)) { throw new OperationFormatException("Resolve Expression argument not available at this location."); } } } } }
Source:
<code>public void testFailureRebindingEntityWhenFailAtEnd() throws Exception { RebindFailureMode danglingRefFailureMode = RebindFailureMode.CONTINUE; RebindFailureMode rebindFailureMode = RebindFailureMode.FAIL_AT_END; MyEntity origFailingE = origApp.createAndManageChild(EntitySpec.create(MyEntity.class) .impl(MyEntityFailingImpl.class) .configure(MyEntityFailingImpl.FAIL_ON_REBIND, true)); newManagementContext = new LocalManagementContext(); EntityManager newEntityManager = newManagementContext.getEntityManager(); RebindExceptionHandlerImpl exceptionHandler = new RebindExceptionHandlerImpl(danglingRefFailureMode, rebindFailureMode); try { newApp = rebind(newManagementContext, exceptionHandler); fail(); } catch (Exception e) { <START> if (!e.toString().contains("Problems rebinding")) throw e; END> } assertEquals(toEntityIds(exceptionHandler.rebindEntityFailures.keySet()), ImmutableSet.of(origFailingE.getId())); assertEquals(toEntityIds(newEntityManager.getEntities()), ImmutableSet.of(origApp.getId(), origFailingE.getId())); }</code><technical_language>catch exception, do some asserts catch block return. Then, catch call fail() fail test</technical_language>

Target:
public void testFailureRebindingEntityWhenFailAtEnd() throws Exception { RebindFailureMode danglingRefFailureMode = RebindFailureMode.CONTINUE; RebindFailureMode rebindFailureMode = RebindFailureMode.FAIL_AT_END; MyEntity origFailingE = origApp.createAndManageChild(EntitySpec.create(MyEntity.class) .impl(MyEntityFailingImpl.class) .configure(MyEntityFailingImpl.FAIL_ON_REBIND, true)); newManagementContext = new LocalManagementContext(); EntityManager newEntityManager = newManagementContext.getEntityManager(); RecordingRebindExceptionHandler exceptionHandler = new RecordingRebindExceptionHandler(danglingRefFailureMode, rebindFailureMode); try { newApp = rebind(newManagementContext, exceptionHandler); fail(); } catch (Exception e) { if (!e.toString().contains("Problems rebinding")) throw e; } assertEquals(toEntityIds(exceptionHandler.rebindEntityFailures.keySet()), ImmutableSet.of(origFailingE.getId())); assertEquals(toEntityIds(newEntityManager.getEntities()), ImmutableSet.of(origApp.getId(), origFailingE.getId())); }
Source:
<code><START> protected EventLoop newChild(Executor executor, Object... args) throws Exception { <END> return new LocalEventLoop(this, executor); }</code><technical_language>args set? worth failing if are</technical_language>

Target:
protected EventLoop newChild(Executor executor, Object... args) throws Exception { assert args == null || args.length == 0; return new LocalEventLoop(this, executor); }
Source:
<code>public PingCommand getCurrentStatus(long id) { if (_relativePath == null || _relativePath.isEmpty()) { s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the relative path information"); _shouldAudit = true; return null; } <START> if (_cmsUserLogin == null || _cmsUserLogin.isEmpty() || _cmsUserPassword == null || _cmsUserPassword.isEmpty()) { <END> s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the CMS user information"); _shouldAudit = true; return null; } try { login(); } catch (ExecutionException | ConfigurationException e) { s_logger.error("Failed to ping to Nuage VSD on " + _name + " as user " + _cmsUserLogin, e); _shouldAudit = true; return null; } PingNuageVspCommand pingNuageVspCommand = new PingNuageVspCommand(Host.Type.L2Networking, id, _shouldAudit); _shouldAudit = false; return pingNuageVspCommand; }</code><technical_language>@nlivens StringUtils.isEmpty(CharString cs) [<LINK_0>] in order check if a String is empty null</technical_language>

Target:
public PingCommand getCurrentStatus(long id) { if (Strings.isNullOrEmpty(_relativePath)) { s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the relative path information"); _shouldAudit = true; return null; } if (Strings.isNullOrEmpty(_cmsUserLogin) || Strings.isNullOrEmpty(_cmsUserPassword)) { s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the CMS user information"); _shouldAudit = true; return null; } try { login(); } catch (ExecutionException | ConfigurationException e) { s_logger.error("Failed to ping to Nuage VSD on " + _name + " as user " + _cmsUserLogin, e); _shouldAudit = true; return null; } PingNuageVspCommand pingNuageVspCommand = new PingNuageVspCommand(Host.Type.L2Networking, id, _shouldAudit); _shouldAudit = false; return pingNuageVspCommand; }
Source:
<code>public List<Map<String, Object>> getAllCalls(final String dataType, final Integer pageSize, final Integer pageNumber) { try { <START> List<Map<String, Object>> brapiCalls; <END> final String jsonPath; if (dataType != null) { jsonPath = "$.data[?('" + dataType + "' in @['datatypes'])]"; } else { jsonPath = "$.data.*"; } final InputStream is = CallServiceImpl.class.getClassLoader().getResourceAsStream("brapi/calls.json"); final String jsonTxt = IOUtils.toString( is ); brapiCalls = JsonPath.parse(jsonTxt).read(jsonPath); if (pageNumber != null && pageSize != null) { int maxLenght = pageSize * (pageNumber) + pageSize; if (maxLenght > brapiCalls.size()) { maxLenght = brapiCalls.size(); } int minLenght = (pageNumber - 1) * pageSize; if (minLenght < 0) { minLenght = 0; } brapiCalls = brapiCalls.subList(minLenght, maxLenght); } return brapiCalls; } catch (final IOException e) { e.printStackTrace(); } return null; }</code><technical_language>@vmaletta I suggest this final remove change if sentences avoid returning null</technical_language>

Target:
public List<Map<String, Object>> getAllCalls(final String dataType, final Integer pageSize, final Integer pageNumber) { try { List<Map<String, Object>> brapiCalls; final String jsonPath; if (dataType != null) { jsonPath = "$.data[?('" + dataType + "' in @['datatypes'])]"; } else { jsonPath = "$.data.*"; } final InputStream is = CallServiceImpl.class.getClassLoader().getResourceAsStream("brapi/calls.json"); final String jsonTxt = IOUtils.toString( is ); brapiCalls = JsonPath.parse(jsonTxt).read(jsonPath); if (pageNumber != null && pageSize != null) { int maxLenght = pageSize * (pageNumber) + pageSize; if (maxLenght > brapiCalls.size()) { maxLenght = brapiCalls.size(); } int minLenght = (pageNumber - 1) * pageSize; if (minLenght < 0) { minLenght = 0; } brapiCalls = brapiCalls.subList(minLenght, maxLenght); } return brapiCalls; } catch (final IOException e) { e.printStackTrace(); return null; } }
Source:
<code>public static void setUp() throws IOException, BadPcapFileException, TmfTraceException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); <START> if (trace.getPath().getFileName().toString().endsWith(".pcapng")) { try (PcapFile pcap = new PcapNgFile(trace.getPath());) { PcapTrace pcapTrace = new PcapTrace(); pcapTrace.initTrace(null, trace.getPath().toString(), PcapEvent.class); fEvent = pcapTrace.parseEvent(new TmfContext(new TmfLongLocation(3), 3)); pcapTrace.dispose(); } }else { try (PcapFile pcap = new PcapOldFile(trace.getPath());) { PcapTrace pcapTrace = new PcapTrace(); pcapTrace.initTrace(null, trace.getPath().toString(), PcapEvent.class); fEvent = pcapTrace.parseEvent(new TmfContext(new TmfLongLocation(3), 3)); pcapTrace.dispose(); } <END> } List<TmfPcapProtocol> list = new ArrayList<>(); list.add(TmfPcapProtocol.PCAP); list.add(TmfPcapProtocol.ETHERNET_II); list.add(TmfPcapProtocol.IPV4); list.add(TmfPcapProtocol.TCP); list.add(TmfPcapProtocol.UNKNOWN); fProtocolList = ImmutableList.copyOf(list); }</code><technical_language>this is common tests, a helper</technical_language>

Target:
public static void setUp() throws IOException, BadPcapFileException, TmfTraceException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); PcapTrace pcapTrace = new PcapTrace(); pcapTrace.initTrace(null, trace.getPath().toString(), PcapEvent.class); fEvent = pcapTrace.parseEvent(new TmfContext(new TmfLongLocation(3), 3)); pcapTrace.dispose(); List<TmfPcapProtocol> list = new ArrayList<>(); list.add(TmfPcapProtocol.PCAP); list.add(TmfPcapProtocol.ETHERNET_II); list.add(TmfPcapProtocol.IPV4); list.add(TmfPcapProtocol.TCP); list.add(TmfPcapProtocol.UNKNOWN); fProtocolList = ImmutableList.copyOf(list); }
Source:
<code>public static void registerDungeons() { <START> if(isLegacy) return; END> try { Method addDungeonMob = Class.forName("com.evilnotch.dungeontweeks.main.world.worldgen.mobs.DungeonMobs").getMethod("addDungeonMob", ResourceLocation.class,ResourceLocation.class,int.class); for(AS_WorldGenTower.TowerTypes tower : AS_WorldGenTower.TowerTypes.values()) { boolean nether = tower == TowerTypes.Netherrack; addDungeonMob.invoke(null, tower.getId(), new ResourceLocation("cave_spider"), 100); addDungeonMob.invoke(null,tower.getId(), new ResourceLocation("spider"), 90); addDungeonMob.invoke(null,tower.getId(), nether ? new ResourceLocation("wither_skeleton") : new ResourceLocation("skeleton"), 120); addDungeonMob.invoke(null,tower.getId(), new ResourceLocation("zombie"), 120); if(nether) addDungeonMob.invoke(null,tower.getId(), new ResourceLocation("blaze"), 20); } } catch(Exception e) { e.printStackTrace(); } }</code><technical_language>Formatting</technical_language>

Target:
public static void registerDungeons() { if (!isLoaded || isLegacy) { return; } try { Method addDungeonMob = Class.forName("com.evilnotch.dungeontweeks.main.world.worldgen.mobs.DungeonMobs").getMethod("addDungeonMob", ResourceLocation.class, ResourceLocation.class, int.class); for (AS_WorldGenTower.TowerTypes tower : AS_WorldGenTower.TowerTypes.values()) { boolean nether = tower == TowerTypes.Netherrack; addDungeonMob.invoke(null, tower.getId(), new ResourceLocation("cave_spider"), 100); addDungeonMob.invoke(null, tower.getId(), new ResourceLocation("spider"), 90); addDungeonMob.invoke(null, tower.getId(), nether ? new ResourceLocation("wither_skeleton") : new ResourceLocation("skeleton"), 120); addDungeonMob.invoke(null, tower.getId(), new ResourceLocation("zombie"), 120); if (nether) { addDungeonMob.invoke(null, tower.getId(), new ResourceLocation("blaze"), 20); } } } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>public static void checkNumberOfLVsForBlockDomain(Guid storageDomainId) { StorageDomainStatic domain = DbFacade.getInstance().getStorageDomainStaticDao().get(storageDomainId); if (domain.getStorageType().isBlockDomain()) { long numOfLVs = DbFacade.getInstance().getStorageDomainDao().getNumberOfImagesInStorageDomain(storageDomainId); Integer maxNumOfLVs = Config.getValue(ConfigValues.AlertOnNumberOfLVs); if (numOfLVs >= maxNumOfLVs) { AuditLogableBase logable = new AuditLogableBase(); <START> logable.setStorageDomainId(storageDomainId); <END> logable.addCustomValue("maxNumOfLVs", maxNumOfLVs.toString()); AuditLogDirector.log(logable, AuditLogType.NUNBER_OF_LVS_ON_STORAGE_DOMAIN_EXCEEDED_THRESHOLD); } } }</code><technical_language>add of storage domain name, need set id load db if it</technical_language>

Target:
public static void checkNumberOfLVsForBlockDomain(Guid storageDomainId) { StorageDomainStatic domain = DbFacade.getInstance().getStorageDomainStaticDao().get(storageDomainId); if (domain.getStorageType().isBlockDomain()) { long numOfLVs = DbFacade.getInstance().getStorageDomainDao().getNumberOfImagesInStorageDomain(storageDomainId); Integer maxNumOfLVs = Config.getValue(ConfigValues.AlertOnNumberOfLVs); if (numOfLVs >= maxNumOfLVs) { AuditLogableBase logable = new AuditLogableBase(); logable.addCustomValue("storageDomainName", domain.getStorageName()); logable.addCustomValue("maxNumOfLVs", maxNumOfLVs.toString()); AuditLogDirector.log(logable, AuditLogType.NUNBER_OF_LVS_ON_STORAGE_DOMAIN_EXCEEDED_THRESHOLD); } } }
Source:
<code>public void writeTo(ProtoStreamWriter protoStreamWriter, KObject kObject) throws IOException { protoStreamWriter.writeString(MetaObject.META_OBJECT_ID, kObject.getId()); protoStreamWriter.writeString(MetaObject.META_OBJECT_TYPE, kObject.getType().getName()); protoStreamWriter.writeString(CLUSTER_ID, kObject.getClusterId()); protoStreamWriter.writeString(SEGMENT_ID, kObject.getSegmentId()); protoStreamWriter.writeString(MetaObject.META_OBJECT_KEY, kObject.getKey()); List<KProperty<?>> props = new ArrayList<>(); kObject.getProperties().iterator().forEachRemaining(props::add); props.removeIf(kProperty -> props.stream() .filter(prop -> kProperty.getName().equals(prop.getName())).count() > 1); props.forEach(kProperty -> { try { <START> this.build(toProtobufFormat(kProperty.getName()), <END> kProperty.getValue(), protoStreamWriter); } catch (IOException e) { logger.error("error", e); } }); if (kObject.fullText()) { protoStreamWriter.writeString(MetaObject.META_OBJECT_FULL_TEXT, props.stream() .filter(kProperty -> kProperty.isSearchable() && !(kProperty.getValue() instanceof Boolean)) .map(kProperty -> String.valueOf(kProperty.getValue()).toLowerCase()) .collect(joining("\n"))); } }</code><technical_language>note if illegal write multiple properties name ProtoStreamWriter this happen here. E.g. if property named "a.b" "a/b" mapped "a__b" here. if this trouble.</technical_language>

Target:
public void writeTo(ProtoStreamWriter protoStreamWriter, KObject kObject) throws IOException { Descriptor descriptor = protoStreamWriter.getSerializationContext().getMessageDescriptor(this.getTypeName()); TreeMap<Integer, KProperty<?>> props = new TreeMap<>(); this.addKProperty(props, descriptor, MetaObject.META_OBJECT_ID, kObject.getId()); this.addKProperty(props, descriptor, MetaObject.META_OBJECT_TYPE, kObject.getType().getName()); this.addKProperty(props, descriptor, CLUSTER_ID, kObject.getClusterId()); this.addKProperty(props, descriptor, SEGMENT_ID, kObject.getSegmentId()); this.addKProperty(props, descriptor, MetaObject.META_OBJECT_KEY, kObject.getKey()); kObject.getProperties() .iterator() .forEachRemaining(kprop -> Optional.ofNullable(descriptor.findFieldByName(toProtobufFormat(kprop.getName()))) .ifPresent(field -> props .putIfAbsent(field.getNumber(), kprop))); if (kObject.fullText()) { this.addKProperty(props, descriptor, MetaObject.META_OBJECT_FULL_TEXT, props.values().stream() .filter(kProperty -> kProperty.isSearchable() && !(kProperty.getValue() instanceof Boolean)) .map(kProperty -> String.valueOf(kProperty.getValue()).toLowerCase()) .collect(joining("\n"))); } props.keySet().forEach((number) -> { try { KProperty<?> kProperty = props.get(number); this.writeField(toProtobufFormat(kProperty.getName()), kProperty.getValue(), protoStreamWriter); } catch (IOException e) { logger.error("error", e); } }); }
Source:
<code>public boolean equals(final Object o) { if (this == o) return true; <START> if (o == null || getClass() != o.getClass()) return false; <END> final Point point = (Point) o; if (Float.compare(point.xCoordinate, xCoordinate) != 0) return false; return Float.compare(point.yCoordinate, yCoordinate) == 0; }</code><technical_language>simplified if (!(o instanceof Point))</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof Point)) { return false; } final Point point = (Point) o; if (Double.compare(point.xCoordinate, xCoordinate) != 0) { return false; } return Double.compare(point.yCoordinate, yCoordinate) == 0; }
Source:
<code>public Response remove() { <START> return BackendClusterFeatureHelper.disableClusterFeature(this, asGuid(clusterId), asGuid(id)); <END> }</code><technical_language>helper method create Response object, here. idea is helper method in other situations, want create a response immediately</technical_language>

Target:
public Response remove() { Cluster cluster = BackendClusterFeatureHelper.getClusterWithFeatureDisabled(this, asGuid(clusterId), guid); ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(cluster); return performAction(ActionType.UpdateCluster, param); }
Source:
<code>public Cluster getClusterByName(String clusterName) { Collection<Cluster> clusters = listClusters(Lists.newArrayList(new QueryParam("name", clusterName))); if (clusters.size() > 1) { <START> LOG.warn("Multiple Clusters have same name: returning first one.", clusterName); <END> return clusters.iterator().next(); } else if (clusters.size() == 1) { return clusters.iterator().next(); } return null; }</code><technical_language>{} returning match</technical_language>

Target:
public Cluster getClusterByName(String clusterName) { Collection<Cluster> clusters = listClusters(Lists.newArrayList(new QueryParam("name", clusterName))); if (clusters.size() > 1) { LOG.warn("Multiple Clusters have same name: returning first match.", clusterName); return clusters.iterator().next(); } else if (clusters.size() == 1) { return clusters.iterator().next(); } return null; }