auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Iterable<Map<String, Object>> join(Iterable<Map<?, ?>> input, int batchSize, Function<List<?>, List<Map<String, ?>>> getRowsFunction) { Iterable<Map.Entry<?, ?>> entries = Iterables.concat(Iterables.transform(input, java.util.Map::entrySet)); return FluentIterable.from(Iterables.partition(entries, batchSize)).transformAndConcat( batch -> { Map<?, ?> batchMap = batch.stream().collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())); List<?> keys = batch.stream().map(Map.Entry::getKey).collect(Collectors.toList()); List<Map<String, ?>> batchResult = getRowsFunction.apply(keys); return batchResult.stream().map(result -> { Map<String, Object> map = Maps.newHashMap(); Object row = result.get("row"); map.put(JoinComponent.JOIN_KEY.toString(), row); map.put(JoinComponent.OUTPUT_VALUE.toString(), result); map.put(JoinComponent.INPUT_VALUE.toString(), batchMap.get(row)); return map; }).collect(Collectors.toList()); } ); }

Target:
public static Iterable<Map<String, Object>> join(Iterable<Map<?, ?>> input, int batchSize, Function<List<?>, List<Map<String, ?>>> getRowsFunction) { Iterable<Entry<?, ?>> entries = Iterables.concat(Iterables.transform(input, Map::entrySet)); return FluentIterable.from(Iterables.partition(entries, batchSize)).transformAndConcat( batch -> { List<?> keys = batch.stream().map(Entry::getKey).collect(Collectors.toList()); List<Map<String, ?>> batchResult = getRowsFunction.apply(keys); Map<?, ?> resultMap = Maps.uniqueIndex(batchResult, m -> m.get("row")); return batch.stream() .filter(inputItem -> resultMap.containsKey(inputItem.getKey())) .map(batchItem -> { Map<String, Object> map = Maps.newHashMap(); Object row = batchItem.getKey(); map.put(JoinComponent.JOIN_KEY.toString(), row); map.put(JoinComponent.OUTPUT_VALUE.toString(), resultMap.get(row)); map.put(JoinComponent.INPUT_VALUE.toString(), batchItem.getValue()); return map; }).collect(Collectors.toList()); } ); }
Source:
public void stop() { managerNoReturn.stop(); managerNoReturn = null; managerForceReturn.stop(); managerForceReturn.stop(); }

Target:
public void stop() { managerNoReturn.stop(); managerNoReturn = null; managerForceReturn.stop(); managerForceReturn = null; }
Source:
public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain ) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String uri = "*"; if ( filterConfig != null ) { uri = filterConfig.getInitParameter( "access_control_allow_origin" ); } response.setHeader( ACCESS_CONTROL_ALLOW_ORIGIN, uri ); if ( !"*".equals( uri ) ) { response.setHeader( VARY, "Origin" ); } Enumeration<String> requestMethodEnumeration = request.getHeaders( ACCESS_CONTROL_REQUEST_METHOD ); if ( requestMethodEnumeration != null ) { while ( requestMethodEnumeration.hasMoreElements() ) { String requestMethod = requestMethodEnumeration.nextElement(); addAllowedMethodIfValid( requestMethod, response ); } } Enumeration<String> requestHeaderEnumeration = request.getHeaders( ACCESS_CONTROL_REQUEST_HEADERS ); if ( requestHeaderEnumeration != null ) { while ( requestHeaderEnumeration.hasMoreElements() ) { String requestHeader = requestHeaderEnumeration.nextElement(); addAllowedHeaderIfValid( requestHeader, response ); } } chain.doFilter( request, response ); }

Target:
public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain ) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; response.setHeader( ACCESS_CONTROL_ALLOW_ORIGIN, accessControlAllowOrigin ); if ( vary != null ) { response.setHeader( VARY, vary ); } Enumeration<String> requestMethodEnumeration = request.getHeaders( ACCESS_CONTROL_REQUEST_METHOD ); if ( requestMethodEnumeration != null ) { while ( requestMethodEnumeration.hasMoreElements() ) { String requestMethod = requestMethodEnumeration.nextElement(); addAllowedMethodIfValid( requestMethod, response ); } } Enumeration<String> requestHeaderEnumeration = request.getHeaders( ACCESS_CONTROL_REQUEST_HEADERS ); if ( requestHeaderEnumeration != null ) { while ( requestHeaderEnumeration.hasMoreElements() ) { String requestHeader = requestHeaderEnumeration.nextElement(); addAllowedHeaderIfValid( requestHeader, response ); } } chain.doFilter( request, response ); }
Source:
public int shutdownAndGetConnectionCount() throws IOException, InterruptedException { try { serverSocket.close(); shutdownLatch.await(1, TimeUnit.SECONDS); serverThread.join(200); assertFalse("serverThread failed to shut down quickly", serverThread.isAlive()); } finally { return connectionAttempts.get(); } }

Target:
public int shutdownAndGetConnectionCount() throws IOException, InterruptedException { try { serverSocket.close(); shutdownLatch.await(1, TimeUnit.SECONDS); serverThread.join(1000); assertFalse("serverThread failed to shut down quickly", serverThread.isAlive()); } finally { return connectionAttempts.get(); } }
Source:
public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); for (Observation obs : getObservations(registrationId)) { try { lock.writeLock().lock(); if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { unsafeRemoveObservation(obs.getId()); removed.add(obs); } } finally { lock.writeLock().unlock(); } } return removed; }

Target:
public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); try { lock.writeLock().lock(); for (Observation obs : unsafeGetObservations(registrationId)) { if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { unsafeRemoveObservation(obs.getId()); removed.add(obs); } } } finally { lock.writeLock().unlock(); } return removed; }
Source:
public LinkAddress getDestinationLinkAddress() { if (mDestination == null) return null; return new LinkAddress(mDestination.getAddress(), mDestination.getPrefixLength()); }

Target:
public LinkAddress getDestinationLinkAddress() { return new LinkAddress(mDestination.getAddress(), mDestination.getPrefixLength()); }
Source:
public void cancelRequestsAndCallback() { mListener = null; }

Target:
public void cancelRequestsAndCallback() { synchronized(mListenerLock) { mListener = null; } }
Source:
public Node transform(Node node) { final LibraryLinkNode linkNode = (LibraryLinkNode) node; final String baseLocation = linkNode.getStartPosition().getPath(); final String refName = linkNode.getRefName(); final String absoluteLocation = ResourcePathUtils.toAbsoluteLocation(baseLocation, refName); final String currentFile = node.getRootNode().getStartPosition().getPath(); try { absoluteLocations.get().add(currentFile); try (InputStream inputStream = resourceLoader.fetchResource(absoluteLocation)) { if (inputStream == null) { return new IncludeErrorNode("Library cannot be resolved: " + absoluteLocation); } final String content = StreamUtils.toString(inputStream); if ( absoluteLocations.get().add(absoluteLocation) ) { try { absoluteLocations.get().add(absoluteLocation); final Node libraryReference = new Raml10Builder() .build(content, RamlFragment.Library, resourceLoader, absoluteLocation, RamlBuilder.ALL_PHASES); linkNode.setLibraryReference(libraryReference); } finally { absoluteLocations.get().remove(absoluteLocation); } } else { return new IncludeErrorNode("Cyclic dependency in file " + currentFile + " using " + absoluteLocation); } } } catch (IOException e) { return new IncludeErrorNode(String.format("Library cannot be resolved: %s. (%s)", absoluteLocation, e.getMessage())); } finally { absoluteLocations.get().remove(currentFile); } return linkNode; }

Target:
public Node transform(Node node) { final LibraryLinkNode linkNode = (LibraryLinkNode) node; final String baseLocation = linkNode.getStartPosition().getPath(); final String refName = linkNode.getRefName(); final String absoluteLocation = ResourcePathUtils.toAbsoluteLocation(baseLocation, refName); try { try (InputStream inputStream = resourceLoader.fetchResource(absoluteLocation)) { if (inputStream == null) { return new IncludeErrorNode("Library cannot be resolved: " + absoluteLocation); } final String content = StreamUtils.toString(inputStream); final Node libraryReference = builder .build(content, RamlFragment.Library, resourceLoader, absoluteLocation, RamlBuilder.ALL_PHASES); linkNode.setLibraryReference(libraryReference); } } catch (IOException e) { return new IncludeErrorNode(String.format("Library cannot be resolved: %s. (%s)", absoluteLocation, e.getMessage())); } return linkNode; }
Source:
public static CompilationUnit getKiePMMLModelCompilationUnit(final DataDictionary dataDictionary, final Model model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final String packageName, final String javaTemplate, final String modelClassName) { logger.trace("getKiePMMLModelCompilationUnit {}", dataDictionary, model, packageName); String className = getSanitizedClassName(model.getModelName()); String targetField = getTargetFieldName(dataDictionary, model).orElse(null); List<KiePMMLOutputField> outputFields = getOutputFields(model); CompilationUnit templateCU = getFromFileName(javaTemplate); CompilationUnit cloneCU = templateCU.clone(); cloneCU.setPackageDeclaration(packageName); ClassOrInterfaceDeclaration modelTemplate = cloneCU.getClassByName(modelClassName) .orElseThrow(() -> new KiePMMLException(MAIN_CLASS_NOT_FOUND)); modelTemplate.setName(className); MINING_FUNCTION miningFunction = MINING_FUNCTION.byName(model.getMiningFunction().value()); final ConstructorDeclaration constructorDeclaration = modelTemplate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format("Missing default constructor in ClassOrInterfaceDeclaration %s ", modelTemplate.getName()))); setConstructor(model, constructorDeclaration, modelTemplate.getName(), targetField, miningFunction); addOutputFieldsPopulation(constructorDeclaration.getBody(), outputFields); addFieldTypeMapPopulation(constructorDeclaration.getBody(), fieldTypeMap); return cloneCU; }

Target:
public static CompilationUnit getKiePMMLModelCompilationUnit(final DataDictionary dataDictionary, final Model model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final String packageName, final String javaTemplate, final String modelClassName) { logger.trace("getKiePMMLModelCompilationUnit {}", dataDictionary, model, packageName); String className = getSanitizedClassName(model.getModelName()); String targetField = getTargetFieldName(dataDictionary, model).orElse(null); List<KiePMMLOutputField> outputFields = getOutputFields(model); CompilationUnit templateCU = getFromFileName(javaTemplate); CompilationUnit cloneCU = templateCU.clone(); cloneCU.setPackageDeclaration(packageName); ClassOrInterfaceDeclaration modelTemplate = cloneCU.getClassByName(modelClassName) .orElseThrow(() -> new KiePMMLException(MAIN_CLASS_NOT_FOUND + ": " + modelClassName)); modelTemplate.setName(className); MINING_FUNCTION miningFunction = MINING_FUNCTION.byName(model.getMiningFunction().value()); final ConstructorDeclaration constructorDeclaration = modelTemplate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format("Missing default constructor in ClassOrInterfaceDeclaration %s ", modelTemplate.getName()))); setConstructor(model, constructorDeclaration, modelTemplate.getName(), targetField, miningFunction); addOutputFieldsPopulation(constructorDeclaration.getBody(), outputFields); addFieldTypeMapPopulation(constructorDeclaration.getBody(), fieldTypeMap); return cloneCU; }
Source:
public void shouldParseTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:Time\n" + "0,Mattias,13:37\n" + "1,Johan,\"16:20:01\"\n" ); Iterable<DataFactory> dataIterable = dataIterable( data ); Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", TimeValue.time( 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", TimeValue.time( 16, 20, 1, 0, "+00:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }

Target:
public void shouldParseTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:Time\n" + "0,Mattias,13:37\n" + "1,Johan,\"16:20:01\"\n" + "2,Bob,07:30-05:00\n" ); Iterable<DataFactory> dataIterable = dataIterable( data ); Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", TimeValue.time( 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", TimeValue.time( 16, 20, 1, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 2L, new Object[]{"name", "Bob", "time", TimeValue.time( 7, 30, 0, 0, "-05:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }
Source:
public RemoveVdsVDSCommand(P parameters) { super(parameters, parameters.isErrorIfHostDoesntExist()); this.parameters = parameters; }

Target:
public RemoveVdsVDSCommand(P parameters) { super(parameters, parameters.isNewHost()); this.parameters = parameters; }
Source:
public int hashCode() { return getWidth() << 15 | getHeight(); }

Target:
public int hashCode() { return Objects.hash(getFbo().width(), getFbo().height()); }
Source:
private void verifyCopiedData() throws IOException { for (int i = 0; i < numFiles; i++) { String fileName = "file" + i; String inputFileData = FileUtils.readFileToString(new File(inputDirFile, fileName)).trim(); String outputFileData = FileUtils.readFileToString(new File(outputDirName, fileName)).trim(); Assert.assertTrue(inputFileData.equals(outputFileData)); } }

Target:
private void verifyCopiedData() throws IOException { for (int i = 0; i < numFiles; i++) { String fileName = "file" + i; Assert.assertTrue(FileUtils.contentEquals(new File(inputDirFile, fileName), new File(outputDirName, fileName))); } }
Source:
public LegoSensorPortConfigDialogWrapper checkDialogVisible() { viewInteraction.check(matches(isDisplayed())); return this; }

Target:
public LegoSensorPortConfigDialogWrapper checkDialogVisible() { viewInteraction.inRoot(isDialog()).check(matches(isDisplayed())); return this; }
Source:
public DbxAutoSync() { super(); this.interval = 1; }

Target:
public DbxAutoSync() { this(1); }
Source:
private InputStream fromBytes(String metacardId, byte[] data) { if (data == null || data.length < MINIMUM_VALID_IMAGE_DATA_SIZE) { LOGGER.debug( String.format( "Image cannot be exported in RTF format, malformed thumbnail data for metacard id: %s", metacardId)); return null; } return new ByteArrayInputStream(data); }

Target:
private InputStream fromBytes(String metacardId, byte[] data) { if (data == null || data.length < MINIMUM_VALID_IMAGE_DATA_SIZE) { LOGGER.debug( "Image cannot be exported in RTF format, malformed thumbnail data for metacard id: {}", metacardId); return null; } return new ByteArrayInputStream(data); }
Source:
public Map<String, ResourceAssignment> getOptimalResourceAssignment() { throw new UnsupportedOperationException("Not implemented yet, depends on #440"); }

Target:
public Map<String, ResourceAssignment> getOptimalResourceAssignment() { throw new UnsupportedOperationException("Not implemented yet"); }
Source:
public void testMetaDataBlobOperation() throws IOException, MessageFormatException { for (int i = 0; i < 2; i++) { if (i == 0) { metadataContentVersion = MessageFormatRecord.Metadata_Content_Version_V2; } else { metadataContentVersion = MessageFormatRecord.Metadata_Content_Version_V3; } InputAndExpected inputAndExpected = new InputAndExpected(BLOB_ID_VERSION_1_METADATA_CONVERTED, VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0], false, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getFirst(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getFirst()}, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getSecond(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getSecond()}); TransformationOutput output = transformer.transform(inputAndExpected.getInput()); assertNull("output exception should be null", output.getException()); verifyOutput(output.getMsg(), inputAndExpected.getExpected()); } }

Target:
public void testMetaDataBlobOperation() throws IOException, MessageFormatException { InputAndExpected inputAndExpected = new InputAndExpected(BLOB_ID_VERSION_1_METADATA_CONVERTED, VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0], false, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getFirst(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getFirst()}, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getSecond(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getSecond()}); TransformationOutput output = transformer.transform(inputAndExpected.getInput()); assertNull("output exception should be null", output.getException()); verifyOutput(output.getMsg(), inputAndExpected.getExpected()); }
Source:
public void shouldParsePomFile() { Properties properties = new Properties(); properties.put("test.properties", "test"); properties.put("modules.root.dir", "${basedir}/../.."); properties.put("project.version", "0-27-SNAPSHOT"); Dependency dependency = new Dependency(new DefaultArtifact( "org.motechproject", "motech-osgi-platform", "", "jar", "${project.version}" ), JavaScopes.RUNTIME); InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("pom.xml"); pomInformation = new PomInformation(); pomInformation.parsePom(inputStream); assertEquals(properties, pomInformation.getProperties()); Parent parentFromParsing = pomInformation.getParent(); assertEquals("0.27-SNAPSHOT", parentFromParsing.getVersion()); assertEquals("motech", parentFromParsing.getArtifactId()); assertEquals("org.motechproject", parentFromParsing.getGroupId()); assertTrue(pomInformation.getDependencies().contains(dependency)); }

Target:
public void shouldParsePomFile() throws IOException { Properties properties = new Properties(); properties.put("test.properties", "test"); properties.put("modules.root.dir", "${basedir}/../.."); properties.put("project.version", "0-27-SNAPSHOT"); properties.put("project.groupId", "testGroupId"); Dependency dependency = new Dependency(new DefaultArtifact( "${project.groupId}", "motech-osgi-platform", "", "jar", "${project.version}" ), JavaScopes.RUNTIME); try (InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("pom.xml")) { pomInformation = new PomInformation(); pomInformation.parsePom(inputStream); } assertEquals(properties, pomInformation.getProperties()); Parent parentFromParsing = pomInformation.getParent(); assertEquals("0.27-SNAPSHOT", parentFromParsing.getVersion()); assertEquals("motech", parentFromParsing.getArtifactId()); assertEquals("org.motechproject", parentFromParsing.getGroupId()); assertTrue(pomInformation.getDependencies().contains(dependency)); }
Source:
public void testHibernateValidatorContextPayload() { HibernateValidatorConfiguration configuration = getConfiguration(); final Validator validator = configuration.buildValidatorFactory().unwrap( HibernateValidatorFactory.class ) .usingContext().constraintValidatorPayload( Integer.class ) .getValidator(); assertNoViolations( validator.validate( new PayloadDummyEntity( Integer.class ) ) ); }

Target:
public void testHibernateValidatorContextPayload() { HibernateValidatorConfiguration configuration = getConfiguration(); Validator validator = configuration.buildValidatorFactory().unwrap( HibernateValidatorFactory.class ) .usingContext().constraintValidatorPayload( Integer.class ) .getValidator(); assertNoViolations( validator.validate( new PayloadDummyEntity( Integer.class ) ) ); assertThat( validator.validate( new PayloadDummyEntity( String.class ) ) ) .containsOnlyViolations( violationOf( PayloadConstraint.class ) ); }
Source:
public void tearDown() throws Exception { bigtableApi.close(); if (server != null) { server.shutdownNow(); server.awaitTermination(); } }

Target:
public void tearDown() throws Exception { bigtableApi.close(); server.shutdownNow(); server.awaitTermination(); }
Source:
public int visit(IASTExpression expression) { if (decl == null) return PROCESS_SKIP; if (expression instanceof IASTBinaryExpression) { IASTBinaryExpression binary = (IASTBinaryExpression) expression; if ((binary.getOperator() == IASTBinaryExpression.op_equals || binary.getOperator() == IASTBinaryExpression.op_notequals)) { if (referencesThis(binary.getOperand1()) && referencesParameter(binary.getOperand2())) { decl = null; return PROCESS_SKIP; } else if (referencesThis(binary.getOperand2()) && referencesParameter(binary.getOperand1())) { decl = null; return PROCESS_SKIP; } else { reportProblem(MISS_SELF_CHECK_ID, decl); } } else { reportProblem(MISS_SELF_CHECK_ID, decl); } decl = null; return PROCESS_SKIP; } else { reportProblem(MISS_SELF_CHECK_ID, decl); decl = null; return PROCESS_SKIP; } }

Target:
public int visit(IASTExpression expression) { if (!opInfo.isEmpty()) { OperatorEqInfo info = opInfo.peek(); if (info.decl == null) return PROCESS_CONTINUE; if (expression instanceof IASTBinaryExpression) { IASTBinaryExpression binary = (IASTBinaryExpression) expression; if ((binary.getOperator() == IASTBinaryExpression.op_equals || binary.getOperator() == IASTBinaryExpression.op_notequals)) { if (referencesThis(binary.getOperand1()) && referencesParameter(info, binary.getOperand2())) { info.decl = null; } else if (referencesThis(binary.getOperand2()) && referencesParameter(info, binary.getOperand1())) { info.decl = null; } else { reportProblem(MISS_SELF_CHECK_ID, info.decl); } } else { reportProblem(MISS_SELF_CHECK_ID, info.decl); } info.decl = null; } else { reportProblem(MISS_SELF_CHECK_ID, info.decl); info.decl = null; } } return PROCESS_CONTINUE; }
Source:
public StoredProcedureQuery createStoredProcedureQuery(String s) { return null; }

Target:
public StoredProcedureQuery createStoredProcedureQuery(String s) { throw new UnsupportedOperationException("createStoredProcedureQuery"); }
Source:
private List<IkePayload> extractChildPayloadsFromMessage(IkeMessage ikeMessage) throws InvalidSyntaxException { IkeSaPayload saPayload = ikeMessage.getPayloadForType(IkePayload.PAYLOAD_TYPE_SA, IkeSaPayload.class); IkeTsPayload tsInitPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_INITIATOR, IkeTsPayload.class); IkeTsPayload tsRespPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_RESPONDER, IkeTsPayload.class); List<IkeNotifyPayload> notifyPayloads = ikeMessage.getPayloadListForType( IkePayload.PAYLOAD_TYPE_NOTIFY, IkeNotifyPayload.class); boolean hasErrorNotify = false; List<IkePayload> list = new LinkedList<>(); for (IkeNotifyPayload payload : notifyPayloads) { if (payload.isBuildChildSaNotify()) { list.add(payload); if (payload.isErrorNotify()) { hasErrorNotify = true; } } } if (!hasErrorNotify && (saPayload == null || tsInitPayload == null || tsRespPayload == null)) { throw new InvalidSyntaxException( "SA, TS-Initiator or TS-Responder payload is missing."); } list.add(saPayload); list.add(tsInitPayload); list.add(tsRespPayload); return list; }

Target:
private List<IkePayload> extractChildPayloadsFromMessage(IkeMessage ikeMessage) throws InvalidSyntaxException { IkeSaPayload saPayload = ikeMessage.getPayloadForType(IkePayload.PAYLOAD_TYPE_SA, IkeSaPayload.class); IkeTsPayload tsInitPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_INITIATOR, IkeTsPayload.class); IkeTsPayload tsRespPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_RESPONDER, IkeTsPayload.class); List<IkeNotifyPayload> notifyPayloads = ikeMessage.getPayloadListForType( IkePayload.PAYLOAD_TYPE_NOTIFY, IkeNotifyPayload.class); boolean hasErrorNotify = false; List<IkePayload> list = new LinkedList<>(); for (IkeNotifyPayload payload : notifyPayloads) { if (payload.isNewChildSaNotify()) { list.add(payload); if (payload.isErrorNotify()) { hasErrorNotify = true; } } } if (!hasErrorNotify && (saPayload == null || tsInitPayload == null || tsRespPayload == null)) { throw new InvalidSyntaxException( "SA, TS-Initiator or TS-Responder payload is missing."); } list.add(saPayload); list.add(tsInitPayload); list.add(tsRespPayload); return list; }
Source:
public void testPartitionsNestedCol() { execute( "create table my_table (" + " id int," + " metadata object as (date timestamp with time zone)" + ") clustered into 5 shards " + "partitioned by (metadata['date'])"); ensureYellow(); execute("insert into my_table (id, metadata) values (?, ?), (?, ?)", new Object[]{ 1, new MapBuilder<String, Object>().put("date", "1970-01-01").map(), 2, new MapBuilder<String, Object>().put("date", "2014-05-28").map() }); refresh(); execute("select table_name, partition_ident, values from information_schema.table_partitions order by table_name, partition_ident"); assertEquals(2, response.rowCount()); assertThat(printedTable(response.rows()), is("my_table| 045j2e9n60mj0c9d60og| {metadata['date']=0}\n" + "my_table| 045j4c1h6gmj0d9d68s0| {metadata['date']=1401235200000}\n")); }

Target:
public void testPartitionsNestedCol() { execute( "create table my_table (" + " id int," + " metadata object as (date timestamp with time zone)" + ") clustered into 5 shards " + "partitioned by (metadata['date'])"); ensureYellow(); execute("insert into my_table (id, metadata) values (?, ?), (?, ?)", new Object[]{ 1, new MapBuilder<String, Object>().put("date", "1970-01-01").map(), 2, new MapBuilder<String, Object>().put("date", "2014-05-28").map() }); refresh(); execute("select table_name, partition_ident, values from information_schema.table_partitions order by table_name, partition_ident"); assertEquals(2, response.rowCount()); assertThat(printedTable(response.rows()), is("my_table| 04130| {metadata['date']=0}\n" + "my_table| 04732d1g64p36d9i60o30c1g| {metadata['date']=1401235200000}\n")); }
Source:
public boolean isTooLarge(BigInteger value) { BigDecimal scaled = new BigDecimal( value ).multiply( scalingFactor ); return ( scaled.compareTo( BigDecimal.valueOf( Long.MAX_VALUE ) ) > 0 || scaled.compareTo( BigDecimal.valueOf( Long.MIN_VALUE ) ) < 0 ); }

Target:
public boolean isTooLarge(BigInteger value) { BigDecimal scaled = new BigDecimal( value ).multiply( scalingFactor ); return ( scaled.compareTo( NumberScaleConstants.MIN_LONG_AS_BIGDECIMAL ) < 0 || scaled.compareTo( NumberScaleConstants.MAX_LONG_AS_BIGDECIMAL ) > 0 ); }
Source:
private Func1<Metric<?>, Boolean> tagNotExistsFilter(String unwantedTagName) { return tMetric -> { for (String tagName : tMetric.getTags().keySet()) { if(unwantedTagName.equals(tagName)) { return false; } } return true; }; }

Target:
private Func1<Metric<?>, Boolean> tagNotExistsFilter(String unwantedTagName) { return tMetric -> !tMetric.getTags().keySet().contains(unwantedTagName); }
Source:
public void setLastUpdate(Date newDate) { this.updatedAt = (keepUpdateTimestamp) ? this.updatedAt : newDate; }

Target:
public void setLastUpdate(Date newDate) { if (!keepUpdateTimestamp) { this.updatedAt = newDate; } }
Source:
public void testRemoteKeyNoPull() throws CoreException { class TestNoPullFactory extends TestEClassRemoteFactory { @Override public TestRemoteEClass pull(EPackage parent, String remoteKey, IProgressMonitor monitor) throws CoreException { fail("No retrieve call expected."); return null; } @Override public boolean isPullNeeded(EPackage parent, EClass object, TestRemoteEClass remote) { return false; } } TestManagerEClassHarness harness = new TestManagerEClassHarness(new TestNoPullFactory()) { @Override RemoteEmfConsumer<EPackage, EClass, String, TestRemoteEClass, String, Integer> createConsumer() { return factory.getConsumerForRemoteKey(parent, REMOTE_KEY_1); } }; checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); harness.consumer.retrieve(false); harness.listener.waitForResponse(0, 0); checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); }

Target:
public void testRemoteKeyNoPull() throws CoreException { class TestNoPullFactory extends TestEClassRemoteFactory { @Override public TestRemoteEClass pull(EPackage parent, String remoteKey, IProgressMonitor monitor) throws CoreException { fail("No retrieve call expected."); return null; } @Override public boolean isPullNeeded(EPackage parent, EClass object, TestRemoteEClass remote) { return false; } } TestManagerEClassHarness harness = new TestManagerEClassHarness(new TestNoPullFactory()) { @Override RemoteEmfConsumer<EPackage, EClass, String, TestRemoteEClass, String, Integer> createConsumer() { return factory.getConsumerForRemoteKey(parent, REMOTE_KEY_1); } }; checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); harness.consumer.retrieve(false); harness.listener.waitForResponse(1, 0); checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); }
Source:
protected Request copyRequest(HttpRequest oldRequest, URI newURI) { HttpRequest newRequest = newHttpRequest(oldRequest.getConversation(), newURI); newRequest.method(oldRequest.getMethod()) .version(oldRequest.getVersion()) .body(oldRequest.getBody()) .idleTimeout(oldRequest.getIdleTimeout(), TimeUnit.MILLISECONDS) .timeout(oldRequest.getTimeout(), TimeUnit.MILLISECONDS) .followRedirects(oldRequest.isFollowRedirects()); for (HttpField field : oldRequest.getHeaders()) { HttpHeader header = field.getHeader(); if (HttpHeader.HOST == header) continue; if (HttpHeader.EXPECT == header) continue; if (HttpHeader.COOKIE == header) continue; if (HttpHeader.AUTHORIZATION == header || HttpHeader.PROXY_AUTHORIZATION == header) continue; if (!newRequest.getHeaders().contains(field)) newRequest.header(field); } return newRequest; }

Target:
protected Request copyRequest(HttpRequest oldRequest, URI newURI) { HttpRequest newRequest = newHttpRequest(oldRequest.getConversation(), newURI); newRequest.method(oldRequest.getMethod()) .version(oldRequest.getVersion()) .body(oldRequest.getBody()) .idleTimeout(oldRequest.getIdleTimeout(), TimeUnit.MILLISECONDS) .timeout(oldRequest.getTimeout(), TimeUnit.MILLISECONDS) .followRedirects(oldRequest.isFollowRedirects()); for (HttpField field : oldRequest.getHeaders()) { HttpHeader header = field.getHeader(); if (HttpHeader.HOST == header) continue; if (HttpHeader.EXPECT == header) continue; if (HttpHeader.COOKIE == header) continue; if (HttpHeader.AUTHORIZATION == header || HttpHeader.PROXY_AUTHORIZATION == header) continue; if (!newRequest.getHeaders().contains(field)) newRequest.addHeader(field); } return newRequest; }
Source:
private String maskPassword(String queryString) { return queryString.replaceAll("password=[^&]+", "password=****"); }

Target:
private String maskPassword(String queryString) { return queryString.replaceAll("password=[^&]+", "password=***"); }
Source:
public String findAllRecommendationsIdsStartingFrom(Date date) { final Objectify objectify = OfyService.ofy(); final List<TechnologyRecommendation> allRecommendations = objectify.load().type(TechnologyRecommendation.class).list(); final String recommendationsIds = ""; for (TechnologyRecommendation techRecommendation : allRecommendations) { TechnologyComment techComment = techRecommendation.getComment().get(); if (techComment.getTimestamp().after(date)) { recommendationsIds.concat("," + techRecommendation.getId()); } } return recommendationsIds; }

Target:
public String findAllRecommendationsIdsStartingFrom(Date date) { String recommendationsIds = ""; final Objectify objectify = OfyService.ofy(); final List<TechnologyRecommendation> recommendations = objectify.load().type(TechnologyRecommendation.class) .filter(TechnologyRecommendation.TIMESTAMP + " >" , date).list(); for (TechnologyRecommendation technologyRecommendation : recommendations) { recommendationsIds = recommendationsIds.concat("," + technologyRecommendation.getId()); } return recommendationsIds; }
Source:
public void init() { org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create(); TRACING_TABLE = conf.get(QueryServices.TRACING_STATS_TABLE_NAME_ATTRIB, QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME); }

Target:
public void init() { Configuration conf = HBaseConfiguration.create(); TRACING_TABLE = conf.get(QueryServices.TRACING_STATS_TABLE_NAME_ATTRIB, QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME); }
Source:
protected void executeForZippedFile(InputStream in) throws Exception { try (ZipInputStream zipInputStream = new ZipInputStream(in)) { ZipEntry entry = zipInputStream.getNextEntry(); while (entry != null && !canHandleFileExtension(Files.getFileExtension(entry.getName()))) { entry = zipInputStream.getNextEntry(); } if (entry == null) { throw Exceptions.createHandled().withNLSKey("FileImportJob.noZippedFileFound").handle(); } process.log(ProcessLog.info() .withNLSKey("FileImportJob.importingZippedFile") .withContext("filename", entry.getName())); executeForStream(entry.getName(), zipInputStream); } }

Target:
protected void executeForZippedFile(InputStream in) throws Exception { process.log(ProcessLog.info().withNLSKey("FileImportJob.importingZipFile")); try (ZipInputStream zipInputStream = new ZipInputStream(in)) { ZipEntry entry = zipInputStream.getNextEntry(); while (entry != null) { if (!isHiddenFile(entry.getName()) && canHandleFileExtension(Files.getFileExtension(entry.getName()))) { process.log(ProcessLog.info() .withNLSKey("FileImportJob.importingZippedFile") .withContext("filename", entry.getName())); executeForStream(entry.getName(), zipInputStream); return; } entry = zipInputStream.getNextEntry(); } throw Exceptions.createHandled().withNLSKey("FileImportJob.noZippedFileFound").handle(); } }
Source:
private Element createServerElement(Document doc, ClusteringServiceConfiguration clusteringServiceConfiguration) { if (!(clusteringServiceConfiguration.getConnectionSource() instanceof ConnectionSource.ServerList)) { throw new IllegalArgumentException("When connection URL is null, source of connection MUST be of type ConnectionSource.ServerList.class"); } ConnectionSource.ServerList servers = (ConnectionSource.ServerList)clusteringServiceConfiguration.getConnectionSource(); Element rootElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + CLUSTER_ELEMENT_NAME); rootElement.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLNS + TC_CLUSTERED_NAMESPACE_PREFIX, getNamespace().toString()); Element connElement = createConnectionElementWrapper(doc, clusteringServiceConfiguration); servers.getServers().forEach(server -> { Element serverElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + SERVER_ELEMENT_NAME); serverElement.setAttribute(HOST_ATTRIBUTE_NAME, server.getHostName()); if (server.getPort() > 0) { serverElement.setAttribute(PORT_ATTRIBUTE_NAME, Integer.toString(server.getPort())); } connElement.appendChild(serverElement); }); rootElement.appendChild(connElement); return rootElement; }

Target:
private Element createServerElement(Document doc, ClusteringServiceConfiguration clusteringServiceConfiguration) { if (!(clusteringServiceConfiguration.getConnectionSource() instanceof ConnectionSource.ServerList)) { throw new IllegalArgumentException("When connection URL is null, source of connection MUST be of type ConnectionSource.ServerList.class"); } ConnectionSource.ServerList servers = (ConnectionSource.ServerList)clusteringServiceConfiguration.getConnectionSource(); Element rootElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + CLUSTER_ELEMENT_NAME); Element connElement = createConnectionElementWrapper(doc, clusteringServiceConfiguration); servers.getServers().forEach(server -> { Element serverElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + SERVER_ELEMENT_NAME); serverElement.setAttribute(HOST_ATTRIBUTE_NAME, server.getHostName()); if (server.getPort() > 0) { serverElement.setAttribute(PORT_ATTRIBUTE_NAME, Integer.toString(server.getPort())); } connElement.appendChild(serverElement); }); rootElement.appendChild(connElement); return rootElement; }
Source:
public String getUnitSymbol() { Unit<?> unit = getUnit(); return unit != null ? unit.toString() : null; }

Target:
public @Nullable String getUnitSymbol() { Unit<?> unit = getUnit(); return unit != null ? unit.toString() : null; }
Source:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new DurationConstraintLinkSelectionHandlesEditPolicy(this, getEditingDomain())); }

Target:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); }
Source:
public void commit(Context context) throws Exception { LinkedHashMap<String, String> partitionSpec = context.partitionSpec(); metaStore.createOrAlterPartition(partitionSpec, context.partitionPath()); if (metaStore.getPartition(partitionSpec).isPresent()) { LOG.warn("partition has existed before current commit, this partition will be altered instead of being created", partitionSpec); } LOG.info("Committed partition to metastore", partitionSpec); }

Target:
public void commit(Context context) throws Exception { LinkedHashMap<String, String> partitionSpec = context.partitionSpec(); metaStore.getPartition(partitionSpec).ifPresent(path -> LOG.warn("The partition has existed before current commit," + " the path is {}, this partition will be altered instead of being created", partitionSpec, path)); metaStore.createOrAlterPartition(partitionSpec, context.partitionPath()); LOG.info("Committed partition to metastore", partitionSpec); }
Source:
static int findStringStatisticTruncationPosition(Slice utf8, HiveWriterVersion version) { int length = utf8.length(); int position = 0; while (position < length) { int codePoint = tryGetCodePointAt(utf8, position); if (codePoint < 0) { break; } if (codePoint == REPLACEMENT_CHARACTER_CODE_POINT) { break; } if (version == ORIGINAL && codePoint > REPLACEMENT_CHARACTER_CODE_POINT) { break; } position += lengthOfCodePoint(codePoint); } return position == length ? -1 : position; }

Target:
static int findStringStatisticTruncationPosition(Slice utf8, HiveWriterVersion version) { int length = utf8.length(); int position = 0; while (position < length) { int codePoint = tryGetCodePointAt(utf8, position); if (codePoint < 0) { break; } if (codePoint == REPLACEMENT_CHARACTER_CODE_POINT) { break; } if (version == ORIGINAL && codePoint >= MIN_SUPPLEMENTARY_CODE_POINT) { break; } position += lengthOfCodePoint(codePoint); } return position; }
Source:
private static <T> Function<Entry<byte[], SortedMap<byte[], T>>, RowResult<T>> createRowResultFunction() { Function<Entry<byte[], SortedMap<byte[], T>>, RowResult<T>> function = e -> RowResult.create(e.getKey(), e.getValue()); return function; }

Target:
private static <T> Function<Entry<byte[], SortedMap<byte[], T>>, RowResult<T>> createRowResultFunction() { return entry -> RowResult.create(entry.getKey(), entry.getValue()); }
Source:
public String toString() { return ToStringBuilder.reflectionToString(this); }

Target:
public String toString() { return new XWikiToStringBuilder(this).append("hasParent", hasParent) .append("filterPreference", filterPreference) .append("scopeReference", scopeReference) .append("children", children) .toString(); }
Source:
private String getDependentName(PathAddress address) { if (address !=null && dynamicDependentNameMapper != null) { return RuntimeCapability.buildDynamicCapabilityName(baseDependentName, dynamicDependentNameMapper.apply(address)); } return baseDependentName; }

Target:
private String getDependentName(PathAddress address) { if (dynamicDependentNameMapper != null) { return RuntimeCapability.buildDynamicCapabilityName(baseDependentName, dynamicDependentNameMapper.apply(address)); } return baseDependentName; }
Source:
public void freezeAsyncResults() { int DATA_SIZE = 10; Realm realm = looperThread.getRealm(); populateTestRealm(realm, DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); looperThread.keepStrongReference(results); assertFalse(results.isLoaded()); assertTrue(results.isValid()); assertEquals(0, results.size()); RealmResults<AllTypes> frozenResults = results.freeze(); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { assertTrue(results.isLoaded()); assertTrue(results.isValid()); assertEquals(DATA_SIZE, results.size()); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); looperThread.testComplete(); } }); }

Target:
public void freezeAsyncResults() { int DATA_SIZE = 10; Realm realm = looperThread.getRealm(); populateTestRealm(realm, DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); looperThread.keepStrongReference(results); assertFalse(results.isLoaded()); assertTrue(results.isValid()); assertEquals(0, results.size()); assertFalse(results.isFrozen()); RealmResults<AllTypes> frozenResults = results.freeze(); assertTrue(frozenResults.isFrozen()); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { assertTrue(results.isLoaded()); assertTrue(results.isValid()); assertEquals(DATA_SIZE, results.size()); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); looperThread.testComplete(); } }); }
Source:
public void testExceptionListener() throws Exception { if (broker.isStarted()) { broker.stop(); broker.waitUntilStopped(); } else broker.waitUntilStopped(); broker.setPlugins(new BrokerPlugin[]{new SimpleAuthenticationPlugin(new ArrayList())}); broker.start(true); connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI()); List<Throwable> lsnrExceptions = new LinkedList<>(); Destination dest = new ActiveMQQueue(QUEUE_NAME); try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) { JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer); jmsStreamer.setExceptionListener(new ExceptionListener() { @Override public void onException(JMSException e) { System.out.println("ERROR"); lsnrExceptions.add(e); } }); jmsStreamer.setDestination(dest); try { jmsStreamer.start(); fail("Expecting security exception"); } catch (IgniteException ie) { assertTrue("Caught IgniteException, expected: ", ie.getCause().getCause() instanceof SecurityException); } while(lsnrExceptions.isEmpty()) Thread.sleep(200); assertTrue(lsnrExceptions.size() > 0); try { jmsStreamer.stop(); } catch (Exception ie) { assertTrue("Caught IgniteException, expected: ", ie instanceof IgniteException); } } }

Target:
public void testExceptionListener() throws Exception { if (broker.isStarted()) broker.stop(); broker.waitUntilStopped(); broker.setPlugins(new BrokerPlugin[]{new SimpleAuthenticationPlugin(new ArrayList())}); broker.start(true); connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI()); final List<Throwable> lsnrExceptions = new LinkedList<>(); final CountDownLatch latch = new CountDownLatch(1); Destination dest = new ActiveMQQueue(QUEUE_NAME); try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) { JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer); jmsStreamer.setExceptionListener(new ExceptionListener() { @Override public void onException(JMSException e) { System.out.println("ERROR"); lsnrExceptions.add(e); latch.countDown(); } }); jmsStreamer.setDestination(dest); GridTestUtils.assertThrowsWithCause(new Callable<Void>() { @Override public Void call() throws Exception { jmsStreamer.start(); return null; } }, SecurityException.class); assertTrue(latch.await(10, TimeUnit.SECONDS)); assertTrue(lsnrExceptions.size() > 0); GridTestUtils.assertThrowsWithCause(new Callable<Void>() { @Override public Void call() throws Exception { jmsStreamer.stop(); return null; } }, IgniteException.class); } }
Source:
public void dispose() { if (cache != null) { for (Object element : cache) { ((BasicContribution) element).dispose(); } cache = null; } }

Target:
public void dispose() { if (cache != null) { for (Object contribution : cache) { ((BasicContribution) contribution).dispose(); } cache = null; } }
Source:
private static Predicate<MetricName> withTagIsCurrentSuspectedLeader(boolean currentLeader) { return metricName -> metricName.safeTags().containsKey(AtlasDbMetricNames.TAG_CURRENT_SUSPECTED_LEADER) && metricName.safeTags().get(AtlasDbMetricNames.TAG_CURRENT_SUSPECTED_LEADER) .equals(String.valueOf(currentLeader)); }

Target:
private static Predicate<MetricName> withTagIsCurrentSuspectedLeader(boolean currentLeader) { return metricName -> Optional.ofNullable(metricName.safeTags().get(AtlasDbMetricNames.TAG_CURRENT_SUSPECTED_LEADER)) .filter(x -> x.equals(String.valueOf(currentLeader))) .isPresent(); }
Source:
@Override public Image decodeImage(BufferedSource source, Request request) throws IOException { try { SVG svg = SVG.getFromInputStream(source.peek().inputStream()); if (request.hasSize()) { if (request.targetWidth != 0) { svg.setDocumentWidth(request.targetWidth); } if (request.targetHeight != 0) { svg.setDocumentHeight(request.targetHeight); } } int width = (int) svg.getDocumentWidth(); if (width == -1) { width = (int) svg.getDocumentViewBox().width(); } int height = (int) svg.getDocumentHeight(); if (height == -1) { height = (int) svg.getDocumentViewBox().height(); } Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); svg.renderToCanvas(canvas); return new Image(bitmap); } catch (SVGParseException e) { throw new IOException(e); } }

Target:
@Override public Image decodeImage(BufferedSource source, Request request) throws IOException { try { SVG svg = SVG.getFromInputStream(source.inputStream()); if (request.hasSize()) { if (request.targetWidth != 0) { svg.setDocumentWidth(request.targetWidth); } if (request.targetHeight != 0) { svg.setDocumentHeight(request.targetHeight); } } int width = (int) svg.getDocumentWidth(); if (width == -1) { width = (int) svg.getDocumentViewBox().width(); } int height = (int) svg.getDocumentHeight(); if (height == -1) { height = (int) svg.getDocumentViewBox().height(); } Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); svg.renderToCanvas(canvas); return new Image(bitmap); } catch (SVGParseException e) { throw new IOException(e); } }
Source:
public void testAddChildCycle3() { assertNotNull(fFixture); assertNotNull(f42Fixture); assertNotNull(fHiFixture); ((CalledFunction) f42Fixture).addChild(fHiFixture); assertEquals(Collections.singletonList(fHiFixture), f42Fixture.getChildren()); }

Target:
public void testAddChildCycle3() { assertNotNull(fFixture); assertNotNull(f42Fixture); assertNotNull(fHiFixture); ((CalledFunction) f42Fixture).addChild(fHiFixture); }