auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
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' produced a null for message"); } 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; }

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:
protected Guid getStorageDomainId() { storage_pool pool = getDbFacade().getStoragePoolDAO().get(getParameters().getStoragePoolId(), getUserID(), getParameters().isFiltered()); if (pool != null) { List<storage_domains> domains = getDbFacade().getStorageDomainDAO().getAllForStoragePool(pool.getId()); for (storage_domains domain : domains) { if (domain.getstorage_domain_type() == StorageDomainType.ISO) { return domain.getId(); } } } return null; }

Target:
protected Guid getStorageDomainId() { if (doesUserHavePemissionsOnStoragePool()) { return getDbFacade().getStorageDomainDAO().getIsoStorageDomainIdForPool(getStoragePoolId()); } return null; }
Source:
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; } }

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:
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); Keyboard.enableRepeatEvents(true); if (numberOnly) setValidator((String s) -> { try { return Integer.parseInt(s) >= minNumber; } catch (NumberFormatException ignored) { return false; } }); }

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:
protected void createDocumentVersions(DocumentModel doc, VersioningOption vo, int nrVersions) { for (int i = 1; i <= nrVersions; i++) { doc.setPropertyValue("dc:description", "" + i); doc.putContextData(VersioningService.VERSIONING_OPTION, vo); session.saveDocument(doc); } session.save(); }

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:
public void testLoad() { MetadataResourceUtil metadataResourceUtil = Mockito.spy(new MetadataResourceUtil(checkpointManager, jobModel)); Mockito.doCallRealMethod().when(metadataResourceUtil).createResources(); Mockito.doNothing().when(metadataResourceUtil).createChangelogStreams(); metadataResourceUtil.createResources(); Mockito.verify(checkpointManager).createResources(); Mockito.verify(metadataResourceUtil).createChangelogStreams(); }

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:
default void awaitConnected(final long waitTime, final TimeUnit unit) throws TimeoutException { try { connectFuture().toCompletableFuture().get(waitTime, unit); } catch (final InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }

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:
public int search(HttpServletRequest req, String... projectNames) { ProjectHelper pHelper = PageConfig.get(req).getProjectHelper(); Set<Project> projects = pHelper.getAllProjects(); HashSet<Project> filteredProjects = new HashSet<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)); }

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:
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 = ByteBuffer.allocate(Math.max(config.storeCleanupOperationsBytesPerSec * 2, 10 * 1024 * 1024)); logger.trace("Constructed BlobStoreCompactor for {}", dataDir); }

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:
public BuiltinList sadd(BitVector<BigInteger> bitVector) { BigInteger result = signedValue().add(bitVector.signedValue()); return new BuiltinList(ImmutableList.<Term>of( BitVector.of(result, bitwidth), BoolToken.of(checkSignedOverflow(result)))); }

Target:
public BuiltinList sadd(BitVector<BigInteger> bitVector) { BigInteger result = signedValue().add(bitVector.signedValue()); return getBuiltinList(result, checkSignedOverflow(result)); }
Source:
public 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; }

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:
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())) { throw new IllegalArgumentException("Bad optional HTTP header: " + header); } else { this.customHeaders.put(header.getKey(), header.getValue()); } } }

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:
public void helloGcs_shouldRunOnGcf() throws Exception { 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); }

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:
public ArtifactDescriptor getArtifact(String type, String id, String version) { if (type == null || id == null) { return null; } SortedMap<Version, ArtifactDescriptor> relevantArtifacts = new TreeMap<>( (Version o1, Version o2) -> -o1.compareTo(o2)); 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); }

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:
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); } } Status status = new Status(IStatus.ERROR, ReviewsUiPlugin.PLUGIN_ID, "Unable to add annotation."); StatusHandler.log(status); return status; }

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:
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()); status.setState(COMPLETED); context.produceRecord("o1", commandId, BulkCodecs.getBulkStatusCodec().encode(status)); context.askForCheckpoint(); }

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:
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; }

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:
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() && Objects.equals(networks, other.networks))) && Objects.equals(cloudInitNetworkProtocol, other.cloudInitNetworkProtocol); }

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:
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 { ptr.set(MessageDigest.getInstance("MD5").digest(sourceStr.getBytes())); return true; } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } }

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:
private void updateStage2AsRemoved() { getAllMeasuresWhereValueIsNotNull().stream() .filter(measure -> (measure.getCertificationCriterion().getNumber().equals(G_8) || measure.getCertificationCriterion().getNumber().equals(G_9)) && VALUES_TO_REMOVE.contains(measure.getValue())) .forEach(measure -> { measure.setRemoved(true); entityManager.merge(measure); }); }

Target:
private void updateStage2AsRemoved() { getAllMeasuresWhereValueIsNotNull().stream() .filter(mm -> isThisAMacraMeasureToRemove(mm)) .forEach(measure -> { measure.setRemoved(true); entityManager.merge(measure); }); }
Source:
public ValidationResult validate(RuntimeContainer container) { 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; }

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:
public 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); }

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:
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> retractTsStateDescriptor = new ValueStateDescriptor<Long>( "retractTsState", Types.LONG ); this.retractTsState = getRuntimeContext().getState(retractTsStateDescriptor); initCleanupTimeState("ProcTimeBoundedRangeOverCleanupTime"); }

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:
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; } return adapter; }

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:
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 ? parameters : Collections.emptyMap()); return invocation.execute(cmd); }

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:
public void placeholdersMinus1() { try { Queries.placeholders(-1); failBecauseExceptionWasNotThrown(IllegalArgumentException.class); } catch (IllegalArgumentException expected) { assertThat(expected) .hasMessageStartingWith("numberOfPlaceholders must be > 0, but was = ") .hasNoCause(); } }

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:
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.error("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); }

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:
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 ); types[type.ordinal()] = new RenewableBatchIdSequence( store, batchSize, idConsumer ); } } } }

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:
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(authClassName + " init complete"); } } catch ( IllegalAccessException | InstantiationException | ClassNotFoundException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | AbfsAuthorizationException e) { throw new IOException(e); } return authorizer; }

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:
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() ); System.setProperty( "plexus.autoblock.remote.status.retain.time", String.valueOf( 30*1000 ) ); world = new ClassWorld(); sharedClassloader = buildSharedClassLoader(); }

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:
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(); stopOtherGlusterProcesses(); setSucceeded(true); }

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:
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); subscriptionCache.invalidateSubscription(subscriptionId); return old; }

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; }
Source:
private void handleAjaxFetchFile( FileSystem fs, HttpServletRequest req, HttpServletResponse resp, Session session, Path path) throws IOException, ServletException { int startLine = getIntParam(req, "startLine", DEFAULT_START_LINE); int endLine = getIntParam(req, "endLine", DEFAULT_END_LINE); OutputStream output = resp.getOutputStream(); if (endLine < startLine) { output.write(("Invalid range: endLine < startLine.").getBytes("UTF-8")); return; } if (endLine - startLine > FILE_MAX_LINES) { output.write(("Invalid range: range exceeds max number of lines.") .getBytes("UTF-8")); return; } HdfsFileViewer fileViewer = null; if (hasParam(req, "viewerId")) { fileViewer = viewers.get(getIntParam(req, "viewerId")); if (!fileViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = null; } } else { for (HdfsFileViewer viewer : viewers) { if (viewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = viewer; break; } } } if (fileViewer == null) { if (defaultViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = defaultViewer; } else { output.write(("No viewer available for file.").getBytes("UTF-8")); return; } } fileViewer.displayFile(fs, path, output, startLine, endLine); }

Target:
private void handleAjaxFetchFile( FileSystem fs, HttpServletRequest req, HttpServletResponse resp, Session session, Path path) throws IOException, ServletException { int startLine = getIntParam(req, "startLine", defaultStartLine); int endLine = getIntParam(req, "endLine", defaultEndLine); OutputStream output = resp.getOutputStream(); if (endLine < startLine) { output.write(("Invalid range: endLine < startLine.").getBytes("UTF-8")); return; } if (endLine - startLine > fileMaxLines) { output.write(("Invalid range: range exceeds max number of lines.") .getBytes("UTF-8")); return; } HdfsFileViewer fileViewer = null; if (hasParam(req, "viewerId")) { fileViewer = viewers.get(getIntParam(req, "viewerId")); if (!fileViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = null; } } else { for (HdfsFileViewer viewer : viewers) { if (viewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = viewer; break; } } } if (fileViewer == null) { if (defaultViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = defaultViewer; } else { output.write(("No viewer available for file.").getBytes("UTF-8")); return; } } fileViewer.displayFile(fs, path, output, startLine, endLine); }
Source:
public static void main(final String[] args) throws Exception { loadPropertiesFiles(args); try (EmbeddedReplayThroughput test = new EmbeddedReplayThroughput()) { System.out.println("Making a recording for playback..."); final long recordingLength = test.makeRecording(); Thread.sleep(10); System.out.println("Finding the recording..."); final long recordingId = test.findRecordingId(ChannelUri.addSessionId(CHANNEL, test.publicationSessionId)); final ContinueBarrier barrier = new ContinueBarrier("Execute again?"); do { System.out.printf("Replaying %,d messages%n", NUMBER_OF_MESSAGES); final long start = System.nanoTime(); test.replayRecording(recordingLength, recordingId); final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); final double dataRate = (recordingLength * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = recordingLength / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.println("Performance inclusive of replay request and connection setup:"); System.out.printf( "Replayed %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); } while (barrier.await()); } }

Target:
public static void main(final String[] args) throws Exception { loadPropertiesFiles(args); try (EmbeddedReplayThroughput test = new EmbeddedReplayThroughput()) { System.out.println("Making a recording for playback..."); final long recordingLength = test.makeRecording(); Thread.sleep(10); System.out.println("Finding the recording..."); final long recordingId = test.findRecordingId(ChannelUri.addSessionId(CHANNEL, test.publicationSessionId)); final ContinueBarrier barrier = new ContinueBarrier("Execute again?"); do { System.out.printf("Replaying %,d messages%n", NUMBER_OF_MESSAGES); final long startNs = System.nanoTime(); test.replayRecording(recordingLength, recordingId); final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs); final double dataRate = (recordingLength * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = recordingLength / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.println("Performance inclusive of replay request and connection setup:"); System.out.printf( "Replayed %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); } while (barrier.await()); } }
Source:
public void testBasePathValidation() throws Exception { ArtifactArchiver.DescriptorImpl desc = (ArtifactArchiver.DescriptorImpl)j.jenkins.getDescriptorOrDie(ArtifactArchiver.class); FreeStyleProject p = j.createFreeStyleProject(); Assert.assertEquals("no workspace", FormValidation.Kind.OK, desc.doCheckBasePath(p, "foo").kind); Assert.assertEquals("relative path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); Assert.assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); Assert.assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "../workfoo").kind); p.getBuildersList().replaceBy(Collections.singleton(new CreateFilesForBasePathTest())); build(p); Assert.assertEquals("workspace exists but path does not", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "foo").kind); Assert.assertEquals("workspace exists and path does", FormValidation.Kind.OK, desc.doCheckBasePath(p, "module").kind); Assert.assertEquals("file specified as base path", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "module/dist/target/file").kind); Assert.assertEquals("relative path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); Assert.assertEquals("absolute path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); }

Target:
public void testBasePathValidation() throws Exception { ArtifactArchiver.DescriptorImpl desc = (ArtifactArchiver.DescriptorImpl)j.jenkins.getDescriptorOrDie(ArtifactArchiver.class); FreeStyleProject p = j.createFreeStyleProject(); assertEquals("no workspace", FormValidation.Kind.OK, desc.doCheckBasePath(p, "foo").kind); assertEquals("explicit same directory", FormValidation.Kind.OK, desc.doCheckBasePath(p, ".").kind); assertEquals("relative path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "../workfoo").kind); p.getBuildersList().replaceBy(Collections.singleton(new CreateFilesForBasePathTest())); build(p); assertEquals("workspace exists but path does not", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "foo").kind); assertEquals("workspace exists and path does", FormValidation.Kind.OK, desc.doCheckBasePath(p, "module").kind); assertEquals("file specified as base path", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "module/dist/target/file").kind); assertEquals("relative path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); assertEquals("absolute path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); }
Source:
public void commit(String localityGroup) throws IOException { Preconditions.checkArgument(mLGNames.size() == 1, "All writes must be to the same locality " + " group."); Preconditions.checkArgument(mLGNames.contains(localityGroup), "All writes must be in the " + "given locality group: " + localityGroup); for (KeyValue kv : mHopper) { mPut.add(kv); } mHTable.put(mPut); if (!mHTable.isAutoFlush()) { mHTable.flushCommits(); } mPut = null; mEntityId = null; mHopper = null; mId = null; mLGNames = new HashSet<String>(); }

Target:
public void commit(String localityGroup) throws IOException { Preconditions.checkState(mPut != null, "commit must be paired with a call to begin()"); Preconditions.checkState(mLGNames.size() == 1, "All writes must be to the same locality group. Locality groups of specified puts: " + mLGNames); Preconditions.checkArgument(mLGNames.contains(localityGroup), "All writes must be in the " + "given locality group: " + localityGroup); for (KeyValue kv : mHopper) { mPut.add(kv); } mHTable.put(mPut); if (!mHTable.isAutoFlush()) { mHTable.flushCommits(); } reset(); }
Source:
private void importButtonClicked() { File file = selectImportFile(); if (file != null) { List<String> regexes = new ArrayList<String>(getRegexes()); try (BufferedReader br = new BufferedReader(new FileReader(file))) { String line = null; while ((line = br.readLine()) != null) { String trimmedLine = line.trim(); if (MultipleRegexesOptionsPanel.validateRegexAndCheckForDuplicates( trimmedLine, regexes)) regexes.add(trimmedLine); } } catch (IOException | PatternSyntaxException e) { View.getSingleton() .showWarningDialog( Constant.messages.getString( "context.include.import.error", e.getLocalizedMessage())); return; } setRegexes(regexes); } }

Target:
private void importButtonClicked() { File file = selectImportFile(); if (file != null) { List<String> regexes = new ArrayList<String>(getRegexes()); try (BufferedReader br = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) { String line = null; while ((line = br.readLine()) != null) { String trimmedLine = line.trim(); if (validateRegexAndCheckForDuplicates(trimmedLine, regexes)) { regexes.add(trimmedLine); } } } catch (IOException | PatternSyntaxException e) { View.getSingleton() .showWarningDialog( Constant.messages.getString( "context.include.import.error", e.getLocalizedMessage())); return; } setRegexes(regexes); } }