auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(this.getDimension()); byte[] lowerBytes = this.getLower() == null ? new byte[0] : StringUtils.toUtf8(this.getLower()); byte[] upperBytes = this.getUpper() == null ? new byte[0] : StringUtils.toUtf8(this.getUpper()); byte boundType = 0x1; if (this.getLower() == null) { boundType = 0x2; } else if (this.getUpper() == null) { boundType = 0x3; } byte lowerStrictByte = (this.isLowerStrict() == false) ? 0x0 : (byte) 1; byte upperStrictByte = (this.isUpperStrict() == false) ? 0x0 : (byte) 1; byte AlphaNumericByte = (this.isAlphaNumeric() == false) ? 0x0 : (byte) 1; byte[] extractionFnBytes = extractionFn == null ? new byte[0] : extractionFn.getCacheKey(); byte[] orderingBytes = StringUtils.toUtf8(ordering); ByteBuffer boundCacheBuffer = ByteBuffer.allocate( 10 + dimensionBytes.length + upperBytes.length + lowerBytes.length + extractionFnBytes.length + orderingBytes.length ); boundCacheBuffer.put(DimFilterUtils.BOUND_CACHE_ID) <START> .put(boundType) <END> .put(upperStrictByte) .put(lowerStrictByte) .put(AlphaNumericByte) .put(DimFilterUtils.STRING_SEPARATOR) .put(dimensionBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(upperBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(lowerBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(extractionFnBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(orderingBytes); return boundCacheBuffer.array(); }</code><technical_language>remove AlphaNumericByte for cache key for equal hashCode</technical_language>

Target:
public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(this.getDimension()); byte[] lowerBytes = this.getLower() == null ? new byte[0] : StringUtils.toUtf8(this.getLower()); byte[] upperBytes = this.getUpper() == null ? new byte[0] : StringUtils.toUtf8(this.getUpper()); byte boundType = 0x1; if (this.getLower() == null) { boundType = 0x2; } else if (this.getUpper() == null) { boundType = 0x3; } byte lowerStrictByte = (this.isLowerStrict() == false) ? 0x0 : (byte) 1; byte upperStrictByte = (this.isUpperStrict() == false) ? 0x0 : (byte) 1; byte[] extractionFnBytes = extractionFn == null ? new byte[0] : extractionFn.getCacheKey(); byte[] orderingBytes = ordering.getCacheKey(); ByteBuffer boundCacheBuffer = ByteBuffer.allocate( 9 + dimensionBytes.length + upperBytes.length + lowerBytes.length + extractionFnBytes.length + orderingBytes.length ); boundCacheBuffer.put(DimFilterUtils.BOUND_CACHE_ID) .put(boundType) .put(upperStrictByte) .put(lowerStrictByte) .put(DimFilterUtils.STRING_SEPARATOR) .put(dimensionBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(upperBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(lowerBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(extractionFnBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(orderingBytes); return boundCacheBuffer.array(); }
Source:
<code>public Object[] getParametersForDocumentation(Object p, ParameterInfoContext context) { <START> return new Object[0]; <END> }</code><technical_language>preallocate new Object[0]? Intellij creates a lot of garbage. a big problem</technical_language>

Target:
public Object[] getParametersForDocumentation(Object p, ParameterInfoContext context) { return EMPTY_ARRAY; }
Source:
<code>public Group drawDiagram(final StackedMutationContainer container, final int zoomLevel, final double width) { Map<Integer, StackedMutationContainer> containers = container .mapLevelStackedMutation(); Group root = new Group(); StackedMutationContainer stack = containers.get(Math.max(1, Math.min(zoomLevel, container.getLevel() - 1))); int stacks = stack.getStack().size(); for (int index = 0; index < stacks; index++) { StackView stackView = new StackView(stack.getStack().get(index), <START> (width / stacks), stack.getMaxMutations()); <END> stackView.setLayoutX(index * (width / stacks)); root.getChildren().add(stackView); } return root; }</code><technical_language>useless parentheses</technical_language>

Target:
public Group drawDiagram(final StackedMutationContainer container, final int zoomLevel, final double width) { Map<Integer, StackedMutationContainer> containers = container .mapLevelStackedMutation(); int stackLevel = Math.max(1, Math.min(zoomLevel, container.getLevel())); StackedMutationContainer stack = containers.get(stackLevel); return drawStackContainer(stack, width); }
Source:
<code>public void scheduleUpdater() { ExecutorService executorService = Executors.newFixedThreadPool(STARTUP_THREAD_COUNT); Set<ScheduledTask> jobsAtStartup = Sets.newHashSet(); if (Boolean.parseBoolean(updaterEnabled) && Boolean.parseBoolean(channelEquivEnabled)) { log.info("Channel equivalence enabled"); addEquivalenceJobs(jobsAtStartup); } <START> for (ScheduledTask scheduledTask : jobsAtStartup) { <END> executorService.submit(scheduledTask); } }</code><technical_language>this streamed</technical_language>

Target:
public void scheduleUpdater() { ExecutorService executorService = Executors.newFixedThreadPool(STARTUP_THREAD_COUNT); Set<ScheduledTask> jobsAtStartup = Sets.newHashSet(); if (Boolean.parseBoolean(updaterEnabled) && Boolean.parseBoolean(channelEquivEnabled)) { log.info("Channel equivalence enabled"); addEquivalenceJobs(jobsAtStartup); } jobsAtStartup.forEach(executorService::submit); }
Source:
<code>public synchronized void updated(final Map<String, Object> properties) { logger.debug(message.updatingWireService() + properties); this.extractProperties(properties); try { this.createWires(); } catch (final KuraException e) { <START> logger.error(ThrowableUtil.stackTraceAsString(e)); <END> } logger.debug(message.updatingWireServiceDone()); }</code><technical_language>passed arguments exceptions. logger handle stack traces is need pre-render this</technical_language>

Target:
public synchronized void updated(final Map<String, Object> properties) { logger.debug(message.updatingWireService() + properties); this.extractProperties(properties); try { this.createWires(); } catch (final KuraException e) { logger.error(e.getMessage(), e); } logger.debug(message.updatingWireServiceDone()); }
Source:
<code>public void computeCompletionProposals(final TextEditor textEditor, final int offset, final CodeAssistCallback callback) { if (buildContext.isBuilding()) { errorMessage = "Code Assistant currently unavailable due to project build."; } else { errorMessage = null; } if (errorMessage != null) { return; } this.eventLogger.log(this, "Autocompleting"); final FileNode file = editor.getEditorInput().getFile(); <START> String projectPath; <END> if (file.getPath().startsWith("/")) { projectPath = "/" + file.getPath().substring(1).split("/")[0]; } else { projectPath = "/" + file.getPath().split("/")[0]; } this.worker.computeCAProposals(textEditor.getDocument().getContents(), offset, file.getName(), projectPath, new JavaParserWorker.WorkerCallback<WorkerProposal>() { @Override public void onResult(final Array<WorkerProposal> problems) { handleCAResponse(callback, problems); } }); }</code><technical_language>inject AppContext dont get curentProject.getPath()</technical_language>

Target:
public void computeCompletionProposals(final TextEditor textEditor, final int offset, final CodeAssistCallback callback) { if (buildContext.isBuilding()) { errorMessage = "Code Assistant currently unavailable due to project build."; } else { errorMessage = null; } if (errorMessage != null) { return; } this.eventLogger.log(this, "Autocompleting"); final String fileName = editor.getEditorInput().getFile().getName(); final String projectPath = this.appContext.getCurrentProject().getProjectDescription().getPath(); this.worker.computeCAProposals(textEditor.getDocument().getContents(), offset, fileName, projectPath, new JavaParserWorker.WorkerCallback<WorkerProposal>() { @Override public void onResult(final Array<WorkerProposal> problems) { handleCAResponse(callback, problems); } }); }
Source:
<code>protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws InterruptedException { if (pristine && stack.isEmpty() && buffer.isReadable()) { if (debugEnabled) { logger.debug("{} Received response without a command context (empty stack)", logPrefix()); } if (consumeResponse(buffer)) { pristine = false; } return; } while (canDecode(buffer)) { RedisCommand<?, ?, ?> command = stack.peek(); if (debugEnabled) { logger.debug("{} Stack contains: commands", logPrefix(), stack.size()); } pristine = false; try { if (!decode(ctx, buffer, command)) { return; } } catch (Exception e) { ctx.close(); throw e; } if (isProtectedMode(command)) { onProtectedMode(command.getOutput().getError()); } else { stack.poll(); try { command.complete(); } catch (Exception e) { logger.warn("{} Unexpected exception during request: {}", logPrefix, e.toString(), e); } } discardReadBytesIfNeeded(buffer); <START> <END> afterComplete(ctx, command); } }</code><technical_language>ByteBuf.discardSomeReadBytes()? effect benefiting actual ByteBuf implementation</technical_language>

Target:
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws InterruptedException { if (pristine && stack.isEmpty() && buffer.isReadable()) { if (debugEnabled) { logger.debug("{} Received response without a command context (empty stack)", logPrefix()); } if (consumeResponse(buffer)) { pristine = false; } return; } while (canDecode(buffer)) { RedisCommand<?, ?, ?> command = stack.peek(); if (debugEnabled) { logger.debug("{} Stack contains: commands", logPrefix(), stack.size()); } pristine = false; try { if (!decode(ctx, buffer, command)) { return; } } catch (Exception e) { ctx.close(); throw e; } if (isProtectedMode(command)) { onProtectedMode(command.getOutput().getError()); } else { stack.poll(); try { command.complete(); } catch (Exception e) { logger.warn("{} Unexpected exception during request: {}", logPrefix, e.toString(), e); } } if (buffer.refCnt() != 0) { buffer.discardSomeReadBytes(); } afterComplete(ctx, command); } }
Source:
<code>public void setPartials(List<PartialConfig> partials) { <START> this.partials = new Cloner().deepClone(partials); <END> }</code><technical_language>consider this forcing caller this decision. For instance, this is cloned (it's not, today). [this](<LINK_0> is a place clone. explicit attempt saving. So, need throw clone if work</technical_language>

Target:
public void setPartials(List<PartialConfig> partials) { this.partials = partials; }
Source:
<code>public void verifySslTrust() throws Exception { System.setProperty("javax.net.ssl.trustStore", this.getClass().getResource("/ssl/trusted/cacerts.jks").getPath()); System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); Properties properties = new Properties(); properties.setProperty(GeneralOption.HOST.getKey(), "localhost"); properties.setProperty(GeneralOption.PORT.getKey(), Integer.toString(trustedService.httpsPort())); properties.setProperty(GeneralOption.USE_HTTPS.getKey(), "true"); properties.setProperty(GeneralOption.VERIFY_SSL.getKey(), "true"); ConnectorDetails connectorDetails = new ConnectorDetails(ConfigurationBuilder.initFromProperties(properties)); HttpHelper httpHelper = new HttpHelper(); HttpHost httpHost = httpHelper.buildHttpHost(connectorDetails); CloseableHttpClient closeableHttpClient = httpHelper.buildClient(httpHost, connectorDetails); <START> <END> CloseableHttpResponse response = closeableHttpClient.execute(httpHost, new HttpGet("/hello")); assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); }</code><technical_language>This section is repeated a times. Extract a method</technical_language>

Target:
public void verifySslTrust() throws Exception { setSystemTrustStore(); ConnectorDetails connectorDetails = buildConnectorDetails("localhost", trustedService.httpsPort(), "true", "true"); HttpHelper httpHelper = new HttpHelper(); HttpHost httpHost = httpHelper.buildHttpHost(connectorDetails); CloseableHttpClient closeableHttpClient = httpHelper.buildClient(httpHost, connectorDetails); CloseableHttpResponse response = closeableHttpClient.execute(httpHost, new HttpGet("/hello")); assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); }
Source:
<code>AesCbcHmacSha2Decryptor(String name, byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { Triple<byte[], byte[], Mac> parameters = getAlgorithmParameters(name, key); hmac = parameters.getRight(); hmacKey = parameters.getMiddle(); inner = new AesCbc.AesCbcDecryptor(parameters.getLeft(), iv, provider); <START> aadLength = toBigEndian(authenticationData.length * 8L); <END> tag = authenticationTag; hmac.update(authenticationData); hmac.update(iv); }</code><technical_language>a constant for [magic numbers](<LINK_0></technical_language>

Target:
AesCbcHmacSha2Decryptor(String name, byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { Triplet<byte[], byte[], Mac> parameters = getAlgorithmParameters(name, key); hmac = parameters.getRight(); hmacKey = parameters.getMiddle(); inner = new AesCbc.AesCbcDecryptor(parameters.getLeft(), iv, provider); aadLength = toBigEndian(authenticationData.length * BYTE_TO_BITS); tag = authenticationTag; hmac.update(authenticationData); hmac.update(iv); }
Source:
<code>protected boolean attachUserToSession() { if (!StringUtils.isEmpty(getParameters().getSessionId())) { if (SessionDataContainer.getInstance() .getValidTo(getParameters().getSessionId()).compareTo(new Date()) < 0) { SessionDataContainer.getInstance().removeSession(getParameters().getSessionId()); return failCanDoAction(VdcBllMessages.USER_CANNOT_LOGIN_SESSION_MISSING); } SessionDataContainer.getInstance().setUser(getParameters().getSessionId(), getCurrentUser()); } else { if (!SessionDataContainer.getInstance().setUser(getCurrentUser())) { return failCanDoAction(VdcBllMessages.USER_CANNOT_LOGIN_SESSION_MISSING); } Date validTo = DateUtils.addMinutes(new Date(), Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); try { Date fromExtension = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ").parse(authRecord.<String> get(AuthRecord.VALID_TO)); validTo = validTo.compareTo(fromExtension) < 0 ? validTo : fromExtension; } catch (ParseException e) { log.warn("Error parsing AuthRecord.VALID_TO . Default VALID_TO value will be set on session"); } <START> SessionDataContainer.getInstance().setValidTo(validTo); <END> } return true; }</code><technical_language>leak this patch</technical_language>

Target:
protected boolean attachUserToSession() { if (!StringUtils.isEmpty(getParameters().getSessionId())) { SessionDataContainer.getInstance().setUser(getParameters().getSessionId(), getCurrentUser()); } else if (!SessionDataContainer.getInstance().setUser(getCurrentUser())) { return failCanDoAction(VdcBllMessages.USER_CANNOT_LOGIN_SESSION_MISSING); } return true; }
Source:
<code>public URL getShareUrl() { <START> String shareURLString = String.format("%s/%s", azureFileStorageClient.getUrl(), shareName); <END> if (snapshot != null) { shareURLString = String.format("%s?snapshot=%s", shareURLString, snapshot); } try { return new URL(shareURLString); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new RuntimeException( String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), shareURLString), e)); } }</code><technical_language>question</technical_language>

Target:
public URL getShareUrl() { StringBuilder shareURLString = new StringBuilder(azureFileStorageClient.getUrl()).append("/").append(shareName); if (snapshot != null) { shareURLString.append("?snapshot=").append(snapshot); } try { return new URL(shareURLString.toString()); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new RuntimeException( String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), shareURLString), e)); } }
Source:
<code>private static ExecutorService getCommonPool() { <START> return AccessController.doPrivileged((PrivilegedAction<ExecutorService>) () -> { <END> return ForkJoinPool.commonPool(); }); }</code><technical_language>Guess want bypass dopriviledge is security manager good</technical_language>

Target:
private static ExecutorService getCommonPool() { if (System.getSecurityManager() != null) { return AccessController.doPrivileged((PrivilegedAction<ExecutorService>) () -> { return ForkJoinPool.commonPool(); }); } else { return ForkJoinPool.commonPool(); } }
Source:
<code>public DataWord and(DataWord word) { <START> byte[] newData = this.getData(); <END> for (int i = 0; i < this.data.length; ++i) { newData[i] &= word.data[i]; } return new DataWord(newData); }</code><technical_language>confusing getData() for making array copy. explicitly add copyData() private method similar below</technical_language>

Target:
public DataWord and(DataWord word) { byte[] newData = this.copyData(); for (int i = 0; i < this.data.length; ++i) { newData[i] &= word.data[i]; } return new DataWord(newData); }
Source:
<code>public void removeWarehouse(Warehouse warehouse) { notNull(warehouse, "warehouse"); try { restTemplate.delete(warehouse.getSelfLink()); } catch (GoodDataException | RestClientException e) { <START> throw new GoodDataException("Unable to delete Warehouse", e); <END> } }</code><technical_language>please add ware house uri message</technical_language>

Target:
public void removeWarehouse(Warehouse warehouse) { notNull(warehouse, "warehouse"); try { restTemplate.delete(warehouse.getSelfLink()); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to delete Warehouse, uri: " + warehouse.getSelfLink(), e); } }
Source:
<code>void handleResponse(ResponseInfo responseInfo) { int correlationId = ((PutRequest) responseInfo.getRequest()).getCorrelationId(); PutOperation putOperation = correlationIdToPutOperation.remove(correlationId); if (putOperations.contains(putOperation)) { try { putOperation.handleResponse(responseInfo); } catch (Exception e) { putOperation.setOperationException(new RouterException("Put handleResponse encountered unexpected error", e, RouterErrorCode.UnexpectedInternalError)); } if (putOperation.isOperationComplete() && putOperations.remove(putOperation)) { <START> onComplete(putOperation); <END> } } else { routerMetrics.ignoredResponseCount.inc(); } }</code><technical_language>handle exceptions coming in onComplete() of fact caller callback is invoked there</technical_language>

Target:
void handleResponse(ResponseInfo responseInfo) { int correlationId = ((PutRequest) responseInfo.getRequest()).getCorrelationId(); PutOperation putOperation = correlationIdToPutOperation.remove(correlationId); if (putOperations.contains(putOperation)) { try { putOperation.handleResponse(responseInfo); } catch (Exception e) { putOperation.setOperationExceptionAndComplete(new RouterException("Put handleResponse encountered unexpected error", e, RouterErrorCode.UnexpectedInternalError)); } if (putOperation.isOperationComplete() && putOperations.remove(putOperation)) { onComplete(putOperation); } } else { routerMetrics.ignoredResponseCount.inc(); } }
Source:
<code>public boolean isAbbreviatedName(String journalName) { String journal = journalName.trim(); <START> boolean isAbbreviated = customAbbreviations.stream().anyMatch(abbreviation -> isMatchedAbbreviated(journal, abbreviation)); <END> if (isAbbreviated) { return true; } return abbreviationToFull.containsKey(journal); }</code><technical_language>Combine returns OR</technical_language>

Target:
public boolean isAbbreviatedName(String journalName) { String journal = journalName.trim(); return customAbbreviations.stream().anyMatch(abbreviation -> isMatchedAbbreviated(journal, abbreviation)) || abbreviationToFull.containsKey(journal); }
Source:
<code>CommitMessageWithCaretPosition calculateCommitMessageAndCaretPosition() { StringBuilder finalMessage = new StringBuilder(); int caretPosition = CommitMessageWithCaretPosition.NO_POSITION; for (ICommitMessageProvider provider : providers) { String <START> messagePart = <END> ""; try { if (provider instanceof ICommitMessageProvider2) { CommitMessageWithCaretPosition commitMessageWithPosition = ((ICommitMessageProvider2) provider) .getCommitMessageWithPosition(resourcesArray); messagePart = getCommitMessage( commitMessageWithPosition, finalMessage.length() == 0); if (commitMessageWithPosition != null) { caretPosition = getUpdatedCaretPosition(finalMessage, caretPosition, commitMessageWithPosition, (ICommitMessageProvider2) provider); } } else { messagePart = getCommitMessage(provider, finalMessage.length() == 0); } } catch (RuntimeException e) { Activator.logError(e.getMessage(), e); } finalMessage.append(messagePart); } return new CommitMessageWithCaretPosition(finalMessage.toString(), Math.max(0, caretPosition)); }</code><technical_language>name this message</technical_language>

Target:
CommitMessageWithCaretPosition calculateCommitMessageAndCaretPosition() { StringBuilder finalMessage = new StringBuilder(); int caretPosition = CommitMessageWithCaretPosition.NO_POSITION; for (ICommitMessageProvider provider : providers) { String message = ""; try { if (provider instanceof ICommitMessageProvider2) { CommitMessageWithCaretPosition commitMessageWithPosition = ((ICommitMessageProvider2) provider) .getCommitMessageWithPosition(resourcesArray); message = getCommitMessage( commitMessageWithPosition, finalMessage.length() == 0); if (commitMessageWithPosition != null) { caretPosition = getUpdatedCaretPosition(finalMessage, caretPosition, commitMessageWithPosition, (ICommitMessageProvider2) provider); } } else { message = buildCommitMessage( provider.getMessage(resourcesArray), finalMessage.length() == 0); } } catch (RuntimeException e) { Activator.logError(e.getMessage(), e); } finalMessage.append(message); } return new CommitMessageWithCaretPosition(finalMessage.toString(), Math.max(0, caretPosition)); }
Source:
<code>public boolean equals(final Object o) { if (!(o instanceof Window)) { return false; } Window<T> window = (Window<T>) o; if (this.getLatestWatermark() == null && window.getLatestWatermark() == null) { <START> return true; <END> } if (this.getLatestWatermark() == null || window.getLatestWatermark() == null) { return false; } return this.getStart() == window.getStart() && this.getEnd() == window.getEnd() && this.getLatestTimestamp() == window.getLatestTimestamp() && this.getLatestWatermark().getTimestamp() == window.getLatestWatermark().getTimestamp() && this.getDataCollection().equals(window.getDataCollection()); }</code><technical_language>this case return true</technical_language>

Target:
public boolean equals(final Object o) { if (!(o instanceof Window)) { return false; } Window<T> window = (Window<T>) o; if (this.getLatestWatermark() == null ^ window.getLatestWatermark() == null) { return false; } return ((this.getLatestWatermark() == null && window.getLatestWatermark() == null) || this.getLatestWatermark().getTimestamp() == window.getLatestWatermark().getTimestamp()) && this.getStart() == window.getStart() && this.getEnd() == window.getEnd() && this.getLatestTimestamp() == window.getLatestTimestamp() && this.getDataCollection().equals(window.getDataCollection()); }
Source:
<code><START> public void renderAFeatureWithNoScenario() { <END> assertPrettyIdentical("Feature: hello\n"); }</code><technical_language>Junit 5 test methods longer public. Please package private</technical_language>

Target:
void renderAFeatureWithNoScenario() { assertPrettyIdentical("Feature: hello\n"); }
Source:
<code>protected boolean canDoAction() { Guid userId = getParameters().getUserProfile().getUserId(); <START> if (userId == null) { <END> return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_PROFILE_NOT_EXISTS); } else { if (userId.equals(Guid.Empty)) { userId = getUserId(); getParameters().getUserProfile().setUserId(userId); } else if (!userId.equals(getUserId())) { return failCanDoAction(EngineMessage.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); } } String sshPublicKey = getParameters().getUserProfile().getSshPublicKey(); if (sshPublicKey == null || sshPublicKey.isEmpty()) { return true; } if (!OpenSSHUtils.isPublicKeyValid(sshPublicKey)) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_INVALID_PUBLIC_SSH_KEY); } return true; }</code><technical_language>reason treating null empty current id</technical_language>

Target:
protected boolean canDoAction() { Guid userId = getParameters().getUserProfile().getUserId(); if (Guid.isNullOrEmpty(userId)) { userId = getUserId(); getParameters().getUserProfile().setUserId(userId); } else if (!userId.equals(getUserId())) { return failCanDoAction(EngineMessage.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); } String sshPublicKey = getParameters().getUserProfile().getSshPublicKey(); if (sshPublicKey == null || sshPublicKey.isEmpty()) { return true; } if (!OpenSSHUtils.isPublicKeyValid(sshPublicKey)) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_INVALID_PUBLIC_SSH_KEY); } return true; }
Source:
<code>public ITokenCacheStore getCache() { if (mBrokerProxy.canSwitchToBroker()) { return new ITokenCacheStore() { private static final long serialVersionUID = 1L; @Override <START> public void setItem(String key, TokenCacheItem item) { <END> } @Override public void removeItem(String key) { } @Override public void removeAll() { mBrokerProxy.removeAccounts(); } @Override public TokenCacheItem getItem(String key) { return null; } @Override public boolean contains(String key) { return false; } }; } return mTokenCacheStore; }</code><technical_language>needs some feedback for users understand call is supported</technical_language>

Target:
public ITokenCacheStore getCache() { if (mBrokerProxy.canSwitchToBroker()) { return new ITokenCacheStore() { private static final long serialVersionUID = 1L; @Override public void setItem(String key, TokenCacheItem item) { throw new UnsupportedOperationException( "Broker cache does not support direct setItem operation"); } @Override public void removeItem(String key) { throw new UnsupportedOperationException( "Broker cache does not support direct removeItem operation"); } @Override public void removeAll() { mBrokerProxy.removeAccounts(); } @Override public TokenCacheItem getItem(String key) { throw new UnsupportedOperationException( "Broker cache does not support direct getItem operation"); } @Override public boolean contains(String key) { throw new UnsupportedOperationException( "Broker cache does not support contains operation"); } }; } return mTokenCacheStore; }
Source:
<code>public List<StopAtDistance> findNearbyStopsViaStreets ( Set<Vertex> originVertices, boolean reverseDirection, boolean removeTempEdges, <START> RoutingRequest routingRequest <END> ) { routingRequest.setRoutingContext(graph, originVertices, null); routingRequest.arriveBy = reverseDirection; int walkTime = (int) (radiusMeters / new RoutingRequest().walkSpeed); routingRequest.worstTime = routingRequest.dateTime + (reverseDirection ? -walkTime : walkTime); routingRequest.disableRemainingWeightHeuristic = true; routingRequest.rctx.remainingWeightHeuristic = new TrivialRemainingWeightHeuristic(); routingRequest.dominanceFunction = new DominanceFunction.MinimumWeight(); ShortestPathTree spt = astar.getShortestPathTree(routingRequest); List<StopAtDistance> stopsFound = Lists.newArrayList(); if (spt != null) { for (State state : spt.getAllStates()) { Vertex targetVertex = state.getVertex(); if (originVertices.contains(targetVertex)) continue; if (targetVertex instanceof TransitStopVertex && state.isFinal()) { stopsFound.add(stopAtDistanceForState(state)); } } } for (Vertex vertex : originVertices) { if (vertex instanceof TransitStopVertex) { stopsFound.add( new StopAtDistance( (TransitStopVertex) vertex, 0, Collections.emptyList(), null, new State(vertex, routingRequest) )); } } if (removeTempEdges) { routingRequest.cleanup(); } return stopsFound; }</code><technical_language>This breaks arriveBy-searches, orginVertices get set row 145. direction of routingRequest forward, originVertives set in parameter in setRoutingContext</technical_language>

Target:
public List<StopAtDistance> findNearbyStopsViaStreets ( Set<Vertex> originVertices, boolean reverseDirection, boolean removeTempEdges, RoutingRequest routingRequest ) { routingRequest.arriveBy = reverseDirection; if (!reverseDirection) { routingRequest.setRoutingContext(graph, originVertices, null); } else { routingRequest.setRoutingContext(graph, null, originVertices); } int walkTime = (int) (radiusMeters / new RoutingRequest().walkSpeed); routingRequest.worstTime = routingRequest.dateTime + (reverseDirection ? -walkTime : walkTime); routingRequest.disableRemainingWeightHeuristic = true; routingRequest.rctx.remainingWeightHeuristic = new TrivialRemainingWeightHeuristic(); routingRequest.dominanceFunction = new DominanceFunction.MinimumWeight(); ShortestPathTree spt = astar.getShortestPathTree(routingRequest); List<StopAtDistance> stopsFound = Lists.newArrayList(); if (spt != null) { for (State state : spt.getAllStates()) { Vertex targetVertex = state.getVertex(); if (originVertices.contains(targetVertex)) continue; if (targetVertex instanceof TransitStopVertex && state.isFinal()) { stopsFound.add(stopAtDistanceForState(state)); } } } for (Vertex vertex : originVertices) { if (vertex instanceof TransitStopVertex) { stopsFound.add( new StopAtDistance( (TransitStopVertex) vertex, 0, Collections.emptyList(), null, new State(vertex, routingRequest) )); } } if (removeTempEdges) { routingRequest.cleanup(); } return stopsFound; }
Source:
<code>public RoomWindow newRoom(int roomId){ <START> RoomWindow newRoom=new RoomWindow(roomId); <END> roomWindowMap.put((Integer)roomId,newRoom); newRoom.setVisible(true); return newRoom; }</code><technical_language>rename variable</technical_language>

Target:
public RoomWindow newRoom(int roomId){ RoomWindow room=new RoomWindow(roomId); roomWindowMap.put((Integer)roomId,room); room.setVisible(true); return room; }
Source:
<code>public void onSuccess(long localTime, String id) { long next = localTime + getMinimumTimeBetweenUploads(); tracker.markIdAsUploaded(id); tracker.purgeObsoleteIds(oldIds); editor .setNextSubmission(next) .setLastUploadSucceeded(localTime) .setCurrentDayFailureCount(0) <START> .setCurrentDayResetTime(-1) END> .commit(); if (Logger.LOG_PERSONAL_INFORMATION) { Logger.pii(LOG_TAG, "Successful upload with id " + id + " obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } else { Logger.info(LOG_TAG, "Successful upload obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } }</code><technical_language>want remove, set -1; magic constants. call clearCurrentDayResetTime()</technical_language>

Target:
public void onSuccess(long localTime, String id) { long next = localTime + getMinimumTimeBetweenUploads(); tracker.markIdAsUploaded(id); tracker.purgeObsoleteIds(oldIds); editor .setNextSubmission(next) .setLastUploadSucceeded(localTime) .setCurrentDayFailureCount(0) .clearCurrentDayResetTime() .commit(); if (Logger.LOG_PERSONAL_INFORMATION) { Logger.pii(LOG_TAG, "Successful upload with id " + id + " obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } else { Logger.info(LOG_TAG, "Successful upload obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } }
Source:
<code>private void setConsumerGuestCounts(Owner owner, OwnerInfo info) { Criteria cr = consumerCurator.createSecureCriteria() .createAlias("facts", "f") .add(Restrictions.eq("owner", owner)) .add(Restrictions.eq("f.indices", "virt.is_guest")) <START> .add(Restrictions.eq("f.elements", "true")) <END> .setProjection(Projections.count("id")); int guestCount = ((Long) cr.uniqueResult()).intValue(); Criteria totalConsumersCriteria = consumerCurator.createSecureCriteria() .add(Restrictions.eq("owner", owner)) .setProjection(Projections.count("id")); int totalConsumers = ((Long) totalConsumersCriteria.uniqueResult()).intValue(); int physicalCount = totalConsumers - guestCount; info.setGuestCount(guestCount); info.setPhysicalCount(physicalCount); }</code><technical_language>Restrictions.ilike("f.elements", "true") query case sensitive, I tend insensitive fact values places</technical_language>

Target:
private void setConsumerGuestCounts(Owner owner, OwnerInfo info) { Criteria cr = consumerCurator.createSecureCriteria() .createAlias("facts", "f") .add(Restrictions.eq("owner", owner)) .add(Restrictions.ilike("f.indices", "virt.is_guest")) .add(Restrictions.ilike("f.elements", "true")) .setProjection(Projections.count("id")); int guestCount = ((Long) cr.uniqueResult()).intValue(); Criteria totalConsumersCriteria = consumerCurator.createSecureCriteria() .add(Restrictions.eq("owner", owner)) .setProjection(Projections.count("id")); int totalConsumers = ((Long) totalConsumersCriteria.uniqueResult()).intValue(); int physicalCount = totalConsumers - guestCount; info.setGuestCount(guestCount); info.setPhysicalCount(physicalCount); }
Source:
<code>public synchronized void dropSchema(ConnectorSession session, String schemaName) { if (!schemas.contains(schemaName)) { throw new PrestoException(NOT_FOUND, format("Schema [%s] does not exist", schemaName)); } tables.values().stream() .filter(table -> table.getSchemaName().equals(schemaName)) <START> .forEach(table -> dropTable(session, table)); <END> verify(schemas.remove(schemaName)); }</code><technical_language>allowed drop schema tables</technical_language>

Target:
public synchronized void dropSchema(ConnectorSession session, String schemaName) { if (!schemas.contains(schemaName)) { throw new PrestoException(NOT_FOUND, format("Schema [%s] does not exist", schemaName)); } boolean tablesExist = tables.values().stream() .anyMatch(table -> table.getSchemaName().equals(schemaName)); if (tablesExist) { throw new PrestoException(SCHEMA_NOT_EMPTY, "Schema not empty: " + schemaName); } verify(schemas.remove(schemaName)); }
Source:
<code>public void successfulCompletionWithErrors(ExportSucceededWithErrorsEvent event) { exportStatusList.append("\n").append("SUCCEEDED WITH ERRORS!"); <START> lblExporting.setText("SUCCEEDED WITH SOME ERRORS SEE DETAILS!"); <END> setActiveExportState(false); }</code><technical_language>this CAPS. Succeeded, errors. details</technical_language>

Target:
public void successfulCompletionWithErrors(ExportSucceededWithErrorsEvent event) { exportStatusList.append("\n").append("SUCCEEDED, BUT WITH ERRORS!"); lblExporting.setText("SUCCEEDED, BUT WITH ERRORS. SEE DETAILS!"); setActiveExportState(false); }
Source:
<code>protected void loadMoreItems() { <START> if (nextPage == null || ((nextPage.getUrl() == null || nextPage.getUrl().isEmpty()) <END> && (nextPage.getIds() == null || nextPage.getIds().isEmpty()))) { return; } isLoading.set(true); showListFooter(true); if (searchDisposable != null) { searchDisposable.dispose(); } searchDisposable = ExtractorHelper.getMoreSearchItems( serviceId, searchString, asList(contentFilter), sortFilter, nextPage) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnEvent((nextItemsResult, throwable) -> isLoading.set(false)) .subscribe(this::handleNextItems, this::onError); }</code><technical_language>creating a static method in Page class replace this duplicate piece of code</technical_language>

Target:
protected void loadMoreItems() { if (!Page.isValid(nextPage)) { return; } isLoading.set(true); showListFooter(true); if (searchDisposable != null) { searchDisposable.dispose(); } searchDisposable = ExtractorHelper.getMoreSearchItems( serviceId, searchString, asList(contentFilter), sortFilter, nextPage) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnEvent((nextItemsResult, throwable) -> isLoading.set(false)) .subscribe(this::handleNextItems, this::onError); }
Source:
<code>public void testChannelNamesTransformedToHyperlinks() { String output = instance.replaceChannelNamesWithHyperlinks("Go to #moderation and report a user"); assertThat(output, containsString("#moderation")); <START> assertThat(output, containsString("<a")); <END> }</code><technical_language>writing expected string here</technical_language>

Target:
public void testChannelNamesTransformedToHyperlinks() { String output = instance.replaceChannelNamesWithHyperlinks("Go to #moderation and report a user"); assertThat(output, is("Go to <a href=\"javascript:void(0);\" onClick=\"java.openChannel('#moderation')\">#moderation</a> and report a user")); }
Source:
<code>private void showBuildException(@NotNull BuildException e, @NotNull String stdErr, @NotNull List<GradleMessage> buildMessages) { <START> if (!stdErr.isEmpty()) { <END> GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, stdErr); buildMessages.add(msg); addMessage(msg, null); } else { ByteArrayOutputStream out = new ByteArrayOutputStream(BUFFER_SIZE); try { e.printStackTrace(new PrintStream(out)); String message = "Internal error:" + SystemProperties.getLineSeparator() + out.toString(); GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, message); buildMessages.add(msg); addMessage(msg, null); } finally { Closeables.closeQuietly(out); } } }</code><technical_language>stdErr.trim().isEmpty()</technical_language>

Target:
private void showBuildException(@NotNull BuildException e, @NotNull String stdErr, @NotNull List<GradleMessage> buildMessages) { if (!stdErr.trim().isEmpty()) { GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, stdErr); buildMessages.add(msg); addMessage(msg, null); } else { ByteArrayOutputStream out = new ByteArrayOutputStream(BUFFER_SIZE); try { e.printStackTrace(new PrintStream(out)); String message = "Internal error:" + SystemProperties.getLineSeparator() + out.toString(); GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, message); buildMessages.add(msg); addMessage(msg, null); } finally { Closeables.closeQuietly(out); } } }
Source:
<code>private void createVnicProfileMappingsModel() { updateExternalVnicProfilesPerTargetCluster(); vnicProfileMappingModel = new VnicProfileMappingModel( <START> RegisterTemplateModel.this, <END> externalVnicProfilesPerTargetCluster); vnicProfileMappingModel.initialize(); }</code><technical_language>s/RegisterTemplateModel.this/this</technical_language>

Target:
private void createVnicProfileMappingsModel() { updateExternalVnicProfilesPerTargetCluster(); vnicProfileMappingModel = new VnicProfileMappingModel( this, externalVnicProfilesPerTargetCluster); vnicProfileMappingModel.initialize(); }
Source:
<code>public String[] getAddresses() { <START> return addrFinder.get(); <END> }</code><technical_language>addrFinder null</technical_language>

Target:
public String[] getAddresses() { if (addrs != null) return Arrays.copyOf(addrs, addrs.length); return null; }
Source:
<code>private CppLinkActionBuilder newLinkActionBuilder( Artifact outputArtifact, LinkTargetType linkType) { CppLinkActionBuilder builder = new CppLinkActionBuilder( ruleErrorConsumer, actionConstructionContext, label, outputArtifact, configuration, ccToolchain, fdoContext, featureConfiguration, semantics) .setGrepIncludes(grepIncludes) .setIsStampingEnabled(isStampingEnabled) .setTestOrTestOnlyTarget(isTestOrTestOnlyTarget) .setLinkType(linkType) .setLinkerFiles( (cppConfiguration.useSpecificToolFiles() && linkType.linkerOrArchiver() == LinkerOrArchiver.ARCHIVER) ? ccToolchain.getArFiles() : ccToolchain.getLinkerFiles()) .setLinkArtifactFactory(linkArtifactFactory) .setUseTestOnlyFlags(useTestOnlyFlags); <START> if (ruleContext != null) { <END> builder.addExecutionInfo(TargetUtils.getExecutionInfo(ruleContext.getRule(), ruleContext.isAllowTagsPropagation())); } return builder; }</code><technical_language>if (ruleContext != null && ruleContext.isAllowTagsPropagation()) { ... }</technical_language>

Target:
private CppLinkActionBuilder newLinkActionBuilder( Artifact outputArtifact, LinkTargetType linkType) { return new CppLinkActionBuilder( ruleErrorConsumer, actionConstructionContext, label, outputArtifact, configuration, ccToolchain, fdoContext, featureConfiguration, semantics) .setGrepIncludes(grepIncludes) .setIsStampingEnabled(isStampingEnabled) .setTestOrTestOnlyTarget(isTestOrTestOnlyTarget) .setLinkType(linkType) .setLinkerFiles( (cppConfiguration.useSpecificToolFiles() && linkType.linkerOrArchiver() == LinkerOrArchiver.ARCHIVER) ? ccToolchain.getArFiles() : ccToolchain.getLinkerFiles()) .setLinkArtifactFactory(linkArtifactFactory) .setUseTestOnlyFlags(useTestOnlyFlags) .addExecutionInfo(executionInfo); }
Source:
<code>public void onPageRequest(final PageRequest request) { <START> final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>(); <END> Integer calendarId = 1; calendars.put(calendarId++, getOrgUnit().getId()); calendars.put(calendarId, getOrgUnit().getCalendarId()); calendarId = calendarId + 3; java.util.Iterator<OrgUnitDTO> iter = getOrgUnit().getChildrenOrgUnits().iterator(); while (iter.hasNext()) { calendars.put(calendarId++, getOrgUnit().getChildrenOrgUnits().iterator().next().getId()); calendars.put(calendarId, getOrgUnit().getChildrenOrgUnits().iterator().next().getCalendarId()); iter.next(); calendarId = calendarId + 3; } calendarPresenter.reload(calendars); }</code><technical_language>Yes, is expected behavior expressed in issue #522 : <LINK_0></technical_language>

Target:
public void onPageRequest(final PageRequest request) { final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>(); Integer calendarId = 1; calendars.put(calendarId++, getOrgUnit().getId()); calendars.put(calendarId, getOrgUnit().getCalendarId()); calendarId = calendarId + 3; for(final OrgUnitDTO child : getOrgUnit().getChildrenOrgUnits()) { calendars.put(calendarId++, child.getId()); calendars.put(calendarId, child.getCalendarId()); calendarId = calendarId + 3; } calendarPresenter.reload(calendars); }
Source:
<code>private Page processColumnSource() { DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); if (!finishing && !yieldSignal.isSet()) { CursorProcessorOutput output = cursorProcessor.process(operatorContext.getSession().toConnectorSession(), yieldSignal, cursor, pageBuilder); pageSourceMemoryContext.setBytes(cursor.getSystemMemoryUsage()); long bytesProcessed = cursor.getCompletedBytes() - completedBytes; long elapsedNanos = cursor.getReadTimeNanos() - readTimeNanos; operatorContext.recordGeneratedInput(bytesProcessed, output.getProcessedRows(), elapsedNanos); completedBytes = cursor.getCompletedBytes(); readTimeNanos = cursor.getReadTimeNanos(); <START> if (output.isNoMoreRows()) { <END> finishing = true; currentOutput.finish(); } } Page page = null; if (!pageBuilder.isEmpty() && (finishing || pageBuilder.isFull())) { page = pageBuilder.build(); pageBuilder.reset(); } pageBuilderMemoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); return page; }</code><technical_language>currentOutput in processColumnSource(). I here</technical_language>

Target:
private Page processColumnSource() { DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); if (!finishing && !yieldSignal.isSet()) { CursorProcessorOutput output = cursorProcessor.process(operatorContext.getSession().toConnectorSession(), yieldSignal, cursor, pageBuilder); pageSourceMemoryContext.setBytes(cursor.getSystemMemoryUsage()); long bytesProcessed = cursor.getCompletedBytes() - completedBytes; long elapsedNanos = cursor.getReadTimeNanos() - readTimeNanos; operatorContext.recordGeneratedInput(bytesProcessed, output.getProcessedRows(), elapsedNanos); completedBytes = cursor.getCompletedBytes(); readTimeNanos = cursor.getReadTimeNanos(); if (output.isNoMoreRows()) { finishing = true; mergingOutput.finish(); } } Page page = null; if (!pageBuilder.isEmpty() && (finishing || pageBuilder.isFull())) { page = pageBuilder.build(); pageBuilder.reset(); } pageBuilderMemoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); return page; }
Source:
<code>public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Project project = request.getParameter("project") != null ? getProject(request) : null; PreferenceStore ps = ProjectManager.singleton.getPreferenceStore(); try { <START> response.setCharacterEncoding("UTF-8"); <END> response.setHeader("Content-Type", "application/json"); JSONWriter writer = new JSONWriter(response.getWriter()); writer.object(); for (String key : ps.getKeys()) { Object pref = ps.get(key); if (pref == null || pref instanceof String || pref instanceof Number || pref instanceof Boolean) { writer.key(key); writer.value(pref); } } writer.endObject(); } catch (JSONException e) { respondException(response, e); } }</code><technical_language>@jackyq2015 is "added backed above", is a difference in code I explain me. I accept turn a blind eye some dirty corners of this PR nice if cooperate a bit more I improve PR</technical_language>

Target:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Project project = request.getParameter("project") != null ? getProject(request) : null; PreferenceStore ps = project != null ? project.getMetadata().getPreferenceStore() : ProjectManager.singleton.getPreferenceStore(); try { response.setCharacterEncoding("UTF-8"); response.setHeader("Content-Type", "application/json"); JSONWriter writer = new JSONWriter(response.getWriter()); writer.object(); for (String key : ps.getKeys()) { Object pref = ps.get(key); if (pref == null || pref instanceof String || pref instanceof Number || pref instanceof Boolean) { writer.key(key); writer.value(pref); } } writer.endObject(); } catch (JSONException e) { respondException(response, e); } }
Source:
<code>public EmailProducerBuilder setCcRecipient(String recipient) { List<String> recipients = new ArrayList<String>(); recipients.add(recipient); <START> return this.setCcRecipients(recipients); <END> }</code><technical_language>return this.setCcRecipients(Arrays.asList(recipient))</technical_language>

Target:
public EmailProducerBuilder setCcRecipient(String recipient) { return this.setCcRecipients(Arrays.asList(recipient)); }
Source:
<code>protected final ResourceEventHandler<WorkerType> getResourceEventHandler() { <START> return Preconditions.checkNotNull( <END> this.resourceEventHandler, "Cannot get resource event handler. Resource manager driver is not initialized."); }</code><technical_language>IllegalStateException instead of NullPointerException here? describe error class in a way</technical_language>

Target:
protected final ResourceEventHandler<WorkerType> getResourceEventHandler() { Preconditions.checkState(resourceEventHandler != null, "Cannot get resource event handler. Resource manager driver is not initialized."); return resourceEventHandler; }
Source:
<code><START> public ReplicationState(ReplicationType type) { <END> this(null, type); }</code><technical_language>Currying of parameter is unusual. If is currying of other parameters typically hints wrong parameter order in other method. sense reverse order of parameters of constructor in line 43</technical_language>

Target:
public ReplicationState(ReplicationType type) { this(type, null); }