auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void seekToSegment(long entryId, SeekErrorRule errorRule) throws NoSuchOffsetException, IOException { assert(m_isTransient); assert(entryId >= 0); synchronized(PersistentBinaryDeque.this) { PBDSegment<M> seekSegment = findSegmentWithEntry(entryId, errorRule); moveToValidSegment(); if (m_segment == null) { return; } if (m_segment.segmentIndex() == seekSegment.segmentIndex()) { if (m_segment.getReader(m_cursorId) != null) { m_numRead -= m_segment.getReader(m_cursorId).readIndex(); m_segment.getReader(m_cursorId).close(); m_segment.openForRead(m_cursorId); } } else { if (m_segment.segmentIndex() > seekSegment.segmentIndex()) { for (PBDSegment<M> curr : m_segments.tailMap(seekSegment.segmentIndex(), true).values()) { if (curr.segmentIndex() > m_segment.segmentIndex()) { break; } PBDSegmentReader<M> currReader = curr.getReader(m_cursorId); if (curr.segmentIndex() == m_segment.segmentIndex()) { if (currReader != null) { m_numRead -= currReader.readIndex(); } } else { m_numRead -= curr.getNumEntries(); } if (currReader != null) { currReader.close(); } } } else { PBDSegmentReader<M> segmentReader = m_segment.getReader(m_cursorId); m_numRead += m_segment.getNumEntries(); if (segmentReader != null) { m_numRead -= segmentReader.readIndex(); segmentReader.close(); } for (PBDSegment<M> curr : m_segments.tailMap(m_segment.segmentIndex(), false).values()) { if (curr.segmentIndex() == seekSegment.segmentIndex()) { break; } m_numRead += curr.getNumEntries(); } } m_segment = seekSegment; } } }

Target:
public void seekToSegment(long entryId, SeekErrorRule errorRule) throws NoSuchOffsetException, IOException { assert(m_isTransient); assert(entryId >= 0); synchronized(PersistentBinaryDeque.this) { PBDSegment<M> seekSegment = findSegmentWithEntry(entryId, errorRule); if (moveToValidSegment() == null) { return; } if (m_segment.segmentIndex() == seekSegment.segmentIndex()) { if (m_segment.getReader(m_cursorId) != null) { m_numRead -= m_segment.getReader(m_cursorId).readIndex(); m_segment.getReader(m_cursorId).close(); m_segment.openForRead(m_cursorId); } } else { if (m_segment.segmentIndex() > seekSegment.segmentIndex()) { for (PBDSegment<M> curr : m_segments.tailMap(seekSegment.segmentIndex(), true).values()) { if (curr.segmentIndex() > m_segment.segmentIndex()) { break; } PBDSegmentReader<M> currReader = curr.getReader(m_cursorId); if (curr.segmentIndex() == m_segment.segmentIndex()) { if (currReader != null) { m_numRead -= currReader.readIndex(); } } else { m_numRead -= curr.getNumEntries(); } if (currReader != null) { currReader.close(); } } } else { PBDSegmentReader<M> segmentReader = m_segment.getReader(m_cursorId); m_numRead += m_segment.getNumEntries(); if (segmentReader != null) { m_numRead -= segmentReader.readIndex(); segmentReader.close(); } for (PBDSegment<M> curr : m_segments.tailMap(m_segment.segmentIndex(), false).values()) { if (curr.segmentIndex() == seekSegment.segmentIndex()) { break; } m_numRead += curr.getNumEntries(); } } m_segment = seekSegment; } } }
Source:
protected ITmfStateProvider createStateProvider() { if (!(getTrace() instanceof LttngKernelTrace)) { throw new IllegalStateException("LttngKernelStateSystemModule: trace should be of type LttngKernelTrace"); } return new LttngKernelStateProvider((LttngKernelTrace) getTrace()); }

Target:
protected @NonNull ITmfStateProvider createStateProvider() { ITmfTrace trace = getTrace(); if (!(trace instanceof LttngKernelTrace)) { throw new IllegalStateException("LttngKernelStateSystemModule: trace should be of type LttngKernelTrace"); } return new LttngKernelStateProvider((LttngKernelTrace) trace); }
Source:
public List<NMFData> parse() { final List<NMFData> result = new ArrayList<>(); for (final Pair<LongWritable, Text> ketValue : dataSet) { final String line = ketValue.getSecond().toString().trim(); if (line.startsWith("#") || line.length() == 0) { continue; } final String[] split = line.split("\\s+"); if (split.length != 3) { throw new RuntimeException("Failed to parse: the number of elements in each line should be 3"); } final int rowIndex; final int colIndex; final double value; try { rowIndex = Integer.valueOf(split[0]); colIndex = Integer.valueOf(split[1]); } catch (final NumberFormatException e) { throw new RuntimeException("Failed to parse: numbers for indices should be integer."); } if (rowIndex >= rows) { throw new RuntimeException( String.format("Invalid row index %d. It should be less than # of input rows %d", rowIndex, rows)); } if (colIndex >= cols) { throw new RuntimeException( String.format("Invalid column index %d. It should be less than # of input columns %d", colIndex, cols)); } try { value = Double.valueOf(split[2]); } catch (final NumberFormatException e) { throw new RuntimeException("Failed to parse: numbers for values should be double."); } if (value < 0) { throw new RuntimeException("Failed to parse: numbers should be greater than or equal to zero."); } result.add(new NMFData(rowIndex, colIndex, value)); } return result; }

Target:
public List<NMFData> parse() { final List<NMFData> result = new LinkedList<>(); for (final Pair<LongWritable, Text> keyValue : dataSet) { final String line = keyValue.getSecond().toString().trim(); if (line.startsWith("#") || line.length() == 0) { continue; } final String[] split = line.split("\\s+"); if (split.length != 3) { throw new RuntimeException("Failed to parse: the number of elements in each line should be 3"); } final int rowIndex; final int colIndex; final double value; try { rowIndex = Integer.valueOf(split[0]); colIndex = Integer.valueOf(split[1]); } catch (final NumberFormatException e) { throw new RuntimeException("Failed to parse: numbers for indices should be integer.", e); } if (rowIndex > numRows) { throw new RuntimeException( String.format("Invalid row index %d. It should be less than # of input rows %d", rowIndex, numRows)); } if (colIndex > numCols) { throw new RuntimeException( String.format("Invalid column index %d. It should be less than # of input columns %d", colIndex, numCols)); } if (rowIndex <= 0 || colIndex <= 0) { throw new RuntimeException("Invalid indices. It should be greater than zero"); } try { value = Double.valueOf(split[2]); } catch (final NumberFormatException e) { throw new RuntimeException("Failed to parse: numbers for values should be double.", e); } if (value < 0) { throw new RuntimeException("Failed to parse: numbers should be greater than or equal to zero."); } result.add(new NMFData(rowIndex, colIndex, value)); } return result; }
Source:
public void FileOpenEmptyTest() throws IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.EMPTY_PCAP; assumeTrue(trace.exists()); PcapFile file = trace.getTrace(); assertEquals(PcapTestTrace.EMPTY_PCAP.getPath(), file.getPath()); assertEquals(2, file.getMajorVersion()); assertEquals(4, file.getMinorVersion()); assertEquals(1, file.getDataLinkType()); assertEquals(65535, file.getSnapLength()); assertEquals(0, file.getTimeAccuracy()); assertEquals(0, file.getTimeZoneCorrection()); assertEquals(ByteOrder.LITTLE_ENDIAN, file.getByteOrder()); assertEquals(0, file.getTotalNbPackets()); }

Target:
public void FileOpenEmptyTest() throws IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.EMPTY_PCAP; assumeTrue(trace.exists()); try (PcapFile file = trace.getTrace();) { assertEquals(PcapTestTrace.EMPTY_PCAP.getPath(), file.getPath()); assertEquals(2, file.getMajorVersion()); assertEquals(4, file.getMinorVersion()); assertEquals(1, file.getDataLinkType()); assertEquals(65535, file.getSnapLength()); assertEquals(0, file.getTimeAccuracy()); assertEquals(0, file.getTimeZoneCorrection()); assertEquals(ByteOrder.LITTLE_ENDIAN, file.getByteOrder()); assertEquals(0, file.getTotalNbPackets()); } }
Source:
public void copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, String destBucketName, String destObjectName, CopyConditions copyConditions, ServerSideEncryption sseTarget) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException { if ((sseTarget.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C provided keys must be made over a secure connection."); } else { Map<String, String> headerTarget = new HashMap<>(); Map<String, String> headers = new HashMap<>(); sseTarget.marshal(headerTarget); if (sseTarget.getType() == ServerSideEncryption.Type.SSE_C) { Map<String, String> headerSource = new HashMap<>(); sseSource.marshal(headerSource); headers.putAll(headerSource); headers.putAll(headerTarget); } else { headers.putAll(headerTarget); } copyObject(bucketName, objectName, destBucketName, destObjectName, copyConditions, headers); } }

Target:
public void copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, String destBucketName, String destObjectName, CopyConditions copyConditions, ServerSideEncryption sseTarget) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException { if ((sseTarget.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C operations must be performed over a secure connection."); } else if ((sseTarget.getType() == (ServerSideEncryption.Type.SSE_KMS)) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_KMS operations must be performed over a secure connection."); } Map<String, String> headerTarget = new HashMap<>(); Map<String, String> headers = new HashMap<>(); sseTarget.marshal(headerTarget); if (sseTarget.getType() == ServerSideEncryption.Type.SSE_C) { Map<String, String> headerSource = new HashMap<>(); sseSource.marshal(headerSource); headers.putAll(headerSource); headers.putAll(headerTarget); } else { headers.putAll(headerTarget); } copyObject(bucketName, objectName, destBucketName, destObjectName, copyConditions, headers); }
Source:
private PollingResult pollCommandWithTimeListener(Stack stack, ApiClient apiClient, BigDecimal commandId, long maximumWaitTimeInSeconds, AbstractClouderaManagerCommandCheckerTask<ClouderaManagerPollerObject> listenerTask) { ClouderaManagerPollerObject clouderaManagerPollerObject = new ClouderaManagerPollerObject(stack, apiClient, commandId); return clouderaManagerCommandPollerObjectPollingService.pollWithAbsoluteTimeout( listenerTask, clouderaManagerPollerObject, POLL_INTERVAL, maximumWaitTimeInSeconds, TOLERATE_FIVE_CONSECUTIVE_ERRORS).getLeft(); }

Target:
private PollingResult pollCommandWithTimeListener(Stack stack, ApiClient apiClient, BigDecimal commandId, long maximumWaitTimeInSeconds, AbstractClouderaManagerCommandCheckerTask<ClouderaManagerPollerObject> listenerTask) { ClouderaManagerPollerObject clouderaManagerPollerObject = new ClouderaManagerPollerObject(stack, apiClient, commandId); return clouderaManagerCommandPollerObjectPollingService.pollWithAbsoluteTimeoutSingleFailure( listenerTask, clouderaManagerPollerObject, POLL_INTERVAL, maximumWaitTimeInSeconds); }
Source:
public void testIndexSeekAndScan() throws Exception { updateAndCommit( asList( IndexEntryUpdate.add( 1L, index, "a" ), IndexEntryUpdate.add( 2L, index, "a" ), IndexEntryUpdate.add( 3L, index, "b" ) ) ); assertThat( query( exact( 1, "a" ) ), equalTo( asList( 1L, 2L ) ) ); assertThat( query( IndexQuery.exists( 1 ) ), equalTo( asList( 1L, 2L, 3L ) ) ); }

Target:
public void testIndexSeekAndScan() throws Exception { updateAndCommit( asList( IndexEntryUpdate.add( 1L, index, "a" ), IndexEntryUpdate.add( 2L, index, "a" ), IndexEntryUpdate.add( 3L, index, "b" ) ) ); assertThat( query( exact( 1, "a" ) ), equalTo( asList( 1L, 2L ) ) ); assertThat( query( exists( 1 ) ), equalTo( asList( 1L, 2L, 3L ) ) ); }
Source:
void store(String tenantId, Property<?> property) throws CacheException; void remove(String tenantId, String id); void addObserver(String tenantId, String id, Observer observer); void removeObserver(String tenantId, String id, Observer observer); interface Observer<Type> { void created(Property<Type> value); void updated(Property<Type> newValue); void removed(); }

Target:
void store(String tenantId, Property<?> property) throws CacheException; void remove(String tenantId, String id); void addObserver(String tenantId, String id, Observer observer); void removeObserver(String tenantId, String id, Observer observer); interface Observer<Type> { void created(Property<Type> property); void updated(Property<Type> property); void removed(Property<Type> property); }
Source:
private boolean isCompressedRequestForPathAccepted(String path) { if (cachedCompressedRequestForPathAccepted != null) return cachedCompressedRequestForPathAccepted; try { String gzipCompressedRequestForPathAccepted = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_GZIP_ACCEPT_COMPRESSED_REQUESTS_FOR_PATHS, ""); cachedCompressedRequestForPathAccepted = false; for (String acceptPath : gzipCompressedRequestForPathAccepted.split(",")) { if (path.matches(acceptPath)) { cachedCompressedRequestForPathAccepted = true; } } return cachedCompressedRequestForPathAccepted; } catch (Throwable t) { log.warn("Unable to get the global property: " + OpenmrsConstants.GLOBAL_PROPERTY_GZIP_ACCEPT_COMPRESSED_REQUESTS_FOR_PATHS, t); return false; } }

Target:
private boolean isCompressedRequestForPathAccepted(String path) { try { cachedGZipCompressedRequestForPathAccepted = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_GZIP_ACCEPT_COMPRESSED_REQUESTS_FOR_PATHS, ""); for (String acceptPath : cachedGZipCompressedRequestForPathAccepted.split(",")) { if (path.matches(acceptPath)) { return true; } } return false; } catch (Throwable t) { log.warn("Unable to get the global property: " + OpenmrsConstants.GLOBAL_PROPERTY_GZIP_ACCEPT_COMPRESSED_REQUESTS_FOR_PATHS, t); return false; } }
Source:
private StatisticsFile getStatisticFile() { MinecraftServer server = MinecraftServer.getServer(); File statsDir = new File(server.worldServerForDimension(0).getSaveHandler().getWorldDirectory(), "stats"); File statsFile = new File(statsDir, getUniqueId().toString() + ".json"); if (!statsFile.exists()) { File legacyFile = new File(statsDir, getName() + ".json"); if (legacyFile.exists() && legacyFile.isFile()) { legacyFile.renameTo(statsFile); } } return new StatisticsFile(server, statsFile); }

Target:
private StatisticsManagerServer getStatisticFile() { MinecraftServer server = SpongeImpl.getServer(); File statsDir = new File(server.worldServerForDimension(0).getSaveHandler().getWorldDirectory(), "stats"); File statsFile = new File(statsDir, getUniqueId().toString() + ".json"); if (!statsFile.exists()) { File legacyFile = new File(statsDir, getName() + ".json"); if (legacyFile.exists() && legacyFile.isFile()) { legacyFile.renameTo(statsFile); } } return new StatisticsManagerServer(server, statsFile); }
Source:
private void scheduleWithFixedDelay() { executor.scheduleWithFixedDelay( () -> { CorruptionHealthReport paxosRoundCorruptionReport = analyzeHistoryAndBuildCorruptionHealthReport(); CorruptionHealthReport timestampInvariantsReport = timestampInvariantsVerifier.timestampInvariantsHealthReport(); localCorruptionReport = ImmutableCorruptionHealthReport.builder() .putAllViolatingStatusesToNamespaceAndUseCase( paxosRoundCorruptionReport.violatingStatusesToNamespaceAndUseCase()) .putAllViolatingStatusesToNamespaceAndUseCase( timestampInvariantsReport.violatingStatusesToNamespaceAndUseCase()) .build(); processLocalHealthReport(); }, TIMELOCK_CORRUPTION_ANALYSIS_INTERVAL.getSeconds(), TIMELOCK_CORRUPTION_ANALYSIS_INTERVAL.getSeconds(), TimeUnit.SECONDS); }

Target:
private void scheduleWithFixedDelay() { executor.scheduleWithFixedDelay( () -> { CorruptionHealthReport paxosRoundCorruptionReport = analyzeHistoryAndBuildCorruptionHealthReport(); CorruptionHealthReport timestampInvariantsReport = timestampInvariantsVerifier.timestampInvariantsHealthReport(); localCorruptionReport = ImmutableCorruptionHealthReport.builder() .from(paxosRoundCorruptionReport) .putAllViolatingStatusesToNamespaceAndUseCase( timestampInvariantsReport.violatingStatusesToNamespaceAndUseCase()) .build(); processLocalHealthReport(); }, TIMELOCK_CORRUPTION_ANALYSIS_INTERVAL.getSeconds(), TIMELOCK_CORRUPTION_ANALYSIS_INTERVAL.getSeconds(), TimeUnit.SECONDS); }
Source:
public void testSetTexture() throws NoSuchFieldException, IllegalAccessException { CustomTextureService service = new CustomTextureService(plugin); SlimefunItem item = SlimefunMocks.mockSlimefunItem(plugin, "TEXTURE_TEST", new ItemStack(Material.LANTERN)); String version = "Unit Test v1.0"; Config config = (Config) ReflectionUtils.getFieldValue(service, "config"); config.setValue(item.getID(), 300); config.setValue("version", version); service.register(Arrays.asList(item), false); Assertions.assertTrue(service.isActive()); Assertions.assertEquals(version, service.getVersion()); Assertions.assertEquals(300, service.getModelData(item.getID())); ItemStack stack = new ItemStack(Material.DIAMOND); service.setTexture(stack, item.getID()); Assertions.assertTrue(stack.getItemMeta().hasCustomModelData()); Assertions.assertEquals(300, stack.getItemMeta().getCustomModelData()); }

Target:
public void testSetTexture() { Config config = new Config("plugins/temporary"); CustomTextureService service = new CustomTextureService(config); SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "TEXTURE_TEST", new ItemStack(Material.LANTERN)); String version = "Unit Test v1.0"; config.setValue(item.getID(), 300); config.setValue("version", version); service.register(Arrays.asList(item), false); Assertions.assertTrue(service.isActive()); Assertions.assertEquals(version, service.getVersion()); Assertions.assertEquals(300, service.getModelData(item.getID())); ItemStack stack = new ItemStack(Material.DIAMOND); service.setTexture(stack, item.getID()); Assertions.assertTrue(stack.getItemMeta().hasCustomModelData()); Assertions.assertEquals(300, stack.getItemMeta().getCustomModelData()); }
Source:
public void linkResultFieldToSubTrans( IMetaverseNode streamFieldNode, TransMeta subTransMeta, IMetaverseNode subTransNode, IComponentDescriptor descriptor ) { List<StepMeta> steps = subTransMeta.getSteps(); if ( !CollectionUtils.isEmpty( steps ) ) { for ( StepMeta step : steps ) { if ( step.getStepMetaInterface() instanceof RowsToResultMeta ) { RowsToResultMeta rtrm = (RowsToResultMeta) step.getStepMetaInterface(); IComponentDescriptor stepDescriptor = new MetaverseComponentDescriptor( step.getName(), DictionaryConst.NODE_TYPE_TRANS_STEP, subTransNode, descriptor.getContext() ); IMetaverseNode subTransStepNode = stepAnalyzer.createNodeFromDescriptor( stepDescriptor ); try { RowMetaInterface rowMetaInterface = rtrm.getParentStepMeta().getParentTransMeta().getStepFields( step ); for ( int i = 0; i < rowMetaInterface.getFieldNames().length; i++ ) { String field = rowMetaInterface.getFieldNames()[ i ]; if ( streamFieldNode.getName().equals( field ) ) { IComponentDescriptor stepFieldDescriptor = new MetaverseComponentDescriptor( field, DictionaryConst.NODE_TYPE_TRANS_FIELD, subTransStepNode, descriptor.getContext() ); IMetaverseNode subTransField = stepAnalyzer.createFieldNode( stepFieldDescriptor, rowMetaInterface.getValueMeta( i ), StepAnalyzer.NONE, false ); stepAnalyzer.getMetaverseBuilder().addLink( subTransField, DictionaryConst.LINK_DERIVES, streamFieldNode ); } } } catch ( KettleStepException e ) { log.warn( "Could not get step fields of RowsToResult step in sub transformation - " + subTransMeta.getName(), e ); } } } } }

Target:
public void linkResultFieldToSubTrans( IMetaverseNode streamFieldNode, TransMeta subTransMeta, IMetaverseNode subTransNode, IComponentDescriptor descriptor ) { List<StepMeta> steps = subTransMeta.getSteps(); if ( !CollectionUtils.isEmpty( steps ) ) { for ( StepMeta step : steps ) { if ( step.getStepMetaInterface() instanceof RowsToResultMeta ) { RowsToResultMeta rtrm = (RowsToResultMeta) step.getStepMetaInterface(); IComponentDescriptor stepDescriptor = new MetaverseComponentDescriptor( step.getName(), DictionaryConst.NODE_TYPE_TRANS_STEP, subTransNode, descriptor.getContext() ); IMetaverseNode subTransStepNode = stepAnalyzer.createNodeFromDescriptor( stepDescriptor ); try { RowMetaInterface rowMetaInterface = rtrm.getParentStepMeta().getParentTransMeta().getStepFields( step ); for ( int i = 0; i < rowMetaInterface.getFieldNames().length; i++ ) { String field = rowMetaInterface.getFieldNames()[ i ]; if ( streamFieldNode.getName().equals( field ) ) { IComponentDescriptor stepFieldDescriptor = new MetaverseComponentDescriptor( field, DictionaryConst.NODE_TYPE_TRANS_FIELD, subTransStepNode, descriptor.getContext() ); IMetaverseNode subTransField = stepAnalyzer.createFieldNode( stepFieldDescriptor, rowMetaInterface.getValueMeta( i ), StepAnalyzer.NONE, false ); stepAnalyzer.getMetaverseBuilder().addLink( subTransField, DictionaryConst.LINK_DERIVES, streamFieldNode ); } } } catch ( KettleStepException e ) { log.warn( Messages.getString( "WARN.SubtransAnalyzer.RowsToResultNotFound", subTransMeta.getName() ), e ); } } } } }
Source:
public List<String> render() { final List<String> violationMessages = new ArrayList<>(); violationMessages.add(violationName); violationMessages.add(MessageFormat.format(VIOLATING_ENTITIES_LIST_FORMAT, violationName, StringUtils.join(violatingEntities, ", "))); return violationMessages; }

Target:
public List<String> render() { final List<String> violationMessages = new ArrayList<>(); violationMessages.add(violationName); violationMessages.add(MessageFormat.format(VIOLATING_ENTITIES_LIST_FORMAT, violationName, StringUtils.join(violatingEntities, COMMA_SEPARATOR))); return violationMessages; }
Source:
public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { if (volume == null) { return; } GlusterStatus status = volume.getStatus(); ImageResource statusImage = null; String tooltip; Boolean isBrickDown = false; for(GlusterBrickEntity brick : volume.getBricks()) { if(brick.getStatus() == GlusterStatus.DOWN) { isBrickDown = true; break; } } if (!isBrickDown) { switch (status) { case DOWN: statusImage = resources.downImage(); tooltip = constants.down(); break; case UP: statusImage = resources.upImage(); tooltip = constants.up(); break; default: statusImage = resources.downImage(); tooltip = constants.down(); } } else { statusImage = resources.volumeUpWarning(); tooltip = constants.volumeBricksDown(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); }

Target:
public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { if (volume == null) { return; } GlusterStatus status = volume.getStatus(); ImageResource statusImage = null; String tooltip; switch (status) { case DOWN: statusImage = resources.downImage(); tooltip = constants.down(); break; case UP: if(isBrickDown(volume)) { statusImage = resources.volumeUpWarning(); tooltip = constants.volumeBricksDown(); } else { statusImage = resources.upImage(); tooltip = constants.up(); } break; default: statusImage = resources.downImage(); tooltip = constants.down(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); }
Source:
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException { if (!TimeZoneRulesDataContract.DATA_URI.equals(uri)) { throw new FileNotFoundException("Unknown URI"); } if (!"r".equals(mode)) { throw new FileNotFoundException("Only read-only access supported."); } File distroFile = null; try { distroFile = File.createTempFile("distro", null, getContext().getFilesDir()); AssetManager assets = getContext().getAssets(); try (InputStream is = assets.open(TimeZoneDistro.FILE_NAME, ACCESS_STREAMING); FileOutputStream fos = new FileOutputStream(distroFile, false )) { copy(is, fos); } return ParcelFileDescriptor.open(distroFile, ParcelFileDescriptor.MODE_READ_ONLY); } catch (IOException e) { throw new RuntimeException("Unable to copy distro asset file", e); } finally { if (distroFile != null) { distroFile.delete(); } } }

Target:
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException { if (!TimeZoneRulesDataContract.DATA_URI.equals(uri)) { throw new FileNotFoundException("Unknown URI: " + uri); } if (!"r".equals(mode)) { throw new FileNotFoundException("Only read-only access supported."); } File distroFile = null; try { distroFile = File.createTempFile("distro", null, getContext().getFilesDir()); AssetManager assets = getContext().getAssets(); try (InputStream is = assets.open(TimeZoneDistro.FILE_NAME, ACCESS_STREAMING); FileOutputStream fos = new FileOutputStream(distroFile, false )) { copy(is, fos); } return ParcelFileDescriptor.open(distroFile, ParcelFileDescriptor.MODE_READ_ONLY); } catch (IOException e) { throw new RuntimeException("Unable to copy distro asset file", e); } finally { if (distroFile != null) { distroFile.delete(); } } }
Source:
public OffsetFetchRequest build(short version) { if (isAllTopicPartitions() && version < 2) { throw new UnsupportedVersionException("The broker only supports OffsetFetchRequest " + "v" + version + ", but we need v2 or newer to request all topic partitions."); } if (data.requireStable() && version < 7) { if (throwOnStableFlagNotSupported) { throw new UnsupportedVersionException("Broker unexpectedly doesn't support requireStable flag " + "on version " + version); } log.trace("Fallback the requireStable flag to false as broker " + "only supports OffsetFetchRequest version {}. Need " + "v7 or newer to enable this feature", version); return new OffsetFetchRequest(data.setRequireStable(false), version); } return new OffsetFetchRequest(data, version); }

Target:
public OffsetFetchRequest build(short version) { if (isAllTopicPartitions() && version < 2) { throw new UnsupportedVersionException("The broker only supports OffsetFetchRequest " + "v" + version + ", but we need v2 or newer to request all topic partitions."); } if (data.requireStable() && version < 7) { if (throwOnFetchStableOffsetsUnsupported) { throw new UnsupportedVersionException("Broker unexpectedly " + "doesn't support requireStable flag on version " + version); } else { log.trace("Fallback the requireStable flag to false as broker " + "only supports OffsetFetchRequest version {}. Need " + "v7 or newer to enable this feature", version); return new OffsetFetchRequest(data.setRequireStable(false), version); } } return new OffsetFetchRequest(data, version); }
Source:
private PropertySet getRef() { return getCheckedRef(PropertySet.class); }

Target:
protected PropertySet getRef() { return getCheckedRef(PropertySet.class); }
Source:
public <TElement extends Element> void updateElement( Graph graph, ExistingElementMutation<TElement> elementMutation, Authorizations authorizations ) { TElement element = elementMutation.getElement(); if (MUTATION_LOGGER.isTraceEnabled()) { MUTATION_LOGGER.trace("updateElement: %s", elementMutation.getId()); } if (!getConfig().isIndexEdges() && elementMutation.getElementType() == ElementType.EDGE) { return; } bulkUpdateService.flushUntilElementIdIsComplete(elementMutation.getId()); addMutationPropertiesToIndex(graph, elementMutation); addUpdateForMutationToBulk(graph, elementMutation); if (elementMutation.getNewElementVisibility() != null && element.getFetchHints().isIncludeExtendedDataTableNames()) { ImmutableSet<String> extendedDataTableNames = element.getExtendedDataTableNames(); if (extendedDataTableNames != null && !extendedDataTableNames.isEmpty()) { extendedDataTableNames.forEach(tableName -> alterExtendedDataElementTypeVisibility( graph, elementMutation, element.getExtendedData(tableName), elementMutation.getOldElementVisibility(), elementMutation.getNewElementVisibility() )); } } if (getConfig().isAutoFlush()) { flush(graph); } }

Target:
public <TElement extends Element> void updateElement( Graph graph, ExistingElementMutation<TElement> elementMutation, Authorizations authorizations ) { TElement element = elementMutation.getElement(); if (MUTATION_LOGGER.isTraceEnabled()) { MUTATION_LOGGER.trace("updateElement: %s", elementMutation.getId()); } if (!getConfig().isIndexEdges() && elementMutation.getElementType() == ElementType.EDGE) { return; } addMutationPropertiesToIndex(graph, elementMutation); addUpdateForMutationToBulk(graph, elementMutation); if (elementMutation.getNewElementVisibility() != null && element.getFetchHints().isIncludeExtendedDataTableNames()) { ImmutableSet<String> extendedDataTableNames = element.getExtendedDataTableNames(); if (extendedDataTableNames != null && !extendedDataTableNames.isEmpty()) { extendedDataTableNames.forEach(tableName -> alterExtendedDataElementTypeVisibility( graph, elementMutation, element.getExtendedData(tableName), elementMutation.getOldElementVisibility(), elementMutation.getNewElementVisibility() )); } } if (getConfig().isAutoFlush()) { flush(graph); } }
Source:
void removeServerSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { log.debug("Segment[%s] is gone from server[%s]", segment.getId(), server.getName()); final Map<SegmentId, AvailableSegmentMetadata> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); final AvailableSegmentMetadata segmentMetadata = knownSegments.get(segment.getId()); final Set<DruidServerMetadata> segmentServers = segmentMetadata.getReplicas(); final ImmutableSet<DruidServerMetadata> servers = FluentIterable.from(segmentServers) .filter(Predicates.not(Predicates.equalTo(server))) .toSet(); final DruidServerMetadata realtimeServer = servers.stream() .filter(metadata -> metadata.getType().equals(ServerType.REALTIME)) .findAny() .orElse(null); long isRealtime = realtimeServer == null ? 0 : 1; final AvailableSegmentMetadata metadataWithNumReplicas = AvailableSegmentMetadata .from(segmentMetadata) .withReplicas(servers) .withRealtime(isRealtime) .build(); knownSegments.put(segment.getId(), metadataWithNumReplicas); lock.notifyAll(); } }

Target:
void removeServerSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { log.debug("Segment[%s] is gone from server[%s]", segment.getId(), server.getName()); final Map<SegmentId, AvailableSegmentMetadata> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); final AvailableSegmentMetadata segmentMetadata = knownSegments.get(segment.getId()); final Set<DruidServerMetadata> segmentServers = segmentMetadata.getReplicas(); final ImmutableSet<DruidServerMetadata> servers = FluentIterable .from(segmentServers) .filter(Predicates.not(Predicates.equalTo(server))) .toSet(); final AvailableSegmentMetadata metadataWithNumReplicas = AvailableSegmentMetadata .from(segmentMetadata) .withReplicas(servers) .withRealtime(recomputeIsRealtime(servers)) .build(); knownSegments.put(segment.getId(), metadataWithNumReplicas); lock.notifyAll(); } }
Source:
public PlanNodeStatsEstimate( @JsonProperty("outputRowCount") double outputRowCount, @JsonProperty("symbolStatistics") Map<Symbol, SymbolStatsEstimate> symbolStatistics) { checkArgument(isNaN(outputRowCount) || outputRowCount >= 0, "outputRowCount cannot be negative"); this.outputRowCount = outputRowCount; this.symbolStatistics = HashTreePMap.from(symbolStatistics); }

Target:
public PlanNodeStatsEstimate( @JsonProperty("outputRowCount") double outputRowCount, @JsonProperty("symbolStatistics") Map<Symbol, SymbolStatsEstimate> symbolStatistics) { this(outputRowCount, HashTreePMap.from(requireNonNull(symbolStatistics, "symbolStatistics is null"))); }
Source:
private ServiceInfo getACS(Predicate<ServiceInfo> predicate) { return assertionConsumerServices .values() .stream() .filter(predicate) .filter(serviceInfo -> supportedBindings.contains(serviceInfo.getBinding())) .filter( serviceInfo -> CollectionUtils.intersection(IDP_SUPPORTED_BINDINGS, SSO_RESPONSE_BINDINGS) .contains(serviceInfo.getBinding())) .findFirst() .orElse(null); }

Target:
private ServiceInfo getACS(Predicate<ServiceInfo> predicate) { return assertionConsumerServices .values() .stream() .filter(predicate) .filter(serviceInfo -> supportedBindings.contains(serviceInfo.getBinding())) .filter(serviceInfo -> IDP_SUPPORTED_BINDINGS.contains(serviceInfo.getBinding())) .filter(serviceInfo -> SSO_RESPONSE_BINDINGS.contains(serviceInfo.getBinding())) .findFirst() .orElse(null); }
Source:
public Object doWork() { final AllelicCountCollection counts = new AllelicCountCollection(snpCountsFile); final List<ACNVModeledSegment> segments = SegmentUtils.readACNVModeledSegmentFile(segmentsFile); final AlleleFractionState state = reconstructState(segments, parametersFile); final AllelicPanelOfNormals allelicPON = allelicPONFile != null ? AllelicPanelOfNormals.read(allelicPONFile) : AllelicPanelOfNormals.EMPTY_PON; final List<SimpleInterval> unmodeledSegments = segments.stream().map(ACNVModeledSegment::getInterval).collect(Collectors.toList()); final AllelicCountWithPhasePosteriorsCollection countsWithPhasePosteriors = calculatePhasePosteriors(counts, unmodeledSegments, state, allelicPON); countsWithPhasePosteriors.write(outputFile, counts.getVerbosity()); return "SUCCESS"; }

Target:
public Object doWork() { if (!new HDF5Library().load(null)) { throw new UserException.HardwareFeatureException("Cannot load the required HDF5 library. " + "HDF5 is currently supported on x86-64 architecture and Linux or OSX systems."); } final AllelicCountCollection counts = new AllelicCountCollection(snpCountsFile); final List<ACNVModeledSegment> segments = SegmentUtils.readACNVModeledSegmentFile(segmentsFile); final AlleleFractionState state = reconstructState(segments, parametersFile); final AllelicPanelOfNormals allelicPoN = allelicPoNFile != null ? AllelicPanelOfNormals.read(allelicPoNFile) : AllelicPanelOfNormals.EMPTY_PON; final List<SimpleInterval> unmodeledSegments = segments.stream().map(ACNVModeledSegment::getInterval).collect(Collectors.toList()); final AllelicCountWithPhasePosteriorsCollection countsWithPhasePosteriors = calculatePhasePosteriors(counts, unmodeledSegments, state, allelicPoN); countsWithPhasePosteriors.write(outputFile, counts.getVerbosity()); return "SUCCESS"; }
Source:
public void close() throws IOException { this.closed = true; for (final EJBClientContextListener listener : this.ejbClientContextListeners) { try { listener.contextClosed(this); } catch (Throwable t) { logger.debug("Ignoring the exception thrown by an EJB client context listener while closing the context " + this, t); } } this.reconnectionExecutorService.shutdownNow(); }

Target:
public synchronized void close() throws IOException { if (closed) { return; } this.closed = true; for (final EJBClientContextListener listener : this.ejbClientContextListeners) { try { listener.contextClosed(this); } catch (Throwable t) { logger.debug("Ignoring the exception thrown by an EJB client context listener while closing the context " + this, t); } } this.reconnectionExecutorService.shutdownNow(); }
Source:
public void updateProviderDatasetRepresentation(String globalId, String schema, String version, Revision revision) throws RepresentationNotExistsException { if(!revision.isPublished()){ return; } Representation rep = recordDAO.getRepresentation(globalId, schema, version); if (rep == null) { throw new RepresentationNotExistsException(schema); } Collection<CompoundDataSetId> dataSets = dataSetDAO.getDataSetAssignments(globalId, schema, version); for (CompoundDataSetId dsID : dataSets) { dataSetDAO.insertProviderDatasetRepresentationInfo(dsID.getDataSetId(), dsID.getDataSetProviderId(), globalId, version, schema, RevisionUtils.getRevisionKey(revision), revision.getCreationTimeStamp(), revision.isAcceptance(), revision.isPublished(), revision.isDeleted()); } }

Target:
public void updateProviderDatasetRepresentation(String globalId, String schema, String version, Revision revision) throws RepresentationNotExistsException { Representation rep = recordDAO.getRepresentation(globalId, schema, version); if (rep == null) { throw new RepresentationNotExistsException(schema); } Collection<CompoundDataSetId> dataSets = dataSetDAO.getDataSetAssignments(globalId, schema, version); for (CompoundDataSetId dsID : dataSets) { dataSetDAO.insertProviderDatasetRepresentationInfo(dsID.getDataSetId(), dsID.getDataSetProviderId(), globalId, version, schema, RevisionUtils.getRevisionKey(revision), revision.getCreationTimeStamp(), revision.isAcceptance(), revision.isPublished(), revision.isDeleted()); } }
Source:
private Message createManagementMessage(String operation, String associatedLinkName) { final Duration serverTimeout = MessageUtils.adjustServerTimeout(operationTimeout); final Map<String, Object> applicationProperties = new HashMap<>(); applicationProperties.put(ManagementConstants.MANAGEMENT_OPERATION_KEY, operation); applicationProperties.put(ManagementConstants.SERVER_TIMEOUT, serverTimeout.toMillis()); if (associatedLinkName != null && !associatedLinkName.isEmpty()) { applicationProperties.put(ManagementConstants.ASSOCIATED_LINK_NAME_KEY, associatedLinkName); } final Message message = Proton.message(); message.setApplicationProperties(new ApplicationProperties(applicationProperties)); return message; }

Target:
private Message createManagementMessage(String operation, String associatedLinkName) { final Duration serverTimeout = MessageUtils.adjustServerTimeout(operationTimeout); final Map<String, Object> applicationProperties = new HashMap<>(); applicationProperties.put(ManagementConstants.MANAGEMENT_OPERATION_KEY, operation); applicationProperties.put(ManagementConstants.SERVER_TIMEOUT, serverTimeout.toMillis()); if (!CoreUtils.isNullOrEmpty(associatedLinkName)) { applicationProperties.put(ManagementConstants.ASSOCIATED_LINK_NAME_KEY, associatedLinkName); } final Message message = Proton.message(); message.setApplicationProperties(new ApplicationProperties(applicationProperties)); return message; }
Source:
protected void postInitTemplate(List<VmTemplate> templates) { boolean isSelectedTemplateBase = selectedTemplate.isBaseTemplate(); VmTemplate baseTemplate = null; List<VmTemplate> relatedTemplates = new ArrayList<>(); for (VmTemplate template : templates) { if (template.getName().equals(selectedTemplate.getName())) { relatedTemplates.add(template); if (!isSelectedTemplateBase) { if (selectedTemplate.getBaseTemplateId().equals(template.getId())) { baseTemplate = template; } } } } initTemplateWithVersion(relatedTemplates); TemplateWithVersion templateCouple; if (selectedTemplate.isBaseTemplate()) { templateCouple = new TemplateWithVersion(selectedTemplate, selectedTemplate); } else { templateCouple = new TemplateWithVersion(baseTemplate, selectedTemplate); } getModel().getTemplateWithVersion().setSelectedItem(templateCouple); updateIsDisksAvailable(); }

Target:
protected void postInitTemplate(List<VmTemplate> templates) { DataCenterWithCluster selectedDCWithCluster = getModel().getDataCenterWithClustersList().getSelectedItem(); Guid clusterId = selectedDCWithCluster != null ? selectedDCWithCluster.getCluster().getId() : selectedTemplate.getVdsGroupId(); VmTemplate baseTemplate = null; if (selectedTemplate.isBaseTemplate()) { baseTemplate = selectedTemplate; } Guid baseTemplateId = selectedTemplate.getBaseTemplateId(); List<VmTemplate> relatedTemplates = new ArrayList<>(); for (VmTemplate template : templates) { if (template.getBaseTemplateId().equals(baseTemplateId)) { if (template.getVdsGroupId().equals(clusterId)) { relatedTemplates.add(template); } if (baseTemplate == null) { if (template.getId().equals(baseTemplateId)) { baseTemplate = template; } } } } if(!relatedTemplates.contains(baseTemplate)) { relatedTemplates.add(baseTemplate); } initTemplateWithVersion(relatedTemplates); if(selectedTemplate.getVdsGroupId().equals(selectedDCWithCluster.getCluster().getId())) { TemplateWithVersion templateCouple = new TemplateWithVersion(baseTemplate, selectedTemplate); getModel().getTemplateWithVersion().setSelectedItem(templateCouple); } updateIsDisksAvailable(); }
Source:
String getHealthReport() { String healthReport = ""; String scriptReport = (nodeHealthScriptRunner == null) ? "" : nodeHealthScriptRunner.getHealthReport(); String discReport = dirsHandler.getDisksHealthReport(false); String exceptionReport = nodeHealthException != null ? nodeHealthException.getMessage() : ""; if (!scriptReport.equals("")) { healthReport = scriptReport; } if (!discReport.equals("")) { healthReport = healthReport.equals("") ? discReport : healthReport.concat(SEPARATOR + discReport); } if (!exceptionReport.equals("")) { healthReport = healthReport.equals("") ? exceptionReport : healthReport.concat(SEPARATOR + exceptionReport); } return healthReport; }

Target:
String getHealthReport() { String scriptReport = nullIfEmpty(nodeHealthScriptRunner == null ? null : nodeHealthScriptRunner.getHealthReport()); String discReport = nullIfEmpty(dirsHandler.getDisksHealthReport(false)); String exceptionReport = nullIfEmpty(nodeHealthException == null ? null : nodeHealthException.getMessage()); return Joiner.on(SEPARATOR).skipNulls() .join(scriptReport, discReport, exceptionReport); }
Source:
private String emailMask(String email){ String[] frag = email.split("@"); int sid = frag[0].length() / 3 + 1; int sdomain = frag[1].length() / 3 + 1; String id = frag[0].substring(0, sid) + "*****"; String domain = "***" + frag[1].substring(sdomain); return id + "@" + domain; }

Target:
private String emailMask(String email){ String[] frag = email.split("@"); int sid = frag[0].length() / 3 + 1; int sdomain = frag[1].length() / 3; String id = frag[0].substring(0, sid) + "***"; String domain = "***" + frag[1].substring(sdomain); return id + "@" + domain; }
Source:
public void toggleAllSelected(){ System.out.print("in toggle all"); this.selectAllFiles = !this.selectAllFiles; toggleSelectedFiles(this.selectAllFiles); }

Target:
public void toggleAllSelected(){ this.selectAllFiles = !this.selectAllFiles; }
Source:
private static String getMessageClass(ReceiveCommand.Type type) { String mc = ""; switch (type) { case CREATE: mc = "newBranch"; break; case UPDATE: mc = "modifyBranch"; break; case DELETE: mc = "deleteBranch"; break; } return mc; }

Target:
private static String getMessageClass(ReceiveCommand.Type type) { switch (type) { case CREATE: return "newBranch"; case UPDATE: return "modifyBranch"; case DELETE: return "deleteBranch"; default: return "errorBranch"; } }
Source:
public Range<Long> visitLimit(LimitNode node, Void context) { Range<Long> sourceCardinalityRange = node.getSource().accept(this, null); return Range.closed(sourceCardinalityRange.lowerEndpoint(), min(sourceCardinalityRange.upperEndpoint(), node.getCount())); }

Target:
public Range<Long> visitLimit(LimitNode node, Void context) { Range<Long> sourceCardinalityRange = node.getSource().accept(this, null); long upper = node.getCount(); if (sourceCardinalityRange.hasUpperBound()) { upper = min(sourceCardinalityRange.upperEndpoint(), node.getCount()); } long lower = min(upper, sourceCardinalityRange.lowerEndpoint()); return Range.closed(lower, upper); }
Source:
private Iterable<ChangeData> queryRecentChanges(int limit) throws OrmException { QueryProcessor qp = queryProcessor.get(); qp.setLimit(limit); String query = "project:{" + projectName + "} is:open"; try { return Iterables.limit(queryProcessor.get().queryChanges(query), limit); } catch (QueryParseException e) { throw new IllegalStateException(e); } }

Target:
private Iterable<ChangeData> queryRecentChanges(int limit) throws OrmException { QueryProcessor qp = queryProcessor.get(); qp.setLimit(limit); ChangeQueryBuilder qb = qp.getQueryBuilder(); Predicate<ChangeData> p = Predicate.and(qb.project(projectName.get()), qb.status_open()); try { return Iterables.limit(qp.queryChanges(p), limit); } catch (QueryParseException e) { throw new OrmException(e); } }
Source:
public Boolean isActiveProject(int id) { Project project = getProject(id); return project != null; }

Target:
public Boolean isActiveProject(int id) { return getProject(id) != null; }
Source:
public void robotInit() { try { DOMConfigurator.configure("log4j.xml"); } catch (Exception e) { log.error("Couldn't configure logging - file probably missing or malformed"); } this.injector = Guice.createInjector(this.injectionModule); this.initializeSystems(); SmartDashboard.putData(Scheduler.getInstance()); frequencyReportInterval = injector.getInstance(XPropertyManager.class).createPersistentProperty("Robot loop frequency report interval", 20); }

Target:
public void robotInit() { try { DOMConfigurator.configure("log4j.xml"); } catch (Exception e) { final String errorString = "Couldn't configure logging - file probably missing or malformed"; System.out.println(errorString); DriverStation.reportError(errorString, false); } this.injector = Guice.createInjector(this.injectionModule); this.initializeSystems(); SmartDashboard.putData(Scheduler.getInstance()); frequencyReportInterval = injector.getInstance(XPropertyManager.class).createPersistentProperty("Robot loop frequency report interval", 20); }
Source:
public OffsetDateTime getNullableResult(ResultSet rs, int columnIndex) throws SQLException { return (OffsetDateTime) rs.getObject(columnIndex); }

Target:
public OffsetDateTime getNullableResult(ResultSet rs, int columnIndex) throws SQLException { return rs.getObject(columnIndex, OffsetDateTime.class); }
Source:
public <B extends RenderedReport.Builder<B, ?>> CompletableFuture<B> render( final S source, final F format, final TimeRange timeRange, final B builder, final Duration timeout ) { final DevToolsService dts = _devToolsFactory.create(getIgnoreCertificateErrors(source)); LOGGER.debug() .setMessage("rendering") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); final CompletableFuture<Void> navigate = dts.navigate(getUri(source).toString()); final CompletableFuture<B> result = navigate .thenCompose(whatever -> { LOGGER.debug() .setMessage("page load completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); return whenLoaded(dts, source, format, timeRange, builder); }); result.whenComplete((x, e) -> { LOGGER.debug() .setMessage("rendering completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .addData("result", x) .addData("exception", e) .log(); navigate.cancel(true); dts.close(); }); TIMEOUT_SERVICE.schedule(() -> result.cancel(true), timeout.toNanos(), TimeUnit.NANOSECONDS); return result; }

Target:
public <B extends RenderedReport.Builder<B, ?>> CompletableFuture<B> render( final S source, final F format, final TimeRange timeRange, final B builder, final Duration timeout ) { final DevToolsService dts = _devToolsFactory.create(getIgnoreCertificateErrors(source)); LOGGER.debug() .setMessage("rendering") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); final CompletableFuture<Void> navigate = dts.navigate(getUri(source).toString()); final CompletableFuture<B> result = navigate .thenCompose(whatever -> { LOGGER.debug() .setMessage("page load completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); return whenLoaded(dts, source, format, timeRange, builder); }); result.whenComplete((x, e) -> { LOGGER.debug() .setMessage("rendering completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .addData("result", x) .setThrowable(e) .log(); navigate.cancel(true); dts.close(); }); TIMEOUT_SERVICE.schedule(() -> result.cancel(true), timeout.toNanos(), TimeUnit.NANOSECONDS); return result; }
Source:
public void processStartTransactionsUpdate( Set<Long> startTimestamps, LockWatchStateUpdate update) { Optional<IdentifiedVersion> latestVersion = processEventLogUpdate(update); latestVersion.ifPresent( version -> startTimestamps.forEach(timestamp -> timestampMap.putStartVersion(timestamp, version))); getEarliestVersion().ifPresent(eventLog::removeOldEntries); }

Target:
public void processStartTransactionsUpdate( Set<Long> startTimestamps, LockWatchStateUpdate update) { Optional<IdentifiedVersion> updateVersion = processEventLogUpdate(update); updateVersion.ifPresent(version -> timestampStateStore.putStartTimestamps(startTimestamps, version)); retentionEventsInLog(); }