auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean saveBaseMessageToCacheDir( boolean overrideIfExists ) throws IOException { String baseMsgPath = Util.joinPath( getDashboardFolderPath(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); IBasicFile basePropertiesFile = null; String basePropertiesCachePath = Util.joinPath( getBaseTempCacheFolder(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); if ( getDashboardAccess().fileExists( baseMsgPath ) ) { basePropertiesFile = getDashboardAccess().fetchFile( baseMsgPath ); if ( !getPluginAccess().fileExists( basePropertiesCachePath ) || overrideIfExists ) { getPluginAccess().saveFile( basePropertiesCachePath, basePropertiesFile.getContents() ); } } if ( !getPluginAccess().fileExists( basePropertiesCachePath ) ) { <START> getPluginAccess().saveFile( basePropertiesCachePath, new ByteArrayInputStream( new String().getBytes() ) ); <END> } return true; }</code><technical_language>new byte[0] instead of new String().getBytes() ? Also, this creating files for dashboard of translations</technical_language>

Target:
protected boolean saveBaseMessageToCacheDir( boolean overrideIfExists ) throws IOException { String baseMsgPath = Util.joinPath( getDashboardFolderPath(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); IBasicFile basePropertiesFile = null; String basePropertiesCachePath = Util.joinPath( getBaseTempCacheFolder(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); if ( getDashboardAccess().fileExists( baseMsgPath ) ) { basePropertiesFile = getDashboardAccess().fetchFile( baseMsgPath ); if ( !getPluginAccess().fileExists( basePropertiesCachePath ) || overrideIfExists ) { getPluginAccess().saveFile( basePropertiesCachePath, basePropertiesFile.getContents() ); } } if ( !getPluginAccess().fileExists( basePropertiesCachePath ) ) { getPluginAccess().saveFile( basePropertiesCachePath, new ByteArrayInputStream( new byte[0] ) ); } return true; }
Source:
<code><START> public void close() { <END> env.getSharedResources().getTimestampTracker().removeTimestamp(startTs); }</code><technical_language>operations a closed transaction fail. I is some checking operations commit</technical_language>

Target:
public synchronized void close() { if (status != TxStatus.CLOSED) { status = TxStatus.CLOSED; env.getSharedResources().getTimestampTracker().removeTimestamp(startTs); } }
Source:
<code>public void onInteractEntity(PlayerInteractEntityEvent e) { if (!e.getRightClicked().isValid() || e.getRightClicked().getType() != EntityType.PIGLIN) { return; } ItemStack itemStack; if (e.getHand() == EquipmentSlot.OFF_HAND) { itemStack = e.getPlayer().getInventory().getItemInOffHand(); } else { itemStack = e.getPlayer().getInventory().getItemInMainHand(); } SlimefunItem sfItem = SlimefunItem.getByItem(itemStack); if (sfItem != null) { <START> e.setCancelled(true); <END> } }</code><technical_language>add a message barter piglins Slimefun items</technical_language>

Target:
public void onInteractEntity(PlayerInteractEntityEvent e) { if (!e.getRightClicked().isValid() || e.getRightClicked().getType() != EntityType.PIGLIN) { return; } ItemStack itemStack; if (e.getHand() == EquipmentSlot.OFF_HAND) { itemStack = e.getPlayer().getInventory().getItemInOffHand(); } else { itemStack = e.getPlayer().getInventory().getItemInMainHand(); } if (itemStack.getType() != Material.GOLD_INGOT) { return; } SlimefunItem sfItem = SlimefunItem.getByItem(itemStack); if (sfItem != null) { SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.piglin-barter", true); e.setCancelled(true); } }
Source:
<code>public void publishTelemetry(String name) { Map<String, Double> angleMap = new HashMap<String, Double>(); for (DHLink l : arms.get(name).getLinks()) { String jointName = l.getName(); double theta = l.getTheta(); double angle = MathUtils.radToDeg(theta) + l.getOffset(); angleMap.put(jointName, (double) angle % 360.0F); <START> invoke("publishJointAngles", new AngleData(jointName, (double) angle % 360.0F)); <END> log.info("Servo : Angle : {}", jointName, angleMap.get(jointName)); } double[][] jointPositionMap = createJointPositionMap(name); invoke("publishJointPositions", (Object) jointPositionMap); }</code><technical_language>Angles plural is incorrect here. AngleData is singular</technical_language>

Target:
public void publishTelemetry(String name) { Map<String, Double> angleMap = new HashMap<String, Double>(); for (DHLink l : arms.get(name).getLinks()) { String jointName = l.getName(); double theta = l.getTheta(); double angle = MathUtils.radToDeg(theta) + l.getOffset(); angleMap.put(jointName, (double) angle % 360.0F); invoke("publishJointAngle", new AngleData(jointName, (double) angle % 360.0F)); log.info("Servo : Angle : {}", jointName, angleMap.get(jointName)); } double[][] jointPositionMap = createJointPositionMap(name); invoke("publishJointPositions", (Object) jointPositionMap); }
Source:
<code>public void update(float delta) { super.update(delta); if (previewGenerator != null) { PreviewSettings newSettings = new PreviewSettings(layerDropdown.getSelection(), TeraMath.floorToInt(zoomSlider.getValue()), seedBinding.get()); if (currentSettings == null || !currentSettings.equals(newSettings)) { UIImage image = find("preview", UIImage.class); try { Texture tex = createTexture(imageSize, imageSize, newSettings.zoom, newSettings.layer); image.setImage(tex); image.setVisible(true); } catch (Exception ex) { <START> image.setVisible(false); <END> } currentSettings = newSettings; } } }</code><technical_language>I exception logged here. Silent failures hard track down</technical_language>

Target:
public void update(float delta) { super.update(delta); if (previewGenerator != null) { PreviewSettings newSettings = new PreviewSettings(layerDropdown.getSelection(), TeraMath.floorToInt(zoomSlider.getValue()), seedBinding.get()); if (currentSettings == null || !currentSettings.equals(newSettings)) { UIImage image = find("preview", UIImage.class); try { Texture tex = createTexture(imageSize, imageSize, newSettings.zoom, newSettings.layer); image.setImage(tex); image.setVisible(true); } catch (Exception ex) { image.setVisible(false); logger.info("Error generating a 2d preview for " + layerDropdown.getSelection()); } currentSettings = newSettings; } } }
Source:
<code>private ConnectorSplit createBucketSplit(int bucketNumber, Set<ShardNodes> shards) { String nodeId = bucketToNode.get().get(bucketNumber); Node node = nodesById.get(nodeId); if (node == null) { throw new PrestoException(NO_NODES_AVAILABLE, "Node for bucket is offline: " + nodeId); } Set<UUID> shardUuids = shards.stream() .map(ShardNodes::getShardUuid) .collect(toSet()); Map<UUID, Optional<UUID>> shardDeltaMap = shards.stream() <START> .collect(toImmutableMap(shard -> shard.getShardUuid(), shard -> shard.getDeltaShardUuid())); <END> HostAddress address = node.getHostAndPort(); return new RaptorSplit(connectorId, shardUuids, shardDeltaMap, bucketNumber, address, effectivePredicate, transactionId, columnTypes, Optional.of(deltaDeleteEnabled)); }</code><technical_language>nit: lambda replaced method reference</technical_language>

Target:
private ConnectorSplit createBucketSplit(int bucketNumber, Set<ShardNodes> shards) { String nodeId = bucketToNode.get().get(bucketNumber); Node node = nodesById.get(nodeId); if (node == null) { throw new PrestoException(NO_NODES_AVAILABLE, "Node for bucket is offline: " + nodeId); } Set<UUID> shardUuids = shards.stream() .map(ShardNodes::getShardUuid) .collect(toSet()); ImmutableMap.Builder<UUID, UUID> shardMapBuilder = new ImmutableMap.Builder<>(); shards.stream().forEach( shard -> { if (shard.getDeltaShardUuid().isPresent()) { shardMapBuilder.put(shard.getShardUuid(), shard.getDeltaShardUuid().get()); } }); HostAddress address = node.getHostAndPort(); return new RaptorSplit( connectorId, shardUuids, shardMapBuilder.build(), tableSupportsDeltaDelete, bucketNumber, address, effectivePredicate, transactionId, columnTypes); }
Source:
<code>public void executeTask( @NotNull final Map<String, Object> context ) throws GenieException { log.debug("Executing JobKillLogic Task in the workflow."); super.executeTask(context); <START> Utils.appendToWriter(writer, JobConstants.JOB_KILL_HANDLER_LOGIC.toString()); <END> }</code><technical_language>Instead of calling toString call in constant class is created</technical_language>

Target:
public void executeTask( @NotNull final Map<String, Object> context ) throws GenieException { log.debug("Executing JobKillLogic Task in the workflow."); super.executeTask(context); Utils.appendToWriter(writer, JobConstants.JOB_KILL_HANDLER_LOGIC); }
Source:
<code>public boolean onActionItemClicked(ActionMode mode, MenuItem item) { if (item.getItemId() == 16) { int selectionStart = mTextBox.getSelectionStart(); int selectionEnd = mTextBox.getSelectionEnd(); String text = mTextBox.getText().toString(); String beforeText = text.substring(0, selectionStart); String selectedText = text.substring(selectionStart, selectionEnd); String afterText = text.substring(selectionEnd); String clozeOpenBracket = "{{c" + mClozeCounter + "::"; <START> mClozeCounter++; END> mTextBox.setText(beforeText + clozeOpenBracket + selectedText + "}}" + afterText); int clozeOpenSize = clozeOpenBracket.length(); mTextBox.setSelection(selectionStart+clozeOpenSize, selectionEnd+clozeOpenSize); mode.finish(); return true; } else { return false; } }</code><technical_language>clozes exist note? a "count clozes" phase editing</technical_language>

Target:
public boolean onActionItemClicked(ActionMode mode, MenuItem item) { if (item.getItemId() == mMenuId) { int selectionStart = mTextBox.getSelectionStart(); int selectionEnd = mTextBox.getSelectionEnd(); String text = mTextBox.getText().toString(); String beforeText = text.substring(0, selectionStart); String selectedText = text.substring(selectionStart, selectionEnd); String afterText = text.substring(selectionEnd); Matcher matcher = mClozeRegexPattern.matcher(text); int highestClozeId = 0; while (matcher.find()) { int detectedClozeId = Integer.parseInt(matcher.group(1)); if (detectedClozeId > highestClozeId) { highestClozeId = detectedClozeId; } } String clozeOpenBracket = "{{c" + (highestClozeId + 1) + "::"; mTextBox.setText(beforeText + clozeOpenBracket + selectedText + "}}" + afterText); int clozeOpenSize = clozeOpenBracket.length(); mTextBox.setSelection(selectionStart+clozeOpenSize, selectionEnd+clozeOpenSize); mode.finish(); return true; } else { return false; } }
Source:
<code>public Response intercept(Chain chain) throws IOException { Request original = chain.request(); if (credential == null) { return chain.proceed(original); } <START> if (!original.isHttps() && credential != null) { <END> throw new PlainTextPasswordException(); } Request.Builder builder = original.newBuilder() .header("Authorization", credential); Request request = builder.build(); return chain.proceed(request); }</code><technical_language>Oh, funny! Sorry, I realized moved that. If this replicates existing behavior, ignore request</technical_language>

Target:
public Response intercept(Chain chain) throws IOException { Request original = chain.request(); if (credential == null) { return chain.proceed(original); } if (enforceSecureEndpoint && !original.isHttps() && credential != null) { throw new PlainTextPasswordException(); } Request.Builder builder = original.newBuilder() .header("Authorization", credential); Request request = builder.build(); return chain.proceed(request); }
Source:
<code>public String toString() { return new StringBuilder() .append("VpnConfig") .append("{ user=").append(user) .append(", interface=").append(interfaze) .append(", session=").append(session) .append(", mtu=").append(mtu) .append(", addresses=").append(toString(addresses)) .append(", routes=").append(toString(routes)) .append(", dns=").append(toString(dnsServers)) .append(", searchDomains=").append(toString(searchDomains)) .append(", allowedApps=").append(toString(allowedApplications)) .append(", disallowedApps=").append(toString(disallowedApplications)) .append(", configureIntent=").append(configureIntent) .append(", startTime=").append(startTime) .append(", legacy=").append(legacy) .append(", blocking=").append(blocking) .append(", allowBypass=").append(allowBypass) .append(", allowIPv4=").append(allowIPv4) .append(", allowIPv6=").append(allowIPv6) .append(", underlyingNetworks=").append(Arrays.toString(underlyingNetworks)) <START> .append(", proxyHost=").append(proxy == null ? "" : proxy.getHost()) .append(", proxyPort=").append(proxy == null ? "" : proxy.getPort()) <END> .append("}") .toString(); }</code><technical_language>Suggest ProxyInfo's toString() method</technical_language>

Target:
public String toString() { return new StringBuilder() .append("VpnConfig") .append("{ user=").append(user) .append(", interface=").append(interfaze) .append(", session=").append(session) .append(", mtu=").append(mtu) .append(", addresses=").append(toString(addresses)) .append(", routes=").append(toString(routes)) .append(", dns=").append(toString(dnsServers)) .append(", searchDomains=").append(toString(searchDomains)) .append(", allowedApps=").append(toString(allowedApplications)) .append(", disallowedApps=").append(toString(disallowedApplications)) .append(", configureIntent=").append(configureIntent) .append(", startTime=").append(startTime) .append(", legacy=").append(legacy) .append(", blocking=").append(blocking) .append(", allowBypass=").append(allowBypass) .append(", allowIPv4=").append(allowIPv4) .append(", allowIPv6=").append(allowIPv6) .append(", underlyingNetworks=").append(Arrays.toString(underlyingNetworks)) .append(", proxy=").append(proxy) .append("}") .toString(); }
Source:
<code>public void close() throws IOException { try { flush(); } finally { if (writer != null) { <START> writer.close(); <END> } } }</code><technical_language>AFAIK Writer::close throws IOException, is posibility exception is thrown flush method suppressed</technical_language>

Target:
public void close() throws IOException { try (@SuppressWarnings("unused") Writer writer = this.writer) { flush(); } }
Source:
<code>private void createBulkUsers() throws Exception { FileUtils.writeLines(sourceLoginFile, sourceUsers1); FileUtils.writeLines(sourceGroupFile, sourceGroups1); <START> ManageUsers.manageUsers(new String[]{"-" + ManageUsers.CREATE_OPTION, <END> "-" + ManageUsers.SOURCE_LOGINFILE_OPTION, sourceLoginFile.getAbsolutePath(), "-" + ManageUsers.SOURCE_GROUPFILE_OPTION, sourceGroupFile.getAbsolutePath(), "-" + ManageUsers.LOGINFILE_OPTION, loginFile.getAbsolutePath(), "-" + ManageUsers.GROUPFILE_OPTION, groupFile.getAbsolutePath(), "-" + ManageUsers.KEYFILE_OPTION, publicKeyFile.getAbsolutePath() }); validateContents(users, groups); }</code><technical_language>Please change signature of ManageUsers#manageUsers String... instead of String[] input parameter. This way, is required create explicitly a String array in _createBulkUsers_, _updateBulkUsers_, _updateBulkUsersLoginFile_ _updateBulkUsersGroupFile_</technical_language>

Target:
private void createBulkUsers() throws Exception { FileUtils.writeLines(sourceLoginFile, sourceUsers1); FileUtils.writeLines(sourceGroupFile, sourceGroups1); ManageUsers.manageUsers("-" + ManageUsers.CREATE_OPTION, "-" + ManageUsers.SOURCE_LOGINFILE_OPTION, sourceLoginFile.getAbsolutePath(), "-" + ManageUsers.SOURCE_GROUPFILE_OPTION, sourceGroupFile.getAbsolutePath(), "-" + ManageUsers.LOGINFILE_OPTION, loginFile.getAbsolutePath(), "-" + ManageUsers.GROUPFILE_OPTION, groupFile.getAbsolutePath(), "-" + ManageUsers.KEYFILE_OPTION, publicKeyFile.getAbsolutePath() ); validateContents(users, groups); }
Source:
<code>public Iterator<Entry<K, V>> crappyterator() { final Store.Iterator<Entry<K, ValueHolder<V>>> iterator = store.iterator(); return new Iterator<Entry<K, V>>() { K current; @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Entry<K, V> next() { try { final Entry<K, ValueHolder<V>> next = iterator.next(); if (get(next.getKey()) == null) { current = null; return null; } <START> store.get(next.getKey()); <END> current = next.getKey(); return new Entry<K, V>() { @Override public K getKey() { return next.getKey(); } @Override public V getValue() { return next.getValue().value(); } }; } catch (CacheAccessException e) { current = null; return null; } } @Override public void remove() { if (current == null) { throw new IllegalStateException(); } Ehcache.this.remove(current); } }; }</code><technical_language>discussions, remove mappings new expiry computed is a duration of zero, while return caller expired accessed. This means changes Store.get logic potential adaptations Store method called EhcacheWithLoaderWriter</technical_language>

Target:
public Iterator<Entry<K, V>> crappyterator() { return new Crappyterator<K, V>(Ehcache.this, store); }
Source:
<code>protected ILogData removeFromQueue(NavigableSet<Long> queue) { Long thisRead = queue.pollFirst(); if (thisRead != null) { ILogData ld; try { <START> ld = readRange(thisRead, queue, false); <END> } catch (TrimmedException te) { if (!options.ignoreTrimmed) { throw te; } log.warn("removeFromQueue[{}]: ignoring trimmed addresses {}", this, te.getTrimmedAddresses()); te.getTrimmedAddresses().forEach(address -> queue.remove(address)); return removeFromQueue(queue); } if (queue == getCurrentContext().readQueue && ld != null) { if (ld.containsStream(this.id)) { addToResolvedQueue(getCurrentContext(), thisRead, ld); return ld; } else { log.trace("getNextEntry[{}]: the data for address does not belong to this stream. Skip.", this, thisRead); return removeFromQueue(queue); } } return ld; } return null; }</code><technical_language>If readRange is ignoreTrimmed false, remove this parameter? readRange sound a good name, returns a single value</technical_language>

Target:
protected ILogData removeFromQueue(NavigableSet<Long> queue) { Long thisRead = queue.pollFirst(); if (thisRead != null) { ILogData ld; try { ld = read(thisRead, queue); } catch (TrimmedException te) { if (!options.ignoreTrimmed) { throw te; } log.warn("removeFromQueue[{}]: ignoring trimmed addresses {}", this, te.getTrimmedAddresses()); te.getTrimmedAddresses().forEach(address -> queue.remove(address)); return removeFromQueue(queue); } if (queue == getCurrentContext().readQueue && ld != null) { if (ld.containsStream(this.id)) { addToResolvedQueue(getCurrentContext(), thisRead, ld); return ld; } else { log.trace("getNextEntry[{}]: the data for address does not belong to this stream. Skip.", this, thisRead); return removeFromQueue(queue); } } return ld; } return null; }
Source:
<code>private void addAssociatedResource(Object value) { if (value instanceof EObject) { <START> if (((EObject) value).eResource() != null) { resourceToRootEObjectMap.put(((EObject) value).eResource().getURI().toString(), (EObject) value); } <END> } else if (value instanceof EList<?>) { EList<?> eListNotifier = (EList<?>) value; for (Object object : eListNotifier) { addAssociatedResource(object); } } }</code><technical_language>branch v2 patch set : 2 access eResource() --> Create a local variable for this</technical_language>

Target:
private void addAssociatedResource(Object value) { if (value instanceof EObject) { Resource eResource = ((EObject) value).eResource(); if (eResource != null) { resourceToRootEObjectMap.put(eResource.getURI().toString(), (EObject) value); } } else if (value instanceof EList<?>) { EList<?> eListNotifier = (EList<?>) value; for (Object object : eListNotifier) { addAssociatedResource(object); } } }
Source:
<code>Resource(byte pos, String name) { this.lockLevel = pos; <START> this.mask += (short) Math.pow(2, lockLevel + 1) - 1; <END> this.setMask = (short) Math.pow(2, lockLevel); this.name = name; }</code><technical_language>a bug se; meant write _this.mask = (short) Math.pow(2, lockLevel + 1) - 1;_ **+=**</technical_language>

Target:
Resource(byte pos, String name) { this.lockLevel = pos; this.mask = (short) (Math.pow(2, lockLevel + 1) - 1); this.setMask = (short) Math.pow(2, lockLevel); this.name = name; }
Source:
<code>public List<DocumentReference> getDocumentParentsList(DocumentReference docRef, boolean includeDoc) { ArrayList<DocumentReference> docParents = new ArrayList<DocumentReference>(); ArrayList<String> secondKeyMaster = new ArrayList<String>( docParentProviderMap.keySet()); secondKeyMaster.remove(XDocParents.DOC_PROVIDER_NAME); ArrayList<String> secondKeys = new ArrayList<String>(secondKeyMaster); String firstKey = XDocParents.DOC_PROVIDER_NAME; try { if (includeDoc) { docParents.add(docRef); } boolean hasMore = false; do { List<DocumentReference> parentList = docParentProviderMap.get(firstKey ).getDocumentParentsList(docRef); joinParentLists(docParents, parentList); <START> docRef = docParents.get(docParents.size() - 1); <END> hasMore = false; if (secondKeys.size() > 0) { int secKeyIndex = -1; parentList = Collections.emptyList(); while ((secKeyIndex < secondKeys.size()) && ((parentList == null) || parentList.isEmpty())) { secKeyIndex = secKeyIndex + 1; parentList = docParentProviderMap.get(secondKeys.get(secKeyIndex) ).getDocumentParentsList(docRef); } hasMore = ((parentList != null) && !parentList.isEmpty()); if (hasMore) { joinParentLists(docParents, parentList); docRef = docParents.get(docParents.size() - 1); secondKeys = new ArrayList<String>(secondKeyMaster); secondKeys.remove(secKeyIndex); } } } while (hasMore); } catch (XDocRecursionException recExp) { _LOGGER.info("Recursion in document parents found [" + recExp + "]."); } return docParents; }</code><technical_language>IndexOutOfBoundsException if DocParentProvider returns empty list</technical_language>

Target:
public List<DocumentReference> getDocumentParentsList(DocumentReference docRef, boolean includeDoc) { ArrayList<DocumentReference> docParents = new ArrayList<DocumentReference>(); ArrayList<String> secondKeyMaster = new ArrayList<String>( docParentProviderMap.keySet()); secondKeyMaster.remove(XDocParents.DOC_PROVIDER_NAME); ArrayList<String> secondKeys = new ArrayList<String>(secondKeyMaster); String firstKey = XDocParents.DOC_PROVIDER_NAME; try { if (includeDoc) { docParents.add(docRef); } boolean hasMore = false; do { List<DocumentReference> parentList = docParentProviderMap.get(firstKey ).getDocumentParentsList(docRef); if (parentList.size() > 0) { joinParentLists(docParents, parentList); docRef = docParents.get(docParents.size() - 1); } hasMore = false; if (secondKeys.size() > 0) { int secKeyIndex = -1; parentList = Collections.emptyList(); while (((secKeyIndex + 1) < secondKeys.size()) && ((parentList == null) || parentList.isEmpty())) { secKeyIndex = secKeyIndex + 1; parentList = docParentProviderMap.get(secondKeys.get(secKeyIndex) ).getDocumentParentsList(docRef); } hasMore = ((parentList != null) && !parentList.isEmpty()); if (hasMore) { joinParentLists(docParents, parentList); docRef = docParents.get(docParents.size() - 1); secondKeys = new ArrayList<String>(secondKeyMaster); secondKeys.remove(secKeyIndex); } } } while (hasMore); } catch (XDocRecursionException recExp) { _LOGGER.info("Recursion in document parents found [" + recExp + "]."); } return docParents; }
Source:
<code>private boolean hasGroupItemChanged(Item item1, Item item2) { GroupItem gItem1 = null; GroupItem gItem2 = null; if (item1 instanceof GroupItem) { gItem1 = (GroupItem) item1; } if (item2 instanceof GroupItem) { gItem2 = (GroupItem) item2; } if (gItem1 == null && gItem2 == null) { return false; } if ((gItem1 != null && gItem2 == null) || (gItem1 == null && gItem2 != null)) { return true; } boolean sameBaseItemClass = false; if (gItem1.getBaseItem() != null && gItem2.getBaseItem() != null) { sameBaseItemClass = Objects.equals(gItem1.getBaseItem().getClass(), gItem2.getBaseItem().getClass()); } boolean sameFunction = false; GroupFunction gf1 = gItem1.getFunction(); GroupFunction gf2 = gItem2.getFunction(); if (gf1 != null && gf2 != null) { if (Objects.equals(gf1.getClass(), gf2.getClass())) { sameFunction = Arrays.equals(gf1.getParameters(), gf2.getParameters()); } } boolean sameMembers = true; Set<Item> members1 = gItem1.getMembers(); Set<Item> members2 = gItem2.getMembers(); if (members1 != null && members2 != null) { if (members1.size() != members2.size()) { <START> sameMembers = false; <END> } else { sameMembers = Objects.equals(members1, members2); } } else if ((gItem1.getMembers() == null && gItem2.getMembers() != null) || gItem1.getMembers() != null && gItem2.getMembers() == null) { sameMembers = false; } return !(sameBaseItemClass && sameFunction && sameMembers); }</code><technical_language>case covered Objects.equals(members1, members2)</technical_language>

Target:
private boolean hasGroupItemChanged(Item item1, Item item2) { GroupItem gItem1 = null; GroupItem gItem2 = null; if (item1 instanceof GroupItem) { gItem1 = (GroupItem) item1; } if (item2 instanceof GroupItem) { gItem2 = (GroupItem) item2; } if (gItem1 == null && gItem2 == null) { return false; } if ((gItem1 != null && gItem2 == null) || (gItem1 == null && gItem2 != null)) { return true; } boolean sameBaseItemClass = Objects.equals(gItem1.getBaseItem(), gItem2.getBaseItem()); boolean sameFunction = false; GroupFunction gf1 = gItem1.getFunction(); GroupFunction gf2 = gItem2.getFunction(); if (gf1 != null && gf2 != null) { if (Objects.equals(gf1.getClass(), gf2.getClass())) { sameFunction = Arrays.equals(gf1.getParameters(), gf2.getParameters()); } } else if (gf1 == null && gf2 == null) { sameFunction = true; } boolean sameMembers = Objects.equals(gItem1.getMembers(), gItem2.getMembers()); return !(sameBaseItemClass && sameFunction && sameMembers); }
Source:
<code>public void removeMouseListener(MouseListener listener) { if <START> (this.dropdownTableViewer != <END> null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeMouseListener(listener); }</code><technical_language>a check for viewer here? this dropdownTable? table</technical_language>

Target:
public void removeMouseListener(MouseListener listener) { if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeMouseListener(listener); }
Source:
<code>public boolean isIdProperty() { <START> return isAnnotationPresent(Id.class) || super.isIdProperty() || this.getFieldName().equals("id"); <END> }</code><technical_language>check case more resilient</technical_language>

Target:
public boolean isIdProperty() { return isAnnotationPresent(Id.class) || super.isIdProperty() || this.getFieldName().toLowerCase(Locale.ROOT).equals("id"); }
Source:
<code>public boolean shouldWait() { if (resultSet == null) { resultSet = createResultSet(); sequence = startSequence; } final EventJournal<J> journal = getJournal(); final int partitionId = getPartitionId(); journal.cleanup(namespace, partitionId); sequence = clampToBounds(journal, partitionId, sequence); if (minSize == 0) { if (!journal.isNextAvailableSequence(namespace, partitionId, sequence)) { sequence = journal.readMany(namespace, partitionId, sequence, resultSet); <START> resultSet.setNextSequenceToReadFrom(sequence); <END> } return false; } if (resultSet.isMinSizeReached()) { return false; } if (journal.isNextAvailableSequence(namespace, partitionId, sequence)) { return true; } sequence = journal.readMany(namespace, partitionId, sequence, resultSet); resultSet.setNextSequenceToReadFrom(sequence); return !resultSet.isMinSizeReached(); }</code><technical_language>duplicate lines 137-138, refactor method</technical_language>

Target:
public boolean shouldWait() { if (resultSet == null) { resultSet = createResultSet(); sequence = startSequence; } final EventJournal<J> journal = getJournal(); final int partitionId = getPartitionId(); journal.cleanup(namespace, partitionId); sequence = clampToBounds(journal, partitionId, sequence); if (minSize == 0) { if (!journal.isNextAvailableSequence(namespace, partitionId, sequence)) { readMany(journal, partitionId); } return false; } if (resultSet.isMinSizeReached()) { return false; } if (journal.isNextAvailableSequence(namespace, partitionId, sequence)) { return true; } readMany(journal, partitionId); return !resultSet.isMinSizeReached(); }
Source:
<code>public void close() throws IOException { if ( flusher != null ) { stopFlushingPageCache(); } flushAndForce(); <START> safeClose( propertyKeyRepository, labelRepository, relationshipTypeRepository ); <END> life.shutdown(); safeClose( neoStores, temporaryNeoStores ); if ( !externalPageCache ) { pageCache.close(); } if ( successful ) { cleanup(); } }</code><technical_language>this safeClose is safe, correct in IOUtils, please instead</technical_language>

Target:
public void close() throws IOException { if ( flusher != null ) { stopFlushingPageCache(); } flushAndForce(); closeAll( propertyKeyRepository, labelRepository, relationshipTypeRepository ); life.shutdown(); closeAll( neoStores, temporaryNeoStores ); if ( !externalPageCache ) { pageCache.close(); } if ( successful ) { cleanup(); } }
Source:
<code>public void afterRegionDestroyIsInvokedInEveryMember() { CacheListener<String, Integer> listener = new RegionDestroyCountingCacheListener(); Region<String, Integer> region = createRegion(regionName, listener); for (int i = 0; i < getVMCount(); i++) { getVM(i).invoke(() -> { createRegion(regionName, listener); }); } region.destroyRegion(); <START> if (region instanceof PartitionedRegion) { <END> assertThat(sharedCountersRule.getTotal(REGION_DESTROY)) .isGreaterThanOrEqualTo(expectedRegionDestroys()); } else { assertThat(sharedCountersRule.getTotal(REGION_DESTROY)).isEqualTo(expectedRegionDestroys()); } }</code><technical_language>typically want avoid if-else blocks this, separate tests. for PR for Replicate. test class is ReplicateCacheListenerDistributedTest. I find PartitionedRegions created in this test. this belong in PRCacheListenerDistributedTest instead</technical_language>

Target:
public void afterRegionDestroyIsInvokedInEveryMember() { CacheListener<String, Integer> listener = new RegionDestroyCountingCacheListener(); Region<String, Integer> region = createRegion(regionName, listener); for (int i = 0; i < getVMCount(); i++) { getVM(i).invoke(() -> { createRegion(regionName, listener); }); } region.destroyRegion(); assertThat(sharedCountersRule.getTotal(REGION_DESTROY)).isEqualTo(expectedRegionDestroys()); }
Source:
<code>protected <K, V> Store<K, V> wrap(Store<K, V> store, Store.Configuration<K, V> storeConfig, ServiceConfiguration<?, ?>... serviceConfigs) { DelegatingLoaderWriterStore<K, V> loaderWriterStore = new DelegatingLoaderWriterStore<>(store); <START> serviceProvider.getService(StatisticsService.class).registerWithParent(store, loaderWriterStore); <END> return loaderWriterStore; }</code><technical_language>If move this in caller of subclasses of AbstractWrapperStoreProvider need care StatisticsService</technical_language>

Target:
protected <K, V> Store<K, V> wrap(Store<K, V> store, Store.Configuration<K, V> storeConfig, ServiceConfiguration<?, ?>... serviceConfigs) { DelegatingLoaderWriterStore<K, V> loaderWriterStore = new DelegatingLoaderWriterStore<>(store); return loaderWriterStore; }
Source:
<code>public void onPackageAdded(String packageName) { final PackageInfo app = getPackageInfo(packageName); if (app == null) { Slog.wtf(TAG, "Failed to get information of installed package: " + packageName); return; } int uid = (app.applicationInfo != null) ? app.applicationInfo.uid : INVALID_UID; <START> if (uid == INVALID_UID) { return; <END> } sendPackagePermissionsForUid(uid, filterPermission(Arrays.asList(app.requestedPermissions))); synchronized (mPackageNameUidMap) { mPackageNameUidMap.put(packageName, uid); } }</code><technical_language>this happen? a wtf here</technical_language>

Target:
public void onPackageAdded(String packageName) { final PackageInfo app = getPackageInfo(packageName); if (app == null) { Slog.wtf(TAG, "Failed to get information of installed package: " + packageName); return; } int uid = (app.applicationInfo != null) ? app.applicationInfo.uid : INVALID_UID; if (uid == INVALID_UID) { Slog.wtf(TAG, "Failed to get the uid of installed package: " + packageName + "uid: " + uid); return; } if (app.requestedPermissions == null) { return; } sendPackagePermissionsForUid(uid, filterPermission(Arrays.asList(app.requestedPermissions))); synchronized (mPackageNameUidMap) { mPackageNameUidMap.put(packageName, uid); } }
Source:
<code>public void start() { long minSleepTime = <START> env.getConfiguration().getInt(FluoConfigurationImpl.MIN_SLEEP_TIME_PROP, <END> FluoConfigurationImpl.MIN_SLEEP_TIME_DEFAULT); long maxSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.MAX_SLEEP_TIME_PROP, FluoConfigurationImpl.MAX_SLEEP_TIME_DEFAULT); paritionManager = new ParitionManager(env, minSleepTime, maxSleepTime); scanThread = new Thread(new ScanTask(this, processor, paritionManager, env, stopped, minSleepTime, maxSleepTime)); scanThread.setName(getClass().getSimpleName() + " " + ScanTask.class.getSimpleName()); scanThread.setDaemon(true); scanThread.start(); }</code><technical_language>name MIN_SLEEP_TIME. for MAX_SLEEP_TIME</technical_language>

Target:
public void start() { long minSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_PROP, FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_DEFAULT); long maxSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_PROP, FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_DEFAULT); paritionManager = new ParitionManager(env, minSleepTime, maxSleepTime); scanThread = new Thread(new ScanTask(this, processor, paritionManager, env, stopped, minSleepTime, maxSleepTime)); scanThread.setName(getClass().getSimpleName() + " " + ScanTask.class.getSimpleName()); scanThread.setDaemon(true); scanThread.start(); }
Source:
<code>protected CompletableFuture<?> completeSingleWriteOnPrimaryOriginator(DataWriteCommand command, Address backup, CompletableFuture<?> rpcFuture) { CompletableFuture<?> revokeFuture = revokeBiasSync(command.getKey(), backup, command.getTopologyId()); <START> return revokeFuture == null ? rpcFuture : CompletableFuture.allOf(rpcFuture, revokeFuture); <END> }</code><technical_language>revokeFuture is null</technical_language>

Target:
protected CompletableFuture<?> completeSingleWriteOnPrimaryOriginator(DataWriteCommand command, Address backup, CompletableFuture<?> rpcFuture) { CompletableFuture<?> revokeFuture = revokeBiasSync(command.getKey(), backup, command.getTopologyId()); return CompletableFuture.allOf(rpcFuture, revokeFuture); }
Source:
<code>public void should_print_error_message_when_invalid_command_is_given() throws Exception { execute("foo"); assertFailure(); assertNoOutput(out); <START> assertContains("\"foo\" is not a valid value for \"<command>\"", err); <END> assertContains("Usage: java -jar jacococli.jar -help | <command>", err); }</code><technical_language>@marchof wondering in case of invalid command exit code is zero? $ java -jar jacococli.jar test $ echo $? 0</technical_language>

Target:
public void should_print_error_message_when_invalid_command_is_given() throws Exception { execute("foo"); assertFailure(); assertNoOutput(out); assertContains("\"foo\" is not a valid value for \"<command>\"", err); assertContains("Usage: java -jar jacococli.jar --help | <command>", err); }
Source:
<code>private static byte[] flags(EnumSet<AdminFlag> flags) { <START> StringJoiner sj = new StringJoiner(","); <END> flags.forEach(f -> sj.add(f.name())); return string(sj.toString()); }</code><technical_language>do flags.stream().collect(Collectors.joining(",")); instead</technical_language>

Target:
private static byte[] flags(EnumSet<AdminFlag> flags) { String sFlags = flags.stream().map(AdminFlag::toString).collect(Collectors.joining(",")); return string(sFlags); }
Source:
<code>public boolean isHidden(Path path) throws IOException { if (context.getLayout() == StorageFileLayout.OBJECT_ID) { <START> return path.getFileName().endsWith(".bai") || path.getFileName().endsWith(".tbi"); <END> } return false; }</code><technical_language>IndexFileType.isIndexFile(path.getFileName)</technical_language>

Target:
public boolean isHidden(Path path) throws IOException { if (context.getLayout() == StorageFileLayout.OBJECT_ID) { return IndexFileType.isIndexFile(path.getFileName().toString()); } return false; }
Source:
<code>public String processText(InputStream in) throws IOException { <START> String text = IOUtils.toString(in, StandardCharsets.UTF_8); <END> return processText(text); }</code><technical_language>import static StandardCharsets.UTF_8 for more concise code</technical_language>

Target:
public String processText(InputStream in) throws IOException { String text = IOUtils.toString(in, UTF_8); return processText(text); }
Source:
<code>public Object getParameter(String name) { Object paramValue = fParameters.get(name); <START> ITmfTrace trace = getTrace(); <END> if ((paramValue == null) && (trace != null)) { for (IAnalysisParameterProvider provider : fParameterProviders) { paramValue = provider.getParameter(name); if (paramValue != null) { break; } } } return paramValue; }</code><technical_language>Unnecessary</technical_language>

Target:
public Object getParameter(String name) { Object paramValue = fParameters.get(name); if ((paramValue == null) && (fTrace != null)) { for (IAnalysisParameterProvider provider : fParameterProviders) { paramValue = provider.getParameter(name); if (paramValue != null) { break; } } } return paramValue; }
Source:
<code>protected String insertResultEntity(InputStream stream, String id, String type, String mimeType) { BufferedInputStream dataStream = new BufferedInputStream(stream, DATA_BUFFER_SIZE); boolean isOutput = null != id && id.toLowerCase().contains("output"); if (isOutput && !Boolean.parseBoolean(getDatabaseProperties("saveResultsToDB"))) { try { dataStream = writeDataToDiskWithGZIP(id, stream); } catch (Exception ex) { LOGGER.error("Failed to write output data to disk", ex); } } try (Connection connection = getConnection(); PreparedStatement myInsertSQL = connection.prepareStatement(insertionString)) { <START> myInsertSQL.setString(INSERT_COLUMN_REQUEST_ID, id); <END> myInsertSQL.setTimestamp(INSERT_COLUMN_REQUEST_DATE, new Timestamp(Calendar.getInstance().getTimeInMillis())); myInsertSQL.setString(INSERT_COLUMN_RESPONSE_TYPE, type); myInsertSQL.setString(INSERT_COLUMN_MIME_TYPE, mimeType); myInsertSQL.setAsciiStream(INSERT_COLUMN_RESPONSE, dataStream, DATA_BUFFER_SIZE); myInsertSQL.executeUpdate(); LOGGER.debug("inserted request into database", id); } catch (SQLException ex) { LOGGER.error("Failed to insert result data into the database", ex); } return generateRetrieveResultURL(id); }</code><technical_language>Whats weird my\* variable naming</technical_language>

Target:
protected String insertResultEntity(InputStream stream, String id, String type, String mimeType) { BufferedInputStream dataStream = new BufferedInputStream(stream, DATA_BUFFER_SIZE); boolean isOutput = null != id && id.toLowerCase().contains("output"); if (isOutput && !Boolean.parseBoolean(getDatabaseProperties("saveResultsToDB"))) { try { dataStream = writeDataToDiskWithGZIP(id, stream); } catch (Exception ex) { LOGGER.error("Failed to write output data to disk", ex); } } try (Connection connection = getConnection(); PreparedStatement insertStatement = connection.prepareStatement(insertionString)) { insertStatement.setString(INSERT_COLUMN_REQUEST_ID, id); insertStatement.setTimestamp(INSERT_COLUMN_REQUEST_DATE, new Timestamp(Calendar.getInstance().getTimeInMillis())); insertStatement.setString(INSERT_COLUMN_RESPONSE_TYPE, type); insertStatement.setString(INSERT_COLUMN_MIME_TYPE, mimeType); insertStatement.setAsciiStream(INSERT_COLUMN_RESPONSE, dataStream, DATA_BUFFER_SIZE); insertStatement.executeUpdate(); LOGGER.debug("inserted request into database", id); } catch (SQLException ex) { LOGGER.error("Failed to insert result data into the database", ex); } return generateRetrieveResultURL(id); }
Source:
<code>private void verifyMediaContent(Question question) { String questionValue = getResponseValue(question); if (!TextUtils.isEmpty(questionValue)) { ViewInteraction downloadButton = onView( allOf(withId(R.id.media_download), withQuestionViewParent(question, MediaQuestionView.class))) .perform(scrollTo()); downloadButton.check(matches(isDisplayed())); <START> downloadButton.perform(click()); <END> } }</code><technical_language>Is supposed happen observed/checked click</technical_language>

Target:
private void verifyMediaContent(Question question) { String questionValue = getResponseValue(question); if (!TextUtils.isEmpty(questionValue)) { ViewInteraction downloadButton = onView( allOf(withId(R.id.media_download), withQuestionViewParent(question, MediaQuestionView.class))) .perform(scrollTo()); downloadButton.check(matches(allOf(isDisplayed(), isEnabled()))); } }
Source:
<code>public String getHelpNote(ConfigKey key) { <START> return getHelpNoteByType(key, "a comma delimited sub collection of any of the possible values"); <END> }</code><technical_language>a comma delimited subset of of values</technical_language>

Target:
public String getHelpNote(ConfigKey key) { return getHelpNoteByType(key, "a comma delimited subset of any of the possible values"); }
Source:
<code>public void destroy() { clearPartition(false); storage.destroy(false); eventJournal.destroy(mapContainer.getObjectNamespace(), partitionId); <START> mutationObserver.onClear(); <END> }</code><technical_language>worth onDestroy method. map is destroyed, want release resources map - event journal, merkle tree... a clear operation</technical_language>

Target:
public void destroy() { clearPartition(false, true); storage.destroy(false); mutationObserver.onDestroy(false); }
Source:
<code>public void deleteGroupUnprocessableTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson reviewer1 = EPersonBuilder.createEPerson(context) .withEmail("reviewer1@example.com") .withPassword(password) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .withWorkflowGroup(1, admin, reviewer1) .build(); final Group workflowGroup = col1.getWorkflowStep1(context); context.commit(); <START> context.reloadEntity(workflowGroup); <END> String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + workflowGroup.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + workflowGroup.getID()) ).andExpect(status().isUnprocessableEntity()); getClient(authToken).perform( get("/api/eperson/groups/" + workflowGroup.getID()) ).andExpect(status().isOk()); }</code><technical_language>above. GroupBuilder, missing a context.restoreAuthSystemState(); question commit() reloadEntity() above</technical_language>

Target:
public void deleteGroupUnprocessableTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson reviewer1 = EPersonBuilder.createEPerson(context) .withEmail("reviewer1@example.com") .withPassword(password) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .withWorkflowGroup(1, admin, reviewer1) .build(); Group workflowGroup = col1.getWorkflowStep1(context); context.restoreAuthSystemState(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + workflowGroup.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + workflowGroup.getID()) ).andExpect(status().isUnprocessableEntity()); getClient(authToken).perform( get("/api/eperson/groups/" + workflowGroup.getID()) ).andExpect(status().isOk()); }
Source:
<code>public void dispose() { logger.debug("Disposing thing {}", getThing().getUID()); if (schedulerFuture != null && !schedulerFuture.isCancelled()) { schedulerFuture.cancel(true); schedulerFuture = null; <START> } <END> if (scheduledExecutor.isPresent()) { final ExpressionThreadPoolExecutor executor = scheduledExecutor.get(); executor.shutdownNow(); scheduledExecutor = Optional.empty(); } logger.debug("Thing disposed", getThing().getUID()); }</code><technical_language>stopJobs() longer necessary</technical_language>

Target:
public void dispose() { logger.debug("Disposing thing {}", getThing().getUID()); if (schedulerFuture != null && !schedulerFuture.isCancelled()) { schedulerFuture.cancel(true); schedulerFuture = null; } stopJobs(); logger.debug("Thing disposed", getThing().getUID()); }
Source:
<code>private boolean validateUnregisteredEntity(VmTemplate entityFromConfiguration, OvfEntityData ovfEntityData) { if (ovfEntityData == null && !getParameters().isImportAsNewEntity()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_UNSUPPORTED_OVF); } if (entityFromConfiguration == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED); } if <START> (getImages().size() > 0 && <END> !ImagesHandler.isImagesExists(getImages(), getStoragePool().getId())) { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } for (DiskImage image : getImages()) { StorageDomain sd = getStorageDomainDao().getForStoragePool( image.getStorageIds().get(0), getStoragePool().getId()); if (!validate(new StorageDomainValidator(sd).isDomainExistAndActive())) { return false; } } if (!getStorageDomain().getStorageDomainType().isDataDomain()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED, String.format("$domainId %1$s", getParameters().getStorageDomainId()), String.format("$domainType %1$s", getStorageDomain().getStorageDomainType())); } return true; }</code><technical_language>This check is redundant</technical_language>

Target:
private boolean validateUnregisteredEntity(VmTemplate entityFromConfiguration, OvfEntityData ovfEntityData) { if (ovfEntityData == null && !getParameters().isImportAsNewEntity()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_UNSUPPORTED_OVF); } if (entityFromConfiguration == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED); } if (!ImagesHandler.isImagesExists(getImages(), getStoragePool().getId())) { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } for (DiskImage image : getImages()) { StorageDomain sd = getStorageDomainDao().getForStoragePool( image.getStorageIds().get(0), getStoragePool().getId()); if (!validate(new StorageDomainValidator(sd).isDomainExistAndActive())) { return false; } } if (!getStorageDomain().getStorageDomainType().isDataDomain()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED, String.format("$domainId %1$s", getParameters().getStorageDomainId()), String.format("$domainType %1$s", getStorageDomain().getStorageDomainType())); } return true; }