auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<AsyncJobStatus> getJobsInState(Collection<AsyncJobStatus.JobState> states) { if (states != null && !states.isEmpty()) { String jpql = "SELECT aj FROM AsyncJobStatus aj WHERE aj.state IN (:states)"; return this.getEntityManager() .createQuery(jpql, AsyncJobStatus.class) .setParameter("states", states) .getResultList(); } <START> return new LinkedList<>(); <END> }</code><technical_language>important, is this method returning a LinkedList, while overloaded of this ArrayList in case jobs found? is for return Collections.emptyList() is more consistent cost effective (not creating a new object)</technical_language>

Target:
public List<AsyncJobStatus> getJobsInState(Collection<AsyncJobStatus.JobState> states) { if (states != null && !states.isEmpty()) { String jpql = "SELECT aj FROM AsyncJobStatus aj WHERE aj.state IN (:states)"; return this.getEntityManager() .createQuery(jpql, AsyncJobStatus.class) .setParameter("states", states) .getResultList(); } return new ArrayList<>(); }
Source:
<code>public Void visitNewClass(NewClassTree node, Void p) { if (checker.shouldSkipUses(TreeUtils.constructor(node))) { return super.visitNewClass(node, p); } ParameterizedExecutableType fromUse = atypeFactory.constructorFromUse(node); AnnotatedExecutableType constructor = fromUse.executableType; List<AnnotatedTypeMirror> typeargs = fromUse.typeArgs; List<? extends ExpressionTree> passedArguments = node.getArguments(); List<AnnotatedTypeMirror> params = AnnotatedTypes.expandVarArgs(atypeFactory, constructor, passedArguments); <START> ExecutableElement method = TreeUtils.elementFromUse(node); <END> Name methodName = method.getSimpleName(); checkArguments(params, passedArguments, methodName, method.getParameters()); checkVarargs(constructor, node); List<AnnotatedTypeParameterBounds> paramBounds = new ArrayList<>(); for (AnnotatedTypeVariable param : constructor.getTypeVariables()) { paramBounds.add(param.getBounds()); } checkTypeArguments( node, paramBounds, typeargs, node.getTypeArguments(), methodName, method.getTypeParameters()); boolean valid = validateTypeOf(node); if (valid) { AnnotatedDeclaredType dt = atypeFactory.getAnnotatedType(node); if (atypeFactory.getDependentTypesHelper() != null) { atypeFactory.getDependentTypesHelper().checkType(dt, node); } checkConstructorInvocation(dt, constructor, node); } scan(node.getEnclosingExpression(), p); scan(node.getIdentifier(), p); scan(node.getClassBody(), p); return null; }</code><technical_language>constructor.getElement() give result</technical_language>

Target:
public Void visitNewClass(NewClassTree node, Void p) { if (checker.shouldSkipUses(TreeUtils.constructor(node))) { return super.visitNewClass(node, p); } ParameterizedExecutableType fromUse = atypeFactory.constructorFromUse(node); AnnotatedExecutableType constructorType = fromUse.executableType; List<AnnotatedTypeMirror> typeargs = fromUse.typeArgs; List<? extends ExpressionTree> passedArguments = node.getArguments(); List<AnnotatedTypeMirror> params = AnnotatedTypes.expandVarArgs(atypeFactory, constructorType, passedArguments); ExecutableElement constructor = constructorType.getElement(); Name constructorName = constructor.getSimpleName(); checkArguments(params, passedArguments, constructorName, constructor.getParameters()); checkVarargs(constructorType, node); List<AnnotatedTypeParameterBounds> paramBounds = new ArrayList<>(); for (AnnotatedTypeVariable param : constructorType.getTypeVariables()) { paramBounds.add(param.getBounds()); } checkTypeArguments( node, paramBounds, typeargs, node.getTypeArguments(), constructorName, constructor.getTypeParameters()); boolean valid = validateTypeOf(node); if (valid) { AnnotatedDeclaredType dt = atypeFactory.getAnnotatedType(node); if (atypeFactory.getDependentTypesHelper() != null) { atypeFactory.getDependentTypesHelper().checkType(dt, node); } checkConstructorInvocation(dt, constructorType, node); } scan(node.getEnclosingExpression(), p); scan(node.getIdentifier(), p); scan(node.getClassBody(), p); return null; }
Source:
<code>private AbstractIntegrationMessageBuilder<?> toMessageBuilder(String topic, MqttMessage mqttMessage) { AbstractIntegrationMessageBuilder<?> builder = null; Exception conversionError = null; try { builder = getConverter().toMessageBuilder(topic, mqttMessage); } catch (Exception ex) { conversionError = ex; } if (builder == null && conversionError == null) { <START> conversionError = new IllegalStateException("'MqttMessageConverter' produced a null for message"); <END> } if (conversionError != null) { GenericMessage<MqttMessage> message = new GenericMessage<>(mqttMessage); if (!sendErrorMessageIfNecessary(message, conversionError)) { MessageConversionException conversionException; if (conversionError instanceof MessageConversionException) { conversionException = (MessageConversionException) conversionError; } else { conversionException = new MessageConversionException(message, "Failed to convert from MQTT Message", conversionError); } throw conversionException; } } return builder; }</code><technical_language>suggestion conversionError = new IllegalStateException("'MqttMessageConverter' returned 'null'");</technical_language>

Target:
private AbstractIntegrationMessageBuilder<?> toMessageBuilder(String topic, MqttMessage mqttMessage) { AbstractIntegrationMessageBuilder<?> builder = null; Exception conversionError = null; try { builder = getConverter().toMessageBuilder(topic, mqttMessage); } catch (Exception ex) { conversionError = ex; } if (builder == null && conversionError == null) { conversionError = new IllegalStateException("'MqttMessageConverter' returned 'null'"); } if (conversionError != null) { GenericMessage<MqttMessage> message = new GenericMessage<>(mqttMessage); if (!sendErrorMessageIfNecessary(message, conversionError)) { MessageConversionException conversionException; if (conversionError instanceof MessageConversionException) { conversionException = (MessageConversionException) conversionError; } else { conversionException = new MessageConversionException(message, "Failed to convert from MQTT Message", conversionError); } throw conversionException; } } return builder; }
Source:
<code>protected Guid getStorageDomainId() { storage_pool pool = getDbFacade().getStoragePoolDAO().get(getParameters().getStoragePoolId(), getUserID(), getParameters().isFiltered()); if (pool != null) { <START> List<storage_domains> domains = getDbFacade().getStorageDomainDAO().getAllForStoragePool(pool.getId()); <END> for (storage_domains domain : domains) { if (domain.getstorage_domain_type() == StorageDomainType.ISO) { return domain.getId(); } } } return null; }</code><technical_language>StorageDomainDAO.getIsoStorageDomainIdForPool()</technical_language>

Target:
protected Guid getStorageDomainId() { if (doesUserHavePemissionsOnStoragePool()) { return getDbFacade().getStorageDomainDAO().getIsoStorageDomainIdForPool(getStoragePoolId()); } return null; }
Source:
<code>private URIish getCloneURI(String content) { <START> if (content != null && content.startsWith("git clone")) { END> content = content.substring(9); } URIish finalURI; try { finalURI = new URIish(content.trim()); if (Protocol.FILE.handles(finalURI) || Protocol.GIT.handles(finalURI) || Protocol.HTTP.handles(finalURI) || Protocol.HTTPS.handles(finalURI) || Protocol.SSH.handles(finalURI)) return finalURI; else return null; } catch (URISyntaxException e) { Activator.handleError(e.getLocalizedMessage(), e, true); return null; } }</code><technical_language>style nit: curly braces single line blocks</technical_language>

Target:
private URIish getCloneURI(String content) { if (content != null && content.startsWith("git clone")) content = content.substring(9); URIish finalURI; try { finalURI = new URIish(content.trim()); if (Protocol.FILE.handles(finalURI) || Protocol.GIT.handles(finalURI) || Protocol.HTTP.handles(finalURI) || Protocol.HTTPS.handles(finalURI) || Protocol.SSH.handles(finalURI)) return finalURI; else return null; } catch (URISyntaxException e) { Activator.handleError(e.getLocalizedMessage(), e, true); return null; } }
Source:
<code>public InputBar(FontRenderer fontRenderer, LogisticsBaseGuiScreen screen, int left, int top, int width, int height, boolean isActive, boolean numberOnly, Align align) { super(0, fontRenderer, left, top, width, height); screen.onGuiEvents.add(this); <START> Keyboard.enableRepeatEvents(true); <END> if (numberOnly) setValidator((String s) -> { try { return Integer.parseInt(s) >= minNumber; } catch (NumberFormatException ignored) { return false; } }); }</code><technical_language>do in constructor, creating instance of InputBar modify keyboard state. want this. Put call in GUI classes itself, input bar is used. done for vanilla guis aswell (unless changed that). Also, somewhere, need call Keyboard.enableRepeatEvents(false); gui is closed (GuiScreen::onGuiClosed, I method is called)</technical_language>

Target:
public InputBar(FontRenderer fontRenderer, LogisticsBaseGuiScreen screen, int left, int top, int width, int height, boolean isActive, boolean numberOnly, Align align) { super(0, fontRenderer, left+2, top, width-4, height-2); screen.onGuiEvents.add(this); if (numberOnly) { setValidator((String s) -> { try { return Integer.parseInt(s) >= minNumber; } catch (NumberFormatException ignored) { return false; } }); setMaxStringLength(5); } else setMaxStringLength(128); }
Source:
<code>protected void createDocumentVersions(DocumentModel doc, VersioningOption vo, int nrVersions) { for (int i = 1; i <= nrVersions; i++) { <START> doc.setPropertyValue("dc:description", "" + i); <END> doc.putContextData(VersioningService.VERSIONING_OPTION, vo); session.saveDocument(doc); } session.save(); }</code><technical_language>String.valueOf(i)</technical_language>

Target:
protected DocumentModel createDocumentVersions(DocumentModel doc, VersioningOption vo, int nrVersions) { for (int i = 1; i <= nrVersions; i++) { doc.setPropertyValue("dc:description", String.valueOf(i)); doc.putContextData(VersioningService.VERSIONING_OPTION, vo); doc = session.saveDocument(doc); } session.save(); return doc; }
Source:
<code>public void testLoad() { MetadataResourceUtil metadataResourceUtil = Mockito.spy(new MetadataResourceUtil(checkpointManager, jobModel)); <START> Mockito.doCallRealMethod().when(metadataResourceUtil).createResources(); <END> Mockito.doNothing().when(metadataResourceUtil).createChangelogStreams(); metadataResourceUtil.createResources(); Mockito.verify(checkpointManager).createResources(); Mockito.verify(metadataResourceUtil).createChangelogStreams(); }</code><technical_language>need do doCallReadMethod for spy objects. long stub a method a spy, call real method default</technical_language>

Target:
public void testLoad() { MetadataResourceUtil metadataResourceUtil = Mockito.spy(new MetadataResourceUtil(checkpointManager, jobModel)); Mockito.doNothing().when(metadataResourceUtil).createChangelogStreams(); metadataResourceUtil.createResources(); Mockito.verify(checkpointManager).createResources(); Mockito.verify(metadataResourceUtil).createChangelogStreams(); }
Source:
<code>default void awaitConnected(final long waitTime, final TimeUnit unit) throws TimeoutException { try { connectFuture().toCompletableFuture().get(waitTime, unit); } catch (final InterruptedException | ExecutionException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>handle interrupter correctly</technical_language>

Target:
default void awaitConnected(final long waitTime, final TimeUnit unit) throws TimeoutException, InterruptedException { try { connectFuture().toCompletableFuture().get(waitTime, unit); } catch (final ExecutionException e) { throw new RuntimeException(e); } }
Source:
<code>public int search(HttpServletRequest req, String... projectNames) { ProjectHelper pHelper = PageConfig.get(req).getProjectHelper(); Set<Project> projects = pHelper.getAllProjects(); <START> HashSet<Project> filteredProjects = new HashSet<Project>(); <END> for(Project project: projects) { for (String name : projectNames) { if(project.getName().equalsIgnoreCase(name)) { filteredProjects.add(project); } } } return search( filteredProjects, new File(RuntimeEnvironment.getInstance().getDataRootFile(), IndexDatabase.INDEX_DIR)); }</code><technical_language>supertype Set</technical_language>

Target:
public int search(HttpServletRequest req, String... projectNames) { ProjectHelper pHelper = PageConfig.get(req).getProjectHelper(); Set<Project> projects = pHelper.getAllProjects(); List<Project> filteredProjects = new ArrayList<Project>(); for(Project project: projects) { for (String name : projectNames) { if (project.getName().equalsIgnoreCase(name)) { filteredProjects.add(project); } } } return search( filteredProjects, new File(RuntimeEnvironment.getInstance().getDataRootFile(), IndexDatabase.INDEX_DIR)); }
Source:
<code>BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics srcMetrics, StoreMetrics tgtMetrics, DiskIOScheduler diskIOScheduler, DiskSpaceAllocator diskSpaceAllocator, Log srcLog, Time time, UUID sessionId, UUID incarnationId) throws IOException, StoreException { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.srcMetrics = srcMetrics; this.tgtMetrics = tgtMetrics; this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.diskSpaceAllocator = diskSpaceAllocator; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; fixStateIfRequired(); this.bundleReadBuffer = <START> ByteBuffer.allocate(Math.max(config.storeCleanupOperationsBytesPerSec * 2, 10 * 1024 * 1024)); <END> logger.trace("Constructed BlobStoreCompactor for {}", dataDir); }</code><technical_language>this a config</technical_language>

Target:
BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics srcMetrics, StoreMetrics tgtMetrics, DiskIOScheduler diskIOScheduler, DiskSpaceAllocator diskSpaceAllocator, Log srcLog, Time time, UUID sessionId, UUID incarnationId) throws IOException, StoreException { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.srcMetrics = srcMetrics; this.tgtMetrics = tgtMetrics; this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.diskSpaceAllocator = diskSpaceAllocator; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; fixStateIfRequired(); logger.trace("Constructed BlobStoreCompactor for {}", dataDir); }
Source:
<code>public BuiltinList sadd(BitVector<BigInteger> bitVector) { BigInteger result = signedValue().add(bitVector.signedValue()); <START> return new BuiltinList(ImmutableList.<Term>of( <END> BitVector.of(result, bitwidth), BoolToken.of(checkSignedOverflow(result)))); }</code><technical_language>is a BuiltinList.of</technical_language>

Target:
public BuiltinList sadd(BitVector<BigInteger> bitVector) { BigInteger result = signedValue().add(bitVector.signedValue()); return getBuiltinList(result, checkSignedOverflow(result)); }
Source:
<code><START> public Flux<ByteBuffer> write(ByteBuffer buf) { <END> if (this.currentBuf == null) { this.currentBuf = this.getBuffer(); } Flux<ByteBuffer> result; if (this.currentBuf.remaining() >= buf.remaining()) { this.currentBuf.put(buf); if (this.currentBuf.remaining() == 0) { this.currentBuf.position(0); result = Flux.just(this.currentBuf); this.currentBuf = null; } else { result = Flux.empty(); } } else { int oldLimit = buf.limit(); buf.limit(buf.position() + this.currentBuf.remaining()); this.currentBuf.put(buf); buf.limit(oldLimit); this.currentBuf.position(0); result = Flux.just(this.currentBuf); this.currentBuf = this.getBuffer(); this.currentBuf.put(buf); } return result; }</code><technical_language>Is this class returned this method need exposed public is internally scoped package-private</technical_language>

Target:
Flux<ByteBuffer> write(ByteBuffer buf) { if (this.currentBuf == null) { this.currentBuf = this.getBuffer(); } Flux<ByteBuffer> result; if (this.currentBuf.remaining() >= buf.remaining()) { this.currentBuf.put(buf); if (this.currentBuf.remaining() == 0) { this.currentBuf.position(0); result = Flux.just(this.currentBuf); this.currentBuf = null; } else { result = Flux.empty(); } } else { int oldLimit = buf.limit(); buf.limit(buf.position() + this.currentBuf.remaining()); this.currentBuf.put(buf); buf.limit(oldLimit); this.currentBuf.position(0); result = Flux.just(this.currentBuf); this.currentBuf = this.getBuffer(); this.currentBuf.put(buf); } return result; }
Source:
<code>public void setCustomHeaders(Map<String, String> customHeaders) { this.customHeaders = new HashMap<String, String>(); List<String> prohibitedHeaders = Arrays.asList("authorization", "www-authenticate", "host", "connection", "content-type", "accept", "content-length"); for (Map.Entry<String, String> header : customHeaders.entrySet()) { if (prohibitedHeaders.contains(header.getKey().toLowerCase())) { <START> throw new IllegalArgumentException("Bad optional HTTP header: " + header); <END> } else { this.customHeaders.put(header.getKey(), header.getValue()); } } }</code><technical_language>I a exception message, state header is allowed set user</technical_language>

Target:
public void setCustomHeaders(Map<String, String> customHeaders) { List<String> prohibitedHeaders = Arrays.asList("www-authenticate", "host", "connection", "content-type", "accept", "content-length"); for (Map.Entry<String, String> header : customHeaders.entrySet()) { if (prohibitedHeaders.contains(header.getKey().toLowerCase())) { throw new IllegalArgumentException("Bad optional HTTP header: " + header); } } this.customHeaders = customHeaders; }
Source:
<code><START> public void helloGcs_shouldRunOnGcf() throws Exception { <END> String filename = String.format("test-%s.txt", UUID.randomUUID()); String expected = String.format("File %s uploaded.", filename); Instant startInstant = Instant.now().minus(Duration.ofMinutes(4)); String startTimestamp = DateTimeFormatter.ISO_INSTANT.format(startInstant); BlobInfo blobInfo = BlobInfo.newBuilder(BlobId.of(FUNCTIONS_BUCKET, filename)).build(); STORAGE.create(blobInfo); RetryRegistry registry = RetryRegistry.of(RetryConfig.custom() .maxAttempts(8) .intervalFunction(IntervalFunction.ofExponentialBackoff(1000, 2)) .retryOnResult(s -> !s.toString().contains(filename)) .build()); Retry retry = registry.retry(filename); String logEntry = Retry .decorateFunction(retry, ExampleSystemTest::getLogEntriesAsString) .apply(startTimestamp); assertThat(logEntry).contains(filename); }</code><technical_language>Please a more specific exception(s) Exception</technical_language>

Target:
public void helloGcs_shouldRunOnGcf() { String filename = String.format("test-%s.txt", UUID.randomUUID()); Instant startInstant = Instant.now().minus(Duration.ofMinutes(4)); String startTimestamp = DateTimeFormatter.ISO_INSTANT.format(startInstant); BlobInfo blobInfo = BlobInfo.newBuilder(BlobId.of(FUNCTIONS_BUCKET, filename)).build(); STORAGE.create(blobInfo); String expected = String.format("File %s uploaded.", filename); RetryRegistry registry = RetryRegistry.of(RetryConfig.custom() .maxAttempts(8) .intervalFunction(IntervalFunction.ofExponentialBackoff(1000, 2)) .retryOnResult(s -> !s.toString().contains(expected)) .build()); Retry retry = registry.retry(filename); String logEntry = Retry .decorateFunction(retry, ExampleSystemTest::getLogEntriesAsString) .apply(startTimestamp); assertThat(logEntry).contains(filename); }
Source:
<code>public ArtifactDescriptor getArtifact(String type, String id, String version) { if (type == null || id == null) { return null; } SortedMap<Version, ArtifactDescriptor> relevantArtifacts = new TreeMap<>( <START> (Version o1, Version o2) -> -o1.compareTo(o2)); <END> for (Map.Entry<ArtifactKey, ArtifactDescriptor> entry : this.artifacts.entrySet()) { ArtifactKey key = entry.getKey(); if (type.equals(key.getType()) && id.equals(key.getId())) { relevantArtifacts.put(Version.parseVersion(key.getVersion()), entry.getValue()); } } if (relevantArtifacts.isEmpty()) { return null; } if (version == null) { return relevantArtifacts.get(relevantArtifacts.firstKey()); } Version parsedVersion = new Version(version); if (VERSION_0_0_0.equals(parsedVersion)) { return relevantArtifacts.get(relevantArtifacts.firstKey()); } String qualifier = parsedVersion.getQualifier(); if (qualifier == null || "".equals(qualifier) || DependencyArtifacts.ANY_QUALIFIER.equals(qualifier)) { for (Map.Entry<Version, ArtifactDescriptor> entry : relevantArtifacts.entrySet()) { if (baseVersionEquals(parsedVersion, entry.getKey())) { return entry.getValue(); } } } return relevantArtifacts.get(parsedVersion); }</code><technical_language>Comparator.naturalOrder()</technical_language>

Target:
public ArtifactDescriptor getArtifact(String type, String id, String version) { if (type == null || id == null) { return null; } SortedMap<Version, ArtifactDescriptor> relevantArtifacts = new TreeMap<>( Comparator.naturalOrder()); for (Map.Entry<ArtifactKey, ArtifactDescriptor> entry : this.artifacts.entrySet()) { ArtifactKey key = entry.getKey(); if (type.equals(key.getType()) && id.equals(key.getId())) { relevantArtifacts.put(Version.parseVersion(key.getVersion()), entry.getValue()); } } if (relevantArtifacts.isEmpty()) { return null; } if (version == null) { return relevantArtifacts.get(relevantArtifacts.firstKey()); } Version parsedVersion = new Version(version); if (VERSION_0_0_0.equals(parsedVersion)) { return relevantArtifacts.get(relevantArtifacts.firstKey()); } String qualifier = parsedVersion.getQualifier(); if (qualifier == null || "".equals(qualifier) || DependencyArtifacts.ANY_QUALIFIER.equals(qualifier)) { for (Map.Entry<Version, ArtifactDescriptor> entry : relevantArtifacts.entrySet()) { if (baseVersionEquals(parsedVersion, entry.getKey())) { return entry.getValue(); } } } return relevantArtifacts.get(parsedVersion); }
Source:
<code>public IStatus addTopic(IReviewItem item, ITopic topic, IProgressMonitor monitor) { short side = 1; String id = item.getId(); if (id.startsWith("base-")) { id = id.substring(5); side = 0; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : topic.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; SaveDraftRequest request = new SaveDraftRequest(key, lineLocation.getTotalMin(), side); request.setMessage(topic.getDescription()); GerritOperation<PatchLineComment> operation = getOperationFactory().createSaveDraftOperation(getTask(), request); return operation.run(monitor); } } <START> Status status = new Status(IStatus.ERROR, ReviewsUiPlugin.PLUGIN_ID, "Unable to add annotation."); <END> StatusHandler.log(status); return status; }</code><technical_language>error message include topic.getLocations().toString() ease debugging. error logged in calling code if all</technical_language>

Target:
public IStatus addTopic(IReviewItem item, ITopic topic, IProgressMonitor monitor) { short side = 1; String id = item.getId(); if (id.startsWith("base-")) { id = id.substring(5); side = 0; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : topic.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; SaveDraftRequest request = new SaveDraftRequest(key, lineLocation.getTotalMin(), side); request.setMessage(topic.getDescription()); GerritOperation<PatchLineComment> operation = getOperationFactory().createSaveDraftOperation(getTask(), request); return operation.run(monitor); } } throw new RuntimeException("Internal Exception. No line location for comment. Topic: " + topic.getId()); }
Source:
<code>public void processRecord(ComputationContext context, String documentIdsStreamName, Record record) { String commandId = commandIdFrom(record); Blob blob = getBlob(dataFrom(record)); TransientStore download = Framework.getService(TransientStoreService.class) .getStore(DownloadService.TRANSIENT_STORE_STORE_NAME); download.putBlobs(commandId, Collections.singletonList(blob)); download.setCompleted(commandId, true); KeyValueStore kvStore = Framework.getService(KeyValueService.class).getKeyValueStore(BULK_KV_STORE_NAME); BulkStatus status = BulkCodecs.getBulkStatusCodec().decode(kvStore.get(commandId + STATUS)); status.setProcessed(status.getCount()); <START> status.setState(COMPLETED); <END> context.produceRecord("o1", commandId, BulkCodecs.getBulkStatusCodec().encode(status)); context.askForCheckpoint(); }</code><technical_language>FYI, <LINK_0> is merged put download url a result</technical_language>

Target:
public void processRecord(ComputationContext context, String documentIdsStreamName, Record record) { String commandId = commandIdFrom(record); Blob blob = getBlob(dataFrom(record)); TransientStore download = Framework.getService(TransientStoreService.class) .getStore(DownloadService.TRANSIENT_STORE_STORE_NAME); download.putBlobs(commandId, Collections.singletonList(blob)); download.setCompleted(commandId, true); BulkCounter counter = new BulkCounter(commandId, countFrom(record)); context.produceRecord("o1", commandId, BulkCodecs.getBulkCounterCodec().encode(counter)); context.askForCheckpoint(); }
Source:
<code>public PipelinePagination getPagination() { if(enablePaging) { return new PipelinePagination(this.getCurrentPage(), pipelines.size(), noOfPipelines, "?" + (this.isFullScreenView() == true ? "fullscreen=true&" : "fullscreen=false&") + "component=" + componentNumber + "&page="); } return null; <START> } <END></code><technical_language>Formatting again</technical_language>

Target:
public PipelinePagination getPagination() { if (pagingEnabled) { return new PipelinePagination(this.getCurrentPage(), pipelines.size(), noOfPipelines, "?" + (this.isFullScreenView() == true ? "fullscreen=true&" : "fullscreen=false&") + "component=" + componentNumber + "&page="); } return null; }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof VmInit)) { return false; } VmInit other = (VmInit) obj; return Objects.equals(id, other.id) && Objects.equals(hostname, other.hostname) && Objects.equals(timeZone, other.timeZone) && Objects.equals(authorizedKeys, other.authorizedKeys) && Objects.equals(customScript, other.customScript) && Objects.equals(userName, other.userName) && Objects.equals(domain, other.domain) && Objects.equals(activeDirectoryOU, other.activeDirectoryOU) && Objects.equals(orgName, other.orgName) && Objects.equals(dnsServers, other.dnsServers) && Objects.equals(dnsSearch, other.dnsSearch) && Objects.equals(winKey, other.winKey) && Objects.equals(rootPassword, other.rootPassword) && Objects.equals(inputLocale, other.inputLocale) && Objects.equals(uiLanguage, other.uiLanguage) && Objects.equals(systemLocale, other.systemLocale) && Objects.equals(userLocale, other.userLocale) && Objects.equals(regenerateKeys, other.regenerateKeys) && Objects.equals(passwordAlreadyStored, other.passwordAlreadyStored) && ((networks == null && other.networks == null) || (other.networks != null && other.networks.size() == 0 && networks == null) || (networks != null && networks.size() == 0 && other.networks == null) || (networks != null && other.networks != null && networks.size() == other.networks.size() && <START> Objects.equals(networks, other.networks))) && <END> Objects.equals(cloudInitNetworkProtocol, other.cloudInitNetworkProtocol); }</code><technical_language>shorter, I think: (Objects.equals(networks, other.networks) || networks == null && other.networks.size() == 0 || other.networks == null && networks.size() == 0) Objects.equals() true if arguments null, if is false, of is null</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof VmInit)) { return false; } VmInit other = (VmInit) obj; return Objects.equals(id, other.id) && Objects.equals(hostname, other.hostname) && Objects.equals(timeZone, other.timeZone) && Objects.equals(authorizedKeys, other.authorizedKeys) && Objects.equals(customScript, other.customScript) && Objects.equals(userName, other.userName) && Objects.equals(domain, other.domain) && Objects.equals(activeDirectoryOU, other.activeDirectoryOU) && Objects.equals(orgName, other.orgName) && Objects.equals(dnsServers, other.dnsServers) && Objects.equals(dnsSearch, other.dnsSearch) && Objects.equals(winKey, other.winKey) && Objects.equals(rootPassword, other.rootPassword) && Objects.equals(inputLocale, other.inputLocale) && Objects.equals(uiLanguage, other.uiLanguage) && Objects.equals(systemLocale, other.systemLocale) && Objects.equals(userLocale, other.userLocale) && Objects.equals(regenerateKeys, other.regenerateKeys) && Objects.equals(passwordAlreadyStored, other.passwordAlreadyStored) && (Objects.equals(networks, other.networks) || (networks == null && other.networks.size() == 0) || (other.networks == null && networks.size() == 0)) && Objects.equals(cloudInitNetworkProtocol, other.cloudInitNetworkProtocol); }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!getStrExpression().evaluate(tuple, ptr)) { return false; } String sourceStr = (String)PDataType.VARCHAR.toObject(ptr, getStrExpression().getColumnModifier()); if (sourceStr == null) { return true; } try { <START> ptr.set(MessageDigest.getInstance("MD5").digest(sourceStr.getBytes())); <END> return true; } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } }</code><technical_language>want allocate a new MessageDigest evaluate call, this expensive. Instead, do following: Add a messageDigest member variable this: private final MessageDigest messageDigest = MessageDigest.getInstance("MD5"); Then, in evaluate do this: // Update digest messageDigest.update(ptr.get(),ptr.getOffset(),ptr.getLength()); // Get digest bytes (note this resets messageDigest well) ptr.set(messageDigest.digest());</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!getChildExpression().evaluate(tuple, ptr)) { return false; } String sourceStr = (String) PDataType.VARCHAR.toObject(ptr, getChildExpression().getColumnModifier()); if (sourceStr == null) { return true; } messageDigest.update(ptr.get(), ptr.getOffset(), ptr.getLength()); ptr.set(messageDigest.digest()); return true; }
Source:
<code>private void updateStage2AsRemoved() { getAllMeasuresWhereValueIsNotNull().stream() .filter(measure -> (measure.getCertificationCriterion().getNumber().equals(G_8) <START> || measure.getCertificationCriterion().getNumber().equals(G_9)) <END> && VALUES_TO_REMOVE.contains(measure.getValue())) .forEach(measure -> { measure.setRemoved(true); entityManager.merge(measure); }); }</code><technical_language>I is a Cures version of g9. I order jobs be/need run I want this code works intended is g9 two</technical_language>

Target:
private void updateStage2AsRemoved() { getAllMeasuresWhereValueIsNotNull().stream() .filter(mm -> isThisAMacraMeasureToRemove(mm)) .forEach(measure -> { measure.setRemoved(true); entityManager.merge(measure); }); }
Source:
<code><START> public ValidationResult validate(RuntimeContainer container) { <END> Connection conn = getConnection(container); if (conn == null) { return new ValidationResult(ValidationResult.Result.ERROR, I18N_MESSAGES.getMessage("validation.refComponentNotConnected")); } try { callOperation(conn); } catch (SQLException e) { return new ValidationResult(ValidationResult.Result.ERROR, e.getMessage()); } finally { if (properties.closeConnection.getValue()) { try { if (conn != null && !conn.isClosed()) { conn.close(); } } catch (SQLException e) { new ValidationResult(ValidationResult.Result.ERROR, e.getMessage()); } } } return ValidationResult.OK; }</code><technical_language>Running operation in a Validate method a bit weird do stuff, ComponentDriverInitialization<ComponentProperties>.runAtDriver more ok</technical_language>

Target:
public ValidationResult validate(RuntimeContainer container) { Connection conn = getConnection(container); if (conn == null) { return new ValidationResult(ValidationResult.Result.ERROR, I18N_MESSAGES.getMessage("validation.referenced.connection.notConnected")); } try { callOperation(conn); } catch (SQLException e) { return new ValidationResult(ValidationResult.Result.ERROR, e.getMessage()); } finally { if (properties.closeConnection.getValue()) { try { if (conn != null && !conn.isClosed()) { conn.close(); } } catch (SQLException e) { return new ValidationResult(ValidationResult.Result.ERROR, e.getMessage()); } } } return ValidationResult.OK; }
Source:
<code><START> public boolean isPropertyGeneratedByUserStore(RealmConfiguration realmConfig, String property) { <END> String immutableAttributesProperty = Optional.ofNullable(realmConfig .getUserStoreProperty(UserStoreConfigConstants.immutableAttributes)).orElse(""); String[] immutableAttributes = org.apache.commons.lang.StringUtils.split(immutableAttributesProperty, ","); return ArrayUtils.contains(immutableAttributes, property); }</code><technical_language>add a method description(java-doc) here</technical_language>

Target:
public static boolean isPropertyGeneratedByUserStore(RealmConfiguration realmConfig, String property) { String immutableAttributesProperty = Optional.ofNullable(realmConfig .getUserStoreProperty(UserStoreConfigConstants.immutableAttributes)).orElse(""); String[] immutableAttributes = org.apache.commons.lang.StringUtils.split(immutableAttributesProperty, ","); return ArrayUtils.contains(immutableAttributes, property); }
Source:
<code>public void open(Configuration parameters) throws Exception { function = genAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader()); function.open(new PerKeyStateDataViewStore(getRuntimeContext())); output = new JoinedRowData(); RowDataTypeInfo inputType = new RowDataTypeInfo(inputFieldTypes); ListTypeInfo<RowData> rowListTypeInfo = new ListTypeInfo<>(inputType); MapStateDescriptor<Long, List<RowData>> mapStateDescriptor = new MapStateDescriptor<>( "inputState", BasicTypeInfo.LONG_TYPE_INFO, rowListTypeInfo); inputState = getRuntimeContext().getMapState(mapStateDescriptor); RowDataTypeInfo accTypeInfo = new RowDataTypeInfo(accTypes); ValueStateDescriptor<RowData> stateDescriptor = new ValueStateDescriptor<RowData>("accState", accTypeInfo); accState = getRuntimeContext().getState(stateDescriptor); <START> ValueStateDescriptor<Long> retractTsStateDescriptor = new ValueStateDescriptor<Long>( <END> "retractTsState", Types.LONG ); this.retractTsState = getRuntimeContext().getState(retractTsStateDescriptor); initCleanupTimeState("ProcTimeBoundedRangeOverCleanupTime"); }</code><technical_language>small suggestion, strong opnion. suggestion ValueStateDescriptor<Long> retractTsStateDescriptor = new ValueStateDescriptor<>(</technical_language>

Target:
public void open(Configuration parameters) throws Exception { function = genAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader()); function.open(new PerKeyStateDataViewStore(getRuntimeContext())); output = new JoinedRowData(); RowDataTypeInfo inputType = new RowDataTypeInfo(inputFieldTypes); ListTypeInfo<RowData> rowListTypeInfo = new ListTypeInfo<>(inputType); MapStateDescriptor<Long, List<RowData>> mapStateDescriptor = new MapStateDescriptor<>( "inputState", BasicTypeInfo.LONG_TYPE_INFO, rowListTypeInfo); inputState = getRuntimeContext().getMapState(mapStateDescriptor); RowDataTypeInfo accTypeInfo = new RowDataTypeInfo(accTypes); ValueStateDescriptor<RowData> stateDescriptor = new ValueStateDescriptor<RowData>("accState", accTypeInfo); accState = getRuntimeContext().getState(stateDescriptor); ValueStateDescriptor<Long> cleanupTsStateDescriptor = new ValueStateDescriptor<>( "cleanupTsState", Types.LONG ); this.cleanupTsState = getRuntimeContext().getState(cleanupTsStateDescriptor); }
Source:
<code>public static ProviderAdapter getProviderAdapter(Notifier notifier, EntityManager entityManager){ ProviderAdapter adapter = null; switch(notifier.getProvider().toLowerCase()){ case "apple" : adapter = new APNsAdapter(entityManager,notifier); break; case "google" : adapter = new GCMAdapter(entityManager ,notifier); break; case "windows" : adapter = new WNSAdapter(entityManager ,notifier); break; <START> case "noop" : adapter = new TestAdapter(notifier); break; <END> } return adapter; }</code><technical_language>silly, I default case throw exception if match of other cases. get some explicit feedback entered incorrectly payload</technical_language>

Target:
public static ProviderAdapter getProviderAdapter(Notifier notifier, EntityManager entityManager){ ProviderAdapter adapter = null; switch(notifier.getProvider().toLowerCase()){ case "apple" : adapter = new APNsAdapter(entityManager,notifier); break; case "google" : adapter = new GCMAdapter(entityManager ,notifier); break; case "windows" : adapter = new WNSAdapter(entityManager ,notifier); break; case "noop" : adapter = new TestAdapter(notifier); break; default: throw new IllegalArgumentException(notifier.getProvider() + " did not match any known adapter, valid arguments are apple,google,windows" ); } return adapter; }
Source:
<code>public CommandResult exec(ContextAwareCommandInvocation invocation) { if (help) { invocation.println(invocation.getHelpInfo()); } CommandInputLine cmd = new CommandInputLine(Task.CMD) .arg(TYPE, Task.Exec.CMD) .arg(NAME, taskName) <START> .arg(PARAMETERS, parameters != null ? parameters : Collections.emptyMap()); <END> return invocation.execute(cmd); }</code><technical_language>init parameters emptyMap</technical_language>

Target:
public CommandResult exec(ContextAwareCommandInvocation invocation) { if (help) { invocation.println(invocation.getHelpInfo()); } CommandInputLine cmd = new CommandInputLine(Task.CMD) .arg(TYPE, Task.Exec.CMD) .arg(NAME, taskName) .arg(PARAMETERS, parameters == null ? Collections.emptyMap() : parameters); return invocation.execute(cmd); }
Source:
<code>public void placeholdersMinus1() { try { Queries.placeholders(-1); <START> failBecauseExceptionWasNotThrown(IllegalArgumentException.class); <END> } catch (IllegalArgumentException expected) { assertThat(expected) .hasMessageStartingWith("numberOfPlaceholders must be > 0, but was = ") .hasNoCause(); } }</code><technical_language>Wow, that, nice</technical_language>

Target:
public void placeholdersMinus1() { try { Queries.placeholders(-1); failBecauseExceptionWasNotThrown(IllegalArgumentException.class); } catch (IllegalArgumentException expected) { assertThat(expected) .hasMessage("numberOfPlaceholders must be > 0, but was = -1") .hasNoCause(); } }
Source:
<code>private void resetHttpClient() { logger.trace("Drop client for fritzbox and setup connection again."); if (_httpClientContext.getTargetAuthState() != null) { _httpClientContext.getTargetAuthState().reset(); } try { _httpClient.close(); } catch (IOException e) { <START> logger.error("Failed to close connection to fritzbox at {}. This might result in still open, but dead connections waiting for a timeout.", _url, e); <END> } _httpClient = createTr064HttpClient(_url); }</code><technical_language>This higher INFO. argue for DEBUG</technical_language>

Target:
private void resetHttpClient() { logger.trace("Drop client for fritzbox and setup connection again."); if (_httpClientContext.getTargetAuthState() != null) { _httpClientContext.getTargetAuthState().reset(); } try { _httpClient.close(); } catch (IOException e) { logger.debug("Failed to close connection to fritzbox at {}. " + "This might result in still open, but dead connections waiting for a timeout.", _url, e); } _httpClient = createTr064HttpClient(_url); }
Source:
<code>public RenewableBatchIdSequences( NeoStores stores, int batchSize ) { for ( StoreType type : StoreType.values() ) { if ( type.isRecordStore() ) { RecordStore<AbstractBaseRecord> store = stores.getRecordStore( type ); if ( type.isLimitedIdStore() ) { types[type.ordinal()] = store; } else { LongConsumer idConsumer = id -> store.freeId( id ); <START> types[type.ordinal()] = new RenewableBatchIdSequence( store, batchSize, idConsumer ); <END> } } } }</code><technical_language>idConsumer defined store::freeId</technical_language>

Target:
public RenewableBatchIdSequences( NeoStores stores, int batchSize ) { for ( StoreType type : StoreType.values() ) { if ( type.isRecordStore() ) { RecordStore<AbstractBaseRecord> store = stores.getRecordStore( type ); if ( type.isLimitedIdStore() || batchSize == 1 ) { types[type.ordinal()] = store; } else { types[type.ordinal()] = new RenewableBatchIdSequence( store, batchSize, store::freeId ); } } } }
Source:
<code>public AbfsAuthorizer getAbfsAuthorizer() throws IOException { String authClassName = getAbfsExternalAuthorizationClass(); AbfsAuthorizer authorizer = null; try { if (authClassName != null && !authClassName.isEmpty()) { @SuppressWarnings("unchecked") Class<AbfsAuthorizer> authClass = (Class<AbfsAuthorizer>) rawConfig.getClassByName(authClassName); authorizer = authClass.getConstructor(new Class[] {Configuration.class}).newInstance(rawConfig); <START> LOG.trace("Initializing " + authClassName); <END> authorizer.init(); LOG.trace(authClassName + " init complete"); } } catch ( IllegalAccessException | InstantiationException | ClassNotFoundException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | AbfsAuthorizationException e) { throw new IOException(e); } return authorizer; }</code><technical_language>{}</technical_language>

Target:
public AbfsAuthorizer getAbfsAuthorizer() throws IOException { String authClassName = getAbfsExternalAuthorizationClass(); AbfsAuthorizer authorizer = null; try { if (authClassName != null && !authClassName.isEmpty()) { @SuppressWarnings("unchecked") Class<AbfsAuthorizer> authClass = (Class<AbfsAuthorizer>) rawConfig.getClassByName(authClassName); authorizer = authClass.getConstructor(new Class[] {Configuration.class}).newInstance(rawConfig); LOG.trace("Initializing {}", authClassName); authorizer.init(); LOG.trace("{} init complete", authClassName); } } catch ( IllegalAccessException | InstantiationException | ClassNotFoundException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | AbfsAuthorizationException e) { throw new IOException(e); } return authorizer; }
Source:
<code>public Jetty7NexusBooter( final File bundleBasedir, final int port ) throws Exception { this.bundleBasedir = bundleBasedir; this.sharedLibs = new File( bundleBasedir.getParentFile(), "shared" ); tamperJettyConfiguration( bundleBasedir, port ); tamperJarsForSharedClasspath( bundleBasedir ); System.setProperty( "bundleBasedir", bundleBasedir.getAbsolutePath() ); System.setProperty( "jettyContext", "nexus.properties" ); System.setProperty( "jettyPlexusCompatibility", "true" ); System.setProperty( "guice.executor.class", "NONE" ); System.setProperty( "mavenIndexerBlockingCommits", Boolean.TRUE.toString() ); <START> System.setProperty( "plexus.autoblock.remote.status.retain.time", String.valueOf( 30*1000 ) ); <END> world = new ClassWorld(); sharedClassloader = buildSharedClassLoader(); }</code><technical_language>this _IT wise_? This affect nexus behavior in ITs, in this one. This moved some of NEXUS-4539 related IT..</technical_language>

Target:
public Jetty7NexusBooter( final File bundleBasedir, final int port ) throws Exception { this.bundleBasedir = bundleBasedir; this.sharedLibs = new File( bundleBasedir.getParentFile(), "shared" ); tamperJettyConfiguration( bundleBasedir, port ); tamperJarsForSharedClasspath( bundleBasedir ); System.setProperty( "bundleBasedir", bundleBasedir.getAbsolutePath() ); System.setProperty( "jettyContext", "nexus.properties" ); System.setProperty( "jettyPlexusCompatibility", "true" ); System.setProperty( "guice.executor.class", "NONE" ); System.setProperty( "mavenIndexerBlockingCommits", Boolean.TRUE.toString() ); world = new ClassWorld(); sharedClassloader = buildSharedClassLoader(); }
Source:
<code>protected void executeCommand() { MoveVdssToGoingToMaintenanceMode(); MigrateAllVdss(); Set<Guid> clusters = new HashSet<>(); for (VDS vds : vdssToMaintenance.values()) { if (!clusters.contains(vds.getVdsGroupId())) { clusters.add(vds.getVdsGroupId()); List<Network> networks = DbFacade.getInstance().getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } } } if (!getParameters().getKeepPolicyPMEnabled()) { for (Guid vdsId : getParameters().getVdsIdList()) { getDbFacade().getVdsDynamicDao().updateVdsDynamicPowerManagementPolicyFlag( vdsId, false); } } stopGlusterDaemonService(); <START> stopOtherGlusterProcesses(); <END> setSucceeded(true); }</code><technical_language>for gluster enabled hosts</technical_language>

Target:
protected void executeCommand() { MoveVdssToGoingToMaintenanceMode(); MigrateAllVdss(); Set<Guid> clusters = new HashSet<>(); for (VDS vds : vdssToMaintenance.values()) { if (!clusters.contains(vds.getVdsGroupId())) { clusters.add(vds.getVdsGroupId()); List<Network> networks = DbFacade.getInstance().getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } } } if (!getParameters().getKeepPolicyPMEnabled()) { for (Guid vdsId : getParameters().getVdsIdList()) { getDbFacade().getVdsDynamicDao().updateVdsDynamicPowerManagementPolicyFlag( vdsId, false); } } stopGlusterServices(); setSucceeded(true); }
Source:
<code>public Subscription updateSubscription(final String subscriptionId, final SubscriptionBase newValue) throws NoSuchSubscriptionException, SubscriptionUpdateConflictException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot create subscription: write operations on DB " + "are blocked by feature flag."); } final Subscription old = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionAdmin(old); subscriptionValidationService.validateSubscriptionChange(old, newValue); old.mergeFrom(newValue); subscriptionRepository.updateSubscription(old); <START> subscriptionCache.invalidateSubscription(subscriptionId); <END> return old; }</code><technical_language>I this call is useless 150 instances</technical_language>

Target:
public Subscription updateSubscription(final String subscriptionId, final SubscriptionBase newValue) throws NoSuchSubscriptionException, SubscriptionUpdateConflictException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot create subscription: write operations on DB " + "are blocked by feature flag."); } final Subscription old = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionAdmin(old); subscriptionValidationService.validateSubscriptionChange(old, newValue); old.mergeFrom(newValue); old.setUpdatedAt(new DateTime(DateTimeZone.UTC)); subscriptionRepository.updateSubscription(old); return old; }