auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testEnforceValidityErrorsOnly() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), true, false, getAdminConfig()); String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); ingestXmlFromResourceWaitForFailure(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_BAD_REQUEST); configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); }

Target:
public void testEnforceValidityErrorsOnly() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), true, false, getAdminConfig()); try { String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); ingestXmlFromResourceWaitForFailure(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_BAD_REQUEST); } finally { configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); } }
Source:
public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException { checkOpen(); try (TraceScope ignored = tracer.newScope("getSnapshottableDirListing")) { return namenode.getSnapshotListing(snapshotRoot); } catch (RemoteException re) { throw re.unwrapRemoteException(); } }

Target:
public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException { checkOpen(); try (TraceScope ignored = tracer.newScope("getSnapshotListing")) { return namenode.getSnapshotListing(snapshotRoot); } catch (RemoteException re) { throw re.unwrapRemoteException(); } }
Source:
private static void error( HttpResponse response, String body, Map<String, Object> payload) throws APIError { if (payload.containsKey("errors")) { Map<String, Object> entity = (Map<String, Object>) ((ArrayList) payload.get("errors")).get(0); String category_code = (String) entity.get("category_code"); if (InsufficientFunds.CODES.contains(category_code)) throw new InsufficientFunds(response, body, entity); else if (Declined.CODES.contains(category_code)) throw new Declined(response, body, entity); else if (DuplicateAccountEmailAddress.CODES.contains(category_code)) throw new DuplicateAccountEmailAddress(response, body, entity); else if (BankAccountVerificationFailure.CODES.contains(category_code)) throw new BankAccountVerificationFailure(response, body, entity); throw new APIError(response, body, entity); } else { throw new APIError(response, body, payload); } }

Target:
private static void error( HttpResponse response, String body, Map<String, Object> payload) throws APIError { if (!payload.containsKey("errors")) { throw new APIError(response, body, payload); } else { Map<String, Object> entity = (Map<String, Object>) ((ArrayList) payload.get("errors")).get(0); String category_code = (String) entity.get("category_code"); if (InsufficientFunds.CODES.contains(category_code)) throw new InsufficientFunds(response, body, entity); else if (Declined.CODES.contains(category_code)) throw new Declined(response, body, entity); else if (DuplicateAccountEmailAddress.CODES.contains(category_code)) throw new DuplicateAccountEmailAddress(response, body, entity); else if (BankAccountVerificationFailure.CODES.contains(category_code)) throw new BankAccountVerificationFailure(response, body, entity); throw new APIError(response, body, entity); } }
Source:
public void setUp() throws Exception { DataSourceFactory factory = new DataSourceFactory(); factory.setDriverClass(org.h2.Driver.class.getName()); factory.setUrl("jdbc:h2:mem:DbTest-" + System.currentTimeMillis()); factory.setUser("DbTest"); dataSource = (ManagedPooledDataSource) factory.build(new MetricRegistry(), "DbTest"); DatabaseConnection conn = new JdbcConnection(dataSource.getConnection()); Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(conn); liquibase = new CloseableLiquibaseWithClassPathMigrationsFile(dataSource, database, "migrations.xml"); }

Target:
public void setUp() throws Exception { DataSourceFactory factory = new DataSourceFactory(); factory.setDriverClass(org.h2.Driver.class.getName()); factory.setUrl("jdbc:h2:mem:DbTest-" + System.currentTimeMillis()); factory.setUser("DbTest"); dataSource = (ManagedPooledDataSource) factory.build(new MetricRegistry(), "DbTest"); liquibase = new CloseableLiquibaseWithClassPathMigrationsFile(dataSource, "migrations.xml"); }
Source:
public void testDrawSumOfQScores(final File metricsFile, final int altDepth, final double tolerance) throws Exception { final MetricsFile<TheoreticalSensitivityMetrics, Integer> Metrics = new MetricsFile<>(); Metrics.read(new FileReader(metricsFile)); final List<Histogram<Integer>> histograms = Metrics.getAllHistograms(); final Histogram<Integer> qualityHistogram = histograms.get(1); final TheoreticalSensitivity.RouletteWheel qualityRW = new TheoreticalSensitivity.RouletteWheel(TheoreticalSensitivity.trimDistribution(TheoreticalSensitivity.normalizeHistogram(qualityHistogram))); final Random randomNumberGenerator = new Random(TheoreticalSensitivity.RANDOM_SEED); final double averageQuality = qualityHistogram.getMean(); final double standardDeviationQuality = qualityHistogram.getStandardDeviation(); for(int k = 0;k < 1;k++) { int sumOfQualitiesFull = IntStream.range(0, altDepth).map(n -> qualityRW.draw()).sum(); int sumOfQualities = TheoreticalSensitivity.drawSumOfQScores(altDepth, averageQuality, standardDeviationQuality, randomNumberGenerator.nextGaussian()); Assert.assertEquals(sumOfQualitiesFull, sumOfQualities, sumOfQualitiesFull*tolerance); } }

Target:
public void testDrawSumOfQScores(final File metricsFile, final int altDepth, final double tolerance) throws Exception { final MetricsFile<TheoreticalSensitivityMetrics, Integer> metrics = new MetricsFile<>(); try (final FileReader metricsFileReader = new FileReader(metricsFile)) { metrics.read(metricsFileReader); } final List<Histogram<Integer>> histograms = metrics.getAllHistograms(); final Histogram<Integer> qualityHistogram = histograms.get(1); final TheoreticalSensitivity.RouletteWheel qualityRW = new TheoreticalSensitivity.RouletteWheel(TheoreticalSensitivity.trimDistribution(TheoreticalSensitivity.normalizeHistogram(qualityHistogram))); final Random randomNumberGenerator = new Random(51); final double averageQuality = qualityHistogram.getMean(); final double standardDeviationQuality = qualityHistogram.getStandardDeviation(); for(int k = 0;k < 1;k++) { int sumOfQualitiesFull = IntStream.range(0, altDepth).map(n -> qualityRW.draw()).sum(); int sumOfQualities = TheoreticalSensitivity.drawSumOfQScores(altDepth, averageQuality, standardDeviationQuality, randomNumberGenerator.nextGaussian()); Assert.assertEquals(sumOfQualitiesFull, sumOfQualities, sumOfQualitiesFull*tolerance); } }
Source:
private void beforeSlotChangedCraftingGrid(final InventoryCraftResult output, final int index, final ItemStack itemstack) { if (!this.impl$captureInventory) { output.setInventorySlotContents(index, itemstack); return; } final ItemStackSnapshot orig = ItemStackUtil.snapshotOf(output.getStackInSlot(index)); output.setInventorySlotContents(index, itemstack); final ItemStackSnapshot repl = ItemStackUtil.snapshotOf(output.getStackInSlot(index)); final SlotAdapter slot = this.impl$getAdapters().get(index); if (this.impl$capturedCraftPreviewTransaction == null) { this.impl$capturedCraftPreviewTransaction = new SlotTransaction(slot, orig, repl); } else if (this.impl$capturedCraftPreviewTransaction.getSlot().equals(slot) && this.impl$capturedCraftPreviewTransaction.getFinal().equals(orig)) { this.impl$capturedCraftPreviewTransaction = new SlotTransaction(slot, this.impl$capturedCraftPreviewTransaction.getOriginal(), repl); } else { SlotTransaction replace = new SlotTransaction(slot, orig, repl); SpongeImpl.getLogger().warn("Could not merge craft preview transactions - some events may break (original {}, replace {})", this.impl$capturedCraftPreviewTransaction, replace); this.impl$capturedCraftPreviewTransaction = replace; } }

Target:
private void beforeSlotChangedCraftingGrid(final InventoryCraftResult output, final int index, final ItemStack itemstack) { if (!this.impl$captureInventory) { output.setInventorySlotContents(index, itemstack); return; } final ItemStackSnapshot orig = ItemStackUtil.snapshotOf(output.getStackInSlot(index)); output.setInventorySlotContents(index, itemstack); final ItemStackSnapshot repl = ItemStackUtil.snapshotOf(output.getStackInSlot(index)); final SlotAdapter slot = this.impl$getAdapters().get(index); if (this.impl$capturedCraftPreviewTransaction == null) { this.impl$capturedCraftPreviewTransaction = new SlotTransaction(slot, orig, repl); } else if (this.impl$capturedCraftPreviewTransaction.getSlot().equals(slot) && this.impl$capturedCraftPreviewTransaction.getFinal().equals(orig)) { this.impl$capturedCraftPreviewTransaction = new SlotTransaction(slot, this.impl$capturedCraftPreviewTransaction.getOriginal(), repl); } else { final SlotTransaction replace = new SlotTransaction(slot, orig, repl); ContainerMixin.impl$numTransactionErrorsLogged++; final int maxLogs = SpongeImpl.getGlobalConfigAdapter().getConfig().getLogging().logTransactionMergeFailure(); if (maxLogs <= 0 || ContainerMixin.impl$numTransactionErrorsLogged <= maxLogs) { SpongeImpl.getLogger().warn("Could not merge craft preview transactions - some events may break (original {}, replace {})", this.impl$capturedCraftPreviewTransaction, replace); if (ContainerMixin.impl$numTransactionErrorsLogged == maxLogs) { SpongeImpl.getLogger().warn("Further warnings about this will be suppressed. Change transaction-merge-fail in global.conf to " + "show more."); } } this.impl$capturedCraftPreviewTransaction = replace; } }
Source:
public ForgedMethod(String name, Type sourceType, Type targetType, MapperConfiguration mapperConfiguration, ExecutableElement positionHintElement) { String sourceParamName = Strings.decapitalize( sourceType.getName() ); String sourceParamSafeName = Strings.getSaveVariableName( sourceParamName ); this.parameters = Arrays.asList( new Parameter( sourceParamSafeName, sourceType ) ); this.returnType = targetType; this.thrownTypes = new ArrayList<Type>(); this.name = Strings.sanatizeIdentifierName( name ); this.mapperConfiguration = mapperConfiguration; this.positionHintElement = positionHintElement; }

Target:
public ForgedMethod(String name, Type sourceType, Type targetType, MapperConfiguration mapperConfiguration, ExecutableElement positionHintElement) { String sourceParamName = Strings.decapitalize( sourceType.getName() ); String sourceParamSafeName = Strings.getSaveVariableName( sourceParamName ); this.parameters = Arrays.asList( new Parameter( sourceParamSafeName, sourceType ) ); this.returnType = targetType; this.thrownTypes = new ArrayList<Type>(); this.name = Strings.sanitizeIdentifierName( name ); this.mapperConfiguration = mapperConfiguration; this.positionHintElement = positionHintElement; }
Source:
public static Connection getConnection(SnowflakeConnectionProperties properties) throws IOException { try { Driver driver = (Driver) Class.forName(SnowflakeConstants.SNOWFLAKE_DRIVER).newInstance(); DriverManager.registerDriver(driver); return DriverManager .getConnection(properties.getConnectionUrl(), AuthenticationType.OAUTH == properties.authenticationType.getValue() ? properties.getJdbcProperties(DriverManagerUtils::getAccessToken) : properties.getJdbcProperties()); } catch (Exception e) { if (e.getMessage().contains("HTTP status=403")) { throw new IllegalArgumentException(e.getMessage()); } else { throw new IOException(e); } } }

Target:
public static Connection getConnection(SnowflakeConnectionProperties properties) throws IOException { try { Driver driver = (Driver) Class.forName(SnowflakeConstants.SNOWFLAKE_DRIVER).newInstance(); DriverManager.registerDriver(driver); return DriverManager .getConnection(properties.getConnectionUrl(), AuthenticationType.OAUTH == properties.authenticationType.getValue() ? properties.getJdbcProperties(OauthTokenUtils.getToken(properties.getOauthProperties())) : properties.getJdbcProperties()); } catch (Exception e) { if (e instanceof IllegalArgumentException) { throw IllegalArgumentException.class.cast(e); } else if(e.getMessage().contains("HTTP status=403")) { throw new IllegalArgumentException(e.getMessage(), e); } else { throw new IOException(e); } } }
Source:
public void testHelp() throws Exception { assertArrayEquals(new String[] { "", "jgit ls-files [-- path ...] [--help (-h)]", "", " --help (-h) : display this help text (default: true)", "", "", "" }, execute("git ls-files -h")); }

Target:
public void testHelp() throws Exception { String[] result = execute("git ls-files -h"); assertTrue(result[1].startsWith("jgit ls-files")); }
Source:
private void initArticleHeaderView() { pageHeaderView.addOnLayoutChangeListener((View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) -> setWebViewPaddingTop()); pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { if (getPage() != null && isLeadImageEnabled()) { String imageName = getPage().getPageProperties().getLeadImageName(); String imageUrl = getPage().getPageProperties().getLeadImageUrl(); if (imageName != null && imageUrl != null) { String filename = "File:" + imageName; WikiSite wiki = getTitle().getWikiSite(); getActivity().startActivityForResult(GalleryActivity.newIntent(getActivity(), parentFragment.getTitleOriginal(), filename, UriUtil.resolveProtocolRelativeUrl(imageUrl), wiki, GalleryFunnel.SOURCE_LEAD_IMAGE), Constants.ACTIVITY_REQUEST_GALLERY); } } } @Override public void onArticleCTAClicked() { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), isTranslation ? captionTargetPageTitle : captionSourcePageTitle, null, sourceSummary, targetSummary, isTranslation ? SUGGESTED_EDITS_TRANSLATE_CAPTION : SUGGESTED_EDITS_ADD_CAPTION), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } }); }

Target:
private void initArticleHeaderView() { pageHeaderView.addOnLayoutChangeListener((View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) -> setWebViewPaddingTop()); pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { if (getPage() != null && isLeadImageEnabled()) { String imageName = getPage().getPageProperties().getLeadImageName(); String imageUrl = getPage().getPageProperties().getLeadImageUrl(); if (imageName != null && imageUrl != null) { String filename = "File:" + imageName; WikiSite wiki = getTitle().getWikiSite(); getActivity().startActivityForResult(GalleryActivity.newIntent(getActivity(), parentFragment.getTitleOriginal(), filename, UriUtil.resolveProtocolRelativeUrl(imageUrl), wiki, GalleryFunnel.SOURCE_LEAD_IMAGE), Constants.ACTIVITY_REQUEST_GALLERY); } } } @Override public void onCallToActionClicked() { if (isTranslation ? (targetSummary != null && sourceSummary != null) : sourceSummary != null) { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), isTranslation ? targetSummary.getPageTitle() : sourceSummary.getPageTitle(), null, sourceSummary, targetSummary, isTranslation ? SUGGESTED_EDITS_TRANSLATE_CAPTION : SUGGESTED_EDITS_ADD_CAPTION), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } } }); }
Source:
public void storeSettings() { int i = 0; while (i < formatterListProperty.getValue().size()) { if (formatterListProperty.getValue().get(i).getName().isEmpty()) { formatterListProperty.getValue().remove(i); } else { i++; } } List<String> names = new ArrayList<>(formatterListProperty.size()); List<String> formats = new ArrayList<>(formatterListProperty.size()); for (NameFormatterItemModel formatter : formatterListProperty) { names.add(formatter.getName()); formats.add(formatter.getFormat()); } preferences.putStringList(JabRefPreferences.NAME_FORMATER_KEY, names); preferences.putStringList(JabRefPreferences.NAME_FORMATTER_VALUE, formats); }

Target:
public void storeSettings() { formatterListProperty.removeIf(formatter -> formatter.getName().isEmpty()); List<String> names = new ArrayList<>(formatterListProperty.size()); List<String> formats = new ArrayList<>(formatterListProperty.size()); for (NameFormatterItemModel formatterListItem : formatterListProperty) { names.add(formatterListItem.getName()); formats.add(formatterListItem.getFormat()); } preferences.putStringList(JabRefPreferences.NAME_FORMATER_KEY, names); preferences.putStringList(JabRefPreferences.NAME_FORMATTER_VALUE, formats); }
Source:
public String getFromGetter() { if(!fromGetter.startsWith(PREFIX)) { return PREFIX + fromGetter; } return fromGetter; }

Target:
public String getFromGetter() { return actuallyFromGetter; }
Source:
public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setDeserializerModifier(new BeanDeserializerModifier() { @Override public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) { if (BeanDeserializer.class.isAssignableFrom(deserializer.getClass())) { return new FlatteningDeserializer(beanDesc.getBeanClass(), deserializer, mapper); } else { return deserializer; } } }); return module; }

Target:
public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setDeserializerModifier(new BeanDeserializerModifier() { @Override public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) { if (beanDesc.getBeanClass().getAnnotation(JsonFlatten.class) != null) { return new FlatteningDeserializer(beanDesc.getBeanClass(), deserializer, mapper); } else { return deserializer; } } }); return module; }
Source:
private Object setPropertyViewLabelProvider(SWTBotView propertiesView) { Object oldLabelProvider; IPage currentPage = ((org.eclipse.ui.views.properties.PropertySheet) propertiesView.getReference().getView(false)).getCurrentPage(); Option<Object> valueOption = ReflectionHelper.getFieldValueWithoutException(currentPage, "registry"); assertTrue(valueOption.get() instanceof TabbedPropertyRegistry); TabbedPropertyRegistry tabbedPropertyRegistry = (TabbedPropertyRegistry) valueOption.get(); String contributorId = (String) ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "contributorId").get(); oldLabelProvider = ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider").get(); Object newLabelProvider = null; if (DiagramUIPlugin.ID.equals(contributorId)) { newLabelProvider = new SiriusSheetLabelProvider(); } else if ("org.eclipse.sirius.table.ui.EditorID".equals(contributorId) || DTreeEditor.ID.equals(contributorId)) { newLabelProvider = new DTableLabelProvider(); } if (newLabelProvider != null) { ReflectionHelper.setFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider", newLabelProvider); } return oldLabelProvider; }

Target:
private Object setPropertyViewLabelProvider(SWTBotView propertiesView) { Object oldLabelProvider = null; if (Platform.getBundle("org.eclipse.emf.eef.runtime") != null) { IPage currentPage = ((org.eclipse.ui.views.properties.PropertySheet) propertiesView.getReference().getView(false)).getCurrentPage(); Option<Object> valueOption = ReflectionHelper.getFieldValueWithoutException(currentPage, "registry"); assertTrue(valueOption.get() instanceof TabbedPropertyRegistry); TabbedPropertyRegistry tabbedPropertyRegistry = (TabbedPropertyRegistry) valueOption.get(); String contributorId = (String) ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "contributorId").get(); oldLabelProvider = ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider").get(); Object newLabelProvider = null; if (DiagramUIPlugin.ID.equals(contributorId)) { newLabelProvider = new SiriusSheetLabelProvider(); } else if ("org.eclipse.sirius.table.ui.EditorID".equals(contributorId) || DTreeEditor.ID.equals(contributorId)) { newLabelProvider = new DTableLabelProvider(); } if (newLabelProvider != null) { ReflectionHelper.setFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider", newLabelProvider); } } return oldLabelProvider; }
Source:
public void testOnCheckAllAndOnClickCheckbox() { this.solo.clickOnCheckBox(0); this.solo.clickOnCheckBox(1); this.inst.waitForIdleSync(); CheckBox selectAll = (CheckBox) this.solo.getCurrentActivity().findViewById(R.id.select_all); Assert.assertFalse(selectAll.isChecked()); }

Target:
public void testOnCheckAllAndOnClickCheckbox() { this.solo.clickOnCheckBox(SELECT_ALL); this.solo.clickOnCheckBox(1); this.inst.waitForIdleSync(); CheckBox selectAll = (CheckBox) this.solo.getCurrentActivity().findViewById(R.id.select_all); Assert.assertFalse(selectAll.isChecked()); }
Source:
public void passesValid() throws IOException { MatcherAssert.assertThat( new String( new CcStrict(new CcPlain()).encode( new Identity.Simple("urn:test:1") ) ), Matchers.equalTo("urn%3Atest%3A1") ); MatcherAssert.assertThat( new String( new CcStrict(new CcPlain()).encode( new Identity.Simple("urn:test:1:1") ) ), Matchers.equalTo("urn%3Atest%3A1%3A1") ); }

Target:
public void passesValid() throws IOException { MatcherAssert.assertThat( new String( new CcStrict(new CcPlain()).encode( new Identity.Simple("urn:test:1") ) ), Matchers.equalTo("urn%3Atest%3A1") ); MatcherAssert.assertThat( new String( new CcStrict(new CcPlain()).encode( new Identity.Simple("urn:test-domain-org:valid:1") ) ), Matchers.equalTo("urn%3Atest-domain-org%3Avalid%3A1") ); }
Source:
private boolean hasSelectedSingleNoteId() { if (checkedCardCount() == 0) { return true; } if (checkedCardCount() > 50) { return false; } Integer[] checkedPositions = mCheckedCardPositions.toArray(new Integer[0]); String firstId = mCards.get(checkedPositions[0]).get(NOTE); for (Integer position : checkedPositions) { String noteId = mCards.get(position).get(NOTE); if (noteId != firstId) { return false; } } return true; }

Target:
private boolean hasSelectedSingleNoteId() { int count = checkedCardCount(); if (count == 0 || count > 50) { return false; } Integer[] checkedPositions = mCheckedCardPositions.toArray(new Integer[0]); String firstId = mCards.get(checkedPositions[0]).get(NOTE); try { for (Integer position : checkedPositions) { String noteId = mCards.get(position).get(NOTE); if (noteId != firstId) { return false; } } } catch (IndexOutOfBoundsException e) { Timber.w(e, "concurrent modification of mCards array - assume more than one note selected"); return false; } return true; }
Source:
public void testGetAllInterfacesForVdsWithPermissionsForUnpriviligedUser() { List<VdsNetworkInterface> result = dao.getAllInterfacesForVds(VDS_ID, UNPRIVILEGED_USER_ID, true); assertNotNull(result); assertTrue(result.size() == 0); }

Target:
public void testGetAllInterfacesForVdsWithPermissionsForUnpriviligedUser() { List<VdsNetworkInterface> result = dao.getAllInterfacesForVds(VDS_ID, UNPRIVILEGED_USER_ID, true); assertNotNull(result); assertTrue(result.isEmpty()); }
Source:
public SeekableByteChannel open( final StorageResourceId resourceId, GoogleCloudStorageReadOptions readOptions) throws IOException { logger.atFine().log("open(%s, %s)", resourceId, readOptions); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); GoogleCloudStorageItemInfo info; if (readOptions.getFastFailOnNotFound()) { info = getItemInfo(resourceId); if (!info.exists()) { throw GoogleCloudStorageExceptions.getFileNotFoundException( resourceId.getBucketName(), resourceId.getObjectName()); } if (readOptions.getFastFailOnGzipEncoding() && (GZIP_ENCODING.equals(info.getContentEncoding()) || GZIP_TYPE.equals(info.getContentType()))) { throw new IOException("Gzip encoding is deprecated"); } } else { info = null; } return new GoogleCloudStorageReadChannel( gcs, resourceId.getBucketName(), resourceId.getObjectName(), errorExtractor, clientRequestHelper, readOptions) { @Override @Nullable protected GoogleCloudStorageItemInfo getInitialMetadata() { return info; } @Override protected Storage.Objects.Get createRequest() throws IOException { return configureRequest(super.createRequest(), resourceId.getBucketName()); } }; }

Target:
public SeekableByteChannel open( final StorageResourceId resourceId, GoogleCloudStorageReadOptions readOptions) throws IOException { logger.atFine().log("open(%s, %s)", resourceId, readOptions); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); GoogleCloudStorageItemInfo info; if (readOptions.getFastFailOnNotFound()) { info = getItemInfo(resourceId); if (!info.exists()) { throw GoogleCloudStorageExceptions.getFileNotFoundException( resourceId.getBucketName(), resourceId.getObjectName()); } } else { info = null; } return new GoogleCloudStorageReadChannel( gcs, resourceId.getBucketName(), resourceId.getObjectName(), errorExtractor, clientRequestHelper, readOptions) { @Override @Nullable protected GoogleCloudStorageItemInfo getInitialMetadata() { return info; } @Override protected Storage.Objects.Get createRequest() throws IOException { return configureRequest(super.createRequest(), resourceId.getBucketName()); } }; }
Source:
private boolean matches(Offer offer, Request request) { double cpus = -1; double mem = -1; for (Resource resource : offer.getResourcesList()) { if (resource.getName().equals("cpus")) { if (resource.getType().equals(Value.Type.SCALAR)) { cpus = resource.getScalar().getValue(); } else { LOGGER.severe("Cpus resource was not a scalar: " + resource.getType().toString()); } } else if (resource.getName().equals("mem")) { if (resource.getType().equals(Value.Type.SCALAR)) { mem = resource.getScalar().getValue(); } else { LOGGER.severe("Mem resource was not a scalar: " + resource.getType().toString()); } } else if (resource.getName().equals("disk")) { LOGGER.warning("Ignoring disk resources from offer"); } else if (resource.getName().equals("ports")) { LOGGER.info("Ignoring ports resources from offer"); } else { LOGGER.warning("Ignoring unknown resource type: " + resource.getName()); } } if (cpus < 0) LOGGER.severe("No cpus resource present"); if (mem < 0) LOGGER.severe("No mem resource present"); double requestedCpus = request.request.cpus; double requestedMem = (1 + JVM_MEM_OVERHEAD_FACTOR) * request.request.mem; if (requestedCpus <= cpus && requestedMem <= mem && slaveAttributesMatch(offer)) { return true; } else { LOGGER.info( "Offer not sufficient for slave request:\n" + offer.getResourcesList().toString() + "\nRequested for Jenkins slave:\n" + " cpus: " + requestedCpus + "\n" + " mem: " + requestedMem); return false; } }

Target:
private boolean matches(Offer offer, Request request) { double cpus = -1; double mem = -1; for (Resource resource : offer.getResourcesList()) { if (resource.getName().equals("cpus")) { if (resource.getType().equals(Value.Type.SCALAR)) { cpus = resource.getScalar().getValue(); } else { LOGGER.severe("Cpus resource was not a scalar: " + resource.getType().toString()); } } else if (resource.getName().equals("mem")) { if (resource.getType().equals(Value.Type.SCALAR)) { mem = resource.getScalar().getValue(); } else { LOGGER.severe("Mem resource was not a scalar: " + resource.getType().toString()); } } else if (resource.getName().equals("disk")) { LOGGER.warning("Ignoring disk resources from offer"); } else if (resource.getName().equals("ports")) { LOGGER.info("Ignoring ports resources from offer"); } else { LOGGER.warning("Ignoring unknown resource type: " + resource.getName()); } } if (cpus < 0) LOGGER.severe("No cpus resource present"); if (mem < 0) LOGGER.severe("No mem resource present"); double requestedCpus = request.request.cpus; double requestedMem = (1 + JVM_MEM_OVERHEAD_FACTOR) * request.request.mem; if (requestedCpus <= cpus && requestedMem <= mem && slaveAttributesMatch(offer)) { return true; } else { LOGGER.info( "Offer not sufficient for slave request:\n" + offer.getResourcesList().toString() + "\n" + offer.getAttributesList().toString() + "\nRequested for Jenkins slave:\n" + " cpus: " + requestedCpus + "\n" + " mem: " + requestedMem + "\n" + " attributes: " + getMesosCloud().getSlaveAttributes().toString()); return false; } }
Source:
private void applyForEachAddress(BiConsumer<Long, ILogData> logDataProcessor) { summonNecromancer(); nextRead = logHead; while (nextRead <= logTail) { try { final long lower = nextRead; final long upper = Math.min(lower + batchReadSize - 1, logTail); nextRead = upper + 1; Map<Long, ILogData> range = runtime.getAddressSpaceView().nonCacheFetchAll(ContiguousSet.create( Range.closed(lower, upper), DiscreteDomain.longs()), true); for (Map.Entry<Long, ILogData> entry : range.entrySet()) { long address = entry.getKey(); ILogData logData = entry.getValue(); if (address != addressProcessed + 1) { throw new IllegalStateException("We missed an entry. It can lead to correctness issues."); } addressProcessed++; if (logData.getType() == DataType.TRIMMED) { throw new IllegalStateException("Unexpected TRIMMED data"); } if (address % STATUS_UPDATE_PACE == 0) { log.info("applyForEachAddress: read up to {}", address); } } invokeNecromancer(range, logDataProcessor); } catch (TrimmedException ex) { log.warn("Error loading data", ex); handleRetry(); } } killNecromancer(); }

Target:
private void applyForEachAddress(BiConsumer<Long, ILogData> logDataProcessor) { summonNecromancer(); nextRead = logHead; while (nextRead <= logTail) { try { final long lower = nextRead; final long upper = Math.min(lower + batchReadSize - 1, logTail); nextRead = upper + 1; ContiguousSet<Long> addresses = ContiguousSet.create( Range.closed(lower, upper), DiscreteDomain.longs()); Map<Long, ILogData> range = runtime.getAddressSpaceView().nonCacheFetchAll(addresses, true); for (Map.Entry<Long, ILogData> entry : range.entrySet()) { long address = entry.getKey(); ILogData logData = entry.getValue(); if (address != addressProcessed + 1) { throw new IllegalStateException("We missed an entry. It can lead to correctness issues."); } addressProcessed++; if (logData.getType() == DataType.TRIMMED) { throw new IllegalStateException("Unexpected TRIMMED data"); } if (address % STATUS_UPDATE_PACE == 0) { log.info("applyForEachAddress: read up to {}", address); } } invokeNecromancer(range, logDataProcessor); } catch (TrimmedException ex) { log.warn("Error loading data", ex); handleRetry(); } } killNecromancer(); }
Source:
private Folder getInboxFolder() throws MessagingException { final Folder inbox = store.getFolder("inbox"); inbox.open(Folder.READ_WRITE); return inbox; }

Target:
private Folder getInboxFolder() throws MessagingException { Folder inbox = store.getFolder("inbox"); inbox.open(Folder.READ_ONLY); return inbox; }
Source:
public KieServerImpl(KieServerStateRepository stateRepository) { this.repository = stateRepository; String modeParam = System.getProperty(KieServerConstants.KIE_SERVER_MODE, KieServerMode.DEVELOPMENT.toString()); try { mode = KieServerMode.valueOf(modeParam.toUpperCase()); } catch (Exception ex) { mode = KieServerMode.DEVELOPMENT; } }

Target:
public KieServerImpl(KieServerStateRepository stateRepository) { this.repository = stateRepository; String modeParam = System.getProperty(KieServerConstants.KIE_SERVER_MODE, KieServerMode.DEVELOPMENT.toString()); try { mode = KieServerMode.valueOf(modeParam.toUpperCase()); logger.info("Starting server in '" + mode.name() + "' mode."); } catch (Exception ex) { mode = KieServerMode.DEVELOPMENT; logger.warn("Unable to parse value of " + KieServerConstants.KIE_SERVER_MODE + " = " + modeParam + "; supported values are 'REGULAR' or 'DEVELOPMENT'. Falling back to 'DEVELOPMENT' mode."); } }
Source:
public void writeTo(ByteBuf buf) { buf.writeLong(intermediateDataSetID.getLowerPart()); buf.writeLong(intermediateDataSetID.getUpperPart()); buf.writeInt(partitionNum); }

Target:
public void writeTo(ByteBuf buf) { intermediateDataSetID.writeTo(buf); buf.writeInt(partitionNum); }
Source:
public SelectionContext<VariableMap> expandTemplate(VariableMap context) { ResourceGroupId id = null; for (ResourceGroupNameTemplate segment : segments) { String expanded = segment.expandTemplate(context); if (id == null) { id = new ResourceGroupId(expanded); } else { id = new ResourceGroupId(id, expanded); } } OptionalInt first = IntStream.range(0, segments.size()) .filter(i -> segments.get(i).hasVariables()) .findFirst(); return new SelectionContext<>(id, context, createResourceGroupSelectionContext(first)); }

Target:
public ResourceGroupId expandTemplate(VariableMap context) { ResourceGroupId id = null; for (ResourceGroupNameTemplate segment : segments) { String expanded = segment.expandTemplate(context); if (id == null) { id = new ResourceGroupId(expanded); } else { id = new ResourceGroupId(id, expanded); } } return id; }
Source:
public void testOnJobRenamed() throws Exception { FreeStyleProject job = j.createFreeStyleProject("MyJob"); PatchsetCreated event = Setup.createManualPatchsetCreated(); GerritTrigger trigger = spy(new GerritTrigger( null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, true, true, false, false, "", "", "", "", "", "", "", null, null, null, null, false, false, "", null)); doReturn(new GerritTrigger.DescriptorImpl()).when(trigger, "getDescriptor"); job.addTrigger(trigger); trigger.start(job, true); when(trigger.isInteresting(event)).thenReturn(true); job.renameTo("MyJobRenamed"); GerritItemListener listener = new GerritItemListener(); listener.onLocationChanged(job, "MyJob", "MyJobRenamed"); PluginImpl.getInstance().getHandler().notifyListeners(event); Thread.sleep(100); Assert.assertNotNull(job.getLastBuild()); }

Target:
public void testOnJobRenamed() throws Exception { FreeStyleProject job = j.createFreeStyleProject("MyJob"); GerritHandler handler = PluginImpl.getInstance().getHandler(); PatchsetCreated event = Setup.createManualPatchsetCreated(); GerritTrigger trigger = spy(new GerritTrigger( null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, true, true, false, false, "", "", "", "", "", "", "", null, null, null, null, false, false, "", null)); doReturn(new GerritTrigger.DescriptorImpl()).when(trigger, "getDescriptor"); job.addTrigger(trigger); trigger.start(job, true); int before = handler.getEventListenersCount(); when(trigger.isInteresting(event)).thenReturn(true); job.renameTo("MyJobRenamed"); assertEquals("We leak some listeners", before, handler.getEventListenersCount()); handler.notifyListeners(event); TestUtils.waitForBuilds(job, 1); assertNotNull(job.getLastBuild()); }
Source:
public void scheduleMessageForRetry(ChargeCaptureMessage message) throws QueueException { sqsQueueService.deferMessage(this.captureQueueUrl, message.getReceiptHandle()); }

Target:
public void scheduleMessageForRetry(ChargeCaptureMessage message) throws QueueException { int captureMessageDeferTimeout = 3600; sqsQueueService.deferMessage(this.captureQueueUrl, message.getReceiptHandle(), captureMessageDeferTimeout); }
Source:
public void testInEnumBlockInLiteralNew() { final DetailAST ast = new DetailAST(); ast.setType(TokenTypes.LITERAL_NEW); final DetailAST ast2 = new DetailAST(); ast2.setType(TokenTypes.IDENT); ast.addChild(ast2); Assert.assertFalse(ScopeUtils.isInEnumBlock(ast2)); }

Target:
public void testInEnumBlockInLiteralNew() { assertFalse(ScopeUtils.isInEnumBlock( getNode(TokenTypes.LITERAL_NEW, TokenTypes.IDENT))); }
Source:
public ShapedCraftingRecipe.Builder group(@Nullable String name) { this.groupName = name == null ? "" : name; return this; }

Target:
public EndStep group(@Nullable String name) { this.groupName = Strings.nullToEmpty(name); return this; }
Source:
public Map<String,Integer> listLanguages() throws IOException { return root.retrieve().to(getApiTailUrl("languages"), HashMap.class); }

Target:
public Map<String,Long> listLanguages() throws IOException { return root.retrieve().to(getApiTailUrl("languages"), HashMap.class); }
Source:
public EnumSet<NeededData> getNeededData() { loadRules(); EnumSet<NeededData> needed = EnumSet.noneOf(NeededData.class); for (List<Predicate<ChangeData>> list : rules.values()) { for (Predicate<ChangeData> p : list) { if (p instanceof Prefetchable) { needed.addAll(((Prefetchable) p).getNeededData()); } } } return needed; }

Target:
public EnumSet<NeededData> getNeededData() { Map<NameKey, List<Predicate<ChangeData>>> rules = getRules(); if (rules.isEmpty()) { return EnumSet.noneOf(NeededData.class); } EnumSet<NeededData> needed = EnumSet.of(NeededData.CHANGE); for (List<Predicate<ChangeData>> list : rules.values()) { for (Predicate<ChangeData> p : list) { if (p instanceof Prefetchable) { needed.addAll(((Prefetchable) p).getNeededData()); } } } return needed; }
Source:
public Response addCommentToAPI(String apiId, CommentDTO body, MessageContext messageContext) { String username = RestApiUtil.getLoggedInUsername(); String requestedTenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); try { APIConsumer apiConsumer = RestApiUtil.getLoggedInUserConsumer(); ApiTypeWrapper apiTypeWrapper = apiConsumer.getAPIorAPIProductByUUID(apiId, requestedTenantDomain); Comment comment = CommentMappingUtil.fromDTOToComment(body, username, apiId); String createdCommentId = apiConsumer.addComment(apiTypeWrapper, comment, username); Comment createdComment = apiConsumer.getComment(apiTypeWrapper, createdCommentId); CommentDTO commentDTO = CommentMappingUtil.fromCommentToDTO(createdComment); String uriString = RestApiConstants.RESOURCE_PATH_APIS + "/" + apiId + RestApiConstants.RESOURCE_PATH_COMMENTS + "/" + createdCommentId; URI uri = new URI(uriString); return Response.created(uri).entity(commentDTO).build(); } catch (APIManagementException e) { if (RestApiUtil.isDueToResourceNotFound(e) || RestApiUtil.isDueToAuthorizationFailure(e)) { RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_API, apiId, e, log); } else { RestApiUtil.handleInternalServerError("Failed to add comment to the API " + apiId, e, log); } } catch (URISyntaxException e) { String errorMessage = "Error while retrieving comment content location for API " + apiId; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }

Target:
public Response addCommentToAPI(String apiId, CommentDTO body, MessageContext messageContext) { String username = RestApiUtil.getLoggedInUsername(); String requestedTenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); try { APIConsumer apiConsumer = RestApiUtil.getLoggedInUserConsumer(); ApiTypeWrapper apiTypeWrapper = apiConsumer.getAPIorAPIProductByUUID(apiId, requestedTenantDomain); Identifier identifier; if (apiTypeWrapper.isAPIProduct()) { identifier = apiTypeWrapper.getApiProduct().getId(); } else { identifier = apiTypeWrapper.getApi().getId(); } Comment comment = CommentMappingUtil.fromDTOToComment(body, username, apiId); String createdCommentId = apiConsumer.addComment(identifier, comment, username); Comment createdComment = apiConsumer.getComment(identifier, createdCommentId); CommentDTO commentDTO = CommentMappingUtil.fromCommentToDTO(createdComment); String uriString = RestApiConstants.RESOURCE_PATH_APIS + "/" + apiId + RestApiConstants.RESOURCE_PATH_COMMENTS + "/" + createdCommentId; URI uri = new URI(uriString); return Response.created(uri).entity(commentDTO).build(); } catch (APIManagementException e) { if (RestApiUtil.isDueToResourceNotFound(e) || RestApiUtil.isDueToAuthorizationFailure(e)) { RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_API, apiId, e, log); } else { RestApiUtil.handleInternalServerError("Failed to add comment to the API " + apiId, e, log); } } catch (URISyntaxException e) { String errorMessage = "Error while retrieving comment content location for API " + apiId; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }
Source:
private String validateAndNormalizeAvroSchemaUrl(String url, HdfsContext context) { try { new URL(url).openStream().close(); return url; } catch (MalformedURLException e) { if (new File(url).exists()) { url = "file:/ return url; } else { try { if (!hdfsEnvironment.getFileSystem(context, new Path(url)).exists(new Path(url))) { throw new PrestoException(INVALID_TABLE_PROPERTY, "Cannot locate AVRO schema file " + url); } return url; } catch (IOException ex) { throw new PrestoException(INVALID_TABLE_PROPERTY, "AVRO schema file is not a valid file system URI", ex); } } } catch (IOException e) { throw new PrestoException(INVALID_TABLE_PROPERTY, "Cannot open AVRO schema file " + url, e); } }

Target:
private String validateAndNormalizeAvroSchemaUrl(String url, HdfsContext context) { try { new URL(url).openStream().close(); return url; } catch (MalformedURLException e) { if (new File(url).exists()) { return new File(url).toURI().toString(); } try { if (!hdfsEnvironment.getFileSystem(context, new Path(url)).exists(new Path(url))) { throw new PrestoException(INVALID_TABLE_PROPERTY, "Cannot locate Avro schema file: " + url); } return url; } catch (IOException ex) { throw new PrestoException(INVALID_TABLE_PROPERTY, "Avro schema file is not a valid file system URI: " + url, ex); } } catch (IOException e) { throw new PrestoException(INVALID_TABLE_PROPERTY, "Cannot open Avro schema file: " + url, e); } }
Source:
public void testExcludedCipher() throws Exception { String keyStorePath = new File(getResource("test.keystore").toURI()).getAbsolutePath(); String keyStorePassword = "airlift"; HttpServerConfig config = new HttpServerConfig() .setHttpsEnabled(true) .setHttpsPort(0) .setKeystorePath(keyStorePath) .setKeystorePassword(keyStorePassword) .setHttpsExcludedCipherSuites("TLS_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"); NodeInfo nodeInfo = new NodeInfo("test"); HttpServerInfo httpServerInfo = new HttpServerInfo(config, nodeInfo); HttpServer server = createServer(nodeInfo, httpServerInfo, config); try { server.start(); URI httpsUri = httpServerInfo.getHttpsUri(); HttpClient httpClient = createClient(new String[] {}, new String[] {}, keyStorePath, keyStorePassword); httpClient.GET(httpsUri); httpClient = createClient(new String[] {"TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"}, new String[] {}, keyStorePath, keyStorePassword); try { httpClient.GET(httpsUri); Assert.fail("SSL handshake should fail because client included only certificates the server excluded"); } catch (ExecutionException e) { } } finally { server.stop(); } }

Target:
public void testExcludedCipher() throws Exception { HttpServerConfig config = new HttpServerConfig() .setHttpsEnabled(true) .setHttpsPort(0) .setKeystorePath(KEY_STORE_PATH) .setKeystorePassword(KEY_STORE_PASSWORD) .setHttpsExcludedCipherSuites(CIPHER_1 + "," + CIPHER_2); NodeInfo nodeInfo = new NodeInfo("test"); HttpServerInfo httpServerInfo = new HttpServerInfo(config, nodeInfo); HttpServer server = createServer(nodeInfo, httpServerInfo, config); try { server.start(); URI httpsUri = httpServerInfo.getHttpsUri(); HttpClient httpClient = createClientIncludeCiphers(); httpClient.GET(httpsUri); httpClient = createClientIncludeCiphers(CIPHER_1, CIPHER_2); try { httpClient.GET(httpsUri); Assert.fail("SSL handshake should fail because client included only ciphers the server excluded"); } catch (ExecutionException e) { } } finally { server.stop(); } }
Source:
public synchronized void noMoreDrivers() { if (closed) { return; } if (encounteredDriverGroups.size() != closedDriverGroups.size()) { Sets.SetView<DriverLifeCycle> unclosedDriverGroups = Sets.difference(encounteredDriverGroups, closedDriverGroups); for (DriverLifeCycle driverGroup : unclosedDriverGroups) { noMoreDrivers(driverGroup); } verify(encounteredDriverGroups.size() == closedDriverGroups.size()); } closed = true; for (OperatorFactory operatorFactory : operatorFactories) { operatorFactory.noMoreOperators(); } }

Target:
public synchronized void noMoreDrivers() { if (closed) { return; } if (encounteredLifespans.size() != closedLifespans.size()) { Sets.difference(encounteredLifespans, closedLifespans).forEach(this::noMoreDrivers); verify(encounteredLifespans.size() == closedLifespans.size()); } closed = true; for (OperatorFactory operatorFactory : operatorFactories) { operatorFactory.noMoreOperators(); } }
Source:
public void testCompareDifferentNames() throws Exception { final SAMRecord a = new SAMRecord(null); a.setReadName("A"); final SAMRecord b = new SAMRecord(null); b.setReadName("B"); Assert.assertTrue(COMPARATOR.compare(a, b) > 0); Assert.assertTrue(COMPARATOR.compare(b, a) < 0); }

Target:
public void testCompareDifferentNames() throws Exception { final SAMRecord a = new SAMRecord(null); a.setReadName("A"); final SAMRecord b = new SAMRecord(null); b.setReadName("B"); Assert.assertTrue(COMPARATOR.compare(a, b) != 0); Assert.assertTrue(COMPARATOR.compare(b, a) != 0); }
Source:
private WebDriver createDriver() { CreateDriverCommand.Result result = createDriverCommand.createDriver(config, factory, userProvidedProxy, listeners); long threadId = currentThread().getId(); threadWebDriver.put(threadId, result.webDriver); if (result.selenideProxyServer != null) { threadProxyServer.put(threadId, result.selenideProxyServer); } if (config.holdBrowserOpen()) { log.info("Hold browser and proxy open: -> {}, {}", threadId, result.webDriver, result.selenideProxyServer); } else { markForAutoClose(currentThread()); } return result.webDriver; }

Target:
private WebDriver createDriver() { CreateDriverCommand.Result result = createDriverCommand.createDriver(config, factory, userProvidedProxy, listeners); long threadId = currentThread().getId(); threadWebDriver.put(threadId, result.webDriver); if (result.selenideProxyServer != null) { threadProxyServer.put(threadId, result.selenideProxyServer); } if (config.holdBrowserOpen()) { log.info("Browser and proxy will stay open due to holdBrowserOpen=true: -> {}, {}", threadId, result.webDriver, result.selenideProxyServer); } else { markForAutoClose(currentThread()); } return result.webDriver; }
Source:
private void normalizeAndCalculateStatistics() { if (allNormalizationIds != null) { normalizeIntensities(); } calculateStatistics(); }

Target:
private void normalizeAndCalculateStatistics() { normalizeIntensities(); calculateStatistics(); }
Source:
public Map<String, String> getProperties() { return MoreObjects.firstNonNull(properties, new HashMap<>()); }

Target:
public Map<String, String> getProperties() { return properties != null ? properties : new HashMap<>(); }
Source:
private byte[] getJarFileAsByteArray (File tarFile) { byte[] data = null; LOG.info("Getting jar file from {}", tarFile); try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(tarFile)); TarArchiveInputStream tarArchiveInputStream = new TarArchiveInputStream(bis)) { TarArchiveEntry tarArchiveEntry = tarArchiveInputStream.getNextTarEntry(); while (tarArchiveEntry != null) { if (tarArchiveEntry.getName().endsWith(".jar")) { data = IOUtils.toByteArray(tarArchiveInputStream); break; } tarArchiveEntry = tarArchiveInputStream.getNextTarEntry(); } } catch (IOException e) { LOG.warn("Exception occured while getting jar file: from " + tarFile, e); } return data; }

Target:
private byte[] getJarFileAsByteArray (File tarFile) { return getFileAsByteArray(tarFile, x -> x.endsWith(".jar")); }
Source:
public static void clearVisitDate(String[] selected) { ArrayList<String> geocodes = new ArrayList<String>(); for (int i = 0; i < selected.length; i++) { geocodes.add(selected[i]); } setVisitDate(geocodes, 0); }

Target:
public static void clearVisitDate(String[] selected) { setVisitDate(Arrays.asList(selected), 0); }
Source:
private static DistributedQueryRunner createQueryRunner(boolean legacyLogFunction) throws Exception { return DistributedQueryRunner.builder(testSessionBuilder().build()) .setNodeCount(1) .setExtraProperties(legacyLogFunction ? ImmutableMap.of("deprecated.legacy-log-function", "true") : ImmutableMap.of("deprecated.legacy-log-function", "false")) .build(); }

Target:
private static QueryRunner createQueryRunner(boolean legacyLogFunction) { return new LocalQueryRunner(testSessionBuilder().build(), new FeaturesConfig().setLegacyLogFunction(legacyLogFunction)); }