auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testKeyValueContainerCheckCorruption() throws Exception { long containerID = 102; int deletedBlocks = 1; int normalBlocks = 3; int chunksPerBlock = 4; boolean valid = false; createContainerWithBlocks(containerID, normalBlocks, deletedBlocks, 65536, chunksPerBlock); File chunksPath = new File(containerData.getChunksPath()); assertTrue(chunksPath.listFiles().length == (deletedBlocks + normalBlocks) * chunksPerBlock); container.close(); KeyValueContainerCheck kvCheck = new KeyValueContainerCheck(containerData.getMetadataPath(), conf, containerID); File metaDir = new File(containerData.getMetadataPath()); File dbFile = KeyValueContainerLocationUtil .getContainerDBFile(metaDir, containerID); containerData.setDbFile(dbFile); try(ReferenceCountedDB db = BlockUtils.getDB(containerData, conf); KeyValueBlockIterator kvIter = new KeyValueBlockIterator(containerID, new File(containerData.getContainerPath()))) { BlockData block = kvIter.nextBlock(); assertTrue(!block.getChunks().isEmpty()); ContainerProtos.ChunkInfo c = block.getChunks().get(0); File chunkFile = ChunkUtils.getChunkFile(containerData, ChunkInfo.getFromProtoBuf(c)); long length = chunkFile.length(); assertTrue(length > 0); try (RandomAccessFile file = new RandomAccessFile(chunkFile, "rws")) { file.setLength(length / 2); } assertEquals(length/2, chunkFile.length()); } valid = kvCheck.fastCheck(); assertTrue(valid); valid = kvCheck.fullCheck(new DataTransferThrottler( HddsConfigKeys.HDDS_CONTAINER_SCANNER_VOLUME_BYTES_PER_SECOND_DEFAULT), null); assertFalse(valid); }

Target:
public void testKeyValueContainerCheckCorruption() throws Exception { long containerID = 102; int deletedBlocks = 1; int normalBlocks = 3; int chunksPerBlock = 4; boolean valid = false; ContainerScrubberConfiguration sc = conf.getObject( ContainerScrubberConfiguration.class); createContainerWithBlocks(containerID, normalBlocks, deletedBlocks, 65536, chunksPerBlock); File chunksPath = new File(containerData.getChunksPath()); assertTrue(chunksPath.listFiles().length == (deletedBlocks + normalBlocks) * chunksPerBlock); container.close(); KeyValueContainerCheck kvCheck = new KeyValueContainerCheck(containerData.getMetadataPath(), conf, containerID); File metaDir = new File(containerData.getMetadataPath()); File dbFile = KeyValueContainerLocationUtil .getContainerDBFile(metaDir, containerID); containerData.setDbFile(dbFile); try(ReferenceCountedDB db = BlockUtils.getDB(containerData, conf); KeyValueBlockIterator kvIter = new KeyValueBlockIterator(containerID, new File(containerData.getContainerPath()))) { BlockData block = kvIter.nextBlock(); assertTrue(!block.getChunks().isEmpty()); ContainerProtos.ChunkInfo c = block.getChunks().get(0); File chunkFile = ChunkUtils.getChunkFile(containerData, ChunkInfo.getFromProtoBuf(c)); long length = chunkFile.length(); assertTrue(length > 0); try (RandomAccessFile file = new RandomAccessFile(chunkFile, "rws")) { file.setLength(length / 2); } assertEquals(length/2, chunkFile.length()); } valid = kvCheck.fastCheck(); assertTrue(valid); valid = kvCheck.fullCheck(new DataTransferThrottler( sc.getBandwidthPerVolume()), null); assertFalse(valid); }
Source:
public final boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) { IMicroblockContainerTile tile = getMicroblockTile(world, pos); MicroblockContainer container = tile != null ? tile.getMicroblockContainer() : null; if (container == null) { return false; } return container.getPartContainer().canPlaceTorchOnTop() || canPlaceTorchOnTopDefault(state, world, pos); }

Target:
public final boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) { IMicroblockContainerTile tile = getMicroblockTile(world, pos); if (tile != null) { return tile.getMicroblockContainer().getPartContainer().canPlaceTorchOnTop() || canPlaceTorchOnTopDefault(state, world, pos); } return false; }
Source:
protected DocumentModel attach(DocumentModel doc) { String sid = ctx.getCoreSession().getSessionId(); try { doc = doc.clone(); } catch (CloneNotSupportedException e) { } doc.attach(sid); return doc; }

Target:
protected void attach(DocumentModel doc) { String sid = ctx.getCoreSession().getSessionId(); doc.attach(sid); }
Source:
private void createPresenter() { RenderedTemplate renderedTemplate = null; if (presenterConfigModel.getNestedPresenter()) { renderedTemplate = createdNestedPresenterTemplates.getPresenter(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getPresenter(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getPresenter(); } PsiClass createdPsiClass = createPsiClass(createdPresenterPackage, renderedTemplate); createdPsiClass.navigate(true); }

Target:
private void createPresenter() { RenderedTemplate renderedTemplate = null; if (presenterConfigModel.getNestedPresenter()) { renderedTemplate = createdNestedPresenterTemplates.getPresenter(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getPresenter(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getPresenter(); } createdPresenterPsiClass = createPsiClass(createdPresenterPackage, renderedTemplate); navigateToClass(createdPresenterPsiClass); }
Source:
public void TestJSON() { byte input[] = new byte[14]; input[0] = Byte.valueOf((byte) 0); input[1] = Byte.valueOf((byte) 1); input[2] = Byte.valueOf((byte) 0); input[3] = Byte.valueOf((byte) 13); input[4] = Byte.valueOf((byte) 0); input[5] = Byte.valueOf((byte) 11); input[6] = Byte.valueOf((byte) 0); input[7] = Byte.valueOf((byte) 2); input[8] = Byte.valueOf((byte) 0); input[9] = Byte.valueOf((byte) 5); input[10] = Byte.valueOf((byte) 3); input[11] = Byte.valueOf((byte) 0); input[12] = Byte.valueOf((byte) 105); input[13] = Byte.valueOf((byte) 100); ColumnDef d = ColumnDef.build("bar", "ascii", "json", 1, false, null, null); RawJSONString result = (RawJSONString) d.asJSON(input); assertThat(result.json, is("{\"id\":3}")); }

Target:
public void TestJSON() { byte input[] = new byte[] { (byte) 0, (byte) 1, (byte) 0, (byte) 13, (byte) 0, (byte) 11, (byte) 0, (byte) 2, (byte) 0, (byte) 5, (byte) 3, (byte) 0, (byte) 105, (byte) 100 }; ColumnDef d = ColumnDef.build("bar", "ascii", "json", 1, false, null, null); RawJSONString result = (RawJSONString) d.asJSON(input); assertThat(result.json, is("{\"id\":3}")); }
Source:
public static void setThrottledOpWaitTime(int time) { LOG.info("throttledOpWaitTime set to " + time); throttledOpWaitTime = time; }

Target:
public static void setThrottledOpWaitTime(int time) { LOG.info("throttledOpWaitTime set to {}", time); throttledOpWaitTime = time; }
Source:
public void setInterrupted(boolean interrupted) { this.interrupted = interrupted; this.interrupt(); try { if (connector != null) { connector.disconnect(); } } catch (SwegonVentilationException e) { logger.error("Error occured when closing connection", e); } }

Target:
public void setInterrupted(boolean interrupted) { this.interrupted = interrupted; this.interrupt(); try { if (connector != null) { connector.disconnect(); } } catch (SwegonVentilationException e) { logger.warn("Error occurred when closing connection", e); } }
Source:
private void setupControl(JTable table, Object value, boolean isSelected, boolean hasFocus) { myPanel.setBorder(getCellBorder(table, isSelected && hasFocus)); Color foreground; Color background; if (isSelected) { background = table.getSelectionBackground(); foreground = table.getSelectionForeground(); } else { background = table.getBackground(); foreground = table.getForeground(); } myPanel.setBackground(background); myCheckBox.setBackground(background); myCheckBox.setForeground(foreground); myPanel.remove(myCheckBox); InstallableComponent installableComponent = (InstallableComponent)value; int indent = 0; if (installableComponent != null) { myCheckBox.setEnabled(installableComponent.isOptional()); myCheckBox.setText(installableComponent.getLabel()); myCheckBox.setSelected(isSelected((InstallableComponent)value)); while (installableComponent.getParent() != null) { indent++; installableComponent = installableComponent.getParent(); } } myPanel.add(myCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, indent * 2)); }

Target:
private void setupControl(JTable table, Object value, boolean isSelected, boolean hasFocus) { myPanel.setBorder(getCellBorder(table, isSelected && hasFocus)); Color foreground; Color background; if (isSelected) { background = table.getSelectionBackground(); foreground = table.getSelectionForeground(); } else { background = table.getBackground(); foreground = table.getForeground(); } myPanel.setBackground(background); myCheckBox.setForeground(foreground); myPanel.remove(myCheckBox); InstallableComponent installableComponent = (InstallableComponent)value; int indent = 0; if (installableComponent != null) { myCheckBox.setEnabled(installableComponent.isOptional()); myCheckBox.setText(installableComponent.getLabel()); myCheckBox.setSelected(isSelected((InstallableComponent)value)); while (installableComponent.getParent() != null) { indent++; installableComponent = installableComponent.getParent(); } } myPanel.add(myCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, indent * 2)); }
Source:
private List<TypeDTO> fetchTypes(File[] typeDirectories) { final List<TypeDTO> results = new ArrayList<>(); for (File typeDirectory : typeDirectories) { if (typeDirectory.isDirectory() && !typeDirectory.getName().startsWith(".")) { final File typeJson = new File(typeDirectory, "type.json"); if (typeJson.exists()) { final TypeDTO jsonTypeDTO = unSerializeType(typeJson); final TypeDTO.Builder typeDTOBuilder = new TypeDTO.Builder(jsonTypeDTO); if (StringUtils.isBlank(jsonTypeDTO.getId())) { if (!StringUtils.isBlank(jsonTypeDTO.getName())) { typeDTOBuilder.withId(jsonTypeDTO.getName().replaceAll("[^a-zA-Z0-9_]", "")); } else { typeDTOBuilder.withId(jsonTypeDTO.getName().replaceAll("[^a-zA-Z0-9_]", "")); } } final File typeIconFile = new File(typeDirectory, ICON_NAME); if (typeIconFile.exists()) { typeDTOBuilder.withIcon(typeIconFile.toURI()); } typeDTOBuilder.withCategories(fetchCategories(typeDTOBuilder.getId(), typeDirectory)); final TypeDTO type = typeDTOBuilder.build(); results.add(type); } } } results.sort(Comparator.comparing(TypeDTO::getName)); return results; }

Target:
private List<TypeDTO> fetchTypes(File[] typeDirectories) { final List<TypeDTO> results = new ArrayList<>(); for (File typeDirectory : typeDirectories) { if (typeDirectory.isDirectory() && !typeDirectory.getName().startsWith(".")) { final File typeJson = new File(typeDirectory, "type.json"); if (typeJson.exists()) { final TypeDTO jsonTypeDTO = unSerializeType(typeJson); final TypeDTO.Builder typeDTOBuilder = new TypeDTO.Builder(jsonTypeDTO); if (StringUtils.isBlank(jsonTypeDTO.getId())) { if (!StringUtils.isBlank(jsonTypeDTO.getName())) { typeDTOBuilder.withId(jsonTypeDTO.getName().replaceAll(ID_REGEX, "")); } else { typeDTOBuilder.withId(jsonTypeDTO.getName().replaceAll(ID_REGEX, "")); } } final File typeIconFile = new File(typeDirectory, ICON_NAME); if (typeIconFile.exists()) { typeDTOBuilder.withIcon(typeIconFile.toURI()); } typeDTOBuilder.withCategories(fetchCategories(typeDTOBuilder.getId(), typeDirectory)); final TypeDTO type = typeDTOBuilder.build(); results.add(type); } } } results.sort(Comparator.comparing(TypeDTO::getName)); return results; }
Source:
public void onReaderSitesSearched(OnReaderSitesSearched event) { if (!isAdded()) { return; } mRecyclerView.setRefreshing(false); showLoadingProgress(false); ReaderSiteSearchAdapter adapter = getSiteSearchAdapter(); if (event.isError()) { adapter.clear(); } else if (StringUtils.equals(event.searchTerm, mCurrentSearchQuery)) { adapter.setCanLoadMore(event.canLoadMore); if (event.offset == 0) { adapter.setSiteList(event.sites); } else { adapter.addSiteList(event.sites); } } }

Target:
public void onReaderSitesSearched(OnReaderSitesSearched event) { if (!isAdded()) { return; } mRecyclerView.setRefreshing(false); showLoadingProgress(false); ReaderSiteSearchAdapter adapter = getSiteSearchAdapter(); if (event.isError()) { adapter.clear(); } else if (StringUtils.equals(event.searchTerm, mCurrentSearchQuery)) { adapter.setCanLoadMore(event.canLoadMore); if (event.offset == 0) { adapter.setSiteList(event.sites); } else { adapter.addSiteList(event.sites); } if (mSiteSearchRestorePosition > 0) { mRecyclerView.scrollRecycleViewToPosition(mSiteSearchRestorePosition); } } if (getSearchTabsPosition() == TAB_SITES && adapter.isEmpty()) { setEmptyTitleAndDescription(event.isError()); showEmptyView(); } mSiteSearchRestorePosition = 0; }
Source:
public void testNodesWithoutFlows() { this.m_driver.get(this.getBaseUrl() + "opennms/element/nodeList.htm?flows=false"); assertThat(Iterables.transform(m_driver.findElements(By.xpath(" containsInAnyOrder("TestMachine loc1node1", "TestMachine loc2node1")); }

Target:
public void testNodesWithoutFlows() { m_driver.get(this.getBaseUrl() + "opennms/element/nodeList.htm?flows=false"); assertThat(Iterables.transform(m_driver.findElements(By.xpath(" containsInAnyOrder("TestMachine loc1node1", "TestMachine loc2node1")); }
Source:
public OAuthToken token(@Required @QueryParam("oauth_provider") String oauthProvider) throws IOException { OAuthAuthenticator provider = getAuthenticator(oauthProvider); return provider.getToken(security.getUserPrincipal().getName()); }

Target:
public OAuthToken token(@Required @QueryParam("oauth_provider") String oauthProvider) throws ServerException, BadRequestException { OAuthAuthenticator provider = getAuthenticator(oauthProvider); try { return provider.getToken(security.getUserPrincipal() .getName()); } catch (IOException e) { throw new ServerException(e.getLocalizedMessage(), e); } }
Source:
public Subscriptions getSubscriptions(final SubscriptionState state, final QueryParams params) { if (state != null) params.put("state", state.getType()); return doGET(Subscriptions.SUBSCRIPTIONS_RESOURCE, Subscriptions.class, params); }

Target:
public Subscriptions getSubscriptions(final SubscriptionState state, final QueryParams params) { if (state != null) { params.put("state", state.getType()); } return doGET(Subscriptions.SUBSCRIPTIONS_RESOURCE, Subscriptions.class, params); }
Source:
public void navigateToObjectNoStepCreationTest() { Dispute dispute = new Dispute(); List<String> pathToProperty = Arrays.asList("creator", "firstName"); ScenarioBeanUtil.navigateToObject(dispute, pathToProperty, false); }

Target:
public void navigateToObjectNoStepCreationTest() { Dispute dispute = new Dispute(); List<String> pathToProperty = Arrays.asList("creator", "firstName"); String message = "Impossible to reach field firstName because a step is not instantiated"; Assertions.assertThatThrownBy(() -> ScenarioBeanUtil.navigateToObject(dispute, pathToProperty, false)) .isInstanceOf(ScenarioException.class) .hasMessage(message); }
Source:
private void throwIfNotBoolean(JsonNode payload) { if (!payload.get(FIELD_VALUE).isBoolean()) { throw new ValidationException(Collections.singletonList(format("Value [%s] is not valid for path [%s]", payload.get(FIELD_VALUE).asText(), payload.get(FIELD_OPERATION_PATH).asText()))); } }

Target:
private void throwIfNotBoolean(JsonNode payload) { if (payload.get(FIELD_VALUE) != null && !payload.get(FIELD_VALUE).isBoolean()) { throw new ValidationException(Collections.singletonList(format("Value [%s] must be of type boolean for path [%s]", payload.get(FIELD_VALUE).asText(), payload.get(FIELD_OPERATION_PATH).asText()))); } }
Source:
public ReportModel(String baseUrl, String ssoToken) { reportUrl = baseUrl.indexOf('?') < 0 ? baseUrl : baseUrl.substring(0, baseUrl.indexOf('?')); paramsMap.parseUrlParams(baseUrl); paramsMap.setParameter("sessionID", ssoToken); paramsMap.setParameter("active_hosts_select", "AND+delete_date+IS+NULL"); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); paramsMap.setParameter("userLocale", (currentLocale.equals("default") ? "en_US" : currentLocale)); }

Target:
public ReportModel(String baseUrl, String ssoToken) { reportUrl = FrontendUrlUtils.stripParameters(baseUrl); paramsMap.parseUrlParams(baseUrl); paramsMap.setParameter("sessionID", ssoToken); paramsMap.setParameter("active_hosts_select", "AND+delete_date+IS+NULL"); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); paramsMap.setParameter("userLocale", (currentLocale.equals("default") ? "en_US" : currentLocale)); }
Source:
public void close() throws IOException { if (closed.getAndSet(true)) { LOG.debug("Ignoring close() as stream is already closed"); return; } S3ADataBlocks.DataBlock block = getActiveBlock(); boolean hasBlock = hasActiveBlock(); LOG.debug("{}: Closing block #{}: current block= {}", this, blockCount, hasBlock ? block : "(none)"); long bytes = 0; try { if (multiPartUpload == null) { if (hasBlock) { bytes = putObject(); bytesSubmitted = bytes; } } else { if (hasBlock && (block.hasData() || multiPartUpload.getPartsSubmitted() == 0)) { uploadCurrentBlock(); } final List<PartETag> partETags = multiPartUpload.waitForAllPartUploads(); bytes = bytesSubmitted; if (putTracker.aboutToComplete(multiPartUpload.getUploadId(), partETags, bytes)) { multiPartUpload.complete(partETags); } else { LOG.info("File will be visible when the job is committed"); } } if (!putTracker.outputImmediatelyVisible()) { statistics.commitUploaded(bytes); } LOG.debug("Upload complete to by {}", key, writeOperationHelper); } catch (IOException ioe) { writeOperationHelper.writeFailed(ioe); throw ioe; } finally { closeAll(LOG, block, blockFactory); LOG.debug("Statistics: {}", statistics); closeAll(LOG, statistics); clearActiveBlock(); } writeOperationHelper.writeSuccessful(bytes); }

Target:
public void close() throws IOException { if (closed.getAndSet(true)) { LOG.debug("Ignoring close() as stream is already closed"); return; } S3ADataBlocks.DataBlock block = getActiveBlock(); boolean hasBlock = hasActiveBlock(); LOG.debug("{}: Closing block #{}: current block= {}", this, blockCount, hasBlock ? block : "(none)"); long bytes = 0; try { if (multiPartUpload == null) { if (hasBlock) { bytes = putObject(); bytesSubmitted = bytes; } } else { if (hasBlock && (block.hasData() || multiPartUpload.getPartsSubmitted() == 0)) { uploadCurrentBlock(); } final List<PartETag> partETags = multiPartUpload.waitForAllPartUploads(); bytes = bytesSubmitted; if (putTracker.aboutToComplete(multiPartUpload.getUploadId(), partETags, bytes)) { multiPartUpload.complete(partETags); } else { LOG.info("File will be visible when the job is committed", key); } } if (!putTracker.outputImmediatelyVisible()) { statistics.commitUploaded(bytes); } LOG.debug("Upload complete to by {}", key, writeOperationHelper); } catch (IOException ioe) { writeOperationHelper.writeFailed(ioe); throw ioe; } finally { closeAll(LOG, block, blockFactory); LOG.debug("Statistics: {}", statistics); closeAll(LOG, statistics); clearActiveBlock(); } writeOperationHelper.writeSuccessful(bytes); }
Source:
public <T> List<T> stores(final String storeName, final QueryableStoreType<T> queryableStoreType) { if (streamThread.state() == StreamThread.State.DEAD) { return Collections.emptyList(); } if (!streamThread.isRunning()) { throw new InvalidStateStoreException("Cannot get state store " + storeName + " because the stream thread is " + streamThread.state() + ", not RUNNING"); } final List<T> stores = new ArrayList<>(); final Set<Task> tasks = new HashSet<>(streamThread.tasks().values()); if (streamThread.standbyTasks() != null) { tasks.addAll(streamThread.standbyTasks().values()); } for (final Task streamTask : tasks) { final StateStore store = streamTask.getStore(storeName); if (store != null && queryableStoreType.accepts(store)) { if (!store.isOpen()) { throw new InvalidStateStoreException("Cannot get state store " + storeName + " for task " + streamTask + " because the store is not open. The state store may have migrated to another instances."); } if (store instanceof TimestampedKeyValueStore && queryableStoreType instanceof QueryableStoreTypes.KeyValueStoreType) { stores.add((T) new ReadOnlyKeyValueStoreFacade((TimestampedKeyValueStore<Object, Object>) store)); } else if (store instanceof TimestampedWindowStore && queryableStoreType instanceof QueryableStoreTypes.WindowStoreType) { stores.add((T) new ReadOnlyWindowStoreFacade((TimestampedWindowStore<Object, Object>) store)); } else { stores.add((T) store); } } } return stores; }

Target:
public <T> List<T> stores(final String storeName, final QueryableStoreType<T> queryableStoreType) { if (streamThread.state() == StreamThread.State.DEAD) { return Collections.emptyList(); } if (!streamThread.isRunning()) { throw new InvalidStateStoreException("Cannot get state store " + storeName + " because the stream thread is " + streamThread.state() + ", not RUNNING or REBALANCING"); } final List<T> stores = new ArrayList<>(); final Set<Task> tasks = new HashSet<>(streamThread.tasks().values()); if (streamThread.standbyTasks() != null) { tasks.addAll(streamThread.standbyTasks().values()); } for (final Task streamTask : tasks) { final StateStore store = streamTask.getStore(storeName); if (store != null && queryableStoreType.accepts(store)) { if (!store.isOpen()) { throw new InvalidStateStoreException("Cannot get state store " + storeName + " for task " + streamTask + " because the store is not open. The state store may have migrated to another instances."); } if (store instanceof TimestampedKeyValueStore && queryableStoreType instanceof QueryableStoreTypes.KeyValueStoreType) { stores.add((T) new ReadOnlyKeyValueStoreFacade((TimestampedKeyValueStore<Object, Object>) store)); } else if (store instanceof TimestampedWindowStore && queryableStoreType instanceof QueryableStoreTypes.WindowStoreType) { stores.add((T) new ReadOnlyWindowStoreFacade((TimestampedWindowStore<Object, Object>) store)); } else { stores.add((T) store); } } } return stores; }
Source:
public ListIterator<StreamInputPacketIndexEntry> search(final long timestamp) { int max = this.entries.size() - 1; int min = 0; int guessI; StreamInputPacketIndexEntry guessEntry = null; if (this.getEntries().isEmpty()) { return this.getEntries().listIterator(); } if (timestamp < 0) { throw new IllegalArgumentException("timestamp is negative"); } for (;;) { guessI = (max + min) / 2; guessEntry = this.entries.get(guessI); if (min == max) { break; } if (timestamp <= guessEntry.getTimestampEnd()) { max = guessI; } else { min = guessI + 1; } } return this.entries.listIterator(guessI); }

Target:
public ListIterator<StreamInputPacketIndexEntry> search(final long timestamp) { if (this.getEntries().isEmpty()) { return this.getEntries().listIterator(); } if (timestamp < 0) { throw new IllegalArgumentException("timestamp is negative"); } StreamInputPacketIndexEntry key = new StreamInputPacketIndexEntry(0); key.setTimestampEnd(timestamp); int guessI = Collections.binarySearch(this.entries ,key, new StreamInputPacketIndexEntryComparator()); guessI = (guessI < 0)? ~guessI: guessI; return this.entries.listIterator(guessI); }
Source:
private List<HasMetadata> unmarshalObjects(RecipeImpl k8sRecipe) throws DevfileException { if (!k8sBasedEnvTypes.contains(k8sRecipe.getType())) { String allowedEnvTypes = String.join(" or ", k8sBasedEnvTypes); throw new DevfileException( format( "Kubernetes component can only be applied to a workspace with either %s recipe type" + " but workspace has a recipe of type '%s'", allowedEnvTypes, k8sRecipe.getType())); } return unmarshal(k8sRecipe.getContent()); }

Target:
private List<HasMetadata> unmarshalObjects(RecipeImpl k8sRecipe) throws DevfileException { if (!k8sBasedEnvTypes.contains(k8sRecipe.getType())) { String allowedEnvTypes = String.join(" or ", k8sBasedEnvTypes); throw new DevfileException( format( "Kubernetes component can only be applied to a workspace with any of %s recipe type" + " but workspace has a recipe of type '%s'", allowedEnvTypes, k8sRecipe.getType())); } return unmarshal(k8sRecipe.getContent()); }
Source:
public void testValuesFromEnvironment() { AzureBlobStoreConfigProvider provider = new AzureBlobStoreConfigProvider(); XStream stream = new XStream(); stream = provider.getConfiguredXStream(stream); Object config = stream.fromXML(getClass().getResourceAsStream("blobstore.xml")); assertTrue(config instanceof AzureBlobStoreInfo); AzureBlobStoreInfo abConfig = (AzureBlobStoreInfo) config; assertEquals("MYCONTAINER", abConfig.getContainer()); assertEquals("30", abConfig.getMaxConnections()); assertEquals(true, abConfig.isEnabled()); }

Target:
public void testValuesFromEnvironment() { AzureBlobStoreConfigProvider provider = new AzureBlobStoreConfigProvider(); XStream stream = new XStream(); stream = provider.getConfiguredXStream(stream); Object config = stream.fromXML(getClass().getResourceAsStream("blobstore.xml")); assertTrue(config instanceof AzureBlobStoreInfo); AzureBlobStoreInfo abConfig = (AzureBlobStoreInfo) config; assertEquals("${CONTAINER}", abConfig.getContainer()); assertEquals("myname", abConfig.getAccountName()); assertEquals("${MYKEY}", abConfig.getAccountKey()); assertEquals("30", abConfig.getMaxConnections()); assertEquals(true, abConfig.isEnabled()); }
Source:
private void init() { setTitle(ConstantsManager.getInstance().getConstants().editLogicalNetworkTitle()); setHashName("edit_logical_network"); getName().setEntity(getNetwork().getName()); if (isManagemet()) { getName().setIsChangable(false); } getDescription().setEntity(getNetwork().getDescription()); getIsStpEnabled().setEntity(getNetwork().getStp()); getHasVLanTag().setEntity(getNetwork().getVlanId() != null); getVLanTag().setEntity((getNetwork().getVlanId() == null ? new Integer(0) : getNetwork().getVlanId())); initMtu(); initIsVm(); }

Target:
private void init() { setTitle(ConstantsManager.getInstance().getConstants().editLogicalNetworkTitle()); setHashName("edit_logical_network"); getName().setEntity(getNetwork().getName()); if (isManagemet()) { getName().setIsChangable(false); } getDescription().setEntity(getNetwork().getDescription()); getIsStpEnabled().setEntity(getNetwork().getStp()); getHasVLanTag().setEntity(getNetwork().getVlanId() != null); getVLanTag().setEntity((getNetwork().getVlanId() == null ? Integer.valueOf(0) : getNetwork().getVlanId())); initMtu(); initIsVm(); }
Source:
protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { if(!context.isBooting() && context.getProcessType() == ProcessType.EMBEDDED_SERVER && context.getRunningMode() == RunningMode.ADMIN_ONLY) { context.reloadRequired(); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { context.revertReloadRequired(); } }); } else { context.addStep(ServiceInstallStepHandler.INSTANCE, OperationContext.Stage.RUNTIME); } }

Target:
protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { if(!context.isBooting() && context.getProcessType() == ProcessType.EMBEDDED_SERVER && context.getRunningMode() == RunningMode.ADMIN_ONLY) { context.reloadRequired(); } else { context.addStep(ServiceInstallStepHandler.INSTANCE, OperationContext.Stage.RUNTIME); } }
Source:
public LockableResourcesStruct(RequiredResourcesProperty property, EnvVars env) { required = new ArrayList<>(); LockableResourcesManager resourcesManager = LockableResourcesManager.get(); List<LockableResource> declaredResources = resourcesManager.getDeclaredResources(); for (String name : property.getResources()) { String resourceName = env.expand(name); if (resourceName == null) { continue; } if (resourceName.contains("$")) { boolean isDeclared = false; for (LockableResource r : declaredResources) { if (r.getName().equals(resourceName)) { isDeclared = true; break; } } if (!isDeclared) { continue; } } resourcesManager.createResource(resourceName); LockableResource r = resourcesManager.fromName(resourceName); this.required.add(r); } label = env.expand(property.getLabelName()); if (label == null) label = ""; resourceMatchScript = property.getResourceMatchScript(); serializableResourceMatchScript = new SerializableSecureGroovyScript(resourceMatchScript); requiredVar = property.getResourceNamesVar(); requiredNumber = property.getResourceNumber(); if (requiredNumber != null && requiredNumber.equals("0")) requiredNumber = null; }

Target:
public LockableResourcesStruct(RequiredResourcesProperty property, EnvVars env) { required = new ArrayList<>(); LockableResourcesManager resourcesManager = LockableResourcesManager.get(); for (String name : property.getResources()) { String resourceName = env.expand(name); if (resourceName == null) { continue; } resourcesManager.createResource(resourceName); LockableResource r = resourcesManager.fromName(resourceName); this.required.add(r); } label = env.expand(property.getLabelName()); if (label == null) label = ""; resourceMatchScript = property.getResourceMatchScript(); serializableResourceMatchScript = new SerializableSecureGroovyScript(resourceMatchScript); requiredVar = property.getResourceNamesVar(); requiredNumber = property.getResourceNumber(); if (requiredNumber != null && requiredNumber.equals("0")) requiredNumber = null; }
Source:
private void saveItemsToPreference(List<Item> items) { StringBuilder sb = new StringBuilder(); items.stream().forEach(i->sb.append(i.toPreferenceValue())); getPreferenceStore().setValue(ALLOWED_SERTIFICATES, sb.toString()); }

Target:
private void saveItemsToPreference(List<Item> items) { StringBuilder sb = new StringBuilder(); items.stream().forEach(i->sb.append(i.toPreferenceValue())); getPreferenceStore().setValue(ALLOWED_CERTIFICATES, sb.toString()); }
Source:
public String getType(Uri uri) { int match = sUriMatcher.match(uri); switch (match) { case NOTES_V2: case NOTES: return FlashCardsContract.Note.CONTENT_TYPE; case NOTES_ID: return FlashCardsContract.Note.CONTENT_ITEM_TYPE; case NOTES_ID_CARDS: return FlashCardsContract.Card.CONTENT_TYPE; case NOTES_ID_CARDS_ORD: return FlashCardsContract.Card.CONTENT_ITEM_TYPE; case MODELS: return FlashCardsContract.Model.CONTENT_TYPE; case MODELS_ID: return FlashCardsContract.Model.CONTENT_ITEM_TYPE; case MODELS_ID_EMPTY_CARDS: return FlashCardsContract.Model.CONTENT_TYPE; case MODELS_ID_TEMPLATES: return FlashCardsContract.CardTemplate.CONTENT_TYPE; case MODELS_ID_TEMPLATES_ID: return FlashCardsContract.CardTemplate.CONTENT_ITEM_TYPE; case SCHEDULE: return FlashCardsContract.ReviewInfo.CONTENT_TYPE; case DECKS: return FlashCardsContract.Deck.CONTENT_TYPE; case DECKS_ID: return FlashCardsContract.Deck.CONTENT_TYPE; case DECK_SELECTED: return FlashCardsContract.Deck.CONTENT_TYPE; default: throw new IllegalArgumentException("uri " + uri + " is not supported"); } }

Target:
public String getType(Uri uri) { int match = sUriMatcher.match(uri); switch (match) { case NOTES_V2: case NOTES: return FlashCardsContract.Note.CONTENT_TYPE; case NOTES_ID: return FlashCardsContract.Note.CONTENT_ITEM_TYPE; case NOTES_ID_CARDS: return FlashCardsContract.Card.CONTENT_TYPE; case NOTES_ID_CARDS_ORD: return FlashCardsContract.Card.CONTENT_ITEM_TYPE; case MODELS: return FlashCardsContract.Model.CONTENT_TYPE; case MODELS_ID: return FlashCardsContract.Model.CONTENT_ITEM_TYPE; case MODELS_ID_EMPTY_CARDS: return FlashCardsContract.Card.CONTENT_TYPE; case MODELS_ID_TEMPLATES: return FlashCardsContract.CardTemplate.CONTENT_TYPE; case MODELS_ID_TEMPLATES_ID: return FlashCardsContract.CardTemplate.CONTENT_ITEM_TYPE; case SCHEDULE: return FlashCardsContract.ReviewInfo.CONTENT_TYPE; case DECKS: return FlashCardsContract.Deck.CONTENT_TYPE; case DECKS_ID: return FlashCardsContract.Deck.CONTENT_TYPE; case DECK_SELECTED: return FlashCardsContract.Deck.CONTENT_TYPE; default: throw new IllegalArgumentException("uri " + uri + " is not supported"); } }
Source:
public Document getDocument() { return rs.getQuery().getDatabase().getDocument(documentID); }

Target:
Document getDocument() { return rs.getQuery().getDatabase().getDocument(documentID); }
Source:
public static MultiTableSweepQueueWriter createWriter(TargetedSweepMetrics metrics, KeyValueService kvs, Supplier<Integer> shardsConfig) { return create(metrics, kvs, shardsConfig, new TargetedSweepFollower(ImmutableList.of(), null)); }

Target:
public static MultiTableSweepQueueWriter createWriter(TargetedSweepMetrics metrics, KeyValueService kvs, Supplier<Integer> shardsConfig) { return SweepQueueFactory.create(metrics, kvs, shardsConfig).createWriter(); }
Source:
private Exception copyFromFeatureSource(ImportData data, ImportTask task, DataStoreFormat format, DataStore dataStoreDestination, Transaction transaction, String featureTypeName, String uniquifiedFeatureTypeName, FeatureDataConverter featureDataConverter, VectorTransformChain tx) throws IOException { Exception error = null; ProgressMonitor monitor = task.progress(); try { long startTime = System.currentTimeMillis(); task.clearMessages(); task.setTotalToProcess(format.getFeatureCount(task.getData(), task)); LOGGER.fine("begining import - highlevel api"); FeatureSource fs = format.getFeatureSource(data, task); FeatureCollection fc = fs.getFeatures(); FeatureStore featureStore = (FeatureStore) dataStoreDestination .getFeatureSource(uniquifiedFeatureTypeName); featureStore.setTransaction(transaction); fc = new ImportTransformFeatureCollection(fc, featureDataConverter, featureStore.getSchema(), tx, task, dataStoreDestination); featureStore.addFeatures(fc); } catch (Exception e) { error = e; } if (error != null || monitor.isCanceled()) { try { transaction.rollback(); } catch (Exception e1) { LOGGER.log(Level.WARNING,"Unable to load data into "+ uniquifiedFeatureTypeName+", rolling back data insert:"+e1, e1); } try { dropSchema(dataStoreDestination, featureTypeName); } catch (Exception e1) { LOGGER.log(Level.WARNING, "Error dropping schema in rollback", e1); } } return error; }

Target:
private Throwable copyFromFeatureSource(ImportData data, ImportTask task, DataStoreFormat format, DataStore dataStoreDestination, Transaction transaction, String featureTypeName, String uniquifiedFeatureTypeName, FeatureDataConverter featureDataConverter, VectorTransformChain tx) throws IOException { Throwable error = null; ProgressMonitor monitor = task.progress(); try { long startTime = System.currentTimeMillis(); task.clearMessages(); task.setTotalToProcess(format.getFeatureCount(task.getData(), task)); LOGGER.fine("begining import - highlevel api"); FeatureSource fs = format.getFeatureSource(data, task); FeatureCollection fc = fs.getFeatures(); FeatureStore featureStore = (FeatureStore) dataStoreDestination .getFeatureSource(uniquifiedFeatureTypeName); featureStore.setTransaction(transaction); fc = new ImportTransformFeatureCollection(fc, featureDataConverter, featureStore.getSchema(), tx, task, dataStoreDestination); featureStore.addFeatures(fc); } catch (Throwable e) { error = e; } if (error != null || monitor.isCanceled()) { try { transaction.rollback(); } catch (Exception e1) { LOGGER.log(Level.WARNING,"Unable to load data into "+ uniquifiedFeatureTypeName+", rolling back data insert:"+e1, e1); } try { dropSchema(dataStoreDestination, featureTypeName); } catch (Exception e1) { LOGGER.log(Level.WARNING, "Error dropping schema in rollback", e1); } } return error; }
Source:
@Override public void onSuccess(Void value) { complete(new byte[0] ); }

Target:
@Override public void onSuccess(Void value) { complete(EMPTY); }
Source:
public void addMethods(HaxeMethodBuilder... methodBuilders) { String out = ""; for (HaxeMethodBuilder builder : methodBuilders) { out += "public " + builder.toString() + "\n"; } this.getDocument().addTextAfterElement(getBodyPsi(), out); }

Target:
public void addMethods(HaxeMethodBuilder... methodBuilders) { String out = ""; for (HaxeMethodBuilder builder : methodBuilders) { out += builder.modifiers.toStringCombined() + " " + builder.toString() + "\n"; } this.getDocument().addTextAfterElement(getBodyPsi(), out); }
Source:
public void badgeCountShouldNotIncludeOldNotifications() { NotificationBundleProcessor_ProcessFromGCMIntentService(blankActivity, getBaseNotifBundle(), null); advanceSystemTimeBy(604_801 * 1_000L); SQLiteDatabase readableDb = OneSignalDbHelper.getInstance(blankActivity).getReadableDatabase(); OneSignalPackagePrivateHelper.BadgeCountUpdater.update(readableDb, blankActivity); assertEquals(0, ShadowBadgeCountUpdater.lastCount); }

Target:
public void badgeCountShouldNotIncludeOldNotifications() { NotificationBundleProcessor_ProcessFromGCMIntentService(blankActivity, getBaseNotifBundle(), null); advanceSystemTimeBy(604_801); SQLiteDatabase readableDb = OneSignalDbHelper.getInstance(blankActivity).getReadableDatabase(); OneSignalPackagePrivateHelper.BadgeCountUpdater.update(readableDb, blankActivity); assertEquals(0, ShadowBadgeCountUpdater.lastCount); }
Source:
public ParentBuildAction() { final Executor currentExecutor = Executor.currentExecutor(); if (currentExecutor != null) { parent = (MatrixBuild) currentExecutor.getCurrentExecutable(); } number = parent == null ? null : parent.getNumber(); }

Target:
public ParentBuildAction() { final Executor currentExecutor = Executor.currentExecutor(); if (currentExecutor != null) { Queue.Executable executable = currentExecutor.getCurrentExecutable(); if (executable instanceof MatrixBuild) { parent = (MatrixBuild) executable; } } number = parent == null ? null : parent.getNumber(); }
Source:
private void loadRoutingTable() { Map<String, List<String>> newRoutingTable = new ConcurrentHashMap<>(); Config config = gondola.getConfig(); for(String hostId : config.getHostIds()) { if (hostId.equals(gondola.getHostId())) { continue; } for(String clusterId : config.getClusterIds(hostId)) { InetSocketAddress address = config.getAddressForHost(hostId); List<String> addresses = newRoutingTable.get(clusterId); if (addresses == null) { addresses = new ArrayList<>(); newRoutingTable.put(clusterId, addresses); } Map<String, String> attrs = config.getAttributesForHost(hostId); if (attrs.get(APP_PORT) == null || attrs.get(APP_SCHEME) == null) { throw new RuntimeException( String.format("Attribute '%s|%s' is required in gondola configuration. (gondola.hosts[].%s|%s)", APP_PORT, APP_SCHEME, APP_PORT, APP_SCHEME)); } String appUri = String.format("%s://%s:%s", attrs.get(APP_SCHEME), address.getHostName(), attrs.get(APP_PORT)); addresses.add(appUri); } } routingTable = newRoutingTable; }

Target:
private void loadRoutingTable() { Map<String, List<String>> newRoutingTable = new ConcurrentHashMap<>(); Config config = gondola.getConfig(); for(String hostId : config.getHostIds()) { if (hostId.equals(gondola.getHostId())) { continue; } for(String clusterId : config.getClusterIds(hostId)) { InetSocketAddress address = config.getAddressForHost(hostId); List<String> addresses = newRoutingTable.get(clusterId); if (addresses == null) { addresses = new ArrayList<>(); newRoutingTable.put(clusterId, addresses); } Map<String, String> attrs = config.getAttributesForHost(hostId); if (attrs.get(APP_PORT) == null || attrs.get(APP_SCHEME) == null) { throw new IllegalStateException( String.format("gondola.hosts[%s] is missing either the %s or %s config values", hostId, APP_PORT, APP_SCHEME)); } String appUri = String.format("%s://%s:%s", attrs.get(APP_SCHEME), address.getHostName(), attrs.get(APP_PORT)); addresses.add(appUri); } } routingTable = newRoutingTable; }
Source:
public void run() { RedisQueueMessageDrivenEndpoint.this.listening = true; try { while (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.popMessageAndSend(); } } catch (RedisSystemException e) { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.listening = false; RedisQueueMessageDrivenEndpoint.this.sleepBeforeRecoveryAttempt(); throw e; } else { logger.error(e); } } finally { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.restart(); } else { RedisQueueMessageDrivenEndpoint.this.listening = false; } } }

Target:
public void run() { RedisQueueMessageDrivenEndpoint.this.listening = true; try { while (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.popMessageAndSend(); } } finally { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.restart(); } else { RedisQueueMessageDrivenEndpoint.this.listening = false; } } }
Source:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { if (!containsUserCredentials(request)) { throw new AuthenticationException("Credentials Required"); } else { request.getSession(true).setAttribute(SSOUtils.USER_CREDENTIALS, getUserCredentials(request)); response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI + request.getQueryString()); } } catch (AuthenticationException ex) { response.setHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\""); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } }

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Credentials credentials = getUserCredentials(request); if (credentials == null) { response.setHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\""); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { request.getSession(true).setAttribute(SSOUtils.USER_CREDENTIALS, credentials); response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI); } }
Source:
private void refreshCommitedMemory() { Integer memCommited = _vds.getGuestOverhead(); int vmsCoresCount = 0; for (VM vm : _vmDict.values()) { if (!VMStatus.WaitForLaunch.equals(vm.getStatus())) { memCommited += vm.getVmMemSizeMb(); memCommited += _vds.getGuestOverhead(); vmsCoresCount += vm.getNumOfCpus(); } } if (memCommited == null || !memCommited.equals(_vds.getMemCommited())) { _vds.setMemCommited(memCommited); _saveVdsDynamic = true; } if (_vds.getVmsCoresCount() == null || !_vds.getVmsCoresCount().equals(vmsCoresCount)) { _vds.setVmsCoresCount(vmsCoresCount); _saveVdsDynamic = true; } }

Target:
private void refreshCommitedMemory() { Integer memCommited = _vds.getGuestOverhead(); int vmsCoresCount = 0; for (VM vm : _vmDict.values()) { if (vm.getStatus() != VMStatus.WaitForLaunch) { memCommited += vm.getVmMemSizeMb(); memCommited += _vds.getGuestOverhead(); vmsCoresCount += vm.getNumOfCpus(); } } if (memCommited == null || !memCommited.equals(_vds.getMemCommited())) { _vds.setMemCommited(memCommited); _saveVdsDynamic = true; } if (_vds.getVmsCoresCount() == null || !_vds.getVmsCoresCount().equals(vmsCoresCount)) { _vds.setVmsCoresCount(vmsCoresCount); _saveVdsDynamic = true; } }
Source:
public void testGetConcern() { if(default_stakeholder.getConcern().size()!=2){ fail(); } if(!(default_stakeholder.getConcern().get(0).equals(THIS_IS_THE_BODY_OF_COMMENT1))){ fail(); } if(!(default_stakeholder.getConcern().get(1).equals(THIS_IS_THE_BODY_OF_COMMENT2))){ fail(); } }

Target:
public void testGetConcern() { if(default_stakeholder.getConcern().size()!=2){ fail(MESSAGE_ERROR); } if(!THIS_IS_THE_BODY_OF_COMMENT1.equals((default_stakeholder.getConcern().get(0)))){ fail(MESSAGE_ERROR); } if(!THIS_IS_THE_BODY_OF_COMMENT2.equals((default_stakeholder.getConcern().get(1)))){ fail(MESSAGE_ERROR); } }
Source:
@NonNull @Override public GraphCall<T> enqueue(@NonNull final Callback<T> callback) { synchronized (this) { if (executed) throw new IllegalStateException("Already Executed"); executed = true; } httpCall = httpCall(); httpCall.enqueue(new okhttp3.Callback() { @Override public void onFailure(final Call call, final IOException e) { callback.onFailure(e); } @Override public void onResponse(final Call call, final Response response) throws IOException { try { TopLevelResponse topLevelResponse = parse(response); callback.onResponse(responseConverter.convert(topLevelResponse)); } catch (Exception e) { callback.onFailure(e); } } }); return this; }

Target:
@NonNull @Override public GraphCall<T> enqueue(@NonNull final Callback<T> callback) { synchronized (this) { if (executed) throw new IllegalStateException("Already Executed"); executed = true; } httpCall = httpCall(); httpCall.enqueue(new okhttp3.Callback() { @Override public void onFailure(final Call call, final IOException e) { callback.onFailure(GraphError.networkError(null, e)); } @Override public void onResponse(final Call call, final Response response) throws IOException { try { checkResponse(response); callback.onResponse(parseResponse(response)); } catch (GraphError error) { callback.onFailure(error); } } }); return this; }
Source:
public RequestLogger get() { LoggingRequestLogger logger = new LoggingRequestLogger(mapper, setMDC, setContextMDC); log.info(new Exception("Stack trace"), "Creating %s at", logger); return logger; }

Target:
public RequestLogger get() { LoggingRequestLogger logger = new LoggingRequestLogger(mapper, setMDC, setContextMDC); log.debug(new Exception("Stack trace"), "Creating %s at", logger); return logger; }
Source:
public Properties getHibernateProperties() { Properties properties = super.getHibernateProperties(); properties.setProperty( "hibernate.search.default.directory_provider", "filesystem" ); properties.setProperty( "hibernate.search.default.indexBase", "target/filesystem-default" ); return properties; }

Target:
public Properties getHibernateProperties() { Properties properties = super.getHibernateProperties(); properties.setProperty( "hibernate.search.default.directory_provider", "filesystem" ); properties.setProperty( "hibernate.search.default.indexBase", TestConstants.getIndexDirectory( FileSystemDefaultTestScenario.class ) ); return properties; }
Source:
private String encode() { String value = username + ":" + timestamp + ":" + path; String mac = KEY.mac(value); return mac + Util.toHexString((value.getBytes(StandardCharsets.UTF_8))); }

Target:
private String encode() { String value = username + ":" + timestamp.toEpochMilli() + ":" + path; byte[] valueBytes = value.getBytes(StandardCharsets.UTF_8); byte[] byteValue = ArrayUtils.addAll(KEY.mac(valueBytes), valueBytes); return Base64.getUrlEncoder().encodeToString(byteValue); }
Source:
public Map<Map.Entry<K, V>, Map.Entry<K, V>> apply(Set<Map.Entry<K, V>> request) { CacheDescriptor cacheDescriptor = offHeapCache.cacheDescriptor.get(); if (cacheDescriptor.currentSize().get() >= offHeapCache.maxSize.getAsLong()) { offHeapCache.taggedMetricRegistry.counter(CACHE_NUKE).inc(); offHeapCache.clear(); } cacheDescriptor = offHeapCache.cacheDescriptor.get(); try { Map<K, V> response = offHeapCache.persistentStore.get( cacheDescriptor.storeNamespace(), request.stream().map(Map.Entry::getKey).collect(Collectors.toList())); int sizeIncrease = Sets.difference(request, response.entrySet()).size(); offHeapCache.persistentStore.put( cacheDescriptor.storeNamespace(), ImmutableMap.copyOf(request)); cacheDescriptor.currentSize().addAndGet(sizeIncrease); } catch (SafeIllegalArgumentException exception) { log.warn("Clear called concurrently, writing failed", exception); } finally { offHeapCache.inFlightRequests.clear(); } return KeyedStream.of(request.stream()).collectToMap(); }

Target:
public Map<Map.Entry<K, V>, Void> apply(Set<Map.Entry<K, V>> request) { CacheDescriptor cacheDescriptor = offHeapCache.cacheDescriptor.get(); if (cacheDescriptor.currentSize().get() >= offHeapCache.maxSize.getAsLong()) { offHeapCache.cacheNuke.inc(); offHeapCache.clear(); } cacheDescriptor = offHeapCache.cacheDescriptor.get(); try { List<K> toWrite = request.stream().map(Map.Entry::getKey).collect(Collectors.toList()); Map<K, V> response = offHeapCache.persistentStore.get(cacheDescriptor.storeHandle(), toWrite); int sizeIncrease = Sets.difference(request, response.entrySet()).size(); offHeapCache.persistentStore.put(cacheDescriptor.storeHandle(), ImmutableMap.copyOf(request)); cacheDescriptor.currentSize().addAndGet(sizeIncrease); } catch (SafeIllegalArgumentException exception) { log.warn("Clear called concurrently, writing failed", exception); } return KeyedStream.of(request).map(value -> (Void) null).collectToMap(); }
Source:
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) { if(!BiomeHelper.isBiomeHellish(world.getBiome(pos))) { return 5; } return 0; }

Target:
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) { return 5; }