auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void handleReceiveSubscriptionEntity(SubscriptionEntity subscriptionEntity) { compositeDisposable.add( subscriptionService.getChannelInfo(subscriptionEntity) .observeOn(Schedulers.io()) .onErrorComplete((@io.reactivex.annotations.NonNull Throwable throwable) -> FeedFragment.super.onError( throwable)) .subscribe(this.getReceiveChannelInfoHandler(subscriptionEntity.getUrl()), getFetchChannelInfoErrorHandler(subscriptionEntity.getServiceId(), subscriptionEntity.getUrl()))); }

Target:
private void handleReceiveSubscriptionEntity(SubscriptionEntity subscriptionEntity) { compositeDisposable.add( subscriptionService.getChannelInfo(subscriptionEntity) .observeOn(Schedulers.io()) .onErrorComplete((@NonNull Throwable throwable) -> FeedFragment.super.onError( throwable)) .subscribe(this.getReceiveChannelInfoHandler(subscriptionEntity.getUrl()), getFetchChannelInfoErrorHandler(subscriptionEntity.getServiceId(), subscriptionEntity.getUrl()))); }
Source:
public void cleanup() throws DBException { synchronized (GoraBenchmarkClient.class) { if (dataStore != null) dataStore.close(); } }

Target:
public void cleanup() throws DBException { if (dataStore != null) dataStore.close(); }
Source:
private static Bitmap attemptBoundedScaleUp(String imageFilepath, int desiredHeight, int desiredWidth, int boundingHeight, int boundingWidth) { if (boundingHeight < desiredHeight || boundingWidth < desiredWidth) { float heightScale = ((float)boundingHeight) / desiredHeight; float widthScale = ((float)boundingWidth) / desiredWidth; float boundingScaleDownFactor = Math.min(heightScale, widthScale); desiredHeight = Math.round(desiredHeight * boundingScaleDownFactor); desiredWidth = Math.round(desiredWidth * boundingScaleDownFactor); } try { BitmapFactory.Options o = new BitmapFactory.Options(); o.inScaled = false; Bitmap originalBitmap = BitmapFactory.decodeFile(imageFilepath, o); try { return Bitmap.createScaledBitmap(originalBitmap, desiredWidth, desiredHeight, false); } catch (OutOfMemoryError e) { return originalBitmap; } } catch (OutOfMemoryError e) { return performSafeScaleDown(imageFilepath, 2, 1); } }

Target:
private static Bitmap attemptBoundedScaleUp(String imageFilepath, int desiredHeight, int desiredWidth, int boundingHeight, int boundingWidth) { if (boundingHeight < desiredHeight || boundingWidth < desiredWidth) { Pair<Integer, Integer> dimensImposedByContainer = getProportionalDimensForContainer( desiredHeight, desiredWidth, boundingHeight, boundingWidth); desiredWidth = dimensImposedByContainer.first; desiredHeight = dimensImposedByContainer.second; } try { BitmapFactory.Options o = new BitmapFactory.Options(); o.inScaled = false; Bitmap originalBitmap = BitmapFactory.decodeFile(imageFilepath, o); try { return Bitmap.createScaledBitmap(originalBitmap, desiredWidth, desiredHeight, false); } catch (OutOfMemoryError e) { return originalBitmap; } } catch (OutOfMemoryError e) { return performSafeScaleDown(imageFilepath, 2, 1); } }
Source:
public void testDroppedColumns() throws SQLException { if (!TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)) { return; } Statement stmt = con.createStatement(); stmt.execute("ALTER TABLE metadatatest DROP name"); stmt.execute("ALTER TABLE metadatatest DROP colour"); stmt.close(); DatabaseMetaData dbmd = con.getMetaData(); ResultSet rs = dbmd.getColumns(null, null, "metadatatest", null); assertTrue(rs.next()); assertEquals("id", rs.getString("COLUMN_NAME")); assertEquals(1, rs.getInt("ORDINAL_POSITION")); assertTrue(rs.next()); assertEquals("updated", rs.getString("COLUMN_NAME")); assertEquals(2, rs.getInt("ORDINAL_POSITION")); assertTrue(rs.next()); assertEquals("quest", rs.getString("COLUMN_NAME")); assertEquals(3, rs.getInt("ORDINAL_POSITION")); rs.close(); rs = dbmd.getColumns(null, null, "metadatatest", "quest"); assertTrue(rs.next()); assertEquals("quest", rs.getString("COLUMN_NAME")); assertEquals(3, rs.getInt("ORDINAL_POSITION")); assertTrue(!rs.next()); rs.close(); rs = dbmd.getFunctionColumns(null, null, "f2", null); assertTrue(rs.next()); assertTrue(rs.next()); assertEquals("a", rs.getString(4)); assertTrue(rs.next()); assertEquals("b", rs.getString(4)); assertTrue(!rs.next()); rs.close(); }

Target:
public void testDroppedColumns() throws SQLException { if (!TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_4)) { return; } Statement stmt = con.createStatement(); stmt.execute("ALTER TABLE metadatatest DROP name"); stmt.execute("ALTER TABLE metadatatest DROP colour"); stmt.close(); DatabaseMetaData dbmd = con.getMetaData(); ResultSet rs = dbmd.getColumns(null, null, "metadatatest", null); assertTrue(rs.next()); assertEquals("id", rs.getString("COLUMN_NAME")); assertEquals(1, rs.getInt("ORDINAL_POSITION")); assertTrue(rs.next()); assertEquals("updated", rs.getString("COLUMN_NAME")); assertEquals(2, rs.getInt("ORDINAL_POSITION")); assertTrue(rs.next()); assertEquals("quest", rs.getString("COLUMN_NAME")); assertEquals(3, rs.getInt("ORDINAL_POSITION")); rs.close(); rs = dbmd.getColumns(null, null, "metadatatest", "quest"); assertTrue(rs.next()); assertEquals("quest", rs.getString("COLUMN_NAME")); assertEquals(3, rs.getInt("ORDINAL_POSITION")); assertTrue(!rs.next()); rs.close(); rs = dbmd.getFunctionColumns(null, null, "f4", null); assertTrue(rs.next()); assertTrue(rs.next()); assertEquals("id", rs.getString(4)); assertTrue(rs.next()); assertEquals("updated", rs.getString(4)); rs.close(); }
Source:
public SubTabNetworkHostView(SearchableDetailModelProvider<PairQueryable<VdsNetworkInterface, VDS>, NetworkListModel, NetworkHostListModel> modelProvider) { super(modelProvider); viewRadioGroup = new ViewRadioGroup<>(Arrays.asList(NetworkHostFilter.values())); viewRadioGroup.setSelectedValue(NetworkHostFilter.attached); viewRadioGroup.addChangeHandler(selected -> { onRadioButtonChange(selected); }); labelImage = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.tagImage()).getHTML()); initTable(); initWidget(getTableContainer()); }

Target:
public SubTabNetworkHostView(SearchableDetailModelProvider<PairQueryable<VdsNetworkInterface, VDS>, NetworkListModel, NetworkHostListModel> modelProvider) { super(modelProvider); viewRadioGroup = new ViewRadioGroup<>(Arrays.asList(NetworkHostFilter.values())); viewRadioGroup.setSelectedValue(NetworkHostFilter.attached); viewRadioGroup.addChangeHandler(selected -> onRadioButtonChange(selected)); labelImage = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.tagImage()).getHTML()); initTable(); initWidget(getTableContainer()); }
Source:
public static int encode(final Car car, final UnsafeBuffer directBuffer, final int bufferOffset) { final int srcOffset = 0; car.wrapForEncode(directBuffer, bufferOffset) .serialNumber(1234) .modelYear(2013) .available(BooleanType.TRUE) .code(Model.A) .putVehicleCode(new String(VEHICLE_CODE)); for (int i = 0, size = Car.someNumbersLength(); i < size; i++) { car.someNumbers(i, i); } car.extras() .clear() .cruiseControl(true) .sportsPack(true) .sunRoof(false); car.engine() .capacity(2000) .numCylinders((short)4) .putManufacturerCode(new String(MANUFACTURER_CODE)); car.fuelFiguresCount(3) .next().speed(30).mpg(35.9f) .next().speed(55).mpg(49.0f) .next().speed(75).mpg(40.0f); final Car.PerformanceFigures perfFigures = car.performanceFiguresCount(2); perfFigures.next() .octaneRating((short)95) .accelerationCount(3) .next().mph(30).seconds(4.0f) .next().mph(60).seconds(7.5f) .next().mph(100).seconds(12.2f); perfFigures.next() .octaneRating((short)99) .accelerationCount(3) .next().mph(30).seconds(3.8f) .next().mph(60).seconds(7.1f) .next().mph(100).seconds(11.8f); car.make(new String(MAKE)); car.putModel(MODEL, srcOffset, MODEL.length); return car.size(); }

Target:
public static int encode(final Car car, final UnsafeBuffer directBuffer, final int bufferOffset) { final int srcOffset = 0; car.wrapForEncode(directBuffer, bufferOffset) .serialNumber(1234) .modelYear(2013) .available(BooleanType.TRUE) .code(Model.A) .putVehicleCode(VEHICLE_CODE, srcOffset); for (int i = 0, size = Car.someNumbersLength(); i < size; i++) { car.someNumbers(i, i); } car.extras() .clear() .cruiseControl(true) .sportsPack(true) .sunRoof(false); car.engine() .capacity(2000) .numCylinders((short)4) .putManufacturerCode(MANUFACTURER_CODE, srcOffset); car.fuelFiguresCount(3) .next().speed(30).mpg(35.9f) .next().speed(55).mpg(49.0f) .next().speed(75).mpg(40.0f); final Car.PerformanceFigures perfFigures = car.performanceFiguresCount(2); perfFigures.next() .octaneRating((short)95) .accelerationCount(3) .next().mph(30).seconds(4.0f) .next().mph(60).seconds(7.5f) .next().mph(100).seconds(12.2f); perfFigures.next() .octaneRating((short)99) .accelerationCount(3) .next().mph(30).seconds(3.8f) .next().mph(60).seconds(7.1f) .next().mph(100).seconds(11.8f); car.make(new String(MAKE)); car.putModel(MODEL, srcOffset, MODEL.length); return car.size(); }
Source:
private void stopParserThreads() { for (ParserThread thread : parserThreads) { if (thread.isRunning()) { LOG.debug("Stopping Thread " + thread.getName()); thread.stopParser(); } } }

Target:
private void stopParserThreads() { synchronized (parserThreads) { for (ParserThread thread : parserThreads) { if (thread.isRunning()) { LOG.debug("Stopping Thread " + thread.getName()); thread.stopParser(); } } } parserThreads.clear(); }
Source:
public void setUp() throws Exception { l1adminUser = "admin"; l1adminPassword = System.getProperty("admin_password"); loginPage = new LoginPage(driver); homePage = new HomePage(driver); participantPage = new ParticipantPage(driver); participantEditPage = new ParticipantEditPage(driver); if (homePage.expectedUrlPath() != currentPage().urlPath()) { loginPage.login(l1adminUser , l1adminPassword); } }

Target:
public void setUp() throws Exception { l1adminUser = "admin"; l1adminPassword = System.getProperty("admin_password"); loginPage = new LoginPage(driver); homePage = new HomePage(driver); participantPage = new ParticipantPage(driver); participantEditPage = new ParticipantEditPage(driver); if (!StringUtils.equals(homePage.expectedUrlPath(), currentPage().urlPath())) { loginPage.login(l1adminUser , l1adminPassword); } }
Source:
private static KafkaProducer<String, String> buildProducer(final Map<String, Object> kafkaConfig) { kafkaConfig.putIfAbsent("batch.num.messages", 100); kafkaConfig.putIfAbsent("compression.codec", "snappy"); kafkaConfig.putIfAbsent("message.max.bytes", 1000000); kafkaConfig.putIfAbsent("receive.message.max.bytes", 100000000); kafkaConfig.putIfAbsent("session.timeout.ms", 30000); kafkaConfig.putIfAbsent("socket.timeout.ms", 60000); kafkaConfig.putIfAbsent("queue.buffering.max.messages", 100000); kafkaConfig.putIfAbsent("queue.buffering.max.kbytes", 1048576); kafkaConfig.putIfAbsent("queue.buffering.max.ms", 1000); kafkaConfig.putIfAbsent("message.send.max.retries", 2); kafkaConfig.putIfAbsent("retry.backoff.ms", 100); return new KafkaProducer<>(kafkaConfig, new StringSerializer(), new StringSerializer()); }

Target:
private static KafkaProducer<String, String> buildProducer(final Map<String, Object> kafkaConfig) { kafkaConfig.putIfAbsent(ProducerConfig.BATCH_SIZE_CONFIG, 100); kafkaConfig.putIfAbsent(ProducerConfig.COMPRESSION_TYPE_CONFIG, "snappy"); kafkaConfig.putIfAbsent(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, 1000000); kafkaConfig.putIfAbsent(ProducerConfig.RETRIES_CONFIG, 2); kafkaConfig.putIfAbsent(ProducerConfig.RETRY_BACKOFF_MS_CONFIG, 100); return new KafkaProducer<>(kafkaConfig, new StringSerializer(), new StringSerializer()); }
Source:
private UpsertOptions buildUpsertOptions() { final UpsertOptions options = UpsertOptions.upsertOptions(); if (persistTo != PersistTo.NONE || replicateTo != ReplicateTo.NONE) { options.durability(persistTo, replicateTo); } else if (durabilityLevel != DurabilityLevel.NONE) { options.durability(durabilityLevel); } if (expiry != null && ! expiry.equals( Duration.ofSeconds(0))) { options.expiry(expiry); } else if (domainType.isAnnotationPresent(Document.class)) { Document documentAnn = domainType.getAnnotation(Document.class); long durationSeconds = documentAnn.expiryUnit().toSeconds(documentAnn.expiry()); options.expiry(Duration.ofSeconds(durationSeconds)); } return options; }

Target:
private UpsertOptions buildUpsertOptions() { final UpsertOptions options = UpsertOptions.upsertOptions(); if (persistTo != PersistTo.NONE || replicateTo != ReplicateTo.NONE) { options.durability(persistTo, replicateTo); } else if (durabilityLevel != DurabilityLevel.NONE) { options.durability(durabilityLevel); } if (expiry != null && ! expiry.isZero()) { options.expiry(expiry); } else if (domainType.isAnnotationPresent(Document.class)) { Document documentAnn = domainType.getAnnotation(Document.class); long durationSeconds = documentAnn.expiryUnit().toSeconds(documentAnn.expiry()); options.expiry(Duration.ofSeconds(durationSeconds)); } return options; }
Source:
public CivicApiAddress getAddressForId(String location_id) { if (locationIds.get(location_id) != null) { PollingLocation location = allLocations.get(locationIds.get(location_id)); return location.address; } else if (location_id.endsWith("eab")) { if (location_id.equals("state_eab") && stateAdmin != null) { return stateAdmin.physicalAddress; } else if (location_id.equals("local_eab") && localAdmin != null) { return localAdmin.physicalAddress; } } else { Log.e("VIPTabBarActivity", "Did not find ID in hash: " + location_id); return null; } return null; }

Target:
public CivicApiAddress getAddressForId(String location_id) { if (locationIds.get(location_id) != null) { PollingLocation location = allLocations.get(locationIds.get(location_id)); return location.address; } else if (location_id.equals(ElectionAdministrationBody.AdminBody.STATE) && stateAdmin != null) { return stateAdmin.physicalAddress; } else if (location_id.equals(ElectionAdministrationBody.AdminBody.LOCAL) && localAdmin != null) { return localAdmin.physicalAddress; } else { Log.e("VIPTabBarActivity", "Did not find ID in hash: " + location_id); return null; } }
Source:
public TableFinishNode tableDelete(SchemaTableName schemaTableName, PlanNode deleteSource, Symbol deleteRowId) { TableWriterNode.DeleteHandle deleteHandle = new TableWriterNode.DeleteHandle( new TableHandle( new ConnectorId("testConnector"), new TestingMetadata.TestingTableHandle()), schemaTableName ); return new TableFinishNode( idAllocator.getNextId(), exchange(e -> e .addSource(new DeleteNode( idAllocator.getNextId(), deleteSource, deleteHandle, deleteRowId, ImmutableList.of(deleteRowId) )) .addInputsSet(deleteRowId) .singleDistributionPartitioningScheme(deleteRowId) ), deleteHandle, ImmutableList.of(deleteRowId) ); }

Target:
public TableFinishNode tableDelete(SchemaTableName schemaTableName, PlanNode deleteSource, Symbol deleteRowId) { TableWriterNode.DeleteHandle deleteHandle = new TableWriterNode.DeleteHandle( new TableHandle( new ConnectorId("testConnector"), new TestingTableHandle()), schemaTableName ); return new TableFinishNode( idAllocator.getNextId(), exchange(e -> e .addSource(new DeleteNode( idAllocator.getNextId(), deleteSource, deleteHandle, deleteRowId, ImmutableList.of(deleteRowId) )) .addInputsSet(deleteRowId) .singleDistributionPartitioningScheme(deleteRowId) ), deleteHandle, ImmutableList.of(deleteRowId) ); }
Source:
private void handleFileEvent(File file, String event) throws Exception { if (this.isProcessConfigFile(file)) { log.info("Configuration file " + event + ": " + file); scheduleReload(); } }

Target:
private void handleFileEvent(File file, String event) throws Exception { if (this.isProcessConfigFile(file)) { log.info("Configuration file {}: {}", event, file); scheduleReload(); } }
Source:
void peekMessagesFromSequence(MessagingEntityType entityType) { setSenderAndReceiver(entityType, TestUtils.USE_CASE_PEEK_MESSAGE_FROM_SEQUENCE, false); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); final int maxMessages = 2; final int fromSequenceNumber = 1; Mono.when(sendMessage(message), sendMessage(message)).block(TIMEOUT); StepVerifier.create(receiver.peekMessagesAt(maxMessages, fromSequenceNumber)) .expectNextCount(maxMessages) .verifyComplete(); StepVerifier.create(receiver.receiveMessages()) .assertNext(receivedMessage -> { receiver.complete(receivedMessage).block(Duration.ofSeconds(15)); }) .assertNext(receivedMessage -> { receiver.complete(receivedMessage).block(Duration.ofSeconds(15)); }) .thenCancel() .verify(); }

Target:
void peekMessagesFromSequence(MessagingEntityType entityType) { setSenderAndReceiver(entityType, TestUtils.USE_CASE_PEEK_MESSAGE_FROM_SEQUENCE, false); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); final int maxMessages = 2; final int fromSequenceNumber = 1; Mono.when(sendMessage(message), sendMessage(message)).block(TIMEOUT); StepVerifier.create(receiver.peekMessagesAt(maxMessages, fromSequenceNumber)) .expectNextCount(maxMessages) .verifyComplete(); StepVerifier.create(receiver.receiveMessages().take(maxMessages)) .assertNext(receivedMessage -> { receiver.complete(receivedMessage).block(Duration.ofSeconds(15)); }) .assertNext(receivedMessage -> { receiver.complete(receivedMessage).block(Duration.ofSeconds(15)); }) .expectComplete() .verify(TIMEOUT); }
Source:
public void shouldNotAssignAdminToNonExistentUser() throws Throwable { InternalFlatFileRealm realm = internalTestRealmWithUsers( Collections.singletonList( "neo4j" ), Collections.singletonList( "morpheus" ) ); exception.expect( InvalidArgumentsException.class ); exception.expectMessage( "No roles defined, and default admin user 'morpheus' does not exist. Please use `" + SetDefaultAdminCommand.COMMAND_NAME + "` to select a valid admin." ); realm.initialize(); realm.start(); }

Target:
public void shouldNotAssignAdminToNonExistentUser() throws Throwable { InternalFlatFileRealm realm = internalTestRealmWithUsers( Collections.singletonList( "neo4j" ), Collections.singletonList( "morpheus" ) ); exception.expect( InvalidArgumentsException.class ); exception.expectMessage( "No roles defined, and default admin user 'morpheus' does not exist. Please use `neo4j-admin " + SetDefaultAdminCommand.COMMAND_NAME + "` to select a valid admin." ); realm.initialize(); realm.start(); }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.renderer_termination_activity_title); WebkitHelpers.appendWebViewVersionToTitle(this); setContentView(R.layout.activity_renderer_termination); mWebView = findViewById(R.id.renderer_termination_webview); mStatus = findViewById(R.id.renderer_termination_status); mTerminateButton = (Button) findViewById( R.id.renderer_termination_terminate_button); mBlockButton = (Button) findViewById( R.id.renderer_termination_block_button); mBlockTransientButton = (Button) findViewById( R.id.renderer_termination_block_transient_button); mUnblockButton = (Button) findViewById( R.id.renderer_termination_unblock_button); recreateWebView(); if (!WebViewFeature.isFeatureSupported( WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE)) { mStatus.setText("Renderer status: unknown"); return; } mTerminateButton.setOnClickListener((View view) -> { terminateWebViewRenderer(); }); mBlockButton.setOnClickListener((View view) -> { blockWebViewRenderer(); }); mBlockTransientButton.setOnClickListener((View view) -> { blockWebViewRenderer(10000); }); mUnblockButton.setOnClickListener((View view) -> { unblockWebViewRenderer(); }); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.renderer_termination_activity_title); WebkitHelpers.appendWebViewVersionToTitle(this); setContentView(R.layout.activity_renderer_termination); mWebView = findViewById(R.id.renderer_termination_webview); mStatus = findViewById(R.id.renderer_termination_status); mTerminateButton = findViewById(R.id.renderer_termination_terminate_button); mBlockButton = findViewById(R.id.renderer_termination_block_button); mBlockTransientButton = findViewById(R.id.renderer_termination_block_transient_button); mUnblockButton = findViewById(R.id.renderer_termination_unblock_button); recreateWebView(); if (!WebViewFeature.isFeatureSupported( WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE)) { mStatus.setText("API not available"); } mTerminateButton.setOnClickListener((View view) -> { terminateWebViewRenderer(); }); mBlockButton.setOnClickListener((View view) -> { blockWebViewRenderer(); }); mBlockTransientButton.setOnClickListener((View view) -> { blockWebViewRenderer(10000); }); mUnblockButton.setOnClickListener((View view) -> { unblockWebViewRenderer(); }); }
Source:
private boolean recheckMerges(ProjectConfig oldCfg, ProjectConfig newCfg) { if (oldCfg == null) { return true; } else if (newCfg == null) { return false; } return !oldCfg.getProject().getSubmitType().equals(newCfg.getProject().getSubmitType()) || oldCfg.getProject().getUseContentMerge() != newCfg.getProject().getUseContentMerge() || (oldCfg.getRulesId() == null ? newCfg.getRulesId() != null : !oldCfg.getRulesId().equals(newCfg.getRulesId())); }

Target:
private boolean recheckMerges(ProjectConfig oldCfg, ProjectConfig newCfg) { if (oldCfg == null || newCfg == null) { return true; } return !oldCfg.getProject().getSubmitType().equals(newCfg.getProject().getSubmitType()) || oldCfg.getProject().getUseContentMerge() != newCfg.getProject().getUseContentMerge() || (oldCfg.getRulesId() == null ? newCfg.getRulesId() != null : !oldCfg.getRulesId().equals(newCfg.getRulesId())); }
Source:
private void checkIfNotMixingRhels(VDS vds, VDSGroup vdsGroup) { if (vds.getHostOs() == null) { return; } String[] hostOsInfo = vds.getHostOs().split("-"); if (hostOsInfo.length != 3) { return; } String newOsName = hostOsInfo[0].trim(); String newRelease = hostOsInfo[2].trim(); if (newOsName.equals("RHEL") || newOsName.equals("oVirt Node") || newOsName.equals("RHEV Hypervisor")) { VDS beforeRhel = vdsDao.getFirstUpRhelForVdsGroup(vdsGroup.getId()); boolean firstHostInCluster = beforeRhel == null; if (firstHostInCluster) { return; } if (beforeRhel.getHostOs() == null) { return; } String[] prevOsInfo = beforeRhel.getHostOs().split("-"); if (prevOsInfo.length != 3) { return; } String prevRelease = prevOsInfo[2].trim(); boolean addingRhel6toRhel7 = newRelease.contains("el6") && prevRelease.contains("el7"); boolean addingRhel7toRhel6 = newRelease.contains("el7") && prevRelease.contains("el6"); if (addingRhel7toRhel6 || addingRhel6toRhel7) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("previousRhel", beforeRhel.getHostOs()); customLogValues.put("addingRhel", vds.getHostOs()); vdsNonOperational(vds, NonOperationalReason.MIXING_RHEL_VERSIONS_IN_CLUSTER, customLogValues); vds.setStatus(VDSStatus.NonOperational); logAuditLogEvent(vds, customLogValues, AuditLogType.MIXING_RHEL_VERSIONS_IN_CLUSTER); } } }

Target:
private void checkIfNotMixingRhels(VDS vds, VDSGroup vdsGroup) { if (vds.getHostOs() == null) { return; } String[] hostOsInfo = vds.getHostOs().split("-"); if (hostOsInfo.length != 3) { return; } String newOsName = hostOsInfo[0].trim(); String newRelease = hostOsInfo[2].trim(); if (newOsName.equals("RHEL") || newOsName.equals("oVirt Node") || newOsName.equals("RHEV Hypervisor")) { VDS beforeRhel = vdsDao.getFirstUpRhelForVdsGroup(vdsGroup.getId()); boolean firstHostInCluster = beforeRhel == null; if (firstHostInCluster) { return; } if (beforeRhel.getHostOs() == null) { return; } String[] prevOsInfo = beforeRhel.getHostOs().split("-"); if (prevOsInfo.length != 3) { return; } String prevRelease = prevOsInfo[2].trim(); boolean addingRhel6toRhel7 = newRelease.contains("el6") && prevRelease.contains("el7"); boolean addingRhel7toRhel6 = newRelease.contains("el7") && prevRelease.contains("el6"); if (addingRhel7toRhel6 || addingRhel6toRhel7) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("previousRhel", beforeRhel.getHostOs()); customLogValues.put("addingRhel", vds.getHostOs()); vdsNonOperational(vds, NonOperationalReason.MIXING_RHEL_VERSIONS_IN_CLUSTER, customLogValues); vds.setStatus(VDSStatus.NonOperational); } } }
Source:
public ServiceTaskUploadFormPresenter(final ServiceTaskUploadFormView view, final Caller<ServiceTaskService> serviceTaskService, Event<NotificationEvent> notificationEvent, final SyncBeanManager iocManager) { this.view = view; this.serviceTaskService = serviceTaskService; this.notificationEvent = notificationEvent; view.addHideHandler(new ModalHideHandler() { @Override public void onHide(ModalHideEvent hideEvent) { iocManager.destroyBean(ServiceTaskUploadFormPresenter.this); } }); }

Target:
public ServiceTaskUploadFormPresenter(final ServiceTaskUploadFormView view, final Caller<ServiceTaskService> serviceTaskService, Event<NotificationEvent> notificationEvent, final SyncBeanManager iocManager) { this.view = view; this.serviceTaskService = serviceTaskService; this.notificationEvent = notificationEvent; this.onClose = () -> iocManager.destroyBean(ServiceTaskUploadFormPresenter.this); }
Source:
public void skip() { LOG.debug(() -> "The invocation is skipped"); invoked.set(true); }

Target:
public void skip() { LOG.debug(() -> "The invocation is skipped"); if (!invokedOrSkipped.compareAndSet(false, true)) { fail("Chain of InvocationInterceptors called invocation multiple times instead of just once"); } delegate.skip(); }
Source:
CompactionManager(String mountPath, StoreConfig storeConfig, Collection<BlobStore> stores, StorageManagerMetrics metrics, Time time) { this.mountPath = mountPath; this.storeConfig = storeConfig; this.stores = stores; this.time = time; this.metrics = metrics; if (storeConfig.storeEnableCompaction) { boolean enableTimeBasedTrigger = false; boolean enableAdminBasedTrigger = false; for (String trigger : storeConfig.storeCompactionTriggers) { switch (trigger.toLowerCase()) { case TIME_BASED_TRIGGER_NAME: enableTimeBasedTrigger = true; break; case ADMIN_BASED_TRIGGER_NAME: enableAdminBasedTrigger = true; break; default: throw new IllegalArgumentException("Unrecognized trigger name: " + trigger); } } compactionExecutor = new CompactionExecutor(enableTimeBasedTrigger, enableAdminBasedTrigger); try { CompactionPolicyFactory compactionPolicyFactory = Utils.getObj(storeConfig.storeCompactionPolicyFactory, storeConfig, time); compactionPolicy = compactionPolicyFactory.getCompactionPolicy(); } catch (Exception e) { throw new IllegalStateException("Error creating compaction policy using compactionPolicyFactory " + storeConfig.storeCompactionPolicyFactory); } } else { compactionExecutor = null; compactionPolicy = null; } }

Target:
CompactionManager(String mountPath, StoreConfig storeConfig, Collection<BlobStore> stores, StorageManagerMetrics metrics, Time time) { this.mountPath = mountPath; this.storeConfig = storeConfig; this.stores = stores; this.time = time; this.metrics = metrics; if (!storeConfig.storeCompactionTriggers[0].isEmpty()) { EnumSet<Trigger> triggers = EnumSet.noneOf(Trigger.class); for (String trigger : storeConfig.storeCompactionTriggers) { triggers.add(Trigger.valueOf(trigger.toUpperCase())); } compactionExecutor = new CompactionExecutor(triggers); try { CompactionPolicyFactory compactionPolicyFactory = Utils.getObj(storeConfig.storeCompactionPolicyFactory, storeConfig, time); compactionPolicy = compactionPolicyFactory.getCompactionPolicy(); } catch (Exception e) { throw new IllegalStateException("Error creating compaction policy using compactionPolicyFactory " + storeConfig.storeCompactionPolicyFactory); } } else { compactionExecutor = null; compactionPolicy = null; } }
Source:
public PagingResponse<CandidateApplicationDTO> loadApplications( @PathVariable(value = "candidateId") Long candidateId, Locale locale, @RequestParam(name = "pageNumber") Integer pageNumber, @RequestParam(name = "pageSize") Integer pageSize) { PagingResponse<CandidateApplicationDTO> candidateApplicationDTOPagingResponse = applicationsService.getApplicationsByCandidateId(candidateId, pageNumber - 1, pageSize); for (CandidateApplicationDTO candidateApplicationDTO : candidateApplicationDTOPagingResponse .getRows()) { String stateType = candidateApplicationDTO.getStateType(); stateType = messageKeyResolver.resolveMessageOrDefault(APPLICATION_STATE + stateType, stateType); candidateApplicationDTO.setStateType(stateType); } return candidateApplicationDTOPagingResponse; }

Target:
public PagingResponse<CandidateApplicationDTO> loadApplications( @PathVariable(value = "candidateId") Long candidateId, Locale locale, @RequestParam(name = "pageNumber") Integer pageNumber, @RequestParam(name = "pageSize") Integer pageSize) { PagingResponse<CandidateApplicationDTO> candidateApplicationDTOPagingResponse = applicationsService.getApplicationsByCandidateId(candidateId, pageNumber - 1, pageSize); for (CandidateApplicationDTO candidateApplicationDTO : candidateApplicationDTOPagingResponse .getRows()) { String stateType = candidateApplicationDTO.getStateType(); candidateApplicationDTO.setStateType( messageKeyResolver.resolveMessageOrDefault(APPLICATION_STATE + stateType, stateType)); } return candidateApplicationDTOPagingResponse; }
Source:
public List<DataSegment> getUnusedSegmentsForInterval(final String dataSource, final Interval interval) { List<DataSegment> matchingSegments = SQLMetadataSegmentManager.inReadOnlyTransaction( connector, new TransactionCallback<List<DataSegment>>() { @Override public List<DataSegment> inTransaction(final Handle handle, final TransactionStatus status) throws Exception { return handle .createQuery( String.format( "SELECT payload FROM %s WHERE dataSource = :dataSource and start >= :start and \"end\" <= :end and used = false", dbTables.getSegmentsTable() ) ) .bind("dataSource", dataSource) .bind("start", interval.getStart().toString()) .bind("end", interval.getEnd().toString()) .setFetchSize(connector.getStreamingFetchSize()) .map(ByteArrayMapper.FIRST) .fold( Lists.<DataSegment>newArrayList(), new Folder3<List<DataSegment>, byte[]>() { @Override public List<DataSegment> fold( List<DataSegment> accumulator, byte[] payload, FoldController foldController, StatementContext statementContext ) throws SQLException { try { accumulator.add(jsonMapper.readValue(payload, DataSegment.class)); return accumulator; } catch (Exception e) { throw Throwables.propagate(e); } } } ); } } ); log.info("Found %,d segments for %s for interval %s.", matchingSegments.size(), dataSource, interval); return matchingSegments; }

Target:
public List<DataSegment> getUnusedSegmentsForInterval(final String dataSource, final Interval interval) { List<DataSegment> matchingSegments = connector.inReadOnlyTransaction( new TransactionCallback<List<DataSegment>>() { @Override public List<DataSegment> inTransaction(final Handle handle, final TransactionStatus status) throws Exception { return handle .createQuery( String.format( "SELECT payload FROM %s WHERE dataSource = :dataSource and start >= :start and \"end\" <= :end and used = false", dbTables.getSegmentsTable() ) ) .setFetchSize(connector.getStreamingFetchSize()) .bind("dataSource", dataSource) .bind("start", interval.getStart().toString()) .bind("end", interval.getEnd().toString()) .map(ByteArrayMapper.FIRST) .fold( Lists.<DataSegment>newArrayList(), new Folder3<List<DataSegment>, byte[]>() { @Override public List<DataSegment> fold( List<DataSegment> accumulator, byte[] payload, FoldController foldController, StatementContext statementContext ) throws SQLException { try { accumulator.add(jsonMapper.readValue(payload, DataSegment.class)); return accumulator; } catch (Exception e) { throw Throwables.propagate(e); } } } ); } } ); log.info("Found %,d segments for %s for interval %s.", matchingSegments.size(), dataSource, interval); return matchingSegments; }
Source:
public void testRenameProcessVariableForAddDomainSpecifColumns() { TaskListViewImpl taskListView = view; GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", taskListView.getInitColumns(), taskListView.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); Set<String> set = Collections.singleton("Id"); taskListView.initColumns(extendedPagedTable); assertEquals(15, extendedPagedTable.getColumnMetaList().size()); assertEquals(0, extendedPagedTable.getColumnMetaList().stream() .filter(column -> column.getCaption().equals("Var_Id")) .collect(Collectors.toList()).size()); taskListView.addDomainSpecifColumns(extendedPagedTable, set); assertEquals(16, extendedPagedTable.getColumnMetaList().size()); assertEquals(1, extendedPagedTable.getColumnMetaList().stream() .filter(column -> column.getCaption().equals("Var_Id")) .collect(Collectors.toList()).size()); }

Target:
public void testRenameProcessVariableForAddDomainSpecifColumns() { GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", view.getInitColumns(), view.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); Set<String> set = Collections.singleton("Id"); view.initColumns(extendedPagedTable); assertThat(extendedPagedTable.getColumnMetaList().stream()).extracting(c -> c.getCaption()).hasSize(15).doesNotContain("Var_Id"); view.addDomainSpecifColumns(extendedPagedTable, set); assertThat(extendedPagedTable.getColumnMetaList().stream()).extracting(c -> c.getCaption()).hasSize(16).containsOnlyOnce("Var_Id"); }
Source:
public void defaultPeriodicTask() { final int[] count = {0}; TestScheduler scheduler = new TestScheduler(); Runnable action = new Runnable() { @Override public void run() { count[0]++; } }; Disposable d = scheduler.schedulePeriodicallyDirect(action, 100, 100, TimeUnit.MILLISECONDS); assertEquals(0, count[0]); assertFalse(d.isDisposed()); scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS); assertEquals(2, count[0]); d.dispose(); assertTrue(d.isDisposed()); scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS); assertEquals(2, count[0]); }

Target:
public void defaultPeriodicTask() { final int[] count = { 0 }; TestScheduler scheduler = new TestScheduler(); Disposable d = scheduler.schedulePeriodicallyDirect(new Runnable() { @Override public void run() { count[0]++; } }, 100, 100, TimeUnit.MILLISECONDS); assertEquals(0, count[0]); assertFalse(d.isDisposed()); scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS); assertEquals(2, count[0]); d.dispose(); assertTrue(d.isDisposed()); scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS); assertEquals(2, count[0]); }
Source:
public void aSetClockConfigurationActionIsPartOfABundledRequest(final Map<String, String> settings) throws Throwable { final BundleRequest request = (BundleRequest) ScenarioContext.Current().get(SCENARIO_CONTEXT_BUNDLE_REQUEST); final SetClockConfigurationRequest action = this.defaultMapper.map( SetClockConfigurationRequestDataFactory.fromParameterMap(settings), SetClockConfigurationRequest.class); new Action() { }; request.getActions().getActionList().add(action); this.increaseCount(SCENARIO_CONTEXT_BUNDLE_ACTIONS); }

Target:
public void aSetClockConfigurationActionIsPartOfABundledRequest(final Map<String, String> settings) throws Throwable { final BundleRequest request = (BundleRequest) ScenarioContext.Current().get(SCENARIO_CONTEXT_BUNDLE_REQUEST); final SetClockConfigurationRequest action = this.defaultMapper.map( SetClockConfigurationRequestDataFactory.fromParameterMap(settings), SetClockConfigurationRequest.class); request.getActions().getActionList().add(action); this.increaseCount(SCENARIO_CONTEXT_BUNDLE_ACTIONS); }
Source:
protected IAtsVersion getOrCreateVersion(AtsArtifactConfigCache cache, Artifact artifact) throws OseeCoreException { String guid = artifact.getGuid(); IAtsVersion item = cache.getSoleByGuid(guid, IAtsVersion.class); if (item == null) { item = versionFactory.createVersion(artifact.getName(), guid, artifact.getHumanReadableId()); cache.cache(item); } return item; }

Target:
protected IAtsVersion getOrCreateVersion(AtsArtifactConfigCache cache, Artifact artifact) throws OseeCoreException { Conditions.checkNotNull(artifact, "artifact"); String guid = artifact.getGuid(); IAtsVersion item = cache.getSoleByGuid(guid, IAtsVersion.class); if (item == null) { item = versionFactory.createVersion(artifact.getName(), guid, artifact.getHumanReadableId()); cache.cache(item); } return item; }
Source:
public static String insertId(String message, ObjectId changeId) { if (message.indexOf("\nChange-Id:") > 0) return message; String[] lines = message.split("\n"); int lastPattern = -1; int firstPattern = -1; for (int i = lines.length - 1; i > 0; --i) { if (issuePattern.matcher(lines[i]).matches()) { firstPattern = i; lastPattern = i; continue; } if (footerPattern.matcher(lines[i]).matches()) { lastPattern = i; continue; } if (lines[i].trim().length() == 0) { lines[i] = ""; break; } lastPattern = lines.length; break; } if (lastPattern == -1) lastPattern = lines.length; if (firstPattern == -1) firstPattern = lastPattern - 1; if (firstPattern > lastPattern) firstPattern = lastPattern - 1; StringBuilder ret = new StringBuilder(); int i = 0; for (; i <= firstPattern; ++i) { if (lines[i].length() != 0 || i > 0 && lines[i-1].length() != 0) { ret.append(lines[i]); ret.append("\n"); } } if (i == lines.length && lastPattern == lines.length) ret.append("\n"); ret.append("Change-Id: I"); ret.append(ObjectId.toString(changeId)); ret.append("\n"); for (; i < lines.length; ++i) { ret.append(lines[i]); ret.append("\n"); } return ret.toString(); }

Target:
public static String insertId(String message, ObjectId changeId) { if (message.indexOf("\nChange-Id:") > 0) return message; String[] lines = message.split("\n"); int footerFirstLine = lines.length; for (int i = lines.length - 1; i > 1; --i) { if (footerPattern.matcher(lines[i]).matches()) { footerFirstLine = i; continue; } if (footerFirstLine != lines.length && lines[i].length() == 0) { break; } if (footerFirstLine != lines.length && includeInFooterPattern.matcher(lines[i]).matches()) { footerFirstLine = i + 1; continue; } footerFirstLine = lines.length; break; } int insertAfter = footerFirstLine; for (int i = footerFirstLine; i < lines.length; ++i) { if (issuePattern.matcher(lines[i]).matches()) { insertAfter = i + 1; continue; } break; } StringBuilder ret = new StringBuilder(); int i = 0; for (; i < insertAfter; ++i) { ret.append(lines[i]); ret.append("\n"); } if (insertAfter == lines.length && insertAfter == footerFirstLine) ret.append("\n"); ret.append("Change-Id: I"); ret.append(ObjectId.toString(changeId)); ret.append("\n"); for (; i < lines.length; ++i) { ret.append(lines[i]); ret.append("\n"); } return ret.toString(); }
Source:
public void setUp() throws Exception { File folder = testDir.directory( "folder" ); indexStorage = new PartitionedIndexStorage( directoryFactory, fileSystemRule.get(), folder, false ); index = LuceneSchemaIndexBuilder.create( descriptor, Config.defaults(), directoryFactory) .withIndexStorage( indexStorage ) .build(); schemaDescriptor = descriptor.schema(); }

Target:
public void setUp() { File folder = testDir.directory( "folder" ); indexStorage = new PartitionedIndexStorage( directoryFactory, fileSystemRule.get(), folder, false ); index = LuceneSchemaIndexBuilder.create( descriptor, Config.defaults(), directoryFactory ) .withIndexStorage( indexStorage ) .build(); schemaDescriptor = descriptor.schema(); }
Source:
public DataObject dateStringToOctetString(final String date) { final ByteBuffer bb = ByteBuffer.allocate(5); final String year = date.substring(0, 2); if (NOT_SPECIFIED.equalsIgnoreCase(year)) { bb.putShort((short) 0xFFFF); } else { bb.put(Integer.valueOf(20).byteValue()); bb.put(Integer.valueOf(year).byteValue()); } final String month = date.substring(2, 4); if (NOT_SPECIFIED.equalsIgnoreCase(month)) { bb.put((byte) 0xFF); } else if (DAYLIGHT_SAVINGS_END.equalsIgnoreCase(month)) { bb.put((byte) 0xFD); } else if (DAYLIGHT_SAVINGS_BEGIN.equalsIgnoreCase(month)) { bb.put((byte) 0xFD); } else { bb.put(Integer.valueOf(month).byteValue()); } final String dayOfMonth = date.substring(4); if (NOT_SPECIFIED.equalsIgnoreCase(dayOfMonth)) { bb.put((byte) 0xFF); } else if (SECOND_LAST_DAY_OF_MONTH.equalsIgnoreCase(month)) { bb.put((byte) 0xFD); } else if (LAST_DAY_OF_MONTH.equalsIgnoreCase(month)) { bb.put((byte) 0xFE); } else { bb.put(Integer.valueOf(dayOfMonth).byteValue()); } bb.put((byte) 0xFF); return DataObject.newOctetStringData(bb.array()); }

Target:
public DataObject dateStringToOctetString(final String date) { final ByteBuffer bb = ByteBuffer.allocate(5); final String year = date.substring(0, 2); if (NOT_SPECIFIED.equalsIgnoreCase(year)) { bb.putShort((short) 0xFFFF); } else { bb.putShort(Short.valueOf(YEAR_MILLENIAL_PART + year)); } final String month = date.substring(2, 4); if (NOT_SPECIFIED.equalsIgnoreCase(month)) { bb.put((byte) 0xFF); } else if (DAYLIGHT_SAVINGS_END.equalsIgnoreCase(month)) { bb.put((byte) 0xFD); } else if (DAYLIGHT_SAVINGS_BEGIN.equalsIgnoreCase(month)) { bb.put((byte) 0xFD); } else { bb.put(Byte.parseByte(month)); } final String dayOfMonth = date.substring(4); if (NOT_SPECIFIED.equalsIgnoreCase(dayOfMonth)) { bb.put((byte) 0xFF); } else if (SECOND_LAST_DAY_OF_MONTH.equalsIgnoreCase(month)) { bb.put((byte) 0xFD); } else if (LAST_DAY_OF_MONTH.equalsIgnoreCase(month)) { bb.put((byte) 0xFE); } else { bb.put(Byte.parseByte(dayOfMonth)); } bb.put((byte) 0xFF); return DataObject.newOctetStringData(bb.array()); }
Source:
public XBee64BitAddress(int b0, int b1, int b2, int b3, int b4, int b5, int b6, int b7) { address = new byte[8]; address[0] = (byte) b0; address[1] = (byte) b1; address[2] = (byte) b2; address[3] = (byte) b3; address[4] = (byte) b4; address[5] = (byte) b5; address[6] = (byte) b6; address[7] = (byte) b7; }

Target:
public XBee64BitAddress(int b0, int b1, int b2, int b3, int b4, int b5, int b6, int b7) { if (b0 > 255 || b0 < 0) throw new IllegalArgumentException("B0 must be betwwen 0 and 255."); if (b1 > 255 || b1 < 0) throw new IllegalArgumentException("B1 must be betwwen 0 and 255."); if (b2 > 255 || b2 < 0) throw new IllegalArgumentException("B2 must be betwwen 0 and 255."); if (b3 > 255 || b3 < 0) throw new IllegalArgumentException("B3 must be betwwen 0 and 255."); if (b5 > 255 || b5 < 0) throw new IllegalArgumentException("B4 must be betwwen 0 and 255."); if (b5 > 255 || b5 < 0) throw new IllegalArgumentException("B5 must be betwwen 0 and 255."); if (b6 > 255 || b6 < 0) throw new IllegalArgumentException("B6 must be betwwen 0 and 255."); if (b7 > 255 || b7 < 0) throw new IllegalArgumentException("B7 must be betwwen 0 and 255."); address = new byte[8]; address[0] = (byte) b0; address[1] = (byte) b1; address[2] = (byte) b2; address[3] = (byte) b3; address[4] = (byte) b4; address[5] = (byte) b5; address[6] = (byte) b6; address[7] = (byte) b7; }
Source:
private void setSorting(ConceptSearchDTO source, SolrQuery result) { if (source.getSort() != null && source.getOrder() != null) { String sortField = source.getSort() + (CASE_INSENSITIVE_FIELDS.contains(source.getSort()) ? CASE_INSENSITIVE_SUFFIX : ""); result.setSort(sortField, SolrQuery.ORDER.valueOf(source.getOrder())); } }

Target:
private void setSorting(ConceptSearchDTO source, SolrQuery result) { if (source.getSort() != null && source.getOrder() != null) { result.setSort(getSortFieldWithSuffix(source.getSort()), SolrQuery.ORDER.valueOf(source.getOrder())); } }
Source:
public boolean validate() { boolean isValid = true; setMessage(null); if(getClusterConfigOptions().getItems() == null || getClusterConfigOptions().getItems().isEmpty()) { return false; } for (EntityModel<GlusterVolumeSnapshotConfig> model : getClusterConfigOptions().getItems()) { GlusterVolumeSnapshotConfig option = model.getEntity(); if (option.getParamValue().trim().length() == 0) { setMessage(ConstantsManager.getInstance() .getMessages() .clusterSnapshotOptionValueEmpty(option.getParamName())); isValid = false; break; } } return isValid; }

Target:
public boolean validate() { boolean isValid = true; setMessage(null); if(getClusterConfigOptions().getItems() == null || getClusterConfigOptions().getItems().isEmpty()) { setMessage(ConstantsManager.getInstance().getMessages().clusterSnapshotOptionNotExist()); return false; } for (EntityModel<GlusterVolumeSnapshotConfig> model : getClusterConfigOptions().getItems()) { GlusterVolumeSnapshotConfig option = model.getEntity(); if (option.getParamValue().trim().length() == 0) { setMessage(ConstantsManager.getInstance() .getMessages() .clusterSnapshotOptionValueEmpty(option.getParamName())); isValid = false; break; } } return isValid; }
Source:
protected Network getNetworkFromDb(Guid vdsGroupId) { List<Network> networks = getNetworkDAO().getAllForCluster(vdsGroupId); return LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network network) { return network.getName().equals(getNetworkName()); } }); }

Target:
protected Network getNetworkFromDb(Guid vdsGroupId) { List<Network> networks = getNetworkDAO().getAllForCluster(vdsGroupId); for (Network network : networks) { if (network.getName().equals(getNetworkName())) { return network; } } return null; }
Source:
private AmqpInboundGateway(AbstractMessageListenerContainer listenerContainer, AmqpTemplate amqpTemplate, boolean amqpTemplateExplicitlySet) { Assert.notNull(listenerContainer, "listenerContainer must not be null"); Assert.isNull(listenerContainer.getMessageListener(), "The listenerContainer provided to an AMQP inbound Gateway " + "must not have a MessageListener configured since " + "the adapter needs to configure its own listener implementation."); this.messageListenerContainer = listenerContainer; this.messageListenerContainer.setAutoStartup(false); this.amqpTemplate = amqpTemplate; this.amqpTemplateExplicitlySet = amqpTemplateExplicitlySet; }

Target:
private AmqpInboundGateway(AbstractMessageListenerContainer listenerContainer, AmqpTemplate amqpTemplate, boolean amqpTemplateExplicitlySet) { Assert.notNull(listenerContainer, "listenerContainer must not be null"); Assert.notNull(amqpTemplate, "'amqpTemplate' must not be null"); Assert.isNull(listenerContainer.getMessageListener(), "The listenerContainer provided to an AMQP inbound Gateway " + "must not have a MessageListener configured since " + "the adapter needs to configure its own listener implementation."); this.messageListenerContainer = listenerContainer; this.messageListenerContainer.setAutoStartup(false); this.amqpTemplate = amqpTemplate; this.amqpTemplateExplicitlySet = amqpTemplateExplicitlySet; }
Source:
public void testReadBooleanList() { List<Boolean> expected = Arrays.asList(true, false); XmlReader reader = openReader("<action><value>true</value><value>false</value></action>"); reader.next(); List<Boolean> booleans = reader.readBooleans(); assertEquals(XMLStreamConstants.END_ELEMENT, reader.getEventType()); assertEquals("action", reader.getLocalName()); assertEquals(expected, booleans); }

Target:
public void testReadBooleanList() { List<Boolean> expected = Arrays.asList(true, false); XmlReader reader = openReader("<action><value>true</value><value>false</value></action>"); reader.next(); List<Boolean> booleans = reader.readBooleans(); assertEquals(expected, booleans); }
Source:
@Test public void getWithQueryThenPathThrows() { class Example { @GET("/foo/bar/{ping}/") Call<Object> method(@Query("kit") String kit, @Path("ping") String ping) { return null; } } try { buildRequest(Example.class, "kat", "pong"); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("A @Path parameter must not come after a @Query. (parameter #2)\n" + " for method Example.method"); } }

Target:
@Test public void getWithQueryThenPathThrows() { class Example { @GET("/foo/bar/{ping}/") Call<Object> method(@Query("kit") String kit, @Path("ping") String ping) { return null; } } try { buildRequest(Example.class, "kat", "pong"); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("A @Path parameter must not come after a @Query. (parameter #2)\n" + " for method Example.method"); } }
Source:
protected Requester getTestRequester(){ return new RequesterImpl(testClient(), Serializer.defaultSerializer()); }

Target:
Requester getTestRequester() { return new RequesterImpl(testClient(), Serializer.defaultSerializer()); }
Source:
public final List<Report.TestCase> getTestCases() { return testCases; }

Target:
public final synchronized List<Report.TestCase> getTestCases() { return testCases; }