auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void construct() throws InvalidGridFileException { builder.createNewEmptyGrid(); GridDimension gridDim = readGridFromFile(); placeItemsOnBoard(startingCoordinates, gridDim.getWidth(), gridDim.getHeight()); if (!isValidGrid(grid)) { builder.createNewEmptyGrid(); throw new InvalidGridFileException("The specified grid was not valid"); } }

Target:
public void construct() throws InvalidGridFileException { try { reset(); } catch (FileNotFoundException e1) { throw new InvalidGridFileException("file not found"); } GridDimension gridDim = readGridFromFile(); placeItemsOnBoard(startingCoordinates, gridDim.getWidth(), gridDim.getHeight()); if (!isValidGrid(grid)) { try { reset(); } catch (FileNotFoundException e) { } throw new InvalidGridFileException("The specified grid was not valid"); } }
Source:
public void testGetAllWithQuery() { List<NetworkView> result = dao.getAllWithQuery(String.format("SELECT * FROM network_view where network_id = '%s'", FixturesTool.EXISTING_NETWORK_ID)); assertEquals(FixturesTool.EXISTING_NETWORK_ID, result.get(0).getNetwork().getId()); }

Target:
public void testGetAllWithQuery() { List<NetworkView> result = dao.getAllWithQuery(String.format("SELECT * FROM network_view where id = '%s'", FixturesTool.EXISTING_NETWORK_ID)); assertFalse(result.isEmpty()); assertEquals(FixturesTool.EXISTING_NETWORK_ID, result.get(0).getNetwork().getId()); }
Source:
public RowIterator(GroupByQuery query, final Cursor cursor, ByteBuffer metricsBuffer, GroupByQueryConfig config) { this.query = query; this.cursor = cursor; this.metricsBuffer = metricsBuffer; this.config = config; unprocessedKeys = null; delegate = Iterators.emptyIterator(); dimensionSpecs = query.getDimensions(); dimensions = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); dimNames = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); final Set<String> optimizedDims = optimizedExtractionDims(query, true); for (int i = 0; i < dimensionSpecs.size(); ++i) { final DimensionSpec dimSpec = dimensionSpecs.get(i); final String dimension = dimSpec.getDimension(); final DimensionSelector selector = cursor.makeDimensionSelector( dimension, optimizedDims.contains(dimension) ? null : dimSpec.getExtractionFn() ); if (selector != null) { dimensions.add(selector); dimNames.add(dimSpec.getOutputName()); } } aggregatorSpecs = query.getAggregatorSpecs(); aggregators = new BufferAggregator[aggregatorSpecs.size()]; metricNames = new String[aggregatorSpecs.size()]; sizesRequired = new int[aggregatorSpecs.size()]; for (int i = 0; i < aggregatorSpecs.size(); ++i) { AggregatorFactory aggregatorSpec = aggregatorSpecs.get(i); aggregators[i] = aggregatorSpec.factorizeBuffered(cursor); metricNames[i] = aggregatorSpec.getName(); sizesRequired[i] = aggregatorSpec.getMaxIntermediateSize(); } }

Target:
public RowIterator(GroupByQuery query, final Cursor cursor, ByteBuffer metricsBuffer, GroupByQueryConfig config) { this.query = query; this.cursor = cursor; this.metricsBuffer = metricsBuffer; this.config = config; unprocessedKeys = null; delegate = Iterators.emptyIterator(); dimensionSpecs = query.getDimensions(); dimensions = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); dimNames = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); for (int i = 0; i < dimensionSpecs.size(); ++i) { final DimensionSpec dimSpec = dimensionSpecs.get(i); final DimensionSelector selector = cursor.makeDimensionSelector( dimSpec.getDimension(), dimSpec.getExtractionFn() ); if (selector != null) { dimensions.add(selector); dimNames.add(dimSpec.getOutputName()); } } aggregatorSpecs = query.getAggregatorSpecs(); aggregators = new BufferAggregator[aggregatorSpecs.size()]; metricNames = new String[aggregatorSpecs.size()]; sizesRequired = new int[aggregatorSpecs.size()]; for (int i = 0; i < aggregatorSpecs.size(); ++i) { AggregatorFactory aggregatorSpec = aggregatorSpecs.get(i); aggregators[i] = aggregatorSpec.factorizeBuffered(cursor); metricNames[i] = aggregatorSpec.getName(); sizesRequired[i] = aggregatorSpec.getMaxIntermediateSize(); } }
Source:
protected String getPackageLocation() throws IOException { return "com/puppycrawl/tools/checkstyle"; }

Target:
protected String getPackageLocation() { return "com/puppycrawl/tools/checkstyle/ant/checkstyleanttask/"; }
Source:
public void writeWithDefaultConfiguration() throws Exception { TAQ.Quote quote = new TAQ.Quote(); quote.date = "2016-01-01"; quote.timestampMillis = 8 * 60 * 60 * 1000; quote.instrument = "FOO"; quote.bidPrice = 100.50; quote.bidSize = 1000; quote.askPrice = 100.75; quote.askSize = 250; try ( ByteArrayOutputStream out = new ByteArrayOutputStream(); TAQWriter writer = new TAQWriter(out);) { writer.write(quote); writer.flush(); String output = "" + "Date\t" + "Timestamp\t" + "Instrument\t" + "Record Type\t" + "Bid Price\t" + "Bid Size\t" + "Ask Price\t" + "Ask Size\t" + "Trade Price\t" + "Trade Size\t" + "Trade Side\n" + "2016-01-01\t" + "08:00:00.000\t" + "FOO\t" + "Q\t" + "100.50\t" + "1000\t" + "100.75\t" + "250\t" + "\t" + "\t" + "\n"; assertEquals(output, out.toString("US-ASCII")); } }

Target:
public void writeWithDefaultConfiguration() throws Exception { TAQ.Quote quote = new TAQ.Quote(); quote.date = "2016-01-01"; quote.timestampMillis = 8 * 60 * 60 * 1000; quote.instrument = "FOO"; quote.bidPrice = 100.50; quote.bidSize = 1000; quote.askPrice = 100.75; quote.askSize = 250; try (ByteArrayOutputStream out = new ByteArrayOutputStream(); TAQWriter writer = new TAQWriter(out)) { writer.write(quote); writer.flush(); String output = "" + "Date\t" + "Timestamp\t" + "Instrument\t" + "Record Type\t" + "Bid Price\t" + "Bid Size\t" + "Ask Price\t" + "Ask Size\t" + "Trade Price\t" + "Trade Size\t" + "Trade Side\n" + "2016-01-01\t" + "08:00:00.000\t" + "FOO\t" + "Q\t" + "100.50\t" + "1000\t" + "100.75\t" + "250\t" + "\t" + "\t" + "\n"; assertEquals(output, out.toString("US-ASCII")); } }
Source:
private GatewayAccountEntity buildTestGatewayAccountWith3DSEntity() { GatewayAccountEntity gatewayAccount = new GatewayAccountEntity(); gatewayAccount.setId(1L); gatewayAccount.setGatewayName("epdq"); gatewayAccount.setRequires3ds(true); gatewayAccount.setIntegrationVersion3ds(1); gatewayAccount.setCredentials(ImmutableMap.of( CREDENTIALS_MERCHANT_ID, "merchant-id", CREDENTIALS_USERNAME, "username", CREDENTIALS_PASSWORD, "password", CREDENTIALS_SHA_IN_PASSPHRASE, "sha-passphrase" )); gatewayAccount.setType(TEST); return gatewayAccount; }

Target:
private GatewayAccountEntity buildTestGatewayAccountWith3DSEntity() { GatewayAccountEntity gatewayAccount = new GatewayAccountEntity(); gatewayAccount.setId(1L); gatewayAccount.setGatewayName("epdq"); gatewayAccount.setRequires3ds(true); gatewayAccount.setIntegrationVersion3ds(1); gatewayAccount.setCredentials(Map.of( CREDENTIALS_MERCHANT_ID, "merchant-id", CREDENTIALS_USERNAME, "username", CREDENTIALS_PASSWORD, "password", CREDENTIALS_SHA_IN_PASSPHRASE, "sha-passphrase" )); gatewayAccount.setType(TEST); return gatewayAccount; }
Source:
Subject cacheAndReturnSubject(ServerSession session) throws SecurityServiceException { UPAuthenticationToken usernamePasswordToken = new UPAuthenticationToken(session.getUsername(), session.getPassword()); Subject subject = securityManager.getSubject(usernamePasswordToken); SUBJECT_CACHE.put(session.getUsername(), subject); return subject; }

Target:
Subject cacheAndReturnSubject(ServerSession session) throws SecurityServiceException { UPAuthenticationToken usernamePasswordToken = new UPAuthenticationToken(session.getUsername(), session.getPassword()); return securityManager.getSubject(usernamePasswordToken); }
Source:
public Sequence<T> run(final Query<T> query, final Map<String, Object> responseContext) { final int priority = QueryContexts.getPriority(query, 0); final ListenableFuture<Sequence<T>> future = executor.submit(new AbstractPrioritizedCallable<Sequence<T>>(priority) { @Override public Sequence<T> call() throws Exception { return baseRunner.run(query, responseContext); } }); queryWatcher.registerQuery(query, future); return new LazySequence<>(new Supplier<Sequence<T>>() { @Override public Sequence<T> get() { try { final long timeout = QueryContexts.getTimeout(query); if (timeout == 0) { return future.get(); } else { return future.get(timeout, TimeUnit.MILLISECONDS); } } catch (ExecutionException | InterruptedException | TimeoutException ex) { throw Throwables.propagate(ex); } } }); }

Target:
public Sequence<T> run(final Query<T> query, final Map<String, Object> responseContext) { final int priority = QueryContexts.getPriority(query); final ListenableFuture<Sequence<T>> future = executor.submit(new AbstractPrioritizedCallable<Sequence<T>>(priority) { @Override public Sequence<T> call() throws Exception { return baseRunner.run(query, responseContext); } }); queryWatcher.registerQuery(query, future); return new LazySequence<>(new Supplier<Sequence<T>>() { @Override public Sequence<T> get() { try { if (QueryContexts.hasTimeout(query)) { return future.get(QueryContexts.getTimeout(query), TimeUnit.MILLISECONDS); } else { return future.get(); } } catch (ExecutionException | InterruptedException | TimeoutException ex) { throw Throwables.propagate(ex); } } }); }
Source:
CustomizingStatementHandler(Class<?> type, Method method) { this.sqlObjectType = type; this.method = method; final Stream<BoundCustomizer> typeCustomizers = concat(Stream.of(type.getInterfaces()), Stream.of(type)) .flatMap(t -> annotationsFor(t)) .map(a -> instantiateFactory(a).createForType(a, type)) .map(BoundCustomizer::of); final Stream<BoundCustomizer> methodCustomizers = annotationsFor(method) .map(a -> instantiateFactory(a).createForMethod(a, type, method)) .map(BoundCustomizer::of); final Stream<BoundCustomizer> parameterCustomizers = parameterCustomizers(type, method); statementCustomizers = Stream.of(typeCustomizers, methodCustomizers, parameterCustomizers) .flatMap(Function.identity()) .collect(Collectors.toList()); }

Target:
CustomizingStatementHandler(Class<?> type, Method method) { this.sqlObjectType = type; this.method = method; final Stream<BoundCustomizer> typeCustomizers = concat(Stream.of(type.getInterfaces()), Stream.of(type)) .flatMap(t -> annotationsFor(t)) .map(a -> instantiateFactory(a).createForType(a, type)) .map(BoundCustomizer::of); final Stream<BoundCustomizer> methodCustomizers = annotationsFor(method) .map(a -> instantiateFactory(a).createForMethod(a, type, method)) .map(BoundCustomizer::of); final Stream<BoundCustomizer> parameterCustomizers = parameterCustomizers(type, method); statementCustomizers = Stream.of(typeCustomizers, methodCustomizers, parameterCustomizers) .reduce(Stream.empty(), Stream::concat) .collect(Collectors.toList()); }
Source:
public void shouldNotifyEventWhenUpdateAnnotation() { Annotation annotation = createAnnotationAndAddSubscription("CommentUpdated", "Modification"); captureAndVerifyAnnotationEventNotification(() -> { annotation.setText("I update the annotation"); annotationService.updateAnnotation(session, annotation.getId(), annotation); return session.getDocument(new IdRef(annotation.getId())); }, COMMENT_UPDATED, DOCUMENT_UPDATED, 1); }

Target:
public void shouldNotifyEventWhenUpdateAnnotation() { Annotation annotation = createAnnotationAndAddSubscription("CommentUpdated", "Modification"); captureAndVerifyAnnotationEventNotification(() -> { annotation.setText("I update the annotation"); annotationService.updateAnnotation(session, annotation.getId(), annotation); return session.getDocument(new IdRef(annotation.getId())); }, COMMENT_UPDATED, DOCUMENT_UPDATED); }
Source:
public void stop() { startStopLock.writeLock().lock(); if (started) { try { LOG.info("LookupReferencesManager is stopping."); started = false; if (exec != null) { exec.shutdownNow(); exec = null; } for (Map.Entry<String, LookupExtractorFactoryContainer> e : lookupMap.entrySet()) { try { LOG.info("Closing lookup [%s]", e.getKey()); if (!e.getValue().getLookupExtractorFactory().close()) { LOG.error("Failed to close lookup [%s]."); } } catch (Exception ex) { LOG.error(ex, "Failed to close lookup [%s].", e.getKey()); } } lookupMap.clear(); } finally { startStopLock.writeLock().unlock(); } LOG.info("LookupReferencesManager is stopped."); } else { startStopLock.writeLock().unlock(); } }

Target:
public void stop() { if (!lifecycleLock.canStop()) { throw new ISE("can't stop."); } LOG.info("LookupReferencesManager is stopping."); if (!testMode) { mainThread.interrupt(); try { mainThread.join(); } catch (InterruptedException ex) { throw new ISE("failed to stop, mainThread couldn't finish."); } } for (Map.Entry<String, LookupExtractorFactoryContainer> e : stateRef.get().lookupMap.entrySet()) { try { LOG.info("Closing lookup [%s]", e.getKey()); if (!e.getValue().getLookupExtractorFactory().close()) { LOG.error("Failed to close lookup [%s].", e.getKey()); } } catch (Exception ex) { LOG.error(ex, "Failed to close lookup [%s].", e.getKey()); } } LOG.info("LookupReferencesManager is stopped."); }
Source:
public final byte[] getRawGpgSignature() { final byte[] raw = buffer; final byte[] header = {'g', 'p', 'g', 's', 'i', 'g'}; final int start = RawParseUtils.headerStart(header, raw, 0); if (start < 0) return null; final int end = RawParseUtils.headerEnd(raw, start); return Arrays.copyOfRange(raw, start, end); }

Target:
public final @Nullable byte[] getRawGpgSignature() { final byte[] raw = buffer; final byte[] header = {'g', 'p', 'g', 's', 'i', 'g'}; final int start = RawParseUtils.headerStart(header, raw, 0); if (start < 0) { return null; } final int end = RawParseUtils.headerEnd(raw, start); return Arrays.copyOfRange(raw, start, end); }
Source:
public boolean isCompact() { return compact; }

Target:
public boolean isCompact() { return reference == COMPACT; }
Source:
private static boolean isCorrectJavadocPosition(DetailAST blockComment) { DetailAST sibling = blockComment; do { sibling = sibling.getNextSibling(); if (sibling != null) { if (sibling.getType() == TokenTypes.BLOCK_COMMENT_BEGIN) { if (isJavadocComment(getBlockCommentContent(sibling))) { break; } } else if (sibling.getType() != TokenTypes.SINGLE_LINE_COMMENT) { sibling = null; } } } while (sibling != null); return sibling == null && (BlockCommentPosition.isOnType(blockComment) || BlockCommentPosition.isOnMember(blockComment)); }

Target:
private static boolean isCorrectJavadocPosition(DetailAST blockComment) { DetailAST sibling = blockComment.getNextSibling(); while (sibling != null) { if (sibling.getType() == TokenTypes.BLOCK_COMMENT_BEGIN) { if (isJavadocComment(getBlockCommentContent(sibling))) { break; } sibling = sibling.getNextSibling(); } else if (sibling.getType() == TokenTypes.SINGLE_LINE_COMMENT) { sibling = sibling.getNextSibling(); } else { sibling = null; } } return sibling == null && (BlockCommentPosition.isOnType(blockComment) || BlockCommentPosition.isOnMember(blockComment)); }
Source:
public void gerritEvent(GerritEvent event) { if (!isSupported()) { return; } if (event instanceof GerritTriggeredEvent) { logger.info("Recording timestamp due to an event for server: {}", event, serverName); GerritTriggeredEvent triggeredEvent = (GerritTriggeredEvent)event; persist(triggeredEvent); if (!playBackComplete) { if (!receivedEventCache.contains(event)) { receivedEventCache.add((ChangeBasedEvent)event); logger.debug("Added event to received cache for server: {}", event, serverName); } else { logger.debug("Event ALREADY in received cache for server: {}", event, serverName); } } else { receivedEventCache = new Vector<ChangeBasedEvent>(); logger.debug("Playback complete...will NOT add event to received cache for server: {}" , event, serverName); } } }

Target:
public void gerritEvent(GerritEvent event) { if (!isSupported()) { return; } if (event instanceof GerritTriggeredEvent) { logger.debug("Recording timestamp due to an event for server: {}", event, serverName); GerritTriggeredEvent triggeredEvent = (GerritTriggeredEvent)event; persist(triggeredEvent); if (!playBackComplete) { boolean receivedEvtFound = false; synchronized (receivedEventCache) { Iterator<GerritTriggeredEvent> i = receivedEventCache.iterator(); while (i.hasNext()) { GerritTriggeredEvent rEvt = i.next(); if (rEvt.equals(triggeredEvent)) { receivedEvtFound = true; break; } } } if (!receivedEvtFound) { receivedEventCache.add(triggeredEvent); logger.debug("Added event to received cache for server: {}", event, serverName); } else { logger.debug("Event ALREADY in received cache for server: {}", event, serverName); } } else { receivedEventCache = Collections.synchronizedList(new ArrayList<GerritTriggeredEvent>()); logger.debug("Playback complete...will NOT add event to received cache for server: {}" , event, serverName); } } }
Source:
private EditPreferencesPage openEmailSection(String wikiURL) { getUrl(wikiURL + URLsContent.SPECIAL_EDITING_PREFERENCES_EMAIL); return this; }

Target:
private EditPreferencesPage openEmailSection(String wikiURL) { getUrl(wikiURL + URLsContent.WIKI_DIR + URLsContent.SPECIAL_EDITING_PREFERENCES_EMAIL); return this; }
Source:
public List<OrganizationMembership> getOrganizationMemberships(long id) { return complete(submit(req("GET", tmpl("/users/{id}/organization_memberships.json").set("id", id)), handleList(OrganizationMembership.class, "organization_memberships"))); }

Target:
public Iterable<OrganizationMembership> getOrganizationMemberships(long id) { return new PagedIterable<OrganizationMembership>( tmpl("/users/{id}/organization_memberships.json").set("id", id), handleList(OrganizationMembership.class, "organization_memberships")); }
Source:
public void testRestServerPrefixedSslConfigs() { Map<String, String> httpsListenerProps = new HashMap<String, String>() { { put(HTTPS_LISTENER_PREFIX + SslConfigs.SSL_KEY_PASSWORD_CONFIG, "ssl_key_password"); put(HTTPS_LISTENER_PREFIX + SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, "ssl_keystore"); put(HTTPS_LISTENER_PREFIX + SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, "ssk_keystore_password"); put(HTTPS_LISTENER_PREFIX + SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, "ssl_truststore"); put(HTTPS_LISTENER_PREFIX + SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, "ssl_truststore_password"); } }; Set<String> passwordConfigs = Stream.of( SslConfigs.SSL_KEY_PASSWORD_CONFIG, SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG ).map(key -> HTTPS_LISTENER_PREFIX + key) .collect(Collectors.toSet()); Map<String, Object> expectedListenerProps = httpsListenerProps.entrySet().stream() .collect(Collectors.toMap( entry -> entry.getKey().substring(HTTPS_LISTENER_PREFIX.length()), entry -> passwordConfigs.contains(entry.getKey()) ? new Password(entry.getValue()) : entry.getValue() )); Map<String, String> props = new HashMap<String, String>() { { put(WorkerConfig.KEY_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter"); put(WorkerConfig.VALUE_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter"); put(StandaloneConfig.OFFSET_STORAGE_FILE_FILENAME_CONFIG, "/tmp/foad"); putAll(httpsListenerProps); } }; StandaloneConfig config = new StandaloneConfig(props); Map<String, Object> actualHttpsListenerProps = config.valuesWithPrefixAllOrNothing(HTTPS_LISTENER_PREFIX); assertEquals(expectedListenerProps, actualHttpsListenerProps); }

Target:
public void testRestServerPrefixedSslConfigs() { Map<String, String> workerProps = baseWorkerProps(); Map<String, Object> expectedSslProps = sslProps(); workerProps.putAll(withStringValues(expectedSslProps, HTTPS_LISTENER_PREFIX)); StandaloneConfig config = new StandaloneConfig(workerProps); assertEquals(expectedSslProps, config.valuesWithPrefixAllOrNothing(HTTPS_LISTENER_PREFIX)); }
Source:
void localVars() { boolean a; Object b; manyStatementsLater(); inTheGalaxyFarAway(); variablesAreInitialized(); a = true; if (a) { } b = new Object(); if (b != null) { } try { Thread.sleep(10); } catch (Exception ex) { if (ex != null) { } } for (Integer i : Arrays.asList(1,2,null)) { if (i == null) { } if (i != null) { } } }

Target:
void localVars() { boolean a; Object b; manyStatementsLater(); inTheGalaxyFarFarAway(); variablesAreInitialized(); a = true; if (a) { } b = new Object(); if (b != null) { } try { Thread.sleep(10); } catch (Exception ex) { if (ex != null) { } } for (Integer i : Arrays.asList(1,2,null)) { if (i == null) { } if (i != null) { } } }
Source:
public boolean equals(Object obj) { if (obj instanceof ApplicationCredentials) { ApplicationCredentials other = (ApplicationCredentials) obj; return Objects.equal(this.getApiKey(), other.getApiKey()); } return false; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ApplicationCredentials) { ApplicationCredentials other = (ApplicationCredentials) obj; return this.getApiKey().equals(other.getApiKey()); } return false; }
Source:
public void setBufferLineLimit(int bufferLines) { int chars = bufferLines * CHARS_PER_LINE_AVG; setWaterMarks(chars, chars + HIGH_WATERMARK_OFFSET_BYTES); }

Target:
private void setBufferLineLimit(int bufferLines) { int chars = bufferLines * CHARS_PER_LINE_AVG; setWaterMarks(chars, chars + HIGH_WATERMARK_OFFSET_BYTES); }
Source:
public static void copyFile(@Nonnull File src, @Nonnull File dst) throws BuildException { Copy cp = new Copy(); cp.setProject(new org.apache.tools.ant.Project()); cp.setTofile(dst); cp.setFile(src); cp.setOverwrite(true); cp.setPreserveLastModified(true); cp.execute(); try { copyFilePosixPermissions(src, dst); } catch (IOException e) { throw new BuildException("Cannot copy file permissions from " + src + " to " + dst, e); } }

Target:
public static void copyFile(@Nonnull File src, @Nonnull File dst) throws BuildException { Copy cp = new Copy(); cp.setProject(new org.apache.tools.ant.Project()); cp.setTofile(dst); cp.setFile(src); cp.setOverwrite(true); cp.execute(); }
Source:
public void tearDown() throws Exception { System.setSecurityManager(originalSecurityManager); FileUtils.delete(root, FileUtils.RECURSIVE); }

Target:
public void tearDown() throws Exception { System.setSecurityManager(originalSecurityManager); FileUtils.delete(root, FileUtils.RECURSIVE | FileUtils.RETRY); }
Source:
public void testViewInFormulaEditorAfterClone() { String userVariablename = "testvariable1"; String userVariablename2 = "testvariable2"; onBrickAtPosition(1).onFormulaTextField(R.id.brick_change_variable_edit_text) .performNewVariable(userVariablename); onBrickAtPosition(1) .performCopyBrick(); onBrickAtPosition(1).onFormulaTextField(R.id.brick_change_variable_edit_text) .performNewVariable(userVariablename2); onBrickAtPosition(1).performDragNDrop(BrickCoordinatesProvider.DOWN_ONE_POSITION); onBrickAtPosition(2).onVariableSpinner(R.id.change_variable_spinner) .checkHasVariable(userVariablename); onBrickAtPosition(2).onVariableSpinner(R.id.change_variable_spinner) .checkHasVariable(userVariablename2); }

Target:
public void testViewInFormulaEditorAfterClone() { String userVariableName = "testvariable1"; String userVariableName2 = "testvariable2"; performNewVariableFromFormulaEditor(1, userVariableName); onBrickAtPosition(1) .performCopyBrick(); performNewVariableFromFormulaEditor(1, userVariableName2); onBrickAtPosition(1).performDragNDrop(BrickCoordinatesProvider.DOWN_ONE_POSITION); onBrickAtPosition(1).onVariableSpinner(R.id.change_variable_spinner) .checkShowsVariableNamesInAdapter(Arrays.asList(userVariableName, userVariableName2)); }
Source:
public void testEditFile() throws CoreException, IOException, InterruptedException { createSimpleProject("TestProject"); assertTrue(projectExists("TestProject")); IFile testFile1 = createEmptyFileInProject("TestFile1", "TestProject"); IFile testFile2 = createEmptyFileInProject("TestFile2", "TestProject"); assertTrue(SelectionView.getOpenedView().getSelection().isEmpty()); SelectionView.getOpenedView().dropToSelection(testFile1); SelectionView.getOpenedView().dropToSelection(testFile2); assertFalse(thereIsATraceBetween(testFile1, testFile2)); createTraceForCurrentSelectionOfType(GenericTraceMetaModelPackage.eINSTANCE.getRelatedTo()); assertTrue(thereIsATraceBetween(testFile1, testFile2)); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IMarker[] markers = root.findMarkers(TestHelper.CAPRA_PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); int currMarkersSize = markers.length; testFile1.appendContents(new ByteArrayInputStream("\nhello again 1!".getBytes()), true, true, new NullProgressMonitor()); TimeUnit.MILLISECONDS.sleep(100); markers = root.findMarkers(TestHelper.CAPRA_PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); assertEquals(currMarkersSize + 1, markers.length); currMarkersSize = markers.length; testFile2.appendContents(new ByteArrayInputStream("\nhello again 2!".getBytes()), true, true, new NullProgressMonitor()); TimeUnit.MILLISECONDS.sleep(100); markers = root.findMarkers(TestHelper.CAPRA_PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); assertEquals(currMarkersSize + 1, markers.length); }

Target:
public void testEditFile() throws CoreException, IOException, InterruptedException { createSimpleProject("TestProject"); assertTrue(projectExists("TestProject")); IFile testFile1 = createEmptyFileInProject("TestFile1", "TestProject"); IFile testFile2 = createEmptyFileInProject("TestFile2", "TestProject"); assertTrue(SelectionView.getOpenedView().getSelection().isEmpty()); SelectionView.getOpenedView().dropToSelection(testFile1); SelectionView.getOpenedView().dropToSelection(testFile2); assertFalse(thereIsATraceBetween(testFile1, testFile2)); createTraceForCurrentSelectionOfType(GenericTraceMetaModelPackage.eINSTANCE.getRelatedTo()); assertTrue(thereIsATraceBetween(testFile1, testFile2)); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IMarker[] markers = root.findMarkers(TestHelper.CAPRA_PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); int currMarkersSize = markers.length; testFile1.appendContents(new ByteArrayInputStream("\nhello again 1!".getBytes()), true, true, new NullProgressMonitor()); TimeUnit.MILLISECONDS.sleep(300); markers = root.findMarkers(TestHelper.CAPRA_PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); assertEquals(currMarkersSize + 1, markers.length); currMarkersSize = markers.length; testFile2.appendContents(new ByteArrayInputStream("\nhello again 2!".getBytes()), true, true, new NullProgressMonitor()); TimeUnit.MILLISECONDS.sleep(300); markers = root.findMarkers(TestHelper.CAPRA_PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); assertEquals(currMarkersSize + 1, markers.length); }
Source:
public VmPoolMap mapRow(ResultSet rs, int rowNum) throws SQLException { VmPoolMap entity = new VmPoolMap(); entity.setvm_guid(getGuid(rs, "vm_guid")); entity.setvm_pool_id(getGuid(rs, "vm_pool_id")); return entity; }

Target:
public VmPoolMap mapRow(ResultSet rs, int rowNum) throws SQLException { VmPoolMap entity = new VmPoolMap(); entity.setvm_guid(getGuidDefaultEmpty(rs, "vm_guid")); entity.setvm_pool_id(getGuidDefaultEmpty(rs, "vm_pool_id")); return entity; }
Source:
public void processLeftData(final MistDataEvent input) { dataUpdate((Map<String, Object>)input.getValue()); if (finalState.contains(state)) { final Tuple2<Map<String, Object>, Object> output = new Tuple2(input.getValue(), state); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "{0} updates the state to {1} with input {2}, and generates {3}", new Object[]{this.getClass().getName(), getOperatorState(), input, output}); } input.setValue(output); outputEmitter.emitData(input); } }

Target:
public void processLeftData(final MistDataEvent input) { stateTransition((Map<String, Object>)input.getValue()); if (finalState.contains(currState)) { final Tuple2<Map<String, Object>, Object> output = new Tuple2(input.getValue(), currState); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "{0} updates the state to {1} with input {2}, and generates {3}", new Object[]{this.getClass().getName(), getOperatorState(), input, output}); } input.setValue(output); outputEmitter.emitData(input); } }
Source:
private void dataCenterWithClusterSelectedItemChanged(Object sender, EventArgs args) { behavior.dataCenterWithClusterSelectedItemChanged(); DataCenterWithCluster dataCenterWithCluster = (DataCenterWithCluster) getDataCenterWithClustersList().getSelectedItem(); if (dataCenterWithCluster != null && dataCenterWithCluster.getDataCenter() != null) { getDisksAllocationModel().setQuotaEnforcementType(dataCenterWithCluster.getDataCenter() .getQuotaEnforcementType()); } updateMaximalVmMemSize(); }

Target:
private void dataCenterWithClusterSelectedItemChanged(Object sender, EventArgs args) { behavior.dataCenterWithClusterSelectedItemChanged(); DataCenterWithCluster dataCenterWithCluster = (DataCenterWithCluster) getDataCenterWithClustersList().getSelectedItem(); if (dataCenterWithCluster != null && dataCenterWithCluster.getDataCenter() != null) { getDisksAllocationModel().setQuotaEnforcementType(dataCenterWithCluster.getDataCenter() .getQuotaEnforcementType()); } updateMaximalVmMemSize(); handleQxlClusterLevel(); }
Source:
public RelNode findBestExp() { ensureRootConverters(); registerMaterializations(); PLANNING: for (VolcanoPlannerPhase phase : VolcanoPlannerPhase.values()) { while (true) { LOGGER.debug("PLANNER = {}; PHASE = {}; COST = {}", this, phase.toString(), root.bestCost); VolcanoRuleMatch match = ruleQueue.popMatch(phase); if (match == null) { break; } assert match.getRule().matches(match); try { match.onMatch(); } catch (VolcanoTimeoutException e) { LOGGER.warn("Catch VolcanoTimeoutException, abort optimization."); root = canonize(root); ruleQueue.phaseCompleted(phase); break PLANNING; } root = canonize(root); } ruleQueue.phaseCompleted(phase); } if (topDownOpt) { tasks.push(OptimizeTask.create(root)); while (!tasks.isEmpty()) { OptimizeTask task = tasks.peek(); if (task.hasSubTask()) { tasks.push(task.nextSubTask()); continue; } task = tasks.pop(); task.execute(); } } if (LOGGER.isTraceEnabled()) { StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); dump(pw); pw.flush(); LOGGER.trace(sw.toString()); } dumpRuleAttemptsInfo(); RelNode cheapest = root.buildCheapestPlan(this); if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Cheapest plan:\n{}", RelOptUtil.toString(cheapest, SqlExplainLevel.ALL_ATTRIBUTES)); if (!provenanceMap.isEmpty()) { LOGGER.debug("Provenance:\n{}", Dumpers.provenance(provenanceMap, cheapest)); } } return cheapest; }

Target:
public RelNode findBestExp() { ensureRootConverters(); registerMaterializations(); PLANNING: for (VolcanoPlannerPhase phase : VolcanoPlannerPhase.values()) { while (true) { LOGGER.debug("PLANNER = {}; PHASE = {}; COST = {}", this, phase.toString(), root.bestCost); VolcanoRuleMatch match = ruleQueue.popMatch(phase); if (match == null) { break; } assert match.getRule().matches(match); try { match.onMatch(); } catch (VolcanoTimeoutException e) { LOGGER.warn("Volcano planning times out, cancels the subsequent optimization."); root = canonize(root); ruleQueue.phaseCompleted(phase); break PLANNING; } root = canonize(root); } ruleQueue.phaseCompleted(phase); } if (topDownOpt) { tasks.push(OptimizeTask.create(root)); while (!tasks.isEmpty()) { OptimizeTask task = tasks.peek(); if (task.hasSubTask()) { tasks.push(task.nextSubTask()); continue; } task = tasks.pop(); task.execute(); } } if (LOGGER.isTraceEnabled()) { StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); dump(pw); pw.flush(); LOGGER.trace(sw.toString()); } dumpRuleAttemptsInfo(); RelNode cheapest = root.buildCheapestPlan(this); if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Cheapest plan:\n{}", RelOptUtil.toString(cheapest, SqlExplainLevel.ALL_ATTRIBUTES)); if (!provenanceMap.isEmpty()) { LOGGER.debug("Provenance:\n{}", Dumpers.provenance(provenanceMap, cheapest)); } } return cheapest; }
Source:
private ClientRegistration azureClientRegistration() { String tenantId = aadAuthenticationProperties.getTenantId().trim(); Assert.hasText(tenantId, "azure.activedirectory.tenant-id should have text."); Assert.doesNotContain(tenantId, " ", "azure.activedirectory.tenant-id should not contain ' '."); Assert.doesNotContain(tenantId, "/", "azure.activedirectory.tenant-id should not contain '/'."); return ClientRegistration.withRegistrationId("azure") .clientId(aadAuthenticationProperties.getClientId()) .clientSecret(aadAuthenticationProperties.getClientSecret()) .clientAuthenticationMethod(ClientAuthenticationMethod.POST) .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) .redirectUriTemplate("{baseUrl}/login/oauth2/code/{registrationId}") .scope("openid", "<LINK_4>", "profile") .authorizationUri( String.format( "<LINK_2>", tenantId ) ) .tokenUri( String.format( "<LINK_0>", tenantId ) ) .userInfoUri("<LINK_3>") .userNameAttributeName(AADAccessTokenClaim.NAME) .jwkSetUri( String.format( "<LINK_1>", tenantId ) ) .clientName("Azure") .build(); }

Target:
private ClientRegistration azureClientRegistration() { String tenantId = aadAuthenticationProperties.getTenantId().trim(); Assert.hasText(tenantId, "azure.activedirectory.tenant-id should have text."); Assert.doesNotContain(tenantId, " ", "azure.activedirectory.tenant-id should not contain ' '."); Assert.doesNotContain(tenantId, "/", "azure.activedirectory.tenant-id should not contain '/'."); return ClientRegistration.withRegistrationId("azure") .clientId(aadAuthenticationProperties.getClientId()) .clientSecret(aadAuthenticationProperties.getClientSecret()) .clientAuthenticationMethod(ClientAuthenticationMethod.POST) .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) .redirectUriTemplate("{baseUrl}/login/oauth2/code/{registrationId}") .scope(aadAuthenticationProperties.getScope()) .authorizationUri( String.format( "<LINK_2>", tenantId ) ) .tokenUri( String.format( "<LINK_0>", tenantId ) ) .userInfoUri("<LINK_3>") .userNameAttributeName(AADAccessTokenClaim.NAME) .jwkSetUri( String.format( "<LINK_1>", tenantId ) ) .clientName("Azure") .build(); }
Source:
public void validate() throws Exception { String command = getCommand(); Set<String> allowedText = new TreeSet<>(Arrays.asList("add", "delete", "list", "list-indexed", "indexed", "get-repos", "get-repos-type", "get", "set")); if (command == null) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!allowedText.contains(command)) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!command.startsWith("list") && getTags().isEmpty()) { throw new Exception("The message must contain a tag (project name(s))"); } if (command.compareTo("get") == 0 && getTags().size() != 1) { throw new Exception("The \"get\" command can take only one project."); } super.validate(); }

Target:
public void validate() throws Exception { String command = getCommand(); Set<String> allowedText = new TreeSet<>(Arrays.asList("add", "delete", "list", "list-indexed", "indexed", "get-repos", "get-repos-type", "get", "set")); if (command == null) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!allowedText.contains(command)) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!command.startsWith("list") && getTags().isEmpty()) { throw new Exception("The message must contain a tag (project name(s))"); } if (command.equals("get") && getTags().size() != 1) { throw new Exception("The \"get\" command can take only one project."); } super.validate(); }
Source:
private void copyProperties(Exchange newExchange){ ContextProxy context=new ContextProxy(); Context contextNew=newExchange.getContext(); for (org.switchyard.Property p: context.getProperties(Scope.EXCHANGE)) { if(contextNew.getProperty(p.getName(),Scope.EXCHANGE)==null && !p.getName().startsWith("org.switchyard.bus.camel")){ Property newProp=newExchange.getContext().setProperty(p.getName(), p.getValue(), Scope.EXCHANGE); if(p.getLabels()!=null && !p.getLabels().isEmpty()){ newProp.addLabels(p.getLabels()); } } } }

Target:
private void copyProperties(Exchange newExchange) { ContextProxy context = new ContextProxy(); Context contextNew = newExchange.getContext(); String prefixPropagation = this.getPrefixPropertyPropagation(newExchange.getConsumer().getDomain()); try { for (org.switchyard.Property p : context.getProperties(Scope.EXCHANGE)) { if (prefixPropagation != null && !prefixPropagation.equals("")) { if (contextNew.getProperty(p.getName(), Scope.EXCHANGE) == null && p.getName().startsWith(prefixPropagation)) { Property newProp = newExchange.getContext().setProperty(p.getName(), p.getValue(), Scope.EXCHANGE); if (p.getLabels() != null && !p.getLabels().isEmpty()) { newProp.addLabels(p.getLabels()); } } } } } catch (Exception e) { _logger.warn("Unable to copy the properties: " + e.getMessage()); } }
Source:
protected RowExpression visitInPredicate(InPredicate node, Void context) { ImmutableList.Builder<RowExpression> arguments = ImmutableList.builder(); arguments.add(process(node.getValue(), context)); if (node.getValueList() instanceof InListExpression) { InListExpression values = (InListExpression) node.getValueList(); for (Expression value : values.getValues()) { arguments.add(process(value, context)); } } else { arguments.add(process(node.getValueList(), context)); } return specialForm(IN, BOOLEAN, arguments.build()); }

Target:
protected RowExpression visitInPredicate(InPredicate node, Void context) { ImmutableList.Builder<RowExpression> arguments = ImmutableList.builder(); arguments.add(process(node.getValue(), context)); InListExpression values = (InListExpression) node.getValueList(); for (Expression value : values.getValues()) { arguments.add(process(value, context)); } return specialForm(IN, BOOLEAN, arguments.build()); }
Source:
private void refresh(Collection<CustomizedView> customizedViewList) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); if (customizedViewList != null && !customizedViewList.isEmpty()) { for (InstanceConfig config : _instanceConfigs) { instanceConfigMap.put(config.getId(), config); } for (CustomizedView customView : customizedViewList) { String resourceName = customView.getId(); for (String partitionName : customView.getPartitionSet()) { Map<String, String> stateMap = customView.getStateMap(partitionName); for (String instanceName : stateMap.keySet()) { String currentState = stateMap.get(instanceName); if (instanceConfigMap.containsKey(instanceName)) { InstanceConfig instanceConfig = instanceConfigMap.get(instanceName); addEntry(resourceName, partitionName, currentState, instanceConfig); } else { logger.warn( "Participant is not found with proper configuration information. It might already be removed from the cluster. " + "Skip recording partition assignment entry: Partition {}, Participant {}, State {}.", instanceName, partitionName, instanceName, stateMap.get(instanceName)); } } } } } }

Target:
private void refresh(Collection<CustomizedView> customizedViewList) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); if (customizedViewList != null && !customizedViewList.isEmpty()) { for (InstanceConfig config : _instanceConfigs) { instanceConfigMap.put(config.getId(), config); } for (CustomizedView customizeView : customizedViewList) { String resourceName = customizeView.getId(); for (String partitionName : customizeView.getPartitionSet()) { Map<String, String> stateMap = customizeView.getStateMap(partitionName); for (String instanceName : stateMap.keySet()) { String customizedState = stateMap.get(instanceName); if (instanceConfigMap.containsKey(instanceName)) { InstanceConfig instanceConfig = instanceConfigMap.get(instanceName); addEntry(resourceName, partitionName, customizedState, instanceConfig); } else { logger.warn( "Participant is not found with proper configuration information. It might already be removed from the cluster. " + "Skip recording partition assignment entry: Partition {}, Participant {}, State {}.", instanceName, partitionName, instanceName, stateMap.get(instanceName)); } } } } } }
Source:
static void analyzeSingle(final PsiElement element, AnnotationHolder holder) { if (element instanceof HaxePackageStatement) { PackageChecker.check((HaxePackageStatement)element, holder); } else if (element instanceof HaxeMethod) { MethodChecker.check((HaxeMethod)element, holder); } else if (element instanceof HaxeClass) { ClassChecker.check((HaxeClass)element, holder); } if (element instanceof HaxeType) { TypeChecker.check((HaxeType)element, holder); } if (element instanceof HaxeVarDeclaration) { FieldChecker.check((HaxeVarDeclaration)element, holder); } }

Target:
static void analyzeSingle(final PsiElement element, AnnotationHolder holder) { if (element instanceof HaxePackageStatement) { PackageChecker.check((HaxePackageStatement)element, holder); } else if (element instanceof HaxeMethod) { MethodChecker.check((HaxeMethod)element, holder); } else if (element instanceof HaxeClass) { ClassChecker.check((HaxeClass)element, holder); } else if (element instanceof HaxeType) { TypeChecker.check((HaxeType)element, holder); } else if (element instanceof HaxeVarDeclaration) { FieldChecker.check((HaxeVarDeclaration)element, holder); } }
Source:
public void testAddOneItemToBox() { final String position = "F06"; BoxPage page = getBoxPage(500L); BoxVisualization visualization = page.getVisualization(); assertTrue("empty position is empty", visualization.isEmptyPosition(position)); visualization.selectPosition(position); visualization.lookupBarcode("TIB_SamStock"); visualization.updatePosition(false); Box box = (Box) getSession().get(BoxImpl.class, 500L); BoxableView itemAtPosition = box.getBoxable(position); assertNotNull(itemAtPosition); }

Target:
public void testAddOneItemToBox() { final String position = "F06"; BoxPage page = getBoxPage(500L); BoxVisualization visualization = page.getVisualization(); assertTrue("empty position is empty", visualization.isEmptyPosition(position)); Box initial = (Box) getSession().get(BoxImpl.class, 500L); assertNull(initial.getBoxable(position)); visualization.selectPosition(position); visualization.lookupBarcode("TIB_SamStock"); visualization.updatePosition(false); BoxPage again = getBoxPage(500L); assertFalse("checking that position is no longer empty", again.getVisualization().isEmptyPosition(position)); Box box = (Box) getSession().get(BoxImpl.class, 500L); assertNotNull(box.getBoxable(position)); }
Source:
public void testAvailableTargetTypes() { final ProjectInfo info = resolveProjectInfo("examples/src/scala/org/pantsbuild/example/hello/"); final List<String> availableTargetTypes = Arrays.asList(info.getAvailableTargetTypes()); assertNotNull(availableTargetTypes); assertNotEmpty(availableTargetTypes); assertContain(availableTargetTypes, "scala_library", "java_library"); }

Target:
public void testAvailableTargetTypes() { final ProjectInfo info = resolveProjectInfo("examples/src/scala/org/pantsbuild/example/hello/"); if (PantsUtil.isCompatibleVersion(info.getVersion(), "1.0.13")) { final List<String> availableTargetTypes = Arrays.asList(info.getAvailableTargetTypes()); assertNotEmpty(availableTargetTypes); assertContain(availableTargetTypes, "scala_library", "java_library"); } }
Source:
public static synchronized RawDSInputPanel createInstance(String context) { RawDSInputPanel instance = new RawDSInputPanel(context); instance.postInit(); instance.createTimeZoneList(); return instance; }

Target:
static synchronized RawDSInputPanel createInstance(String context) { RawDSInputPanel instance = new RawDSInputPanel(context); instance.postInit(); instance.createTimeZoneList(); return instance; }
Source:
public void async() throws Exception { CountDownLatch latch = new CountDownLatch(1); AMQP.Queue.Declare queueDeclare = new AMQImpl.Queue.Declare.Builder() .queue(queue) .durable(true) .exclusive(false) .autoDelete(false) .arguments(null) .build(); channel.asyncCompletableRpc(queueDeclare) .thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Exchange.Declare.Builder() .exchange(exchange) .type("fanout") .durable(false) .autoDelete(false) .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Queue.Bind.Builder() .queue(queue) .exchange(exchange) .routingKey("") .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync(action -> { try { channel.basicPublish("", queue, null, "dummy".getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync((whatever) -> { try { channel.basicConsume(queue, true, new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { latch.countDown(); } }); } catch (IOException e) { throw new RuntimeException(e); } }, executor); assertTrue(latch.await(1, TimeUnit.SECONDS)); }

Target:
public void async() throws Exception { channel.confirmSelect(); CountDownLatch latch = new CountDownLatch(1); AMQP.Queue.Declare queueDeclare = new AMQImpl.Queue.Declare.Builder() .queue(queue) .durable(true) .exclusive(false) .autoDelete(false) .arguments(null) .build(); channel.asyncCompletableRpc(queueDeclare) .thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Exchange.Declare.Builder() .exchange(exchange) .type("fanout") .durable(false) .autoDelete(false) .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Queue.Bind.Builder() .queue(queue) .exchange(exchange) .routingKey("") .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync(action -> { try { channel.basicPublish("", queue, null, "dummy".getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync((whatever) -> { try { channel.basicConsume(queue, true, new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { latch.countDown(); } }); } catch (IOException e) { throw new RuntimeException(e); } }, executor); channel.waitForConfirmsOrDie(1000); assertTrue(latch.await(2, TimeUnit.SECONDS)); }
Source:
public AbstractEntityHydrator(List<Object> results, Query query, EntityDictionary entityDictionary) { this.stitchList = new StitchList(entityDictionary); this.results = new ArrayList<>(results); this.query = query; this.entityDictionary = entityDictionary; }

Target:
public AbstractEntityHydrator(List<Object> results, Query query, EntityDictionary entityDictionary) { this.stitchList = new StitchList(entityDictionary); this.query = query; this.entityDictionary = entityDictionary; List<String> projections = this.query.getMetrics().keySet().stream() .map(Metric::getName) .collect(Collectors.toList()); projections.addAll(this.query.getDimensions().stream() .map(Dimension::getName) .collect(Collectors.toList())); results.forEach(result -> { Map<String, Object> row = new HashMap<>(); Object[] resultValues = result instanceof Object[] ? (Object[]) result : new Object[] { result }; Preconditions.checkArgument(projections.size() == resultValues.length); for (int idx = 0; idx < resultValues.length; idx++) { Object value = resultValues[idx]; String fieldName = projections.get(idx); row.put(fieldName, value); } this.results.add(row); }); }
Source:
public boolean isValidAuthorizations(String user, List<ByteBuffer> auths) throws AccumuloSecurityException { if (auths.size() == 0) { return true; } Authorizations userauths = getCachedUserAuthorizations(user); for (ByteBuffer auth : auths) { if (!userauths.contains(ByteBufferUtil.toBytes(auth))) { return false; } } return true; }

Target:
public boolean isValidAuthorizations(String user, List<ByteBuffer> auths) throws AccumuloSecurityException { if (auths.isEmpty()) { return true; } Authorizations userauths = getCachedUserAuthorizations(user); for (ByteBuffer auth : auths) { if (!userauths.contains(ByteBufferUtil.toBytes(auth))) { return false; } } return true; }