auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void processTransactionsStatus() { if (_transactionUidVector != null) { Enumeration<?> transactionUidEnum = _transactionUidVector.elements(); while (transactionUidEnum.hasMoreElements()) { Uid currentUid = (Uid) transactionUidEnum.nextElement(); try { if (_recoveryStore.currentState(currentUid, _transactionType) != StateStatus.OS_UNKNOWN) { doRecoverTransaction(currentUid); } } catch (ObjectStoreException e) { if (LRALogger.logger.isTraceEnabled()) { <START> LRALogger.logger.tracef("failed to access transaction store %s: %s", <END> currentUid, e.getMessage(), e); } else if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("failed to access transaction store %s: %s", currentUid, e.getMessage()); } } } } }</code><technical_language>This print stacktrace tracef definition of tracef(String format, Object... params) needs tracef(Throwable t, String format, Object... params) printing "manually" exception message e.getMessage() is necessary message automatically printed logger exception e is passed Throwable. LRALogger.logger.tracef(e, "failed access transaction store %s", currentUid); more question message. Is currentUid meaning "an access of transaction store". message informs able accessing some LRA UID similar</technical_language>

Target:
private void processTransactionsStatus() { if (_transactionUidVector != null) { Enumeration<?> transactionUidEnum = _transactionUidVector.elements(); while (transactionUidEnum.hasMoreElements()) { Uid currentUid = (Uid) transactionUidEnum.nextElement(); try { if (_recoveryStore.currentState(currentUid, _transactionType) != StateStatus.OS_UNKNOWN) { doRecoverTransaction(currentUid); } } catch (ObjectStoreException e) { if (LRALogger.logger.isTraceEnabled()) { LRALogger.logger.tracef(e, "LRARecoverModule: Object store exception '%s' while reading the current state of LRA record %s:", e.getMessage(), currentUid.fileStringForm()); } else if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof( "LRARecoverModule: Object store exception '%s' while reading the current state of LRA record %s", e.getMessage(), currentUid.fileStringForm()); } } } } }
Source:
<code>private void setHttpHeaders(Request request, Response response, BinaryContent content) throws MimeTypeException { <START> String mimeType = content.getMimeTypeValue(); <END> String fileExt = getFileExtFromMimeType(mimeType); if (containsGzip(request)) { LOGGER.trace("Request header accepts gzip"); response.header(HttpHeaders.CONTENT_ENCODING, GZIP); } response.type(mimeType); String attachment = String.format("attachment;filename=export-%s%s", Instant.now().toString(), fileExt); response.header(HttpHeaders.CONTENT_DISPOSITION, attachment); }</code><technical_language>this return null</technical_language>

Target:
private void setHttpHeaders(Request request, Response response, BinaryContent content) throws MimeTypeException { String mimeType = content.getMimeTypeValue(); if (mimeType == null) { LOGGER.debug("Failure to fetch file extension, mime-type is empty"); throw new IllegalArgumentException("Binary Content contains null mime-type value."); } String fileExt = getFileExtFromMimeType(mimeType); if (containsGzip(request)) { LOGGER.trace("Request header accepts gzip"); response.header(HttpHeaders.CONTENT_ENCODING, GZIP); } response.type(mimeType); String attachment = String.format("attachment;filename=export-%s%s", Instant.now().toString(), fileExt); response.header(HttpHeaders.CONTENT_DISPOSITION, attachment); }
Source:
<code>Configuration(String apiKey) { this.apiKey = apiKey; addCallback(new AppCallback(this)); addCallback(new DeviceCallback()); DeviceCallback.initializeCache(); if (ServletCallback.isAvailable()) { addCallback(new ServletCallback()); } <START> sessionDelivery = new AsyncHttpDelivery(); <END> ((HttpDelivery) sessionDelivery).setEndpoint("<LINK_0>"); }</code><technical_language>reason initializing this declaration time</technical_language>

Target:
Configuration(String apiKey) { this.apiKey = apiKey; addCallback(new AppCallback(this)); addCallback(new DeviceCallback()); DeviceCallback.initializeCache(); if (ServletCallback.isAvailable()) { addCallback(new ServletCallback()); } }
Source:
<code>public void onFreed(MgcpEndpoint endpoint) { queue.offer(endpoint); if(logger.isDebugEnabled()) { logger.debug("Endpoint " + endpoint.getName() + " released"); <START> logger.debug("Free " + endpoint.getEndpoint().toString() + " endpoints " + queue.size()); <END> } }</code><technical_language>a single log line "Endpoint xxx released (free=yyy)"</technical_language>

Target:
public void onFreed(MgcpEndpoint endpoint) { queue.offer(endpoint); if(logger.isDebugEnabled()) { logger.debug("Endpoint " + endpoint.getName() + " released (free="+queue.size()+")"); } }
Source:
<code>public void clear() { <START> itens.clear(); <END> selection.clear(); notifiyMissionUpdate(); }</code><technical_language>'itens' a typo, want fix this while modifying file</technical_language>

Target:
public void clear() { items.clear(); selection.clear(); notifiyMissionUpdate(); }
Source:
<code>public static String elementToString(Element element) { try { if (element == null) { return null; } TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); <START> Transformer transformer = factory.newTransformer(); <END> transformer.setOutputProperty(OutputKeys.INDENT, "yes"); StringWriter buff = new StringWriter(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(new DOMSource(element), new StreamResult(buff)); return buff.toString(); } catch (Exception e) { log.error("Error while convering element to string: " + e.getMessage(), e); return null; } }</code><technical_language>tab for indentation</technical_language>

Target:
public static String elementToString(Element element) { try (StringWriter buff = new StringWriter()) { if (element == null) { return null; } TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(new DOMSource(element), new StreamResult(buff)); return buff.toString(); } catch (TransformerException e) { log.error("Error while converting element to string: " + e.getMessage(), e); return null; } catch (IOException e) { log.error("Error while closing StringWriter " + e.getMessage(), e); return null; } }
Source:
<code>public List<Long> findCcRemovedJudgmentSourceIds() { log.info("Searching for ccJudgments removed from external repository"); List<Long> removedJudgmentsIds = judgmentRepository.findAllIdsBySourceCode(SourceCode.COMMON_COURT); int pageNumber = 0; while(true) { List<String> judgmentExternalIdsPage = sourceCcjExternalRepository.findJudgmentIds(pageNumber, pageSize, null); log.info("Downloaded judgment ids from external repository", (pageNumber*pageSize) + judgmentExternalIdsPage.size()); if (judgmentExternalIdsPage.isEmpty()) { break; } <START> List<Long> judgmentIdsPage = judgmentRepository.findAllIdsBySourceCodeAndSourceJudgmentIds(SourceCode.COMMON_COURT, judgmentExternalIdsPage); <END> removedJudgmentsIds.removeAll(judgmentIdsPage); ++pageNumber; } return removedJudgmentsIds; }</code><technical_language>Well, if pageSize 10000? a problem</technical_language>

Target:
public List<Long> findCcRemovedJudgmentSourceIds() { log.info("Searching for ccJudgments removed from external repository"); List<Long> removedJudgmentsIds = judgmentRepository.findAllIdsBySourceCode(SourceCode.COMMON_COURT); int pageNumber = 0; while(true) { List<String> judgmentExternalIdsPage = sourceCcjExternalRepository.findJudgmentIds(pageNumber, externalRepositoryPageSize, null); log.info("Downloaded judgment ids from external repository", (pageNumber*externalRepositoryPageSize) + judgmentExternalIdsPage.size()); if (judgmentExternalIdsPage.isEmpty()) { break; } List<Long> judgmentIdsPage = findCorrespondingJudgmentIds(judgmentExternalIdsPage); removedJudgmentsIds.removeAll(judgmentIdsPage); ++pageNumber; } return removedJudgmentsIds; }
Source:
<code>public void pause() { try { log.debug("Stopping session for EventReciever."); <START> if (!this.consumer.isClosed()) { <END> this.consumer.close(); } } catch (ActiveMQException e) { log.warn("Message receiver could not stop client consumer.", e); } }</code><technical_language>If .close() returns silently repeated operations, drop this check. Otherwise, I argue moving debug statement this block output a message no-op</technical_language>

Target:
public void pause() { try { log.debug("Pausing message consumption for: {}.", listener); this.consumer.close(); } catch (ActiveMQException e) { log.warn("Message receiver could not stop client consumer.", e); } }
Source:
<code>public List<WorkspaceImpl> getWorkspaces(String user, boolean includeRuntimes) throws ServerException { requireNonNull(user, "Required non-null user id"); final List<WorkspaceImpl> workspaces = workspaceDao.getWorkspaces(user); <START> if (includeRuntimes) { <END> for (WorkspaceImpl workspace : workspaces) { normalizeState(workspace); } } else { for (WorkspaceImpl workspace : workspaces) { workspace.setStatus(runtimes.getStatus(workspace.getId())); } } return workspaces; }</code><technical_language>a <LINK_0></technical_language>

Target:
public List<WorkspaceImpl> getWorkspaces(String user, boolean includeRuntimes) throws ServerException { requireNonNull(user, "Required non-null user id"); final List<WorkspaceImpl> workspaces = workspaceDao.getWorkspaces(user); for (WorkspaceImpl workspace : workspaces) { normalizeState(workspace, includeRuntimes); } return workspaces; }
Source:
<code>private Object handleNonTxWriteCommand(InvocationContext ctx, WriteCommand command) throws Throwable { if (trace) log.tracef("handleNonTxWriteCommand for command %s, topology id %d", command, command.getTopologyId()); if (isLocalOnly(ctx, command)) { return invokeNextInterceptor(ctx, command); } updateTopologyId(command); if (!ctx.isOriginLocal()) { return invokeNextInterceptor(ctx, command); } int commandTopologyId = command.getTopologyId(); Object localResult; try { localResult = invokeNextInterceptor(ctx, command); return localResult; } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; if (trace) log.tracef("Retrying command because of topology change, current topology is %d: %s", <START> command.getTopologyId(), command); <END> int newTopologyId = Math.max(currentTopologyId(), commandTopologyId + 1); command.setTopologyId(newTopologyId); waitForTransactionData(newTopologyId); command.setFlags(Flag.COMMAND_RETRY); localResult = handleNonTxWriteCommand(ctx, command); } return localResult; }</code><technical_language>topology id is supposed current topology, command. this: int currentTopologyId = currentTopologyId(); if (trace) log.tracef("Retrying command of topology change, current topology is %d: %s", currentTopologyId, command); int newTopologyId = Math.max(currentTopologyId, command.getTopologyId() + 1);</technical_language>

Target:
private Object handleNonTxWriteCommand(InvocationContext ctx, WriteCommand command) throws Throwable { if (trace) log.tracef("handleNonTxWriteCommand for command %s, topology id %d", command, command.getTopologyId()); if (isLocalOnly(ctx, command)) { return invokeNextInterceptor(ctx, command); } updateTopologyId(command); if (!ctx.isOriginLocal()) { return invokeNextInterceptor(ctx, command); } int commandTopologyId = command.getTopologyId(); Object localResult; try { localResult = invokeNextInterceptor(ctx, command); return localResult; } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; int currentTopologyId = currentTopologyId(); if (trace) log.tracef("Retrying command because of topology change, current topology is %d: %s", currentTopologyId, command); int newTopologyId = Math.max(currentTopologyId, commandTopologyId + 1); command.setTopologyId(newTopologyId); waitForTransactionData(newTopologyId); command.setFlags(Flag.COMMAND_RETRY); localResult = handleNonTxWriteCommand(ctx, command); } return localResult; }
Source:
<code>private void notifyDataSetChanged() { if (isFinishing()) { return; } if (search == null) { return; } <START> final ScrollView scroll = ButterKnife.findById(this, R.id.detailScroll); <END> cache = search.getFirstCacheFromResult(LoadFlags.LOAD_ALL_DB_ONLY); if (cache == null) { progress.dismiss(); showToast(res.getString(R.string.err_detail_cache_find_some)); finish(); return; } cache.setChangeNotificationHandler(new ChangeNotificationHandler(this, progress)); setCacheTitleBar(cache); imagesList = null; reinitializeViewPager(); invalidateOptionsMenuCompatible(); progress.dismiss(); Settings.addCacheToHistory(cache.getGeocode()); final ScrollView scrollNew = ButterKnife.findById(this, R.id.detailScroll); if ((scroll != null) && (scrollNew != null)) { final int lastScrollPos = scroll.getScrollY(); scrollNew.post(new Runnable() { @Override public void run() { scrollNew.scrollTo(0, lastScrollPos); } }); } }</code><technical_language>early instead of scrollNew</technical_language>

Target:
private void notifyDataSetChanged() { if (isFinishing()) { return; } if (search == null) { return; } cache = search.getFirstCacheFromResult(LoadFlags.LOAD_ALL_DB_ONLY); if (cache == null) { progress.dismiss(); showToast(res.getString(R.string.err_detail_cache_find_some)); finish(); return; } cache.setChangeNotificationHandler(new ChangeNotificationHandler(this, progress)); setCacheTitleBar(cache); final ScrollView scroll = ButterKnife.findById(this, R.id.detailScroll); imagesList = null; reinitializeViewPager(); invalidateOptionsMenuCompatible(); progress.dismiss(); Settings.addCacheToHistory(cache.getGeocode()); if (scroll != null) { final int lastScrollPos = scroll.getScrollY(); final ScrollView scrollNew = ButterKnife.findById(this, R.id.detailScroll); scrollNew.post(new Runnable() { @Override public void run() { scrollNew.scrollTo(0, lastScrollPos); } }); } }
Source:
<code>public void close_blocksUntilFirstCallToCloseCompletes() throws Exception { gemFireCacheImpl = gemFireCacheImpl(false); CyclicBarrier cyclicBarrier = new CyclicBarrier(3); Future<Boolean> close1 = executorServiceRule.submit(() -> { synchronized (GemFireCacheImpl.class) { cyclicBarrier.await(getTimeout().toMillis(), MILLISECONDS); return gemFireCacheImpl.doClose("test", null, false, false, false); } }); await().until(() -> cyclicBarrier.getNumberWaiting() == 1); Future<Boolean> close2 = executorServiceRule.submit(() -> { cyclicBarrier.await(getTimeout().toMillis(), MILLISECONDS); return gemFireCacheImpl.doClose("test", null, false, false, false); }); cyclicBarrier.await(getTimeout().toMillis(), MILLISECONDS); boolean closedCache1 = close1.get(); boolean closedCache2 = close2.get(); <START> <END> assertThat(closedCache1) .as("closedCache1=" + closedCache1 + " and closedCache2=" + closedCache2) .isTrue(); }</code><technical_language>for safe, assert closedCache2 is false</technical_language>

Target:
public void close_blocksUntilFirstCallToCloseCompletes() throws Exception { gemFireCacheImpl = gemFireCacheImpl(false); CyclicBarrier cyclicBarrier = new CyclicBarrier(3); Future<Boolean> close1 = executorServiceRule.submit(() -> { synchronized (GemFireCacheImpl.class) { cyclicBarrier.await(getTimeout().toMillis(), MILLISECONDS); return gemFireCacheImpl.doClose("test", null, false, false, false); } }); await().until(() -> cyclicBarrier.getNumberWaiting() == 1); Future<Boolean> close2 = executorServiceRule.submit(() -> { cyclicBarrier.await(getTimeout().toMillis(), MILLISECONDS); return gemFireCacheImpl.doClose("test", null, false, false, false); }); cyclicBarrier.await(getTimeout().toMillis(), MILLISECONDS); boolean closedCache1 = close1.get(); boolean closedCache2 = close2.get(); assertThat(closedCache1) .as("closedCache1=" + closedCache1 + " and closedCache2=" + closedCache2) .isTrue(); assertThat(closedCache2) .as("closedCache1=" + closedCache1 + " and closedCache2=" + closedCache2) .isFalse(); }
Source:
<code>private Part loadPart(File stateDir, String objectId, String partFileName) { File objectStateDir = getObjectStateDir(stateDir, objectId); File partFile = new File(objectStateDir, partFileName); val mapper = new ObjectMapper(); Part part = null; try (val partStream = new FileInputStream(partFile)) { <START> part = mapper.readValue(partStream, Part.class); <END> } catch (IOException e) { throw new NotRetryableException(e); } return part; }</code><technical_language>mapper.readValue(partFile, Part.class). encapsulate this in a helper (i.e. readPart(partFile))</technical_language>

Target:
private Part loadPart(File stateDir, String objectId, String partFileName) { File objectStateDir = getObjectStateDir(stateDir, objectId); File partFile = new File(objectStateDir, partFileName); return readPart(partFile); }
Source:
<code>private boolean added(Provider<E> provider, E element, Collection<E> providerElements) { final K uid = element.getUID(); if (identifierToElement.containsKey(uid)) { logger.warn( "{} with key '{}' already exists from provider {}! Failed to add a second with the same UID from provider {}!", element.getClass().getSimpleName(), uid, elementToProvider.get(identifierToElement.get(uid)).getClass().getSimpleName(), provider.getClass().getSimpleName()); return false; } try { onAddElement(element); } catch (final RuntimeException ex) { <START> logger.warn("Could not add element: {}", ex.getMessage(), ex); <END> return false; } identifierToElement.put(element.getUID(), element); elementToProvider.put(element, provider); providerElements.add(element); elements.add(element); return true; }</code><technical_language>suggestion logger.warn("Could add key '{}': {}", element.getClass().getSimpleName(), uid, ex.getMessage(), ex);</technical_language>

Target:
private boolean added(Provider<E> provider, E element, Collection<E> providerElements) { final K uid = element.getUID(); if (identifierToElement.containsKey(uid)) { logger.warn( "Cannot add \"{}\" with key \"{}\". It exists already from provider \"{}\"! Failed to add a second with the same UID from provider \"{}\"!", element.getClass().getSimpleName(), uid, elementToProvider.get(identifierToElement.get(uid)).getClass().getSimpleName(), provider.getClass().getSimpleName()); return false; } try { onAddElement(element); } catch (final RuntimeException ex) { logger.warn("Cannot add \"{}\" with key \"{}\": {}", element.getClass().getSimpleName(), uid, ex.getMessage(), ex); return false; } identifierToElement.put(element.getUID(), element); elementToProvider.put(element, provider); providerElements.add(element); elements.add(element); return true; }
Source:
<code>private void assertExpectedValueDisplayed(String dsName, String attribute, String expectedValue) { page.invokeViewDatasource(dsName); ConnectionConfig connection = page.getConnectionConfig(); String actualValue = connection.getAttributeValueBySubstring(attribute); <START> Assert.assertEquals("Incorrect value of " + attribute + " displayed. See <LINK_0>", expectedValue, actualValue); <END> }</code><technical_language>Please reference upstream jira</technical_language>

Target:
private void assertExpectedValueDisplayed(String dsName, String attribute, String expectedValue) { page.invokeViewDatasource(dsName); ConnectionConfig connection = page.getConnectionConfig(); String actualValue = connection.getAttributeValueBySubstring(attribute); Assert.assertEquals("Incorrect value of " + attribute + " displayed. See <LINK_1>", expectedValue, actualValue); }
Source:
<code>private List<ServerChecker> getServerCheckers() throws InfrastructureException { ArrayList<ServerChecker> checkers = new ArrayList<>(servers.size()); for (Map.Entry<String, ServerImpl> serverEntry : servers.entrySet()) { <START> if (!livenessChecksPaths.containsKey(serverEntry.getKey())) { <END> continue; } checkers.add(getChecker(serverEntry.getKey(), serverEntry.getValue())); } return checkers; }</code><technical_language>follow positive condition java if (livenessChecksPaths.containsKey(serverEntry.getKey())) { checkers.add(...) }</technical_language>

Target:
private List<ServerChecker> getServerCheckers() throws InfrastructureException { ArrayList<ServerChecker> checkers = new ArrayList<>(servers.size()); for (Map.Entry<String, ServerImpl> serverEntry : servers.entrySet()) { if (LIVENESS_CHECKS_PATHS.containsKey(serverEntry.getKey())) { checkers.add(getChecker(serverEntry.getKey(), serverEntry.getValue())); } } return checkers; }
Source:
<code>public void clearMessageSentToClientWithRegisteredInterest() throws Exception { Region<Object, Object> testRegion = client.getCache().getRegion(NAME); assertThat(testRegion).isEmpty(); server1.invoke(() -> addRecord(10)); assertThat(testRegion).hasSize(0); testRegion.registerInterestForAllKeys(); assertThat(testRegion).hasSize(10); Boolean cleared = false; <START> for (int i = 0; i < servers.size(); i++) { <END> if (!cleared) { cleared = servers.get(i).invoke( PartitionRegionClearMessageQueueDUnitTest::clearRegionOnNoClientProxyMember); } } assertThat(cleared).isTrue(); assertThat(testRegion).hasSize(0); }</code><technical_language>this clear invoked server? If successfully clears server, happy. finish loop. introduce a break if cleared == true continuing loop. logic is a bit odd way</technical_language>

Target:
public void clearMessageSentToClientWithRegisteredInterest() throws Exception { Region<Object, Object> testRegion = client.getCache().getRegion(NAME); assertThat(testRegion).isEmpty(); server1.invoke(() -> addRecord(10)); assertThat(testRegion).hasSize(0); testRegion.registerInterestForAllKeys(); assertThat(testRegion).hasSize(10); Boolean cleared = false; for (int i = 0; i < servers.size(); i++) { cleared = servers.get(i).invoke( PartitionRegionClearMessageQueueDUnitTest::clearRegionOnNoClientProxyMember); if (cleared) { break; } } assertThat(cleared).isTrue(); assertThat(testRegion).hasSize(0); }
Source:
<code>private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException, BacktrackException { List<IASTInitializerClause> result= new ArrayList<IASTInitializerClause>(); loop: while (true) { IASTInitializerClause clause = initClause(allowSkipping); if (allowSkipping && maximumTrivialExpressionsInAggregateInitializers <= result.size()) { <START> if (!ASTQueries.canContainName(clause)) { <END> translationUnit.setHasNodesOmitted(true); clause= null; } } if (LT(1) == IToken.tELLIPSIS) { final int endOffset = consume(IToken.tELLIPSIS).getEndOffset(); if (clause instanceof ICPPASTPackExpandable) { ((ICPPASTPackExpandable) clause).setIsPackExpansion(true); adjustEndOffset(clause, endOffset); } else if (clause instanceof IASTExpression) { IASTExpression packExpansion= nodeFactory.newPackExpansionExpression((IASTExpression) clause); clause= setRange(packExpansion, clause, endOffset); } } result.add(clause); if (LT(1) != IToken.tCOMMA) break; switch (LT(2)) { case IToken.tRBRACE: case IToken.tRPAREN: case IToken.tEOC: break loop; } consume(IToken.tCOMMA); } return result; }</code><technical_language>Please combine nested 'if' statements one. condition easier read if written result.getSize() >= maximumTrivialExpressionsInAggregateInitializers</technical_language>

Target:
private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException, BacktrackException { List<IASTInitializerClause> result= new ArrayList<IASTInitializerClause>(); loop: while (true) { IASTInitializerClause clause = initClause(allowSkipping); if (allowSkipping && result.size() >= maximumTrivialExpressionsInAggregateInitializers && !ASTQueries.canContainName(clause)) { translationUnit.setHasNodesOmitted(true); clause= null; } if (LT(1) == IToken.tELLIPSIS) { final int endOffset = consume(IToken.tELLIPSIS).getEndOffset(); if (clause instanceof ICPPASTPackExpandable) { ((ICPPASTPackExpandable) clause).setIsPackExpansion(true); adjustEndOffset(clause, endOffset); } else if (clause instanceof IASTExpression) { IASTExpression packExpansion= nodeFactory.newPackExpansionExpression((IASTExpression) clause); clause= setRange(packExpansion, clause, endOffset); } } result.add(clause); if (LT(1) != IToken.tCOMMA) break; switch (LT(2)) { case IToken.tRBRACE: case IToken.tRPAREN: case IToken.tEOC: break loop; } consume(IToken.tCOMMA); } return result; }
Source:
<code>public KnoxShellTableFilter name(String name) { for (int i = 0; i < tableToFilter.headers.size(); i++) { if (tableToFilter.headers.get(i).equalsIgnoreCase(name)) { <START> index = i; <END> break; } else { index = -1; } } return this; }</code><technical_language>is index for of this method? issue index is updated changed -1 matches switched right index</technical_language>

Target:
public KnoxShellTableFilter name(String name) throws KnoxShellTableFilterException { for (int i = 0; i < tableToFilter.headers.size(); i++) { if (tableToFilter.headers.get(i).equalsIgnoreCase(name)) { index = i; break; } } if (index == -1) { throw new KnoxShellTableFilterException("Column name not found"); } return this; }
Source:
<code>public Map<String, List<MessageReference>> getDeliveringMessages() { final Iterator<ConsumerHolder<? extends Consumer>> consumerHolderIterator; synchronized (this) { consumerHolderIterator = redistributor == null ? consumers.iterator() : SingletonIterator.newInstance(redistributor); } Map<String, List<MessageReference>> mapReturn = new HashMap<>(); while (consumerHolderIterator.hasNext()) { ConsumerHolder holder = consumerHolderIterator.next(); List<MessageReference> msgs = holder.consumer.getDeliveringMessages(); if (msgs != null && msgs.size() > 0) { mapReturn.put(holder.consumer.toManagementString(), msgs); } } for (String lingerSessionId : lingerSessionIds) { ServerSession serverSession = server.getSessionByID(lingerSessionId); if (serverSession != null) { <START> List<MessageReference> refs = serverSession.getInTxLingerMessages(); <END> if (!refs.isEmpty()) { mapReturn.put(serverSession.toManagementString(), refs); } } } return mapReturn; }</code><technical_language>I semantic change change here. I getInTxLingerMessages() return null, so, changed serverSession != null, stopped verifying actual result. this NPE tests breaks</technical_language>

Target:
public Map<String, List<MessageReference>> getDeliveringMessages() { final Iterator<ConsumerHolder<? extends Consumer>> consumerHolderIterator; synchronized (this) { consumerHolderIterator = redistributor == null ? consumers.iterator() : SingletonIterator.newInstance(redistributor); } Map<String, List<MessageReference>> mapReturn = new HashMap<>(); while (consumerHolderIterator.hasNext()) { ConsumerHolder holder = consumerHolderIterator.next(); List<MessageReference> msgs = holder.consumer.getDeliveringMessages(); if (msgs != null && msgs.size() > 0) { mapReturn.put(holder.consumer.toManagementString(), msgs); } } for (String lingerSessionId : lingerSessionIds) { ServerSession serverSession = server.getSessionByID(lingerSessionId); List<MessageReference> refs = serverSession == null ? null : serverSession.getInTxLingerMessages(); if (refs != null && !refs.isEmpty()) { mapReturn.put(serverSession.toManagementString(), refs); } } return mapReturn; }
Source:
<code>public List<String> filter(List<String> children) { List<String> filteredChildren = new ArrayList<>(); <START> for (String child : children) <END> { int separatorIndex = child.lastIndexOf('-'); if (separatorIndex < 0) { filteredChildren.add(child); continue; } String childPrefix = child.substring(0, separatorIndex); String ephemeralStorePrefix = _prefixGenerator.generatePrefix(); if (childPrefix.equals(ephemeralStorePrefix)) { filteredChildren.add(child); } else if (childPrefix.equals(ZooKeeperEphemeralStore.DEFAULT_PREFIX)) { filteredChildren.add(child); } } return filteredChildren; }</code><technical_language>java 8 stream</technical_language>

Target:
public List<String> filter(List<String> children) { if (children == null) { return null; } return children.stream().filter(child -> { int separatorIndex = child.lastIndexOf('-'); String childPrefix = separatorIndex > 0 ? child.substring(0, separatorIndex) : child; String ephemeralStorePrefix = _prefixGenerator.generatePrefix(); return StringUtils.isEmpty(ephemeralStorePrefix) || childPrefix.equals(ephemeralStorePrefix) || childPrefix.equals(ZooKeeperEphemeralStore.DEFAULT_PREFIX); }).collect(Collectors.toList()); }
Source:
<code>public boolean init(Aphrodite aphrodite, AphroditeConfig config) throws NotFoundException { this.aphrodite = aphrodite; this.config = config; <START> urlToStreamsMap.values(); <END> return updateStreams(); }</code><technical_language>purpose call values() ignore returned collection this place</technical_language>

Target:
public boolean init(Aphrodite aphrodite, AphroditeConfig config) throws NotFoundException { this.config = config; return updateStreams(); }
Source:
<code>public String getModelId(String deviceId) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return null; } Object modelId = settingsData.node("lights").node(deviceId).value("modelid"); if(modelId instanceof String) { return (String) modelId; } else { return "unknown"; <START> } <END> }</code><technical_language>if/else replaced java return modelId != null ? modelId.toString() : null;</technical_language>

Target:
public String getModelId(String deviceId) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return null; } Object modelId = settingsData.node("lights").node(deviceId).value("modelid"); return modelId != null ? modelId.toString() : null; }
Source:
<code>public void loadGroupLoansAccountTemplate(int groupId, int productId) { checkViewAttached(); getMvpView().showProgressbar(true); if (mSubscription != null) mSubscription.unsubscribe(); <START> mSubscription = mDataManager.getGroupLoansAccountTemplate(groupId, productId) <END> .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<GroupLoanTemplate>() { @Override public void onCompleted() { getMvpView().showProgressbar(false); } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showFetchingError("Failed to load GroupLoan"); } @Override public void onNext(GroupLoanTemplate groupLoanTemplate) { getMvpView().showProgressbar(false); getMvpView().showGroupLoanTemplate( groupLoanTemplate); } }); }</code><technical_language>Remove Subscription CompositeSubscription. <LINK_0> for example</technical_language>

Target:
public void loadGroupLoansAccountTemplate(int groupId, int productId) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManager.getGroupLoansAccountTemplate(groupId, productId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<GroupLoanTemplate>() { @Override public void onCompleted() { getMvpView().showProgressbar(false); } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showFetchingError("Failed to load GroupLoan"); } @Override public void onNext(GroupLoanTemplate groupLoanTemplate) { getMvpView().showProgressbar(false); getMvpView().showGroupLoanTemplate( groupLoanTemplate); } }) ); }
Source:
<code>public ModelAndView getBrowseAllRssFeedView(@SiteParam Site site, @PathVariable String feedType) throws IOException { ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery("*:*") .setStart(0) .setRows(15) .setJournalKeys(ImmutableList.of(site.getJournalKey())) .setSortOrder(SolrSearchServiceImpl.SolrSortOrder.DATE_NEWEST_FIRST) .setDateRange(SolrSearchServiceImpl.SolrEnumeratedDateRange.ALL_TIME) .setSimple(false) .setIsRssSearch(true); ArticleSearchQuery queryObj = query.build(); Map<String, ?> searchResults = solrSearchService.search(queryObj); ModelAndView mav = new ModelAndView(); mav.addObject("site", site); mav.addObject("solrResults", searchResults.get("docs")); if (feedType.equalsIgnoreCase(FeedType.ATOM.name())) { mav.setView(articleFeedView.getArticleAtomView()); <START> } else { <END> mav.setView(articleFeedView.getArticleRssView()); } return mav; }</code><technical_language>this "else if RSS" throw 404 otherwise? Also, want declare options in request mapping. do {feedType:rss|atom} (don't quote syntax). able get strings enums though, annotations</technical_language>

Target:
public ModelAndView getBrowseAllRssFeedView(@SiteParam Site site, @PathVariable String feedType) throws IOException { ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery("*:*") .setStart(0) .setRows(RSS_ARTICLE_COUNT) .setJournalKeys(ImmutableList.of(site.getJournalKey())) .setSortOrder(SolrSearchServiceImpl.SolrSortOrder.DATE_NEWEST_FIRST) .setDateRange(SolrSearchServiceImpl.SolrEnumeratedDateRange.ALL_TIME) .setSimple(false) .setIsRssSearch(true); ArticleSearchQuery queryObj = query.build(); Map<String, ?> searchResults = solrSearchService.search(queryObj); return getFeedModelAndView(site, feedType, searchResults); }
Source:
<code>public V001() { super(); WikibaseUris uris = WikibaseUris.getURISystem(); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.reference(), 40)); <START> addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.value(), 40)); <END> }</code><technical_language>handler for above, collide? Also, uris.value is 32 chars long, 40 (no idea why, is)</technical_language>

Target:
public V001() { super(); WikibaseUris uris = WikibaseUris.getURISystem(); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.reference(), 40)); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.value(), 32)); }
Source:
<code>private String getBodyContentAsString() { if (body == null) { return null; } try { String contentType = (messageProperties != null) ? messageProperties.getContentType() : null; if (MessageProperties.CONTENT_TYPE_SERIALIZED_OBJECT.equals(contentType)) { return SerializationUtils.deserialize(body).toString(); } if (MessageProperties.CONTENT_TYPE_TEXT_PLAIN.equals(contentType)) { return new String(body, ENCODING); } if (MessageProperties.CONTENT_TYPE_JSON.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON_ALT.equals(contentType)) { <START> return new String(body, ENCODING); <END> } } catch (Exception e) { } return body.toString()+"(byte["+body.length+"])"; }</code><technical_language>CONTENT_TYPE_XML included here? CONTENT_TYPE_TEXT_PLAIN this if</technical_language>

Target:
private String getBodyContentAsString() { if (body == null) { return null; } try { String contentType = (messageProperties != null) ? messageProperties.getContentType() : null; if (MessageProperties.CONTENT_TYPE_SERIALIZED_OBJECT.equals(contentType)) { return SerializationUtils.deserialize(body).toString(); } if (MessageProperties.CONTENT_TYPE_TEXT_PLAIN.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON_ALT.equals(contentType) || MessageProperties.CONTENT_TYPE_XML.equals(contentType)) { return new String(body, ENCODING); } } catch (Exception e) { } return body.toString()+"(byte["+body.length+"])"; }
Source:
<code>public void enqueue(Callback callback) { ListenableFuture<Listener> listenerFuture = limiter.acquire(); Futures.addCallback(listenerFuture, new FutureCallback<Listener>() { @Override public void onSuccess(Listener listener) { enqueue(new RequestCompletion(schedulingExecutor, executionExecutor, callback, listener)); } @Override public void onFailure(Throwable t) { callback.onFailure( RemotingOkHttpCall.this, <START> new IOException(new AssertionError("This should never happen", t))); <END> } }, MoreExecutors.directExecutor()); }</code><technical_language>explain a bit more in message please</technical_language>

Target:
public void enqueue(Callback callback) { super.enqueue(new Callback() { @Override public void onFailure(Call call, IOException exception) { urls.markAsFailed(request().url()); Optional<Duration> backoff = backoffStrategy.nextBackoff(); if (!backoff.isPresent()) { callback.onFailure(call, new IOException("Failed to complete the request due to an " + "IOException", exception)); return; } Optional<HttpUrl> redirectTo = urls.redirectToNext(request().url()); if (!redirectTo.isPresent()) { callback.onFailure(call, new IOException("Failed to determine valid failover URL" + "for '" + request().url() + "' and base URLs " + urls.getBaseUrls())); return; } Request redirectedRequest = request().newBuilder() .url(redirectTo.get()) .build(); RemotingOkHttpCall retryCall = client.newCallWithMutableState(redirectedRequest, backoffStrategy, maxNumRelocations - 1); log.debug("Rescheduling call after backoff", SafeArg.of("backoffMillis", backoff.get().toMillis()), exception); scheduleExecution(() -> retryCall.enqueue(callback), backoff.get()); } @Override public void onResponse(Call call, Response response) throws IOException { if (response.code() / 100 <= 2) { callback.onResponse(call, response); return; } Supplier<Response> errorResponseSupplier; try { byte[] body = response.body().bytes(); errorResponseSupplier = () -> buildFrom(response, body); } catch (IOException e) { onFailure(call, e); return; } Optional<QosException> qosError = qosHandler.handle(errorResponseSupplier.get()); if (qosError.isPresent()) { qosError.get().accept(createQosVisitor(callback, call)); return; } Optional<RemoteException> httpError = remoteExceptionHandler.handle(errorResponseSupplier.get()); if (httpError.isPresent()) { callback.onFailure(call, new IoRemoteException(httpError.get())); return; } Optional<IOException> ioException = ioExceptionHandler.handle(errorResponseSupplier.get()); if (ioException.isPresent()) { callback.onFailure(call, ioException.get()); return; } callback.onFailure(call, new IOException("Failed to handle request, this is an http-remoting bug.")); } }); }
Source:
<code>public void sendLogoutRequest( @Context HttpServletRequest request, @Context HttpServletResponse response) { response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setContentType("text/html"); UriBuilder redirectPage = UriBuilder.fromUri(casServerLogoutUrl); HttpSession session = request.getSession(false); if (session != null) { SecurityTokenHolder savedToken = (SecurityTokenHolder) session.getAttribute(SecurityConstants.SAML_ASSERTION); <START> if (savedToken != null) { <END> Subject subject = ThreadContext.getSubject(); boolean hasSecurityAuditRole = Arrays.stream(System.getProperty("security.audit.roles", "").split(",")) .filter(subject::hasRole) .findFirst() .isPresent(); if (hasSecurityAuditRole) { SecurityLogger.audit("Subject with admin privileges has logged out", subject); } savedToken.removeAll(); } session.invalidate(); deleteJSessionId(response); } try { response.sendRedirect(redirectPage.build().toString()); } catch (IOException e) { LOGGER.warn("Failed to send redirect: ", e); } }</code><technical_language>This return a null subject check it. Generally SecurityUtils for this call, is fine in this case want generate exception</technical_language>

Target:
public void sendLogoutRequest( @Context HttpServletRequest request, @Context HttpServletResponse response) { response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setContentType("text/html"); UriBuilder redirectPage = UriBuilder.fromUri(casServerLogoutUrl); HttpSession session = request.getSession(false); if (session != null) { SecurityTokenHolder savedToken = (SecurityTokenHolder) session.getAttribute(SecurityConstants.SAML_ASSERTION); if (savedToken != null) { Subject subject = ThreadContext.getSubject(); if (subject != null) { boolean hasSecurityAuditRole = Arrays.stream(System.getProperty("security.audit.roles", "").split(",")) .filter(subject::hasRole) .findFirst() .isPresent(); if (hasSecurityAuditRole) { SecurityLogger.audit("Subject with admin privileges has logged out", subject); } } savedToken.removeAll(); } session.invalidate(); } try { response.sendRedirect(redirectPage.build().toString()); } catch (IOException e) { LOGGER.warn("Failed to send redirect: ", e); } }
Source:
<code>public static FirmwareUpdateStore create(final OTAHistoryDAODynamoDB otaHistoryDAO, final AmazonS3 s3, final String bucketName, final AmazonS3 s3Signer, final Integer s3CacheExpireMinutes, final FirmwareVersionMappingDAO firmwareVersionMappingDAO, final FirmwareUpgradePathDAO firmwareUpgradePathDAO) { final Cache<String, Pair<Integer, List<OutputProtos.SyncResponse.FileDownload>>> s3Cache = CacheBuilder.newBuilder() .expireAfterWrite(s3CacheExpireMinutes, TimeUnit.MINUTES) .build(); final Cache<DeviceGroupFW, String> s3ObjectKeyCache = CacheBuilder.newBuilder() <START> .expireAfterWrite(5, TimeUnit.MINUTES) <END> .build(); return new FirmwareUpdateStore(otaHistoryDAO, s3, bucketName, s3Signer, s3Cache, firmwareVersionMappingDAO, firmwareUpgradePathDAO, s3ObjectKeyCache); }</code><technical_language>1min</technical_language>

Target:
public static FirmwareUpdateStore create(final OTAHistoryDAODynamoDB otaHistoryDAO, final AmazonS3 s3, final String bucketName, final AmazonS3 s3Signer, final Integer s3CacheExpireMinutes, final FirmwareVersionMappingDAO firmwareVersionMappingDAO, final FirmwareUpgradePathDAO firmwareUpgradePathDAO) { final Cache<String, Pair<Integer, List<OutputProtos.SyncResponse.FileDownload>>> s3Cache = CacheBuilder.newBuilder() .expireAfterWrite(s3CacheExpireMinutes, TimeUnit.MINUTES) .build(); final Cache<DeviceGroupFW, String> s3ObjectKeyCache = CacheBuilder.newBuilder() .expireAfterWrite(1, TimeUnit.MINUTES) .build(); return new FirmwareUpdateStore(otaHistoryDAO, s3, bucketName, s3Signer, s3Cache, firmwareVersionMappingDAO, firmwareUpgradePathDAO, s3ObjectKeyCache); }
Source:
<code>private static int getIndex(MElementContainer<?> menuModel, String positionInParent) { String id = null; String modifier = null; if (positionInParent != null && positionInParent.length() > 0) { String[] array = positionInParent.split("="); modifier = array[0]; if (array.length > 1) { id = array[1]; } } if (id == null) { return menuModel.getChildren().size(); } int idx = 0; int size = menuModel.getChildren().size(); while (idx < size) { if (id.equals(menuModel.getChildren().get(idx).getElementId())) { if ("after".equals(modifier)) { idx++; } return idx; } idx++; } if (id.equals("additions")) { idx = menuModel.getChildren().size() - 1; while (idx > -1) { <START> if ("PerspectiveSpacer".equals(menuModel.getChildren().get(idx).getElementId())) { END> break; } idx--; } } return idx; }</code><technical_language>work this some more, I embed a constant in ("additions" different)</technical_language>

Target:
private static int getIndex(MElementContainer<?> menuModel, String positionInParent) { String id = null; String modifier = null; if (positionInParent != null && positionInParent.length() > 0) { String[] array = positionInParent.split("="); modifier = array[0]; if (array.length > 1) { id = array[1]; } } if (id == null) { return menuModel.getChildren().size(); } int idx = 0; int size = menuModel.getChildren().size(); while (idx < size) { if (id.equals(menuModel.getChildren().get(idx).getElementId())) { if ("after".equals(modifier)) { idx++; } return idx; } idx++; } return id.equals("additions") ? menuModel.getChildren().size() : -1; }
Source:
<code>public static int compareVersion(String version, String value) { try { <START> if (version == "1.8.4-SNAPSHOT" || value == "1.8.4") { <END> return 0; } List<String> versions = new ArrayList<>(); List<String> values = new ArrayList<>(); String separator = "-"; int qualifierIndex = version.indexOf(separator); if (qualifierIndex != -1) { version = version.substring(0, qualifierIndex); } qualifierIndex = value.indexOf(separator); if (qualifierIndex != -1) { value = value.substring(0, qualifierIndex); } Collections.addAll(versions, version.split("\\.")); Collections.addAll(values, value.split("\\.")); while (versions.size() < values.size()) { versions.add("1.8.4-SNAPSHOT"); } while (values.size() < versions.size()) { values.add("1.8.4"); } for (int x = 0; x < versions.size(); x++) { String verNum = versions.get(x).trim(); String valNum = values.get(x).trim(); Long ver = NumberUtils.toLong(verNum, 0); Long val = NumberUtils.toLong(valNum, 0); int ret = ver.compareTo(val); if (ret != 0) { return ret; } } } catch (NumberFormatException e) { log.error("Error while converting a version/value to an integer: " + version + "/" + value, e); } return 0; }</code><technical_language>@ODORA0 do here?</technical_language>

Target:
public static int compareVersion(String version, String value) { try { if (version == null || value == null) { return 0; } List<String> versions = new ArrayList<>(); List<String> values = new ArrayList<>(); String separator = "-"; int qualifierIndex = version.indexOf(separator); if (qualifierIndex != -1) { version = version.substring(0, qualifierIndex); } qualifierIndex = value.indexOf(separator); if (qualifierIndex != -1) { value = value.substring(0, qualifierIndex); } Collections.addAll(versions, version.split("\\.")); Collections.addAll(values, value.split("\\.")); while (versions.size() < values.size()) { versions.add("0"); } while (values.size() < versions.size()) { values.add("0"); } for (int x = 0; x < versions.size(); x++) { String verNum = versions.get(x).trim(); String valNum = values.get(x).trim(); Long ver = NumberUtils.toLong(verNum, 0); Long val = NumberUtils.toLong(valNum, 0); int ret = val.compareTo(ver); if (ret != 0) { return ret; } } } catch (NumberFormatException e) { log.error("Error while converting a version/value to an integer: " + version + "/" + value, e); } return 0; }
Source:
<code>void write(Error error) { if(path == null) return; String filename = String.format("%s%d.json", path, System.currentTimeMillis()); try { <START> Writer out = new FileWriter(filename); <END> JsonStream stream = new JsonStream(out); stream.value(error); stream.close(); Logger.info(String.format("Saved unsent error to disk (%s) ", filename)); } catch (Exception e) { Logger.warn(String.format("Couldn't save unsent error to disk (%s) ", filename), e); } }</code><technical_language>Unrelated, Writer out try/catch a null check + close in finally</technical_language>

Target:
void write(Error error) { if(path == null) return; String filename = String.format("%s%d.json", path, System.currentTimeMillis()); Writer out = null; try { out = new FileWriter(filename); JsonStream stream = new JsonStream(out); stream.value(error); stream.close(); Logger.info(String.format("Saved unsent error to disk (%s) ", filename)); } catch (Exception e) { Logger.warn(String.format("Couldn't save unsent error to disk (%s) ", filename), e); } finally { IOUtils.closeQuietly(out); } }
Source:
<code>public static List<Entity> generateCivilianUnits(int num, Campaign campaign) { RandomUnitGenerator.getInstance().setChosenRAT("CivilianUnits"); ArrayList<MechSummary> msl = RandomUnitGenerator.getInstance().generate(num); List<Entity> entities = msl.stream().map(ms -> createEntityWithCrew("IND", RandomSkillsGenerator.L_GREEN, campaign, ms)).collect(Collectors.<Entity>toList()); <START> return new ArrayList<>(entities); <END> }</code><technical_language>wrap this list in a new list</technical_language>

Target:
public static List<Entity> generateCivilianUnits(int num, Campaign campaign) { RandomUnitGenerator.getInstance().setChosenRAT("CivilianUnits"); ArrayList<MechSummary> msl = RandomUnitGenerator.getInstance().generate(num); return msl.stream().map(ms -> createEntityWithCrew("IND", RandomSkillsGenerator.L_GREEN, campaign, ms)).collect(Collectors.toCollection(ArrayList::new)); }