auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void tryUpdateCache(String currentVersion) throws Exception { boolean updatedCacheSuccessfully = false; VersionedCache newVersionedCache = null; try { newVersionedCache = cacheGenerator.generateCache(namespace, this, currentVersion, CacheScheduler.this ); if (newVersionedCache != null) { CacheState previousCacheState = swapCacheState(newVersionedCache); if (previousCacheState != NoCache.ENTRY_CLOSED) { updatedCacheSuccessfully = true; <START> if (previousCacheState instanceof VersionedCache && !(newVersionedCache).incremental) { <END> ((VersionedCache) previousCacheState).close(); } log.debug("%s: the cache was successfully updated", this); } else { newVersionedCache.close(); log.debug("%s was closed while the cache was being updated, discarding the update", this); } } else { log.debug("%s: Version `%s` not updated, the cache is not updated", this, currentVersion); } } catch (Throwable t) { try { if (newVersionedCache != null && !updatedCacheSuccessfully) { newVersionedCache.close(); } log.error(t, "Failed to update %s", this); } catch (Exception e) { t.addSuppressed(e); } if (Thread.currentThread().isInterrupted() || t instanceof InterruptedException || t instanceof Error) { throw t; } } }</code><technical_language>more robust compare previousCacheState's newVersionedCache's cacheHandlers identical. Also, previous VersionedCache "close", a no-op. I log a custom message</technical_language>

Target:
private void tryUpdateCache(String currentVersion) throws Exception { boolean updatedCacheSuccessfully = false; VersionedCache newVersionedCache = null; try { newVersionedCache = cacheGenerator.generateCache(namespace, this, currentVersion, CacheScheduler.this ); if (newVersionedCache != null) { CacheState previousCacheState = swapCacheState(newVersionedCache); if (previousCacheState != NoCache.ENTRY_CLOSED) { updatedCacheSuccessfully = true; if (previousCacheState instanceof VersionedCache) { ((VersionedCache) previousCacheState).close(); } log.debug("%s: the cache was successfully updated", this); } else { newVersionedCache.close(); log.debug("%s was closed while the cache was being updated, discarding the update", this); } } else { log.debug("%s: Version `%s` not updated, the cache is not updated", this, currentVersion); } } catch (Throwable t) { try { if (newVersionedCache != null && !updatedCacheSuccessfully) { newVersionedCache.close(); } log.error(t, "Failed to update %s", this); } catch (Exception e) { t.addSuppressed(e); } if (Thread.currentThread().isInterrupted() || t instanceof InterruptedException || t instanceof Error) { throw t; } } }
Source:
<code>public void regenerateCertificatesOf(String productId, boolean lazy) { if (lazy) { poolCurator.markCertificatesDirtyForProductId(productId); } else { List<Pool> poolsForProduct = this.listAvailableEntitlementPools(null, null, null, productId, new Date(), false, false, new PoolFilterBuilder(), null, false, false) .getPageData(); for (Pool pool : poolsForProduct) { <START> regenerateCertificatesOf(pool.getEntitlements(), lazy); <END> } } }</code><technical_language>need pass lazy here, false this point</technical_language>

Target:
public void regenerateCertificatesOf(String productId, boolean lazy) { if (lazy) { poolCurator.markCertificatesDirtyForProductId(productId); } else { List<Pool> poolsForProduct = this.listAvailableEntitlementPools(null, null, null, productId, new Date(), false, false, new PoolFilterBuilder(), null, false, false) .getPageData(); for (Pool pool : poolsForProduct) { regenerateCertificatesOf(pool.getEntitlements(), false); } } }
Source:
<code>public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new EnableMaterial(LIGHT_GEOMETRY_MATERIAL.toString())); lightGeometryMaterial = getMaterial(LIGHT_GEOMETRY_MATERIAL); addDesiredStateChange(new DisableDepthTest()); addDesiredStateChange(new EnableBlending()); addDesiredStateChange(new SetBlendFunction(GL_ONE, GL_ONE_MINUS_SRC_COLOR)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); update(); initMainDirectionalLight(); <START> displayResolutionDependentFBOs.subscribe(this); <END> }</code><technical_language>Move please</technical_language>

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new EnableMaterial(LIGHT_GEOMETRY_MATERIAL.toString())); lightGeometryMaterial = getMaterial(LIGHT_GEOMETRY_MATERIAL); addDesiredStateChange(new DisableDepthTest()); addDesiredStateChange(new EnableBlending()); addDesiredStateChange(new SetBlendFunction(GL_ONE, GL_ONE_MINUS_SRC_COLOR)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); initMainDirectionalLight(); }
Source:
<code><START> public int reOpenChannel(Integer channelId, String newSecWebSocketKey, boolean followRedirects, boolean useSessionState) throws IllegalArgumentException, RequestOutOfScopeException, IOException { <END> WebSocketProxy connectionToEstablish = getWebSocketProxy(channelId); HandshakeConfig handshakeConfig; try { handshakeConfig = connectionToEstablish.getHandShakeConfig(); }catch (IllegalArgumentException e){ throw e; } handshakeConfig.setFollowRedirects(followRedirects); handshakeConfig.setUseSessionState(useSessionState); if(newSecWebSocketKey != null){ HttpHandshakeBuilder.setWebSocketKey(handshakeConfig.getHttpMessage().getRequestHeader(), newSecWebSocketKey); }else{ HttpHandshakeBuilder.setGeneratedWebSocketKey(handshakeConfig.getHttpMessage().getRequestHeader()); } WebSocketProxy newWebSocketConnection = connectionToEstablish.reEstablishConnection(handshakeConfig); addHistoryReference(handshakeConfig.getHttpMessage(), newWebSocketConnection); return newWebSocketConnection != null ? newWebSocketConnection.getChannelId() : -1; }</code><technical_language>exception IllegalArgumentException removed throws clause (it's unchecked)</technical_language>

Target:
public int reOpenChannel(Integer channelId, String newSecWebSocketKey, boolean followRedirects, boolean useSessionState) throws RequestOutOfScopeException, IOException { WebSocketProxy connectionToEstablish = getWebSocketProxy(channelId); HandshakeConfig handshakeConfig; handshakeConfig = connectionToEstablish.getHandShakeConfig(); handshakeConfig.setFollowRedirects(followRedirects); handshakeConfig.setUseSessionState(useSessionState); if(newSecWebSocketKey != null){ HttpHandshakeBuilder.setWebSocketKey(handshakeConfig.getHttpMessage().getRequestHeader(), newSecWebSocketKey); }else{ HttpHandshakeBuilder.setGeneratedWebSocketKey(handshakeConfig.getHttpMessage().getRequestHeader()); } WebSocketProxy newWebSocketConnection = connectionToEstablish.reEstablishConnection(handshakeConfig); addHistoryReference(handshakeConfig.getHttpMessage(), newWebSocketConnection); return newWebSocketConnection != null ? newWebSocketConnection.getChannelId() : -1; }
Source:
<code>public void filterTextFieldTest() { doubleClick("#dummy/dummy_col0_filterTextField"); push(KeyCode.BACK_SPACE); <START> type("(is:open OR is:closed)"); <END> push(KeyCode.ENTER); }</code><technical_language>parentheses needed</technical_language>

Target:
public void filterTextFieldTest() { doubleClick("#dummy/dummy_col0_filterTextField"); push(KeyCode.BACK_SPACE); type("is:open OR is:closed"); push(KeyCode.ENTER); FilterTextField filterTextField = find("#dummy/dummy_col0_filterTextField"); filterTextField.clear(); click("#dummy/dummy_col0_filterTextField"); type("!@#$%^&*( ) { } :?"); assertEquals("!@#$%^&*( ) { } :?", filterTextField.getText()); }
Source:
<code>private Void updatePropertiesFile() { String etcDir = getProperty(KARAF_ETC); String systemPropertyFilename = etcDir + File.separator + SYSTEM_PROPERTIES_FILE; File systemPropertiesFile = new File(systemPropertyFilename); try { Properties systemDotProperties = new Properties(systemPropertiesFile); systemDotProperties.setProperty(SOLR_PASSWORD_PROPERTY_NAME, newPasswordWrappedEncrypted); systemDotProperties.save(); passwordSavedSuccessfully = true; String msg = String.format( "Updated encrypted Solr password in properties file %s.", systemPropertyFilename); SecurityLogger.audit(msg); LOGGER.info(msg); } catch (IOException e) { String msgFail = String.format( <START> "Exception while writing to %s. Solr password was changed, but new password was not saved.", <END> systemPropertyFilename); LOGGER.error(msgFail); SecurityLogger.audit(msgFail); } return null; }</code><technical_language>Is recover this? give some kind of action take</technical_language>

Target:
private Void updatePropertiesFile() { String etcDir = getProperty(KARAF_ETC); String systemPropertyFilename = etcDir + File.separator + SYSTEM_PROPERTIES_FILE; File systemPropertiesFile = new File(systemPropertyFilename); try { Properties systemDotProperties = new Properties(systemPropertiesFile); systemDotProperties.setProperty(SOLR_PASSWORD_PROPERTY_NAME, newPasswordWrappedEncrypted); systemDotProperties.save(); passwordSavedSuccessfully = true; String msg = String.format( "Updated encrypted Solr password in properties file %s.", systemPropertyFilename); SecurityLogger.audit(msg); LOGGER.info(msg); } catch (IOException e) { String msgFail = String.format( "Exception while writing to %s. Solr password was changed, but new password was not saved. The application cannot communicate with Solr until the password is restored.", systemPropertyFilename); LOGGER.error(msgFail); SecurityLogger.audit(msgFail); } return null; }
Source:
<code>public Map<String, Object> currentState() { <START> return null; <END> }</code><technical_language>return empty Hashmap null.. Check upstream code.</technical_language>

Target:
public Map<String, Object> currentState() { return new HashMap<>(); }
Source:
<code>private PollingContext(PollResponse<T> activationResponse, PollResponse<T> latestResponse, Map<String, String> map) { <START> this.activationResponse = Objects.requireNonNull(activationResponse, <END> "'activationResponse' cannot be null."); this.latestResponse = Objects.requireNonNull(latestResponse, "'latestResponse' cannot be null."); this.map = map; }</code><technical_language>This throw NPE. PollingContext<String> context = new PollingContext<>(); context.clone();</technical_language>

Target:
private PollingContext(PollResponse<T> activationResponse, PollResponse<T> latestResponse, Map<String, String> map) { this.activationResponse = Objects.requireNonNull(activationResponse, "'activationResponse' cannot be null."); this.latestResponse = Objects.requireNonNull(latestResponse, "'latestResponse' cannot be null."); this.map = Objects.requireNonNull(map, "'map' cannot be null."); }
Source:
<code>private static int checkResponseCode(String responseCode, String method){ if ("403".equalsIgnoreCase(responseCode)) { Log.w(TAG, "CommonSense" + method + "refused! Response: forbidden!"); return -3; <START> } else if ("201".equalsIgnoreCase(responseCode)) { <END> Log.e(TAG, "CommonSense" + method + "created! Response: " + responseCode); return -2; } else if (!"200".equalsIgnoreCase(responseCode)) { Log.w(TAG, "CommonSense" + method + "failed! Response: " + responseCode); return -1; } else { Log.e(TAG, "CommonSense" + method + "OK! "); return 0; } }</code><technical_language>@excaliburnan a problem, for clarity I 0 positive values for positive results 201 1</technical_language>

Target:
private static int checkResponseCode(String responseCode, String method){ if ("403".equalsIgnoreCase(responseCode)) { Log.w(TAG, "CommonSense" + method + "refused! Response: forbidden!"); return -2; } else if ("201".equalsIgnoreCase(responseCode)) { Log.e(TAG, "CommonSense" + method + "created! Response: " + responseCode); return 1; } else if (!"200".equalsIgnoreCase(responseCode)) { Log.w(TAG, "CommonSense" + method + "failed! Response: " + responseCode); return -1; } else { Log.e(TAG, "CommonSense" + method + "OK! "); return 0; } }
Source:
<code>public void checkoutBranch(@ScriptParameter(defaultValue = NULL) Object repository, @ScriptParameter(defaultValue = NULL) final String branchName) { try { Ref branchRef = ((Repository) repository).findRef(branchName); BranchOperationUI.checkout((Repository) repository, branchRef.getName()).start(); } catch (IOException e) { <START> Activator.logError("Failed to checkout branch " + branchName, e); <END> } }</code><technical_language>o.e.ease.Logger class log error messages. get rid of Activator speeds bundle loading. is bundle ID put interface IBundleConstants similar</technical_language>

Target:
public void checkoutBranch(@ScriptParameter(defaultValue = NULL) Object repository, @ScriptParameter(defaultValue = NULL) final String branchName) { try { final Ref branchRef = ((Repository) repository).findRef(branchName); BranchOperationUI.checkout((Repository) repository, branchRef.getName()).start(); } catch (final IOException e) { Logger.error(PLUGIN_ID, "Failed to checkout branch " + branchName, e); } }
Source:
<code>private String createMacAddress(String value) { StringBuilder builder = new StringBuilder(); for (int j = 0; j < value.length(); j += 2) { String group = value.substring(j, j + 2); <START> if (j == 0) { <END> if (StringUtils.contains(MAC_ADDRESS_MULTICAST_MSB, group.charAt(1))) { return null; } } builder.append(group); builder.append(":"); } builder.deleteCharAt(builder.length() - 1); return builder.toString(); }</code><technical_language>&& instead of nested if</technical_language>

Target:
private String createMacAddress(String value) { StringBuilder builder = new StringBuilder(); for (int j = 0; j < value.length(); j += 2) { String group = value.substring(j, j + 2); if (j == 0 && StringUtils.contains(MAC_ADDRESS_MULTICAST_LSB, group.charAt(1))) { return null; } builder.append(group); if (j + 2 < value.length()) { builder.append(":"); } } return builder.toString(); }
Source:
<code>protected String visitSimpleCaseExpression(SimpleCaseExpression node, @Nullable List<Expression> parameters) { <START> ArrayList<String> parts = new ArrayList<>(); <END> parts.add("CASE"); parts.add(node.getOperand().accept(this, parameters)); for (WhenClause whenClause : node.getWhenClauses()) { parts.add(whenClause.accept(this, parameters)); } if (node.getDefaultValue() != null) { parts.add("ELSE"); parts.add(node.getDefaultValue().accept(this, parameters)); } parts.add("END"); return "(" + Lists2.joinOn(" ", parts, x -> x) + ")"; }</code><technical_language>a StringBuilder StringJoiner</technical_language>

Target:
protected String visitSimpleCaseExpression(SimpleCaseExpression node, @Nullable List<Expression> parameters) { var parts = new StringJoiner(" ", "(", ")"); parts.add("CASE"); parts.add(node.getOperand().accept(this, parameters)); for (WhenClause whenClause : node.getWhenClauses()) { parts.add(whenClause.accept(this, parameters)); } if (node.getDefaultValue() != null) { parts.add("ELSE"); parts.add(node.getDefaultValue().accept(this, parameters)); } parts.add("END"); return parts.toString(); }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); if (!m_compTasks.isEmpty()){ for (Pair<CompleteTransactionTask, Boolean> pair : m_compTasks.values()) <START> builder.append("CompleteTransactionTasks: " + pair); <END> builder.append("\n"); } if (m_fragTask != null) { builder.append("FragmentTask: " + m_fragTask); } return builder.toString(); }</code><technical_language>This indented and/or parenthesis body of for loop. pair appended concatenated a string appended. builder.append("CompleteTransactionTasks: ").append(pair); output of this a bit strange separators completion strings. append a comma space task strings</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); if (!m_compTasks.isEmpty()){ builder.append("CompleteTransactionTasks: "); for (Pair<CompleteTransactionTask, Boolean> pair : m_compTasks.values()) { builder.append("\n" + pair); } } if (m_fragTask != null) { builder.append("\nFragmentTask: " + m_fragTask); } return builder.toString(); }
Source:
<code>private Map<String, DbParameterAccessor> readIntoParams(String objname, String query) throws SQLException { DbParameterAccessorsMapBuilder params = new DbParameterAccessorsMapBuilder(); objname = objname.replaceAll("[^a-zA-Z0-9_.#]", ""); String[] qualifiers = objname.split("\\."); String bracketedName = ""; for (int i = 0; i < qualifiers.length; i++) { if (i > 0) { <START> bracketedName += "."; <END> } bracketedName += "[" + qualifiers[i] + "]"; } try (PreparedStatement dc = currentConnection.prepareStatement(query)) { dc.setString(1, bracketedName); ResultSet rs = dc.executeQuery(); while (rs.next()) { String paramName = defaultIfNull(rs.getString(1), ""); params.add(paramName, getParameterDirection(rs.getInt(4), paramName), getSqlType(rs.getString(2)), getJavaClass(rs.getString(2))); } } return params.toMap(); }</code><technical_language>I if worth add a separator variable avoid nested if</technical_language>

Target:
private Map<String, DbParameterAccessor> readIntoParams(String objname, String query) throws SQLException { DbParameterAccessorsMapBuilder params = new DbParameterAccessorsMapBuilder(); objname = objname.replaceAll("[^a-zA-Z0-9_.#]", ""); String bracketedName = enquoteAndJoin(objname.split("\\."), ".", "[", "]"); try (PreparedStatement dc = currentConnection.prepareStatement(query)) { dc.setString(1, bracketedName); ResultSet rs = dc.executeQuery(); while (rs.next()) { String paramName = defaultIfNull(rs.getString(1), ""); params.add(paramName, getParameterDirection(rs.getInt(4), paramName), getSqlType(rs.getString(2)), getJavaClass(rs.getString(2))); } } return params.toMap(); }
Source:
<code>public void testFindAssociatedNotLinkedFilesSuccess() throws Exception { <START> when(databaseContext.getFileDirectoriesAsPaths(any())).thenReturn(Collections.singletonList(path.getParent())); <END> when(externalFileTypes.getExternalFileTypeSelection()).thenReturn(new TreeSet<>(ExternalFileTypes.getDefaultExternalFileTypes())); List<LinkedFile> expected = Collections.singletonList(new LinkedFile("", "CiteKey.pdf", "")); AutoSetFileLinksUtil util = new AutoSetFileLinksUtil(databaseContext, fileDirPrefs, autoLinkPrefs, externalFileTypes); List<LinkedFile> actual = util.findAssociatedNotLinkedFiles(entry); assertEquals(expected, actual); }</code><technical_language>move mockings here</technical_language>

Target:
public void testFindAssociatedNotLinkedFilesSuccess() throws Exception { when(databaseContext.getFileDirectoriesAsPaths(any())).thenReturn(Collections.singletonList(path.getParent())); List<LinkedFile> expected = Collections.singletonList(new LinkedFile("", "CiteKey.pdf", "")); AutoSetFileLinksUtil util = new AutoSetFileLinksUtil(databaseContext, fileDirPrefs, autoLinkPrefs, externalFileTypes); List<LinkedFile> actual = util.findAssociatedNotLinkedFiles(entry); assertEquals(expected, actual); }
Source:
<code><START> public abstract Ref getRef(String name) throws IOException; <END> @Nullable public final Ref findRef(String name) throws IOException { String[] names = new String[SEARCH_PATH.length]; for (int i = 0; i < SEARCH_PATH.length; i++) { names[i] = SEARCH_PATH[i] + name; } return firstExactRef(names); }</code><technical_language>this delegate new findRef method remove implementations in subclasses</technical_language>

Target:
public final Ref getRef(String name) throws IOException { return findRef(name); }
Source:
<code>public void verifyUserLoggedIn(final String userName) { changeImplicitWait(250, TimeUnit.MILLISECONDS); try { if (driver.findElements(By.cssSelector("#PreviewFrame")).size() > 0) { driver.switchTo().frame("PreviewFrame"); } waitFor.until(new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { try { if (driver.findElement(By.tagName("body")).getAttribute("class") .contains("skin-monobook")) { return driver.findElements( By.cssSelector(loggedInUserSelectorMonobook.replace("%userName%", userName.replace(" ", "_")))).size() > 0; <START> } else if (driver.findElement(By.tagName("body")).getAttribute("class") <END> .contains("ember-application")) { return true; } else { return driver.findElements( By.cssSelector(LOGGED_IN_USER_SELECTOR_VENUS.replace("%userName%", userName))) .size() > 0; } } catch (StaleElementReferenceException e) { return false; } } }); } finally { restoreDeaultImplicitWait(); driver.switchTo().defaultContent(); } PageObjectLogging.log("verifyUserLoggedIn", "user " + userName + " logged in", true); }</code><technical_language>is this else if needed all</technical_language>

Target:
public void verifyUserLoggedIn(final String userName) { changeImplicitWait(250, TimeUnit.MILLISECONDS); try { if (driver.findElements(By.cssSelector("#PreviewFrame")).size() > 0) { driver.switchTo().frame("PreviewFrame"); } waitFor.until(new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { try { if (driver.findElement(By.tagName("body")).getAttribute("class") .contains("skin-monobook")) { return driver.findElements( By.cssSelector(loggedInUserSelectorMonobook.replace("%userName%", userName.replace(" ", "_")))).size() > 0; } else { return driver.findElements( By.cssSelector(LOGGED_IN_USER_SELECTOR_VENUS.replace("%userName%", userName))) .size() > 0; } } catch (StaleElementReferenceException e) { return false; } } }); } finally { restoreDeaultImplicitWait(); driver.switchTo().defaultContent(); } PageObjectLogging.log("verifyUserLoggedIn", "user " + userName + " logged in", true); }
Source:
<code>private void print(String classification, String msg, Location location) { <START> ViolationMessage violationMessage = ViolationMessage.EMPTY; <END> try { violationMessage = new ViolationMessage(this.inputFile.getCanonicalPath(), location.line, location.column, classification, msg); } catch (IOException e) { System.err.println("Error in getting canonical path of input file: " + e.getMessage()); } this.msgBuffer.put(violationMessage.toString(), violationMessage); }</code><technical_language>discussed, a default constructor instead</technical_language>

Target:
private void print(String classification, String msg, Location location) { ViolationMessage violationMessage = new ViolationMessage(location.line, location.column, classification, msg); try { violationMessage.setFilePath(this.inputFile.getCanonicalPath()); } catch (IOException e) { System.err.println("Error in getting canonical path of input file: " + e.getMessage()); } this.msgBuffer.put(violationMessage.toString(), violationMessage); }
Source:
<code>public int complete(CommandContext ctx, String buffer, int cursor, List<String> candidates) { int offset = 0; if(ctx.getArgumentsString() != null) { offset = ctx.getArgumentsString().length(); buffer = ctx.getArgumentsString() + buffer; } final int result = doComplete(ctx, buffer, cursor, candidates); if(result < 0) { return result; } <START> <END> return result - offset + countTrailingSpaces(buffer, cursor); }</code><technical_language>@xstefank, this work I wandering if isolate fix failing piece (value completion). If OperationRequestCompleter, line 300: <LINK_0> chunk completed whitespaces. I is issue root cause. Computing length diff original line (the substring of buffer starting result index) chunk capture this case</technical_language>

Target:
public int complete(CommandContext ctx, String buffer, int cursor, List<String> candidates) { int offset = 0; if(ctx.getArgumentsString() != null) { offset = ctx.getArgumentsString().length(); buffer = ctx.getArgumentsString() + buffer; } final int result = doComplete(ctx, buffer, cursor, candidates); if(result < 0) { return result; } return result - offset; }
Source:
<code>public ClientSession.AddressQuery addressQuery(final SimpleString address) throws ActiveMQException { <START> if (sessionChannel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V3)) { <END> Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V3); SessionBindingQueryResponseMessage_V3 response = (SessionBindingQueryResponseMessage_V3) packet; return new AddressQueryImpl(response.isExists(), response.getQueueNames(), response.isAutoCreateJmsQueues(), response.isAutoCreateJmsTopics()); } else if (sessionChannel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V2)) { Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V2); SessionBindingQueryResponseMessage_V2 response = (SessionBindingQueryResponseMessage_V2) packet; return new AddressQueryImpl(response.isExists(), response.getQueueNames(), response.isAutoCreateJmsQueues(), false); } else { Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP); SessionBindingQueryResponseMessage response = (SessionBindingQueryResponseMessage) packet; return new AddressQueryImpl(response.isExists(), response.getQueueNames(), false, false); } }</code><technical_language>sessionChannel.supports() give correct results, I I that. problem connection.getClientVersion() returned zero in ChannelImpl.supports(), I comparing version numbers directly</technical_language>

Target:
public ClientSession.AddressQuery addressQuery(final SimpleString address) throws ActiveMQException { if (sessionChannel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V3, getServerVersion())) { Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V3); SessionBindingQueryResponseMessage_V3 response = (SessionBindingQueryResponseMessage_V3) packet; return new AddressQueryImpl(response.isExists(), response.getQueueNames(), response.isAutoCreateJmsQueues(), response.isAutoCreateJmsTopics()); } else if (sessionChannel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V2, getServerVersion())) { Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V2); SessionBindingQueryResponseMessage_V2 response = (SessionBindingQueryResponseMessage_V2) packet; return new AddressQueryImpl(response.isExists(), response.getQueueNames(), response.isAutoCreateJmsQueues(), false); } else { Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP); SessionBindingQueryResponseMessage response = (SessionBindingQueryResponseMessage) packet; return new AddressQueryImpl(response.isExists(), response.getQueueNames(), false, false); } }
Source:
<code><START> private boolean enrichMapDataObjectsToInputColumnsByName(List<ConfiguredPropertyDescriptor> inputColProperties, ProcessStatelessInput input) { <END> if(inputColProperties.isEmpty()) { return false; } if(input.data.isArray()) { for(JsonNode item: input.data) { if(!item.isObject()) { return false; } } } else if(input.data.isObject()) { } else { return false; } JsonNodeFactory json = Serializator.getJacksonObjectMapper().getNodeFactory(); if(input.data.isArray()) { int i = 0; for(JsonNode item: input.data) { ((ArrayNode)input.data).set(i++, mapDataObjectToInputColumnsByName(item, inputColProperties)); } } else { input.data = json.arrayNode().add(mapDataObjectToInputColumnsByName(input.data, inputColProperties)); } if(input.configuration == null) { input.configuration = new ComponentConfiguration(); } int i = 1; for(ConfiguredPropertyDescriptor inputCol: inputColProperties) { String colName = "c" + i++; input.configuration.getProperties().put(inputCol.getName(), json.textNode(colName)); input.configuration.getColumns().add(json.textNode(colName)); } return true; }</code><technical_language>Code style: long line</technical_language>

Target:
private boolean enrichMapDataObjectsToInputColumnsByName(List<ConfiguredPropertyDescriptor> inputColProperties, ProcessStatelessInput input) { if (inputColProperties.isEmpty()) { return false; } if (input.data.isArray()) { for (JsonNode item: input.data) { if (!item.isObject()) { return false; } } } else if (input.data.isObject()) { } else { return false; } final JsonNodeFactory json = Serializator.getJacksonObjectMapper().getNodeFactory(); if (input.data.isArray()) { final ArrayNode inputData = (ArrayNode)input.data; for (int i = 0; i < inputData.size(); i++) { inputData.set(i++, mapDataObjectToInputColumnsByName(inputData.get(i), inputColProperties)); } } else { input.data = json.arrayNode().add(mapDataObjectToInputColumnsByName(input.data, inputColProperties)); } if (input.configuration == null) { input.configuration = new ComponentConfiguration(); } for (int i = 0; i < inputColProperties.size(); i++) { final String colName = "c" + (i + 1); input.configuration.getProperties().put(inputColProperties.get(i).getName(), json.textNode(colName)); input.configuration.getColumns().add(json.textNode(colName)); } return true; }
Source:
<code>protected PatchLineComment execute(GerritClient client, IProgressMonitor monitor) throws GerritException { <START> return client.saveDraft(getPatchKey(), getMessage(), getLine(), getSide(), getParentUuid(), monitor, getUuid()); <END> }</code><technical_language>convention if is a monitor passed, param</technical_language>

Target:
protected PatchLineComment execute(GerritClient client, IProgressMonitor monitor) throws GerritException { return client.saveDraft(getPatchKey(), getMessage(), getLine(), getSide(), getParentUuid(), getUuid(), monitor); }
Source:
<code>public Result apply(TableScanNode tableScan, Captures captures, Context context) { Map<ColumnHandle, List<SubfieldPath>> subfields = tableScan.getPrunedSubfieldPaths() .entrySet().stream().collect(toImmutableMap( e -> tableScan.getAssignments().get(e.getKey()), Map.Entry::getValue)); <START> if (subfields.isEmpty()) { <END> return Result.empty(); } Map<ColumnHandle, ColumnHandle> prunedColumns = metadata.pushdownSubfieldPruning(context.getSession(), tableScan.getTable(), subfields); if (prunedColumns.isEmpty()) { return Result.empty(); } Map<Symbol, ColumnHandle> newAssignments = tableScan.getAssignments() .entrySet() .stream() .collect(toImmutableMap(Map.Entry::getKey, e -> prunedColumns.getOrDefault(e.getValue(), e.getValue()))); TableScanNode newTableScanNode = new TableScanNode( tableScan.getId(), tableScan.getTable(), tableScan.getOutputSymbols(), newAssignments, tableScan.getLayout(), tableScan.getCurrentConstraint(), tableScan.getEnforcedConstraint(), ImmutableMap.of()); return Result.ofPlanNode(newTableScanNode); }</code><technical_language>this check removed included in PATTERN</technical_language>

Target:
public Result apply(TableScanNode tableScan, Captures captures, Context context) { Map<ColumnHandle, List<Subfield>> subfields = tableScan.getRequiredSubfieldPaths().entrySet().stream() .collect(toImmutableMap(e -> tableScan.getAssignments().get(e.getKey()), Map.Entry::getValue)); Map<ColumnHandle, ColumnHandle> prunedColumns = metadata.pushdownSubfieldPruning(context.getSession(), tableScan.getTable(), subfields); if (prunedColumns.isEmpty()) { return Result.empty(); } Map<Symbol, ColumnHandle> newAssignments = tableScan.getAssignments().entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, e -> prunedColumns.getOrDefault(e.getValue(), e.getValue()))); TableScanNode newTableScanNode = new TableScanNode( tableScan.getId(), tableScan.getTable(), tableScan.getOutputSymbols(), newAssignments, tableScan.getCurrentConstraint(), tableScan.getEnforcedConstraint(), tableScan.isTemporaryTable(), ImmutableMap.of()); return Result.ofPlanNode(newTableScanNode); }
Source:
<code>private void createDimensions() throws JAXBException, IOException { DimensionTable dim = (DimensionTable)readFromXML("dim_table.xml"); XStorageTables storageTables = (XStorageTables)readFromXML("dim1-storage-tables.xml"); if (dim != null && storageTables != null) { result = metaClient.createDimensionTable(dim, storageTables); if (result.getStatus().equals(APIResult.Status.FAILED)) { System.out.println("Creating dim table from: dim_table.xml and dim1-storage-tables.xml failed"); retCode = 1; } } dim = (DimensionTable)readFromXML("dim_table2.xml"); storageTables = (XStorageTables)readFromXML("dim2-storage-tables.xml"); if (dim != null && storageTables != null) { result = metaClient.createDimensionTable(dim, storageTables); if (result.getStatus().equals(APIResult.Status.FAILED)) { System.out.println("Creating dim table from: dim_table2.xml and dim2-storage-tables.xml failed"); retCode = 1; } } dim = (DimensionTable)readFromXML("dim_table3.xml"); storageTables = (XStorageTables)readFromXML("dim3-storage-tables.xml"); if (dim != null && storageTables != null) { result = metaClient.createDimensionTable(dim, storageTables); if (result.getStatus().equals(APIResult.Status.FAILED)) { <START> System.out.println("Creating dim table from: dim_table.xml and dim1-storage-tables.xml failed"); <END> retCode = 1; } } }</code><technical_language>message modifed dim_table3.xml dim3-storage-tables.xml</technical_language>

Target:
private void createDimensions() throws JAXBException, IOException { DimensionTable dim = (DimensionTable)readFromXML("dim_table.xml"); XStorageTables storageTables = (XStorageTables)readFromXML("dim1-storage-tables.xml"); if (dim != null && storageTables != null) { result = metaClient.createDimensionTable(dim, storageTables); if (result.getStatus().equals(APIResult.Status.FAILED)) { System.out.println("Creating dim table from: dim_table.xml and dim1-storage-tables.xml failed"); retCode = 1; } } dim = (DimensionTable)readFromXML("dim_table2.xml"); storageTables = (XStorageTables)readFromXML("dim2-storage-tables.xml"); if (dim != null && storageTables != null) { result = metaClient.createDimensionTable(dim, storageTables); if (result.getStatus().equals(APIResult.Status.FAILED)) { System.out.println("Creating dim table from: dim_table2.xml and dim2-storage-tables.xml failed"); retCode = 1; } } dim = (DimensionTable)readFromXML("dim_table3.xml"); storageTables = (XStorageTables)readFromXML("dim3-storage-tables.xml"); if (dim != null && storageTables != null) { result = metaClient.createDimensionTable(dim, storageTables); if (result.getStatus().equals(APIResult.Status.FAILED)) { System.out.println("Creating dim table from: dim_table3.xml and dim3-storage-tables.xml failed"); retCode = 1; } } }
Source:
<code>public AssertingPartyDetails build() { if (this.signingMethodAlgorithms.isEmpty()) { this.signingMethodAlgorithms.add(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); } List<String> signingMethodAlgorithmsCopy = new ArrayList(this.signingMethodAlgorithms); <START> this.signingMethodAlgorithms.clear(); <END> return new AssertingPartyDetails(this.entityId, this.wantAuthnRequestsSigned, this.verificationX509Credentials, this.encryptionX509Credentials, this.singleSignOnServiceLocation, this.singleSignOnServiceBinding, signingMethodAlgorithmsCopy); }</code><technical_language>is reasoning for clearing list out? build clear out other lists reset of other fields original state</technical_language>

Target:
public AssertingPartyDetails build() { List<String> signingMethodAlgorithmsCopy = this.signingMethodAlgorithms.isEmpty() ? Arrays.asList(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256) : Collections.unmodifiableList(this.signingMethodAlgorithms); return new AssertingPartyDetails(this.entityId, this.wantAuthnRequestsSigned, this.verificationX509Credentials, this.encryptionX509Credentials, this.singleSignOnServiceLocation, this.singleSignOnServiceBinding, signingMethodAlgorithmsCopy); }
Source:
<code>public <T> T deserialize(org.apache.qpid.proton.message.Message message, Class<T> clazz) { Objects.requireNonNull(message, "'message' cannot be null."); Objects.requireNonNull(clazz, "'clazz' cannot be null."); <START> if (clazz == ServiceBusProperties.class) { <END> return deserializeManagementResponse(message, clazz); } else if (clazz == Message.class) { return (T) deserializeEventData(message); } else { throw logger.logExceptionAsError(new IllegalArgumentException( "Deserialization only supports ServiceBusProperties.")); } }</code><technical_language>ServiceBusProperties in SB API</technical_language>

Target:
public <T> T deserialize(org.apache.qpid.proton.message.Message message, Class<T> clazz) { Objects.requireNonNull(message, "'message' cannot be null."); Objects.requireNonNull(clazz, "'clazz' cannot be null."); if (clazz == ServiceBusReceivedMessage.class) { return (T) deserializeMessage(message); } else { throw logger.logExceptionAsError(new IllegalArgumentException( "Deserialization only supports ServiceBusReceivedMessage.")); } }
Source:
<code>public static double theoreticalSensitivity(final double[] depthDistribution, final double[] qualityDistribution, final int sampleSize, final double logOddsThreshold, final double alleleFraction) { if (alleleFraction > 1.0 || alleleFraction < 0.0) { throw new PicardException("Allele fractions must be between 0 and 1."); } double sensitivity = 0.0; <START> for (int k = 0; k < depthDistribution.length; k++) { <END> if (k % 100 == 0) { log.info("Calculting sensitivity for allele fraction " + alleleFraction + " at depth " + k + " of " + depthDistribution.length); } sensitivity += sensitivityAtConstantDepth(k, qualityDistribution, logOddsThreshold, sampleSize, alleleFraction) * depthDistribution[k]; } return sensitivity; }</code><technical_language>if is depth, call depth, k</technical_language>

Target:
public static double theoreticalSensitivity(final double[] depthDistribution, final double[] qualityDistribution, final int sampleSize, final double logOddsThreshold, final double alleleFraction) { if (alleleFraction > 1.0 || alleleFraction < 0.0) { throw new PicardException("Allele fractions must be between 0 and 1."); } final double depthBinWidth = 0.01; double sensitivity = 0.0; int k = 0; double right = sensitivityAtConstantDepth(k, qualityDistribution, logOddsThreshold, sampleSize, alleleFraction); while (k < depthDistribution.length) { double width = 0.0; while (width < depthBinWidth && k < depthDistribution.length) { width += depthDistribution[k]; k++; } double left = right; right = sensitivityAtConstantDepth(k, qualityDistribution, logOddsThreshold, sampleSize, alleleFraction); sensitivity += width * (left + right) / 2.0; } return sensitivity; }
Source:
<code>public ParametersMap put(Parameter param, Object value) { <START> if (value == null || (value instanceof String && "".equals((String) value))) { <END> remove(param); } else { if (!isAssignableFrom(param.getJavaType(), value.getClass())) { throw new InvalidParameterValueException(param.getName(), param.getJavaType(), value.getClass()); } paramsMap.put(param, (Serializable) value); } return this; }</code><technical_language>I empty string is null is a valid value</technical_language>

Target:
public ParametersMap put(Parameter param, Object value) { if (value == null) { remove(param); } else { if (!isAssignableFrom(param.getJavaType(), value.getClass())) { throw new InvalidParameterValueException(param.getName(), param.getJavaType(), value.getClass()); } paramsMap.put(param, (Serializable) value); } return this; }
Source:
<code>public void schedule(String scheduleName, String taskDefinitionName, Map<String, String> taskProperties, List<String> commandLineArgs, String platform) { MultiValueMap<String, Object> values = new LinkedMultiValueMap<>(); values.add("scheduleName", scheduleName); values.add("properties", DeploymentPropertiesUtils.format(taskProperties)); values.add("taskDefinitionName", taskDefinitionName); values.add("arguments", commandLineArgs); <START> if(platform != null) { <END> values.add("platform", platform); } restTemplate.postForObject(schedulesLink.getHref(), values, Long.class); }</code><technical_language>Instead of null, do StringUtils.hasText() related avoid empty string</technical_language>

Target:
public void schedule(String scheduleName, String taskDefinitionName, Map<String, String> taskProperties, List<String> commandLineArgs, String platform) { MultiValueMap<String, Object> values = new LinkedMultiValueMap<>(); values.add("scheduleName", scheduleName); values.add("properties", DeploymentPropertiesUtils.format(taskProperties)); values.add("taskDefinitionName", taskDefinitionName); String commandLineArgValue = new String(); boolean isFirst = true; for(String command : commandLineArgs) { if(isFirst) { isFirst = false; } else { commandLineArgValue += " "; } commandLineArgValue += command; } values.add("arguments", commandLineArgValue); if(StringUtils.hasText(platform)) { values.add("platform", platform); } restTemplate.postForObject(schedulesLink.getHref(), values, Long.class); }
Source:
<code>private void writeSystemInfo() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } final String product = Config.getValue(ConfigValues.OriginType); final String manufacturer = OriginType.valueOf(product) == OriginType.OVIRT ? "oVirt" : "Red Hat"; writer.writeStartElement("sysinfo"); writer.writeAttributeString("type", "smbios"); writer.writeStartElement("system"); writeEntryElement("manufacturer", manufacturer); writeEntryElement("product", "KVM"); <START> writeEntryElement("version", "RHEL-8.1.0 PC (Q35 + ICH9, 2009)"); <END> writeEntryElement("family", "Red Hat Enterprise Linux"); writeEntryElement("sku", "OS-VERSION:"); writeEntryElement("serial", "HOST-SERIAL:"); writeEntryElement("uuid", vm.getId().toString()); writer.writeEndElement(); writer.writeStartElement("baseBoard"); writeEntryElement("manufacturer", manufacturer); writeEntryElement("product", "RHEL-AV"); writeEntryElement("version", "RHEL-8.1.0 PC (Q35 + ICH9, 2009)"); writeEntryElement("serial", "HOST-SERIAL:"); writer.writeEndElement(); writer.writeStartElement("chassis"); writeEntryElement("manufacturer", manufacturer); writeEntryElement("product", "KVM"); writeEntryElement("version", "RHEL-8.1.0 PC (Q35 + ICH9, 2009)"); writer.writeEndElement(); writer.writeStartElement("processor"); writeEntryElement("manufacturer", manufacturer); writeEntryElement("product", "KVM"); writeEntryElement("version", "RHEL-8.1.0 PC (Q35 + ICH9, 2009)"); writer.writeEndElement(); writer.writeEndElement(); }</code><technical_language>Is OK hardcode this version, for hosts</technical_language>

Target:
private void writeSystemInfo() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } final String product = Config.getValue(ConfigValues.OriginType); final String manufacturer = OriginType.valueOf(product) == OriginType.OVIRT ? "oVirt" : "Red Hat"; final boolean needsBaseBoard = OriginType.valueOf(product) == OriginType.RHEV; final String productName = OriginType.valueOf(product) == OriginType.OVIRT ? "oVirt" : "RHV"; writer.writeStartElement("sysinfo"); writer.writeAttributeString("type", "smbios"); writer.writeStartElement("system"); writeEntryElement("manufacturer", manufacturer); writeEntryElement("product", productName); writeEntryElement("version", vm.getClusterCompatibilityVersion().toString()); writeEntryElement("family", "Red Hat Enterprise Linux"); writeEntryElement("sku", Config.getValue(ConfigValues.SkuToAVLevel, vm.getCompatibilityVersion().toString())); writeEntryElement("serial", "HOST-SERIAL:"); writeEntryElement("uuid", vm.getId().toString()); writer.writeEndElement(); if (needsBaseBoard) { writer.writeStartElement("baseBoard"); writeEntryElement("manufacturer", "Red Hat"); writeEntryElement("product", "RHEL-AV"); writer.writeEndElement(); } writer.writeEndElement(); }
Source:
<code><START> public void setMuteReason (String reason) { <END> if (reason.equals("")) { config.removeProperty ("muteReason"); muteReason = null; } else { muteReason = reason; config.setProperty ("muteReason", reason); } config.save(); }</code><technical_language>space is inconsistent rest of EssX</technical_language>

Target:
public void setMuteReason(String reason) { if (reason == null) { config.removeProperty("muteReason"); muteReason = null; } else { muteReason = reason; config.setProperty("muteReason", reason); } config.save(); }
Source:
<code>protected List<URL> listBundleComponents(Bundle bundle) { String list = getComponentsList(bundle); String name = bundle.getSymbolicName(); log.debug("PartialBundle: " + name + " components: " + list); if (list == null) { return null; } return Collections.list(new StringTokenizer(list, ", \t\n\r\f")) .stream() .map(s -> bundle.getEntry((String) s)) .filter(Objects::nonNull) <START> .collect(Collectors.toList()); <END> }</code><technical_language>this method in this class re-convert list a Steam, I suggest rename method streamBundleComponents returning a Stream</technical_language>

Target:
protected Stream<URL> listBundleComponents(Bundle bundle) { String list = OSGiRuntimeService.getComponentsList(bundle); String name = bundle.getSymbolicName(); log.debug("PartialBundle: " + name + " components: " + list); if (list == null) { return null; } return Arrays.stream(list.split("[, \t\n\r\f]")).map(s -> bundle.getEntry((String) s)).filter(Objects::nonNull); }
Source:
<code>public void init() { this.taskSideInputStorageManager.init(); Map<SystemStreamPartition, String> fileOffsets = this.taskSideInputStorageManager.getFileOffsets(); LOG.info("File offsets for the task {}: {}", taskName, fileOffsets); this.lastProcessedOffsets.putAll(fileOffsets); LOG.info("Last processed offsets for the task {}: {}", taskName, lastProcessedOffsets); this.startingOffsets = getStartingOffsets(fileOffsets, getOldestOffsets()); LOG.info("Starting offsets for the task {}: {}", taskName, startingOffsets); <START> this.sspOffsetsToBlockUntil = new HashMap<>(); for (SystemStreamPartition ssp : this.sspToStores.keySet()) { SystemStreamMetadata metadata = this.streamMetadataCache.getSystemStreamMetadata(ssp.getSystemStream(), false); if (metadata != null) { String offset = metadata.getSystemStreamPartitionMetadata().get(ssp.getPartition()).getNewestOffset(); this.sspOffsetsToBlockUntil.put(ssp, offset); } } <END> this.startingOffsets.forEach((ssp, offset) -> checkCaughtUp(ssp, offset, true)); }</code><technical_language>minor: init() a high-level method calling helpers do actual stuff. i read it, I easily get steps init is understand steps performed. Hence, wondering if is in moving this piece a helper similar getStartingoffsets? I feel serves purposes - init a quick read clarifies this step is in a single glance.. java doc for this helper a nice bonus ;)</technical_language>

Target:
public void init() { this.taskSideInputStorageManager.init(); Map<SystemStreamPartition, String> fileOffsets = this.taskSideInputStorageManager.getFileOffsets(); LOG.info("File offsets for the task {}: {}", taskName, fileOffsets); this.lastProcessedOffsets.putAll(fileOffsets); LOG.info("Last processed offsets for the task {}: {}", taskName, lastProcessedOffsets); this.startingOffsets = getStartingOffsets(fileOffsets, getOldestOffsets()); LOG.info("Starting offsets for the task {}: {}", taskName, startingOffsets); this.initialSideInputSSPMetadata = getInitialSideInputSSPMetadata(); LOG.info("Task will catch up to offsets {}", this.taskName, this.initialSideInputSSPMetadata); this.startingOffsets.forEach((ssp, offset) -> checkCaughtUp(ssp, offset, SystemStreamMetadata.OffsetType.UPCOMING)); }
Source:
<code>private TimeValue unpackTime() throws IOException { long nanosOfDayUTC = unpackLong(); int offsetSeconds = unpackInteger(); <START> return time( nanosOfDayUTC - offsetSeconds * NANOS_PER_SECOND, ZoneOffset.ofTotalSeconds( offsetSeconds ) ); <END> }</code><technical_language>is conversion needed here? I bolt server send receive local time offset. conversion is needed in #writeTime() database stores UTC. **Update:** please nvm, I misunderstood code</technical_language>

Target:
private TimeValue unpackTime() throws IOException { long nanosOfDayLocal = unpackLong(); int offsetSeconds = unpackInteger(); return time( TimeUtil.nanosOfDayToUTC( nanosOfDayLocal, offsetSeconds ), ZoneOffset.ofTotalSeconds( offsetSeconds ) ); }