auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void continue_in_try_finally() { final CFG cfg = buildCFG("void fun() { while (foo()) {\n" + " try {\n" + " bar(\"try\");\n" + " continue;\n" + " } finally {\n" + " qix(\"finally\");\n" + " }\n" + " }}"); final CFGChecker cfgChecker = checker( block( element(IDENTIFIER, "foo"), element(METHOD_INVOCATION) ).terminator(WHILE_STATEMENT).successors(0, 4), block(element(TRY_STATEMENT)).successors(3), block( element(Tree.Kind.IDENTIFIER, "bar"), element(STRING_LITERAL, "try"), element(METHOD_INVOCATION) ).successors(2).exceptions(1), new BlockChecker(CONTINUE_STATEMENT, 1).hasNoExitBlock(), block(element(IDENTIFIER, "qix"), element(STRING_LITERAL, "finally"), element(METHOD_INVOCATION) ).successors(0, 5) ); cfgChecker.check(cfg); }

Target:
public void continue_in_try_finally() { final CFG cfg = buildCFG("void fun() { while (foo()) {\n" + " try {\n" + " bar(\"try\");\n" + " continue;\n" + " } finally {\n" + " qix(\"finally\");\n" + " }\n" + " }}"); final CFGChecker cfgChecker = checker( block( element(IDENTIFIER, "foo"), element(METHOD_INVOCATION) ).terminator(WHILE_STATEMENT).successors(0, 4), block(element(TRY_STATEMENT)).successors(3), block( element(Tree.Kind.IDENTIFIER, "bar"), element(STRING_LITERAL, "try"), element(METHOD_INVOCATION) ).successors(2).exceptions(1), terminator(CONTINUE_STATEMENT, 1).hasNoExitBlock(), block(element(IDENTIFIER, "qix"), element(STRING_LITERAL, "finally"), element(METHOD_INVOCATION) ).successors(0, 5) ); cfgChecker.check(cfg); }
Source:
private int sampleFromTerms(final double randomVar, final double[] terms) { double val = randomVar; for (int i = 0; i < terms.length; i++) { if (val < terms[i]) { return i; } val -= terms[i]; } throw new RuntimeException("randomVar have to be smaller than summation of all terms"); }

Target:
private int sampleFromTerms(final double randomVar, final double[] terms) { double val = randomVar; for (int i = 0; i < terms.length; i++) { if (val < terms[i]) { return i; } val -= terms[i]; } throw new RuntimeException("randomVar has to be smaller than summation of all terms"); }
Source:
public void changeEvent(int type) { String currUri = null; int currIndex = 0; IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); if (connection != null) { currUri = connection.getUri(); } int index = 0; for (int i = 0; i < connections.length; ++i) { if (connections[i].getUri() != null && connections[i].getUri().equals(currUri)) index = i; } if (type == IDockerConnectionManagerListener.RENAME_EVENT) { index = currIndex; } if (connections.length > 0 && type != IDockerConnectionManagerListener.REMOVE_EVENT) { setConnection(connections[index]); } else { setConnection(null); } }

Target:
public void changeEvent(int type) { String currUri = null; int currIndex = 0; IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); if (connection != null) { currUri = connection.getUri(); } int index = 0; for (int i = 0; i < connections.length; ++i) { if (currUri.equals(connections[i].getUri())) { index = i; } } if (type == IDockerConnectionManagerListener.RENAME_EVENT) { index = currIndex; } if (connections.length > 0 && type != IDockerConnectionManagerListener.REMOVE_EVENT) { setConnection(connections[index]); } else { setConnection(null); } }
Source:
public List<Attribute> getAttributes(PerunSession sess, Group group, Member member, Resource resource, List<String> attrNames, boolean workWithUserAttributes) throws InternalErrorException, MemberResourceMismatchException, GroupResourceMismatchException, MemberGroupMismatchException { checkGroupIsFromTheSameVoLikeResource(sess, group, resource); List<Attribute> attributes = getAttributes(sess, member, resource, attrNames, workWithUserAttributes); if (attrNames.isEmpty()) { attributes.addAll(getAttributes(sess, member, group)); return attributes; } List<String> memberGroupAttributeNames = new ArrayList<>(); for (String attributeName : attrNames) { if (attributeName.startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)) { memberGroupAttributeNames.add(attributeName); } } if (!memberGroupAttributeNames.isEmpty()) { attributes.addAll(getAttributesManagerImpl().getAttributes(sess, member, group, memberGroupAttributeNames)); } return attributes; }

Target:
public List<Attribute> getAttributes(PerunSession sess, Group group, Member member, Resource resource, List<String> attrNames, boolean workWithUserAttributes) throws InternalErrorException, MemberResourceMismatchException, GroupResourceMismatchException, MemberGroupMismatchException { checkGroupIsFromTheSameVoLikeResource(sess, group, resource); checkMemberIsFromTheSameVoLikeGroup(sess, member, group); List<Attribute> attributes = getAttributes(sess, member, resource, attrNames, workWithUserAttributes); if (attrNames.isEmpty()) { attributes.addAll(getAttributes(sess, member, group)); return attributes; } List<String> memberGroupAttributeNames = new ArrayList<>(); for (String attributeName : attrNames) { if (attributeName.startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)) { memberGroupAttributeNames.add(attributeName); } } if (!memberGroupAttributeNames.isEmpty()) { attributes.addAll(getAttributesManagerImpl().getAttributes(sess, member, group, memberGroupAttributeNames)); } return attributes; }
Source:
public TimeView() { Span text = new Span("Time view " + LocalDateTime.now().toString()); Button back = new Button("Return", event -> UI.getCurrent().navigate("")); Button remove = new Button("Remove time view", event -> SessionRouteRegistry.getSessionRegistry(VaadinSession.getCurrent()) .removeRoute(TimeView.class)); Button reload = new Button("Reload page", event -> UI.getCurrent().getPage().reload()); add(text, back, remove, reload); }

Target:
public TimeView() { Span text = new Span("Time view " + LocalDateTime.now().toString()); Button back = new Button("Return", event -> UI.getCurrent().navigate("")); back.setId("time-return"); Button remove = new Button("Remove time view", event -> RouteConfiguration.forSessionScope() .removeRoute(TimeView.class)); remove.setId("time-remove"); Button reload = new Button("Reload page", event -> UI.getCurrent().getPage().reload()); reload.setId("time-reload"); add(text, back, remove, reload); }
Source:
public static InputStream teeInputWithDecompression( NetworkPeerManager peerManager, String requestId, InputStream availableInputStream, OutputStream decompressedOutput, @Nullable String contentEncoding, ResponseHandler responseHandler) throws IOException { OutputStream output = decompressedOutput; CountingOutputStream decompressedCounter = null; if (contentEncoding != null) { boolean gzipEncoding = "gzip".equals(contentEncoding); boolean deflateEncoding = "deflate".equals(contentEncoding); if (gzipEncoding || deflateEncoding) { decompressedCounter = new CountingOutputStream(decompressedOutput); if (gzipEncoding) { output = GunzippingOutputStream.create(decompressedCounter); } else if (deflateEncoding) { output = new InflaterOutputStream(decompressedCounter); } } else { CLog.writeToConsole( peerManager, Console.MessageLevel.WARNING, Console.MessageSource.NETWORK, "Unsupported Content-Encoding in response for request #" + requestId + ": " + contentEncoding); } } return new ResponseHandlingInputStream( availableInputStream, requestId, output, decompressedCounter, peerManager, responseHandler); }

Target:
public static InputStream teeInputWithDecompression( NetworkPeerManager peerManager, String requestId, InputStream availableInputStream, OutputStream decompressedOutput, @Nullable String contentEncoding, ResponseHandler responseHandler) throws IOException { OutputStream output = decompressedOutput; CountingOutputStream decompressedCounter = null; if (contentEncoding != null) { boolean gzipEncoding = GZIP_ENCODING.equals(contentEncoding); boolean deflateEncoding = DEFLATE_ENCODING.equals(contentEncoding); if (gzipEncoding || deflateEncoding) { decompressedCounter = new CountingOutputStream(decompressedOutput); if (gzipEncoding) { output = GunzippingOutputStream.create(decompressedCounter); } else if (deflateEncoding) { output = new InflaterOutputStream(decompressedCounter); } } else { CLog.writeToConsole( peerManager, Console.MessageLevel.WARNING, Console.MessageSource.NETWORK, "Unsupported Content-Encoding in response for request #" + requestId + ": " + contentEncoding); } } return new ResponseHandlingInputStream( availableInputStream, requestId, output, decompressedCounter, peerManager, responseHandler); }
Source:
private static synchronized Map<Integer, String> getTrace(String filePath, int recordCount) throws WorkloadException { Map<Integer, String> urlMap = new ConcurrentHashMap<Integer, String>(); int count = 0; String line; try { FileReader inputFile = new FileReader(filePath); BufferedReader bufferReader = new BufferedReader(inputFile); while ((line = bufferReader.readLine()) != null) { urlMap.put(count++, line.trim()); if (count >= recordCount) break; } bufferReader.close(); } catch (IOException e) { throw new WorkloadException( "Error while reading the trace. Please make sure the trace file path is correct. " + e.getLocalizedMessage()); } return urlMap; }

Target:
private static Map<Integer, String> getTrace(String filePath, int recordCount) throws WorkloadException { Map<Integer, String> urlMap = new HashMap<Integer, String>(); int count = 0; String line; try { FileReader inputFile = new FileReader(filePath); BufferedReader bufferReader = new BufferedReader(inputFile); while ((line = bufferReader.readLine()) != null) { urlMap.put(count++, line.trim()); if (count >= recordCount) break; } bufferReader.close(); } catch (IOException e) { throw new WorkloadException( "Error while reading the trace. Please make sure the trace file path is correct. " + e.getLocalizedMessage()); } return urlMap; }
Source:
protected Object doInBackground() throws Exception { Timer updateViewTime = new Timer(DELAY_DRAWING, this); try { beginDrawing = System.currentTimeMillis(); renderer = new ImageRenderer(); renderer.setRsProvider(resultSetProviderFactory); updateViewTime.start(); rendererImage = mapControl.getMapTransform().getImage(); renderer.draw(mapControl.getMapTransform(), mapContext.getLayerModel(), this.getProgressMonitor()); LOGGER.info(I18N.tr("Rendering done in {0} seconds", (System.currentTimeMillis() - beginDrawing) / 1000.0)); } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(), ex); } finally { if(!isCancelled()) { mapControl.getMapTransform().setImage(rendererImage); intermediateDrawing.set(false); awaitingDrawing.set(false); updateViewTime.stop(); mapControl.repaint(); } } return null; }

Target:
protected Object doInBackground() throws Exception { Timer updateViewTime = new Timer(DELAY_DRAWING, this); try { beginDrawing = System.currentTimeMillis(); renderer = new ImageRenderer(); renderer.setRsProvider(resultSetProviderFactory); updateViewTime.start(); rendererImage = mapControl.getMapTransform().getImage(); renderer.draw(mapControl.getMapTransform(), mapContext.getLayerModel(), this.getProgressMonitor()); LOGGER.info(I18N.tr("Rendering done in {0} seconds", (System.currentTimeMillis() - beginDrawing) / 1000.0)); } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(), ex); } finally { mapControl.getMapTransform().setImage(rendererImage); intermediateDrawing.set(false); awaitingDrawing.set(false); updateViewTime.stop(); mapControl.repaint(); } return null; }
Source:
public static PhantomJSDriverService createDefaultService(Capabilities desiredCapabilities) { Proxy proxy = null; if (desiredCapabilities != null) { proxy = (Proxy) desiredCapabilities.getCapability(CapabilityType.PROXY); } File phantomjsfile = findPhantomJS(desiredCapabilities, PHANTOMJS_DOC_LINK, PHANTOMJS_DOWNLOAD_LINK); File ghostDriverfile = findGhostDriver(desiredCapabilities, GHOSTDRIVER_DOC_LINK, GHOSTDRIVER_DOWNLOAD_LINK); return new Builder().usingPhantomJSExecutable(phantomjsfile) .usingGhostDriver(ghostDriverfile) .usingAnyFreePort() .withProxy(proxy) .usingCommandLineArguments(findCommandLineArguments(desiredCapabilities)) .build(); }

Target:
public static PhantomJSDriverService createDefaultService(Capabilities desiredCapabilities) { Proxy proxy = null; if (desiredCapabilities != null) { proxy = (Proxy) desiredCapabilities.getCapability(CapabilityType.PROXY); } File phantomjsfile = findPhantomJS(desiredCapabilities, PHANTOMJS_DOC_LINK, PHANTOMJS_DOWNLOAD_LINK); File ghostDriverfile = findGhostDriver(desiredCapabilities, GHOSTDRIVER_DOC_LINK, GHOSTDRIVER_DOWNLOAD_LINK); String[] commandLineArguments = findCommandLineArguments(desiredCapabilities); return new Builder().usingPhantomJSExecutable(phantomjsfile) .usingGhostDriver(ghostDriverfile) .usingAnyFreePort() .withProxy(proxy) .usingCommandLineArguments(commandLineArguments) .build(); }
Source:
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) { BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset); Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue()); if(bgReading != null) { bgReading.calculated_value = egvRecord.getBGValue(); if (egvRecord.getBGValue() <= 13) { Calibration calibration = bgReading.calibration; double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp)/(1000 * 60 * 10))); double calSlope = (calibration.first_scale / firstAdjSlope)*1000; double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope)*-1; bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5); } Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value); AtomicBoolean hide = new AtomicBoolean(); bgReading.calculated_value_slope = bgReading.slopefromName(egvRecord.getTrend().friendlyTrendName(), hide); bgReading.noise = egvRecord.noiseValue(); bgReading.hide_slope = hide.get(); bgReading.save(); bgReading.find_new_curve(); bgReading.find_new_raw_curve(); context.startService(new Intent(context, Notifications.class)); BgSendQueue.handleNewBgReading(bgReading, "create", context); } }

Target:
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) { BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset); Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue()); if(bgReading != null) { bgReading.calculated_value = egvRecord.getBGValue(); if (egvRecord.getBGValue() <= 13) { Calibration calibration = bgReading.calibration; double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp)/(1000 * 60 * 10))); double calSlope = (calibration.first_scale / firstAdjSlope)*1000; double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope)*-1; bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5); } Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value); Pair<Double, Boolean> slopePair = BgReading.slopefromName(egvRecord.getTrend().friendlyTrendName()); bgReading.calculated_value_slope = slopePair.first; bgReading.hide_slope = slopePair.second; bgReading.noise = egvRecord.noiseValue(); bgReading.save(); bgReading.find_new_curve(); bgReading.find_new_raw_curve(); context.startService(new Intent(context, Notifications.class)); BgSendQueue.handleNewBgReading(bgReading, "create", context); } }
Source:
public void aggregate() { long time = timeSelector.getLong(); if (time >= lastTime) { lastTime = time; Object value = valueSelector.getObject(); if (value instanceof String) { lastValue = (String) value; } else if (value instanceof SerializablePairLongString) { lastValue = ((SerializablePairLongString) value).rhs; } else if (value != null) { throw new IllegalStateException( "Try to aggregate unsuported class type [" + value.getClass().getName() + "]. Supported class types: String or SerializablePairLongString" ); } if (lastValue != null && lastValue.length() > maxStringBytes) { lastValue = lastValue.substring(0, maxStringBytes); } } }

Target:
public void aggregate() { long time = timeSelector.getLong(); if (time >= lastTime) { lastTime = time; Object value = valueSelector.getObject(); if (value != null) { if (value instanceof String) { lastValue = (String) value; } else if (value instanceof SerializablePairLongString) { lastValue = ((SerializablePairLongString) value).rhs; } else { throw new ISE( "Try to aggregate unsuported class type [%s].Supported class types: String or SerializablePairLongString", value.getClass().getCanonicalName() ); } if (lastValue != null && lastValue.length() > maxStringBytes) { lastValue = lastValue.substring(0, maxStringBytes); } } else { lastValue = null; } } }
Source:
public List<CourseDetailsBundle> extractArchivedCourses(List<CourseDetailsBundle> courseBundles, String googleId) { CourseDetailsBundle.sortDetailedCoursesByCourseId(courseBundles); List<CourseDetailsBundle> result = new ArrayList<CourseDetailsBundle>(); for (CourseDetailsBundle courseBundle : courseBundles) { if (isCourseArchived(courseBundle.course.id, googleId)) { result.add(courseBundle); } } return result; }

Target:
public List<CourseDetailsBundle> extractArchivedCourses(List<CourseDetailsBundle> courseBundles, String googleId) { List<CourseDetailsBundle> result = new ArrayList<CourseDetailsBundle>(); for (CourseDetailsBundle courseBundle : courseBundles) { if (isCourseArchived(courseBundle.course.id, googleId)) { result.add(courseBundle); } } return result; }
Source:
public XmlValidatorManager(Props props) { String validatorDirPath = props.getString(VALIDATOR_PLUGIN_DIR, DEFAULT_VALIDATOR_DIR); File validatorDir = new File(validatorDirPath); if (!validatorDir.canRead() || !validatorDir.isDirectory()) { throw new ValidatorManagerException("Validator directory " + validatorDirPath + " does not exist or is not a direcotry."); } List<URL> resources = new ArrayList<URL>(); try { logger.info("Adding validator resources."); for (File f : validatorDir.listFiles()) { if (f.getName().endsWith(".jar")) { resources.add(f.toURI().toURL()); logger.debug("adding to classpath " + f.toURI().toURL()); } } } catch (MalformedURLException e) { throw new ValidatorManagerException(e); } validatorLoader = new URLClassLoader(resources.toArray(new URL[resources.size()])); try { loadValidators(props, logger); } catch (Exception e) { logger.error("Cannot load all the validaotors."); throw new ValidatorManagerException(e); } }

Target:
public XmlValidatorManager(Props props) { String validatorDirPath = props.getString(VALIDATOR_PLUGIN_DIR, DEFAULT_VALIDATOR_DIR); File validatorDir = new File(validatorDirPath); if (!validatorDir.canRead() || !validatorDir.isDirectory()) { throw new ValidatorManagerException("Validator directory " + validatorDirPath + " does not exist or is not a directory."); } List<URL> resources = new ArrayList<URL>(); try { logger.info("Adding validator resources."); for (File f : validatorDir.listFiles()) { if (f.getName().endsWith(".jar")) { resources.add(f.toURI().toURL()); logger.debug("adding to classpath " + f.toURI().toURL()); } } } catch (MalformedURLException e) { throw new ValidatorManagerException(e); } validatorLoader = new URLClassLoader(resources.toArray(new URL[resources.size()])); try { loadValidators(props, logger); } catch (Exception e) { logger.error("Cannot load all the validators."); throw new ValidatorManagerException(e); } }
Source:
private void convertRequireForAlreadyConverted(ModuleImport moduleImport) { String originalPath = moduleImport.requiredNamespace.replace(alreadyConvertedPrefix + ".", "").replace(".", "/"); String referencedFile = pathUtil.getImportPath(moduleImport.originalImportNode.getSourceFileName(), originalPath); Node importSpec = IR.empty(); Node requireLHS = moduleImport.originalImportNode.getFirstChild(); if (moduleImport.isDestructuringImport) { importSpec = new Node(Token.IMPORT_SPECS); for (String fullLocalName : moduleImport.fullLocalNames) { importSpec.addChildToBack(IR.name(fullLocalName)); } } else if (requireLHS != null && requireLHS.isName()) { importSpec = Node.newString(Token.IMPORT_STAR, moduleImport.fullLocalNames.get(0)); } Node importNode = new Node(Token.IMPORT, IR.empty(), importSpec, Node.newString(referencedFile)); nodeComments.replaceWithComment(moduleImport.originalImportNode, importNode); compiler.reportChangeToEnclosingScope(importNode); }

Target:
private void convertRequireForAlreadyConverted(ModuleImport moduleImport) { String originalPath = moduleImport.requiredNamespace.replace(alreadyConvertedPrefix + ".", "").replace(".", "/"); String referencedFile = pathUtil.getImportPath(moduleImport.originalImportNode.getSourceFileName(), originalPath); Node importSpec = IR.empty(); if (moduleImport.isDestructuringImport) { importSpec = new Node(Token.IMPORT_SPECS); for (String fullLocalName : moduleImport.fullLocalNames) { importSpec.addChildToBack(IR.name(fullLocalName)); } } else if (moduleImport.isFullModuleImport()) { importSpec = Node.newString(Token.IMPORT_STAR, moduleImport.fullLocalNames.get(0)); } Node importNode = new Node(Token.IMPORT, IR.empty(), importSpec, Node.newString(referencedFile)); nodeComments.replaceWithComment(moduleImport.originalImportNode, importNode); compiler.reportChangeToEnclosingScope(importNode); }
Source:
protected Op checkTableIds(final TableId...expectedTables) { return new Op() { @Override public void execute() { List<TableId> expectedTableIds = new ArrayList<>(); for (TableId expectedTable: expectedTables) { expectedTableIds.add(expectedTable); } assertEquals(expectedTableIds, tableMonitorThread.tables()); } }; }

Target:
protected void checkTableIds(final TableId...expectedTables) { assertEquals(Arrays.asList(expectedTables), tableMonitorThread.tables()); }
Source:
public Tracker build(){ if (trackerClass == null) { throw new IllegalStateException("No tracker class found or defined"); } try { Constructor<? extends Tracker> c = trackerClass.getDeclaredConstructor(TrackerBuilder.class); return c.newInstance(this); } catch (NoSuchMethodException e) { throw new IllegalStateException("Can’t create tracker", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Can’t create tracker", e); } catch (InstantiationException e) { throw new IllegalStateException("Can’t create tracker", e); } catch (IllegalAccessException e) { throw new IllegalStateException("Can’t create tracker", e); } }

Target:
public Tracker build(){ if (trackerClass == null) { throw new IllegalStateException("No tracker class found or defined"); } String err = "Can’t create tracker"; try { Constructor<? extends Tracker> c = trackerClass.getDeclaredConstructor(TrackerBuilder.class); return c.newInstance(this); } catch (NoSuchMethodException e) { throw new IllegalStateException(err, e); } catch (InvocationTargetException e) { throw new IllegalStateException(err, e); } catch (InstantiationException e) { throw new IllegalStateException(err, e); } catch (IllegalAccessException e) { throw new IllegalStateException(err, e); } }
Source:
public HttpContent readChunk(ChannelHandlerContext ctx) { long chunkDispenseStartTime = System.currentTimeMillis(); logger.trace("Servicing request for next chunk on channel {}", ctx.channel()); HttpContent content = null; Chunk chunk = chunksToWrite.poll(); if (chunk != null) { chunk.onDequeue(); ByteBuf buf = Unpooled.wrappedBuffer(chunk.buffer); chunksAwaitingCallback.add(chunk); if (contentLength != -1 && chunk.writeCompleteThreshold >= contentLength) { content = new DefaultLastHttpContent(buf); sentLastChunk = true; } else { content = new DefaultHttpContent(buf); } } else if (allChunksWritten() && !sentLastChunk) { sentLastChunk = true; content = LastHttpContent.EMPTY_LAST_CONTENT; logger.trace("Last chunk was sent on channel {}", ctx.channel()); } nettyMetrics.chunkDispenseTimeInMs.update(System.currentTimeMillis() - chunkDispenseStartTime); return content; }

Target:
public HttpContent readChunk(ChannelHandlerContext ctx) { long chunkDispenseStartTime = System.currentTimeMillis(); logger.trace("Servicing request for next chunk on channel {}", ctx.channel()); HttpContent content = null; Chunk chunk = chunksToWrite.poll(); if (chunk != null) { chunk.onDequeue(); ByteBuf buf = Unpooled.wrappedBuffer(chunk.buffer); chunksAwaitingCallback.add(chunk); if (chunk.isLast) { content = new DefaultLastHttpContent(buf); sentLastChunk = true; } else { content = new DefaultHttpContent(buf); } } else if (allChunksWritten() && !sentLastChunk) { sentLastChunk = true; content = LastHttpContent.EMPTY_LAST_CONTENT; logger.trace("Last chunk was sent on channel {}", ctx.channel()); } nettyMetrics.chunkDispenseTimeInMs.update(System.currentTimeMillis() - chunkDispenseStartTime); return content; }
Source:
public ChooseDeviceDialogFixture runApp(@NotNull String appName) throws ClassNotFoundException { runApplication("Run", appName); return ChooseDeviceDialogFixture.find(this, robot, AndroidBundle.message("choose.device.dialog.title")); }

Target:
public void runApp(@NotNull String appName) throws ClassNotFoundException { runApplication("Run", appName); }
Source:
public void testRefreshInterval() throws Exception { H2DaoProvider daoProvider = setup("selectors"); H2ResourceGroupsDao dao = daoProvider.get(); dao.createResourceGroupsTable(); dao.createSelectorsTable(); dao.insertResourceGroup(1, "global", "100%", 100, 100, 100, null, null, null, null, null, null, null, null, ENVIRONMENT); DbResourceGroupConfigurationManager manager = new DbResourceGroupConfigurationManager( (poolId, listener) -> {}, new DbResourceGroupConfig().setMaxRefreshInterval(Duration.valueOf("1ms")), daoProvider.get(), ENVIRONMENT); manager.start(); Thread.sleep(1000); dao.dropSelectorsTable(); Thread.sleep(2000); try { manager.getSelectors(); fail("Expected unavailable configuration exception"); } catch (Exception e) { assertEquals(e.getMessage(), "Selectors could not be fetched from database"); } try { manager.getRootGroups(); fail("Expected unavailable configuration exception"); } catch (Exception e) { assertEquals(e.getMessage(), "Root groups could not be fetched from database"); } manager.destroy(); }

Target:
public void testRefreshInterval() { H2DaoProvider daoProvider = setup("selectors"); H2ResourceGroupsDao dao = daoProvider.get(); dao.createResourceGroupsTable(); dao.createSelectorsTable(); dao.insertResourceGroup(1, "global", "100%", 100, 100, 100, null, null, null, null, null, null, null, null, ENVIRONMENT); DbResourceGroupConfigurationManager manager = new DbResourceGroupConfigurationManager( (poolId, listener) -> {}, new DbResourceGroupConfig().setMaxRefreshInterval(Duration.valueOf("1ms")), daoProvider.get(), ENVIRONMENT); dao.dropSelectorsTable(); manager.load(); try { manager.getSelectors(); fail("Expected unavailable configuration exception"); } catch (Exception e) { assertEquals(e.getMessage(), "Selectors cannot be fetched from database"); } try { manager.getRootGroups(); fail("Expected unavailable configuration exception"); } catch (Exception e) { assertEquals(e.getMessage(), "Root groups cannot be fetched from database"); } manager.destroy(); }
Source:
private boolean obtainLock() { boolean success = RedisLockRegistry.this.redisTemplate.execute(RedisLockRegistry.this.obtainLockScript, Collections.<Object>singletonList(constructLockKey()), RedisLockRegistry.this.clientId, String.valueOf(RedisLockRegistry.this.expireAfter)); if (success) { this.lockedAt = System.currentTimeMillis(); } return success; }

Target:
private boolean obtainLock() { boolean success = RedisLockRegistry.this.redisTemplate.execute(RedisLockRegistry.this.obtainLockScript, Collections.singletonList(this.lockKey), RedisLockRegistry.this.clientId, String.valueOf(RedisLockRegistry.this.expireAfter)); if (success) { this.lockedAt = System.currentTimeMillis(); } return success; }
Source:
private void init() { try { if (hasPropertyAndNotNull("manual_output")) { manualOutput = Boolean.valueOf(getProperty("manual_output")); } if (hasPropertyAndNotNull("greeting")) { greeting = getProperty("greeting"); } catPath = getProperty("cat"); echoPath = getProperty("echo"); } catch (Exception e) { e.printStackTrace(); System.exit(1); } }

Target:
private void init() { try { if (hasPropertyAndNotNull("manual_output")) { manualOutput = Boolean.valueOf(getProperty("manual_output")); } if (hasPropertyAndNotNull("greeting")) { greeting = getProperty("greeting"); } catPath = getProperty("cat"); echoPath = getProperty("echo"); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }
Source:
public void invalidateAllWords() { lintManager_.relintAfterDelay(-1); }

Target:
public void invalidateAllWords() { lintManager_.relintAfterDelay(LintManager.DEFAULT_LINT_DELAY); }
Source:
public static void prepareAggregations( List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { Preconditions.checkNotNull(aggFactories, "aggregations cannot be null"); final Map<String, AggregatorFactory> aggsFactoryMap = Maps.newHashMap(); for (AggregatorFactory aggFactory : aggFactories) { Preconditions.checkArgument(!aggsFactoryMap.containsKey(aggFactory.getName()), "[%s] already defined", aggFactory.getName()); aggsFactoryMap.put(aggFactory.getName(), aggFactory); } if (postAggs != null && !postAggs.isEmpty()) { final Set<String> combinedAggNames = Sets.newHashSet(aggsFactoryMap.keySet()); for (final PostAggregator postAgg : postAggs) { final Set<String> dependencies = postAgg.getDependentFields(); final Set<String> missing = Sets.difference(dependencies, combinedAggNames); Preconditions.checkArgument( missing.isEmpty(), "Missing fields [%s] for postAggregator [%s]", missing, postAgg.getName() ); Preconditions.checkArgument(combinedAggNames.add(postAgg.getName()), "[%s] already defined", postAgg.getName()); if (postAgg instanceof HasDependentAggFactories) { HasDependentAggFactories richPostAgg = (HasDependentAggFactories)postAgg; richPostAgg.setDependentAggFactories(Maps.filterKeys(aggsFactoryMap, new Predicate<String>() { @Override public boolean apply(@Nullable String input) { return postAgg.getDependentFields().contains(input); } })); } } } }

Target:
public static List<PostAggregator> prepareAggregations( List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { Preconditions.checkNotNull(aggFactories, "aggregations cannot be null"); final Map<String, AggregatorFactory> aggsFactoryMap = Maps.newHashMap(); for (AggregatorFactory aggFactory : aggFactories) { Preconditions.checkArgument(!aggsFactoryMap.containsKey(aggFactory.getName()), "[%s] already defined", aggFactory.getName()); aggsFactoryMap.put(aggFactory.getName(), aggFactory); } if (postAggs != null && !postAggs.isEmpty()) { final Set<String> combinedAggNames = Sets.newHashSet(aggsFactoryMap.keySet()); List<PostAggregator> decorated = Lists.newArrayListWithExpectedSize(postAggs.size()); for (final PostAggregator postAgg : postAggs) { final Set<String> dependencies = postAgg.getDependentFields(); final Set<String> missing = Sets.difference(dependencies, combinedAggNames); Preconditions.checkArgument( missing.isEmpty(), "Missing fields [%s] for postAggregator [%s]", missing, postAgg.getName() ); Preconditions.checkArgument(combinedAggNames.add(postAgg.getName()), "[%s] already defined", postAgg.getName()); decorated.add(postAgg.decorate(aggsFactoryMap)); } return decorated; } return postAggs; }
Source:
public GroupRest getItemReadGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } List<Group> itemGroups = authorizeService .getAuthorizedGroups(context, collection, Constants.DEFAULT_ITEM_READ); if (itemGroups == null || itemGroups.isEmpty()) { return null; } Group itemReadGroup = itemGroups.get(0); if (!authorizeService.isAdmin(context) && !authorizeService.authorizeActionBoolean(context, collection, Constants.ADMIN, true)) { throw new AccessDeniedException("The current user was not allowed to retrieve the itemReadGroup for" + " collection: " + collectionId); } if (itemReadGroup == null) { return null; } return converter.toRest(itemReadGroup, projection); } catch (SQLException e) { throw new RuntimeException(e); } }

Target:
public GroupRest getItemReadGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } try { AuthorizeUtil.authorizeManageDefaultReadGroup(context, collection); } catch (AuthorizeException e) { throw new AccessDeniedException("The current user was not allowed to retrieve the itemReadGroup for" + " collection: " + collectionId); } List<Group> itemGroups = authorizeService .getAuthorizedGroups(context, collection, Constants.DEFAULT_ITEM_READ); if (itemGroups == null || itemGroups.isEmpty()) { return null; } Group itemReadGroup = itemGroups.get(0); if (itemReadGroup == null) { return null; } return converter.toRest(itemReadGroup, projection); } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
public void onSuccess(T t) { ObservableSource<? extends R> p; try { p = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null Publisher"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); downstream.onError(ex); return; } p.subscribe(this); }

Target:
public void onSuccess(T t) { ObservableSource<? extends R> o; try { o = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null Publisher"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); downstream.onError(ex); return; } o.subscribe(this); }
Source:
private void buildTryStatement(TryStatementTree tryStatementTree) { currentBlock = createBlock(currentBlock); BlockTree finallyBlockTree = tryStatementTree.finallyBlock(); if (finallyBlockTree != null) { build(finallyBlockTree); } Block finallyOrEndBlock = currentBlock; Block beforeFinally = createBlock(currentBlock); List<Block> catches = new ArrayList<>(); for (CatchTree catchTree : tryStatementTree.catches()) { currentBlock = createBlock(finallyOrEndBlock); build(catchTree.block()); catches.add(currentBlock); } currentBlock = beforeFinally; build(tryStatementTree.block()); for (Block catchBlocks : catches) { currentBlock.addSuccessor(catchBlocks); } build((List<? extends Tree>) tryStatementTree.resources()); currentBlock = createBlock(currentBlock); currentBlock.elements.add(tryStatementTree); }

Target:
private void buildTryStatement(TryStatementTree tryStatementTree) { currentBlock = createBlock(currentBlock); BlockTree finallyBlockTree = tryStatementTree.finallyBlock(); if (finallyBlockTree != null) { build(finallyBlockTree); } Block finallyOrEndBlock = currentBlock; Block beforeFinally = createBlock(currentBlock); List<Block> catches = new ArrayList<>(); for (CatchTree catchTree : tryStatementTree.catches()) { currentBlock = createBlock(finallyOrEndBlock); build(catchTree.block()); catches.add(currentBlock); } currentBlock = beforeFinally; build(tryStatementTree.block()); for (Block catchBlock : catches) { currentBlock.addSuccessor(catchBlock); } build((List<? extends Tree>) tryStatementTree.resources()); currentBlock = createBlock(currentBlock); currentBlock.elements.add(tryStatementTree); }
Source:
public boolean addPersistableNetworkPayload(PersistableNetworkPayload payload, @Nullable NodeAddress sender, boolean isDataOwner, boolean allowBroadcast, boolean reBroadcast, boolean checkDate) { log.trace("addPersistableNetworkPayload payload={}", payload); if (!payload.verifyHashSize()) { log.warn("We got a hash exceeding our permitted size"); return false; } ByteArray hashAsByteArray = new ByteArray(payload.getHash()); boolean payloadHashAlreadyInStore = getAppendOnlyDataStoreMap().containsKey(hashAsByteArray); if (payloadHashAlreadyInStore && !reBroadcast) { log.trace("We have that payload already in our map."); return false; } if (checkDate && payload instanceof DateTolerantPayload && !((DateTolerantPayload) payload).isDateInTolerance((clock))) { log.warn("Publish date of payload is not matching our current time and outside of our tolerance.\n" + "Payload={}; now={}", payload.toString(), new Date()); return false; } if (!payloadHashAlreadyInStore) { appendOnlyDataStoreService.put(hashAsByteArray, payload); appendOnlyDataStoreListeners.forEach(e -> e.onAdded(payload)); } if (allowBroadcast) broadcaster.broadcast(new AddPersistableNetworkPayloadMessage(payload), sender, null, isDataOwner); return true; }

Target:
public boolean addPersistableNetworkPayload(PersistableNetworkPayload payload, @Nullable NodeAddress sender, boolean isDataOwner, boolean allowBroadcast, boolean reBroadcast, boolean checkDate) { log.trace("addPersistableNetworkPayload payload={}", payload); if (!payload.verifyHashSize()) { log.warn("addPersistableNetworkPayload failed due to unexpected hash size"); return false; } ByteArray hashAsByteArray = new ByteArray(payload.getHash()); boolean payloadHashAlreadyInStore = getAppendOnlyDataStoreMap().containsKey(hashAsByteArray); if (payloadHashAlreadyInStore && !reBroadcast) { log.trace("addPersistableNetworkPayload failed due to duplicate payload"); return false; } if (checkDate && payload instanceof DateTolerantPayload && !((DateTolerantPayload) payload).isDateInTolerance((clock))) { log.warn("addPersistableNetworkPayload failed due to payload time outside tolerance.\n" + "Payload={}; now={}", payload.toString(), new Date()); return false; } if (!payloadHashAlreadyInStore) { appendOnlyDataStoreService.put(hashAsByteArray, payload); appendOnlyDataStoreListeners.forEach(e -> e.onAdded(payload)); } if (allowBroadcast) broadcaster.broadcast(new AddPersistableNetworkPayloadMessage(payload), sender, null, isDataOwner); return true; }
Source:
public long totalEventsInPartition(final Timeline timeline, final String partitionString) { final Timeline.StoragePosition positions = timeline.getLatestPosition(); if (positions == null) { throw new InvalidCursorOperation(InvalidCursorOperation.Reason.PARTITION_NOT_FOUND); } final int partition = Integer.valueOf(partitionString); final Timeline.KafkaStoragePosition kafkaPositions = (Timeline.KafkaStoragePosition) positions; final List<Long> offsets = kafkaPositions.getOffsets(); if (offsets.size() - 1 < partition) { throw new InvalidCursorOperation(InvalidCursorOperation.Reason.PARTITION_NOT_FOUND); } else { return offsets.get(partition); } }

Target:
public long totalEventsInPartition(final Timeline timeline, final String partitionString) throws InvalidCursorOperation { try { final Timeline.StoragePosition positions = timeline.getLatestPosition(); if (positions == null) { final Optional<PartitionStatistics> statsO = loadPartitionStatistics(timeline, partitionString); return statsO.map(stats -> numberOfEventsBeforeCursor(stats.getLast()) + 1).orElseThrow( MyNakadiRuntimeException1::new ); } final int partition = KafkaCursor.toKafkaPartition(partitionString); final Timeline.KafkaStoragePosition kafkaPositions = (Timeline.KafkaStoragePosition) positions; final List<Long> offsets = kafkaPositions.getOffsets(); if (offsets.size() - 1 < partition) { throw new InvalidCursorOperation(InvalidCursorOperation.Reason.PARTITION_NOT_FOUND); } else { return offsets.get(partition) + 1; } } catch (final ServiceUnavailableException e) { throw new MyNakadiRuntimeException1("Problem calculating partition statistics", e); } }
Source:
private InternalDriver createDriver( URI uri, SecurityPlan securityPlan, BoltServerAddress address, ConnectionPool connectionPool, EventExecutorGroup eventExecutorGroup, RoutingSettings routingSettings, RetryLogic retryLogic, MetricsProvider metricsProvider, Config config ) { try { String scheme = uri.getScheme().toLowerCase(); if ( isRoutingScheme( scheme ) ) { return createRoutingDriver( securityPlan, address, connectionPool, eventExecutorGroup, routingSettings, retryLogic, metricsProvider, config ); } else if ( !isRoutingScheme( scheme ) ) { assertNoRoutingContext( uri, routingSettings ); return createDirectDriver( securityPlan, address, connectionPool, retryLogic, metricsProvider, config ); } throw new ClientException( format( "Unsupported URI scheme: %s", scheme ) ); } catch ( Throwable driverError ) { closeConnectionPoolAndSuppressError( connectionPool, driverError ); throw driverError; } }

Target:
private InternalDriver createDriver( URI uri, SecurityPlan securityPlan, BoltServerAddress address, ConnectionPool connectionPool, EventExecutorGroup eventExecutorGroup, RoutingSettings routingSettings, RetryLogic retryLogic, MetricsProvider metricsProvider, Config config ) { try { String scheme = uri.getScheme().toLowerCase(); if ( isRoutingScheme( scheme ) ) { return createRoutingDriver( securityPlan, address, connectionPool, eventExecutorGroup, routingSettings, retryLogic, metricsProvider, config ); } else { assertNoRoutingContext( uri, routingSettings ); return createDirectDriver( securityPlan, address, connectionPool, retryLogic, metricsProvider, config ); } } catch ( Throwable driverError ) { closeConnectionPoolAndSuppressError( connectionPool, driverError ); throw driverError; } }
Source:
public Schema getOutputSchema(GetSchemaRequest request) { try { return getOutputSchema(request.inputSchemas); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage()); } }

Target:
public Schema getOutputSchema(GetSchemaRequest request) { try { return getOutputSchema(request.inputSchemas); } catch (IllegalArgumentException e) { if (!duplicateFields.isEmpty()) { throw new BadRequestException(GSON.toJson(duplicateFields.asMap())); } else { throw new BadRequestException(e.getMessage()); } } }
Source:
public boolean routeVendorEdit(PaymentWorksVendor paymentWorksVendor) { boolean isRouted = false; PaymentWorksVendorUpdateConversionUtil paymentWorksVendorUpdateConversionUtil = new PaymentWorksVendorUpdateConversionUtil(); String vendorNumberList = paymentWorksVendor.getVendorNumberList(); List<String> vendorNumbers = Arrays.asList(vendorNumberList.split("\\s*,\\s*")); StringBuffer documentNumbers = new StringBuffer(""); for (String vendorNumber : vendorNumbers) { VendorDetail oldVendor = vendorService.getVendorDetail(vendorNumber); VendorDetail newVendor = (VendorDetail) ObjectUtils.deepCopy(oldVendor); if (!paymentWorksVendorUpdateConversionUtil.duplicateFieldsOnVendor(newVendor, paymentWorksVendor)) { isRouted = processNonDuplicateVendorDetail(paymentWorksVendor, documentNumbers, oldVendor, newVendor); } else { GlobalVariables.getMessageMap().putError("vendorDetail", KFSKeyConstants.ERROR_CUSTOM, "Duplicate vendor update detected"); isRouted = false; } } if (documentNumbers.length() > 0) { paymentWorksVendor.setDocumentNumberList(documentNumbers.toString().substring(0, documentNumbers.length() - 1)); } return isRouted; }

Target:
public boolean routeVendorEdit(PaymentWorksVendor paymentWorksVendor) { boolean routed = false; PaymentWorksVendorUpdateConversionUtil paymentWorksVendorUpdateConversionUtil = new PaymentWorksVendorUpdateConversionUtil(); String vendorNumberList = paymentWorksVendor.getVendorNumberList(); List<String> vendorNumbers = Arrays.asList(vendorNumberList.split("\\s*,\\s*")); StringBuffer documentNumbers = new StringBuffer(""); for (String vendorNumber : vendorNumbers) { VendorDetail oldVendor = vendorService.getVendorDetail(vendorNumber); VendorDetail newVendor = (VendorDetail) ObjectUtils.deepCopy(oldVendor); if (!paymentWorksVendorUpdateConversionUtil.duplicateFieldsOnVendor(newVendor, paymentWorksVendor)) { routed = processNonDuplicateVendorDetail(paymentWorksVendor, documentNumbers, oldVendor, newVendor); } else { GlobalVariables.getMessageMap().putError("vendorDetail", KFSKeyConstants.ERROR_CUSTOM, "Duplicate vendor update detected"); routed = false; } } if (documentNumbers.length() > 0) { paymentWorksVendor.setDocumentNumberList(documentNumbers.toString().substring(0, documentNumbers.length() - 1)); } return routed; }
Source:
private JSONObject gatherBuildMetadata(final Run run, @Nonnull final TaskListener listener) { EnvVars envVars = null; try { envVars = run.getEnvironment(listener); } catch (IOException e) { logger.severe(e.getMessage()); } catch (InterruptedException e) { logger.severe(e.getMessage()); } long starttime = run.getStartTimeInMillis() / DatadogBuildListener.THOUSAND_LONG; double duration = run.getDuration() / DatadogBuildListener.THOUSAND_DOUBLE; long endtime = starttime + (long) duration; JSONObject builddata = new JSONObject(); builddata.put("starttime", starttime); builddata.put("duration", duration); builddata.put("timestamp", endtime); builddata.put("result", run.getResult().toString()); builddata.put("number", run.number); builddata.put("job", run.getParent().getDisplayName()); builddata.put("hostname", getHostname(envVars)); builddata.put("buildurl", envVars.get("BUILD_URL")); builddata.put("node", envVars.get("NODE_NAME")); if ( envVars.get("GIT_BRANCH") != null ) { builddata.put("branch", envVars.get("GIT_BRANCH")); } else if ( envVars.get("CVS_BRANCH") != null ) { builddata.put("branch", envVars.get("CVS_BRANCH")); } return builddata; }

Target:
private JSONObject gatherBuildMetadata(final Run run, @Nonnull final TaskListener listener) { EnvVars envVars = null; try { envVars = run.getEnvironment(listener); } catch (IOException e) { logger.severe(e.getMessage()); } catch (InterruptedException e) { logger.severe(e.getMessage()); } long starttime = run.getStartTimeInMillis() / DatadogBuildListener.THOUSAND_LONG; double duration = run.getDuration() / DatadogBuildListener.THOUSAND_DOUBLE; long endtime = starttime + (long) duration; JSONObject builddata = new JSONObject(); builddata.put("starttime", starttime); builddata.put("duration", duration); builddata.put("timestamp", endtime); builddata.put("result", run.getResult().toString()); builddata.put("number", run.number); builddata.put("job", run.getParent().getDisplayName()); builddata.put("hostname", DatadogUtilities.getHostname(envVars)); builddata.put("buildurl", envVars.get("BUILD_URL")); builddata.put("node", envVars.get("NODE_NAME")); if ( envVars.get("GIT_BRANCH") != null ) { builddata.put("branch", envVars.get("GIT_BRANCH")); } else if ( envVars.get("CVS_BRANCH") != null ) { builddata.put("branch", envVars.get("CVS_BRANCH")); } return builddata; }
Source:
public void testNotAllInputsReferenced() throws Exception { tester().assertThat(new PruneAggregationSourceColumns()) .on(p -> buildAggregation(p, Predicates.alwaysTrue())) .matches( aggregation( ImmutableList.of(ImmutableList.of("key")), ImmutableMap.of( Optional.of("avg"), functionCall("avg", ImmutableList.of("input"))), ImmutableMap.of(), Optional.empty(), SINGLE, strictProject( ImmutableMap.of( "input", expression("input"), "key", expression("key"), "keyHash", expression("keyHash"), "mask", expression("mask")), values("input", "key", "keyHash", "mask", "unused")))); }

Target:
public void testNotAllInputsReferenced() throws Exception { tester().assertThat(new PruneAggregationSourceColumns()) .on(p -> buildAggregation(p, alwaysTrue())) .matches( aggregation( ImmutableList.of(ImmutableList.of("key")), ImmutableMap.of( Optional.of("avg"), functionCall("avg", ImmutableList.of("input"))), ImmutableMap.of(), Optional.empty(), SINGLE, strictProject( ImmutableMap.of( "input", expression("input"), "key", expression("key"), "keyHash", expression("keyHash"), "mask", expression("mask")), values("input", "key", "keyHash", "mask", "unused")))); }