auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Void uploadFile(final String remotePath) { try { return retryExecutor() .withRetryLimit(maxConnectionRetry) .withInitialRetryWait(500) .withMaxRetryWait(30 * 1000) .runInterruptible(new Retryable<Void>() { @Override public Void call() throws InterruptedException, IOException, RetryGiveupException { <START> FileObject remoteFile = newSftpFile(getSftpFileUri(remotePath)); <END> logger.info("new sftp file: {}", remoteFile.getPublicURIString()); try (BufferedOutputStream outputStream = new BufferedOutputStream(remoteFile.getContent().getOutputStream())) { try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(tempFile))) { IOUtils.copy(inputStream, outputStream); } } return null; } @Override public boolean isRetryableException(Exception exception) { return true; } @Override public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait) throws RetryGiveupException { String message = String.format("SFTP output failed. Retrying %d/%d after %d seconds. Message: %s", retryCount, retryLimit, retryWait / 1000, exception.getMessage()); if (retryCount % 3 == 0) { logger.warn(message, exception); } else { logger.warn(message); } } @Override public void onGiveup(Exception firstException, Exception lastException) throws RetryGiveupException { } }); } catch (RetryGiveupException ex) { throw Throwables.propagate(ex.getCause()); } catch (InterruptedException ex) { throw Throwables.propagate(ex); } }</code><technical_language>newSftpFile method retry. Do special reason a retry is nested</technical_language>

Target:
private Void uploadFile(final String remotePath) { try { return retryExecutor() .withRetryLimit(maxConnectionRetry) .withInitialRetryWait(500) .withMaxRetryWait(30 * 1000) .runInterruptible(new Retryable<Void>() { @Override public Void call() throws IOException { FileObject remoteFile = newSftpFile(getSftpFileUri(remotePath)); logger.info("new sftp file: {}", remoteFile.getPublicURIString()); try (BufferedOutputStream outputStream = new BufferedOutputStream(remoteFile.getContent().getOutputStream())) { try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(tempFile))) { IOUtils.copy(inputStream, outputStream); } } return null; } @Override public boolean isRetryableException(Exception exception) { return true; } @Override public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait) throws RetryGiveupException { String message = String.format("SFTP output failed. Retrying %d/%d after %d seconds. Message: %s", retryCount, retryLimit, retryWait / 1000, exception.getMessage()); if (retryCount % 3 == 0) { logger.warn(message, exception); } else { logger.warn(message); } } @Override public void onGiveup(Exception firstException, Exception lastException) throws RetryGiveupException { } }); } catch (RetryGiveupException ex) { throw Throwables.propagate(ex.getCause()); } catch (InterruptedException ex) { throw Throwables.propagate(ex); } }
Source:
<code>public void removeAllDownloads() { final String username = loginPrefs.getUsername(); final String sha1Username; if (TextUtils.isEmpty(username)) { return; } else { sha1Username = Sha1Util.SHA1(username); } db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>(false) { @Override public void onResult(List<VideoModel> result) { long videoIds = new long[result.size()]; int i = 0; <START> for (VideoModel model : result) { <END> db.deleteVideoByVideoId(model, null, sha1Username); videoIds[i] = model.getDmId(); i++; } dm.removeDownload(videoIds); EventBus.getDefault().post(new DownloadedVideoDeletedEvent()); } @Override public void onFail(Exception ex) { } }); }</code><technical_language>Instead of a for-each loop, conventional for loop for brevity</technical_language>

Target:
public void removeAllDownloads() { final String username = loginPrefs.getUsername(); final String sha1Username; if (TextUtils.isEmpty(username)) { return; } else { sha1Username = Sha1Util.SHA1(username); } db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>(false) { @Override public void onResult(List<VideoModel> result) { long videoIds = new long[result.size()]; VideoModel model; for (int i=0; i<result.size(); i++) { model = result.get(i); db.deleteVideoByVideoId(model, null, sha1Username); videoIds[i] = model.getDmId(); } dm.removeDownloads(videoIds); EventBus.getDefault().post(new DownloadedVideoDeletedEvent()); } @Override public void onFail(Exception ex) { } }); }
Source:
<code>public static Image create(String id, String name, OSFamliyType osFamily, OSType os, String osVersion, List<String> availableSites, int architecture, String osImageType, ImageType type, int minHddSize, List<Licenses> licenses, String state, String description, List<Hdd> hdds, String serverId, ImageFrequency frequency, int numImages, String creationDate) { <START> return new AutoValue_Image(id, name, osFamily, os, osVersion, availableSites, architecture, osImageType, type, minHddSize, licenses, state, description, hdds, serverId, frequency, numImages, creationDate); <END> }</code><technical_language>lists non-nullable, initialising immutable empty list, if input parameter is null? api expect do send empty lists</technical_language>

Target:
public static Image create(String id, String name, OSFamliyType osFamily, OSType os, String osVersion, List<String> availableSites, int architecture, String osImageType, ImageType type, int minHddSize, List<Licenses> licenses, String state, String description, List<Hdd> hdds, String serverId, ImageFrequency frequency, int numImages, String creationDate) { return new AutoValue_Image(id, name, osFamily, os, osVersion, availableSites == null ? ImmutableList.<String>of() : availableSites, architecture, osImageType, type, minHddSize, licenses == null ? ImmutableList.<Licenses>of() : licenses, state, description, hdds == null ? ImmutableList.<Hdd>of() : hdds, serverId, frequency, numImages, creationDate); }
Source:
<code>private ResultScanner<Row> streamRows(ReadRowsRequest request) { final ClientCall<ReadRowsRequest , ReadRowsResponse> readRowsCall = channel.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); final Iterator<ReadRowsResponse> results = ClientCalls.blockingServerStreamingCall( readRowsCall, request); return new ResultScanner<Row>() { @Override public void close() throws IOException { readRowsCall.cancel(); } @Override public Row[] next(int count) throws IOException { List<Row> rows = new ArrayList<>(); for (int i = 0; i < count; i++) { rows.add(next()); } return (Row[]) rows.toArray(new Row[rows.size()]); } @Override public Row next() throws IOException { if (!results.hasNext()) { return null; } <START> StreamingBigtableResultScanner.RowMerger rowMerger = <END> new StreamingBigtableResultScanner.RowMerger(); while (!rowMerger.isRowCommitted()) { Preconditions.checkState( results.hasNext(), "End of stream marker encountered while merging a row."); rowMerger.addPartialRow(results.next()); } return rowMerger.buildRow(); } }; }</code><technical_language>delete StreamingBigtableResultScanner later</technical_language>

Target:
private ResultScanner<Row> streamRows(ReadRowsRequest request) { final ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channel.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); final Iterator<ReadRowsResponse> results = ClientCalls.blockingServerStreamingCall(readRowsCall, request); final Iterator<ReadRowsResponse> iterator = ClientCalls.blockingServerStreamingCall(readRowsCall, request); return new AbstractBigtableResultScanner() { @Override public void close() throws IOException { readRowsCall.cancel(); } @Override public Row next() throws IOException { if (!results.hasNext()) { return null; } RowMerger rowMerger = new RowMerger(); while (!rowMerger.isRowCommitted()) { Preconditions.checkState( results.hasNext(), "End of stream marker encountered while merging a row."); rowMerger.addPartialRow(results.next()); } return iterator.hasNext() ? RowMerger.readNextRow(iterator) : null; } }; }
Source:
<code>public void canDoActionFailedGuestOsIsNotSupported() { VM vm = mockVmStatusUp(); vm.setVmOs(15); cretaeVirtIODisk(); when(osRepository.getOsName(15)).thenReturn("RHEL3x64"); when(osRepository.getDiskHotpluggableInterfaces(any(Integer.class), <START> any(Version.class))).thenReturn(new ArrayList<String>()); <END> assertFalse(command.canDoAction()); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED.toString())); }</code><technical_language>return Collections.emptyList() - a bit cleaner</technical_language>

Target:
public void canDoActionFailedGuestOsIsNotSupported() { VM vm = mockVmStatusUp(); vm.setVmOs(15); cretaeVirtIODisk(); when(osRepository.getOsName(15)).thenReturn("RHEL3x64"); when(osRepository.getDiskHotpluggableInterfaces(any(Integer.class), any(Version.class))).thenReturn(Collections.<String>emptySet()); assertFalse(command.canDoAction()); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED.toString())); }
Source:
<code>private BlockAppender prepareMetaBlock(String name, Algorithm compressAlgo) throws IOException, MetaBlockAlreadyExists { if (blkInProgress) { throw new IllegalStateException("Cannot create Meta Block until previous block is closed."); } if (metaIndex.getMetaByName(name) != null) { throw new MetaBlockAlreadyExists("name=" + name); } MetaBlockRegister mbr = new MetaBlockRegister(name, compressAlgo); WBlockState wbs = new WBlockState(compressAlgo, out, fsOutputBuffer, conf, <START> encryptionStrategy); <END> BlockAppender ba = new BlockAppender(mbr, wbs); blkInProgress = true; metaBlkSeen = true; return ba; }</code><technical_language>run formatter? This collapse line</technical_language>

Target:
private BlockAppender prepareMetaBlock(String name, Algorithm compressAlgo) throws IOException, MetaBlockAlreadyExists { if (blkInProgress) { throw new IllegalStateException("Cannot create Meta Block until previous block is closed."); } if (metaIndex.getMetaByName(name) != null) { throw new MetaBlockAlreadyExists("name=" + name); } MetaBlockRegister mbr = new MetaBlockRegister(name, compressAlgo); WBlockState wbs = new WBlockState(compressAlgo, out, fsOutputBuffer, conf, encrypter); BlockAppender ba = new BlockAppender(mbr, wbs); blkInProgress = true; metaBlkSeen = true; return ba; }
Source:
<code>public Boolean propagateResourceEvent(final long agentId, final ResourceState.Event event) throws AgentUnavailableException { final String msPeer = getPeerName(agentId); if (msPeer == null) { return null; } <START> if (s_logger.isDebugEnabled()) { <END> s_logger.debug("Propagating resource request event:" + event.toString() + " to agent:" + agentId); } final Command[] cmds = new Command[1]; cmds[0] = new PropagateResourceEventCommand(agentId, event); final String AnsStr = _clusterMgr.execute(msPeer, agentId, _gson.toJson(cmds), true); if (AnsStr == null) { throw new AgentUnavailableException(agentId); } final Answer[] answers = _gson.fromJson(AnsStr, Answer[].class); if (s_logger.isDebugEnabled()) { s_logger.debug("Result for agent change is " + answers[0].getResult()); } return answers[0].getResult(); }</code><technical_language>remove this IF check ? I mean, removing IF maintaining logging</technical_language>

Target:
public Boolean propagateResourceEvent(final long agentId, final ResourceState.Event event) throws AgentUnavailableException { final String msPeer = getPeerName(agentId); if (msPeer == null) { return null; } s_logger.debug("Propagating resource request event:" + event.toString() + " to agent:" + agentId); final Command[] cmds = new Command[1]; cmds[0] = new PropagateResourceEventCommand(agentId, event); final String AnsStr = _clusterMgr.execute(msPeer, agentId, _gson.toJson(cmds), true); if (AnsStr == null) { throw new AgentUnavailableException(agentId); } final Answer[] answers = _gson.fromJson(AnsStr, Answer[].class); if (s_logger.isDebugEnabled()) { s_logger.debug("Result for agent change is " + answers[0].getResult()); } return answers[0].getResult(); }
Source:
<code>public void theBundleRequestContainsAGetPeriodicMeterReadsActionWithParameters(final Map<String, String> parameters) throws Throwable { final BundleRequest request = (BundleRequest) ScenarioContext.current() .get(PlatformSmartmeteringKeys.BUNDLE_REQUEST); final GetPeriodicMeterReadsRequest action = new GetPeriodicMeterReadsRequestBuilder() .fromParameterMap(parameters).build(); <START> this.addActionToBundleRequest(request, action); <END> }</code><technical_language>Lots of steps code retrieve BundleRequest scenario context, able pass a parameter addActionToBundleRequest. this duplication avoided dropping bundleRequestParamater addActionToBundleRequest in BaseBundleSteps lookup method</technical_language>

Target:
public void theBundleRequestContainsAGetPeriodicMeterReadsActionWithParameters(final Map<String, String> parameters) throws Throwable { final GetPeriodicMeterReadsRequest action = new GetPeriodicMeterReadsRequestBuilder() .fromParameterMap(parameters).build(); this.addActionToBundleRequest(action); }
Source:
<code>public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { <START> System.err.println(">>>>>>> ON START ...... " ); <END> Collection<? extends ServletRegistration> registrations = context .getServletRegistrations().values(); if (registrations.isEmpty()) { return; } DeploymentConfiguration config = StubServletConfig .createDeploymentConfiguration(context, registrations.iterator().next(), VaadinServlet.class); initDevModeHandler(classes, context, config); }</code><technical_language>This want remove</technical_language>

Target:
public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { Collection<? extends ServletRegistration> registrations = context .getServletRegistrations().values(); if (registrations.isEmpty()) { return; } DeploymentConfiguration config = StubServletConfig .createDeploymentConfiguration(context, registrations.iterator().next(), VaadinServlet.class); initDevModeHandler(classes, context, config); }
Source:
<code>public void run() { if (!fStateSystemAssigned) { System.err.println("Cannot run event manager without assigning a target state system first!"); return; } @NonNull <START> ITmfEvent event; <END> event = checkNotNull(fEventsQueue.take()); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = checkNotNull(fEventsQueue.take()); continue; } currentEvent = event; eventHandle(event); event = checkNotNull(fEventsQueue.take()); } closeStateSystem(); }</code><technical_language>no</technical_language>

Target:
public void run() { if (!fStateSystemAssigned) { System.err.println("Cannot run event manager without assigning a target state system first!"); return; } @NonNull ITmfEvent event = checkNotNull(fEventsQueue.take()); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = checkNotNull(fEventsQueue.take()); continue; } currentEvent = event; eventHandle(event); event = checkNotNull(fEventsQueue.take()); } closeStateSystem(); }
Source:
<code><START> public synchronized void init0() throws Throwable <END> { localDatabase.init(); }</code><technical_language>longer need methods synch right</technical_language>

Target:
public void init0() throws Throwable { localDatabase.init(); }
Source:
<code>TypeToExtend(PackageElement typePackage, TypeElement typeToExtend, TypeElement... supertypes) { this.typeToExtend = typeToExtend; this.typePackage = typePackage; List<ExecutableElement> allMethods = extractMethods(typeToExtend); for (TypeElement supertype : supertypes) { allMethods.addAll(extractMethods(supertype)); } Map<String, ExecutableElement> unifiedMethods = allMethods .stream() <START> .collect(Collectors.toMap(ExecutableElement::toString, Function.identity(), (name1, name2) -> name1)); <END> methods = Sets.newHashSet(unifiedMethods.values()); constructors = extractConstructors(typeToExtend); }</code><technical_language>do name1 name2 here</technical_language>

Target:
TypeToExtend(PackageElement typePackage, TypeElement typeToExtend, TypeElement... supertypes) { this.typeToExtend = typeToExtend; this.typePackage = typePackage; List<ExecutableElement> allMethods = extractMethods(typeToExtend); for (TypeElement supertype : supertypes) { allMethods.addAll(extractMethods(supertype)); } Map<String, ExecutableElement> methodSignatureToMethod = allMethods .stream() .collect(Collectors.toMap(ExecutableElement::toString, Function.identity(), (methodSignature1, methodSignature2) -> methodSignature1)); methods = Sets.newHashSet(methodSignatureToMethod.values()); constructors = extractConstructors(typeToExtend); }
Source:
<code>protected int incrementCount() { return ++this.count; <START> } <END></code><technical_language>do guys setting this method Evolving, for release</technical_language>

Target:
protected int incrementCount() { return ++count; }
Source:
<code>public Response resetPasswordByAdmin(UserCredentialWrapper credentials) throws MDMAPIException { UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); ResponsePayload responsePayload = new ResponsePayload(); try { byte[] decodedNewPassword = Base64.decodeBase64(credentials.getNewPassword()); userStoreManager.updateCredentialByAdmin(credentials.getUsername(), new String( decodedNewPassword, "UTF-8")); responsePayload.setStatusCode(HttpStatus.SC_CREATED); responsePayload.setMessageFromServer("User password by username: " + credentials.getUsername() + " was successfully changed."); return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); } catch (UserStoreException e) { String errorMsg = "Exception in trying to change the password by username: " + credentials.getUsername(); log.error(errorMsg, e); <START> responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST); <END> responsePayload.setMessageFromServer("Could not change the password."); return Response.status(HttpStatus.SC_BAD_REQUEST).entity(responsePayload).build(); } catch (UnsupportedEncodingException e) { String errorMsg = "Exception in trying to change the password by username: " + credentials.getUsername(); log.error(errorMsg, e); throw new MDMAPIException(errorMsg, e); } }</code><technical_language>a option builder pattern construct this response a single liner!</technical_language>

Target:
public Response resetPasswordByAdmin(UserCredentialWrapper credentials) throws MDMAPIException { return CredentialManagementResponseBuilder.buildResetPasswordResponse(credentials); }
Source:
<code>public void register() { <START> getChart().getPlotArea().addMouseTrackListener(this); <END> fTooltipHandler.activateHoverHelp(getChart().getPlotArea()); }</code><technical_language>Remove</technical_language>

Target:
public void register() { fTooltipHandler.activateHoverHelp(getChart().getPlotArea()); }
Source:
<code>public void rollback() { if ( !isActive() ) { if ( jpaCompliance.isJpaTransactionComplianceEnabled() ) { throw new IllegalStateException( "JPA compliance dictates throwing IllegalStateException when #rollback " + "is called on non-active transaction" ); } } TransactionStatus status = getStatus(); if ( status == TransactionStatus.ROLLED_BACK || status == TransactionStatus.NOT_ACTIVE ) { <START> if ( LOG.isDebugEnabled() ) { <END> LOG.debug( "rollback() called on an inactive transaction" ); } return; } if ( !status.canRollback() ) { throw new TransactionException( "Cannot rollback transaction in current status [" + status.name() + "]" ); } if ( LOG.isDebugEnabled() ) { LOG.debug( "rolling back" ); } if ( status != TransactionStatus.FAILED_COMMIT || allowFailedCommitToPhysicallyRollback() ) { internalGetTransactionDriverControl().rollback(); } }</code><technical_language>wrt "logging protection"</technical_language>

Target:
public void rollback() { if ( !isActive() ) { if ( jpaCompliance.isJpaTransactionComplianceEnabled() ) { throw new IllegalStateException( "JPA compliance dictates throwing IllegalStateException when #rollback " + "is called on non-active transaction" ); } } TransactionStatus status = getStatus(); if ( status == TransactionStatus.ROLLED_BACK || status == TransactionStatus.NOT_ACTIVE ) { LOG.debug( "rollback() called on an inactive transaction" ); return; } if ( !status.canRollback() ) { throw new TransactionException( "Cannot rollback transaction in current status [" + status.name() + "]" ); } LOG.debug( "rolling back" ); if ( status != TransactionStatus.FAILED_COMMIT || allowFailedCommitToPhysicallyRollback() ) { internalGetTransactionDriverControl().rollback(); } }
Source:
<code>public LabelTypes getLabelTypes() { Map<String, LabelType> types = Maps.newLinkedHashMap(); List<ProjectState> projects = Lists.newArrayList(tree()); Collections.reverse(projects); for (ProjectState s : projects) { for (LabelType type : s.getConfig().getLabelSections().values()) { <START> LabelType old = types.get(type.getName()); <END> if (old == null || !old.canOverride()) { types.put(type.getName(), type); } } } List<LabelType> all = Lists.newArrayListWithCapacity(types.size()); for (LabelType type : types.values()) { if (!type.getValues().isEmpty()) { all.add(type); } } labelTypes = new LabelTypes(Collections.unmodifiableList(all)); }</code><technical_language>in LabelTypes treat name case insensitive. for overriding require name identical, implicitly override accident of LabelTypes name map is created</technical_language>

Target:
public LabelTypes getLabelTypes() { Map<String, LabelType> types = Maps.newLinkedHashMap(); List<ProjectState> projects = Lists.newArrayList(tree()); Collections.reverse(projects); for (ProjectState s : projects) { for (LabelType type : s.getConfig().getLabelSections().values()) { LabelType old = types.get(type.getName()); if (old == null || !old.canOverride()) { types.put(type.getName(), type); } } } List<LabelType> all = Lists.newArrayListWithCapacity(types.size()); for (LabelType type : types.values()) { if (!type.getValues().isEmpty()) { all.add(type); } } return new LabelTypes(Collections.unmodifiableList(all)); }
Source:
<code>private String fenToChessboard(String text) { Boolean showBlack = false; Matcher mf = fFenPattern.matcher(text); StringBuffer sb = new StringBuffer(); while (mf.find()) { if (mf.group(1) != null) { Matcher mo = fFenOrientationPattern.matcher(mf.group(1)); if (mo.find() && mo.group(1) != null && mo.group(1).equalsIgnoreCase("black")) { showBlack = true; } } try { mf.appendReplacement(sb, "<script type=\"text/javascript\">document.write(" + String.format(Locale.US, fRenderFen, mf.group(2), showBlack) + ");</script>"); } catch (Exception e) { Timber.e("ChessFilter exception: %s", e); <START> } <END> } mf.appendTail(sb); return sb.toString(); }</code><technical_language>exception log</technical_language>

Target:
private String fenToChessboard(String text) { Boolean showBlack = false; Matcher mf = fFenPattern.matcher(text); StringBuffer sb = new StringBuffer(); while (mf.find()) { if (mf.group(1) != null) { Matcher mo = fFenOrientationPattern.matcher(mf.group(1)); if (mo.find() && mo.group(1) != null && mo.group(1).equalsIgnoreCase("black")) { showBlack = true; } } try { mf.appendReplacement(sb, "<script type=\"text/javascript\">document.write(" + String.format(Locale.US, fRenderFen, mf.group(2), showBlack) + ");</script>"); } catch (Exception e) { Timber.e(e, "ChessFilter exception: "); } } mf.appendTail(sb); return sb.toString(); }
Source:
<code>private List evaluateSingleSource(QueryMetadata metadata, Map<Expression<?>, Iterable<?>> iterables, boolean count) { final Expression<?> source = metadata.getJoins().get(0).getTarget(); final List<Expression<?>> sources = Collections.<Expression<?>>singletonList(source); final Iterable<?> iterable = iterables.values().iterator().next(); List<?> list; if (iterable instanceof List) { list = (List)iterable; } else { list = IteratorAdapter.asList(iterable.iterator()); } if (metadata.getWhere() != null) { Evaluator<List<?>> evaluator = (Evaluator)evaluatorFactory .createEvaluator(metadata, source, metadata.getWhere()); list = evaluator.evaluate(list); } if (!count && !list.isEmpty()) { if (!metadata.getOrderBy().isEmpty()) { if (list == iterable) { list = new ArrayList(list); } order(metadata, sources, list); } <START> if (!metadata.getProjection().equals(source)) { <END> list = project(metadata, sources, list); } if (metadata.getModifiers().isRestricting()) { list = metadata.getModifiers().subList(list); } if (list.isEmpty()) { return list; } } if (metadata.isDistinct()) { list = distinct(list); } return list; }</code><technical_language>If move annotation interface, this highlight a null pointer dereference</technical_language>

Target:
private List evaluateSingleSource(QueryMetadata metadata, Map<Expression<?>, Iterable<?>> iterables, boolean count) { final Expression<?> source = metadata.getJoins().get(0).getTarget(); final List<Expression<?>> sources = Collections.<Expression<?>>singletonList(source); final Iterable<?> iterable = iterables.values().iterator().next(); List<?> list; if (iterable instanceof List) { list = (List)iterable; } else { list = IteratorAdapter.asList(iterable.iterator()); } if (metadata.getWhere() != null) { Evaluator<List<?>> evaluator = (Evaluator)evaluatorFactory .createEvaluator(metadata, source, metadata.getWhere()); list = evaluator.evaluate(list); } if (!count && !list.isEmpty()) { if (!metadata.getOrderBy().isEmpty()) { if (list == iterable) { list = new ArrayList(list); } order(metadata, sources, list); } if (metadata.getProjection() != null && !metadata.getProjection().equals(source)) { list = project(metadata, sources, list); } if (metadata.getModifiers().isRestricting()) { list = metadata.getModifiers().subList(list); } if (list.isEmpty()) { return list; } } if (metadata.isDistinct()) { list = distinct(list); } return list; }
Source:
<code><START> public void setExpirationTime(final Date expirationTime) { <END> this.expirationTime = expirationTime; }</code><technical_language>getExpirationTime getter is missing, it</technical_language>

Target:
public void setExpirationTime(final Date expirationTime) { this.expirationTime = new Date(expirationTime.getTime()); }
Source:
<code>public void testFetch() throws JGitInternalException, IOException, GitAPIException, URISyntaxException { Repository db2 = createWorkRepository(); Git git2 = new Git(db2); final Config config = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(config, "test"); URIish uri = new URIish(db2.getDirectory().toURI().toURL()); remoteConfig.addURI(uri); remoteConfig.update(config); RevCommit commit = git2.commit().setMessage("initial commit").call(); RevTag tag = git2.tag().setName("tag").call(); Git git1 = new Git(db); RefSpec spec = new RefSpec("refs/heads/master:refs/heads/x"); git1.fetch().setRemote("test").setRefSpecs(spec) .call(); <START> assertTrue(commit.getId().equals( <END> db.resolve(commit.getId().getName() + "^{commit}"))); assertTrue(tag.getId().equals(db.resolve(tag.getId().getName()))); }</code><technical_language>assertTrue(equals()). assertEquals() JUnit wants to. works fixed .equals() RevObject. :-)</technical_language>

Target:
public void testFetch() throws JGitInternalException, IOException, GitAPIException, URISyntaxException { Repository db2 = createWorkRepository(); Git git2 = new Git(db2); final Config config = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(config, "test"); URIish uri = new URIish(db2.getDirectory().toURI().toURL()); remoteConfig.addURI(uri); remoteConfig.update(config); RevCommit commit = git2.commit().setMessage("initial commit").call(); RevTag tag = git2.tag().setName("tag").call(); Git git1 = new Git(db); RefSpec spec = new RefSpec("refs/heads/master:refs/heads/x"); git1.fetch().setRemote("test").setRefSpecs(spec) .call(); assertEquals(commit.getId(), db.resolve(commit.getId().getName() + "^{commit}")); assertEquals(tag.getId(), db.resolve(tag.getId().getName())); }
Source:
<code>void checkFile(@TempDir File tempDir, @TempDir Path ref) { <START> final Path path = tempDir.toPath(); <END> assertEquals(ref.toAbsolutePath(), path.toAbsolutePath()); assertTrue(Files.exists(path)); }</code><technical_language>suggestion Path path = tempDir.toPath();</technical_language>

Target:
void checkFile(@TempDir File tempDir, @TempDir Path ref) { Path path = tempDir.toPath(); assertEquals(ref.toAbsolutePath(), path.toAbsolutePath()); assertTrue(Files.exists(path)); }
Source:
<code>public MobileArticlePageObject openSections(String wikiURL){ <START> getUrl(wikiURL + articleSections); <END> waitForElementByElement(tocWrapper); PageObjectLogging.log("openSections", "sections page was opened", true, driver); return new MobileArticlePageObject(driver); }</code><technical_language>again, some sort of URLsContent Class</technical_language>

Target:
public MobileArticlePageObject openSections(String wikiURL){ getUrl(wikiURL + URLsContent.articleSections); waitForElementByElement(tocWrapper); PageObjectLogging.log("openSections", "sections page was opened", true, driver); return new MobileArticlePageObject(driver); }
Source:
<code>private String[] getVariableNameProposals(ITypeBinding arrayTypeBinding, IJavaProject project) { String[] variableNames= getUsedVariableNames(); String name= fArrayBinding.getName(); String baseName= modifybasename(name); <START> if (name.length() > 2 && name.charAt(name.length() - 1) == 's') { <END> baseName= name.substring(0, name.length() - 1); } String[] elementSuggestions= StubUtility.getLocalNameSuggestions(project, baseName, 0, variableNames); String type= arrayTypeBinding.getElementType().getName(); String[] typeSuggestions= StubUtility.getLocalNameSuggestions(project, type, arrayTypeBinding.getDimensions() - 1, variableNames); String[] result= new String[elementSuggestions.length + typeSuggestions.length]; System.arraycopy(elementSuggestions, 0, result, 0, elementSuggestions.length); System.arraycopy(typeSuggestions, 0, result, elementSuggestions.length, typeSuggestions.length); return result; }</code><technical_language>This logic is part of new method removed I suppose</technical_language>

Target:
private String[] getVariableNameProposals(ITypeBinding arrayTypeBinding, IJavaProject project) { String[] variableNames= getUsedVariableNames(); String name= fArrayBinding.getName(); String baseName= modifybasename(name); String[] elementSuggestions= StubUtility.getLocalNameSuggestions(project, baseName, 0, variableNames); String type= arrayTypeBinding.getElementType().getName(); String[] typeSuggestions= StubUtility.getLocalNameSuggestions(project, type, arrayTypeBinding.getDimensions() - 1, variableNames); String[] result= new String[elementSuggestions.length + typeSuggestions.length]; System.arraycopy(elementSuggestions, 0, result, 0, elementSuggestions.length); System.arraycopy(typeSuggestions, 0, result, elementSuggestions.length, typeSuggestions.length); return result; }
Source:
<code>private static boolean containsAll(String text, final Collection<String> items) { final String _text = text.toLowerCase(); return items.stream() <START> .allMatch((String it) -> { <END> return _text.contains(it); }); }</code><technical_language>do need type parameter</technical_language>

Target:
private static boolean containsAll(String text, final Collection<String> items) { final String _text = text.toLowerCase(); return items.stream() .allMatch(it -> { return _text.contains(it); }); }
Source:
<code>private Patient getPatientByUuid(Config config, String uuid) { Validate.notEmpty(uuid, "Patient Id cannot be empty"); Patient patient; try { patient = patientResource.getPatientById(config, uuid); <START> } catch (HttpServerErrorException | HttpClientErrorException e) { <END> throw new OpenMRSException(String.format("Could not get Patient with uuid: %s. %s %s", uuid, e.getMessage(), e.getResponseBodyAsString()), e); } Identifier motechIdentifier = getMotechIdentifier(config, patient); patient.setMotechIdentifierValues(motechIdentifier); List<Identifier> identifiers = patient.getIdentifiers(); identifiers.remove(motechIdentifier); List<Identifier> supportedIdentifierTypeList = getSupportedIdentifierTypeList(config, identifiers); patient.setIdentifiers(supportedIdentifierTypeList); return patient; }</code><technical_language>HttpStatusCodeException</technical_language>

Target:
private Patient getPatientByUuid(Config config, String uuid) { Validate.notEmpty(uuid, "Patient Id cannot be empty"); Patient patient; try { patient = patientResource.getPatientById(config, uuid); } catch (HttpStatusCodeException e) { throw new OpenMRSException(String.format("Could not get Patient with uuid: %s. %s %s", uuid, e.getMessage(), e.getResponseBodyAsString()), e); } Identifier motechIdentifier = getMotechIdentifier(config, patient); patient.setMotechIdentifierValues(motechIdentifier); List<Identifier> identifiers = patient.getIdentifiers(); identifiers.remove(motechIdentifier); List<Identifier> supportedIdentifierTypeList = getSupportedIdentifierTypeList(config, identifiers); patient.setIdentifiers(supportedIdentifierTypeList); return patient; }
Source:
<code>private void updateMemoryWatchpoint(boolean toggle, boolean interactive, IWorkbenchPart part, IRepositionableMemoryRendering rendering) throws CoreException { int addressableSize = 1; IMemoryBlock memblock = rendering.getMemoryBlock(); if (memblock instanceof IMemoryBlockExtension) { try { addressableSize = ((IMemoryBlockExtension)memblock).getAddressableSize(); } catch (DebugException e) { CDebugUIPlugin.log(e); } } String memorySpace = getMemorySpace(rendering.getMemoryBlock(), null); String address = getSelectedAddress(rendering.getSelectedAddress(), ""); String range = getRange(rendering.getSelectedAsBytes(), addressableSize, "1"); <START> address = "*" + address; END> createWatchpoint(interactive, part, "", ResourcesPlugin.getWorkspace().getRoot(), -1, -1, -1, address, memorySpace, range); }</code><technical_language>This works I if is ok put in this class. This code is part of base CDT, while requirement of '*' specific GDB. setting address breakpoint add '*' in MIBreakpoints.formatLocation(). do a similar formatting for a watchpoint expression in MIBreakpoints.addWatchpoint()</technical_language>

Target:
private void updateMemoryWatchpoint(boolean toggle, boolean interactive, IWorkbenchPart part, IRepositionableMemoryRendering rendering) throws CoreException { int addressableSize = 1; IMemoryBlock memblock = rendering.getMemoryBlock(); if (memblock instanceof IMemoryBlockExtension) { try { addressableSize = ((IMemoryBlockExtension)memblock).getAddressableSize(); } catch (DebugException e) { CDebugUIPlugin.log(e); } } String memorySpace = getMemorySpace(rendering.getMemoryBlock(), null); String address = getSelectedAddress(rendering.getSelectedAddress(), ""); String range = getRange(rendering.getSelectedAsBytes(), addressableSize, "1"); createWatchpoint(interactive, part, "", ResourcesPlugin.getWorkspace().getRoot(), -1, -1, -1, address, memorySpace, range); }
Source:
<code>public String getImageUrl(String imageName) { for (WebElement elem:imagesNewFiles) { String href = elem.findElement(parentBy).getAttribute("href"); if (href.contains(imageName)){ return href; } } <START> throw new RuntimeException("there is no " + imageName + " on Special:NewFiles page"); <END> }</code><technical_language>NoSuchElementException is more accurate</technical_language>

Target:
public String getImageUrl(String imageName) { for (WebElement elem:imagesNewFiles) { String href = elem.findElement(parentBy).getAttribute("href"); if (href.contains(imageName)){ return href; } } throw new NoSuchElementException("there is no " + imageName + " on Special:NewFiles page"); }
Source:
<code><START> public void mbusDeviceWithDeviceIDIsInactive(String mbusDeviceId) throws Throwable { <END> this.deviceHooks.inactivateDevice(mbusDeviceId); }</code><technical_language>remove "throws Throwable"</technical_language>

Target:
public void mbusDeviceWithDeviceIDIsInactive(String mbusDeviceId) { this.deviceHooks.deactivateDevice(mbusDeviceId); }
Source:
<code>public void reset() { RxAndroidPlugins.getInstance().reset(); final TestScheduler testScheduler = new TestScheduler(); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return testScheduler; } }); AndroidSchedulers.reset(); <START> assertTrue(AndroidSchedulers.mainThread().equals(testScheduler)); <END> RxAndroidPlugins.getInstance().reset(); RxAndroidPlugins.getInstance().registerSchedulersHook(RxAndroidSchedulersHook.getDefaultInstance()); AndroidSchedulers.reset(); assertTrue(AndroidSchedulers.mainThread() instanceof LooperScheduler); }</code><technical_language>assertSame</technical_language>

Target:
public void reset() { RxAndroidPlugins.getInstance().reset(); final TestScheduler testScheduler = new TestScheduler(); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return testScheduler; } }); AndroidSchedulers.reset(); assertSame(AndroidSchedulers.mainThread(), testScheduler); RxAndroidPlugins.getInstance().reset(); RxAndroidPlugins.getInstance().registerSchedulersHook(RxAndroidSchedulersHook.getDefaultInstance()); AndroidSchedulers.reset(); assertTrue(AndroidSchedulers.mainThread() instanceof LooperScheduler); }
Source:
<code>void handleBody(InputStream payload) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData; <START> switch (getOperationFlag()) { <END> case Blob: blobData = MessageFormatRecord.deserializeBlob(payload); break; default: BlobAll blobAll = MessageFormatRecord.deserializeBlobAll(payload, blobIdFactory); blobInfo = blobAll.getBlobInfo(); blobData = blobAll.getBlobData(); break; } BlobType blobType = blobData.getBlobType(); chunkIndexToBuffer = new TreeMap<>(); if (blobType == BlobType.MetadataBlob) { handleMetadataBlob(blobData); } else { handleSimpleBlob(blobData); } successfullyDeserialized = true; state = ChunkState.Complete; } else { } }</code><technical_language>choose if-else switch-case too</technical_language>

Target:
void handleBody(InputStream payload) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData; if (getOperationFlag() == MessageFormatFlags.Blob) { blobData = MessageFormatRecord.deserializeBlob(payload); } else { BlobAll blobAll = MessageFormatRecord.deserializeBlobAll(payload, blobIdFactory); blobInfo = blobAll.getBlobInfo(); blobData = blobAll.getBlobData(); } BlobType blobType = blobData.getBlobType(); chunkIndexToBuffer = new TreeMap<>(); if (blobType == BlobType.MetadataBlob) { handleMetadataBlob(blobData); } else { handleSimpleBlob(blobData); } successfullyDeserialized = true; state = ChunkState.Complete; } else { } }
Source:
<code>private Schema getGroupKeySchema(Schema inputSchema) { List<Schema.Field> fields = new ArrayList<>(); for (String groupByField : conf.getGroupByFields()) { <START> fields.add(inputSchema.getField(groupByField)); <END> } return Schema.recordOf("group.key.schema", fields); }</code><technical_language>inputSchema.getField(groupByField) null right? is add list</technical_language>

Target:
private Schema getGroupKeySchema(Schema inputSchema) { List<Schema.Field> fields = new ArrayList<>(); for (String groupByField : conf.getGroupByFields()) { Schema.Field fieldSchema = inputSchema.getField(groupByField); if (fieldSchema == null) { throw new IllegalArgumentException(String.format( "Cannot group by field '%s' because it does not exist in input schema %s", groupByField, inputSchema)); } fields.add(fieldSchema); } return Schema.recordOf("group.key.schema", fields); }
Source:
<code>public void starImportedFactAlsoDeclaredInDRL() throws Exception { AgendaEventListener ael = mock(AgendaEventListener.class); session.addEventListener(ael); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(KieServices.Factory.get().getCommands().newInsert(new TestEvent(1, "event 1", 0))); <START> commands.add(KieServices.Factory.get().getCommands().newFireAllRules()); <END> session.execute(KieServices.Factory.get().getCommands().newBatchExecution(commands, null)); try { verify(ael, times(1)).afterMatchFired(any(AfterMatchFiredEvent.class)); } catch (WantedButNotInvoked e) { Assertions.fail("BZ 973264", e); } }</code><technical_language>Reuse code</technical_language>

Target:
public void starImportedFactAlsoDeclaredInDRL() throws Exception { session.setGlobal("LOGGER", LOGGER); AgendaEventListener ael = mock(AgendaEventListener.class); session.addEventListener(ael); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(getCommands().newInsert(new TestEvent(1, "event 1", 0))); commands.add(getCommands().newFireAllRules()); session.execute(getCommands().newBatchExecution(commands, null)); try { verify(ael, times(1)).afterMatchFired(any(AfterMatchFiredEvent.class)); } catch (WantedButNotInvoked e) { Assertions.fail("The rule does not fire. For more information see BZ 973264", e); } }
Source:
<code>private boolean seen(String fingerprint) { TermQuery query = new TermQuery(new Term(F_IDENTITY, fingerprint)); IndexSearcher searcher = null; try { searcher = manager.acquire(); TopDocs results = searcher.search(query, 1); boolean foundIdenticalReport = results.totalHits > 0; return foundIdenticalReport; } catch (Exception e) { log(WARN_HISTORY_NOT_AVAILABLE, e); return false; } finally { try { <START> manager.release(searcher); <END> } catch (IOException e) { log(WARN_HISTORY_NOT_AVAILABLE, e); } } }</code><technical_language>if acquire throws? Is this a problem</technical_language>

Target:
private boolean seen(String fingerprint) { TermQuery query = new TermQuery(new Term(F_IDENTITY, fingerprint)); IndexSearcher searcher = null; try { searcher = manager.acquire(); TopDocs results = searcher.search(query, 1); boolean foundIdenticalReport = results.totalHits > 0; return foundIdenticalReport; } catch (Exception e) { log(WARN_HISTORY_NOT_AVAILABLE, e); return false; } finally { try { if (searcher != null) { manager.release(searcher); searcher = null; } } catch (IOException e) { log(WARN_HISTORY_NOT_AVAILABLE, e); } } }
Source:
<code>public void doTheThing() { int divisor = 15; int dividend = 5; <START> double result = divide(dividend, divisor); END> }</code><technical_language>This work if I place divide method doTheThing</technical_language>

Target:
public void doTheThing() { Unknown u, A; alpha(u); alpha(A); int divisor = 15; int dividend = 5; double result = divide(dividend, divisor); double result1 = divide(new B().alpha, divisor); double result2 = divide(new B().dividend, divisor); Unknown e; String b =""; beta(e, b); beta(b, e); beta(a,b); alpha(divisor); alpha(e); int a = 2; alpha(a); }
Source:
<code>protected void executeQueryCommand() { if (setVdsForConnectStorage() == null) { <START> return; <END> } storageDomainsWithAttachedStoragePoolId = filterAttachedStorageDomains(); getQueryReturnValue().setReturnValue(storageDomainsWithAttachedStoragePoolId); }</code><technical_language>set return empty in this case</technical_language>

Target:
protected void executeQueryCommand() { List<StorageDomainStatic> storageDomainsWithAttachedStoragePoolId = new ArrayList<>(); if (getVdsForConnectStorage() != null) { storageDomainsWithAttachedStoragePoolId = filterAttachedStorageDomains(); } getQueryReturnValue().setReturnValue(storageDomainsWithAttachedStoragePoolId); }
Source:
<code>private RexNode simplifyMultiply(RexCall e) { int oneIndex = findLiteralIndex(e.operands, 1L); if (oneIndex >= 0) { <START> RexNode other = e.getOperands().get((oneIndex + 1) % 2); <END> return other.getType().equals(e.getType()) ? other : rexBuilder.makeCast(e.getType(), other); } return simplifyGenericNode(e); }</code><technical_language>final convention</technical_language>

Target:
private RexNode simplifyMultiply(RexCall e) { final int oneIndex = findLiteralIndex(e.operands, BigDecimal.ONE); if (oneIndex >= 0) { RexNode other = e.getOperands().get((oneIndex + 1) % 2); return other.getType().equals(e.getType()) ? other : rexBuilder.makeCast(e.getType(), other); } return simplifyGenericNode(e); }
Source:
<code>private void disableBreakpoints() { for (BreakpointRequest <START> fBreakpointRequest : <END> fBreakpointRequests) { fBreakpointRequest.disable(); } }</code><technical_language>rename breakpointRequest</technical_language>

Target:
private void disableBreakpoints() { for (BreakpointRequest breakpointRequest : fBreakpointRequests) { breakpointRequest.disable(); } }
Source:
<code>public void visitFileInput(FileInput fileInput) { scopesByRootTree = new HashMap<>(); fileInput.accept(new FirstPhaseVisitor()); fileInput.accept(new SecondPhaseVisitor()); scopesByRootTree.values().stream() .filter(scope -> scope.rootTree instanceof FunctionLike) .forEach(scope -> { FunctionLike funcDef = (FunctionLike) scope.rootTree; for (Symbol symbol : scope.symbols()) { if (funcDef.is(Kind.LAMBDA)) { ((LambdaExpressionImpl) funcDef).addLocalVariableSymbol(symbol); } else { ((FunctionDefImpl) funcDef).addLocalVariableSymbol(symbol); } } }); scopesByRootTree.values().stream() .filter(scope -> scope.rootTree.is(Kind.CLASSDEF)) .forEach(scope -> { ClassDefImpl classDef = (ClassDefImpl) scope.rootTree; scope.symbols.forEach(classDef::addClassField); scope.instanceAttributesByName.values().forEach(classDef::addInstanceField); }); <START> scopesByRootTree.values().stream() <END> .filter(scope -> scope.rootTree.is(Kind.FILE_INPUT)) .forEach(scope -> scope.symbols.forEach(((FileInputImpl) fileInput)::addModuleFields)); }</code><technical_language>related PR : I wondering if avoid 3 iterations values a plain for loop. If it, I is worth a commit of refactoring end of PR</technical_language>

Target:
public void visitFileInput(FileInput fileInput) { scopesByRootTree = new HashMap<>(); fileInput.accept(new FirstPhaseVisitor()); fileInput.accept(new SecondPhaseVisitor()); for (Scope scope : scopesByRootTree.values()) { if (scope.rootTree instanceof FunctionLike) { FunctionLike funcDef = (FunctionLike) scope.rootTree; for (Symbol symbol : scope.symbols()) { if (funcDef.is(Kind.LAMBDA)) { ((LambdaExpressionImpl) funcDef).addLocalVariableSymbol(symbol); } else { ((FunctionDefImpl) funcDef).addLocalVariableSymbol(symbol); } } } else if (scope.rootTree.is(Kind.CLASSDEF)) { ClassDefImpl classDef = (ClassDefImpl) scope.rootTree; scope.symbols.forEach(classDef::addClassField); scope.instanceAttributesByName.values().forEach(classDef::addInstanceField); } else if (scope.rootTree.is(Kind.FILE_INPUT)) { scope.symbols.forEach(((FileInputImpl) fileInput)::addGlobalVariables); } } }
Source:
<code>public void runTestAsync() { mContext.getPostTarget().postDelayed(() -> { Display display = mContext.getWindowManager().getDefaultDisplay(); <START> boolean passing = checkEqualsAndLog(R.string.tv_hdr_display_is_hdr, false, display.isHdr()); <END> passing &= hasNoHdrCapabilities(display, this); doneWithPassingState(passing); }, Duration.ofSeconds(DISPLAY_DISCONNECT_WAIT_TIME_SECONDS).toMillis()); }</code><technical_language>isHdr(display) hide logging</technical_language>

Target:
public void runTestAsync() { mContext.getPostTarget().postDelayed(() -> { Display display = mContext.getWindowManager().getDefaultDisplay(); getAsserter() .withFailureMessage("Display.isHdr()") .that(display.isHdr()) .isTrue(); getAsserter() .withFailureMessage("Display.getHdrCapabilities()") .that(display.getHdrCapabilities().getSupportedHdrTypes()) .isEmpty(); done(); }, Duration.ofSeconds(DISPLAY_DISCONNECT_WAIT_TIME_SECONDS).toMillis()); }