auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) { String path = restRequest.getPath(); int offset = 0; String prefixFound = ""; if (prefixesToRemove != null) { for (String prefix : prefixesToRemove) { int nextSegmentOffset = matchPathSegments(path, offset, prefix, false); if (nextSegmentOffset >= 0) { prefixFound = prefix; offset = nextSegmentOffset; break; } } } String clusterNameFound = ""; if (clusterName != null) { int nextSegmentOffset = matchPathSegments(path, offset, clusterName, true); if (nextSegmentOffset >= 0) { clusterNameFound = clusterName; offset = nextSegmentOffset; } } RestUtils.SubResource subResource = null; int lastSlashOffset = path.lastIndexOf('/'); if (lastSlashOffset > offset) { try { subResource = RestUtils.SubResource.valueOf(path.substring(lastSlashOffset + 1)); } catch (IllegalArgumentException e) { } } String operationOrBlobId = path.substring(offset, subResource == null ? path.length() : lastSlashOffset); if ((operationOrBlobId.isEmpty() || operationOrBlobId.equals("/")) && restRequest.getArgs() .containsKey(RestUtils.Headers.BLOB_ID)) { operationOrBlobId = restRequest.getArgs().get(RestUtils.Headers.BLOB_ID).toString(); } return new RequestPath(prefixFound, clusterNameFound, operationOrBlobId, subResource); }

Target:
public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) { return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); }
Source:
public TaskDefinition save(TaskDefinition taskDefinition) { taskServiceWrapper.saveTaskDefinition(taskDefinition); return Context.getSchedulerService().getTaskByName(taskDefinition.getName()); }

Target:
public TaskDefinition save(TaskDefinition taskDefinition) { taskServiceWrapper.saveTaskDefinition(taskDefinition); return taskDefinition; }
Source:
public void testValidateStatOutput() throws Exception { ZooKeeper zk1 = createClient(); ZooKeeper zk2 = createClient(); String resp = sendRequest("stat"); BufferedReader in = new BufferedReader(new StringReader(resp)); String line; line = in.readLine(); Assert.assertTrue(Pattern.matches("^.*\\s\\d+\\.\\d+\\.\\d+-.*$", line)); Assert.assertTrue(Pattern.matches("^Clients:$", in.readLine())); int count = 0; while ((line = in.readLine()).length() > 0) { count++; Assert.assertTrue(Pattern.matches("^ /.*:\\d+\\[\\d+\\]\\(queued=\\d+,recved=\\d+,sent=\\d+\\)$", line)); } Assert.assertTrue(count >= 2); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Latency min/avg/max: \\d+/\\d+/\\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Received: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Sent: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Connections: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Outstanding: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Zxid: 0x[\\da-fA-F]+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Mode: .*$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Fsync threshold exceeded: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Node count: \\d+$", line)); zk1.close(); zk2.close(); }

Target:
public void testValidateStatOutput() throws Exception { ZooKeeper zk1 = createClient(); ZooKeeper zk2 = createClient(); String resp = sendRequest("stat"); BufferedReader in = new BufferedReader(new StringReader(resp)); String line; line = in.readLine(); Assert.assertTrue(Pattern.matches("^.*\\s\\d+\\.\\d+\\.\\d+-.*$", line)); Assert.assertTrue(Pattern.matches("^Clients:$", in.readLine())); int count = 0; while ((line = in.readLine()).length() > 0) { count++; Assert.assertTrue(Pattern.matches("^ /.*:\\d+\\[\\d+\\]\\(queued=\\d+,recved=\\d+,sent=\\d+\\)$", line)); } Assert.assertTrue(count >= 2); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Latency min/avg/max: \\d+/\\d+/\\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Received: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Sent: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Connections: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Outstanding: \\d+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Zxid: 0x[\\da-fA-F]+$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Mode: .*$", line)); line = in.readLine(); Assert.assertTrue(Pattern.matches("^Node count: \\d+$", line)); zk1.close(); zk2.close(); }
Source:
public Feature decodeLoc(LineIterator lineIterator) { return decodeShallow(lineIterator); }

Target:
public Feature decodeLoc(LineIterator lineIterator) throws IOException { return decode(lineIterator, DecodeDepth.SHALLOW); }
Source:
public BalancerSegmentHolder getRandomBalancerSegmentHolder(final List<ServerHolder> serverHolders) { Random rand = new Random(0); ServerHolder fromServerHolder = null; DataSegment proposalSegment = null; int numSoFar = 0; for (ServerHolder server : serverHolders) { for (DataSegment segment : server.getServer().getSegments().values()) { int randNum = rand.nextInt(numSoFar + 1); if (randNum == numSoFar) { fromServerHolder = server; proposalSegment = segment; } numSoFar++; } } return new BalancerSegmentHolder(fromServerHolder.getServer(), proposalSegment); }

Target:
public BalancerSegmentHolder getRandomBalancerSegmentHolder(final List<ServerHolder> serverHolders) { final Random rand = new Random(); ServerHolder fromServerHolder = null; DataSegment proposalSegment = null; int numSoFar = 0; for (ServerHolder server : serverHolders) { for (DataSegment segment : server.getServer().getSegments().values()) { int randNum = rand.nextInt(numSoFar + 1); if (randNum == numSoFar) { fromServerHolder = server; proposalSegment = segment; } numSoFar++; } } if (fromServerHolder != null) { return new BalancerSegmentHolder(fromServerHolder.getServer(), proposalSegment); } else { return null; } }
Source:
public IRegion getRegion(String path) { if (Strings.emptyToNull(path) == null) return null; if (path.startsWith(":")) { path = path.substring(1); } String[] paths = path.split(":"); Node current = getYaml(); Node start; int pPos = 0; boolean noPath = false; do { String currentPath = paths[pPos]; start = current; if (current.getNodeId() == NodeId.mapping) { MappingNode mn = (MappingNode) current; for (NodeTuple node : mn.getValue()) { Node keyNode = node.getKeyNode(); if (keyNode.getNodeId() == NodeId.scalar) { ScalarNode scalar = (ScalarNode) keyNode; if (Objects.equals(currentPath, scalar.getValue())) { pPos++; current = node.getValueNode(); break; } } } } else if (current.getNodeId() == NodeId.sequence) { SequenceNode sq = (SequenceNode) current; if (!currentPath.startsWith("@")) { throw new IllegalStateException("Should be a sequence"); } Integer seqPos = Integer.valueOf(currentPath.substring(1)); pPos++; current = sq.getValue().get(seqPos); } if (start == current) { noPath = true; current = null; } } while (pPos < paths.length && !noPath); if (current == null) return null; try { int offset = getLineOffset(current.getStartMark().getLine()); int length = getLineOffset(current.getEndMark().getLine()); return new Region(offset, length - offset); } catch (BadLocationException e) { return null; } }

Target:
public IRegion getRegion(String path) { if (Strings.emptyToNull(path) == null) { return null; } if (path.startsWith(":")) { path = path.substring(1); } String[] paths = path.split(":"); Node current = getYaml(); Node start; int pPos = 0; boolean noPath = false; do { String currentPath = paths[pPos]; start = current; if (current.getNodeId() == NodeId.mapping) { MappingNode mn = (MappingNode) current; for (NodeTuple node : mn.getValue()) { Node keyNode = node.getKeyNode(); if (keyNode.getNodeId() == NodeId.scalar) { ScalarNode scalar = (ScalarNode) keyNode; if (Objects.equals(currentPath, scalar.getValue())) { pPos++; current = node.getValueNode(); break; } } } } else if (current.getNodeId() == NodeId.sequence) { SequenceNode sq = (SequenceNode) current; Integer seqPos; try { if (currentPath.startsWith("@")) { currentPath = currentPath.substring(1); } seqPos = Integer.valueOf(currentPath); } catch (Exception e) { throw new IllegalStateException("Should be a sequence"); } pPos++; current = sq.getValue().get(seqPos); } if (start == current) { noPath = true; current = null; } } while (pPos < paths.length && !noPath); if (current == null) { return null; } try { int offset = getLineOffset(current.getStartMark().getLine()); int length = getLineOffset(current.getEndMark().getLine()); return new Region(offset, length - offset); } catch (BadLocationException e) { return null; } }
Source:
static void addFile(List<FileStatus> result, LocatedFileStatus lfs, long startTime, long endTime) { long timestamp = WAL.getTimestamp(lfs.getPath().getName()); if (timestamp > 0) { if (timestamp <= endTime && timestamp >= startTime) { LOG.info("Found {}", lfs.getPath()); result.add(lfs); } else { LOG.debug("Skipped {}, outside range [{}/{} - {}/{}]", lfs.getPath(), startTime, Instant.ofEpochMilli(startTime), endTime, Instant.ofEpochMilli(endTime)); } } else { LOG.info("Found {}", lfs); result.add(lfs); } }

Target:
static void addFile(List<FileStatus> result, LocatedFileStatus lfs, long startTime, long endTime) { long timestamp = WAL.getTimestamp(lfs.getPath().getName()); if (timestamp > 0) { if (timestamp <= endTime && timestamp >= startTime) { LOG.info("Found {}", lfs.getPath()); result.add(lfs); } else { LOG.info("Skipped {}, outside range [{}/{} - {}/{}]", lfs.getPath(), startTime, Instant.ofEpochMilli(startTime), endTime, Instant.ofEpochMilli(endTime)); } } else { LOG.info("Found (no-timestamp!) {}", lfs); result.add(lfs); } }
Source:
public int hashCode() { return 0; }

Target:
public int hashCode() { return new HashCode(new Unchecked<>(this.shead::get).value()).value(); }
Source:
private void addExtraSets(Object xoaiItemsList, String setSpec, Date from, Date until) { List<Xitem> xoaiItems = (List<Xitem>)xoaiItemsList; List<OAIRecord> oaiRecords = recordService.findOaiRecordsNotInThisSet(setSpec, from, until); if (oaiRecords == null && oaiRecords.isEmpty()) { return; } int j = 0; for (int i = 0; i < xoaiItems.size(); i++) { Xitem xitem = xoaiItems.get(i); while (j < oaiRecords.size() && xitem.getIdentifier().compareTo(oaiRecords.get(j).getGlobalId()) > 0) { j++; } while (j < oaiRecords.size() && xitem.getIdentifier().equals(oaiRecords.get(j).getGlobalId())) { xoaiItems.get(i).getSets().add(new Set(oaiRecords.get(j).getSetName())); j++; } } }

Target:
private void addExtraSets(Object xoaiItemsList, String setSpec, Date from, Date until) { List<Xitem> xoaiItems = (List<Xitem>)xoaiItemsList; List<OAIRecord> oaiRecords = recordService.findOaiRecordsNotInThisSet(setSpec, from, until); if (oaiRecords == null || oaiRecords.isEmpty()) { return; } int j = 0; for (int i = 0; i < xoaiItems.size(); i++) { Xitem xitem = xoaiItems.get(i); while (j < oaiRecords.size() && xitem.getIdentifier().compareTo(oaiRecords.get(j).getGlobalId()) > 0) { j++; } while (j < oaiRecords.size() && xitem.getIdentifier().equals(oaiRecords.get(j).getGlobalId())) { xoaiItems.get(i).getSets().add(new Set(oaiRecords.get(j).getSetName())); j++; } } }
Source:
public void testInitializeAndClock() { final int initialWorkerClock = 10; final int initialGlobalMinimumClock = 30; final int numberOFClockCalls = 3; final ResettingCountDownLatch countDownLatch = new ResettingCountDownLatch(numberOFClockCalls); doAnswer(invocation -> { final byte[] data = invocation.getArgumentAt(1, byte[].class); final AvroClockMsg sendMsg = codec.decode(data); if (sendMsg.getType() == ClockMsgType.RequestInitClock) { final AvroClockMsg initClockMsg = ClockManager.getReplyInitialClockMessage(initialGlobalMinimumClock, initialWorkerClock); final byte[] replyData = codec.encode(initClockMsg); final AggregationMessage aggregationMessage = getTestAggregationMessage("worker", replyData); sspWorkerClockMessageHandler.onNext(aggregationMessage); } else if (sendMsg.getType() == ClockMsgType.Tick) { countDownLatch.countDown(); } return null; }).when(mockAggregationSlave).send(anyString(), anyObject()); sspWorkerClock.initialize(); assertEquals(initialWorkerClock, sspWorkerClock.getWorkerClock()); assertEquals(initialGlobalMinimumClock, sspWorkerClock.getGlobalMinimumClock()); for (int i = 0; i < numberOFClockCalls; i++) { assertEquals(initialWorkerClock + i, sspWorkerClock.getWorkerClock()); sspWorkerClock.clock(); } countDownLatch.await(); assertEquals(initialWorkerClock + numberOFClockCalls, sspWorkerClock.getWorkerClock()); assertEquals(initialGlobalMinimumClock, sspWorkerClock.getGlobalMinimumClock()); }

Target:
public void testInitializeAndClock() { final int numberOfClockCalls = 3; final AtomicInteger numberOfTickMsgCalls = new AtomicInteger(0); doAnswer(invocation -> { final byte[] data = invocation.getArgumentAt(1, byte[].class); final AvroClockMsg sendMsg = codec.decode(data); if (sendMsg.getType() == ClockMsgType.RequestInitClockMsg) { final AvroClockMsg initClockMsg = ClockManager.getReplyInitialClockMessage(initialGlobalMinimumClock, initialWorkerClock); final byte[] replyData = codec.encode(initClockMsg); final AggregationMessage aggregationMessage = getTestAggregationMessage("worker", replyData); sspWorkerClockMessageHandler.onNext(aggregationMessage); } else if (sendMsg.getType() == ClockMsgType.TickMsg) { numberOfTickMsgCalls.incrementAndGet(); } return null; }).when(mockAggregationSlave).send(anyString(), anyObject()); sspWorkerClock.initialize(); assertEquals(initialWorkerClock, sspWorkerClock.getWorkerClock()); assertEquals(initialGlobalMinimumClock, sspWorkerClock.getGlobalMinimumClock()); for (int i = 0; i < numberOfClockCalls; i++) { assertEquals(initialWorkerClock + i, sspWorkerClock.getWorkerClock()); sspWorkerClock.clock(); } assertEquals(numberOfClockCalls, numberOfTickMsgCalls.intValue()); assertEquals(initialWorkerClock + numberOfClockCalls, sspWorkerClock.getWorkerClock()); assertEquals(initialGlobalMinimumClock, sspWorkerClock.getGlobalMinimumClock()); }
Source:
public static JavaRDD<VariantContext> callVariantsWithHaplotypeCaller( final AuthHolder authHolder, final JavaSparkContext ctx, final JavaRDD<GATKRead> reads, final SAMFileHeader header, final ReferenceMultiSource reference, final List<SimpleInterval> intervals, final HaplotypeCallerArgumentCollection hcArgs, final ShardingArgumentCollection shardingArgs) { Utils.validateArg(hcArgs.dbsnp.dbsnp == null && hcArgs.comps.isEmpty(), "HaplotypeCallerSpark does not yet support dbsnp or comp side inputs." ); if ( !reference.isCompatibleWithSparkBroadcast()){ throw new UserException.Require2BitReferenceForBroadcast(); } final Broadcast<ReferenceMultiSource> referenceBroadcast = ctx.broadcast(reference); final Broadcast<HaplotypeCallerArgumentCollection> hcArgsBroadcast = ctx.broadcast(hcArgs); final OverlapDetector<ReadShard.ShardBoundary> overlaps = getShardBoundaryOverlapDetector(header, intervals, shardingArgs.readShardSize, shardingArgs.readShardPadding); final Broadcast<OverlapDetector<ReadShard.ShardBoundary>> shardBoundariesBroadcast = ctx.broadcast(overlaps); final JavaRDD<ReadShard> readShards = createReadShards(shardBoundariesBroadcast, reads); final JavaRDD<Tuple2<AssemblyRegion, SimpleInterval>> assemblyRegions = readShards .flatMap(shardsToAssemblyRegions(authHolder, referenceBroadcast, hcArgsBroadcast, shardingArgs, header)); return assemblyRegions.flatMap(callVariantsFromAssemblyRegions(authHolder, header, referenceBroadcast, hcArgsBroadcast)); }

Target:
public static JavaRDD<VariantContext> callVariantsWithHaplotypeCaller( final AuthHolder authHolder, final JavaSparkContext ctx, final JavaRDD<GATKRead> reads, final SAMFileHeader header, final ReferenceMultiSource reference, final List<SimpleInterval> intervals, final HaplotypeCallerArgumentCollection hcArgs, final ShardingArgumentCollection shardingArgs) { Utils.validateArg(hcArgs.dbsnp.dbsnp == null, "HaplotypeCallerSpark does not yet support -D or --dbsnp arguments" ); Utils.validateArg(hcArgs.comps.isEmpty(), "HaplotypeCallerSpark does not yet support -comp or --comp arguments" ); Utils.validateArg(hcArgs.bamOutputPath == null, "HaplotypeCallerSpark does not yet support -bamout or --bamOutput"); if ( !reference.isCompatibleWithSparkBroadcast()){ throw new UserException.Require2BitReferenceForBroadcast(); } final Broadcast<ReferenceMultiSource> referenceBroadcast = ctx.broadcast(reference); final Broadcast<HaplotypeCallerArgumentCollection> hcArgsBroadcast = ctx.broadcast(hcArgs); final OverlapDetector<ShardBoundary> overlaps = getShardBoundaryOverlapDetector(header, intervals, shardingArgs.readShardSize, shardingArgs.readShardPadding); final Broadcast<OverlapDetector<ShardBoundary>> shardBoundariesBroadcast = ctx.broadcast(overlaps); final JavaRDD<Shard<GATKRead>> readShards = createReadShards(shardBoundariesBroadcast, reads); final JavaRDD<Tuple2<AssemblyRegion, SimpleInterval>> assemblyRegions = readShards .mapPartitions(shardsToAssemblyRegions(authHolder, referenceBroadcast, hcArgsBroadcast, shardingArgs, header)); return assemblyRegions.mapPartitions(callVariantsFromAssemblyRegions(authHolder, header, referenceBroadcast, hcArgsBroadcast)); }
Source:
private ImageMapType getCitySchemaMapType() { ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance(); opts.setMinZoom(ZOOM_MIN); opts.setMaxZoom(ZOOM_MAX); opts.setName(MAP_TYPE_ID); opts.setTileSize(Size.newInstance(TILE_SIZE, TILE_SIZE)); opts.setTileUrl(new TileUrlCallBack() { @Override public String getTileUrl(Point point, int zoomLevel) { Point normalizedCoord = getNormalizedCoords(point, zoomLevel); if (normalizedCoord == null) { return null; } return TILE_IMAGES_PATH.replace("/", PATH_SEPARATOR) + PATH_SEPARATOR + (zoomLevel - 2) + PATH_SEPARATOR + + (zoomLevel - 2) + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getY() + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getX() + FILE_EXTENSION_SEPARATOR + TILE_IMAGES_FILE_EXTENSION; } }); return ImageMapType.newInstance(opts); }

Target:
private ImageMapType getCitySchemaMapType() { ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance(); opts.setMinZoom(ZOOM_MIN); opts.setMaxZoom(ZOOM_MAX); opts.setName(MAP_TYPE_ID); opts.setTileSize(Size.newInstance(TILE_SIZE, TILE_SIZE)); opts.setTileUrl(new TileUrlCallBack() { @Override public String getTileUrl(Point point, int zoomLevel) { Point normalizedCoord = getNormalizedCoords(point, zoomLevel); if (normalizedCoord == null) { return null; } return TILE_IMAGES_PATH + PATH_SEPARATOR + (zoomLevel - 2) + PATH_SEPARATOR + + (zoomLevel - 2) + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getY() + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getX() + FILE_EXTENSION_SEPARATOR + TILE_IMAGES_FILE_EXTENSION; } }); return ImageMapType.newInstance(opts); }
Source:
FrameType(int encodedType) { this(encodedType, 0); }

Target:
FrameType(int encodedType) { this(encodedType, Flags.EMPTY); }
Source:
protected Message<?> receiveMessage() { if (this.limitingSource != null) { return this.limitingSource.receive(this.maxFetchSize); } else { return this.source.receive(); } }

Target:
protected Message<?> receiveMessage() { return this.source.receive(); }
Source:
public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); List<ByteBuffer> args = new ArrayList<>(); args.add(ByteBuffer.wrap(tableName.getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); int numSplits = ntc.getSplits().size(); args.add(ByteBuffer.wrap(String.valueOf(numSplits).getBytes(UTF_8))); if (numSplits > 0) { for (Text t : ntc.getSplits()) { args.add(ByteBuffer.wrap(t.toString().getBytes(UTF_8))); } } Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { throw new AssertionError(e); } }

Target:
public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); List<ByteBuffer> args = new ArrayList<>(); args.add(ByteBuffer.wrap(tableName.getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getInitialTableState().name().getBytes(UTF_8))); int numSplits = ntc.getSplits().size(); args.add(ByteBuffer.wrap(String.valueOf(numSplits).getBytes(UTF_8))); if (numSplits > 0) { for (Text t : ntc.getSplits()) { args.add(TextUtil.getByteBuffer(t)); } } Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { throw new AssertionError(e); } }
Source:
private static JavaSymbol.MethodJavaSymbol getSamMethod(JavaType lambdaType) { for (Symbol member : lambdaType.symbol().memberSymbols()) { if (member.isMethodSymbol() && member.isAbstract()) { return (JavaSymbol.MethodJavaSymbol) member; } } for (ClassJavaType type : lambdaType.symbol.superTypes()) { for (Symbol member : type.symbol().memberSymbols()) { if (member.isMethodSymbol() && member.isAbstract()) { return (JavaSymbol.MethodJavaSymbol) member; } } } return null; }

Target:
private static JavaSymbol.MethodJavaSymbol getSamMethod(JavaType lambdaType) { for (Symbol member : lambdaType.symbol().memberSymbols()) { if (member.isMethodSymbol() && member.isAbstract()) { return (JavaSymbol.MethodJavaSymbol) member; } } for (ClassJavaType type : lambdaType.symbol.superTypes()) { JavaSymbol.MethodJavaSymbol samMethod = getSamMethod(type); if (samMethod != null) { return samMethod; } } return null; }
Source:
public RegexSearchQuerySpec( @JsonProperty("pattern") String pattern ) { this.pattern = pattern; compiled = Pattern.compile(pattern); }

Target:
public RegexSearchQuerySpec( @JsonProperty("pattern") String pattern ) { this.pattern = Preconditions.checkNotNull(pattern, "pattern should not be null"); compiled = Pattern.compile(pattern); }
Source:
public void updateCategories(List<String> selectedCategories) { Single<Boolean> resultSingle =reasonBuilder.getReason(media, null) .flatMap((reason) -> categoryEditHelper.makeCategoryEdit(getContext(), media, selectedCategories, this)); compositeDisposable.add(resultSingle .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(s -> { Timber.d("Categories are added."); onOutsideOfCategoryEditClicked(); media.setAddedCategories(selectedCategories); updateCategoryList(); })); }

Target:
public void updateCategories(List<String> selectedCategories) { compositeDisposable.add(categoryEditHelper.makeCategoryEdit(getContext(), media, selectedCategories, this) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(s -> { Timber.d("Categories are added."); onOutsideOfCategoryEditClicked(); media.setAddedCategories(selectedCategories); updateCategoryList(); })); }
Source:
public Color getBackground(Object element, int columnIndex) { int category = ((MyModel) element).category; if (category == 0) { return Display.getCurrent().getSystemColor(SWT.COLOR_RED); } else if (category == 1) { return Display.getCurrent().getSystemColor(SWT.COLOR_GRAY); } else if (category == 2) { return Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW); } else if (category == 3) { return Display.getCurrent().getSystemColor(SWT.COLOR_BLUE); } else if (category == 4) { return Display.getCurrent().getSystemColor(SWT.COLOR_GREEN); } else if (category == 5) { return Display.getCurrent().getSystemColor(SWT.COLOR_CYAN); } else if (category == 6) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } return null; }

Target:
public Color getBackground(Object element, int columnIndex) { int category = ((MyModel) element).getCategory(); Display display = Display.getCurrent(); if (category == 0) { return display.getSystemColor(SWT.COLOR_RED); } else if (category == 1) { return display.getSystemColor(SWT.COLOR_GRAY); } else if (category == 2) { return display.getSystemColor(SWT.COLOR_YELLOW); } else if (category == 3) { return display.getSystemColor(SWT.COLOR_BLUE); } else if (category == 4) { return display.getSystemColor(SWT.COLOR_GREEN); } else if (category == 5) { return display.getSystemColor(SWT.COLOR_CYAN); } else if (category == 6) { return display.getSystemColor(SWT.COLOR_WHITE); } return null; }
Source:
public static boolean isKindEditable(Property capsulePart, CapsulePartKindEnum newKind) { boolean result = true; UMLRTCapsulePart partFacade = (capsulePart == null) ? null : UMLRTCapsulePart.getInstance(capsulePart); if (partFacade != null) { UMLRTCapsulePartKind currentKind = partFacade.getKind(); UMLRTCapsulePartKind targetKind = CapsulePartKindEnum.toFacade(newKind); if (targetKind == UMLRTCapsulePartKind.NULL) { result = false; } else if (targetKind != currentKind) { if (partFacade.isInherited()) { result = (currentKind != UMLRTCapsulePartKind.PLUG_IN) && (targetKind != UMLRTCapsulePartKind.PLUG_IN); } if (completesCycle(capsulePart.getType(), capsulePart) && newKind == CapsulePartKindEnum.FIXED) { result = false; } } } return result; }

Target:
public static boolean isKindEditable(Property capsulePart, CapsulePartKindEnum newKind) { boolean result = true; UMLRTCapsulePart partFacade = (capsulePart == null) ? null : UMLRTCapsulePart.getInstance(capsulePart); if (partFacade != null) { UMLRTCapsulePartKind currentKind = partFacade.getKind(); UMLRTCapsulePartKind targetKind = CapsulePartKindEnum.toFacade(newKind); if (targetKind == UMLRTCapsulePartKind.NULL) { result = false; } else if (targetKind != currentKind) { if (partFacade.isInherited()) { result = (currentKind != UMLRTCapsulePartKind.PLUG_IN) && (targetKind != UMLRTCapsulePartKind.PLUG_IN); } if (newKind == CapsulePartKindEnum.FIXED && completesCycle(capsulePart.getType(), capsulePart)) { result = false; } } } return result; }
Source:
private static Set<String> extractStringInterpolationIdentifiers(PyFunctionDefTree functionTree) { return functionTree.descendants(Kind.STRING_LITERAL) .map(PyStringLiteralTree.class::cast) .flatMap(str -> str.stringElements().stream()) .filter(str -> str.prefix().equals("f")) .map(PyStringElementTree::trimmedQuotesValue) .flatMap(UnusedLocalVariableCheck::extractInterpolations) .collect(Collectors.toSet()); }

Target:
private static Set<String> extractStringInterpolationIdentifiers(PyFunctionDefTree functionTree) { return functionTree.descendants(Kind.STRING_LITERAL) .map(PyStringLiteralTree.class::cast) .flatMap(str -> str.stringElements().stream()) .filter(str -> str.prefix().equalsIgnoreCase("f")) .map(PyStringElementTree::trimmedQuotesValue) .flatMap(UnusedLocalVariableCheck::extractInterpolations) .collect(Collectors.toSet()); }
Source:
public void testProcessMessage() throws Exception { RMQTestSource source = new RMQTestSource(); source.open(config); RMQDeserializationSchema.RMQCollector collector = Mockito.mock(RMQDeserializationSchema.RMQCollector.class); source.processMessage(source.mockedDelivery, collector); Mockito.verify(collector, Mockito.times(1)).collect("test"); Mockito.verify(collector, Mockito.times(1)).setMessageIdentifiers("1", messageId); source = new RMQTestSource(new CustomDeserializationSchema()); source.open(config); List<String> expectedOutput = new ArrayList<>(1); expectedOutput.add("I Love Turtles"); expectedOutput.add("Brush your teeth"); collector = Mockito.mock(RMQDeserializationSchema.RMQCollector.class); source.processMessage(source.mockedDelivery, collector); Mockito.verify(collector, Mockito.times(1)).collect(Mockito.eq(expectedOutput)); Mockito.verify(collector, Mockito.times(1)).setMessageIdentifiers("1-MESSAGE_ID", messageId); }

Target:
public void testProcessMessage() throws Exception { RMQTestSource source = new RMQTestSource(); source.open(config); RMQDeserializationSchema.RMQCollector<String> collector = Mockito.mock(RMQDeserializationSchema.RMQCollector.class); source.processMessage(source.mockedDelivery, collector); Mockito.verify(collector, Mockito.times(1)).collect("test"); Mockito.verify(collector, Mockito.times(1)).setMessageIdentifiers("0", messageId); source = new RMQTestSource(new CustomDeserializationSchema()); source.open(config); collector = Mockito.mock(RMQDeserializationSchema.RMQCollector.class); source.processMessage(source.mockedDelivery, collector); Mockito.verify(collector, Mockito.times(1)).collect(Mockito.eq("I Love Turtles")); Mockito.verify(collector, Mockito.times(1)).collect(Mockito.eq("Brush your teeth")); Mockito.verify(collector, Mockito.times(1)).setMessageIdentifiers("1", messageId - 1); Mockito.verify(collector, Mockito.times(1)).setMessageIdentifiers("2-MESSAGE_ID", messageId); }
Source:
public void addRuleConfig (RuleConfig rc) { this.ruleConfigs.put(rc.getKey(), rc); }

Target:
public void addRuleConfig (RuleConfig rc) { this.ruleConfigs.put(rc.getKey(), rc); if (! this.getConfig().containsKey(rc.getKey())) { this.getConfig().setProperty(rc.getKey(), rc.getValue()); } }
Source:
protected String getAdbPath() { String adb = GlobalConfiguration.getDeviceManagerInstance().getAdbPath(); String[] getAdbPathCmd = new String[] {"which", adb}; CommandResult res = getRunUtil().runTimedCmd(CMD_TIME_OUT, getAdbPathCmd); return res.getStdout().trim(); }

Target:
protected String getAdbPath() { String adbPath = GlobalConfiguration.getDeviceManagerInstance().getAdbPath(); if (!new File(adbPath).exists()) { return null; } return adbPath; }
Source:
public void GetReturnsAllAvailableMetadataFormats() throws Exception { String token = getAuthToken(admin.getEmail(), password); List<Map<String,String>> configs = OAIHarvester.getAvailableMetadataFormats(); getClient(token).perform( get("/api/config/harvestermetadata")) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( MetadataConfigsMatcher.matchMetadataConfigs(configs) ))) .andExpect(jsonPath("$._links.self.href", endsWith("/api/config/harvestermetadata"))); }

Target:
public void GetReturnsAllAvailableMetadataFormats() throws Exception { String token = getAuthToken(admin.getEmail(), password); List<Map<String,String>> configs = OAIHarvester.getAvailableMetadataFormats(); getClient(token).perform( get("/api/config/harvestermetadata")) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( MetadataConfigsMatcher.matchMetadataConfigs(configs) ))) .andExpect(jsonPath("$._links.self.href", endsWith("/api/config/harvestermetadata"))); getClient().perform( get("/api/config/harvestermetadata")) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( MetadataConfigsMatcher.matchMetadataConfigs(configs) ))) .andExpect(jsonPath("$._links.self.href", endsWith("/api/config/harvestermetadata"))); token = getAuthToken(eperson.getEmail(), password); getClient(token).perform( get("/api/config/harvestermetadata")) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( MetadataConfigsMatcher.matchMetadataConfigs(configs) ))) .andExpect(jsonPath("$._links.self.href", endsWith("/api/config/harvestermetadata"))); }
Source:
public void write(StreamsDatum streamsDatum) { ObjectNode node; if (streamsDatum.getDocument() instanceof String) { try { node = mapper.readValue((String) streamsDatum.getDocument(), ObjectNode.class); byte[] value = node.toString().getBytes(); BoundStatement statement = insertStatement.bind(GuidUtils.generateGuid(node.toString()), ByteBuffer.wrap(value)); insertBatch.add(statement); } catch (IOException ex) { ex.printStackTrace(); LOGGER.warn("Failure adding object: {}", streamsDatum.getDocument().toString()); return; } } else { try { node = mapper.valueToTree(streamsDatum.getDocument()); byte[] value = node.toString().getBytes(); BoundStatement statement = insertStatement.bind(GuidUtils.generateGuid(node.toString()), ByteBuffer.wrap(value)); insertBatch.add(statement); } catch (Exception ex) { ex.printStackTrace(); LOGGER.warn("Failure adding object: {}", streamsDatum.getDocument().toString()); return; } } flushIfNecessary(); }

Target:
public void write(StreamsDatum streamsDatum) { ObjectNode node; if (streamsDatum.getDocument() instanceof String) { try { node = mapper.readValue((String) streamsDatum.getDocument(), ObjectNode.class); byte[] value = node.toString().getBytes(); String key = GuidUtils.generateGuid(node.toString()); if(!Objects.isNull(streamsDatum.getMetadata().get("id"))) { key = streamsDatum.getMetadata().get("id").toString(); } BoundStatement statement = insertStatement.bind(key, ByteBuffer.wrap(value)); insertBatch.add(statement); } catch (IOException ex) { LOGGER.warn("Failure adding object: {}", streamsDatum.getDocument().toString()); return; } } else { try { node = mapper.valueToTree(streamsDatum.getDocument()); byte[] value = node.toString().getBytes(); String key = GuidUtils.generateGuid(node.toString()); if(!Objects.isNull(streamsDatum.getMetadata().get("id"))) { key = streamsDatum.getMetadata().get("id").toString(); } BoundStatement statement = insertStatement.bind(key, ByteBuffer.wrap(value)); insertBatch.add(statement); } catch (Exception ex) { LOGGER.warn("Failure adding object: {}", streamsDatum.getDocument().toString()); return; } } flushIfNecessary(); }
Source:
private static PullRef.Smart pullRef(final Repo repo) throws IOException { final Coordinates coords = repo.coordinates(); final JsonObject user = Json.createObjectBuilder() .add("login", coords.user()) .build(); return new PullRef.Smart( new RtPullRef( repo.github(), Json.createObjectBuilder() .add("label", LABEL) .add("ref", REF) .add("sha", SHA) .add("user", user) .add( "repo", Json.createObjectBuilder() .add("name", coords.repo()) .add("full_name", coords.toString()) .add("owner", user) .build() ) .build() ) ); }

Target:
private static PullRef.Smart pullRef(final Repo repo) throws IOException { final Coordinates coords = repo.coordinates(); final JsonObject user = Json.createObjectBuilder() .add("login", coords.user()) .build(); return new PullRef.Smart( new RtPullRef( repo.github(), Json.createObjectBuilder() .add("label", PullRefTest.LABEL) .add("ref", PullRefTest.REF) .add("sha", PullRefTest.SHA) .add("user", user) .add( "repo", Json.createObjectBuilder() .add("name", coords.repo()) .add("full_name", coords.toString()) .add("owner", user) .build() ).build() ) ); }
Source:
public static DataSet generate(final int numArticles, final int numComments) { final int timeSpan = 1000 * 60 * 60 * 24 * 7; final long dataStartTime = System.currentTimeMillis(); final long dataEndTime = dataStartTime + timeSpan; final long seed = new Random().nextLong(); final Random random = new Random(seed); LOG.info("Dataset PRNG seed: {}", seed); final Iterator<Integer> articlesToCommentOnSequence = zipfNormal(random, numArticles); final Article[] articles = new Article[numArticles]; final Comment[] comments = new Comment[numComments]; for (int i = 0; i < numArticles; i++) { final long timestamp = random.nextInt(timeSpan) + dataStartTime; final String text = randomText(random, 2000); articles[i] = new Article(i, timestamp, text); } for (int i = 0; i < numComments; i++) { final int articleId = articlesToCommentOnSequence.next(); final long articleTimestamp = articles[articleId].getTimestamp(); final long timestamp = random.nextInt((int) (dataEndTime - articleTimestamp)) + articleTimestamp; final String text = randomText(random, 200); final Comment comment = new Comment(i, timestamp, text, articleId); comments[i] = comment; } return new DataSet(articles, comments); }

Target:
public static DataSet generate(final int numArticles, final int numComments) { final int timeSpan = 1000 * 60 * 60 * 24 * 4; final long dataStartTime = System.currentTimeMillis(); final long dataEndTime = dataStartTime + timeSpan; final long seed = new Random().nextLong(); final Random random = new Random(seed); LOG.info("Dataset PRNG seed: {}", seed); final Iterator<Integer> articlesToCommentOnSequence = zipfNormal(random, numArticles); final Article[] articles = new Article[numArticles]; final Comment[] comments = new Comment[numComments]; for (int i = 0; i < numArticles; i++) { final long timestamp = random.nextInt(timeSpan) + dataStartTime; final String text = randomText(random, 2000); articles[i] = new Article(i, timestamp, text); } for (int i = 0; i < numComments; i++) { final int articleId = articlesToCommentOnSequence.next(); final long articleTimestamp = articles[articleId].getTimestamp(); final long timestamp = random.nextInt((int) (dataEndTime - articleTimestamp)) + articleTimestamp; final String text = randomText(random, 200); final Comment comment = new Comment(i, timestamp, text, articleId); comments[i] = comment; } return new DataSet(articles, comments); }
Source:
T map(ResultSet rs, StatementContext ctx) throws SQLException; default RowMapper<T> memoize(ResultSet rs, StatementContext ctx) throws SQLException { return this; }

Target:
T map(ResultSet rs, StatementContext ctx) throws SQLException; default RowMapper<T> specialize(ResultSet rs, StatementContext ctx) throws SQLException { return this; }
Source:
public void accept(Object obj) { for (XYSeriesConsumer consumer : fSeries) { consumer.accept(obj); } }

Target:
public void accept(Object obj) { fSeries.forEach(consumer -> consumer.accept(obj)); }
Source:
private int nioBuffers(Entry entry, ByteBuf buf, ByteBuffer[] nioBuffers, int nioBufferCount, int maxCount) { ByteBuffer[] nioBufs = entry.bufs; if (nioBufs == null) { entry.bufs = nioBufs = buf.nioBuffers(); } for (int i = 0; i < nioBufs.length && nioBufferCount < maxCount; ++i) { ByteBuffer nioBuf = nioBufs[i]; if (nioBuf == null) { break; } else if (!nioBuf.hasRemaining()) { continue; } nioBuffers[nioBufferCount++] = nioBuf; } return nioBufferCount; }

Target:
private static int nioBuffers(Entry entry, ByteBuf buf, ByteBuffer[] nioBuffers, int nioBufferCount, int maxCount) { ByteBuffer[] nioBufs = entry.bufs; if (nioBufs == null) { entry.bufs = nioBufs = buf.nioBuffers(); } for (int i = 0; i < nioBufs.length && nioBufferCount < maxCount; ++i) { ByteBuffer nioBuf = nioBufs[i]; if (nioBuf == null) { break; } else if (!nioBuf.hasRemaining()) { continue; } nioBuffers[nioBufferCount++] = nioBuf; } return nioBufferCount; }
Source:
public void setXFraction(float fraction) { this.xFraction = fraction; if (getWidth() == 0) { if (preDrawListener == null) { preDrawListener = new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { getViewTreeObserver().removeOnPreDrawListener(preDrawListener); setXFraction(xFraction); return true; } }; getViewTreeObserver().addOnPreDrawListener(preDrawListener); } return; } float translationX = getWidth() * fraction; setTranslationX(translationX); }

Target:
public void setXFraction(float fraction) { mXFraction = fraction; if (getWidth() == 0) { if (mPreDrawListener == null) { mPreDrawListener = new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { getViewTreeObserver().removeOnPreDrawListener(mPreDrawListener); setXFraction(mXFraction); return true; } }; getViewTreeObserver().addOnPreDrawListener(mPreDrawListener); } return; } float translationX = getWidth() * fraction; setTranslationX(translationX); }
Source:
public static IRecipe[] getRecipes(String... keys) { ArrayList<IRecipe> recipes = new ArrayList<>(); for (String key : keys) { recipes.add(BookRecipeRegistry.getRecipe(key)); } return recipes.size() > 0 ? recipes.toArray(new IRecipe[recipes.size()]) : new IRecipe[0]; }

Target:
public static IRecipe[] getRecipes(String... keys) { ArrayList<IRecipe> recipes = new ArrayList<>(); for (String key : keys) { recipes.add(BookRecipeRegistry.getRecipe(key)); } return !recipes.isEmpty() ? recipes.toArray(new IRecipe[recipes.size()]) : new IRecipe[0]; }
Source:
public void testFindJdk() { final File executable = PantsUtil.findPantsExecutable(getProjectFolder()).get(); final Sdk sdkA = getDefaultJavaSdk(executable.getPath()).get(); List<Sdk> sdkResults = Arrays.stream(ProjectJdkTable.getInstance().getAllJdks()) .filter(jdk -> jdk == sdkA) .collect(Collectors.toList()); assertTrue(sdkResults.size() == 1); assertTrue(sdkResults.get(0) == sdkA); ApplicationManager.getApplication().runWriteAction(() -> { ProjectJdkTable.getInstance().addJdk(sdkA); }); sdkResults = Arrays.stream(ProjectJdkTable.getInstance().getAllJdks()) .filter(jdk -> jdk == sdkA) .collect(Collectors.toList()); assertTrue(sdkResults.size() == 2); Sdk sdkB = getDefaultJavaSdk(executable.getPath()).get(); assertTrue(sdkA == sdkB); sdkResults = Arrays.stream(ProjectJdkTable.getInstance().getAllJdks()) .filter(jdk -> jdk == sdkA) .collect(Collectors.toList()); assertTrue(sdkResults.size() == 2); assertTrue(sdkResults.get(0) == sdkA); }

Target:
public void testFindJdk() { final File executable = PantsUtil.findPantsExecutable(getProjectFolder()).get(); assertEquals(Lists.newArrayList(), getAllJdks().collect(Collectors.toList())); final Sdk sdkA = getDefaultJavaSdk(executable.getPath()).get(); assertEquals(Lists.newArrayList(sdkA), getSameJdks(sdkA)); final List<Sdk> singleSdkInTable = getSameJdks(sdkA); assertTrue(singleSdkInTable.get(0).getName().contains("pants")); final List<Sdk> twoEntriesSameSdk = Lists.newArrayList(sdkA, sdkA); ApplicationManager.getApplication().runWriteAction(() -> { ProjectJdkTable.getInstance().addJdk(sdkA); }); assertEquals(twoEntriesSameSdk, getSameJdks(sdkA)); final Sdk sdkB = getDefaultJavaSdk(executable.getPath()).get(); assertTrue(sdkA == sdkB); assertEquals(twoEntriesSameSdk, getSameJdks(sdkA)); }
Source:
public void downloadFiles( List<? extends S3Artifact> s3Artifacts, SingularityExecutorTask task ) throws InterruptedException { final List<CompletableFutureHolder> futures = Lists.newArrayListWithCapacity( s3Artifacts.size() ); for (S3Artifact s3Artifact : s3Artifacts) { String destination = task .getArtifactPath(s3Artifact, task.getTaskDefinition().getTaskDirectoryPath()) .toString(); ArtifactDownloadRequest artifactDownloadRequest = new ArtifactDownloadRequest( destination, s3Artifact, Optional.of(executorConfiguration.getLocalDownloadServiceTimeoutMillis()) ); task .getLog() .debug( "Requesting from {}", artifactDownloadRequest, s3Configuration.getLocalDownloadSocket().get() ); try { CompletableFuture<ContentResponse> future = new CompletableFuture<>(); httpClient .newRequest(localDownloadPath) .method(HttpMethod.POST) .content( new BytesContentProvider( objectMapper.writeValueAsBytes(artifactDownloadRequest) ), "application/json" ) .send(new CompletableFutureResponseListener(future)); futures.add( new CompletableFutureHolder(future, System.currentTimeMillis(), s3Artifact) ); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } for (CompletableFutureHolder future : futures) { ContentResponse response = future.getReponse(); task .getLog() .debug( "Future for got status code after {}", future.s3Artifact.getName(), response.getStatus(), JavaUtils.duration(future.start) ); if (response.getStatus() != 200) { throw new IllegalStateException("Got status code:" + response.getStatus()); } } }

Target:
public void downloadFiles( List<? extends S3Artifact> s3Artifacts, SingularityExecutorTask task ) throws InterruptedException { final List<CompletableFutureHolder> futures = Lists.newArrayListWithCapacity( s3Artifacts.size() ); for (S3Artifact s3Artifact : s3Artifacts) { String destination = task .getArtifactPath(s3Artifact, task.getTaskDefinition().getTaskDirectoryPath()) .toString(); ArtifactDownloadRequest artifactDownloadRequest = new ArtifactDownloadRequest( destination, s3Artifact, Optional.of(executorConfiguration.getLocalDownloadServiceTimeoutMillis()) ); task .getLog() .debug( "Requesting from {}", artifactDownloadRequest, s3Configuration.getLocalDownloadSocket().get() ); try { CompletableFuture<ContentResponse> future = new CompletableFuture<>(); httpClient .newRequest(localDownloadPath) .method(HttpMethod.POST) .content( new BytesContentProvider( objectMapper.writeValueAsBytes(artifactDownloadRequest) ), "application/json" ) .send(new CompletableFutureResponseListener(future)); futures.add( new CompletableFutureHolder(future, System.currentTimeMillis(), s3Artifact) ); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } for (CompletableFutureHolder future : futures) { ContentResponse response = future.getResponse(); task .getLog() .debug( "Future for got status code after {}", future.s3Artifact.getName(), response.getStatus(), JavaUtils.duration(future.start) ); if (response.getStatus() != 200) { throw new IllegalStateException("Got status code:" + response.getStatus()); } } }
Source:
private AsyncRequestListener(final HttpServletRequest request, final HttpServletResponse response, final long startTime, final String flowId) { this.response = response; this.flowId = flowId; this.requestLogInfo = new RequestLogInfo(request, startTime); logToAccessLog(this.requestLogInfo, this.response.getStatus(), 0L); }

Target:
private AsyncRequestListener(final HttpServletRequest request, final HttpServletResponse response, final long startTime, final String flowId) { this.response = response; this.flowId = flowId; this.requestLogInfo = new RequestLogInfo(request, startTime); logToAccessLog(this.requestLogInfo, HttpStatus.PROCESSING.value(), 0L); }
Source:
public void testValueOf() { assertEquals(CENT, valueOf(0, 1)); assertEquals(SATOSHI, valueOf(1)); assertEquals(NEGATIVE_ONE, valueOf(-1)); assertEquals(NetworkParameters.MAX_MONEY, valueOf(NetworkParameters.MAX_MONEY.value)); assertEquals(NetworkParameters.MAX_MONEY.negate(), valueOf(NetworkParameters.MAX_MONEY.value * -1)); try { valueOf(NetworkParameters.MAX_MONEY.value + 1); org.junit.Assert.fail("should not have accepted too-great a monetary value"); } catch (ArithmeticException e) { } try { valueOf( (NetworkParameters.MAX_MONEY.value * -1) - 1); org.junit.Assert.fail("should not have accepted too-little a monetary value"); } catch (ArithmeticException e) { } try { valueOf(1, -1); fail(); } catch (IllegalArgumentException e) try { valueOf(-1, 0); fail(); } catch (IllegalArgumentException e) }

Target:
public void testValueOf() { assertEquals(CENT, valueOf(0, 1)); assertEquals(SATOSHI, valueOf(1)); assertEquals(NEGATIVE_SATOSHI, valueOf(-1)); assertEquals(MAX_MONEY, valueOf(MAX_MONEY.value)); assertEquals(MAX_MONEY.negate(), valueOf(MAX_MONEY.value * -1)); try { valueOf(MAX_MONEY.value + 1); org.junit.Assert.fail("should not have accepted too-great a monetary value"); } catch (IllegalArgumentException e) { } try { valueOf( (MAX_MONEY.value * -1) - 1); org.junit.Assert.fail("should not have accepted too-little a monetary value"); } catch (IllegalArgumentException e) { } try { valueOf(1, -1); fail(); } catch (IllegalArgumentException e) try { valueOf(-1, 0); fail(); } catch (IllegalArgumentException e) }
Source:
protected void saveContent(String content) { Intent savedContentIntent = new Intent(); String blockId = getIntent().getExtras().getString(ARG_BLOCK_ID); savedContentIntent.putExtra(ARG_BLOCK_ID, blockId); savedContentIntent.putExtra(RESULT_SAVED_CONTENT, content); setResult(RESULT_OK, savedContentIntent); finish(); }

Target:
protected void saveContent(String content) { Intent savedContentIntent = new Intent(); String blockId = getIntent().getExtras().getString(ARG_BLOCK_ID); savedContentIntent.putExtra(ARG_BLOCK_ID, blockId); savedContentIntent.putExtra(ARG_BLOCK_CONTENT, content); setResult(RESULT_OK, savedContentIntent); finish(); }