auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int getContainerCount() { Optional<String> autoscalingContainerCountValue = Optional.ofNullable(get(JOB_AUTOSIZING_CONTAINER_COUNT)); Optional<String> jobContainerCountValue = Optional.ofNullable(get(JOB_CONTAINER_COUNT)); if (getAutosizingEnabled() && autoscalingContainerCountValue.isPresent()) { return Integer.parseInt(autoscalingContainerCountValue.get()); } else if (jobContainerCountValue.isPresent()) { return Integer.parseInt(jobContainerCountValue.get()); } else { Optional<String> yarnContainerCountValue = Optional.ofNullable(get("yarn.container.count")); if (yarnContainerCountValue.isPresent()) { LOG.warn("Configuration 'yarn.container.count' is deprecated. Please use {}.", JOB_CONTAINER_COUNT); return Integer.parseInt(yarnContainerCountValue.get()); } else { return DEFAULT_JOB_CONTAINER_COUNT; } } }

Target:
public int getContainerCount() { Optional<String> autosizingContainerCountValue = Optional.ofNullable(get(JOB_AUTOSIZING_CONTAINER_COUNT)); Optional<String> jobContainerCountValue = Optional.ofNullable(get(JOB_CONTAINER_COUNT)); if (getAutosizingEnabled() && autosizingContainerCountValue.isPresent()) { return Integer.parseInt(autosizingContainerCountValue.get()); } else if (jobContainerCountValue.isPresent()) { return Integer.parseInt(jobContainerCountValue.get()); } else { Optional<String> yarnContainerCountValue = Optional.ofNullable(get("yarn.container.count")); if (yarnContainerCountValue.isPresent()) { LOG.warn("Configuration 'yarn.container.count' is deprecated. Please use {}.", JOB_CONTAINER_COUNT); return Integer.parseInt(yarnContainerCountValue.get()); } else { return DEFAULT_JOB_CONTAINER_COUNT; } } }
Source:
public void setLabel(String label) throws Exception { if(!PodTemplateUtils.validateLabel(label)) { throw new Exception(String.format("Labels must follow required specs - <LINK_0> - %s", label)); } this.label = label; }

Target:
public void setLabel(String label) { this.label = label; }
Source:
static public void reportException(String name, Logger logger, PrintStream stderr, Throwable e) { final String errorMsg = String.format("Unexpected exception occurred while performing %s command.", name); stderr.println(); stderr.println("ERROR: "+errorMsg); logger.log(Level.WARNING,errorMsg,e); Functions.printStackTrace(e,stderr); }

Target:
static public void reportException(String name, Logger logger, PrintStream stderr, Throwable e) { final String errorMsg = String.format("Unexpected exception occurred while performing %s command.", name); logAndPrintError(e, errorMsg, errorMsg, Level.WARNING); Functions.printStackTrace(e, stderr); }
Source:
private static void printHistory(CommandSender sender, FName[] oldNames) { if (oldNames.length == 1) { sender.sendMessage(ChatColor.GREEN + oldNames[0].getName() + ChatColor.GOLD + " has never changed their name."); } else { sender.sendMessage(ChatColor.GOLD + "Original name: " + ChatColor.GREEN + oldNames[0].getName()); for (int i = 1; i < oldNames.length; i++) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(oldNames[i].changedToAt); String formattedDate = df.format(date); sender.sendMessage(ChatColor.BLUE + formattedDate + ChatColor.GOLD + " changed to " + ChatColor.GREEN + oldNames[i].getName()); } } }

Target:
private static void printHistory(CommandSender sender, FName[] oldNames) { if (oldNames.length == 1) { FSync.playerMsg(sender, ChatColor.GREEN + oldNames[0].getName() + ChatColor.GOLD + " has never changed their name."); return; } FSync.playerMsg(sender, ChatColor.GOLD + "Original name: " + ChatColor.GREEN + oldNames[0].getName()); for (int i = 1; i < oldNames.length; i++) { Date date = new Date(oldNames[i].getChangedToAt()); String formattedDate = df.format(date); FSync.playerMsg(sender, ChatColor.BLUE + formattedDate + ChatColor.GOLD + " changed to " + ChatColor.GREEN + oldNames[i].getName()); } }
Source:
public void removeAll() throws TckRepositoryException { final EntityManager manager = managerProvider.get(); manager.createQuery("SELECT stack FROM Stack stack", StackImpl.class).getResultList().forEach(manager::remove); manager.createQuery("DELETE FROM \"User\"").executeUpdate(); }

Target:
public void removeAll() throws TckRepositoryException { final EntityManager manager = managerProvider.get(); manager.createNamedQuery("Stack.getAll", StackImpl.class).getResultList().forEach(manager::remove); manager.createQuery("DELETE FROM \"User\"").executeUpdate(); }
Source:
public void doOnTerminateComplete() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Maybe.empty().doOnTerminate(new Action() { @Override public void run() { atomicBoolean.set(true); } }) .subscribe(); assertTrue(atomicBoolean.get()); }

Target:
public void doOnTerminateComplete() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Maybe.empty().doOnTerminate(new Action() { @Override public void run() { atomicBoolean.set(true); } }) .test() .assertResult(); assertTrue(atomicBoolean.get()); }
Source:
private Mono<Void> sendInternal(Flux<EventData> events, SendOptions options) { final String partitionKey = options.partitionKey(); verifyPartitionKey(partitionKey); return sendLinkMono.flatMap(link -> { final AtomicReference<Context> sendSpanContext = new AtomicReference<>(Context.NONE); return link.getLinkSize() .flatMap(size -> { final int batchSize = size > 0 ? size : MAX_MESSAGE_LENGTH_BYTES; final BatchOptions batchOptions = new BatchOptions() .partitionKey(partitionKey) .maximumSizeInBytes(batchSize); return events.map(eventData -> { Context parentContext = eventData.context(); Context entityContext = parentContext.addData(entityPath, link.getEntityPath()); sendSpanContext.set(TraceUtil.start("send", entityContext.addData(hostName, link.getHostname()))); return setSpanContext(eventData, parentContext); }).collect(new EventDataCollector(batchOptions, 1, () -> link.getErrorContext())); }) .flatMap(list -> sendInternal(Flux.fromIterable(list))) .doOnEach(signal -> TraceUtil.endTracingSpan(sendSpanContext.get(), signal)); }); }

Target:
private Mono<Void> sendInternal(Flux<EventData> events, SendOptions options) { final String partitionKey = options.partitionKey(); verifyPartitionKey(partitionKey); if (tracerProvider.isEnabled()) { return sendInternalTracingEnabled(events, partitionKey); } else { return sendInternalTracingDisabled(events, partitionKey); } }
Source:
public void testBadInputs() { try { parseArgs("-p prefix -s start -e end"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-r exactRow -s start"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-p prefix -e end"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-r exactRow -e end -s start"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-p prefix -r exactRow"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-c col1,cf:cq:oops"); Assert.fail(); } catch (IllegalArgumentException e) { } }

Target:
public void testBadInputs() { for (String extraArg : new String[]{"-r exactRow", "-s start", "-e end", "-s start -e end"}) { try { parseArgs("-p prefix "+extraArg); Assert.fail(); } catch (IllegalArgumentException e) { } } for (String extraArg : new String[]{"-p prefix", "-s start", "-e end", "-s start -e end"}) { try { parseArgs("-r exactRow "+extraArg); Assert.fail(); } catch (IllegalArgumentException e) { } } try { parseArgs("-c col1,cf:cq:oops"); Assert.fail(); } catch (IllegalArgumentException e) { } }
Source:
private void testInviteInstructorAction() { ______TS("success: invite an uregistered instructor"); courseEditPage.clickInviteInstructorLink(4); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_REMINDER_SENT_TO + "InsCrsEdit.newInstr@gmail.tmt"); }

Target:
private void testInviteInstructorAction() { ______TS("success: invite an uregistered instructor"); int unregisteredInsturctorIndex = 4; courseEditPage.clickInviteInstructorLink(unregisteredInsturctorIndex); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_REMINDER_SENT_TO + "InsCrsEdit.newInstr@gmail.tmt"); }
Source:
public void testCorrectBehaviourOfGetTokenId() { final String id = "EOF"; assertEquals(1, TokenUtils.getTokenId(id)); }

Target:
public void testCorrectBehaviourOfGetTokenId() { final String id = "EOF"; assertEquals(TokenTypes.EOF, TokenUtils.getTokenId(id)); }
Source:
public static String[] decodeFieldsFromUniqueId(final String id) { final String[] parts = checkNotNull(id, "id").split("/"); return parts; }

Target:
public static String[] decodeFieldsFromUniqueId(final String id) { return checkNotNull(id, "id").split("/"); }
Source:
public Object unmarshal(final Exchange exchange, final InputStream inputStream) throws Exception { if (supportEmptyDirectory) { exchange.getIn().setHeader("unzipEmptyDirectorySupported", true); } else { exchange.getIn().setHeader("unzipEmptyDirectorySupported", false); } if (usingIterator) { return new ZipIterator(exchange.getIn()); } else { ZipInputStream zis = new ZipInputStream(inputStream); OutputStreamBuilder osb = OutputStreamBuilder.withExchange(exchange); try { ZipEntry entry = zis.getNextEntry(); if (entry != null) { exchange.getOut().setHeader(FILE_NAME, entry.getName()); IOHelper.copy(zis, osb); } entry = zis.getNextEntry(); if (entry != null) { throw new IllegalStateException("Zip file has more than 1 entry."); } return osb.build(); } finally { IOHelper.close(zis, osb); } } }

Target:
public Object unmarshal(final Exchange exchange, final InputStream inputStream) throws Exception { if (usingIterator) { ZipIterator zipIterator = new ZipIterator(exchange.getIn()); zipIterator.setAllowEmptyDirectory(allowEmptyDirectory); return zipIterator; } else { ZipInputStream zis = new ZipInputStream(inputStream); OutputStreamBuilder osb = OutputStreamBuilder.withExchange(exchange); try { ZipEntry entry = zis.getNextEntry(); if (entry != null) { exchange.getOut().setHeader(FILE_NAME, entry.getName()); IOHelper.copy(zis, osb); } entry = zis.getNextEntry(); if (entry != null) { throw new IllegalStateException("Zip file has more than 1 entry."); } return osb.build(); } finally { IOHelper.close(zis, osb); } } }
Source:
private void flipCard() { currentCard = isCradFront() ? cradBack : cradFront; langCode = isCradFront() ? Settings.selectedLanguageCode : Settings.nativeTongue; loadWordAndShow(serverIDs[currentIndex]); AnimationFactory.flipTransition(viewAnimator, FlipDirection.LEFT_RIGHT); }

Target:
private void flipCard() { currentCard = isCradFront() ? cardBack : cardFront; langCode = isCradFront() ? Settings.selectedLanguageCode : Settings.nativeTongue; loadWordAndShow(serverIDs[currentIndex]); AnimationFactory.flipTransition(viewAnimator, FlipDirection.LEFT_RIGHT, 250); }
Source:
public GeneratedAlgorithm generate(Attribute targetAttribute, Hits<ExplainedAttribute> sourceAttributes, EntityType targetEntityType, EntityType sourceEntityType) { if (targetAttribute.hasExpression()) { throw new AlgorithmException(format("Algorithm generation for expressed attribute '%s' is not allowed", targetAttribute.getName())); } String algorithm = StringUtils.EMPTY; AlgorithmState algorithmState = null; Set<Attribute> mappedSourceAttributes = null; if (sourceAttributes.getHits().size() > 0) { AlgorithmTemplate algorithmTemplate = algorithmTemplateService.find(sourceAttributes) .findFirst() .orElse(null); if (algorithmTemplate != null) { algorithm = algorithmTemplate.render(); mappedSourceAttributes = AlgorithmGeneratorHelper.extractSourceAttributesFromAlgorithm(algorithm, sourceEntityType); algorithm = convertUnitForTemplateAlgorithm(algorithm, targetAttribute, targetEntityType, mappedSourceAttributes, sourceEntityType); algorithmState = GENERATED_HIGH; } else { ExplainedAttribute attributeSearchHit = sourceAttributes.getHits().iterator().next().getResult(); Attribute sourceAttribute = attributeSearchHit.getAttribute(); algorithm = generate(targetAttribute, Arrays.asList(sourceAttribute), targetEntityType, sourceEntityType); mappedSourceAttributes = AlgorithmGeneratorHelper.extractSourceAttributesFromAlgorithm(algorithm, sourceEntityType); algorithmState = attributeSearchHit.isHighQuality() ? GENERATED_HIGH : GENERATED_LOW; } } return GeneratedAlgorithm.create(algorithm, mappedSourceAttributes, algorithmState); }

Target:
public GeneratedAlgorithm generate(Attribute targetAttribute, Hits<ExplainedAttribute> sourceAttributes, EntityType targetEntityType, EntityType sourceEntityType) { if (targetAttribute.hasExpression()) { throw new AlgorithmException(format("Algorithm generation for expressed attribute '%s' is not allowed", targetAttribute.getName())); } String algorithm = StringUtils.EMPTY; AlgorithmState algorithmState = null; Set<Attribute> mappedSourceAttributes = null; if (!sourceAttributes.getHits().isEmpty()) { AlgorithmTemplate algorithmTemplate = algorithmTemplateService.find(sourceAttributes) .findFirst() .orElse(null); if (algorithmTemplate != null) { algorithm = algorithmTemplate.render(); mappedSourceAttributes = AlgorithmGeneratorHelper.extractSourceAttributesFromAlgorithm(algorithm, sourceEntityType); algorithm = convertUnitForTemplateAlgorithm(algorithm, targetAttribute, targetEntityType, mappedSourceAttributes, sourceEntityType); algorithmState = GENERATED_HIGH; } else { ExplainedAttribute attributeSearchHit = sourceAttributes.getHits().iterator().next().getResult(); Attribute sourceAttribute = attributeSearchHit.getAttribute(); algorithm = generate(targetAttribute, Arrays.asList(sourceAttribute), targetEntityType, sourceEntityType); mappedSourceAttributes = AlgorithmGeneratorHelper.extractSourceAttributesFromAlgorithm(algorithm, sourceEntityType); algorithmState = attributeSearchHit.isHighQuality() ? GENERATED_HIGH : GENERATED_LOW; } } return GeneratedAlgorithm.create(algorithm, mappedSourceAttributes, algorithmState); }
Source:
public String getAttribute(Attribute attribute) { if (attribute == null) { return null; } ViaAPI api = Via.getAPI(); if (attribute.startsWith("viaversion")) { return new ElementTag(api.getPlayerVersion(player.getOfflinePlayer().getUniqueId())) .getAttribute(attribute.fulfill(1)); } return null; }

Target:
public String getAttribute(Attribute attribute) { if (attribute == null) { return null; } if (attribute.startsWith("viaversion")) { ViaAPI api = Via.getAPI(); return new ElementTag(api.getPlayerVersion(player.getOfflinePlayer().getUniqueId())) .getAttribute(attribute.fulfill(1)); } return null; }
Source:
public FNatsServer build() { if (executorService == null) { this.executorService = new ThreadPoolExecutor( workerCount, workerCount, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<>(queueLength), new BlockingRejectedExecutionHandler()); } return new FNatsServer(conn, processor, protoFactory, subjects, queue, highWatermark, executorService); }

Target:
public FNatsServer build() { if (executorService == null) { this.executorService = new ThreadPoolExecutor( workerCount, workerCount, 0, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(queueLength), new BlockingRejectedExecutionHandler()); } return new FNatsServer(conn, processor, protoFactory, subjects, queue, highWatermark, executorService); }
Source:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); Term a2 = arg2.dereference(); Term a3 = arg3.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; final PatchSet.Id id = StoredValues.PATCH_SET_ID.get(engine); PatchSetInfoFactory psiFactory = env.getInjector().getInstance(PatchSetInfoFactory.class); Term idTerm; Term nameTerm = Prolog.Nil; Term emailTerm = Prolog.Nil; try { UserIdentity committer = psiFactory.get(id).getCommitter(); Account.Id committerId = committer.getAccount(); if (committerId == null) { idTerm = SymbolTerm.intern("anonymous"); } else { idTerm = new IntegerTerm(committerId.get()); } String name = committer.getName(); if (name != null && !name.equals("")) { nameTerm = SymbolTerm.intern(name); } String email = committer.getEmail(); if (email != null && !email.equals("")) { emailTerm = SymbolTerm.intern(email); } } catch (PatchSetInfoNotAvailableException err) { throw new JavaException(this, 1, err); } if (!a1.unify(new StructureTerm(user, idTerm), engine.trail)) { return engine.fail(); } if (!a2.unify(nameTerm, engine.trail)) { return engine.fail(); } if (!a3.unify(emailTerm, engine.trail)) { return engine.fail(); } return cont; }

Target:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); PatchSetInfo psInfo = StoredValues.PATCH_SET_INFO.get(engine); UserIdentity committer = psInfo.getCommitter(); return exec(engine, committer); }
Source:
public void testValidDoubleQuotedQuerySpecificChars() { String query = "repository: \"releases#1\""; AqlQueryParser aqlParser = new AqlQueryParser(query); Map<Pair<Integer, Integer>, String> errorMap = null; try { aqlParser.parseQuery(); } catch (QueryParserException e) { errorMap = aqlParser.getErrors(); } logger.info(String.format("Query [%s] parse tree:\n[%s]", query, aqlParser)); assertFalse(aqlParser.hasErrors()); assertNull(errorMap); }

Target:
public void testValidDoubleQuotedQuerySpecificChars() { String query = "repository: \"releases#1\""; AqlQueryParser aqlParser = new AqlQueryParser(query); aqlParser.parseQuery(); logger.info(String.format("Query [%s] parse tree:\n[%s]", query, aqlParser)); assertFalse(aqlParser.hasErrors()); }
Source:
private void build() { if (slotToBuild != null) { int destX = (int)Math.floor(destination.x); int destY = (int)Math.floor(destination.y); int destZ = (int)Math.floor(destination.z); Block block = context.world().getBlock(destX, destY, destZ); int meta = context.world().getBlockMetadata(destX, destY, destZ); context.world().playAuxSFXAtEntity(null, 2001, destX, destY, destZ, Block.getIdFromBlock(block) + (meta << 12)); if (BlockUtil.isToughBlock(context.world(), destX, destY, destZ)) { BlockUtil.breakBlock(context.world(), destX, destY, destZ, BuildCraftBuilders.fillerLifespanTough); } else { BlockUtil.breakBlock(context.world(), destX, destY, destZ, BuildCraftBuilders.fillerLifespanNormal); } slotToBuild.writeToWorld(context); } }

Target:
private void build() { if (slotToBuild != null) { int destX = (int)Math.floor(destination.x); int destY = (int)Math.floor(destination.y); int destZ = (int)Math.floor(destination.z); Block block = context.world().getBlock(destX, destY, destZ); int meta = context.world().getBlockMetadata(destX, destY, destZ); context.world().playAuxSFXAtEntity(null, 2001, destX, destY, destZ, Block.getIdFromBlock(block) + (meta << 12)); slotToBuild.writeToWorld(context); } }
Source:
public String getPackageName() { GoFileStub stub = getStub(); if (stub != null) return stub.getPackageName(); GoPackageClause packageClause = getPackage(); if (packageClause != null) { PsiElement packageIdentifier = packageClause.getIdentifier(); if (packageIdentifier != null) { String name = packageIdentifier.getText().trim(); if (GoTestFinder.isTestFile(this)) { name = StringUtil.trimEnd(name, GoConstants.TEST_SUFFIX); } return name; } } return null; }

Target:
public String getPackageName() { GoFileStub stub = getStub(); if (stub != null) return stub.getPackageName(); GoPackageClause packageClause = getPackage(); if (packageClause != null) { PsiElement packageIdentifier = packageClause.getIdentifier(); if (packageIdentifier != null) { String name = packageIdentifier.getText().trim(); return GoTestFinder.isTestFile(this) ? StringUtil.trimEnd(name, GoConstants.TEST_SUFFIX) : name; } } return null; }
Source:
public static String getTokenServerEncodedUrl() { return getMetadataServerUrl() + "/computeMetadata/v1/instance/service-accounts/default/token"; }

Target:
public static String getTokenServerEncodedUrl() { return getTokenServerEncodedUrl(DefaultCredentialsProvider.DEFAULT); }
Source:
public MishrasGroundbreaker(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new MishrasGroundbreakerToken(), false, true, Duration.EndOfGame), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetLandPermanent()); this.addAbility(ability); }

Target:
public MishrasGroundbreaker(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new MishrasGroundbreakerToken(), false, true, Duration.Custom), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetLandPermanent()); this.addAbility(ability); }
Source:
public ProjectImports load(final Path path) { try { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (!ioService.exists(nioPath)) { saveProjectImports(path); } final String content = ioService.readAllString(Paths.convert(path)); final ProjectImports projectImports = projectConfigurationContentHandler.toModel(content); final Import javaLangNumber = new Import(java.lang.Number.class.getName()); if (projectImports.getImports().getImports().stream().filter(anImport -> anImport != null).noneMatch(anImport -> anImport.equals(javaLangNumber))) { projectImports.getImports().addImport(javaLangNumber); } return projectImports; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }

Target:
public ProjectImports load(final Path path) { try { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (!ioService.exists(nioPath)) { saveProjectImports(path); } final String content = ioService.readAllString(Paths.convert(path)); final ProjectImports projectImports = projectConfigurationContentHandler.toModel(content); final Import javaLangNumber = new Import(Number.class); if (projectImports.getImports().getImports().stream().noneMatch(anImport -> Objects.equals(anImport, javaLangNumber))) { projectImports.getImports().addImport(javaLangNumber); } return projectImports; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }
Source:
public IndexedInts getBitmapIndex(String dimension, int dictId) { if (dictId >= 0) { final Indexed<String> dimValues = getDimValueLookup(dimension); String value = Strings.nullToEmpty(dimValues.get(dictId)); return getBitmapIndex(dimension, value); } else { return new EmptyIndexedInts(); } }

Target:
public IndexedInts getBitmapIndex(String dimension, int dictId) { if (dictId >= 0) { final Indexed<String> dimValues = getDimValueLookup(dimension); String value = Strings.nullToEmpty(dimValues.get(dictId)); return getBitmapIndex(dimension, value); } else { return EmptyIndexedInts.EMPTY_INDEXED_INTS; } }
Source:
public static Properties loadProperties(Properties properties, File file) throws IOException { return loadProperties(properties, new FileInputStream(file)); }

Target:
public static Properties loadProperties(Properties properties, File file) throws IOException { try (InputStream propertiesStream = new FileInputStream(file)) { return loadProperties(properties, propertiesStream); } }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent resultData) { if (requestCode == REQUEST_CODE_RESTORE && resultCode == RESULT_OK && resultData != null) { Uri uri = resultData.getData(); restoreFrom(uri); } else if (requestCode == REQUEST_CODE_BACKUP_DOCUMENT && resultCode == RESULT_OK && resultData != null) { Uri uri = resultData.getData(); backupToDocument(uri); } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent resultData) { if (resultCode != RESULT_OK || resultData == null) { return; } Uri uri = resultData.getData(); if (requestCode == REQUEST_CODE_RESTORE) { restoreFrom(uri); } else if (requestCode == REQUEST_CODE_BACKUP_DOCUMENT) { backupToDocument(uri); } }
Source:
private String getSanitizedDefaultGroupId(final String proposedGroupId) { return proposedGroupId != null ? proposedGroupId.replaceAll("[^A-Za-z0-9_\\-.]", "") : proposedGroupId; }

Target:
private String getSanitizedDefaultGroupId(final String proposedGroupId) { return proposedGroupId != null ? proposedGroupId.replaceAll(PROPOSED_GROUP_ID_REGEX, "") : proposedGroupId; }
Source:
static ISideEffectFactory createFactory() { ICompositeSideEffect compositeSideEffect = ICompositeSideEffect.create(); return new SideEffectFactory(compositeSideEffect::add); }

Target:
static ISideEffectFactory createFactory() { return new SideEffectFactory(); }
Source:
public void validate(JobParameters parameters) throws JobParametersInvalidException { ParametersValidatorUtil.checkDirectory(parameters.getString(JobParametersNames.APP_VEP_CACHE_PATH), JobParametersNames.APP_VEP_CACHE_PATH); }

Target:
public void validate(JobParameters parameters) throws JobParametersInvalidException { ParametersValidatorUtil.checkDirectoryExists(parameters.getString(JobParametersNames.APP_VEP_CACHE_PATH), JobParametersNames.APP_VEP_CACHE_PATH); ParametersValidatorUtil.checkFileIsReadable(parameters.getString(JobParametersNames.APP_VEP_CACHE_PATH), JobParametersNames.APP_VEP_CACHE_PATH); }
Source:
public void getSurveyAllVersionsIncludeDeleted() { createSurvey(new SimpleSurvey("First Survey")); Survey versionedSurvey = createSurvey(new SimpleSurvey("Second Survey")); versionSurvey(versionedSurvey); versionSurvey(versionedSurvey); Survey finalVersion = versionSurvey(versionedSurvey); long lastCreatedOnTime = finalVersion.getCreatedOn(); List<Survey> surveyVersions = surveyDao.getSurveyAllVersions(TEST_STUDY, versionedSurvey.getGuid(), true); for (Survey survey : surveyVersions) { assertEquals("All surveys versions of one survey", versionedSurvey.getGuid(), survey.getGuid()); } assertEquals("First survey is the most recently versioned", lastCreatedOnTime, surveyVersions.get(0).getCreatedOn()); assertNotEquals("createdOn updated", lastCreatedOnTime, versionedSurvey.getCreatedOn()); }

Target:
public void getSurveyAllVersionsIncludeDeleted() { createSurvey(new SimpleSurvey("First Survey")); Survey versionedSurvey = createSurvey(new SimpleSurvey("Second Survey")); versionSurvey(versionedSurvey); versionSurvey(versionedSurvey); Survey finalVersion = versionSurvey(versionedSurvey); surveyDao.deleteSurvey(versionedSurvey); long lastCreatedOnTime = finalVersion.getCreatedOn(); List<Survey> surveyVersions = surveyDao.getSurveyAllVersions(TEST_STUDY, versionedSurvey.getGuid(), true); assertTrue("One survey version is deleted", surveyVersions.stream().anyMatch(Survey::isDeleted)); assertTrue("All surveys versions of one survey", surveyVersions.stream().allMatch((survey) -> survey.getGuid().equals(versionedSurvey.getGuid()))); assertEquals("First survey is the most recently versioned", lastCreatedOnTime, surveyVersions.get(0).getCreatedOn()); assertNotEquals("createdOn updated", lastCreatedOnTime, versionedSurvey.getCreatedOn()); }
Source:
public EurekaServerResolver build() { if (serviceSelector == null) { serviceSelector = ServiceSelector.selectBy() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4).publicIp(true) .or() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4); } if (loadBalancerBuilder == null) { loadBalancerBuilder = new DefaultLoadBalancerBuilder<>(null); } if (bootstrapResolver == null) { throw new IllegalStateException("BootstrapResolver property not set"); } if (transportConfig == null) { transportConfig = new BasicEurekaTransportConfig.Builder().build(); } if (clientMetricFactory == null) { clientMetricFactory = EurekaClientMetricFactory.clientMetrics(); } if (registryMetricFactory == null) { registryMetricFactory = EurekaRegistryMetricFactory.registryMetrics(); } EurekaClientBuilder eurekaClientBuilder = EurekaClientBuilder.newBuilder() .withMetricFactory(clientMetricFactory) .withMetricFactory(registryMetricFactory) .withWriteServerResolver(ServerResolvers.just("localhost", 0)) .withReadServerResolver(bootstrapResolver) .withTransportConfig(transportConfig); return new EurekaServerResolver(eurekaClientBuilder, readServerInterest, serviceSelector, loadBalancerBuilder); }

Target:
public EurekaServerResolver build() { if (serviceSelector == null) { serviceSelector = ServiceSelector.selectBy() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4).publicIp(true) .or() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4); } if (loadBalancerBuilder == null) { loadBalancerBuilder = new DefaultLoadBalancerBuilder<>(null); } if (bootstrapResolver == null) { throw new IllegalStateException("BootstrapResolver property not set"); } if (transportConfig == null) { transportConfig = new BasicEurekaTransportConfig.Builder().build(); } if (clientMetricFactory == null) { clientMetricFactory = EurekaClientMetricFactory.clientMetrics(); } if (registryMetricFactory == null) { registryMetricFactory = EurekaRegistryMetricFactory.registryMetrics(); } EurekaClientBuilder eurekaClientBuilder = EurekaClientBuilder.newBuilder() .withClientMetricFactory(clientMetricFactory) .withRegistryMetricFactory(registryMetricFactory) .withWriteServerResolver(ServerResolvers.just("localhost", 0)) .withReadServerResolver(bootstrapResolver) .withTransportConfig(transportConfig); return new EurekaServerResolver(eurekaClientBuilder, readServerInterest, serviceSelector, loadBalancerBuilder); }
Source:
private static boolean responseShouldBeProtected(Exchange exchange, Response response) throws OSException{ Request request = exchange.getCurrentRequest(); OptionSet options = request.getOptions(); if(exchange.getCryptographicContextID() == null){ if(response.getOptions().hasObserve() && request.getOptions().hasObserve()){ if (options.hasOption(OptionNumberRegistry.OSCORE)){ String uri = request.getURI(); OSCoreCtxDB db = HashMapCtxDB.getInstance(); OSCoreCtx ctx = null; try { ctx = db.getContext(uri); } catch (OSException e) { LOGGER.severe("Error when re-creating exchange at OSCORE level"); throw new OSException("Error when re-creating exchange at OSCORE level"); } exchange.setCryptographicContextID(ctx.getRecipientId()); } } } return exchange.getCryptographicContextID() != null; }

Target:
private static boolean responseShouldBeProtected(Exchange exchange, Response response) throws OSException { Request request = exchange.getCurrentRequest(); OptionSet options = request.getOptions(); if (exchange.getCryptographicContextID() == null) { if (response.getOptions().hasObserve() && request.getOptions().hasObserve()) { if (options.hasOscore()) { String uri = request.getURI(); OSCoreCtxDB db = HashMapCtxDB.getInstance(); OSCoreCtx ctx = null; try { ctx = db.getContext(uri); } catch (OSException e) { LOGGER.error("Error when re-creating exchange at OSCORE level"); throw new OSException("Error when re-creating exchange at OSCORE level"); } exchange.setCryptographicContextID(ctx.getRecipientId()); } } } return exchange.getCryptographicContextID() != null; }
Source:
public ObjectPropertyTemplateModel call() throws Exception { ObjectPropertyTemplateModel tm = ObjectPropertyTemplateModel.getObjectPropertyTemplateModel( op, subject, vreq, editing, populatedObjectPropertyList); if (!tm.isEmpty() || (editing && !tm.getAddUrl().isEmpty())) { List<Map<String, String>> l = tm.getStatementData(); } return tm; }

Target:
public ObjectPropertyTemplateModel call() { ObjectPropertyTemplateModel tm = ObjectPropertyTemplateModel.getObjectPropertyTemplateModel(op, subject, vreq, editing, populatedObjectPropertyList); if (!tm.isEmpty() || (editing && !tm.getAddUrl().isEmpty())) { tm.getStatementData(); } return tm; }
Source:
private static RefFormat computeRefFormat(String ref) { RefFormat result = RefFormat.INTERNAL; ref = mungedRef(ref); if (ref.startsWith("http:") || ref.startsWith("https:")) { result = RefFormat.URL; } else if (ref.startsWith("#/")) { result = RefFormat.INTERNAL; } else if (ref.startsWith(".") || ref.startsWith("/")) { result = RefFormat.RELATIVE; } return result; }

Target:
private static RefFormat computeRefFormat(String ref) { RefFormat result = RefFormat.INTERNAL; if (ref.startsWith("http:") || ref.startsWith("https:")) { result = RefFormat.URL; } else if (ref.startsWith("#/")) { result = RefFormat.INTERNAL; } else if (ref.startsWith(".") || ref.startsWith("/")) { result = RefFormat.RELATIVE; }else if (!ref.contains(":") && !ref.startsWith("#") && !ref.startsWith("/")&& ref.lastIndexOf(".") > 0) { result = RefFormat.RELATIVE; } return result; }
Source:
protected EObject getEditedEObject() { int columnIndex = this.layerCell.getColumnIndex(); int rowIndex = this.layerCell.getRowIndex(); Object row = this.elementProvider.getRowElement(rowIndex); Object column = this.elementProvider.getColumnElement(columnIndex); row = AxisUtils.getRepresentedElement(row); column = AxisUtils.getRepresentedElement(column); Element editedElement = null; if (row instanceof Element && column instanceof EStructuralFeature) { if (((EStructuralFeature) column).getEType() .equals(UMLPackage.Literals.VALUE_SPECIFICATION)) { editedElement = (Element) row; } } return editedElement; }

Target:
protected EObject getEditedEObject() { int columnIndex = this.layerCell.getColumnIndex(); int rowIndex = this.layerCell.getRowIndex(); Object row = this.elementProvider.getRowElement(rowIndex); Object column = this.elementProvider.getColumnElement(columnIndex); row = AxisUtils.getRepresentedElement(row); column = AxisUtils.getRepresentedElement(column); Element editedElement = null; if (row instanceof Element && column instanceof EStructuralFeature) { if (UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) column) .getEType()) { editedElement = (Element) row; } } return editedElement; }
Source:
public static TrafficClass fromNameOrValue(String tcName) { int tcParsed = -1; try { tcParsed = Integer.parseInt(tcName); } catch (NumberFormatException e){ } for(TrafficClass t : TrafficClass.values()) { if(t.toString().equalsIgnoreCase(tcName) || t.value == tcParsed) { return t; } } return getDefault(); }

Target:
public static TrafficClass fromNameOrValue(String tcName) { int tcParsed = -1; try { tcParsed = Integer.parseInt(tcName); } catch (NumberFormatException e){ } for (TrafficClass t : TrafficClass.values()) { if (t.toString().equalsIgnoreCase(tcName) || t.value == tcParsed) { return t; } } throw new IllegalArgumentException(); }
Source:
public static void refreshValidProjects(IProject[] projects, boolean delete, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshingProjects, projects.length); for (IProject p : projects) { if (subMonitor.isCanceled()) break; IPath projectLocation = p.getLocation(); if (projectLocation == null) continue; String projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME) .toOSString(); File projectFile = new File(projectFilePath); if (projectFile.exists()) p.refreshLocal(IResource.DEPTH_INFINITE, subMonitor.newChild(1)); else if (delete) p.delete(false, true, subMonitor.newChild(1)); else closeMissingProject(p, projectFile, subMonitor.newChild(1)); } }

Target:
public static void refreshValidProjects(IProject[] projects, boolean delete, IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshingProjects, projects.length); for (IProject p : projects) { if (progress.isCanceled()) break; IPath projectLocation = p.getLocation(); if (projectLocation == null) { progress.worked(1); continue; } String projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME) .toOSString(); File projectFile = new File(projectFilePath); if (projectFile.exists()) p.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); else if (delete) p.delete(false, true, progress.newChild(1)); else closeMissingProject(p, projectFile, progress.newChild(1)); } }
Source:
protected static void batchRemoveDocuments(CoreSession adminSession, IterableQueryResult results) { String rootDocumentId = adminSession.getRootDocument().getId(); List<DocumentRef> ids = new ArrayList<>(); for (Map<String, Serializable> result : results) { String id = (String) result.get("ecm:uuid"); if (id.equals(rootDocumentId)) { continue; } ids.add(new IdRef(id)); if (ids.size() >= 100) { batchRemoveDocuments(adminSession, ids); ids.clear(); } } if (!ids.isEmpty()) { batchRemoveDocuments(adminSession, ids); } }

Target:
protected void batchRemoveDocuments(CoreSession adminSession, IterableQueryResult results) { String rootDocumentId = adminSession.getRootDocument().getId(); List<DocumentRef> ids = new ArrayList<>(); for (Map<String, Serializable> result : results) { String id = (String) result.get("ecm:uuid"); if (id.equals(rootDocumentId)) { continue; } ids.add(new IdRef(id)); if (ids.size() >= 100) { batchRemoveDocuments(adminSession, ids); ids.clear(); } } if (!ids.isEmpty()) { batchRemoveDocuments(adminSession, ids); } }
Source:
public void testLogicalSlotCancelsPhysicalSlotRequestAndRemovesSharedSlot() { testLogicalSlotRequestCancellation( true, (context, assignment) -> { context.getAllocator().cancel(assignment.getExecutionVertexId()); try { assignment.getLogicalSlotFuture().get(); fail("THe logical future must finish with the cancellation exception"); } catch (InterruptedException | ExecutionException e) { assertThat(e.getCause(), instanceOf(CancellationException.class)); } }); }

Target:
public void testLogicalSlotCancelsPhysicalSlotRequestAndRemovesSharedSlot() { testLogicalSlotRequestCancellation( true, (context, assignment) -> { context.getAllocator().cancel(assignment.getExecutionVertexId()); try { assignment.getLogicalSlotFuture().get(); fail("The logical future must finish with the cancellation exception"); } catch (InterruptedException | ExecutionException e) { assertThat(e.getCause(), instanceOf(CancellationException.class)); } }); }
Source:
public boolean equals(Object o) { return o == this || o instanceof PreparedEvent && equalTo((NotifiedEvent) o); }

Target:
public boolean equals(Object o) { return o == this || o instanceof NotifiedEvent && equalTo((NotifiedEvent) o); }
Source:
public static boolean policyNeedsUpdate(IndexingPolicy existingPolicy, IndexingPolicy newPolicy) { return new IndexPolicyCompareService().needsUpdate(existingPolicy, newPolicy); }

Target:
public static boolean policyNeedsUpdate(IndexingPolicy existingPolicy, IndexingPolicy newPolicy) { return !hasSameIncludedPaths(existingPolicy.getIncludedPaths(), newPolicy.getIncludedPaths()) || !hasSameExcludedPaths(existingPolicy.getExcludedPaths(), newPolicy.getExcludedPaths()) || !existingPolicy.getIndexingMode().equals(newPolicy.getIndexingMode()) || !existingPolicy.isAutomatic().equals(newPolicy.isAutomatic()); }
Source:
public void addMembers(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException { Context context = obtainContext(request); Group parentGroup = groupService.find(context, uuid); if (parentGroup == null) { throw new ResourceNotFoundException("parent group is not found for uuid: " + uuid); } checkAuthorization(context, parentGroup); List<String> memberLinks = utils.getStringListFromRequest(request); List<EPerson> members = new ArrayList<>(); for (String memberLink : memberLinks) { Optional<EPerson> member = findEPerson(context, memberLink); if (!member.isPresent()) { throw new UnprocessableEntityException("cannot add child group: " + memberLink); } members.add(member.get()); } for (EPerson member : members) { groupService.addMember(context, parentGroup, member); } context.commit(); response.setStatus(SC_NO_CONTENT); }

Target:
public void addMembers(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException { Context context = obtainContext(request); Group parentGroup = groupService.find(context, uuid); if (parentGroup == null) { throw new ResourceNotFoundException("parent group is not found for uuid: " + uuid); } checkAuthorization(context, parentGroup); List<String> memberLinks = utils.getStringListFromRequest(request); List<EPerson> members = new ArrayList<>(); for (String memberLink : memberLinks) { Optional<EPerson> member = findEPerson(context, memberLink); if (!member.isPresent()) { throw new UnprocessableEntityException("cannot add child group: " + memberLink); } members.add(member.get()); } for (EPerson member : members) { groupService.addMember(context, parentGroup, member); } context.complete(); response.setStatus(SC_NO_CONTENT); }
Source:
public ResponseEntity<Map<String, Object>> calculate( @PathVariable final String crop, @PathVariable final Integer studyId, @PathVariable final Integer datasetId, @RequestBody final CalculateVariableRequest request) { try { final Map<String, Object> result = this.derivedVariableService .execute(studyId, datasetId, request.getVariableId(), request.getGeoLocationIds(), request.isOverwriteExistingData()); return new ResponseEntity<>(result, HttpStatus.OK); } catch (final ApiRequestValidationException e) { final ErrorResponse errorResponse = new ErrorResponse(); final ObjectError objectError = e.getErrors().get(0); errorResponse.addError( resourceBundleMessageSource.getMessage(objectError.getCode(), objectError.getArguments(), LocaleContextHolder.getLocale())); return new ResponseEntity(errorResponse, HttpStatus.CONFLICT); } catch (final OverwriteDataException e2) { final Map<String, Object> result = new HashMap<>(); result.put(DerivedVariableServiceImpl.HAS_DATA_OVERWRITE_RESULT_KEY, true); return new ResponseEntity<>(result, HttpStatus.OK); } }

Target:
public ResponseEntity<Map<String, Object>> calculate( @PathVariable final String crop, @PathVariable final Integer studyId, @PathVariable final Integer datasetId, @RequestBody final CalculateVariableRequest request) { try { final Map<String, Object> result = this.derivedVariableService .execute(studyId, datasetId, request.getVariableId(), request.getGeoLocationIds(), request.isOverwriteExistingData()); return new ResponseEntity<>(result, HttpStatus.OK); } catch (final OverwriteDataException e2) { final Map<String, Object> result = new HashMap<>(); result.put(DerivedVariableServiceImpl.HAS_DATA_OVERWRITE_RESULT_KEY, true); return new ResponseEntity<>(result, HttpStatus.OK); } }
Source:
ViewContext(int sortColunm, int sortDirection, ITimeGraphEntry selection, @NonNull Set<@NonNull ITimeGraphEntry> collapsedEntries) { fSortColumnIndex = sortColunm; fSortDirection = sortDirection; fSelection = selection; fCollapsedEntries = collapsedEntries; }

Target:
ViewContext(int sortColunm, int sortDirection, ITimeGraphEntry selection, @NonNull Set<@NonNull ITimeGraphEntry> collapsedEntries) { fSortColumnIndex = sortColunm; fSortDirection = sortDirection; fSelection = selection; fCollapsedEntries = ImmutableSet.copyOf(collapsedEntries); }
Source:
private void MoveVdssToGoingToMaintenanceMode() { List<VDS> spms = new ArrayList<>(); List<VDS> vdss = new ArrayList<>(vdssToMaintenance.size()); vdss.addAll(vdssToMaintenance.values()); for (VDS vds : vdss) { if (vds.getSpmStatus() != VdsSpmStatus.SPM) { setVdsStatusToPrepareForMaintenance(vds); } else { spms.add(vds); } } for (VDS vds : spms) { setVdsStatusToPrepareForMaintenance(vds); } cancelIncommingMigrations(); freeLock(); }

Target:
private void MoveVdssToGoingToMaintenanceMode() { List<VDS> spms = new ArrayList<VDS>(); Iterator<VDS> it = vdssToMaintenance.values().iterator(); while (it.hasNext()) { VDS vds = it.next(); if (vds.getSpmStatus() != VdsSpmStatus.SPM) { if (!setVdsStatusToPrepareForMaintenance(vds)) { it.remove(); } } else { spms.add(vds); } } for (VDS vds : spms) { if (!setVdsStatusToPrepareForMaintenance(vds)) { vdssToMaintenance.remove(vds.getId()); } } cancelIncommingMigrations(); freeLock(); }
Source:
static DashboardInfo parse(Project definingProject, String refName, String path, Config config, String project, Set<Project.DashboardType> setTypes) throws UnsupportedEncodingException { DashboardInfo info = new DashboardInfo(refName, path); info.project = project; info.definingProject = definingProject.getName(); info.title = config.getString("dashboard", null, "title"); info.description = config.getString("dashboard", null, "description"); info.foreach = config.getString("dashboard", null, "foreach"); String id = refName + ":" + path; for (Project.DashboardType type : types(definingProject, id)) { if (setTypes.contains(type)) { info.types.add(type); } } UrlEncoded u = new UrlEncoded("/dashboard/"); u.put("title", Objects.firstNonNull(info.title, info.path) if (info.foreach != null) { u.put("foreach", replace(project, info.foreach)); } for (String name : config.getSubsections("section")) { Section s = new Section(); s.name = name; s.query = config.getString("section", name, "query"); u.put(s.name, replace(project, s.query)); info.sections.add(s); } info.parameters = u.getParameters().replace("%3A", ":"); info.url = u.toString().replace("%3A", ":"); return info; }

Target:
static DashboardInfo parse(Project definingProject, String refName, String path, Config config, String project, Set<Project.DashboardType> setTypes) throws UnsupportedEncodingException { DashboardInfo info = new DashboardInfo(refName, path); info.project = project; info.definingProject = definingProject.getName(); info.title = config.getString("dashboard", null, "title"); info.description = config.getString("dashboard", null, "description"); info.foreach = config.getString("dashboard", null, "foreach"); String id = refName + ":" + path; for (Project.DashboardType type : types(definingProject, id)) { if (setTypes.contains(type)) { info.types.add(type); } } UrlEncoded u = new UrlEncoded("/dashboard/"); u.put("title", Objects.firstNonNull(info.title, info.path)); if (info.foreach != null) { u.put("foreach", replace(project, info.foreach)); } for (String name : config.getSubsections("section")) { Section s = new Section(); s.name = name; s.query = config.getString("section", name, "query"); u.put(s.name, replace(project, s.query)); info.sections.add(s); } info.parameters = u.getParameters().replace("%3A", ":"); info.url = u.toString().replace("%3A", ":"); return info; }
Source:
private ArrayList<Map<ActionParameter, String>> getMappedParamToValue(List<Map<String, String>> mappedParamToValue) { ArrayList<Map<ActionParameter, String>> newMappedParamToValue = new ArrayList<Map<ActionParameter, String>>(); for (Map<String, String> map : mappedParamToValue) { Map<ActionParameter, String> tempMap = new HashMap<ActionParameter, String>(); for (Map.Entry<String, String> entry : map.entrySet()) { tempMap.put(new ActionParameter(entry.getKey()), entry.getValue()); } newMappedParamToValue.add(tempMap); } return newMappedParamToValue; }

Target:
private List<Map<ActionParameter, String>> getMappedParamToValue(List<Map<String, String>> mappedParamToValue) { return mappedParamToValue.stream().map(m -> m.entrySet().stream().collect(Collectors.toMap(p -> new ActionParameter(p.getKey()), p-> p.getValue()))).collect(Collectors.toList()); }
Source:
private void addMediaToUploadService(@NonNull MediaModel media) { if (!NetworkUtils.isNetworkAvailable(this)) { AppLog.v(AppLog.T.MEDIA, "Unable to start UploadService, internet connection required."); ToastUtils.showToast(this, R.string.no_network_message, ToastUtils.Duration.SHORT); } ArrayList<MediaModel> mediaList = new ArrayList<>(); mediaList.add(media); UploadService.uploadMedia(this, mediaList); }

Target:
private void addMediaToUploadService(@NonNull MediaModel media) { if (!NetworkUtils.isNetworkAvailable(this)) { AppLog.v(AppLog.T.MEDIA, "Unable to start UploadService, internet connection required."); ToastUtils.showToast(this, R.string.no_network_message, ToastUtils.Duration.SHORT); return; } ArrayList<MediaModel> mediaList = new ArrayList<>(); mediaList.add(media); UploadService.uploadMedia(this, mediaList); }