auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ServiceCreationConfiguration<ClusteringService> parseServiceCreationConfiguration(final Element fragment) { if ("cluster".equals(fragment.getLocalName())) { final Attr aliasAttribute = fragment.getAttributeNode("alias"); final String alias = (aliasAttribute == null ? "" : aliasAttribute.getValue()); URI connectionUri = null; final NodeList childNodes = fragment.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { final Node item = childNodes.item(i); if (Node.ELEMENT_NODE == item.getNodeType()) { if ("connection".equals(item.getLocalName())) { final Attr urlAttribute = ((Element)item).getAttributeNode("url"); final String urlValue = urlAttribute.getValue(); try { connectionUri = URI.create(urlValue); } catch (IllegalArgumentException e) { throw new RuntimeException( String.format("Value of %s attribute on XML configuration element <%s> in <%s> is not a valid URI - '%s'", urlAttribute.getName(), fragment.getTagName(), (fragment.getParentNode() == null ? "null" : fragment.getParentNode().getLocalName()), connectionUri)); } } } } return new ClusteringServiceConfiguration(alias, connectionUri); } throw new RuntimeException(String.format("XML configuration element <%s> in <%s> is not supported", fragment.getTagName(), (fragment.getParentNode() == null ? "null" : fragment.getParentNode().getLocalName()))); }

Target:
public ServiceCreationConfiguration<ClusteringService> parseServiceCreationConfiguration(final Element fragment) { if ("cluster".equals(fragment.getLocalName())) { URI connectionUri = null; final NodeList childNodes = fragment.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { final Node item = childNodes.item(i); if (Node.ELEMENT_NODE == item.getNodeType()) { if ("connection".equals(item.getLocalName())) { final Attr urlAttribute = ((Element)item).getAttributeNode("url"); final String urlValue = urlAttribute.getValue(); try { connectionUri = new URI(urlValue); } catch (URISyntaxException e) { throw new XmlConfigurationException( String.format("Value of %s attribute on XML configuration element <%s> in <%s> is not a valid URI - '%s'", urlAttribute.getName(), fragment.getTagName(), (fragment.getParentNode() == null ? "null" : fragment.getParentNode().getLocalName()), connectionUri), e); } } } } return new ClusteringServiceConfiguration(connectionUri); } throw new XmlConfigurationException(String.format("XML configuration element <%s> in <%s> is not supported", fragment.getTagName(), (fragment.getParentNode() == null ? "null" : fragment.getParentNode().getLocalName()))); }
Source:
public boolean artifactOmitted(Artifact artifact) { throw new UnsupportedOperationException(); }

Target:
public boolean artifactOmitted(Artifact artifact) { return perActionCache.artifactOmitted(artifact) || perBuildFileCache.artifactOmitted(artifact); }
Source:
public void testCanDecreaseMemoryCategory() { MemoryCache memoryCache = mock(MemoryCache.class); BitmapPool bitmapPool = mock(BitmapPool.class); MemoryCategory memoryCategory = MemoryCategory.NORMAL; Glide glide = new GlideBuilder().setMemoryCache(memoryCache).setBitmapPool(bitmapPool) .build(getContext()); glide.setMemoryCategory(memoryCategory); verify(memoryCache).setSizeMultiplier(eq(memoryCategory.getMultiplier())); verify(bitmapPool).setSizeMultiplier(eq(memoryCategory.getMultiplier())); MemoryCategory newMemoryCategory = MemoryCategory.LOW; MemoryCategory oldMemoryCategory = glide.setMemoryCategory(newMemoryCategory); assertEquals(memoryCategory, oldMemoryCategory); verify(memoryCache).setSizeMultiplier(eq(newMemoryCategory.getMultiplier())); verify(bitmapPool).setSizeMultiplier(eq(newMemoryCategory.getMultiplier())); }

Target:
public void testCanDecreaseMemoryCategory() { MemoryCache memoryCache = mock(MemoryCache.class); BitmapPool bitmapPool = mock(BitmapPool.class); MemoryCategory memoryCategory = MemoryCategory.NORMAL; Glide glide = new GlideBuilder().setBitmapPool(bitmapPool).setMemoryCache(memoryCache) .build(getContext()); glide.setMemoryCategory(memoryCategory); verify(memoryCache).setSizeMultiplier(eq(memoryCategory.getMultiplier())); verify(bitmapPool).setSizeMultiplier(eq(memoryCategory.getMultiplier())); MemoryCategory newMemoryCategory = MemoryCategory.LOW; MemoryCategory oldMemoryCategory = glide.setMemoryCategory(newMemoryCategory); assertEquals(memoryCategory, oldMemoryCategory); verify(memoryCache).setSizeMultiplier(eq(newMemoryCategory.getMultiplier())); verify(bitmapPool).setSizeMultiplier(eq(newMemoryCategory.getMultiplier())); }
Source:
public void compactInternally(TableReference tableRef, boolean inMaintenanceMode) { long startTime = System.currentTimeMillis(); maybeLog(() -> delegate.compactInternally(tableRef, inMaintenanceMode), (logger, stopwatch) -> { if (inMaintenanceMode) { logger.log("Call to KVS.compactInternally (in maintenance mode) at time {}, on table took ms.", LoggingArgs.startTimeMillis(startTime), LoggingArgs.tableRef(tableRef), LoggingArgs.durationMillis(stopwatch)); } else { logTimeAndTable("compactInternally", tableRef); } }); }

Target:
public void compactInternally(TableReference tableRef, boolean inMaintenanceMode) { long startTime = System.currentTimeMillis(); maybeLog(() -> delegate.compactInternally(tableRef, inMaintenanceMode), (logger, stopwatch) -> { if (inMaintenanceMode) { logger.log("Call to KVS.compactInternally (in maintenance mode) at time {}, on table took ms.", LoggingArgs.startTimeMillis(startTime), LoggingArgs.tableRef(tableRef), LoggingArgs.durationMillis(stopwatch)); } else { logger.log("Call to KVS.{} at time {}, on table took ms.", LoggingArgs.method("compactInternally"), LoggingArgs.startTimeMillis(startTime), LoggingArgs.tableRef(tableRef), LoggingArgs.durationMillis(stopwatch)); } }); }
Source:
public void setup() { bundles = new HashMap<ArtifactKey, File>(); ArtifactKey key1 = new DefaultArtifactKey("eclipse-plugin", "foo.bar.artifact1", "1.0"); ArtifactKey key2 = new DefaultArtifactKey("eclipse-plugin", "foo.bar.artifact2", "1.0"); File file1 = createNiceMock(File.class); File file2 = createNiceMock(File.class); expect(file1.getAbsolutePath()).andReturn("absolute/path/to/bundle1"); expect(file2.getAbsolutePath()).andReturn("absolute/path/to/bundle2"); replay(file1, file2); bundles.put(key1, file1); bundles.put(key2, file2); startLevel = new HashMap<String, BundleStartLevel>(); BundleStartLevel startLevel1 = new BundleStartLevel("foo.bar.artifact1", 6, true); startLevel.put("foo.bar.artifact1", startLevel1); Logger log = createNiceMock(Logger.class); factory = new DefaultEquinoxInstallationFactory(log); }

Target:
public void setup() { bundles = new HashMap<ArtifactKey, File>(); bundles.put(new DefaultArtifactKey("eclipse-plugin", "org.example.bundle1", "1.0"), mockFile("absolute/path/to/bundle1")); bundles.put(new DefaultArtifactKey("eclipse-plugin", "org.example.bundle2", "1.0"), mockFile("absolute/path/to/bundle2")); instDesc = new DefaultEquinoxInstallationDescription(); defaultLevel = new BundleStartLevel(null, 7, false); subject = new DefaultEquinoxInstallationFactory(mock(Logger.class)); }
Source:
public ICompletionProposal[] computeCompletionProposals(ITextViewer textViewer, int offset) { IDocument document = textViewer.getDocument(); try { IRegion lineInformationOfOffset = document.getLineInformationOfOffset(offset); String line = document.get(lineInformationOfOffset.getOffset(), lineInformationOfOffset.getLength()); if (line != null) { int indexOf = -1; Optional<String> prefix = fileRefPrefixes.stream().filter(p -> line.indexOf(p) != -1).findAny(); if (prefix.isPresent()) { indexOf = line.indexOf(prefix.get()); } if (indexOf == -1) { indexOf = line.indexOf(File.separator); } if (indexOf != -1) { IContainer parent = file.getParent(); int lastIndexOf = line.lastIndexOf(File.separator); if (lastIndexOf != -1 && indexOf != lastIndexOf) { String inlinePath = line.substring(indexOf + prefix.map(p -> p.length()).orElse(0), lastIndexOf); IResource member = parent.findMember(inlinePath, false); return computeProposals(line, offset, lastIndexOf, offset - lineInformationOfOffset.getOffset(), member); } return computeProposals(line, offset, lastIndexOf + prefix.map(p -> p.length()).orElse(0), offset - lineInformationOfOffset.getOffset(), parent); } } } catch (BadLocationException e) { } catch (CoreException e) { } return null; }

Target:
public ICompletionProposal[] computeCompletionProposals(ITextViewer textViewer, int offset) { IDocument document = textViewer.getDocument(); try { IRegion lineInformationOfOffset = document.getLineInformationOfOffset(offset); String line = document.get(lineInformationOfOffset.getOffset(), lineInformationOfOffset.getLength()); if (line != null) { int indexOf = -1; Optional<FileRefPrefix> prefix = fileRefPrefixes.stream() .filter(p -> line.indexOf(p.getFileRefPrefix()) != -1) .findAny(); if (prefix.isPresent()) { indexOf = line.indexOf(prefix.get().getFileRefPrefix()); } if (indexOf == -1) { indexOf = line.indexOf(File.separator); } if (indexOf != -1) { IContainer parent = file.getParent(); int lastIndexOf = line.lastIndexOf(File.separator); if (lastIndexOf != -1 && indexOf != lastIndexOf) { String inlinePath = line.substring( indexOf + prefix.map(p -> p.getFileRefPrefix().length()).orElse(0), lastIndexOf); IResource member = parent.findMember(inlinePath, false); return computeProposals(line, offset, lastIndexOf, offset - lineInformationOfOffset.getOffset(), member); } return computeProposals(line, offset, lastIndexOf + prefix.map(p -> p.getFileRefPrefix().length()).orElse(0), offset - lineInformationOfOffset.getOffset(), parent); } } } catch (BadLocationException e) { } catch (CoreException e) { } return null; }
Source:
public void testExecuteAndPostProcess() { prepareTestData(); testModifyResponses(); testIncorrectParameters(); testDifferentPrivileges(); testSubmitResponseForInvalidQuestion(); testClosedSession(); }

Target:
public void testExecuteAndPostProcess() { testModifyResponses(); testIncorrectParameters(); testSubmitResponseForInvalidQuestion(); testClosedSession(); }
Source:
public int compareTypeSafe(Value v, CompareMode mode, CastDataProvider provider) { return 0; }

Target:
public int compareTypeSafe(Value v, CompareMode mode, CastDataProvider provider) { throw new UnsupportedOperationException(); }
Source:
public BlueprintProvisioningState getBlueprintProvisioningState() { BlueprintProvisioningState blueprintProvisioningState = null; ClusterEntity clusterEntity = getClusterEntity(); blueprintProvisioningState = clusterEntity.getBlueprintProvisioningState(); return blueprintProvisioningState; }

Target:
public BlueprintProvisioningState getBlueprintProvisioningState() { ClusterEntity clusterEntity = getClusterEntity(); return clusterEntity.getBlueprintProvisioningState(); }
Source:
public Chain build() { List<Element> elements = new ArrayList<>(); for (final ByteBuffer buffer : buffers) { elements.add(new Element() { @Override public ByteBuffer getPayload() { return buffer.asReadOnlyBuffer(); } @Override public String toString() { return "Element{size=" + buffer.capacity() + "}"; } }); } return chainFromList(elements); }

Target:
public Chain build() { List<Element> elements = new ArrayList<>(); for (final ByteBuffer buffer : buffers) { elements.add(buffer::asReadOnlyBuffer); } return chainFromList(elements); }
Source:
public void after() { admin.getSession().getAdminClient().deleteSubpopulationPermanently(guid); developer.signOutAndDeleteUser(); }

Target:
public void after() { if (guid != null) { admin.getSession().getAdminClient().deleteSubpopulationPermanently(guid); } developer.signOutAndDeleteUser(); }
Source:
protected boolean validate() { macPool = getMacPool(); if (getCluster() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY); } List<VmNetworkInterface> nicsUnableToBeImported = getVm().getInterfaces() .stream() .filter(iface -> !shouldReassignMac(iface) && macPool.isMacInUse(iface.getMacAddress())) .collect(Collectors.toList()); if (!nicsUnableToBeImported.isEmpty()) { EngineMessage engineMessage = EngineMessage.ACTION_TYPE_FAILED_CANNOT_ADD_IFACE_DUE_TO_MAC_DUPLICATES; Collection<String> replacements = ReplacementUtils.getListVariableAssignmentString(engineMessage, nicsUnableToBeImported); validate(new ValidationResult(engineMessage, replacements)); } return true; }

Target:
protected boolean validate() { macPool = getMacPool(); if (getCluster() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY); } List<VmNetworkInterface> nicsUnableToBeImported = getVm().getInterfaces() .stream() .filter(this::ifaceMacCannotBeAddedToMacPool) .collect(Collectors.toList()); if (!nicsUnableToBeImported.isEmpty()) { EngineMessage engineMessage = EngineMessage.ACTION_TYPE_FAILED_CANNOT_ADD_IFACE_DUE_TO_MAC_DUPLICATES; Collection<String> replacements = ReplacementUtils.getListVariableAssignmentString(engineMessage, nicsUnableToBeImported); validate(new ValidationResult(engineMessage, replacements)); } return true; }
Source:
public JRDataSource getDataSource() { List<TestDetailsDTO> result = new ArrayList<TestDetailsDTO>(); if (!sessionScopeAvailable){ return new JRBeanCollectionDataSource(result); } SystemUnderTestPlotsGeneralProvider plotsGeneralProvider = (SystemUnderTestPlotsGeneralProvider) getContext().getMappedProvider("sysUTPlotsGeneral"); Set<String> boxIdentifiers = plotsGeneralProvider.getStatistics().findBoxIdentifiers(); Set<String> sutUrls = plotsGeneralProvider.getStatistics().findSutUrls(); for (GroupKey groupName : plotsGeneralProvider.getPlotGroups().getPlotGroups().keySet()) { if (hasGlobalStatistics(plotsGeneralProvider, groupName)) { TestDetailsDTO testDetailsDTO = new TestDetailsDTO(); testDetailsDTO.setTestId(groupName.getUpperName()); testDetailsDTO.setTestName(groupName.getUpperName()); result.add(testDetailsDTO); } for (String boxIdentifier : boxIdentifiers) { if (hasBoxStatistics(plotsGeneralProvider, boxIdentifier, groupName)) { String name = groupName.getUpperName() + " on " + boxIdentifier; TestDetailsDTO testDetailsDTO = new TestDetailsDTO(); testDetailsDTO.setTestId(name); testDetailsDTO.setTestName(name); result.add(testDetailsDTO); } } for (String sutUrl : sutUrls) { if (hasSutStatistics(plotsGeneralProvider, sutUrl, groupName)) { String name = groupName.getUpperName() + " on " + sutUrl; TestDetailsDTO testDetailsDTO = new TestDetailsDTO(); testDetailsDTO.setTestId(name); testDetailsDTO.setTestName(name); result.add(testDetailsDTO); } } } return new JRBeanCollectionDataSource(result); }

Target:
public JRDataSource getDataSource() { if (!sessionScopeAvailable){ return new JRBeanCollectionDataSource(Collections.EMPTY_LIST); } List<TestDetailsDTO> result = new ArrayList<TestDetailsDTO>(); SystemUnderTestPlotsGeneralProvider plotsGeneralProvider = (SystemUnderTestPlotsGeneralProvider) getContext().getMappedProvider("sysUTPlotsGeneral"); Set<String> boxIdentifiers = plotsGeneralProvider.getStatistics().findBoxIdentifiers(); Set<String> sutUrls = plotsGeneralProvider.getStatistics().findSutUrls(); for (GroupKey groupName : plotsGeneralProvider.getPlotGroups().getPlotGroups().keySet()) { if (hasGlobalStatistics(plotsGeneralProvider, groupName)) { TestDetailsDTO testDetailsDTO = new TestDetailsDTO(); testDetailsDTO.setTestId(groupName.getUpperName()); testDetailsDTO.setTestName(groupName.getUpperName()); result.add(testDetailsDTO); } for (String boxIdentifier : boxIdentifiers) { if (hasBoxStatistics(plotsGeneralProvider, boxIdentifier, groupName)) { String name = groupName.getUpperName() + " on " + boxIdentifier; TestDetailsDTO testDetailsDTO = new TestDetailsDTO(); testDetailsDTO.setTestId(name); testDetailsDTO.setTestName(name); result.add(testDetailsDTO); } } for (String sutUrl : sutUrls) { if (hasSutStatistics(plotsGeneralProvider, sutUrl, groupName)) { String name = groupName.getUpperName() + " on " + sutUrl; TestDetailsDTO testDetailsDTO = new TestDetailsDTO(); testDetailsDTO.setTestId(name); testDetailsDTO.setTestName(name); result.add(testDetailsDTO); } } } return new JRBeanCollectionDataSource(result); }
Source:
private void checkAnnotatedAssignment(SubscriptionContext ctx) { AnnotatedAssignment assignment = (AnnotatedAssignment) ctx.syntaxNode(); Expression variable = assignment.variable(); Token equalToken = assignment.equalToken(); if (equalToken != null && shouldReportIssue(variable, variable)) { ctx.addIssue(variable, String.format(MESSAGE, VRBL_ISSUE_TYPE)); } }

Target:
private void checkAnnotatedAssignment(SubscriptionContext ctx) { AnnotatedAssignment assignment = (AnnotatedAssignment) ctx.syntaxNode(); Tree ancestor = TreeUtils.firstAncestorOfKind(assignment, Tree.Kind.FUNCDEF, Tree.Kind.CLASSDEF); if (ancestor == null || ancestor.is(Tree.Kind.FUNCDEF)) { Expression variable = assignment.variable(); Token equalToken = assignment.equalToken(); if (equalToken != null && shouldReportIssue(variable)) { ctx.addIssue(variable, String.format(MESSAGE, VRBL_ISSUE_TYPE)); } } }
Source:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; Term topicTerm = Prolog.Nil; Change change = StoredValues.CHANGE.get(engine); String topic = change.getTopic(); if (topic != null) { topicTerm = SymbolTerm.intern(topic); } if (!a1.unify(topicTerm, engine.trail)) { return engine.fail(); } return cont; }

Target:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; Term topicTerm = Prolog.Nil; Change change = StoredValues.CHANGE.get(engine); String topic = change.getTopic(); if (topic != null) { topicTerm = SymbolTerm.create(topic); } if (!a1.unify(topicTerm, engine.trail)) { return engine.fail(); } return cont; }
Source:
public void purgeMemberships(List<CohortMembership> cohortMembershipList) { cohortMembershipList.forEach(m -> getMembers().remove(m)); }

Target:
public void purgeMemberships(List<CohortMembership> cohortMembershipList) { List<CohortMembership> membersToPurge = getMembers().stream() .filter(m -> cohortMembershipList.stream() .anyMatch(c -> m.getPatient().getPatientId().equals(c.getPatient().getPatientId()))) .collect(Collectors.toList()); membersToPurge.forEach(m -> getMembers().remove(m)); }
Source:
public void testCreateSubscriptionNullProject() throws Exception { notificationService.createSubscription(null, mock(Account.class), mock(Subscription.class)); }

Target:
public void testCreateSubscriptionNullProject() throws Exception { notificationService.createSubscription(null, account, subscription); }
Source:
public VolumeType getSelectedVolumeType() { if (!(Boolean) collapseSnapshots.getEntity() || selectedVolumeType == null) { return getVolumeType(); } return selectedVolumeType; }

Target:
public VolumeType getSelectedVolumeType() { if ((Boolean) collapseSnapshots.getEntity() && selectedVolumeType != null) { return selectedVolumeType; } return getVolumeType(); }
Source:
private static boolean hasHMSAGConnectLibrary() { try { return com.huawei.agconnect.config.AGConnectServicesConfig.class != null; } catch (Throwable e) { return false; } }

Target:
private static boolean hasHMSAGConnectLibrary() { try { return com.huawei.agconnect.config.AGConnectServicesConfig.class != null; } catch (Exception e) { return false; } }
Source:
public void addModelListeners() { super.addModelListeners(); getTable().getSelectionModel().addSelectionChangeHandler(event -> { getModelProvider().setSelectedItems(getTable().getSelectedItems()); }); }

Target:
public void addModelListeners() { super.addModelListeners(); getTable().getSelectionModel().addSelectionChangeHandler(event -> getModelProvider().setSelectedItems(getTable().getSelectedItems()) ); }
Source:
public void clear(String sourceId) { Verify.verifyNotNull(sourceId, "argument 'sourceId' may not be null."); for (Iterator<ServiceRegistration<MetacardType>> iter = serviceRegistrations.iterator(); iter.hasNext(); ) { ServiceRegistration registration = iter.next(); if (registration.getReference() != null && registration.getReference().getProperty((SOURCE_ID)) != null && registration.getReference().getProperty(SOURCE_ID).equals(sourceId)) { registration.unregister(); iter.remove(); } } }

Target:
public void clear(String sourceId) { Verify.verifyNotNull(sourceId, "argument 'sourceId' may not be null."); try { registryLock.lock(); for (Iterator<ServiceRegistration<MetacardType>> iter = serviceRegistrations.iterator(); iter.hasNext(); ) { ServiceRegistration registration = iter.next(); if (registration.getReference() != null && registration.getReference().getProperty(SOURCE_ID).equals(sourceId)) { registration.unregister(); iter.remove(); } } } finally { registryLock.unlock(); } }
Source:
public static boolean isSupported(AST ast, int nodeType) { switch (nodeType) { case ASTNode.SWITCH_EXPRESSION: case ASTNode.YIELD_STATEMENT: if (ast.apiLevel() < AST.JLS14_INTERNAL) { return false; } break; case ASTNode.TEXT_BLOCK: if (!ast.isPreviewEnabled()) { return false; } } return true; }

Target:
public static boolean isSupported(AST ast, int nodeType) { switch (nodeType) { case ASTNode.SWITCH_EXPRESSION: case ASTNode.YIELD_STATEMENT: if (ast.apiLevel() < AST.JLS14_INTERNAL) { return false; } break; case ASTNode.TEXT_BLOCK: return ast.isPreviewEnabled(); } return true; }
Source:
public void testBlockingExecutorService() throws Exception { final int capacity = 3; final ExecutorService executorService = Execs.blockingSingleThreaded("test%d", capacity); final AtomicInteger producedCount = new AtomicInteger(); final AtomicInteger consumedCount = new AtomicInteger(); final CyclicBarrier barrier = new CyclicBarrier(2); Thread producer = new Thread("producer") { public void run() { for (int i = 0; i < 2 * capacity; i++) { final int taskID = i; System.out.println("Produced task"+ taskID); executorService.submit( new Runnable() { @Override public void run() { System.out.println("Starting task" + taskID); try { barrier.await(); } catch (Exception e) { throw Throwables.propagate(e); } consumedCount.incrementAndGet(); System.out.println("Completed task" + taskID); } } ); producedCount.incrementAndGet(); } } }; producer.start(); for(int i=0;i<capacity;i++){ Thread.sleep(500); Assert.assertEquals(consumedCount.intValue()+1+capacity,producedCount.intValue()); barrier.await(); } for(int i=0;i<capacity;i++){ barrier.await(); } }

Target:
public void testBlockingExecutorService() throws Exception { final int capacity = 3; final ExecutorService blockingExecutor = Execs.newBlockingSingleThreaded("test%d", capacity); final CountDownLatch queueFullSignal = new CountDownLatch(capacity + 1); final CountDownLatch taskCompletedSignal = new CountDownLatch(2 * capacity); final CountDownLatch taskStartSignal = new CountDownLatch(1); final AtomicInteger producedCount = new AtomicInteger(); final AtomicInteger consumedCount = new AtomicInteger(); ExecutorService producer = Executors.newSingleThreadExecutor(); producer.submit( new Runnable() { public void run() { for (int i = 0; i < 2 * capacity; i++) { final int taskID = i; System.out.println("Produced task" + taskID); blockingExecutor.submit( new Runnable() { @Override public void run() { System.out.println("Starting task" + taskID); try { taskStartSignal.await(); consumedCount.incrementAndGet(); taskCompletedSignal.countDown(); } catch (Exception e) { throw Throwables.propagate(e); } System.out.println("Completed task" + taskID); } } ); producedCount.incrementAndGet(); queueFullSignal.countDown(); } } } ); queueFullSignal.await(); Assert.assertEquals(capacity + 1, producedCount.get()); taskStartSignal.countDown(); taskCompletedSignal.await(); Assert.assertEquals(2 * capacity, consumedCount.get()); blockingExecutor.shutdown(); producer.shutdown(); }
Source:
public ArtifactInputStream getInputStream(String storageId, String repositoryId, String path) throws IOException { Repository repository = getConfiguration().getStorage(storageId).getRepository(repositoryId); final LayoutProvider layoutProvider = layoutProviderRegistry.getProvider(repository.getLayout()); final RepositoryPath artifactPath = layoutProvider.resolve(repository).resolve(path); logger.debug(" -> Checking local cache for ...", artifactPath); if (layoutProvider.containsPath(repository, path)) { logger.debug("The artifact was found in the local cache", artifactPath); return (ArtifactInputStream) Files.newInputStream(artifactPath); } logger.debug("The artifact as not found in the local cache", artifactPath); return null; }

Target:
public ArtifactInputStream getInputStream(String storageId, String repositoryId, String path) throws IOException { Repository repository = getConfiguration().getStorage(storageId).getRepository(repositoryId); final LayoutProvider layoutProvider = layoutProviderRegistry.getProvider(repository.getLayout()); final RepositoryPath artifactPath = layoutProvider.resolve(repository).resolve(path); logger.debug(" -> Checking local cache for ...", artifactPath); if (layoutProvider.containsPath(repository, path)) { logger.debug("The artifact was found in the local cache", artifactPath); return (ArtifactInputStream) Files.newInputStream(artifactPath); } logger.debug("The artifact was not found in the local cache", artifactPath); return null; }
Source:
public CompletableFuture<Void> modifyColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamilyDesc) { return CompletableFuture.supplyAsync(() -> { return Modification.newBuilder() .setId(columnFamilyDesc.getNameAsString()) .setCreate(new ColumnDescriptorAdapter().adapt((HColumnDescriptor) columnFamilyDesc) .build()); }).thenCompose( d -> modifyColumn(tableName, columnFamilyDesc.getNameAsString(), "update", d)). thenApply(r -> null); }

Target:
public CompletableFuture<Void> modifyColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamilyDesc) { return CompletableFuture.supplyAsync(() -> { return Modification.newBuilder() .setId(columnFamilyDesc.getNameAsString()) .setCreate(new ColumnDescriptorAdapter().adapt((HColumnDescriptor) columnFamilyDesc) .build()); }).thenCompose( descriptor -> modifyColumn(tableName, columnFamilyDesc.getNameAsString(), "update", descriptor)). thenApply(response -> null); }
Source:
private Object getResultElementItem(DelegateExecution childExecution) { CommandContext commandContext = Context.getCommandContext(); if (commandContext.getCommand() instanceof CompleteTaskCmd) { Map<String, Object> taskVariables = ((CompleteTaskCmd) commandContext .getCommand()).getTaskVariables(); return taskVariables.get(getOutputDataItem()); } return childExecution.getVariable(getOutputDataItem()); }

Target:
private Object getResultElementItem(DelegateExecution childExecution) { CommandContext commandContext = Context.getCommandContext(); if (commandContext.getCommand() instanceof CompleteTaskCmd) { Map<String, Object> taskVariables = ((CompleteTaskCmd) commandContext .getCommand()).getTaskVariables(); return taskVariables.get(getOutputDataItem()); } return childExecution.getVariableLocal(getOutputDataItem()); }
Source:
protected void endWithFailure() { revertTasks(); if (getDestinationDiskImage() != null && !vmDao.getVmsListForDisk(getDestinationDiskImage().getId(), false).isEmpty()) { if (!getDestinationDiskImage().getParentId().equals(Guid.Empty)) { if (!getDestinationDiskImage().getParentId().equals(getDestinationDiskImage().getImageTemplateId())) { DiskImage previousSnapshot = diskImageDao.getSnapshotById(getDestinationDiskImage().getParentId()); previousSnapshot.setActive(true); if (getParameters().getOldLastModifiedValue() != null) { previousSnapshot.setLastModified(getParameters().getOldLastModifiedValue()); } imageDao.update(previousSnapshot.getImage()); } } } runVdsCommand(VDSCommandType.DestroyImage, createDestroyImageParameters()); super.endWithFailure(); }

Target:
protected void endWithFailure() { revertTasks(); if (getDestinationDiskImage() != null && !vmDao.getVmsListForDisk(getDestinationDiskImage().getId(), false).isEmpty()) { if (!getDestinationDiskImage().getParentId().equals(Guid.Empty)) { if (!getDestinationDiskImage().getParentId().equals(getDestinationDiskImage().getImageTemplateId())) { DiskImage previousSnapshot = diskImageDao.getSnapshotById(getDestinationDiskImage().getParentId()); previousSnapshot.setActive(true); if (getParameters().getOldLastModifiedValue() != null) { previousSnapshot.setLastModified(getParameters().getOldLastModifiedValue()); } imageDao.update(previousSnapshot.getImage()); } } runVdsCommand(VDSCommandType.DestroyImage, createDestroyImageParameters()); } super.endWithFailure(); }
Source:
public T thisNode() { return curNode; }

Target:
public T thisNode() { assertFalse(this.nodeDeleted, "node is deleted"); if (newNode != null) { return newNode; } return curNode; }
Source:
private static boolean importsManipulatedAllProperty(FileInput fileInput) { return fileInput.globalVariables().stream().anyMatch(s -> s.name().equals("__all__") && s.usages().stream().anyMatch(u -> u.kind().equals(Usage.Kind.IMPORT))); }

Target:
private static boolean importsManipulatedAllProperty(FileInput fileInput) { return fileInput.globalVariables().stream() .filter(s -> s.name().equals("__all__")) .flatMap(s -> s.usages().stream()) .anyMatch(u -> u.kind() == Usage.Kind.IMPORT); }
Source:
protected boolean createKeys(List<Long> list) { if (skCase == null) { return true; } hashsetResults.getArtifactIds(hashsetName).forEach((id) -> { try { BlackboardArtifact art = skCase.getBlackboardArtifact(id); artifactHits.put(id, art); list.add(id); } catch (TskException ex) { logger.log(Level.WARNING, "TSK Exception occurred", ex); } }); return true; }

Target:
protected boolean createKeys(List<Long> list) { if (skCase == null) { return true; } hashsetResults.getArtifactIds(hashsetName).forEach((id) -> { try { BlackboardArtifact art = skCase.getBlackboardArtifact(id); artifactHits.put(id, art); list.add(id); } catch (TskException ex) { logger.log(Level.SEVERE, "TSK Exception occurred", ex); } }); return true; }
Source:
public String getModuleNameForEntry(Entry entry) { Vector<Suite> installed = getInstalledSuites(); for (Suite s : installed) { for (Entry suiteEntry : s.getEntries().values()) { if (suiteEntry.getCommandId().equals(entry.getCommandId())) { return s.getMenus().firstElement().getId(); } } } return null; }

Target:
public String getModuleNameForEntry(Entry entry) { Vector<Suite> installed = getInstalledSuites(); for (Suite suite : installed) { for (Entry suiteEntry : suite.getEntries().values()) { if (suiteEntry.getCommandId().equals(entry.getCommandId())) { return suite.getMenus().firstElement().getId(); } } } return null; }
Source:
public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); final List<OAuth2AuthorizedClient> clients = new ArrayList<>(); for (OAuth2AuthorizedClientProvider authorizedClientProvider: authorizedClientProviders) { final OAuth2AuthorizedClient auth2AuthorizedClient = authorizedClientProvider.authorize(context); if (auth2AuthorizedClient != null) { clients.add(auth2AuthorizedClient); } } if (!clients.isEmpty()) { return clients.get(0); } else { return null; } }

Target:
public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); for (OAuth2AuthorizedClientProvider authorizedClientProvider : authorizedClientProviders) { OAuth2AuthorizedClient oauth2AuthorizedClient = authorizedClientProvider.authorize(context); if (oauth2AuthorizedClient != null) { return oauth2AuthorizedClient; } } return null; }
Source:
private void setupHooks() { varNames.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { if (varNames.getSelectedIndex() != -1) { String val = vars.getStringVariable(varNames.getSelected()); varName.setText(varNames.getSelected()); varVal.setText(val); } else { varName.setText(""); varVal.setText(""); } } }); changeName.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { DialogUtils.showInputDialog(getStage(), "New Name for Variable", "Name:", new InputDialogAdapter() { @Override public void finished(String input) { vars.removeVariable(varName.getText()); vars.setVariable(input, varVal.getText()); renderNames(); varNames.setSelected(input); varName.setText(input); } }); } }); updateValue.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { vars.setVariable(varName.getText(),varVal.getText()); } }); deleteVar.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { vars.removeVariable(varName.getText()); varName.setText(""); varVal.setText(""); renderNames(); varNames.setSelectedIndex(-1); } }); addVar.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { vars.setVariable(keyName.getText(), keyVal.getText()); keyName.setText(""); keyVal.setText(""); renderNames(); varNames.setSelectedIndex(-1); } }); }

Target:
private void setupHooks() { varNames.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { if (varNames.getSelectedIndex() != -1) { String val = vars.getStringVariable(varNames.getSelected()); varName.setText(varNames.getSelected()); varVal.setText(val); } else { varName.setText(""); varVal.setText(""); } } }); changeName.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { DialogUtils.showInputDialog(getStage(), "New Name for Variable", "Name:", new InputDialogAdapter() { @Override public void finished(String input) { vars.removeVariable(varName.getText()); vars.setVariable(input, varVal.getText()); item.updateDataVO(); renderNames(); varNames.setSelected(input); varName.setText(input); } }); } }); updateValue.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { vars.setVariable(varName.getText(),varVal.getText()); item.updateDataVO(); } }); deleteVar.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { vars.removeVariable(varName.getText()); item.updateDataVO(); varName.setText(""); varVal.setText(""); renderNames(); varNames.setSelectedIndex(-1); } }); addVar.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { vars.setVariable(keyName.getText(), keyVal.getText()); item.updateDataVO(); keyName.setText(""); keyVal.setText(""); renderNames(); varNames.setSelectedIndex(-1); } }); }
Source:
public static void onBarcodeResult(BarcodeScanListener barcodeScanListener, int requestCode, int resultCode, Intent intent) { if (BuildConfig.DEBUG) { if (!(requestCode == BARCODE_FETCH)) { throw new IllegalArgumentException("requestCode should've been BARCODE_FETCH!"); } } if (resultCode == Activity.RESULT_OK) { String result = intent.getStringExtra("SCAN_RESULT"); barcodeScanListener.onBarcodeFetch(result, intent); } }

Target:
public static void onBarcodeResult(BarcodeScanListener barcodeScanListener, int requestCode, int resultCode, Intent intent) { if (BuildConfig.DEBUG && !(requestCode == BARCODE_FETCH)) { throw new AssertionError("requestCode should be BARCODE_FETCH!"); } if (resultCode == Activity.RESULT_OK) { String result = intent.getStringExtra(SCAN_RESULT); barcodeScanListener.onBarcodeFetch(result, intent); } }
Source:
public IConnectionWrapper getConnection() throws CoreException { HashMap<String,Object> map = new HashMap<String,Object>(); map.put(JolokiaConnectionWrapper.ID, name); map.put(JolokiaConnectionWrapper.URL, url); map.put(JolokiaConnectionWrapper.HEADERS, headers); map.put(JolokiaConnectionWrapper.IGNORE_SSL_ERRORS, ignoreSSL); map.put(JolokiaConnectionWrapper.GET_OR_POST, getOrPost); IConnectionProvider provider = ExtensionManager.getProvider(JolokiaConnectionProvider.PROVIDER_ID); return provider.createConnection(map); }

Target:
public IConnectionWrapper getConnection() throws CoreException { Map<String,Object> map = new HashMap<>(); map.put(JolokiaConnectionWrapper.ID, name); map.put(JolokiaConnectionWrapper.URL, url); map.put(JolokiaConnectionWrapper.HEADERS, headers); map.put(JolokiaConnectionWrapper.IGNORE_SSL_ERRORS, ignoreSSL); map.put(JolokiaConnectionWrapper.GET_OR_POST, getOrPost); IConnectionProvider provider = ExtensionManager.getProvider(JolokiaConnectionProvider.PROVIDER_ID); return provider.createConnection(map); }
Source:
protected boolean canDoAction() { if (getDisk() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (getVms() == null || getVms().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_IS_NOT_VM_DISK); } if (getDiskType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) getDisk(); if (diskImage.getImageStatus() != ImageStatus.OK) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED); } } if (isImageLockNeeded()) { for (VM vm : getVms()) { if (vm.isRunningOrPaused()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } } } return true; }

Target:
protected boolean canDoAction() { if (getDisk() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (getDiskType() == DiskStorageType.IMAGE) { if (((DiskImage) getDisk()).getImageStatus() != ImageStatus.OK) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED); } } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_IS_NOT_VM_DISK); } if (isImageLockNeeded() && getVm().isRunningOrPaused()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } if (getVdsIdInPool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_VDS_IN_POOL); } if (!validate(new StoragePoolValidator(getStoragePoolDao().get(getStoragePoolId())).isUp())) { return false; } return true; }
Source:
public void testConvertDs3RequestWithRequestPayload() { final Request testRequest = RequestConverter.toRequest( new Ds3Request("CreateGetJobRequestHandler", HttpVerb.PUT, Classification.spectrads3, null, null, Action.MODIFY, Resource.BUCKET, ResourceType.NON_SINGLETON, Operation.START_BULK_GET, true, null, ImmutableList.of( new Ds3Param("Aggregating", "boolean", false), new Ds3Param("ChunkClientProcessingOrderGuarantee", "com.spectralogic.s3.common.dao.domain.ds3.JobChunkClientProcessingOrderGuarantee", false), new Ds3Param("Name", "java.lang.String", true), new Ds3Param("Priority", "com.spectralogic.s3.common.dao.domain.ds3.BlobStoreTaskPriority", false)), ImmutableList.of( new Ds3Param("Operation", "com.spectralogic.s3.server.request.rest.RestOperationType", true)))); assertTrue(testRequest.hasRequestPayload()); }

Target:
public void testConvertDs3RequestWithRequestPayload() { final Request testRequest = RequestConverter.toRequest(Ds3ModelFixtures.getRequestBulkGet()); assertTrue(testRequest.hasRequestPayload()); }
Source:
public void buildDependencyGraph(final AbstractProject downstream, DependencyGraph graph) { for (AbstractProject upstream : Items.fromNameList(downstream.getParent(), upstreamProjects, AbstractProject.class)) { graph.addDependency(new DependencyGraph.Dependency(upstream, downstream) { @Override public boolean shouldTriggerBuild(AbstractBuild upstreamBuild, TaskListener listener, List<Action> actions) { return shouldTrigger(upstreamBuild, listener); } }); } }

Target:
@Override public void buildDependencyGraph(final AbstractProject downstream, DependencyGraph graph) { for (AbstractProject upstream : Items.fromNameList(downstream.getParent(), upstreamProjects, AbstractProject.class)) { graph.addDependency(new DependencyGraph.Dependency(upstream, downstream) { @Override public boolean shouldTriggerBuild(AbstractBuild upstreamBuild, TaskListener listener, List<Action> actions) { return shouldTrigger(upstreamBuild, listener); } }); } }
Source:
public void init(String... args) throws Throwable { final InputStream in; final File propertiesFile; String path = System.getProperty(LauncherConstants.LAUNCHER_PROPERTIES); if (path != null) { Matcher matcher = Pattern.compile("^([\"'])(.*)\\1$") .matcher(path); if (matcher.matches()) { path = matcher.group(2); } propertiesFile = new File(path).getAbsoluteFile(); if (!propertiesFile.isFile()) errorAndExit("Specified launch file `%s' was not found - absolutePath='%s'", path, propertiesFile.getAbsolutePath()); in = IO.stream(propertiesFile); } else { propertiesFile = null; in = Launcher.class.getClassLoader() .getResourceAsStream(DEFAULT_LAUNCHER_PROPERTIES); if (in == null) { printUsage(); errorAndExit("Launch file not specified, and no embedded properties found."); return; } } Properties properties = new Properties(); load(in, properties); augmentWithSystemProperties(properties); for (String arg : args) { if ("-v".equals(arg) || "-verbose".equals(arg)) { properties.put(LauncherConstants.LAUNCH_TRACE, "true"); break; } } init(properties, null); }

Target:
public void init(String... args) throws Throwable { final InputStream in; final File propertiesFile; String path = System.getProperty(LauncherConstants.LAUNCHER_PROPERTIES); if (path != null) { Matcher matcher = Pattern.compile("^([\"'])(.*)\\1$") .matcher(path); if (matcher.matches()) { path = matcher.group(2); } propertiesFile = new File(path).getAbsoluteFile(); if (!propertiesFile.isFile()) errorAndExit("Specified launch file `%s' was not found - absolutePath='%s'", path, propertiesFile.getAbsolutePath()); in = IO.stream(propertiesFile); } else { propertiesFile = null; in = Launcher.class.getClassLoader() .getResourceAsStream(DEFAULT_LAUNCHER_PROPERTIES); if (in == null) { printUsage(); errorAndExit("Launch file not specified, and no embedded properties found."); return; } } Properties properties = new Properties(); load(in, properties); augmentWithSystemProperties(properties); init(properties, null); }
Source:
public Object decode(Response response, Type type) throws IOException, DecodeException, FeignException { Collection<String> contentTypes = HeaderAccessUtils.caseInsensitiveGet(response.headers(), HttpHeaders.CONTENT_TYPE); if (contentTypes == null) { contentTypes = ImmutableSet.of(); } if (contentTypes.size() == 1 && Iterables.getOnlyElement(contentTypes, "").startsWith(CborDelegateEncoder.MIME_TYPE)) { InputStream inputStream = response.body().asInputStream(); if (!inputStream.markSupported()) { inputStream = new BufferedInputStream(inputStream, 1); } inputStream.mark(1); if (inputStream.read() == -1) { return null; } inputStream.reset(); return cborObjectMapper.readValue(inputStream, cborObjectMapper.constructType(type)); } else { return delegate.decode(response, type); } }

Target:
public Object decode(Response response, Type type) throws IOException, DecodeException, FeignException { Collection<String> contentTypes = HeaderAccessUtils.caseInsensitiveGet(response.headers(), HttpHeaders.CONTENT_TYPE); if (contentTypes == null) { contentTypes = ImmutableSet.of(); } if (contentTypes.size() == 1 && Iterables.getOnlyElement(contentTypes, "").startsWith(CborDelegateEncoder.MIME_TYPE)) { int pushbackBufferSize = 1; PushbackInputStream pushbackInputStream = new PushbackInputStream( response.body().asInputStream(), pushbackBufferSize); int firstByte = pushbackInputStream.read(); if (firstByte == -1) { return null; } pushbackInputStream.unread(firstByte); return cborObjectMapper.readValue(pushbackInputStream, cborObjectMapper.constructType(type)); } else { return delegate.decode(response, type); } }
Source:
public INodeDirectory getSnapshottableAncestorDir(final INodesInPath iip) throws IOException { final String path = iip.getPath(); final INode inode = iip.getLastINode(); final INodeDirectory dir; if (inode instanceof INodeDirectory) { dir = INodeDirectory.valueOf(inode, path); if (dir.isSnapshottable()) { return dir; } } else { dir = INodeDirectory.valueOf(iip.getINode(-2), iip.getParentPath()); } for (INodeDirectory snapRoot : this.snapshottables.values()) { if (dir.isAncestorDirectory(snapRoot)) { return snapRoot; } } return null; }

Target:
public INodeDirectory getSnapshottableAncestorDir(final INodesInPath iip) throws IOException { final String path = iip.getPath(); final INode inode = iip.getLastINode(); final INodeDirectory dir; if (inode instanceof INodeDirectory) { dir = INodeDirectory.valueOf(inode, path); } else { dir = INodeDirectory.valueOf(iip.getINode(-2), iip.getParentPath()); } if (dir.isSnapshottable()) { return dir; } for (INodeDirectory snapRoot : this.snapshottables.values()) { if (dir.isAncestorDirectory(snapRoot)) { return snapRoot; } } return null; }
Source:
public void globalConfigAllowedWithManagePermission() throws Exception { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() .grant(Jenkins.MANAGE, Jenkins.READ).everywhere().toEveryone()); HtmlForm form = j.createWebClient().goTo("configure").getFormByName("config"); HtmlPage updated = j.submit(form); assertEquals("User with Jenkins.MANAGE permission should be able to update global configuration", 200, updated.getWebResponse().getStatusCode()); }

Target:
public void globalConfigAllowedWithManagePermission() throws Exception { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() .grant(Jenkins.MANAGE, Jenkins.READ).everywhere().toEveryone()); HtmlForm form = j.createWebClient().goTo("configure").getFormByName("config"); HtmlPage updated = j.submit(form); assertThat("User with Jenkins.MANAGE permission should be able to update global configuration", updated.getWebResponse(), hasResponseCode(HttpURLConnection.HTTP_OK)); }
Source:
private void applyAttributes(Attributes attributes) { if (attributes.getId() != null) { writer.writeAttribute("id", attributes.getId()); } if (attributes.getCssClass() != null) { writer.writeAttribute("role", attributes.getCssClass()); } if (attributes instanceof ListAttributes) { ListAttributes lattr = (ListAttributes) attributes; if (lattr.getType() != null) { writer.writeAttribute("numeration", lattr.getType()); } } }

Target:
private void applyAttributes(Attributes attributes) { if (attributes.getId() != null) { writer.writeAttribute("id", attributes.getId()); } if (attributes.getCssClass() != null) { writer.writeAttribute("role", attributes.getCssClass()); } if (attributes instanceof ListAttributes) { ListAttributes listAttributes = (ListAttributes) attributes; if (listAttributes.getType() != null) { writer.writeAttribute("numeration", listAttributes.getType()); } } }
Source:
public ForemanHostProvider(final HostRepository hostRepository, @Assisted final Configuration configuration) { _hostRepository = hostRepository; getContext().system().scheduler().schedule( ConfigurationHelper.getFiniteDuration(configuration, "initialDelay"), ConfigurationHelper.getFiniteDuration(configuration, "interval"), getSelf(), TICK, getContext().dispatcher(), getSelf()); _client = new ForemanClient.Builder() .setBaseUrl(URI.create(configuration.getString("foreman.baseUrl"))) .build(); }

Target:
public ForemanHostProvider(final HostRepository hostRepository, @Assisted final Configuration configuration) { _hostRepository = hostRepository; getContext().system().scheduler().schedule( ConfigurationHelper.getFiniteDuration(configuration, "initialDelay"), ConfigurationHelper.getFiniteDuration(configuration, "interval"), getSelf(), TICK, getContext().dispatcher(), getSelf()); _client = new ForemanClient.Builder() .setBaseUrl(URI.create(configuration.getString("baseUrl"))) .build(); }
Source:
public void createDatabaseIfNotExists(String databaseName) throws TDClientException { if (!existsDatabase(databaseName)) { createDatabase(databaseName); } }

Target:
public void createDatabaseIfNotExists(String databaseName) throws TDClientException { try { createDatabase(databaseName); } catch (TDClientHttpConflictException e) { } }
Source:
public Builder request(Request request) { checkNotNull(request, "the original request is required on all responses"); this.request = Request.create( request.method(), request.url(), request.headers(), null, request.charset()); return this; }

Target:
public Builder request(Request request) { checkNotNull(request, "request is required"); this.request = request; return this; }