auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void constructFromMap() { final NavigableMap<Long, List<Integer>> r = new TreeMap<>(); final List<Integer> expectedList = Arrays.asList( 0, 1, 2, 3, 10, 11, 12, 13, 30, 31, 32, 33); r.put(1L, Arrays.asList(10, 11, 12, 13)); r.put(0L, Arrays.asList(0, 1, 2, 3)); r.put(3L, Arrays.asList(30, 31, 32, 33)); final StreamingCommitterState<Integer> streamingCommitterState = new StreamingCommitterState<>( r); Assert.assertArrayEquals( expectedList.toArray(), streamingCommitterState.getCommittables().toArray()); }

Target:
public void constructFromMap() { final NavigableMap<Long, List<Integer>> r = new TreeMap<>(); final List<Integer> expectedList = Arrays.asList(0, 1, 2, 3, 10, 11, 12, 13, 30, 31, 32, 33); r.put(1L, Arrays.asList(10, 11, 12, 13)); r.put(0L, Arrays.asList(0, 1, 2, 3)); r.put(3L, Arrays.asList(30, 31, 32, 33)); final StreamingCommitterState<Integer> streamingCommitterState = new StreamingCommitterState<>( r); assertThat( streamingCommitterState.getCommittables(), equalTo( expectedList)); }
Source:
public Device getLocalDevice() { List<Device> devices = getDevices(true); if (devices.isEmpty()) { Log.e(TAG, "getLocalDevice: devices is empty"); throw new RuntimeException(); } Log.v(TAG, "getLocalDevice: Looking for local device ID " + mLocalDeviceId); for (Device d : devices) { if (d.deviceID.equals(mLocalDeviceId)) { return deepCopy(d, Device.class); } } throw new RuntimeException(); }

Target:
public Device getLocalDevice() { List<Device> devices = getDevices(true); if (devices.isEmpty()) { throw new RuntimeException("RestApi.getLocalDevice: devices is empty."); } Log.v(TAG, "getLocalDevice: Looking for local device ID " + mLocalDeviceId); for (Device d : devices) { if (d.deviceID.equals(mLocalDeviceId)) { return deepCopy(d, Device.class); } } throw new RuntimeException("RestApi.getLocalDevice: Failed to get the local device crucial to continuing execution."); }
Source:
public void testSubmitToUdpInput() throws Exception { Service service = connect(); String indexName = temporaryName(); Integer udpPort = 10000; while (service.getInputs().containsKey(udpPort.toString())) { udpPort += 1; } Index index = null; UdpInput input = null; try { index = service.getIndexes().create(indexName); Args args = new Args(); args.add("index", indexName); input = service.getInputs().create(udpPort.toString(), InputKind.Udp, args); int nEvents = index.getTotalEventCount(); input.submit(getTimestamp() + " Boris the mad baboon!\r\n"); int nTries = 50; while (nTries > 0) { index.refresh(); if (index.getTotalEventCount() == nEvents + 1) { break; } else { nTries -= 1; Thread.sleep(1000); } } if (nTries == 0) { SplunkTestCase.fail("Timed out before new events were found in index."); } } finally { if (index != null && service.versionCompare("5.0") >= 0) { index.remove(); } if (input != null) { input.remove(); } } }

Target:
public void testSubmitToUdpInput() throws Exception { Service service = connect(); String indexName = temporaryName(); int udpPort = 10000; while (service.getInputs().containsKey(String.valueOf(udpPort))) { udpPort += 1; } Index index = null; UdpInput input = null; try { index = service.getIndexes().create(indexName); Args args = new Args(); args.add("index", indexName); input = service.getInputs().create(String.valueOf(udpPort), InputKind.Udp, args); int nEvents = index.getTotalEventCount(); input.submit(createTimestamp() + " Boris the mad baboon!\r\n"); int nTries = 50; while (nTries > 0) { index.refresh(); if (index.getTotalEventCount() == nEvents + 1) { break; } else { nTries -= 1; Thread.sleep(1000); } } if (nTries == 0) { SplunkTestCase.fail("Timed out before new events were found in index."); } } finally { if (index != null && service.versionCompare("5.0") >= 0) { index.remove(); } if (input != null) { input.remove(); } } }
Source:
public void configureWebApplication() throws Exception { File extractedWebAppDir= new File(getTmpDirectory(), "webapp"); if (isExtractedWebAppDirStale(extractedWebAppDir, webAppFile)) { FileUtils.deleteDirectory(extractedWebAppDir); } super.configureWebApplication(); getWebAppConfig().setWar(webAppFile.getCanonicalPath()); HashLoginService hashLoginService = (new HashLoginService("Jenkins Realm")); hashLoginService.setConfig(System.getProperty("jetty.home", ".") + "/etc/realm.properties"); getWebAppConfig().getSecurityHandler().setLoginService(hashLoginService); }

Target:
public void configureWebApplication() throws Exception { File extractedWebAppDir= new File(getTmpDirectory(), "webapp"); if (isExtractedWebAppDirStale(extractedWebAppDir, webAppFile)) { FileUtils.deleteDirectory(extractedWebAppDir); } super.configureWebApplication(); getWebAppConfig().setWar(webAppFile.getCanonicalPath()); HashLoginService hashLoginService = (new HashLoginService("Jenkins Realm")); hashLoginService.setConfig(System.getProperty("jetty.home", "work") + "/etc/realm.properties"); getWebAppConfig().getSecurityHandler().setLoginService(hashLoginService); }
Source:
protected Object visitLogicalBinaryExpression(LogicalBinaryExpression node, Object context) { LogicalBinaryExpression.Type type = node.getType(); Object left = process(node.getLeft(), context); if (isPredicate && type == LogicalBinaryExpression.Type.AND && Boolean.FALSE.equals(left)) { return left; } if (isPredicate && type == LogicalBinaryExpression.Type.OR && Boolean.TRUE.equals(left)) { return left; } Object right = process(node.getRight(), context); switch (type) { case AND: { if (Boolean.FALSE.equals(left) || Boolean.TRUE.equals(right)) { return left; } if (Boolean.FALSE.equals(right) || Boolean.TRUE.equals(left)) { return right; } break; } case OR: { if (Boolean.TRUE.equals(left) || Boolean.FALSE.equals(right)) { return left; } if (Boolean.TRUE.equals(right) || Boolean.FALSE.equals(left)) { return right; } break; } } if (left == null && right == null) { return null; } return new LogicalBinaryExpression(node.getType(), toExpression(left, type(node.getLeft())), toExpression(right, type(node.getRight()))); }

Target:
protected Object visitLogicalBinaryExpression(LogicalBinaryExpression node, Object context) { Object left = process(node.getLeft(), context); Object right; switch (node.getType()) { case AND: { if (Boolean.FALSE.equals(left)) { return false; } right = process(node.getRight(), context); if (Boolean.FALSE.equals(left) || Boolean.TRUE.equals(right)) { return left; } if (Boolean.FALSE.equals(right) || Boolean.TRUE.equals(left)) { return right; } break; } case OR: { if (Boolean.TRUE.equals(left)) { return true; } right = process(node.getRight(), context); if (Boolean.TRUE.equals(left) || Boolean.FALSE.equals(right)) { return left; } if (Boolean.TRUE.equals(right) || Boolean.FALSE.equals(left)) { return right; } break; } default: throw new IllegalStateException("Unknown LogicalBinaryExpression#Type"); } if (left == null && right == null) { return null; } return new LogicalBinaryExpression(node.getType(), toExpression(left, type(node.getLeft())), toExpression(right, type(node.getRight()))); }
Source:
public Optional<Kill> getKill() { if (kill == null) { return Optional.empty(); } return Optional.of(kill); }

Target:
public Optional<Kill> getKill() { return Optional.empty().ofNullable(kill); }
Source:
public void setup() { sessionFactory = mock(SessionFactory.class); hibernateTemplate = mock(HibernateTemplate.class); goCache = mock(GoCache.class); systemEnvironment = mock(SystemEnvironment.class); databaseStrategy = mock(DatabaseStrategy.class); queryExtensions = mock(QueryExtensions.class); when(databaseStrategy.getQueryExtensions()).thenReturn(queryExtensions); pipelineRepository = new PipelineRepository(sessionFactory, goCache,systemEnvironment, databaseStrategy); pipelineRepository.setHibernateTemplate(hibernateTemplate); }

Target:
public void setup() { sessionFactory = mock(SessionFactory.class); hibernateTemplate = mock(HibernateTemplate.class); goCache = mock(GoCache.class); systemEnvironment = mock(SystemEnvironment.class); databaseStrategy = mock(DatabaseStrategy.class); pipelineRepository = new PipelineRepository(sessionFactory, goCache,systemEnvironment, databaseStrategy); pipelineRepository.setHibernateTemplate(hibernateTemplate); }
Source:
public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader!"); metrics.isLeader.set(true); zkUtils.subscribeToProcessorChange(new ProcessorChangeHandler(zkUtils)); debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }

Target:
public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader"); metrics.isLeader.set(true); zkUtils.subscribeToProcessorChange(new ProcessorChangeHandler(zkUtils)); debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }
Source:
public Optional<String> getUsername(PublicSigningKey signer) { String name = reverseLookup.get(signer); if (name == null) return Optional.empty(); return Optional.of(name); }

Target:
public Optional<String> getUsername(PublicSigningKey signer) { String name = reverseLookup.get(signer); return Optional.ofNullable(name); }
Source:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { return method.invoke(bean, args); } catch (Throwable e) { logger.error("Convert RpcException to real exception"); Throwable t; while ((t = e.getCause()) != null) { e = t; } throw e; } }

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { return method.invoke(bean, args); } catch (UndeclaredThrowableException e) { logger.error("Convert RpcException to real exception"); if (e.getCause() instanceof InvocationTargetException) { throw e.getCause().getCause(); } else { throw e; } } }
Source:
public void start(StartContext context) throws StartException { final ExecutorService executorService = getExecutorServiceInjector().getValue(); this.hostControllerConfigurationPersister = new HostControllerConfigurationPersister(environment, hostControllerInfo, executorService, hostExtensionRegistry, extensionRegistry); setConfigurationPersister(hostControllerConfigurationPersister); prepareStepHandler.setExecutorService(executorService); ThreadFactory pingerThreadFactory = doPrivileged(new PrivilegedAction<JBossThreadFactory>() { public JBossThreadFactory run() { return new JBossThreadFactory(new ThreadGroup("proxy-pinger-threads"), Boolean.TRUE, null, "%G - %t", null, null); } }); pingScheduler = Executors.newScheduledThreadPool(PINGER_POOL_SIZE, pingerThreadFactory); ContentCleanerService.addServiceOnHostController(context.getChildTarget(), DomainModelControllerService.SERVICE_NAME, CLIENT_FACTORY_CAPABILITY.getCapabilityServiceName(), HC_EXECUTOR_SERVICE_NAME, HC_SCHEDULED_EXECUTOR_SERVICE_NAME); super.start(context); pingScheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { slaveHostRegistrations.pruneExpired(); } catch (Exception e) { HostControllerLogger.DOMAIN_LOGGER.debugf(e, "failed to execute eviction task"); } } }, 1, 1, TimeUnit.MINUTES); }

Target:
public void start(StartContext context) throws StartException { final ExecutorService executorService = getExecutorServiceInjector().getValue(); this.hostControllerConfigurationPersister = new HostControllerConfigurationPersister(environment, hostControllerInfo, executorService, hostExtensionRegistry, extensionRegistry); setConfigurationPersister(hostControllerConfigurationPersister); prepareStepHandler.setExecutorService(executorService); ThreadFactory pingerThreadFactory = doPrivileged(new PrivilegedAction<JBossThreadFactory>() { public JBossThreadFactory run() { return new JBossThreadFactory(new ThreadGroup("proxy-pinger-threads"), Boolean.TRUE, null, "%G - %t", null, null); } }); pingScheduler = Executors.newScheduledThreadPool(PINGER_POOL_SIZE, pingerThreadFactory); ContentCleanerService.addServiceOnHostController(context.getChildTarget(), DomainModelControllerService.SERVICE_NAME, CLIENT_FACTORY_SERVICE_NAME, HC_EXECUTOR_SERVICE_NAME, HC_SCHEDULED_EXECUTOR_SERVICE_NAME); super.start(context); pingScheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { slaveHostRegistrations.pruneExpired(); } catch (Exception e) { HostControllerLogger.DOMAIN_LOGGER.debugf(e, "failed to execute eviction task"); } } }, 1, 1, TimeUnit.MINUTES); }
Source:
public void visitForEachStatement(ForEachStatement tree) { scan(tree.variable()); scan(tree.expression()); TypeTree typeTree = tree.variable().type(); JavaType iterableType = (JavaType) tree.expression().symbolType(); if (typeTree.is(Tree.Kind.VAR_TYPE)) { JavaType iteredObjectType = getIteredObjectType(iterableType); setInferedType(upwardProjection(iteredObjectType), (DeferredType) typeTree.symbolType()); } scan(tree.statement()); }

Target:
public void visitForEachStatement(ForEachStatement tree) { scan(tree.variable()); scan(tree.expression()); TypeTree typeTree = tree.variable().type(); if (typeTree.is(Tree.Kind.VAR_TYPE)) { JavaType iteratedObjectType = getIteratedObjectType((JavaType) tree.expression().symbolType()); setInferedType(upwardProjection(iteratedObjectType), (DeferredType) typeTree.symbolType()); } scan(tree.statement()); }
Source:
private Function<DataObject, Promise<Void>> onDelete() { return new Function<DataObject, Promise<Void>>() { @Override public Promise<Void> apply(DataObject deletedObject) throws FunctionException { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { eventBus.fireEvent(new ResourceNodeDeletedEvent(ResourceBasedNode.this)); } }); return Promises.resolve(null); } }; }

Target:
private Function<DataObject, Promise<Void>> onDelete() { return new Function<DataObject, Promise<Void>>() { @Override public Promise<Void> apply(DataObject deletedObject) throws FunctionException { eventBus.fireEvent(new ResourceNodeDeletedEvent(ResourceBasedNode.this)); return Promises.resolve(null); } }; }
Source:
public void close() throws Exception { }

Target:
public void close() { }
Source:
public synchronized void removeQuotaFromCache(Guid storagePoolId, List<Guid> quotaList) { lock.writeLock().lock(); try { if (!storagePoolQuotaMap.containsKey(storagePoolId)) { return; } synchronized (storagePoolQuotaMap.get(storagePoolId)) { Map<Guid, Quota> map = storagePoolQuotaMap.get(storagePoolId); for (Guid quotaId : quotaList) { map.remove(quotaId); } } } finally { lock.writeLock().unlock(); } }

Target:
public void removeQuotaFromCache(Guid storagePoolId, List<Guid> quotaList) { lock.writeLock().lock(); try { if (!storagePoolQuotaMap.containsKey(storagePoolId)) { return; } synchronized (storagePoolQuotaMap.get(storagePoolId)) { Map<Guid, Quota> map = storagePoolQuotaMap.get(storagePoolId); for (Guid quotaId : quotaList) { map.remove(quotaId); } } } finally { lock.writeLock().unlock(); } }
Source:
public Void call() throws Exception { System.out.println(BANNER); System.out.println("Version: " + BrooklynVersion.get()); System.out.println("Website: <LINK_0>"); System.out.println("Source: <LINK_1>"); System.out.println(); System.out.println("Copyright 2011-2014 The Apache Software Foundation."); System.out.println("Licensed under the Apache 2.0 License"); System.out.println(); Console console = System.console(); if (console == null) { System.err.println("No console; cannot get password securely from standard input; aborting"); } System.out.print("Enter password: "); System.out.flush(); char[] chars = console.readPassword(); if (Strings.isBlank(new String(chars))) { System.err.println("Password must not be blank; aborting"); return null; } System.out.print("Re-enter password: "); System.out.flush(); char[] chars2 = console.readPassword(); if (!Arrays.equals(chars, chars2)) { System.err.println("Passwords did not match; aborting"); return null; } String salt = Identifiers.makeRandomId(4); String sha256password = PasswordHasher.sha256(salt, new String(chars)); System.out.println(); System.out.println("Please enter the following into your brooklyn.properies:"); System.out.println(); System.out.println("brooklyn.webconsole.security.users="+user); System.out.println("brooklyn.webconsole.security.user."+user+".salt="+salt); System.out.println("brooklyn.webconsole.security.user."+user+".sha256="+sha256password); return null; }

Target:
public Void call() throws Exception { checkCanReadPassword(); System.out.print("Enter password: "); System.out.flush(); String password = readPassword(); if (Strings.isBlank(password)) { throw new UserFacingException("Password must not be blank; aborting"); } System.out.print("Re-enter password: "); System.out.flush(); String password2 = readPassword(); if (!password.equals(password2)) { throw new UserFacingException("Passwords did not match; aborting"); } String salt = Identifiers.makeRandomId(4); String sha256password = PasswordHasher.sha256(salt, new String(password)); System.out.println(); System.out.println("Please add the following to your brooklyn.properties:"); System.out.println(); System.out.println("brooklyn.webconsole.security.users="+user); System.out.println("brooklyn.webconsole.security.user."+user+".salt="+salt); System.out.println("brooklyn.webconsole.security.user."+user+".sha256="+sha256password); return null; }
Source:
public void testDSLWithFrom() { final RuleModel m = new RuleModel(); m.name = "testDSLWithFrom"; m.lhs = new IPattern[2]; m.rhs = new IAction[0]; final FromCollectCompositeFactPattern from = new FromCollectCompositeFactPattern(); final FromCompositeFactPattern rightPattern = new FromCompositeFactPattern(); final FactPattern person = new FactPattern("Person"); person.setBoundName("$person"); m.lhs[0] = person; rightPattern.setFactPattern(new FactPattern("Person")); rightPattern.setExpression(new ExpressionFormLine(new ExpressionVariable(person.getBoundName(), person.getFactType()))); from.setRightPattern(rightPattern); from.setFactPattern(new FactPattern("java.util.List")); m.lhs[1] = from; final RuleModel modelSpy = spy(m); doReturn(true).when(modelSpy).hasDSLSentences(); final String drl = ruleModelPersistence.marshal(modelSpy); final RuleModel tempModel = spy(ruleModelPersistence.unmarshalUsingDSL(drl, null, dmo, "")); doReturn(true).when(tempModel).hasDSLSentences(); final String newDrl = ruleModelPersistence.marshal(tempModel); final RuleModel newModel = ruleModelPersistence.unmarshalUsingDSL(newDrl, null, dmo, ""); assertTrue(newModel.lhs[0] instanceof FactPattern); assertTrue(newModel.lhs[1] instanceof FromCollectCompositeFactPattern); }

Target:
public void testDSLWithFrom() { final RuleModel m = new RuleModel(); m.name = "testDSLWithFrom"; m.lhs = new IPattern[2]; m.rhs = new IAction[0]; final FromCollectCompositeFactPattern from = new FromCollectCompositeFactPattern(); final FromCompositeFactPattern rightPattern = new FromCompositeFactPattern(); final FactPattern person = new FactPattern("Person"); person.setBoundName("$person"); m.lhs[0] = person; rightPattern.setFactPattern(new FactPattern("Person")); rightPattern.setExpression(new ExpressionFormLine(new ExpressionVariable(person.getBoundName(), person.getFactType()))); from.setRightPattern(rightPattern); from.setFactPattern(new FactPattern("java.util.List")); m.lhs[1] = from; final RuleModel modelSpy = spy(m); doReturn(true).when(modelSpy).hasDSLSentences(); final String drl = ruleModelPersistence.marshal(modelSpy); final RuleModel tempModel = spy(ruleModelPersistence.unmarshalUsingDSL(drl, null, dmo, "")); doReturn(true).when(tempModel).hasDSLSentences(); final String newDrl = ruleModelPersistence.marshal(tempModel); final RuleModel newModel = ruleModelPersistence.unmarshalUsingDSL(newDrl, null, dmo, ""); assertTrue(newModel.lhs[0] instanceof FactPattern); assertTrue(newModel.lhs[1] instanceof FromCollectCompositeFactPattern); final String[] rows = newDrl.split("\n"); boolean foundWhen = false; for (final String row : rows) { if (row.trim().startsWith("then")) { break; } if (foundWhen && !row.trim().isEmpty() && !row.trim().startsWith(">")) { fail("Each row inside the LHS needs to start with >. The row with the issue: " + row); } if (row.trim().startsWith("when")) { foundWhen = true; } } }
Source:
public void onMediaRetryAllClicked(Set<String> failedMediaIds) { UploadService.cancelFinalNotification(this, mPost); UploadService.cancelFinalNotificationForMedia(this, mSite); ArrayList<MediaModel> failedMedia = new ArrayList<>(); for (String mediaId : failedMediaIds) { failedMedia.add(mMediaStore.getMediaWithLocalId(Integer.valueOf(mediaId))); } if (!failedMedia.isEmpty()) { for (MediaModel mediaModel : failedMedia) { mediaModel.setUploadState(MediaUploadState.QUEUED); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(mediaModel)); } startUploadService(failedMedia); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }

Target:
public void onMediaRetryAllClicked(Set<String> failedMediaIds) { UploadService.cancelFinalNotification(this, mPost); UploadService.cancelFinalNotificationForMedia(this, mSite); ArrayList<MediaModel> failedMediaList = new ArrayList<>(); for (String mediaId : failedMediaIds) { failedMediaList.add(mMediaStore.getMediaWithLocalId(Integer.valueOf(mediaId))); } if (!failedMediaList.isEmpty()) { for (MediaModel mediaModel : failedMediaList) { mediaModel.setUploadState(MediaUploadState.QUEUED); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(mediaModel)); } startUploadService(failedMediaList); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }
Source:
private boolean isSchemaAccessible(CatalogSchemaName schema) { Set<String> schemas = ImmutableSet.of(schema.getSchemaName()); schemas = accessControl.filterSchemas(session.getRequiredTransactionId(), session.getIdentity(), schema.getCatalogName(), schemas); return schemas.contains(schema.getSchemaName()) && metadata.schemaExists(session, schema); }

Target:
private boolean isSchemaAccessible(CatalogSchemaName schema) { return metadata.schemaExists(session, schema) && filterSchemas(schema.getCatalogName(), ImmutableSet.of(schema.getSchemaName())).contains(schema.getSchemaName()); }
Source:
public boolean isSchemaEnum(Type type) { for (Name name : SCHEMA_ENUMS) { if (name.toString().equals(type.getName().toString())) { return true; } } return false; }

Target:
public boolean isSchemaEnum(Type type) { return SCHEMA_ENUMS.contains(type.getName()); }
Source:
private ComponentUISpecification getCustomProcessorUISpecification (ComponentUISpecification componentUISpecification) { ComponentUISpecification result = new ComponentUISpecification(); List<ComponentUISpecification.UIField> fields = new ArrayList<>(); for (ComponentUISpecification.UIField uiField: componentUISpecification.getFields()) { if (uiField.getFieldName().startsWith(TopologyLayoutConstants.JSON_KEY_CUSTOM_PROCESSOR_PREFIX)) { ComponentUISpecification.UIField newUIField = new ComponentUISpecification.UIField(uiField); newUIField.setFieldName(uiField.getFieldName().replaceFirst(TopologyLayoutConstants.JSON_KEY_CUSTOM_PROCESSOR_PREFIX_REGEX, "")); fields.add(newUIField); } } result.setFields(fields); return (result.getFields().size() == 0 ? null : result); }

Target:
private ComponentUISpecification getCustomProcessorUISpecification (ComponentUISpecification componentUISpecification) { ComponentUISpecification result = new ComponentUISpecification(); List<ComponentUISpecification.UIField> fields = new ArrayList<>(); for (ComponentUISpecification.UIField uiField: componentUISpecification.getFields()) { if (uiField.getFieldName().startsWith(TopologyLayoutConstants.JSON_KEY_CUSTOM_PROCESSOR_PREFIX)) { ComponentUISpecification.UIField newUIField = new ComponentUISpecification.UIField(uiField); newUIField.setFieldName(uiField.getFieldName().replaceFirst(TopologyLayoutConstants.JSON_KEY_CUSTOM_PROCESSOR_PREFIX_REGEX, "")); fields.add(newUIField); } } result.setFields(fields); return (result.getFields().isEmpty() ? null : result); }
Source:
void verifyEnumBraceStyle(ParserRuleContext ctx) { for (ParseTree child : ctx.children) { if (child instanceof TerminalNodeImpl) { Token openBrace = ((TerminalNodeImpl) child).getSymbol(); Location openBraceLocation = ListenerUtil.getTokenLocation(openBrace); ParserRuleContext leftSibling = (ParserRuleContext) ParseTreeUtil.getLeftSibling(child); Location leftSiblingLocation = ListenerUtil.getContextStopLocation(leftSibling); if (openBraceLocation.line != leftSiblingLocation.line) { printer.warn(Messages.ENUM + Messages.OPEN_BRACKET_STYLE, openBraceLocation); } else if (checkLeftSpaces(leftSibling.getStop(), openBrace, 1)) { printer.error(Messages.OPEN_BRACE + Messages.SPACE_BEFORE, openBraceLocation); } break; } } ParseTree lastChild = ParseTreeUtil.getLastChild(ctx); Location closeBraceLocation = ListenerUtil.getParseTreeStartLocation(lastChild); Location closeBraceLeftSiblingLocation = ListenerUtil.getParseTreeStopLocation( ParseTreeUtil.getLeftSibling(lastChild)); if (closeBraceLocation.line == closeBraceLeftSiblingLocation.line) { printer.warn(Messages.ENUM + Messages.CLOSE_BRACKET_STYLE, closeBraceLocation); } }

Target:
void verifyEnumBraceStyle(ParserRuleContext ctx) { for (ParseTree child : ctx.children) { if (child instanceof TerminalNodeImpl) { Token openBrace = ((TerminalNodeImpl) child).getSymbol(); Location openBraceLocation = ListenerUtil.getTokenLocation(openBrace); ParserRuleContext leftSibling = (ParserRuleContext) ParseTreeUtil.getLeftSibling(child); Location leftSiblingLocation = ListenerUtil.getContextStopLocation(leftSibling); if (openBraceLocation.line != leftSiblingLocation.line) { printer.warn(Messages.ENUM + Messages.OPEN_BRACKET_STYLE, openBraceLocation); } else if (checkLeftSpaces(leftSibling.getStop(), openBrace, 1)) { printer.error(Messages.OPEN_BRACE + Messages.SPACE_BEFORE, openBraceLocation); } break; } } ParseTree lastChild = ParseTreeUtil.getLastChild(ctx); verifyCloseBraceStyle(lastChild, ParseTreeUtil.getLeftSibling(lastChild), Messages.ENUM); }
Source:
public Message send(Payload responsePayload) { Acknowledge.AcknowledgeBuilder ackBuilder = this.messageFactory.createAckBuilder(); ackBuilder.withResponderId(responderId); ackBuilder.withResponsesRemaining(-1); Message message = this.messageFactory.createResponseMessage(this.messageBuilder, ackBuilder.build(), responsePayload); sendMessage(message); return message; }

Target:
public Message send(Payload responsePayload) { AcknowledgeBuilder ackBuilder = this.messageFactory.createAckBuilder(); ackBuilder.withResponderId(responderId); ackBuilder.withResponsesRemaining(-1); Message message = this.messageFactory.createResponseMessage(this.messageBuilder, ackBuilder.build(), responsePayload); sendMessage(message); return message; }
Source:
public EditBlockDialog(Shell parentShell, EditableBlock block, EditableConfiguration config) { super(parentShell); this.config = config; this.block = block; blockLogSettingsViewModel = new BlockLogSettingsViewModel(this.block); viewModels.add(blockLogSettingsViewModel); blockRunControlViewModel = new BlockRunControlViewModel(this.block); viewModels.add(blockRunControlViewModel); blockDetailsViewModel = new BlockDetailsViewModel(this.block, this.config); viewModels.add(blockDetailsViewModel); for (ErrorMessageProvider provider : viewModels) { provider.addPropertyChangeListener("error", errorListener); } for (ErrorMessageProvider provider : viewModels) { provider.addPropertyChangeListener("warning", warningListener); } }

Target:
public EditBlockDialog(Shell parentShell, EditableBlock block, EditableConfiguration config) { super(parentShell); this.config = config; this.block = block; blockLogSettingsViewModel = new BlockLogSettingsViewModel(this.block); viewModels.add(blockLogSettingsViewModel); blockRunControlViewModel = new BlockRunControlViewModel(this.block); viewModels.add(blockRunControlViewModel); blockDetailsViewModel = new BlockDetailsViewModel(this.block, this.config); viewModels.add(blockDetailsViewModel); for (ErrorMessageProvider provider : viewModels) { provider.addPropertyChangeListener("error", errorListener); provider.addPropertyChangeListener("warning", warningListener); } }
Source:
protected void testDelStereotypedElementMergeRToL(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.DELETE, 2); assertDeletedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeRightToLeft(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsB4Left(right); }

Target:
protected void testDelStereotypedElementMergeRToL(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.DELETE, 2); assertDeletedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeRightToLeft(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsM1(right); assertEqualsM1(left); }
Source:
private void validateJBIDE22704() { BuilderImageApplicationWizardHandlingTest.nextToBuildConfigurationWizardPage(); applicationName = new LabeledText("Name: ").getText(); assertNotNull(applicationName); assertTrue(applicationName.length() > 0); String gitUrl = new LabeledText("Git Repository URL:").getText(); assertNotNull(gitUrl); if (gitUrl.length() < 1){ new CancelButton().click(); throw new OpenshiftTestInFailureException("JBIDE-23704 should be fixed now."); } new WaitUntil(new WidgetIsEnabled(new NextButton())); new NextButton().click(); new WaitUntil(new WidgetIsEnabled(new BackButton())); int numberofEnvironmentVariables = new DefaultTable().rowCount(); assertTrue(numberofEnvironmentVariables > 0); new NextButton().click(); new WaitUntil(new WidgetIsEnabled(new BackButton())); int numberOfServicePorts = new DefaultTable().rowCount(); assertTrue(numberOfServicePorts > 0); new CancelButton().click(); new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(120)); }

Target:
private void validateJBIDE22704() { BuilderImageApplicationWizardHandlingTest.nextToBuildConfigurationWizardPage(); applicationName = new LabeledText("Name: ").getText(); assertNotNull(applicationName); assertTrue(applicationName.length() > 0); String gitUrl = new LabeledText("Git Repository URL:").getText(); assertNotNull(gitUrl); if (gitUrl.length() < 1){ new CancelButton().click(); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD)); throw new OpenshiftTestInFailureException("JBIDE-23704 should be fixed now."); } new WaitUntil(new WidgetIsEnabled(new NextButton())); new NextButton().click(); new WaitUntil(new WidgetIsEnabled(new BackButton())); int numberofEnvironmentVariables = new DefaultTable().rowCount(); assertTrue(numberofEnvironmentVariables > 0); new NextButton().click(); new WaitUntil(new WidgetIsEnabled(new BackButton())); int numberOfServicePorts = new DefaultTable().rowCount(); assertTrue(numberOfServicePorts > 0); new CancelButton().click(); new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(120)); }
Source:
private boolean hasProjectPermission(String userName, Permission permission, RoleBasedAuthorizationStrategy rbas) { LOGGER.debug("Check the project permission of the user " + userName + " " + rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.PROJECT)); return hasPermission(userName, permission, rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.PROJECT)); }

Target:
private boolean hasProjectPermission(String userName, Permission permission, RoleBasedAuthorizationStrategy rbas) { return hasPermission(userName, permission, rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.PROJECT)); }
Source:
public void testGetOptionalExpressionWhenIsPresent() { final View content = mock(View.class); final Decision decision = mock(Decision.class); when(node.getContent()).thenReturn(content); when(content.getDefinition()).thenReturn(decision); when(decision.getExpression()).thenReturn(null); final Optional<Expression> optionalExpression = helper.getOptionalExpression(node); assertFalse(optionalExpression.isPresent()); }

Target:
public void testGetOptionalExpressionWhenIsPresent() { final View content = mock(View.class); final Decision decision = mock(Decision.class); final Expression expectedExpression = mock(Expression.class); when(node.getContent()).thenReturn(content); when(content.getDefinition()).thenReturn(decision); when(decision.getExpression()).thenReturn(expectedExpression); final Optional<Expression> optionalExpression = helper.getOptionalExpression(node); assertTrue(optionalExpression.isPresent()); assertEquals(expectedExpression, optionalExpression.get()); }
Source:
public void onActivated(OnActivatedComponent event, EntityRef entityRef, LASTeamComponent team, LocationComponent locationComponent) { logger.info("activated " + entityRef + " " + team.team); Set<EntityRef> teamEntities = teams.get(team.team); if (teamEntities == null) { teamEntities = Sets.newHashSet(); teams.put(team.team, teamEntities); } teamEntities.add(entityRef); entities.add(entityRef); WorkTargetComponent component = new WorkTargetComponent(); component.workUri = "LightAndShadow:attackMinion" + team.team; entityRef.addComponent(component); }

Target:
public void onActivated(OnActivatedComponent event, EntityRef entityRef, LASTeamComponent team, LocationComponent locationComponent) { Set<EntityRef> teamEntities = teams.get(team.team); if (teamEntities == null) { teamEntities = Sets.newHashSet(); teams.put(team.team, teamEntities); } teamEntities.add(entityRef); entities.add(entityRef); WorkTargetComponent component = new WorkTargetComponent(); component.workUri = "LightAndShadow:attackMinion" + team.team; entityRef.addComponent(component); }
Source:
public CompletableFuture<List<TableDescriptor>> listTableDescriptors(boolean arg0) { throw new UnsupportedOperationException("updateConfiguration"); }

Target:
public CompletableFuture<List<TableDescriptor>> listTableDescriptors(boolean arg0) { throw new UnsupportedOperationException("listTableDescriptors"); }
Source:
public ValidationResult validate(ConfigKey key, String value) { boolean returnValue = true; StringTokenizer tokenizer = new StringTokenizer(value, ","); while (tokenizer.hasMoreElements()) { String token = (String) tokenizer.nextElement(); String[] pair = token.split(":", -1); String password = pair[1]; if (!pwdValueHelper.validate(null, password).isOk()) { returnValue = false; break; } } return new ValidationResult(returnValue); }

Target:
public ValidationResult validate(ConfigKey key, String value) { StringTokenizer tokenizer = new StringTokenizer(value, ","); while (tokenizer.hasMoreElements()) { String token = (String) tokenizer.nextElement(); String[] pair = token.split(":", -1); String password = pair[1]; ValidationResult validationResult = pwdValueHelper.validate(null, password); if (!validationResult.isOk()) { return validationResult; } } return new ValidationResult(true); }
Source:
private boolean shouldAdd(String dimName) { final boolean belowThreshold = pQueue.size() < this.threshold; final boolean belowMax = belowThreshold || this.comparator.compare(pQueue.peek().getTopNMetricVal(), dimName) < 0; return belowMax && comparator.compare(dimName, previousStop) > 0; }

Target:
private boolean shouldAdd(String dimName) { final boolean belowThreshold = pQueue.size() < threshold; final boolean belowMax = belowThreshold || comparator.compare(pQueue.peek().getTopNMetricVal(), dimName) < 0; return belowMax && (previousStop == null || comparator.compare(dimName, previousStop) > 0); }
Source:
public R save(@RequestParam("name") String name, @RequestParam("definition") String definition, @RequestParam(value = "deploy", defaultValue = "true") boolean deploy) { final D moduleDefinition = createDefinition(name, definition); final D savedModuleDefinition = deployer.save(moduleDefinition); if (deploy) { Map<String, String> emptyMap = Collections.emptyMap(); deployer.deploy(name, emptyMap); } final R result = resourceAssemblerSupport.toResource(savedModuleDefinition); return result; }

Target:
public R save(@RequestParam("name") String name, @RequestParam("definition") String definition, @RequestParam(value = "deploy", defaultValue = "true") boolean deploy) { final D moduleDefinition = createDefinition(name, definition); final D savedModuleDefinition = deployer.save(moduleDefinition); if (deploy) { deployer.deploy(name, Collections.<String, String> emptyMap()); } final R result = resourceAssemblerSupport.toResource(savedModuleDefinition); return result; }
Source:
private void completeRequest(boolean closeNetworkChannel, boolean shouldDelay) { if ((closeNetworkChannel || forceClose) && ctx.channel().isOpen()) { if (!shouldDelay || (request != null && !request.getRestMethod().equals(RestMethod.POST)) || (this.nettyConfig.nettyServerCloseDelayTimeoutMs == 0)) { writeFuture.addListener(ChannelFutureListener.CLOSE); } else { writeFuture.addListener(DELAYED_CLOSE); nettyMetrics.delayedCloseScheduledCount.inc(); } logger.trace("Requested closing of channel {}", ctx.channel()); } closeRequest(); }

Target:
private void completeRequest(boolean closeNetworkChannel, boolean shouldDelay) { if ((closeNetworkChannel || forceClose) && ctx.channel().isOpen()) { if (shouldDelay && (request != null && request.getRestMethod().equals(RestMethod.POST)) && this.nettyConfig.nettyServerCloseDelayTimeoutMs > 0) { nettyMetrics.delayedCloseScheduledCount.inc(); writeFuture.addListener(DELAYED_CLOSE); } else { writeFuture.addListener(ChannelFutureListener.CLOSE); } logger.trace("Requested closing of channel {}", ctx.channel()); } closeRequest(); }
Source:
public ActionResult execute() { String blobKey = getNonNullRequestParamValue(Const.ParamsNames.BLOB_KEY); logic.deletePicture(new BlobKey(blobKey)); logic.deletePictureKey(userInfo.id); return new JsonResult("Your profile picture has been deleted successfully", HttpStatus.SC_OK); }

Target:
public ActionResult execute() { String googleId = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_ID); StudentProfileAttributes studentProfileAttributes = logic.getStudentProfile(googleId); if (studentProfileAttributes == null) { return new JsonResult("Invalid student profile", HttpStatus.SC_NOT_FOUND); } logic.deletePicture(new BlobKey(studentProfileAttributes.pictureKey)); logic.deletePictureKey(userInfo.id); return new JsonResult("Your profile picture has been deleted successfully", HttpStatus.SC_OK); }
Source:
public void deprecatesDefaultImage() throws IOException { final Profile profile = this.profile( new XMLDocument( StringUtils.join( "<p>", "<entry key='docker'>", "<entry key='image'>yegor256/rultor</entry>", "</entry>", "</p>" ) ) ); final Talk talk = this.talk(profile); final String dir = talk.read().xpath("/talk/daemon/dir/text()").get(0); MatcherAssert.assertThat( dir, Matchers.notNullValue() ); }

Target:
public void deprecatesDefaultImage() throws IOException { final Talk talk = this.talk(); final XML xml = talk.read(); for (final String path : xml.xpath("/p/entry[@key='merge']/entry[@key='script']") ) { if ("yegor256/rultor".equals(path)) { final String dir = talk.read() .xpath("/talk/daemon/dir/text()").get(0); MatcherAssert.assertThat( dir, StringStartsWith.startsWith("#### Deprecation Notice ####") ); } } }
Source:
private RowDataPoint dataPointFor(final Row row) { final ColumnDefinitions columnDefinitions = row.getColumnDefinitions(); if (columnDefinitions.contains("long_value")) { return new RowLongDataPoint(); } else { throw new AssertionError("row does not contain any known type"); } }

Target:
private RowDataPoint dataPointFor(final Row row) { final ColumnDefinitions columnDefinitions = row.getColumnDefinitions(); if (columnDefinitions.contains("long_value")) { return new RowDataPoint.RowLongDataPoint(); } else if (columnDefinitions.contains("float_value")) { return new RowDataPoint.RowFloatDataPoint(); } else if (columnDefinitions.contains("double_value")) { return new RowDataPoint.RowDoubleDataPoint(); } else { throw new AssertionError("row does not contain any known type"); } }
Source:
public void save() { try (BufferedWriter writer = Files.newBufferedWriter(getConfigFile(), TerasologyConstants.CHARSET)) { createGson().toJson(config, writer); } catch (IOException e) { logger.error("Failed to save config", e); } CoreRegistry.get(FlexibleConfigManager.class).save(); }

Target:
public void save() { try (BufferedWriter writer = Files.newBufferedWriter(getConfigFile(), TerasologyConstants.CHARSET)) { createGson().toJson(config, writer); } catch (IOException e) { logger.error("Failed to save config", e); } context.get(FlexibleConfigManager.class).saveAllConfigs(); }
Source:
public void podTemplateWithMultipleLabels() throws Exception { PodTemplate pt = new PodTemplate(); pt.setName("podTemplate"); pt.setLabel("label1 label2"); ContainerTemplate jnlp = new ContainerTemplate("jnlp", "jenkins/jnlp-slave:3.35-5-alpine"); pt.setContainers(Collections.singletonList(jnlp)); cloud.addTemplate(pt); SemaphoreStep.waitForStart("pod/1", b); Map<String, String> labels = getLabels(cloud, this, name); labels.put("jenkins/label","label1_label2"); PodList pods = cloud.connect().pods().withLabels(labels).list(); assertThat( "Expected one pod with labels " + labels + " but got: " + pods.getItems().stream().map(pod -> pod.getMetadata()).collect(Collectors.toList()), pods.getItems(), hasSize(1)); SemaphoreStep.success("pod/1", null); r.assertBuildStatusSuccess(r.waitForCompletion(b)); }

Target:
public void podTemplateWithMultipleLabels() throws Exception { PodTemplate pt = new PodTemplate(); pt.setName("podTemplate"); pt.setLabel("label1 label2"); ContainerTemplate jnlp = new ContainerTemplate("jnlp", "jenkins/jnlp-slave:3.35-5-alpine"); pt.setContainers(Collections.singletonList(jnlp)); cloud.addTemplate(pt); SemaphoreStep.waitForStart("pod/1", b); Map<String, String> labels = getLabels(cloud, this, name); labels.put("jenkins/label","label1_label2"); KubernetesSlave node = r.jenkins.getNodes().stream() .filter(KubernetesSlave.class::isInstance) .map(KubernetesSlave.class::cast) .findAny().get(); assertTrue(node.getAssignedLabels().containsAll(Label.parse("label1 label2"))); PodList pods = cloud.connect().pods().withLabels(labels).list(); assertThat( "Expected one pod with labels " + labels + " but got: " + pods.getItems().stream().map(pod -> pod.getMetadata()).collect(Collectors.toList()), pods.getItems(), hasSize(1)); SemaphoreStep.success("pod/1", null); r.assertBuildStatusSuccess(r.waitForCompletion(b)); }
Source:
private IStatus getModuleStatus(String moduleName) { StatusInfo status= new StatusInfo(); if (moduleName.length() > 0) { IStatus val= validateModuleName(moduleName); if (val.getSeverity() == IStatus.ERROR) { status.setError(Messages.format(NewWizardMessages.NewModuleInfoWizardPage_error_InvalidModuleName, val.getMessage())); } else if (val.getSeverity() == IStatus.WARNING) { status.setWarning(Messages.format(NewWizardMessages.NewModuleInfoWizardPage_warning_DiscouragedModuleName, val.getMessage())); } } else { status.setError(NewWizardMessages.NewModuleInfoWizardPage_error_EnterName); } return status; }

Target:
private IStatus getModuleStatus(String moduleName) { StatusInfo status= new StatusInfo(); if (moduleName != null && moduleName.length() > 0) { IStatus val= validateModuleName(moduleName); if (val.getSeverity() == IStatus.ERROR) { status.setError(Messages.format(NewWizardMessages.NewModuleInfoWizardPage_error_InvalidModuleName, val.getMessage())); } else if (val.getSeverity() == IStatus.WARNING) { status.setWarning(Messages.format(NewWizardMessages.NewModuleInfoWizardPage_warning_DiscouragedModuleName, val.getMessage())); } } else { status.setError(NewWizardMessages.NewModuleInfoWizardPage_error_EnterName); } return status; }
Source:
public void testWithInvalidForcedQualifier() throws Exception { MavenProject project = getProject("projects/buildqualifier", "p001/pom.xml"); BuildQualifierMojo mojo = createMojoWithProject(project); setVariableValueToObject(mojo, "forceContextQualifier", "invalid:Qualifier"); try { mojo.execute(); fail(); } catch (MojoFailureException e) { assertEquals( "Invalid build qualifier, it does not match the OSGi qualifier constraint ([0..9]|[a..zA..Z]|'_'|'-')", e.getMessage()); } }

Target:
public void testWithInvalidForcedQualifier() throws Exception { MavenProject project = getProject("projects/buildqualifier", "p001/pom.xml"); BuildQualifierMojo mojo = createMojoWithProject(project); setVariableValueToObject(mojo, "forceContextQualifier", "invalid:Qualifier"); try { mojo.execute(); fail(); } catch (MojoFailureException e) { assertThat(e.getMessage(), containsString("Invalid build qualifier")); } }
Source:
protected void doAppend(ByteBuffer bb) { throw new IllegalStateException("Can not add to this buffer!"); }

Target:
protected void doAppend(ByteBuffer bb) { throw new UnsupportedOperationException("Can not add to this buffer!"); }
Source:
public int compare(String o1, String o2) { LocalDate dateA; LocalDate dateB; try { dateA = LocalDate.parse(o1, DateTimeFormatter.ofPattern( campaign.getCampaignOptions().getDisplayDateFormat())); } catch (Exception ignored) { if ("-".equals(o2) && "-".equals(o1)) { return 0; } else if ("-".equals(o1)) { return 1; } else { return -1; } } try { dateB = LocalDate.parse(o2, DateTimeFormatter.ofPattern( campaign.getCampaignOptions().getDisplayDateFormat())); } catch (Exception ignored) { return -1; } return dateA.compareTo(dateB); }

Target:
public int compare(String o1, String o2) { if (Objects.equals(o1, o2)) { return 0; } else if ("-".equals(o1)) { return -1; } else if ("-".equals(o2)) { return 1; } LocalDate dateA; LocalDate dateB; try { dateA = LocalDate.parse(o1, DateTimeFormatter.ofPattern( campaign.getCampaignOptions().getDisplayDateFormat())); } catch (Exception ignored) { return -1; } try { dateB = LocalDate.parse(o2, DateTimeFormatter.ofPattern( campaign.getCampaignOptions().getDisplayDateFormat())); } catch (Exception ignored) { return 1; } return dateA.compareTo(dateB); }
Source:
public static int getNextFreeDimId() { int next = 0; while (true) { while (usedIds.contains(next)) next++; if (checkAvailable(next)) return next; } }

Target:
public static int getNextFreeDimId() { int next = lastUsedId; while (usedIds.contains(next) || !checkAvailable(next)) { next++; } return lastUsedId = next; }
Source:
private ApiDefinition getApiDefinitionForPaginatedList(boolean requiresFullDetails, Class<?> clazz) { ApiDefinition apiDefinition; if (requiresFullDetails == true) { apiDefinition = new ApiDefinition(ApiType.GET_LIST_WITH_DETAILS, clazz); } else { apiDefinition = new ApiDefinition(ApiType.GET_LIST, clazz); } return apiDefinition; }

Target:
private ApiDefinition getApiDefinitionForPaginatedList(boolean requiresFullDetails, Class<?> clazz) { ApiDefinition apiDefinition; if (requiresFullDetails) { apiDefinition = new ApiDefinition(ApiType.GET_LIST_WITH_DETAILS, clazz); } else { apiDefinition = new ApiDefinition(ApiType.GET_LIST, clazz); } return apiDefinition; }
Source:
public static MediaLayout buildComprehensiveLayout(Context context, TextView text, String audioURI, String imageURI, final String videoURI, final String bigImageURI, final String qrCodeContent, String inlineVideoURI, final String ttsText, int questionIndex) { MediaLayout mediaLayout = new MediaLayout(context); mediaLayout.setAVT(text, audioURI, imageURI, videoURI, bigImageURI, qrCodeContent, inlineVideoURI, false, questionIndex); if (ttsText != null && audioURI == null && imageURI == null && videoURI == null && qrCodeContent == null && inlineVideoURI == null) { mediaLayout.showTtsButton(ttsText); } return mediaLayout; }

Target:
public static MediaLayout buildComprehensiveLayout(Context context, TextView text, String audioURI, String imageURI, final String videoURI, final String bigImageURI, final String qrCodeContent, String inlineVideoURI, final String ttsText, int questionIndex) { MediaLayout mediaLayout = new MediaLayout(context); mediaLayout.setAVT(text, audioURI, imageURI, videoURI, bigImageURI, qrCodeContent, inlineVideoURI, false, questionIndex); if (ttsText != null && audioURI == null) { mediaLayout.showTtsButton(ttsText); } return mediaLayout; }