auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean checkCanBeMoveInVm() { List<VM> listVms = getVmDAO().getForImageGroup(getImage().getId()); int indList = 0; boolean canMoveDisk = true; while (listVms.size() > indList && canMoveDisk) { VM vm = listVms.get(indList++); if (VMStatus.Down != vm.getstatus()) { VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(getImage().getId(), vm.getId())); if (vmDevice.getIsPlugged()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); canMoveDisk = false; } } } return canMoveDisk; }

Target:
protected boolean checkCanBeMoveInVm() { List<VM> listVms = getVmsForImageGroup(); int indList = 0; boolean canMoveDisk = true; while (listVms.size() > indList && canMoveDisk) { VM vm = listVms.get(indList++); if (VMStatus.Down != vm.getstatus()) { VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(getImage().getId(), vm.getId())); if (vmDevice.getIsPlugged()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); canMoveDisk = false; } } } return canMoveDisk; }
Source:
static ProgrammaticConfigBuilder programmaticBuilder() { return new DefaultProgrammaticConfigBuilder(); }

Target:
static ProgrammaticDriverConfigLoaderBuilder programmaticBuilder() { return new DefaultProgrammaticDriverConfigLoaderBuilder(); }
Source:
public void addPage(Page page) { if (page.getPositionCount() == 0) { return; } positionCount += page.getPositionCount(); int pageIndex = (channels.length > 0) ? channels[0].size() : 0; for (int i = 0; i < channels.length; i++) { Block block = page.getBlock(i); channels[i].add(block); pagesMemorySize += block.getRetainedSizeInBytes(); } for (int position = 0; position < page.getPositionCount(); position++) { long sliceAddress = encodeSyntheticAddress(pageIndex, position); valueAddresses.add(sliceAddress); } if (eagerCompact) { compact(); } estimatedSize = calculateEstimatedSize(); }

Target:
public void addPage(Page page) { if (page.getPositionCount() == 0) { return; } positionCount += page.getPositionCount(); int pageIndex = (channels.length > 0) ? channels[0].size() : 0; for (int i = 0; i < channels.length; i++) { Block block = page.getBlock(i); if (eagerCompact) { block = block.copyRegion(0, block.getPositionCount()); } channels[i].add(block); pagesMemorySize += block.getRetainedSizeInBytes(); } for (int position = 0; position < page.getPositionCount(); position++) { long sliceAddress = encodeSyntheticAddress(pageIndex, position); valueAddresses.add(sliceAddress); } estimatedSize = calculateEstimatedSize(); }
Source:
public MapLocation(float x, float y) { this.x = x; this.y = y; }

Target:
public MapLocation(float x, float y) { this.x = x == Float.NaN ? 0 : x; this.y = y == Float.NaN ? 0 : y; }
Source:
private JPanel getPanelMisc() { if (panelMisc == null) { panelMisc = new JPanel(); panelMisc.setLayout(new GridBagLayout()); panelMisc.add(getInMemoryStatsEnabledField(), LayoutHelper.getGBC(0, 0, 1, 0.5)); panelMisc.add(getStatsdStatsEnabledField(), LayoutHelper.getGBC(0, 1, 1, 0.5)); JPanel statsdPanel = new JPanel(); statsdPanel.setLayout(new GridBagLayout()); statsdPanel.setBorder( BorderFactory.createTitledBorder( null, Constant.messages.getString("stats.options.statsd.panel"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); statsdPanel.add(new JLabel(Constant.messages.getString("stats.options.label.statsd.host")), LayoutHelper.getGBC(0, 1, 1, 0.5)); statsdPanel.add(this.getStatsdHostField(), LayoutHelper.getGBC(1, 1, 1, 0.5)); statsdPanel.add(new JLabel(Constant.messages.getString("stats.options.label.statsd.port")), LayoutHelper.getGBC(0, 2, 1, 0.5)); statsdPanel.add(this.getStatsdPortField(), LayoutHelper.getGBC(1, 2, 1, 0.5)); statsdPanel.add(new JLabel(Constant.messages.getString("stats.options.label.statsd.prefix")), LayoutHelper.getGBC(0, 3, 1, 0.5)); statsdPanel.add(this.getStatsdPrefixField(), LayoutHelper.getGBC(1, 3, 1, 0.5)); panelMisc.add(statsdPanel, LayoutHelper.getGBC(0, 2, 1, 1.0D)); panelMisc.add(new JLabel(), LayoutHelper.getGBC(0, 10, 1, 0.5D, 1.0D)); } return panelMisc; }

Target:
private JPanel getPanelMisc() { if (panelMisc == null) { panelMisc = new JPanel(); panelMisc.setLayout(new GridBagLayout()); panelMisc.add(getInMemoryStatsEnabledField(), LayoutHelper.getGBC(0, 0, 1, 0.5)); panelMisc.add(getStatsdStatsEnabledField(), LayoutHelper.getGBC(0, 1, 1, 0.5)); JPanel statsdPanel = new JPanel(); statsdPanel.setLayout(new GridBagLayout()); statsdPanel.setBorder( BorderFactory.createTitledBorder( null, Constant.messages.getString("stats.options.statsd.panel"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), Color.black)); statsdPanel.add(new JLabel(Constant.messages.getString("stats.options.label.statsd.host")), LayoutHelper.getGBC(0, 1, 1, 0.5)); statsdPanel.add(this.getStatsdHostField(), LayoutHelper.getGBC(1, 1, 1, 0.5)); statsdPanel.add(new JLabel(Constant.messages.getString("stats.options.label.statsd.port")), LayoutHelper.getGBC(0, 2, 1, 0.5)); statsdPanel.add(this.getStatsdPortField(), LayoutHelper.getGBC(1, 2, 1, 0.5)); statsdPanel.add(new JLabel(Constant.messages.getString("stats.options.label.statsd.prefix")), LayoutHelper.getGBC(0, 3, 1, 0.5)); statsdPanel.add(this.getStatsdPrefixField(), LayoutHelper.getGBC(1, 3, 1, 0.5)); panelMisc.add(statsdPanel, LayoutHelper.getGBC(0, 2, 1, 1.0D)); panelMisc.add(new JLabel(), LayoutHelper.getGBC(0, 10, 1, 0.5D, 1.0D)); } return panelMisc; }
Source:
public static void main( String[] args ) { String url = args.length > 0 ? args[0] : "http://localhost:8000/"; e = Endpoint.publish( url, new WSTest() ); System.out.println( "Local SOAP service started" ); }

Target:
public static void main( String[] args ) { String url = args.length >0 ? args[0] : "http://localhost:14000/"; e = Endpoint.publish( url, new WSTest() ); }
Source:
private ICommand buildResizeCommand(ChangeBoundsRequest request) { ICommand result; Command cmd = super.getResizeCommand(request); if (cmd == null) { result = null; } else { if (getHost() instanceof IGraphicalEditPart) { CompositeTransactionalCommand ctc = new CompositeTransactionalCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), cmd.getLabel()); ctc.add(new CommandProxy(cmd)); ctc.add(new ChildrenAdjustmentCommand((IGraphicalEditPart) getHost(), request)); result = ctc; } else { result = new CommandProxy(cmd); } } return result; }

Target:
private ICommand buildResizeCommand(ChangeBoundsRequest request) { ICommand result; Command cmd = super.getResizeCommand(request); if (cmd == null) { result = null; } else if (getHost() instanceof IGraphicalEditPart) { CompositeTransactionalCommand ctc = new CompositeTransactionalCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), cmd.getLabel()); ctc.add(new CommandProxy(cmd)); ctc.add(new ChildrenAdjustmentCommand((IGraphicalEditPart) getHost(), request)); result = ctc; } else { result = new CommandProxy(cmd); } return result; }
Source:
public void createNewLauncherApplicationProjectWithCustomizedSettings() { log.step("Import project start"); NewLauncherProjectWizard wizard = new NewLauncherProjectWizard(); NewLauncherProjectWizardPage wizardPage = new NewLauncherProjectWizardPage("New Launcher project"); wizard.openWizardFromShellMenu(); wizardPage.setTargetMission("rest-http"); wizardPage.setTargetRuntime("vert.x redhat"); wizardPage.setProjectName("project_2_customized_settings"); wizardPage.toggleUseDefaultLocationCheckBox(true); wizardPage.setCustomProjectLocation("/Users/zcervink/zc-custom-loc"); wizardPage.setArtifactId("my_customized_artifact_id"); wizardPage.setGroupId("my.customized.group.id"); wizardPage.setVersion("1.2.3-SNAPSHOT"); wizardPage.clickTheFinishButton(); new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(2500)); log.step("Import project finished"); checkForErrors(); }

Target:
public void createNewLauncherApplicationProjectWithCustomizedSettings() { log.step("Import project start"); NewLauncherProjectWizard wizard = new NewLauncherProjectWizard(); NewLauncherProjectWizardPage wizardPage = new NewLauncherProjectWizardPage(wizard); wizard.openWizardFromShellMenu(); wizardPage.setTargetMission("rest-http"); wizardPage.setTargetRuntime("vert.x redhat"); wizardPage.setProjectName("project_2_customized_settings"); wizardPage.toggleUseDefaultLocationCheckBox(true); wizardPage.setCustomProjectLocation("/Users/zcervink/zc-custom-loc"); wizardPage.setArtifactId("my_customized_artifact_id"); wizardPage.setGroupId("my.customized.group.id"); wizardPage.setVersion("1.2.3-SNAPSHOT"); wizard.finish(TimePeriod.getCustom(2500)); log.step("Import project finished"); checkForErrors(); }
Source:
public long getLastSchedulingCycleRuntimeDelayMs() { return System.currentTimeMillis() - lastSchedulingCycleRunTimeMs.get(); }

Target:
public long getLastSchedulingCycleRuntimeDelayMs() { return currentTimeMillis() - lastSchedulingCycleRunTimeMs.get(); }
Source:
public MockReplicaId(String storeId, long capacity, String filePath) { this.storeId = storeId; this.capacity = capacity; this.filePath = filePath; partitionId = mock(PartitionId.class); when(partitionId.toString()).thenReturn(storeId); }

Target:
MockReplicaId(String storeId, long capacity, String filePath) { this.storeId = storeId; this.capacity = capacity; this.filePath = filePath; partitionId = mock(PartitionId.class); when(partitionId.toString()).thenReturn(storeId); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; GlusterGeoRepSession other = (GlusterGeoRepSession) obj; if (masterVolumeId == null) { if (other.masterVolumeId != null) return false; } else if (!masterVolumeId.equals(other.masterVolumeId)) return false; if (sessionId == null) { if (other.sessionId != null) return false; } else if (!sessionId.equals(other.sessionId)) return false; if (sessionKey == null) { if (other.sessionKey != null) return false; } else if (!sessionKey.equals(other.sessionKey)) return false; if (slaveHostName == null) { if (other.slaveHostName != null) return false; } else if (!slaveHostName.equals(other.slaveHostName)) return false; if (slaveNodeUuid == null) { if (other.slaveNodeUuid != null) return false; } else if (!slaveNodeUuid.equals(other.slaveNodeUuid)) return false; if (slaveVolumeId == null) { if (other.slaveVolumeId != null) return false; } else if (!slaveVolumeId.equals(other.slaveVolumeId)) return false; if (slaveVolumeName == null) { if (other.slaveVolumeName != null) return false; } else if (!slaveVolumeName.equals(other.slaveVolumeName)) return false; if (status != other.status) return false; return true; }

Target:
public boolean equals(Object obj) { return ObjectUtils.checkEquals(obj, this); }
Source:
public void testGenerateInitAmazonS3WithRequiredQueryParams() throws IOException, ParseException, TemplateModelException { final Map<String,Object> testMap = new HashMap<>(); final Request testRequest = RequestConverter.toRequest(new Ds3Request( "com.spectralogic.s3.server.handler.reqhandler.amazons3.InitiateMultiPartUploadRequestHandler", HttpVerb.POST, Classification.amazons3, Requirement.REQUIRED, Requirement.REQUIRED, null, null, null, null, false, null, ImmutableList.of( new Ds3Param("Job", "java.util.UUID", true), new Ds3Param("Offset", "long", false)), ImmutableList.of()), new Ds3DocSpecImpl( ImmutableMap.of(), ImmutableMap.of())); testMap.put("requestEntry", testRequest); final CCodeGenerator codeGenerator = new CCodeGenerator(); final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); codeGenerator.processTemplate(testMap, "request-templates/InitRequest.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "ds3_request* ds3_init_initiate_multi_part_upload(const char* bucket_name, const char* object_name, const uint64_t length) {" + "\n" + " struct _ds3_request* request = _common_request_init(HTTP_POST, _build_path(\"/\", bucket_name, object_name));" + "\n" + " request->length = length;" + "\n" + "\n" + " return (ds3_request*) request;" + "\n" + "}\n"; assertEquals(expectedOutput, output); }

Target:
public void testGenerateInitAmazonS3WithRequiredQueryParams() throws IOException, ParseException, TemplateModelException { final Map<String,Object> testMap = new HashMap<>(); final Request testRequest = RequestConverter.toRequest(new Ds3Request( "com.spectralogic.s3.server.handler.reqhandler.amazons3.InitiateMultiPartUploadRequestHandler", HttpVerb.POST, Classification.amazons3, Requirement.REQUIRED, Requirement.REQUIRED, null, null, null, null, false, null, ImmutableList.of( new Ds3Param("Job", "java.util.UUID", true), new Ds3Param("Offset", "long", false)), ImmutableList.of()), new Ds3DocSpecEmptyImpl()); testMap.put("requestEntry", testRequest); final CCodeGenerator codeGenerator = new CCodeGenerator(); final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); codeGenerator.processTemplate(testMap, "request-templates/InitRequest.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "ds3_request* ds3_init_initiate_multi_part_upload(const char* bucket_name, const char* object_name, const uint64_t length) {" + "\n" + " struct _ds3_request* request = _common_request_init(HTTP_POST, _build_path(\"/\", bucket_name, object_name));" + "\n" + " request->length = length;" + "\n" + "\n" + " return (ds3_request*) request;" + "\n" + "}\n"; assertEquals(expectedOutput, output); }
Source:
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ApplicationEnvironmentPreparedEvent) { ApplicationEnvironmentPreparedEvent castEvent = (ApplicationEnvironmentPreparedEvent) event; String serviceName = castEvent.getEnvironment().getProperty(COMPONENT_NAME_KEY); if (StringUtils.isBlank(serviceName)) { serviceName = castEvent.getSpringApplication().getMainApplicationClass().getPackage().getImplementationTitle(); } LOG.info("Setting service name to {}", serviceName); CommonLogHolder.setServiceType(serviceName); } if (event instanceof ApplicationFailedEvent) { LOG.info("Terminating default logging context"); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); new BasicConfigurator().configure(loggerContext); } }

Target:
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ApplicationEnvironmentPreparedEvent) { ApplicationEnvironmentPreparedEvent castEvent = (ApplicationEnvironmentPreparedEvent) event; String serviceName = Optional.ofNullable(castEvent.getEnvironment().getProperty(OT_COMPONENT_NAME_KEY)) .orElse(Optional.ofNullable(castEvent.getEnvironment().getProperty(DMITRY_COMPONENT_NAME_KEY)) .orElse(castEvent.getSpringApplication().getMainApplicationClass().getPackage().getImplementationTitle()) ); LOG.info("Setting service name to {}", serviceName); CommonLogHolder.setServiceType(serviceName); } if (event instanceof ApplicationFailedEvent) { LOG.info("Terminating default logging context"); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); new BasicConfigurator().configure(loggerContext); } }
Source:
public static Any idOf(Object target) { if (target instanceof Entity) { Object entityId = ((Entity) target).getId(); return Identifier.pack(entityId); } if (target instanceof EventProducer) { return ((EventProducer) target).getProducerId(); } return TypeConverter.toAny(target.toString()); }

Target:
private static Any idOf(Object target) { if (target instanceof Entity) { Object entityId = ((Entity) target).getId(); return Identifier.pack(entityId); } if (target instanceof EventProducer) { return ((EventProducer) target).getProducerId(); } return Identifier.pack(target.toString()); }
Source:
public static Event clearEnrichments(Event event) { final EventContext context = event.getContext(); final EventContext.Builder resultContext = context.toBuilder() .clearEnrichment(); final EventContext.OriginCase originCase = resultContext.getOriginCase(); switch (originCase) { case EVENT_CONTEXT: resultContext.setEventContext(context.getEventContext() .toBuilder() .clearEnrichment()); break; case REJECTION_CONTEXT: resultContext.setRejectionContext(context.getRejectionContext() .toBuilder() .clearEnrichment()); break; case COMMAND_CONTEXT: break; case ORIGIN_NOT_SET: break; default: throw newIllegalStateException("Unsupported origin case is encountered: %s", originCase); } return event.toBuilder() .setContext(resultContext) .build(); }

Target:
public static Event clearEnrichments(Event event) { final EventContext context = event.getContext(); final EventContext.Builder resultContext = context.toBuilder() .clearEnrichment(); final EventContext.OriginCase originCase = resultContext.getOriginCase(); switch (originCase) { case EVENT_CONTEXT: resultContext.setEventContext(context.getEventContext() .toBuilder() .clearEnrichment()); break; case REJECTION_CONTEXT: resultContext.setRejectionContext(context.getRejectionContext() .toBuilder() .clearEnrichment()); break; case COMMAND_CONTEXT: break; case ORIGIN_NOT_SET: break; default: throw newIllegalStateException("Unsupported origin case is encountered: %s", originCase); } final Event result = event.toBuilder() .setContext(resultContext) .build(); return result; }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { Optional<CopyBlobOptions> optional = (Optional<CopyBlobOptions>) input; if (!optional.isPresent()) { return request; } HttpRequest.Builder builder = request.toBuilder(); CopyBlobOptions options = optional.get(); Optional<Map<String, String>> userMetadata = options.getUserMetadata(); if (userMetadata.isPresent()) { for (Map.Entry<String, String> entry : userMetadata.get().entrySet()) { builder.addHeader(AzureStorageHeaders.USER_METADATA_PREFIX + entry.getKey(), entry.getValue()); } } return (R) builder.build(); }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { HttpRequest.Builder builder = request.toBuilder(); CopyBlobOptions options = (CopyBlobOptions) input; Optional<Map<String, String>> userMetadata = options.getUserMetadata(); if (userMetadata.isPresent()) { for (Map.Entry<String, String> entry : userMetadata.get().entrySet()) { builder.addHeader(AzureStorageHeaders.USER_METADATA_PREFIX + entry.getKey(), entry.getValue()); } } Optional<Date> ifModifiedSince = options.getIfModifiedSince(); if (ifModifiedSince.isPresent()) { builder.addHeader(AzureStorageHeaders.COPY_SOURCE_IF_MODIFIED_SINCE, dateService.rfc822DateFormat(ifModifiedSince.get())); } Optional<Date> ifUnmodifiedSince = options.getIfUnmodifiedSince(); if (ifUnmodifiedSince.isPresent()) { builder.addHeader(AzureStorageHeaders.COPY_SOURCE_IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(ifUnmodifiedSince.get())); } Optional<String> ifMatch = options.getIfMatch(); if (ifMatch.isPresent()) { builder.addHeader(AzureStorageHeaders.COPY_SOURCE_IF_MATCH, ifMatch.get()); } Optional<String> ifNoneMatch = options.getIfNoneMatch(); if (ifNoneMatch.isPresent()) { builder.addHeader(AzureStorageHeaders.COPY_SOURCE_IF_NONE_MATCH, ifNoneMatch.get()); } return (R) builder.build(); }
Source:
ConsumerResultReturner(Method method, int consumerIndex) { this.consumerIndex = consumerIndex; elementType = GenericTypes.findGenericParameter(method.getParameters()[consumerIndex].getParameterizedType(), Consumer.class) .orElseThrow(() -> new IllegalStateException("Couldn't find concrete type for Consumer<T>")); }

Target:
ConsumerResultReturner(Method method, int consumerIndex) { this.consumerIndex = consumerIndex; elementType = method.getGenericParameterTypes()[consumerIndex]; }
Source:
protected void acquireLockAndCheckIfIpv4IsFree(Network network, String requestedIpv4Address) { IPAddressVO ipVO = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), requestedIpv4Address); if (ipVO == null) { throw new CloudRuntimeException(String.format("Cannot find IPAddressVO for guest [IPv4 address='%s'] and [network id=%s]", requestedIpv4Address, network.getId())); } IPAddressVO lockedIpVO = _ipAddressDao.acquireInLockTable(ipVO.getId()); if (lockedIpVO.getState() != IPAddressVO.State.Free) { String ipState = lockedIpVO.getState().toString(); _ipAddressDao.releaseFromLockTable(lockedIpVO.getId()); throw new CloudRuntimeException(String.format("Cannot acquire guest [IPv4 address='%s']; The Ip address is in [state=%s]", requestedIpv4Address, ipState)); } lockedIpVO.setState(IPAddressVO.State.Allocated); _ipAddressDao.update(lockedIpVO.getId(), lockedIpVO); _ipAddressDao.releaseFromLockTable(lockedIpVO.getId()); }

Target:
protected void acquireLockAndCheckIfIpv4IsFree(Network network, String requestedIpv4Address) { IPAddressVO ipVO = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), requestedIpv4Address); if (ipVO == null) { throw new InvalidParameterValueException( String.format("Cannot find IPAddressVO for guest [IPv4 address='%s'] and [network id='%s']", requestedIpv4Address, network.getId())); } try { IPAddressVO lockedIpVO = _ipAddressDao.acquireInLockTable(ipVO.getId()); validateLockedRequestedIp(ipVO, lockedIpVO); lockedIpVO.setState(IPAddressVO.State.Allocated); _ipAddressDao.update(lockedIpVO.getId(), lockedIpVO); } finally { _ipAddressDao.releaseFromLockTable(ipVO.getId()); } }
Source:
public void testCommaSeparatedStringWithValidList(){ CrossSiteOriginFilter crossSiteOriginFilter = new CrossSiteOriginFilter(new ServerConfiguration()); String commaSeparatedList = crossSiteOriginFilter.getAsCommaSeparatedList(Arrays.asList("origin", "authorization", "accept")); assertEquals("origin,authorization,accept",commaSeparatedList); }

Target:
public void testCommaSeparatedStringWithValidList(){ final CrossSiteOriginFilter crossSiteOriginFilter = new CrossSiteOriginFilter(new ServerConfiguration()); final String commaSeparatedList = crossSiteOriginFilter.getAsCommaSeparatedList(Arrays.asList("origin", "authorization", "accept")); assertEquals("origin,authorization,accept",commaSeparatedList); }
Source:
protected void doRemoveItem(Pair<T, V> item, T value, V widget) { if (items.isEmpty()) { return; } boolean removalOfLastItem = item == lastItem(); boolean maxNumberOfItemsWasExceeded = this.maxNumberOfItemsExceeded(); removeEntry(item); onRemove(value, widget); boolean shouldAddPlusButton = this.showAddButton && (removalOfLastItem || maxNumberOfItemsWasExceeded); if (shouldAddPlusButton && !items.isEmpty()) { Pair<T, V> last = lastItem(); V lastItemWidget = last.getSecond(); getEntry(lastItemWidget).appendButton(createPlusButton(last)); } if (items.isEmpty() && this.showGhost) { Pair<T, V> ghostItem = addGhostEntry(); onAdd(ghostItem.getFirst(), ghostItem.getSecond()); } }

Target:
protected void doRemoveItem(Pair<T, V> item, T value, V widget) { if (items.isEmpty()) { return; } boolean removalOfLastItem = item == lastItem(); boolean maxNumberOfItemsWasExceeded = maxNumberOfItemsExceeded(); removeEntry(item); onRemove(value, widget); boolean shouldAddPlusButton = showAddButton && (removalOfLastItem || maxNumberOfItemsWasExceeded); if (shouldAddPlusButton && !items.isEmpty()) { Pair<T, V> last = lastItem(); V lastItemWidget = last.getSecond(); getEntry(lastItemWidget).appendButton(createPlusButton(last)); } if (items.isEmpty() && this.showGhost) { Pair<T, V> ghostItem = addGhostEntry(); onAdd(ghostItem.getFirst(), ghostItem.getSecond()); } }
Source:
public int run(String[] args, PrintStream out) throws InterruptedException, IOException { List<String> paths = parseArgs(args); if (paths.isEmpty()) { out.println(USAGE); throw invalidArgs("no arguments"); } String s3Path = paths.get(0); try { initS3AFileSystem(s3Path); } catch (Exception e) { errorln("Failed to initialize S3AFileSystem from path: " + s3Path); throw e; } URI uri = toUri(s3Path); Path root; if (uri.getPath().isEmpty()) { root = new Path("/"); } else { root = new Path(uri.getPath()); } final S3AFileSystem fs = getFilesystem(); initMetadataStore(false); final MetadataStore ms = getStore(); if (ms == null || !(ms instanceof DynamoDBMetadataStore)) { errorln(s3Path + " path uses MS: " + ms); errorln(NAME + " can be only used with a DynamoDB backed s3a bucket."); errorln(USAGE); return ERROR; } final CommandFormat commandFormat = getCommandFormat(); if (commandFormat.getOpt(CHECK_FLAG)) { S3GuardFsck s3GuardFsck = new S3GuardFsck(fs, ms); try { s3GuardFsck.compareS3ToMs(fs.qualify(root)); } catch (IOException e) { errorln("Error while running the check: compareS3ToMs"); throw e; } } else { errorln("No supported operation is selected."); errorln(USAGE); return ERROR; } out.flush(); return SUCCESS; }

Target:
public int run(String[] args, PrintStream out) throws InterruptedException, IOException { List<String> paths = parseArgs(args); if (paths.isEmpty()) { out.println(USAGE); throw invalidArgs("no arguments"); } int exitValue = EXIT_SUCCESS; String s3Path = paths.get(0); try { initS3AFileSystem(s3Path); } catch (Exception e) { errorln("Failed to initialize S3AFileSystem from path: " + s3Path); throw e; } URI uri = toUri(s3Path); Path root; if (uri.getPath().isEmpty()) { root = new Path("/"); } else { root = new Path(uri.getPath()); } final S3AFileSystem fs = getFilesystem(); initMetadataStore(false); final MetadataStore ms = getStore(); if (ms == null || !(ms instanceof DynamoDBMetadataStore)) { errorln(s3Path + " path uses MS: " + ms); errorln(NAME + " can be only used with a DynamoDB backed s3a bucket."); errorln(USAGE); return ERROR; } final CommandFormat commandFormat = getCommandFormat(); if (commandFormat.getOpt(CHECK_FLAG)) { S3GuardFsck s3GuardFsck = new S3GuardFsck(fs, ms); try { final List<S3GuardFsck.ComparePair> comparePairs = s3GuardFsck.compareS3ToMs(fs.qualify(root)); if (comparePairs.size() > 0) { exitValue = EXIT_FAIL; } } catch (IOException e) { throw e; } } else { errorln("No supported operation is selected."); errorln(USAGE); return ERROR; } out.flush(); return exitValue; }
Source:
public static String computeLandingURL(String endpointURL, String devstudioOsioLandingPageSuffix) { try { URL url = new URL(endpointURL); URL landingURL = new URL(url.getProtocol(), url.getHost(), url.getPort(), devstudioOsioLandingPageSuffix); return landingURL.toExternalForm(); } catch (MalformedURLException e) { return null; } }

Target:
public static String computeLandingURL(String endpointURL, String devstudioOsioLandingPageSuffix) { try { URI uri = new URI(endpointURL); URI landingURI = new URI(uri.getScheme(), null, uri.getAuthority(), uri.getPort(), devstudioOsioLandingPageSuffix, null, null); return landingURI.toString(); } catch (URISyntaxException e) { return null; } }
Source:
private void registerContextPhases(Iterable<? extends NodeOperation> nodeOperations, Context context) { for (NodeOperation nodeOperation : nodeOperations) { if (nodeOperation.downstreamExecutionPhaseId() == NodeOperation.NO_DOWNSTREAM) { LOGGER.trace("Building context for nodeOp without downstream: {}", nodeOperation); if (createContexts(nodeOperation.executionPhase(), context)) { context.opCtx.builtNodeOperations.set(nodeOperation.executionPhase().phaseId()); } } if (ExecutionPhases.hasDirectResponseDownstream(nodeOperation.downstreamNodes())) { var executionPhase = nodeOperation.executionPhase(); CircuitBreaker breaker = breaker(); int ramAccountingBlockSizeInBytes = BlockBasedRamAccounting.calculateBlockSizeInBytes( breaker.getLimit(), 1 ); var ramAccounting = ConcurrentRamAccounting.forCircuitBreaker(executionPhase.label(), breaker); Streamer<?>[] streamers = StreamerVisitor.streamersFromOutputs(executionPhase); SingleBucketBuilder bucketBuilder = new SingleBucketBuilder( streamers, new BlockBasedRamAccounting(ramAccounting::addBytes, ramAccountingBlockSizeInBytes)); context.directResponseFutures.add(bucketBuilder.completionFuture().whenComplete((res, err) -> ramAccounting.close())); context.registerBatchConsumer(nodeOperation.downstreamExecutionPhaseId(), bucketBuilder); } } }

Target:
private void registerContextPhases(Iterable<? extends NodeOperation> nodeOperations, Context context) { for (NodeOperation nodeOperation : nodeOperations) { if (nodeOperation.downstreamExecutionPhaseId() == NodeOperation.NO_DOWNSTREAM) { LOGGER.trace("Building context for nodeOp without downstream: {}", nodeOperation); if (createContexts(nodeOperation.executionPhase(), context)) { context.opCtx.builtNodeOperations.set(nodeOperation.executionPhase().phaseId()); } } if (ExecutionPhases.hasDirectResponseDownstream(nodeOperation.downstreamNodes())) { var executionPhase = nodeOperation.executionPhase(); CircuitBreaker breaker = breaker(); int ramAccountingBlockSizeInBytes = BlockBasedRamAccounting.calculateBlockSizeInBytes( breaker.getLimit(), 1 ); var ramAccounting = new BlockBasedRamAccounting( b -> breaker.addEstimateBytesAndMaybeBreak(b, executionPhase.label()), ramAccountingBlockSizeInBytes); Streamer<?>[] streamers = StreamerVisitor.streamersFromOutputs(executionPhase); SingleBucketBuilder bucketBuilder = new SingleBucketBuilder(streamers, ramAccounting); context.directResponseFutures.add(bucketBuilder.completionFuture().whenComplete((res, err) -> ramAccounting.close())); context.registerBatchConsumer(nodeOperation.downstreamExecutionPhaseId(), bucketBuilder); } } }
Source:
public Optional<BigDecimal> getRateById(@NonNull final TaxId taxId) { final I_C_Tax tax = queryBL.createQueryBuilder(I_C_Tax.class) .addEqualsFilter(I_C_Tax.COLUMNNAME_C_Tax_ID, taxId) .create() .first(); return Optional.ofNullable(tax).map(I_C_Tax::getRate); }

Target:
public Percent getRateById(@NonNull final TaxId taxId) { final I_C_Tax tax = getTaxById(taxId); return Percent.of(tax.getRate()); }
Source:
private void checkSchemas() throws RestartBlockException { try { boolean newSchema = false; ExportRowSchema curSchema = getExportRowSchema(); if (m_curSchema == null || !m_curSchema.sameSchema(curSchema)) { if (m_logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Detected new schema:\n"); sb.append("old: "); if (m_curSchema == null) { sb.append("(none)\n"); } else { sb.append(m_curSchema).append("\n"); } sb.append("new: "); if (curSchema == null) { sb.append("(none)\n"); } else { sb.append(curSchema).append("\n"); } m_logger.debug(sb.toString()); } m_curSchema = curSchema; newSchema = true; } if (newSchema) { if (pstmt != null) { try { pstmt.close(); } catch (Exception e) finally { pstmt = null; } } m_preparedStmtStr = null; m_createTableStr = null; } } catch (Exception e) { m_logger.warn("JDBC export unable to check schemas", e); throw new RestartBlockException(true); } }

Target:
private void checkSchemas() throws RestartBlockException { try { ExportRowSchema curSchema = getExportRowSchema(); assert(curSchema != null); if (m_curGenId != curSchema.generation && !(m_curSchema != null && m_curSchema.sameSchema(curSchema))) { if (m_logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Detected new schema: ") .append("old = ") .append(m_curGenId) .append(", new = ") .append(curSchema.generation); m_logger.debug(sb); } m_curGenId = curSchema.generation; m_curSchema = curSchema; if (pstmt != null) { try { pstmt.close(); } catch (Exception e) finally { pstmt = null; } } m_preparedStmtStr = null; m_createTableStr = null; } } catch (Exception e) { m_logger.warn("JDBC export unable to check schemas", e); throw new RestartBlockException(true); } }
Source:
public void endOfAnalysis() { if(!classesNotFound.isEmpty()) { String message = ""; if(classesNotFound.size() > 50) { message = ", ..."; } LOG.warn("Classes not found during the analysis : [{}{}]", classesNotFound.stream().limit(50).collect(Collectors.joining(", ")), message); } scanners.stream() .filter(s -> s instanceof CrossFileScanner) .map(s -> (CrossFileScanner)s) .forEach(CrossFileScanner::endOfAnalysis); classLoader.close(); }

Target:
public void endOfAnalysis() { if(!classesNotFound.isEmpty()) { String message = ""; if(classesNotFound.size() > 50) { message = ", ..."; } LOG.warn("Classes not found during the analysis : [{}{}]", classesNotFound.stream().limit(50).collect(Collectors.joining(", ")), message); } executableScanners.stream() .filter(s -> s instanceof EndOfAnalysisCheck) .map(EndOfAnalysisCheck.class::cast) .forEach(EndOfAnalysisCheck::endOfAnalysis); classLoader.close(); }
Source:
public boolean act(float delta) { if (userVariable == null) { return true; } if (firstStart) { firstStart = false; writeActionFinished = false; new WriteVariableOnDeviceAction.WriteTask().execute(userVariable); } return writeActionFinished; }

Target:
public boolean act(float delta) { if (userVariable == null) { return true; } if (firstStart) { firstStart = false; writeActionFinished = false; new WriteTask().execute(userVariable); } return writeActionFinished; }
Source:
public int read() throws IOException { byte[] buffer = new byte[1]; int bytesRead = ((FSDataInputStream) in).read(mPos, buffer, 0, buffer.length); if (bytesRead > 0) { mPos += bytesRead; } return bytesRead < 0 ? bytesRead : (int) buffer[0]; }

Target:
public int read() throws IOException { byte[] buffer = new byte[1]; int bytesRead = read(buffer); if (bytesRead > 0) { return BufferUtils.byteToInt(buffer[0]); } Preconditions.checkArgument(bytesRead != 0, "Expected a non-zero value if end of stream has not been reached"); return bytesRead; }
Source:
public static String readFile(String filePath) throws IOException { try (BufferedReader br = new BufferedReader(new FileReader(filePath)); Scanner sc = new Scanner(br)) { return sc.useDelimiter("\\Z").next(); } }

Target:
public static String readFile(String filePath) throws IOException { try (Scanner sc = new Scanner(new BufferedReader(new FileReader(filePath)))) { return sc.useDelimiter("\\Z").next(); } }
Source:
final Point getCheckSize() { Point result = new Point( 0, 0 ); if( ( style & SWT.CHECK ) != 0 ) { CssImage check = getThemeAdapter().getCheckBoxImage( this ); CssBoxDimensions margin = getCheckBoxMargin(); result.x = check.width + margin.getWidth(); result.y = check.height + margin.getHeight(); } return result; }

Target:
final Point getCheckSize() { Point result = new Point( 0, 0 ); if( ( style & SWT.CHECK ) != 0 ) { CssImage checkImage = getThemeAdapter().getCheckBoxImage( this ); CssBoxDimensions margin = getCheckBoxMargin(); result.x = checkImage.width + margin.getWidth(); result.y = checkImage.height + margin.getHeight(); } return result; }
Source:
public static void represent(OutputWriter childWriter, UserToRepresent user) { childWriter.add("login_name", user.getUsername().getUsername().toString()) .add("display_name", user.getDisplayName()) .add("enabled", user.isEnabled()) .add("email", user.getEmail()) .add("email_me", user.isEmailMe()) .add("is_admin", user.isAdmin()) .add("is_individual_admin", user.isIndividualAdmin()) .addChildList("roles", listWriter -> user.getRoles().forEach(role -> listWriter.addChild(propertyWriter -> RoleRepresenter.toJSON(propertyWriter, role)))) .addChildList("checkin_aliases", user.getMatchers()); }

Target:
public static void represent(OutputWriter childWriter, UserToRepresent user) { childWriter.add("login_name", user.getUsername().getUsername().toString()) .add("display_name", user.getDisplayName()) .add("enabled", user.isEnabled()) .add("email", user.getEmail()) .add("email_me", user.isEmailMe()) .add("is_admin", user.isAdmin()) .addChildList("roles", listWriter -> user.getRoles().forEach(role -> listWriter.addChild(propertyWriter -> RoleRepresenter.toJSON(propertyWriter, role)))) .addChildList("checkin_aliases", user.getMatchers()); }
Source:
protected Node parseInline(Node previous) { char c = peek(); if (c == '\0') { return null; } Node node; switch (c) { case '\n': node = parseNewline(previous); break; case '\\': node = parseBackslash(); break; case '`': node = parseBackticks(); break; case '[': node = parseOpenBracket(); break; case '!': node = parseBang(); break; case ']': node = parseCloseBracket(); break; case '<': node = parseAutolink(); if (node == null) { node = parseHtmlInline(); } break; case '&': node = parseEntity(); break; default: boolean isDelimiter = delimiterCharacters.get(c); if (isDelimiter) { DelimiterProcessor delimiterProcessor = delimiterProcessors.get(c); node = parseDelimiters(delimiterProcessor, c); } else { node = parseString(); } break; } if (node != null) { return node; } else { index++; String literal = String.valueOf(c); return text(literal); } }

Target:
private Node parseInline(Node previous) { char c = peek(); if (c == '\0') { return null; } Node node; switch (c) { case '\n': node = parseNewline(previous); break; case '\\': node = parseBackslash(); break; case '`': node = parseBackticks(); break; case '[': node = parseOpenBracket(); break; case '!': node = parseBang(); break; case ']': node = parseCloseBracket(); break; case '<': node = parseAutolink(); if (node == null) { node = parseHtmlInline(); } break; case '&': node = parseEntity(); break; default: boolean isDelimiter = delimiterCharacters.get(c); if (isDelimiter) { DelimiterProcessor delimiterProcessor = delimiterProcessors.get(c); node = parseDelimiters(delimiterProcessor, c); } else { node = parseString(); } break; } if (node != null) { return node; } else { index++; String literal = String.valueOf(c); return text(literal); } }
Source:
public void canRetrieveBusinessServices() throws Exception { BusinessService bs = new BusinessService(); bs.setName("Application Servers"); String reductionKey = "MyReductionKey"; bs.addReductionKey(reductionKey); Long id = m_businessServiceDao.save(bs); m_businessServiceDao.flush(); String url = "/business-services"; JAXBContext context = JAXBContext.newInstance(BusinessServiceListDTO.class, BusinessServiceDTO.class); List<BusinessServiceDTO> businessServices = getXmlObject(context, url, 200, JaxbListWrapper.class).getObjects(); assertEquals(1, businessServices.size()); BusinessServiceDTO bsDTO = new BusinessServiceDTO(); bsDTO.setName(bs.getName()); bsDTO.setId(id); assertEquals(bsDTO, businessServices.get(0)); assertTrue("canRetrieveReductionKey", businessServices.get(0).getReductionKeys().contains(reductionKey)); }

Target:
public void canRetrieveBusinessServices() throws Exception { BusinessService bs = new BusinessService(); bs.setName("Application Servers"); String reductionKey = "MyReductionKey"; bs.addReductionKey(reductionKey); Long id = m_businessServiceDao.save(bs); m_businessServiceDao.flush(); String url = "/business-services"; JAXBContext context = JAXBContext.newInstance(BusinessServiceListDTO.class, BusinessServiceDTO.class); List<BusinessServiceDTO> businessServices = getXmlObject(context, url, 200, JaxbListWrapper.class).getObjects(); assertEquals(1, businessServices.size()); BusinessServiceDTO bsDTO = new BusinessServiceDTO(); bsDTO.setName(bs.getName()); bsDTO.setId(id); assertEquals(bsDTO, businessServices.get(0)); assertTrue("Expect reductionkey '" + reductionKey + "' to be present in retrieved BusinessService.", businessServices.get(0).getReductionKeys().contains(reductionKey)); }
Source:
private void batchWriteDocuments(List<String> keys, BackupDocumentWriter contentWriter) { final NodeKey metadataKey = repositoryCache.getRepositoryMetadataDocumentKey(); for (String key : keys) { if (key == null) break; if (!key.equals(metadataKey.toString())) { SchematicEntry entry = documentStore.get(key); if (entry != null) { writeToContentArea(entry, contentWriter); } } } }

Target:
private void batchWriteDocuments(List<String> keys, BackupDocumentWriter contentWriter) { for (String key : keys) { if (key == null) break; SchematicEntry entry = documentStore.get(key); if (entry != null) { writeToContentArea(entry, contentWriter); } } }
Source:
public void handleUnableToConnectDeviceResponse(final DeviceResponse deviceResponse, final Throwable t, final Serializable messageData, final DeviceResponseMessageSender responseMessageSender, final DeviceResponse deviceResponse2, final String domain, final String domainVersion, final String messageType, final boolean isScheduled, final int retryCount) { final ResponseMessageResultType result = ResponseMessageResultType.NOT_OK; final OsgpException ex = new TechnicalException(ComponentType.PROTOCOL_OSLP, t.getMessage() == null ? UNEXPECTED_EXCEPTION : t.getMessage(), t); final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage(domain, domainVersion, messageType, deviceResponse.getCorrelationUid(), deviceResponse.getOrganisationIdentification(), deviceResponse.getDeviceIdentification(), result, ex, messageData, isScheduled, retryCount); this.responseMessageSender.send(responseMessage); }

Target:
public void handleUnableToConnectDeviceResponse(final DeviceResponse deviceResponse, final Throwable t, final Serializable messageData, final DeviceResponseMessageSender responseMessageSender, final DeviceResponse deviceResponse2, final String domain, final String domainVersion, final String messageType, final boolean isScheduled, final int retryCount) { final ResponseMessageResultType result = ResponseMessageResultType.NOT_OK; final OsgpException ex = new TechnicalException(ComponentType.PROTOCOL_OSLP, StringUtils.isBlank(t.getMessage()) ? UNEXPECTED_EXCEPTION : t.getMessage(), t); final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage(domain, domainVersion, messageType, deviceResponse.getCorrelationUid(), deviceResponse.getOrganisationIdentification(), deviceResponse.getDeviceIdentification(), result, ex, messageData, isScheduled, retryCount); this.responseMessageSender.send(responseMessage); }
Source:
public void testEquals() { assertTrue(fRequest1.equals(fRequest1)); assertFalse(fRequest1.equals(fRequest2)); assertFalse(fRequest1.equals(fRequest3)); assertFalse(fRequest1.equals(fRequest4)); }

Target:
public void testEquals() { assertTrue(fRequest1.equals(fRequest1)); assertFalse(fRequest1.equals(fRequest2)); assertFalse(fRequest1.equals(fRequest3)); assertFalse(fRequest1.equals(fRequest4)); assertFalse(fRequest4.equals(fRequest5)); }
Source:
protected CreateVmVDSCommandParameters initCreateVmParams() { CreateVmVDSCommandParameters createVmParams = super.initCreateVmParams(); getVm().setRunOnce(true); RunVmOnceParams runOnceParams = getParameters(); SysPrepParams sysPrepParams = new SysPrepParams(); sysPrepParams.setSysPrepDomainName(runOnceParams.getSysPrepDomainName()); sysPrepParams.setSysPrepUserName(runOnceParams.getSysPrepUserName()); sysPrepParams.setSysPrepPassword(runOnceParams.getSysPrepPassword()); createVmParams.setSysPrepParams(sysPrepParams); createVmParams.setCloudInitParameters(runOnceParams.getCloudInitParameters()); return createVmParams; }

Target:
protected CreateVmVDSCommandParameters initCreateVmParams() { CreateVmVDSCommandParameters createVmParams = super.initCreateVmParams(); createVmParams.getVm().setRunOnce(true); RunVmOnceParams runOnceParams = getParameters(); SysPrepParams sysPrepParams = new SysPrepParams(); sysPrepParams.setSysPrepDomainName(runOnceParams.getSysPrepDomainName()); sysPrepParams.setSysPrepUserName(runOnceParams.getSysPrepUserName()); sysPrepParams.setSysPrepPassword(runOnceParams.getSysPrepPassword()); createVmParams.setSysPrepParams(sysPrepParams); createVmParams.setCloudInitParameters(runOnceParams.getCloudInitParameters()); return createVmParams; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VID other = (VID) obj; if (annotationId != other.annotationId) { return false; } if (attribute != other.attribute) { return false; } if (extensionId == null) { if (other.extensionId != null) { return false; } } else if (!extensionId.equals(other.extensionId)) { return false; } return slot == other.slot && subAnnotationId == other.subAnnotationId; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VID other = (VID) obj; if (annotationId != other.annotationId) { return false; } if (attribute != other.attribute) { return false; } if (extensionId == null) { if (other.extensionId != null) { return false; } } else if (!extensionId.equals(other.extensionId)) { return false; } if (slot != other.slot) { return false; } if (subAnnotationId != other.subAnnotationId) { return false; } return true; }
Source:
private TwitterUserDetails getUserDetails(Twitter twitter, UserRef userRef) throws TwitterException { TwitterUserDetails userDetails = new TwitterUserDetails(userRef); long userIds[] = new long[1]; userIds[0] = Long.valueOf(userRef.getUserId()); ResponseList<twitter4j.User> lookupResult = twitter.lookupUsers(userIds); if (!lookupResult.isEmpty()) { twitter4j.User twUser = lookupResult.get(0); String homepageUrl = twUser.getURLEntity().getExpandedURL(); if (homepageUrl == null) { homepageUrl = twUser.getURLEntity().getURL(); } userDetails.withProfileImage(twUser.getProfileImageURLHttps()); userDetails.withHomepageUrl(homepageUrl); userDetails.withScreenName(twUser.getScreenName()); userDetails.withFullName(twUser.getName()); } return userDetails; }

Target:
private TwitterUserDetails getUserDetails(Twitter twitter, UserRef userRef) throws TwitterException { TwitterUserDetails userDetails = new TwitterUserDetails(userRef); long userIds[] = new long[]{ Long.valueOf(userRef.getUserId()) }; ResponseList<twitter4j.User> lookupResult = twitter.lookupUsers(userIds); if (!lookupResult.isEmpty()) { twitter4j.User twUser = lookupResult.get(0); String homepageUrl = twUser.getURLEntity().getExpandedURL(); if (homepageUrl == null) { homepageUrl = twUser.getURLEntity().getURL(); } userDetails.withProfileImage(twUser.getProfileImageURLHttps()); userDetails.withHomepageUrl(homepageUrl); userDetails.withScreenName(twUser.getScreenName()); userDetails.withFullName(twUser.getName()); } return userDetails; }
Source:
public void normalizesInputSlashesToHyphens() { Param<LocalDate> localDate = Param.localDate("start", "export_start_date", "Export start date"); assertThat(localDate.map("2018/01/20").isEqual(LocalDate.of(2018, 01,20)), is(true)); }

Target:
public void normalizesInputSlashesToHyphens() { Param<LocalDate> localDate = Param.localDate("start", "export_start_date", "Export start date"); assertThat(localDate.map("2018/01/20"), is(LocalDate.of(2018, 1, 20))); }
Source:
public void onResume() { super.onResume(); final Uri uri = getIntent().getData(); if (uri != null) { final String verifier = uri.getQueryParameter("oauth_verifier"); if (!verifier.equals(lastVerifier)) { if (StringUtils.isNotBlank(verifier)) { exchangeTokens(verifier); } else { changeTokensHandler.sendEmptyMessage(NOT_AUTHENTICATED); } } lastVerifier = verifier; } }

Target:
public void onResume() { super.onResume(); final Uri uri = getIntent().getData(); if (uri == null) { return; } final String verifier = uri.getQueryParameter("oauth_verifier"); if (StringUtils.isBlank(verifier)) { changeTokensHandler.sendEmptyMessage(NOT_AUTHENTICATED); return; } if (verifier.equals(lastVerifier)) { return; } lastVerifier = verifier; exchangeTokens(verifier); }
Source:
public NettyServer start() { ServerBootstrap b = new ServerBootstrap(); if (secure) { b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new SeleniumHttpsInitializer(handler, sslCtx)); } else { b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new SeleniumHttpInitializer(handler)); } try { channel = b.bind(port).sync().channel(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new UncheckedIOException(new IOException("Start up interrupted", e)); } return this; }

Target:
public NettyServer start() { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new SeleniumHttpInitializer(handler, sslCtx)); try { channel = b.bind(port).sync().channel(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new UncheckedIOException(new IOException("Start up interrupted", e)); } return this; }