auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean validateDiscardAfterDeleteLegal(StorageDomainValidator storageDomainValidator) { if (getStoragePoolId() != null && validate(storageDomainValidator.isDiscardAfterDeleteSupportedByDcVersion(getStoragePool().getCompatibilityVersion()))) { return false; } return validate(storageDomainValidator.isDiscardAfterDeleteLegalForExistingStorageDomain()); }

Target:
private boolean validateDiscardAfterDeleteLegal(StorageDomainValidator storageDomainValidator) { if (getStoragePoolId() != null && !validate(storageDomainValidator.isDiscardAfterDeleteSupportedByDcVersion(getStoragePool().getCompatibilityVersion()))) { return false; } return validate(storageDomainValidator.isDiscardAfterDeleteLegalForExistingStorageDomain()); }
Source:
public static Unit from(@Nullable final TimeUnit timeUnit) { if (timeUnit == TimeUnit.DAYS) { return DAY; } else if (timeUnit == TimeUnit.HOURS) { return HOUR; } else if (timeUnit == TimeUnit.MINUTES) { return MINUTE; } else if (timeUnit == TimeUnit.SECONDS) { return SECOND; } else if (timeUnit == TimeUnit.MILLISECONDS) { return MILLISECOND; } else if (timeUnit == TimeUnit.MICROSECONDS) { return MICROSECOND; } else if (timeUnit == TimeUnit.NANOSECONDS) { return NANOSECOND; } else { return null; } }

Target:
@Nullable public static Unit from(@Nullable final TimeUnit timeUnit) { if (timeUnit == null) { return null; } return TIME_UNIT_MAP.get(timeUnit); }
Source:
public void addSteps(MigrationStepRegistry registry) { registry .add(2000, "Delete settings defined in sonar.properties from PROPERTIES table", DeleteSettingsDefinedInSonarDotProperties.class) .add(2001, "Add scope to rules", AddRuleScope.class) .add(2002, "Set rules scope to MAIN", SetRuleScopeToMain.class) .add(2003, "Make scope not nullable in rules", MakeScopeNotNullableInRules.class) .add(2004, "Use rule id in QPROFILE_CHANGES", UseRuleIdInQPChangesData.class) .add(2005, "Create table DEPRECATED_RULE_KEYS", CreateDeprecatedRuleKeysTable.class) .add(2006, "Clean orphans in Compute Engine child tables", CleanCeChildTablesOrphans.class) .add(2007, "Update PERMISSION_TEMPLATES.KEYS ", UpdatePermissionTooLongTemplateKeys.class) .add(2008, "Increase branch type size in PROJECT_BRANCHES", IncreaseBranchTypeSizeForPullRequest.class) .add(2009, "Add key type column in PROJECT_BRANCHES", AddKeyTypeInProjectBranches.class); ; }

Target:
public void addSteps(MigrationStepRegistry registry) { registry .add(2000, "Delete settings defined in sonar.properties from PROPERTIES table", DeleteSettingsDefinedInSonarDotProperties.class) .add(2001, "Add scope to rules", AddRuleScope.class) .add(2002, "Set rules scope to MAIN", SetRuleScopeToMain.class) .add(2003, "Make scope not nullable in rules", MakeScopeNotNullableInRules.class) .add(2004, "Use rule id in QPROFILE_CHANGES", UseRuleIdInQPChangesData.class) .add(2005, "Create table DEPRECATED_RULE_KEYS", CreateDeprecatedRuleKeysTable.class) .add(2006, "Clean orphans in Compute Engine child tables", CleanCeChildTablesOrphans.class) .add(2007, "Update PERMISSION_TEMPLATES.KEYS ", UpdatePermissionTooLongTemplateKeys.class) .add(2008, "Increase branch type size in PROJECT_BRANCHES", IncreaseBranchTypeSizeForPullRequest.class) .add(2009, "Add key_type column in PROJECT_BRANCHES", AddKeyTypeInProjectBranches.class) .add(2010, "Fill key_type column in PROJECT_BRANCHES", SetKeyTypeToBranchInProjectBranches.class) .add(2011, "Make key_type not nullable in PROJECT_BRANCHES", MakeKeyTypeNotNullableInProjectBranches.class) .add(2012, "Replace index in PROJECT_BRANCHES", ReplaceIndexInProjectBranches.class) ; }
Source:
public String parse(String text, Locale locale) throws ParseException { if (StringUtils.isNotBlank(text)) { try { lawJournalEntryCodeExtractor.extractYear(text); lawJournalEntryCodeExtractor.extractJournalNo(text); lawJournalEntryCodeExtractor.extractEntry(text); } catch (IllegalArgumentException e) { throw new WrongRequestParameterException("invalid value"); } } return text; }

Target:
public String parse(String text, Locale locale) throws ParseException { if (!lawJournalEntryCodeExtractor.isCorrectLawJournalEntryCode(text)) { throw new WrongRequestParameterException(String.format("invalid value '%s', input should be in format 'year/journal_number/entry_number'", text)); } return text; }
Source:
private static void newZipFile(File zipFile) throws URISyntaxException, IOException { if (zipFile.exists()) { if (!zipFile.delete()) { END bytes in the file) throw new IOException("Cannot delete file " + zipFile); } } Map<String, String> env = new HashMap<>(); env.put("create", Boolean.TRUE.toString()); try (FileSystem ignored = FileSystems.newFileSystem(getZipURI(zipFile), env)) { } }

Target:
private static void newZipFile(File zipFile) throws URISyntaxException, IOException { if (zipFile.exists() && !zipFile.delete()) { END bytes in the file) throw new IOException("Cannot delete file " + zipFile); } Map<String, Object> env = new HashMap<>(); env.put("create", Boolean.TRUE.toString()); try (FileSystem ignored = FileSystems.newFileSystem(getZipURI(zipFile), env)) { } }
Source:
public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request, final Client client) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (errors.hasErrors()) { return create(new ValidationProblem(errors), request); } try { return createSubscription(subscriptionBase, request, client); } catch (final DuplicatedSubscriptionException e) { try { Subscription existingSubscription = getExistingSubscription(subscriptionBase); UriComponents path = SUBSCRIPTION_PATH.buildAndExpand(existingSubscription.getId()); return status(OK).location(path.toUri()).body(existingSubscription); } catch (final ServiceUnavailableException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return create(e.asProblem(), request); } catch (final NoSuchSubscriptionException | InternalNakadiException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return create(INTERNAL_SERVER_ERROR, ex.getProblemMessage(), request); } } catch (final NakadiException e) { LOG.error("Error occurred during subscription creation", e); return create(e.asProblem(), request); } }

Target:
public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request, final Client client) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (errors.hasErrors()) { return create(new ValidationProblem(errors), request); } try { return createSubscription(subscriptionBase, request, client); } catch (final DuplicatedSubscriptionException e) { try { final Subscription existingSubscription = getExistingSubscription(subscriptionBase); final UriComponents path = SUBSCRIPTION_PATH.buildAndExpand(existingSubscription.getId()); return status(OK).location(path.toUri()).body(existingSubscription); } catch (final ServiceUnavailableException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return create(e.asProblem(), request); } catch (final NoSuchSubscriptionException | InternalNakadiException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return create(INTERNAL_SERVER_ERROR, ex.getProblemMessage(), request); } } catch (final NakadiException e) { LOG.error("Error occurred during subscription creation", e); return create(e.asProblem(), request); } }
Source:
public void registerService(ServiceDescription description) throws IOException { for (JmDNS instance : jmdnsInstances) { logger.debug("Registering new service at port (instance {})", description.serviceType, description.servicePort, instance.getName()); ServiceInfo serviceInfo = ServiceInfo.create(description.serviceType, description.serviceName, description.servicePort, 0, 0, description.serviceProperties); instance.registerService(serviceInfo); } }

Target:
public void registerService(ServiceDescription description) throws IOException { for (JmDNS instance : jmdnsInstances) { logger.debug("Registering new service at {}:{} ({})", description.serviceType, instance.getInetAddress().getHostAddress(), description.servicePort, instance.getName()); ServiceInfo serviceInfo = ServiceInfo.create(description.serviceType, description.serviceName, description.servicePort, 0, 0, description.serviceProperties); instance.registerService(serviceInfo); } }
Source:
protected void onInit() { synchronized (this.initializationMonitor) { if (this.initialized) { return; } Assert.notNull(this.trigger, "Trigger is required"); if (this.taskExecutor != null) { if (!(this.taskExecutor instanceof ErrorHandlingTaskExecutor)) { if (this.errorHandler == null) { Assert.notNull(this.getBeanFactory(), "BeanFactory is required"); this.errorHandler = new MessagePublishingErrorHandler( new BeanFactoryChannelResolver(getBeanFactory())); this.errorHandlerIsDefault = true; } this.taskExecutor = new ErrorHandlingTaskExecutor(this.taskExecutor, this.errorHandler); } } if (this.transactionSynchronizationFactory == null) { this.transactionSynchronizationFactory = new PassthroughTransactionSynchronizationFactory(); } this.initialized = true; } }

Target:
protected void onInit() { synchronized (this.initializationMonitor) { if (this.initialized) { return; } Assert.notNull(this.trigger, "Trigger is required"); if (this.taskExecutor != null) { if (!(this.taskExecutor instanceof ErrorHandlingTaskExecutor)) { if (this.errorHandler == null) { Assert.notNull(this.getBeanFactory(), "BeanFactory is required"); this.errorHandler = new MessagePublishingErrorHandler( new BeanFactoryChannelResolver(getBeanFactory())); this.errorHandlerIsDefault = true; } this.taskExecutor = new ErrorHandlingTaskExecutor(this.taskExecutor, this.errorHandler); } } if (this.transactionSynchronizationFactory == null && this.adviceChain != null) { if (this.adviceChain.stream().anyMatch(TransactionInterceptor.class::isInstance)) { this.transactionSynchronizationFactory = new PassthroughTransactionSynchronizationFactory(); } } this.initialized = true; } }
Source:
public TextEditBasedChange[] getAllChanges(){ Set<ICompilationUnit> cuSet= fMap.keySet(); ICompilationUnit[] cus= cuSet.toArray(new ICompilationUnit[cuSet.size()]); Arrays.sort(cus, (o1, o2) -> { String name1= o1.getElementName(); String name2= o2.getElementName(); return name1.compareTo(name2); }); TextEditBasedChange[] textChanges= new TextEditBasedChange[cus.length]; for (int i= 0; i < cus.length; i++) { textChanges[i]= fMap.get(cus[i]); } return textChanges; }

Target:
public TextEditBasedChange[] getAllChanges(){ Set<ICompilationUnit> cuSet= fMap.keySet(); ICompilationUnit[] cus= cuSet.toArray(new ICompilationUnit[cuSet.size()]); Arrays.sort(cus, Comparator.comparing(ICompilationUnit::getElementName)); TextEditBasedChange[] textChanges= new TextEditBasedChange[cus.length]; for (int i= 0; i < cus.length; i++) { textChanges[i]= fMap.get(cus[i]); } return textChanges; }
Source:
public synchronized void init() { if (hasBeenInitialized) { throw new IllegalStateException("This map has already been initialized."); } List<Binding<?>> rootResourceBindings = new ArrayList<>(); for (Binding<?> binding : injector.getBindings().values()) { Type type = binding.getKey().getTypeLiteral().getType(); if (type instanceof Class) { Class<?> beanClass = (Class) type; if (GetRestful.isRootResource(beanClass)) { rootResourceBindings.add(binding); } } } for (Binding<?> binding : rootResourceBindings) { Class<?> clazz = (Class) binding.getKey().getTypeLiteral().getType(); if (Proxy.isProxyClass(clazz)) { for (Class<?> intf : clazz.getInterfaces()) { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(intf); registerConcreteMethods(resourceClass, clazz); } } else { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(clazz); registerConcreteMethods(resourceClass, clazz); } } lock(); }

Target:
public synchronized MethodLocator init() { if (hasBeenInitialized) { throw new IllegalStateException("This map has already been initialized."); } List<Binding<?>> rootResourceBindings = new ArrayList<>(); for (Binding<?> binding : injector.getBindings().values()) { Type type = binding.getKey().getTypeLiteral().getType(); if (type instanceof Class) { Class<?> beanClass = (Class) type; if (GetRestful.isRootResource(beanClass)) { rootResourceBindings.add(binding); } } } for (Binding<?> binding : rootResourceBindings) { Class<?> clazz = (Class) binding.getKey().getTypeLiteral().getType(); if (Proxy.isProxyClass(clazz)) { for (Class<?> intf : clazz.getInterfaces()) { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(intf); registerConcreteMethods(resourceClass, clazz); } } else { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(clazz); registerConcreteMethods(resourceClass, clazz); } } lock(); return this; }
Source:
public void visit(VarRefNode varRefNode) { String name = varRefNode.getName(); if (name.equals("this")) { mv.visitVarInsn(ALOAD, 0); } else if (ScopeStack.isSpecial(name)) { String object; switch (name) { case "true": object = "True"; break; case "false": object = "False"; break; default: object = "Nil"; break; } mv.visitTypeInsn(NEW, object); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, object, "<init>", "()V", false); } else { try { VarDeclNode decl = scope.getVarDeclNode(varRefNode.getName()); if (decl.isMethodVariable()) { mv.visitVarInsn(ALOAD, 1 + decl.getOffset()); } else if (decl.isClassField()) { mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, ((ClazzNode) decl.getScope().getNode()).getName(), decl.getName(), "Lorg/twnc/runtime/BObject;"); } else { mv.visitTypeInsn(NEW, "Nil"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "Nil", "<init>", "()V", false); } } catch (VariableNotDeclaredException e) { e.printStackTrace(); } } super.visit(varRefNode); }

Target:
public void visit(VarRefNode varRefNode) { String name = varRefNode.getName(); if (name.equals("this")) { mv.visitVarInsn(ALOAD, 0); } else if (ScopeStack.isSpecial(name)) { String object; switch (name) { case "true": object = "True"; break; case "false": object = "False"; break; default: object = "Nil"; break; } mv.visitTypeInsn(NEW, object); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, object, "<init>", "()V", false); } else { try { VarDeclNode decl = scope.getVarDeclNode(varRefNode.getName()); if (decl.isMethodVariable()) { mv.visitVarInsn(ALOAD, 1 + decl.getOffset()); } else if (decl.isClassField()) { mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, ((ClazzNode) decl.getScope().getNode()).getName(), decl.getName(), "Lorg/twnc/runtime/BObject;"); } else { throw new UnknownVariableDeclarationLocation(); } } catch (VariableNotDeclaredException e) { e.printStackTrace(); } } super.visit(varRefNode); }
Source:
private EnvironmentVariableContext getEnvironmentVariableContextFromEnvironment(String pipelineName) { EnvironmentConfig environmentConfig = environmentConfigService.environmentForPipeline(pipelineName); if (environmentConfig == null) { return null; } secretParamResolver.resolve(environmentConfig); EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext(); environmentConfig.getVariables().forEach(variable -> { String resolvedValue = variable.getSecretParams().substitute(variable.getValue()); environmentVariableContext.setProperty(variable.getName(), resolvedValue, variable.isSecure() || variable.hasSecretParams()); }); return environmentVariableContext; }

Target:
private EnvironmentVariableContext getEnvironmentVariableContextFromEnvironment(String pipelineName) { EnvironmentConfig environmentConfig = environmentConfigService.environmentForPipeline(pipelineName); if (environmentConfig == null) { return null; } secretParamResolver.resolve(environmentConfig); EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext(); environmentConfig.getVariables().forEach(variable -> { environmentVariableContext.setProperty(variable.getName(), variable.valueForCommandline(), variable.isSecure() || variable.hasSecretParams()); }); return environmentVariableContext; }
Source:
public void shouldHaveEnglishAsFirstAvailableLocale() { List<String> locales = LocaleUtils.getAvailableLocales(); String defaultLocale = locales.get(0); assertThat(defaultLocale, is(equalTo("en_GB"))); }

Target:
public void shouldHaveEnglishAsFirstAvailableLocale() { List<String> locales = LocaleUtils.getAvailableLocales(); String firstAvailableLocale = locales.get(0); assertThat(firstAvailableLocale, is(equalTo("en_GB"))); }
Source:
public void testNodeSuspendedReturnsTrueWhenSuspended() { expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce(); expect(node.getBackendStatus()).andReturn(null).atLeastOnce(); replay(node); replay(computeService); AtomicNodeSuspended nodeRunning = new AtomicNodeSuspended(computeService); AtomicReference<NodeMetadata> reference = Atomics.newReference(node); Assert.assertTrue(nodeRunning.apply(reference)); Assert.assertEquals(reference.get(), node); }

Target:
public void testNodeSuspendedReturnsTrueWhenSuspended() { expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce(); expect(node.getBackendStatus()).andReturn(null).atLeastOnce(); replay(node, computeService); AtomicNodeSuspended nodeSuspended = new AtomicNodeSuspended(computeService); AtomicReference<NodeMetadata> reference = Atomics.newReference(node); Assert.assertTrue(nodeSuspended.apply(reference)); Assert.assertEquals(reference.get(), node); }
Source:
public void testVanillaScenario() throws Exception { final AnalysisResultFuture result; final SparkConf sparkConf = new SparkConf().setMaster("local").setAppName("DCTest - " + getName()); final JavaSparkContext sparkContext = new JavaSparkContext(sparkConf); try { final SparkJobContext sparkJobContext = new SparkJobContext(sparkContext, "src/test/resources/conf_local.xml", "src/test/resources/vanilla-job.analysis.xml"); final AnalysisJob job = sparkJobContext.getAnalysisJob(); assertNotNull(job); final SparkAnalysisRunner sparkAnalysisRunner = new SparkAnalysisRunner(sparkContext, sparkJobContext); result = sparkAnalysisRunner.run(job); } finally { sparkContext.close(); } if (result.isErrornous()) { throw (Exception) result.getErrors().get(0); } assertEquals(2, result.getResultMap().size()); final List<AnalyzerResult> results = result.getResults(); assertEquals(2, results.size()); final StringAnalyzerResult stringAnalyzerResult = result.getResults(StringAnalyzerResult.class).get(0); assertEquals("[MetaModelInputColumn[resources.person_names.txt.company]]", Arrays.toString(stringAnalyzerResult.getColumns())); final int rowCount = stringAnalyzerResult.getRowCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, rowCount); final int upperCaseChars = stringAnalyzerResult.getEntirelyUpperCaseCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, upperCaseChars); }

Target:
public void testVanillaScenario() throws Exception { final AnalysisResultFuture result; final SparkConf sparkConf = new SparkConf().setMaster("local").setAppName("DCTest - " + getName()); final JavaSparkContext sparkContext = new JavaSparkContext(sparkConf); try { final SparkJobContext sparkJobContext = new SparkJobContext(sparkContext, "src/test/resources/conf_local.xml", "src/test/resources/vanilla-job.analysis.xml"); final AnalysisJob job = sparkJobContext.getAnalysisJob(); assertNotNull(job); assertEquals("vanilla-job", sparkJobContext.getAnalysisJobName()); final SparkAnalysisRunner sparkAnalysisRunner = new SparkAnalysisRunner(sparkContext, sparkJobContext); result = sparkAnalysisRunner.run(job); } finally { sparkContext.close(); } if (result.isErrornous()) { throw (Exception) result.getErrors().get(0); } assertEquals(2, result.getResultMap().size()); final List<AnalyzerResult> results = result.getResults(); assertEquals(2, results.size()); final StringAnalyzerResult stringAnalyzerResult = result.getResults(StringAnalyzerResult.class).get(0); assertEquals("[MetaModelInputColumn[resources.person_names.txt.company]]", Arrays.toString(stringAnalyzerResult.getColumns())); final int rowCount = stringAnalyzerResult.getRowCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, rowCount); final int upperCaseChars = stringAnalyzerResult.getEntirelyUpperCaseCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, upperCaseChars); }
Source:
public void withChecksContext() throws Exception { WorkflowJob j = rule.jenkins.createProject(WorkflowJob.class, "singleStep"); j.setDefinition(new CpsFlowDefinition("stage('first') {\n" + " node {\n" + " withChecks('With Checks') {\n"+ " def results = junit(testResults: '*.xml')\n" + " assert results.totalCount == 6\n" + " }\n" + " }\n" + "}\n", true)); FilePath ws = rule.jenkins.getWorkspaceFor(j); FilePath testFile = requireNonNull(ws).child("test-result.xml"); testFile.copyFrom(TestResultTest.class.getResource("junit-report-1463.xml")); rule.buildAndAssertSuccess(j); List<ChecksDetails> checksDetails = getDetails(); assertThat(checksDetails.size(), is(2)); assertThat(checksDetails.get(0).getName().get(), is("With Checks")); assertThat(checksDetails.get(0).getStatus(), is(ChecksStatus.IN_PROGRESS)); assertThat(checksDetails.get(0).getConclusion(), is(ChecksConclusion.NONE)); assertThat(checksDetails.get(1).getName().get(), is("With Checks")); assertThat(checksDetails.get(1).getStatus(), is(ChecksStatus.COMPLETED)); assertThat(checksDetails.get(1).getConclusion(), is(ChecksConclusion.SUCCESS)); }

Target:
public void withChecksContext() throws Exception { WorkflowJob j = rule.jenkins.createProject(WorkflowJob.class, "singleStep"); j.setDefinition(new CpsFlowDefinition("stage('first') {\n" + " node {\n" + " withChecks('With Checks') {\n"+ " def results = junit '*.xml'\n" + " assert results.totalCount == 6\n" + " }\n" + " }\n" + "}\n", true)); FilePath ws = rule.jenkins.getWorkspaceFor(j); FilePath testFile = requireNonNull(ws).child("test-result.xml"); testFile.copyFrom(TestResultTest.class.getResource("junit-report-1463.xml")); rule.buildAndAssertSuccess(j); List<ChecksDetails> checksDetails = getDetails(); assertThat(checksDetails.size(), is(2)); assertThat(checksDetails.get(0).getName().get(), is("With Checks")); assertThat(checksDetails.get(0).getStatus(), is(ChecksStatus.IN_PROGRESS)); assertThat(checksDetails.get(0).getConclusion(), is(ChecksConclusion.NONE)); assertThat(checksDetails.get(1).getName().get(), is("With Checks")); assertThat(checksDetails.get(1).getStatus(), is(ChecksStatus.COMPLETED)); assertThat(checksDetails.get(1).getConclusion(), is(ChecksConclusion.SUCCESS)); }
Source:
public Date getEndDate() { if (null == dataFile) { return null; } LocalDateTime date = dataFile.getEndDate(); if (null == date) { return null; } return Date.from(date.atZone(ZoneId.of("UTC")).toInstant()); }

Target:
public Date getEndDate() { Date date = null; if (null != dataFile) { LocalDateTime localDate = dataFile.getEndDate(); if (null != localDate) { date = Date.from(localDate.atZone(ZoneId.of("UTC")).toInstant()); } } return date; }
Source:
public <T extends LwM2mResponse> void send(Client destination, String requestTicket, DownlinkRequest<T> request) { LOG.trace("send(requestTicket={})", requestTicket); @SuppressWarnings("unchecked") DownlinkRequest<LwM2mResponse> castedDownlinkRequest = (DownlinkRequest<LwM2mResponse>) request; LOG.trace("Sending request with queue mode", castedDownlinkRequest); String endpoint = destination.getEndpoint(); readWriteLock.readLock().lock(); try { if (clientRegistry.get(endpoint) != null) { QueuedRequest queuedRequest = new QueuedRequestImpl(endpoint, castedDownlinkRequest, requestTicket); messageStore.add(queuedRequest); if (clientStatusTracker.startClientReceiving(endpoint)) { processingExecutor.execute(newRequestSendingTask(endpoint)); } } else { String message = String.format("message received in Queue Mode for the unknown client [%s]", endpoint); LOG.warn(message); throw new RequestCanceledException(message); } } finally { readWriteLock.readLock().unlock(); } }

Target:
public <T extends LwM2mResponse> void send(Client destination, String requestTicket, DownlinkRequest<T> request) { LOG.trace("send(requestTicket={})", requestTicket); @SuppressWarnings("unchecked") DownlinkRequest<LwM2mResponse> castedDownlinkRequest = (DownlinkRequest<LwM2mResponse>) request; LOG.trace("Sending request with queue mode", castedDownlinkRequest); String endpoint = destination.getEndpoint(); readWriteLock.readLock().lock(); try { if (clientRegistry.get(endpoint) != null) { QueuedRequest queuedRequest = new QueuedRequestImpl(endpoint, castedDownlinkRequest, requestTicket); messageStore.add(queuedRequest); if (clientStatusTracker.startClientReceiving(endpoint)) { processingExecutor.execute(newRequestSendingTask(endpoint)); } } else { String message = String.format("message received in Queue Mode for the unknown client [%s]", endpoint); LOG.warn(message); processingExecutor.execute(new ResponseProcessingTask(destination, requestTicket, responseListeners, new RequestCanceledException(message))); } } finally { readWriteLock.readLock().unlock(); } }
Source:
private void backoff(Exception e) { if (e != null) { ZLog.logException(e); } failures += 1; long backoff = (long) (Math.exp(failures / 2.0) * 1000); Log.e(ASYNC_GET_EVENTS, "Failure " + failures + ", sleeping for " + backoff); if (failures == 2) { mActivity.showConnectivitySnackBar(Constants.STATUS_NOT_CONNECTED); } SystemClock.sleep(backoff); }

Target:
private void backoff(Exception e) { if (e != null) { ZLog.logException(e); } failures += 1; long backoff = (long) (Math.exp(failures / 2.0) * 1000); Log.e(ASYNC_GET_EVENTS, "Failure " + failures + ", sleeping for " + backoff); if (failures == Constants.MAX_CONNECTION_FAILURE_COUNT) { mActivity.showConnectivitySnackBar(Constants.STATUS_NOT_CONNECTED); } SystemClock.sleep(backoff); }
Source:
public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { Request<?> request = (Request<?>) msg; if (request instanceof BinaryRequest) { ((BinaryRequest) request).setOpaque(requestSequenceId.incrementAndGet()); } outstanding.add(request); super.write(ctx, msg, promise); }

Target:
public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { Request<?> request = (Request<?>) msg; if (request instanceof BinaryRequest) { ((BinaryRequest) request).setOpaque(++requestSequenceId); } outstanding.add(request); super.write(ctx, msg, promise); }
Source:
public Map<String, Object> getSpecificEventStyle(ITimeEvent event) { if (event instanceof SpanMarkerEvent) { SpanMarkerEvent markerEvent = (SpanMarkerEvent) event; Map<String, Object> ret = new HashMap<>(); ret.put(ITimeEventStyleStrings.fillColor(), RGBAUtil.fromRGBA(markerEvent.getColor())); String type = markerEvent.getType(); String fillStyle = ITimeEventStyleStrings.symbolStyle(); if (type.contains(ERROR_KIND)) { ret.put(fillStyle, IYAppearance.SymbolStyle.PLUS); } else if (type.contains(ERROR_OBJECT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CROSS); } else if (type.contains(EVENT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CIRCLE); } else if (type.contains(MESSAGE)) { ret.put(fillStyle, IYAppearance.SymbolStyle.TRIANGLE); } else if (type.contains(STACK)) { ret.put(fillStyle, IYAppearance.SymbolStyle.INVERTED_TRIANGLE); } else { ret.put(fillStyle, IYAppearance.SymbolStyle.DIAMOND); } ret.put(ITimeEventStyleStrings.heightFactor(), 0.5f); ret.put(ITimeEventStyleStrings.label(), markerEvent.getLabel()); return ret; } return super.getSpecificEventStyle(event); }

Target:
public Map<String, Object> getSpecificEventStyle(ITimeEvent event) { if (event instanceof SpanMarkerEvent) { SpanMarkerEvent markerEvent = (SpanMarkerEvent) event; Map<String, Object> ret = new HashMap<>(); ret.put(ITimeEventStyleStrings.fillColor(), RGBAUtil.fromRGBA(markerEvent.getColor())); String type = markerEvent.getType(); String fillStyle = ITimeEventStyleStrings.symbolStyle(); if (type.contains(ERROR_KIND)) { ret.put(fillStyle, IYAppearance.SymbolStyle.PLUS); } else if (type.contains(ERROR_OBJECT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CROSS); } else if (type.contains(EVENT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CIRCLE); } else if (type.contains(MESSAGE)) { ret.put(fillStyle, IYAppearance.SymbolStyle.TRIANGLE); } else if (type.contains(STACK)) { ret.put(fillStyle, IYAppearance.SymbolStyle.INVERTED_TRIANGLE); } else { ret.put(fillStyle, IYAppearance.SymbolStyle.DIAMOND); } ret.put(ITimeEventStyleStrings.heightFactor(), 0.5f); ret.put(ITimeEventStyleStrings.label(), markerEvent.getLabel()); return ret; } Map<String, Object> specificEventStyle = super.getSpecificEventStyle(event); return specificEventStyle; }
Source:
public Permission getRequiredPermission() { return Jenkins.MANAGE; }

Target:
public Permission getRequiredPermission() { return Jenkins.ADMINISTER; }
Source:
public static <T> Stream<T> stream(Optional<T> optional) { if (optional.isPresent()) { return Stream.of(optional.get()); } return Stream.empty(); }

Target:
public static <T> Stream<T> stream(Optional<T> optional) { return optional.map(Stream::of).orElseGet(Stream::empty); }
Source:
public T deleteHostedVersion(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "version", required = true) @QueryParam("version") String version) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUserCanUpdate(user, entry); checkHosted(entry); if (entry.getActualDefaultVersion().getName().equals(version)) { Optional<U> max = entry.getWorkflowVersions().stream().filter(v -> !Objects.equals(v.getName(), version)) .max(Comparator.comparingLong(ver -> ver.getDate() != null ? ver.getDate().getTime() : ver.getDbCreateDate().getTime())); entry.setActualDefaultVersion(max.orElse(null)); } entry.getWorkflowVersions().removeIf(v -> Objects.equals(v.getName(), version)); PublicStateManager.getInstance().handleIndexUpdate(entry, StateManagerMode.UPDATE); return entry; }

Target:
public T deleteHostedVersion(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "version", required = true) @QueryParam("version") String version) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUserCanUpdate(user, entry); checkHosted(entry); if (entry.getActualDefaultVersion().getName().equals(version)) { Optional<U> max = entry.getWorkflowVersions().stream().filter(v -> !Objects.equals(v.getName(), version)) .max(Comparator.comparingLong(ver -> ver.getDbCreateDate().getTime())); entry.setActualDefaultVersion(max.orElse(null)); } entry.getWorkflowVersions().removeIf(v -> Objects.equals(v.getName(), version)); PublicStateManager.getInstance().handleIndexUpdate(entry, StateManagerMode.UPDATE); return entry; }
Source:
private CppCompileActionBuilder initializeCompileAction(Artifact sourceArtifact) { CppCompileActionBuilder builder = new CppCompileActionBuilder( actionConstructionContext, grepIncludes, ccToolchain, configuration); builder.setSourceFile(sourceArtifact); builder.setCcCompilationContext(ccCompilationContext); builder.setCoptsFilter(coptsFilter); builder.setFeatureConfiguration(featureConfiguration); if (ruleContext != null) { builder.addExecutionInfo(TargetUtils.getExecutionInfo(ruleContext.getRule(), ruleContext.isAllowTagsPropagation())); } return builder; }

Target:
private CppCompileActionBuilder initializeCompileAction(Artifact sourceArtifact) { CppCompileActionBuilder builder = new CppCompileActionBuilder( actionConstructionContext, grepIncludes, ccToolchain, configuration); builder.setSourceFile(sourceArtifact); builder.setCcCompilationContext(ccCompilationContext); builder.setCoptsFilter(coptsFilter); builder.setFeatureConfiguration(featureConfiguration); builder.addExecutionInfo(executionInfo); return builder; }
Source:
public void unbind(String name) { if (name == null || name.isEmpty()) { throw MessagingLogger.ROOT_LOGGER.cannotUnbindJndiName(); } final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name); ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName()); if (bindingService == null) { ROOT_LOGGER.debugf("Cannot unbind %s since no binding exists with that name", name); return; } final UninterruptibleCountDownLatch latch = new UninterruptibleCountDownLatch(1); bindingService.addListener(new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) { ROOT_LOGGER.unboundJndiName(bindInfo.getAbsoluteJndiName()); latch.countDown(); } } }); try { bindingService.setMode(ServiceController.Mode.REMOVE); } finally { latch.awaitUninterruptibly(); } }

Target:
public void unbind(String name) { if (name == null || name.isEmpty()) { throw MessagingLogger.ROOT_LOGGER.cannotUnbindJndiName(); } final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name); ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName()); if (bindingService == null) { ROOT_LOGGER.debugf("Cannot unbind %s since no binding exists with that name", name); return; } final CountDownLatch latch = new CountDownLatch(1); bindingService.addListener(new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) { ROOT_LOGGER.unboundJndiName(bindInfo.getAbsoluteJndiName()); latch.countDown(); } } }); try { bindingService.setMode(ServiceController.Mode.REMOVE); } finally { try { latch.await(); } catch (InterruptedException ie) { ROOT_LOGGER.failedToUnbindJndiName(name, 5, SECONDS.toString().toLowerCase(Locale.US)); } } }
Source:
private static boolean appendPort(final String scheme, final int port) { return port > -1 && ((HTTP.equals(scheme) && port != 80) || (HTTPS.equals(scheme) && port != 443)); }

Target:
private static boolean appendPort(final String scheme, final int port) { return port > -1 && ((HTTP.equalsIgnoreCase(scheme) && port != 80) || (HTTPS.equalsIgnoreCase(scheme) && port != 443)); }
Source:
private static String getProperty(String property) { try { return SystemReader.getInstance().getProperty(property); } catch (SecurityException e) { return null; } }

Target:
private static String getProperty(String property) { try { return SystemReader.getInstance().getProperty(property); } catch (SecurityException e) { LOG.warn(JGitText.get().failedReadHttpsProtocols, e); return null; } }
Source:
public boolean isEmpty() { return size > 0; }

Target:
public boolean isEmpty() { return size == 0; }
Source:
public TestTemplateTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod) { super(uniqueId, determineDisplayName(Preconditions.notNull(templateMethod, "Method must not be null"), MethodTestDescriptor::generateDefaultDisplayName)); this.testClass = Preconditions.notNull(testClass, "Class must not be null"); this.templateMethod = templateMethod; setSource(new MethodSource(templateMethod)); }

Target:
public TestTemplateTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod) { super(uniqueId, testClass, templateMethod); }
Source:
private void getPathsAndIndex(RevCommit bCommit) throws Exception { RevTree bTree = bCommit.getTree(); try { RevTree aTree = aFor(bCommit, walk); if (aTree == null) { return; } DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE); try { df.setRepository(repo); List<ChangeData> cds = byId.get(bCommit); if (!cds.isEmpty()) { List<String> paths = getPaths(df.scan(aTree, bTree)); for (ChangeData cd : cds) { try { cd.setCurrentFilePaths(paths); indexer.indexTask(cd).call(); done.update(1); if (verbose) { System.out.println("Reindexed change " + cd.getId()); } } catch (Exception e) { log.warn("Failed to index change " + cd.getId(), e); if (verbose) { System.out.println("Failed to index change " + cd.getId()); } failed.update(1); } } } } finally { df.release(); } } catch (Exception e) { log.warn("Failed to index changes for commit " + bCommit.name(), e); if (verbose) { System.out.println("Failed to index changes for commit " + bCommit.name()); } failed.update(1); } }

Target:
private void getPathsAndIndex(RevCommit bCommit) throws Exception { RevTree bTree = bCommit.getTree(); try { RevTree aTree = aFor(bCommit, walk); if (aTree == null) { return; } DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE); try { df.setRepository(repo); List<ChangeData> cds = byId.get(bCommit); if (!cds.isEmpty()) { List<String> paths = getPaths(df.scan(aTree, bTree)); for (ChangeData cd : cds) { cd.setCurrentFilePaths(paths); indexer.indexTask(cd).call(); done.update(1); if (verbose) { System.out.println("Reindexed change " + cd.getId()); } } } } finally { df.release(); } } catch (Exception e) { fail("Failed to index commit " + bCommit.name(), e); } }
Source:
private List<Person> createModel() { List<Person> elements = new ArrayList<Person>(4); elements.add(new Person("Tom", "Schindl", "tom.schindl@bestsolution.at")); elements.add(new Person("Boris", "Bokowski", "Boris_Bokowski@ca.ibm.com")); elements.add(new Person("Tod", "Creasey", "Tod_Creasey@ca.ibm.com")); elements.add(new Person("Wayne", "Beaton", "wayne@eclipse.org")); return elements; }

Target:
private List<Person> createModel() { List<Person> elements = new ArrayList<Person>(4); elements.add(new Person("Tom", "Schindl", "tom.schindl@bestsolution.at")); elements.add(new Person("Tod", "Creasey", "Tod_Creasey@ca.ibm.com")); elements.add(new Person("Wayne", "Beaton", "wayne@eclipse.org")); return elements; }
Source:
public I dispatch(CommandEnvelope cmd) { checkNotNull(cmd); I id = with(cmd.tenantId()).evaluate(() -> { I target = route(cmd); return target; }); inbox.send(cmd).toHandler(id); return id; }

Target:
public I dispatch(CommandEnvelope cmd) { checkNotNull(cmd); I id = route(cmd); inbox.send(cmd).toHandler(id); return id; }
Source:
public default LabeledText getCRCBinary() { return new LabeledText(getCDKDefaultSection(), "crc binary file: "); }

Target:
public default LabeledText getCRCBinary() { return new LabeledText(getCDKDefaultSection(), CDKLabel.Labels.CRC_BINARY_EDITOR); }
Source:
ReactorCloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, TokenProvider tokenProvider) { return ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); }

Target:
public ReactorCloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, TokenProvider tokenProvider) { return ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("GetRequest["); sb.append("ListOfBlobIDs=").append(blobIds); if(partitionId!=null) { sb.append(", ").append("PartitionId=").append(partitionId); } else { sb.append(", ").append("PartitionId=Null"); } if(flags!=null) { sb.append(", ").append("MessageFormatFlags=").append(flags); } else { sb.append(", ").append("MessageFormatFlags=Null"); } sb.append(", ").append("TotalIdSize=").append(totalIdSize); sb.append("]"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("GetRequest["); sb.append("ListOfBlobIDs=").append(blobIds); sb.append(", ").append("PartitionId=").append(partitionId); sb.append(", ").append("MessageFormatFlags=").append(flags); sb.append(", ").append("TotalIdSize=").append(totalIdSize); sb.append("]"); return sb.toString(); }
Source:
private void processTask(Task task) { if (task.getProcessingStatusEnum().equals(TaskStatus.OPEN)) { task.setProcessingStatusEnum(TaskStatus.INWORK); task.setEditTypeEnum(TaskEditType.MANUAL_MULTI); task.setProcessingTime(new Date()); User user = getUser(); serviceManager.getTaskService().replaceProcessingUser(task, user); if (task.getProcessingBegin() == null) { task.setProcessingBegin(new Date()); } if (task.isTypeImagesRead() || task.isTypeImagesWrite()) { try { new File(serviceManager.getProcessService().getImagesOrigDirectory(false, task.getProcess())); } catch (Exception e1) { Helper.setErrorMessage("Error retrieving image directory: ", logger, e1); } task.setProcessingTime(new Date()); serviceManager.getTaskService().replaceProcessingUser(task, user); this.myDav.downloadToHome(task.getProcess(), !task.isTypeImagesWrite()); } } try { this.serviceManager.getProcessService().save(task.getProcess()); } catch (DataException e) { Helper.setErrorMessage("errorSaving", new Object[] {Helper.getTranslation("prozess") }, logger, e); } }

Target:
private void processTask(Task task) { if (task.getProcessingStatusEnum().equals(TaskStatus.OPEN)) { task.setProcessingStatusEnum(TaskStatus.INWORK); task.setEditTypeEnum(TaskEditType.MANUAL_MULTI); task.setProcessingTime(new Date()); User user = getUser(); serviceManager.getTaskService().replaceProcessingUser(task, user); if (task.getProcessingBegin() == null) { task.setProcessingBegin(new Date()); } if (task.isTypeImagesRead() || task.isTypeImagesWrite()) { try { URI imagesOrigDirectory = serviceManager.getProcessService().getImagesOrigDirectory(false, task.getProcess()); if (! serviceManager.getFileService().fileExist(imagesOrigDirectory)) { Helper.setErrorMessage("Directory doesn't exists!", new Object[] {imagesOrigDirectory}); } } catch (Exception e) { Helper.setErrorMessage("Error retrieving image directory: ", logger, e); } task.setProcessingTime(new Date()); serviceManager.getTaskService().replaceProcessingUser(task, user); this.myDav.downloadToHome(task.getProcess(), !task.isTypeImagesWrite()); } } try { this.serviceManager.getProcessService().save(task.getProcess()); } catch (DataException e) { Helper.setErrorMessage("errorSaving", new Object[] {Helper.getTranslation("prozess") }, logger, e); } }
Source:
public void testToJsonWithLengthLimitComplex() throws JsonLengthLimitExceededException { JsonCodec<List<ImmutablePerson>> jsonCodec = listJsonCodec(jsonCodec(ImmutablePerson.class)); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); List<ImmutablePerson> people = Collections.nCopies(10, person); assertLengthLimitExceeded(jsonCodec, people, 10000); jsonCodec.toJsonWithLengthLimit(people, 10382); }

Target:
public void testToJsonWithLengthLimitComplex() { JsonCodec<List<ImmutablePerson>> jsonCodec = listJsonCodec(jsonCodec(ImmutablePerson.class)); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); List<ImmutablePerson> people = Collections.nCopies(10, person); assertFalse(jsonCodec.toJsonWithLengthLimit(people, 0).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(people, 5000).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(people, 10381).isPresent()); jsonCodec.toJsonWithLengthLimit(people, 10382); }
Source:
public boolean put(String lookupName, final LookupExtractorFactory lookupExtractorFactory) { synchronized (lock) { assertStarted(); if (!lookupExtractorFactory.start()) { throw new ISE("start method returned false for lookup [%s]", lookupName); } return (null == lookupMap.putIfAbsent(lookupName, lookupExtractorFactory)); } }

Target:
public boolean put(String lookupName, final LookupExtractorFactory lookupExtractorFactory) { synchronized (lock) { assertStarted(); if (lookupMap.containsKey(lookupName)) { LOGGER.warn("lookup [%s] is not add, another lookup with the same name already exist", lookupName); return false; } if (!lookupExtractorFactory.start()) { throw new ISE("start method returned false for lookup [%s]", lookupName); } return (null == lookupMap.putIfAbsent(lookupName, lookupExtractorFactory)); } }
Source:
private AstyanaxCassandraContentStore( AstyanaxContext<Keyspace> context, String cfName, ConsistencyLevel readConsistency, ConsistencyLevel writeConsistency, ContentHasher hasher, IdGenerator idGenerator, MessageSender<ResourceUpdatedMessage> sender, EquivalenceGraphStore graphStore, Clock clock, MetricRegistry metricRegistry, String metricPrefix ) { super(hasher, idGenerator, sender, graphStore, clock); this.keyspace = checkNotNull(context.getClient()); this.readConsistency = checkNotNull(readConsistency); this.writeConsistency = checkNotNull(writeConsistency); this.mainCf = ColumnFamily.newColumnFamily(checkNotNull(cfName), LongSerializer.get(), StringSerializer.get() ); this.aliasIndex = AliasIndex.create(keyspace, cfName + "_aliases"); calledMeter = checkNotNull(metricRegistry) .meter(checkNotNull(metricPrefix) + "meter.called"); failureMeter = checkNotNull(metricRegistry) .meter(checkNotNull(metricPrefix) + "meter.failure"); }

Target:
private AstyanaxCassandraContentStore( AstyanaxContext<Keyspace> context, String cfName, ConsistencyLevel readConsistency, ConsistencyLevel writeConsistency, ContentHasher hasher, IdGenerator idGenerator, MessageSender<ResourceUpdatedMessage> sender, EquivalenceGraphStore graphStore, Clock clock, MetricRegistry metricRegistry, String metricPrefix ) { super(hasher, idGenerator, sender, graphStore, clock, metricRegistry, metricPrefix); this.keyspace = checkNotNull(context.getClient()); this.readConsistency = checkNotNull(readConsistency); this.writeConsistency = checkNotNull(writeConsistency); this.mainCf = ColumnFamily.newColumnFamily(checkNotNull(cfName), LongSerializer.get(), StringSerializer.get() ); this.aliasIndex = AliasIndex.create(keyspace, cfName + "_aliases"); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiController.setupUI(); loadSaveInstanceState(savedInstanceState); boolean isRotation = savedInstanceState != null; setupUpdateTask(isRotation); proceedAutomatically = getIntent().getBooleanExtra( RefreshToLatestBuildActivity.KEY_FROM_LATEST_BUILD_ACTIVITY, false); if (proceedAutomatically) { startUpdateCheck(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiController.setupUI(); proceedAutomatically = getIntent().getBooleanExtra( RefreshToLatestBuildActivity.KEY_FROM_LATEST_BUILD_ACTIVITY, false); loadSavedInstanceState(savedInstanceState); boolean isRotation = savedInstanceState != null; setupUpdateTask(isRotation); }
Source:
void setUp() { factory = shouldHaveSizeGreaterThanOrEqualTo(newArrayList('a', 'b'), 4, 2); }

Target:
void setUp() { factory = shouldHaveSizeGreaterThanOrEqualTo("ab", 4, 2); }
Source:
public boolean hasConfigChangeTrigger(IDeploymentConfig dc) { return dc.getTriggers().stream() .anyMatch(t -> IDeploymentConfigChangeTrigger.class.isAssignableFrom(t.getClass())); }

Target:
public boolean hasConfigChangeTrigger(IDeploymentConfig dc) { return dc.getTriggers().stream() .anyMatch(t -> DeploymentTriggerType.CONFIG_CHANGE.equals(t.getType())); }
Source:
public void stringValue(DistinctQueryType queryType) { String resource = String.format("{ " + "\"id\": \"5\" + \"}"); DistinctMap distinctMap = DistinctMap.create(queryType, null); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); boolean add = distinctMap.add(resource, outHash); assertThat(add).as("Value should be added first time").isTrue(); boolean add2 = distinctMap.add(resource, outHash); assertThat(add2).as("same value should not be added again").isFalse(); resource = String.format("{ " + "\"id\": \"6\" + \"}"); boolean add3 = distinctMap.add(resource, outHash); assertThat(add3).as("different value should be added again").isTrue(); }

Target:
public void stringValue(DistinctQueryType queryType) { String resourceString = String.format("{ " + "\"id\": \"a\" }"); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); Document resource = new Document(resourceString); DistinctMap distinctMap = DistinctMap.create(queryType, null); boolean add = distinctMap.add(resource, outHash); assertThat(add).as("Value should be added first time").isTrue(); boolean add2 = distinctMap.add(resource, outHash); assertThat(add2).as("same value should not be added again").isFalse(); resource = new Document(String.format("{ " + "\"id\": \"b\" }")); boolean add3 = distinctMap.add(resource, outHash); assertThat(add3).as("different value should be added again").isTrue(); }