auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean isValidConnection(StorageServerConnections conn) { StorageType storageType = conn.getstorage_type(); if (storageType == StorageType.NFS && !new NfsMountPointConstraint().isValid(conn.getconnection(), null)) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID); } if (storageType == StorageType.POSIXFS && (StringUtils.isEmpty(conn.getVfsType()))) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if ((storageType == StorageType.POSIXFS || storageType == StorageType.NFS) && !validate(validateMountOptions())) { return false; } if (storageType == StorageType.ISCSI) { if (StringUtils.isEmpty(conn.getiqn())) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_IQN); } if (!isValidStorageConnectionPort(conn.getport())) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID_PORT); } } if (storageType == StorageType.GLUSTERFS) { StorageConnectionValidator validatror = new StorageConnectionValidator(conn); ValidationResult validionResult = validatror.isGlusterfsCliPackageInstalled(getVds()); if (!validionResult.isValid()) { return failCanDoAction(validionResult.getMessage(), (String[])validionResult.getVariableReplacements().toArray()); } } if (checkIsConnectionFieldEmpty(conn)) { return false; } return true; }

Target:
protected boolean isValidConnection(StorageServerConnections conn) { StorageType storageType = conn.getstorage_type(); if (storageType == StorageType.NFS && !new NfsMountPointConstraint().isValid(conn.getconnection(), null)) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID); } if (storageType == StorageType.POSIXFS && (StringUtils.isEmpty(conn.getVfsType()))) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if ((storageType == StorageType.POSIXFS || storageType == StorageType.NFS) && !validate(validateMountOptions())) { return false; } if (storageType == StorageType.ISCSI) { if (StringUtils.isEmpty(conn.getiqn())) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_IQN); } if (!isValidStorageConnectionPort(conn.getport())) { return failCanDoAction(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID_PORT); } } if (storageType == StorageType.GLUSTERFS) { StorageConnectionValidator validator = new StorageConnectionValidator(conn); ValidationResult validionResult = validator.isGlusterfsCliPackageInstalled(getVds()); if (!validionResult.isValid()) { return failCanDoAction(validionResult.getMessage(), validionResult.getVariableReplacements().toArray(new String[validionResult.getVariableReplacements().size()])); } } if (checkIsConnectionFieldEmpty(conn)) { return false; } return true; }
Source:
private void setStopTimeAvailable(boolean available) { if (available) { onPropertyChanged(new PropertyChangedEventArgs("STOP_TIME_IS_APPLICABLE")); } else { onPropertyChanged(new PropertyChangedEventArgs("STOP_TIME_NOT_APPLICABLE")); } }

Target:
private void setStopTimeAvailable(boolean available) { onPropertyChanged(new PropertyChangedEventArgs("STOP_TIME_UPDATED")); setStopTimeVisible(available); }
Source:
public Response toResponse(InternalServerException e) { ErrorResponse errorResponse = new ErrorResponse(); errorResponse.setTitle("Error occurred in the server while performing an operation."); errorResponse.setCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); errorResponse.setMessage(e.getMessage()); errorResponse.setDescription("Error occurred in the server."); errorResponse.setMoreInfo( "Please contact administrator." + System.lineSeparator() + ExceptionUtils.getFullStackTrace(e)); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse) .type(MediaType.APPLICATION_JSON).build(); }

Target:
public Response toResponse(InternalServerException e) { ErrorResponse errorResponse = new ErrorResponse(); errorResponse.setTitle("Error occurred in the server while performing an operation."); errorResponse.setCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); errorResponse.setMessage(e.getMessage()); errorResponse.setDescription("Error occurred in the server."); errorResponse.setMoreInfo("Please contact administrator."); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse) .type(MediaType.APPLICATION_JSON).build(); }
Source:
public String getSubscriptionStatus(IBaseResource theSubscription) { final IPrimitiveType<?> status = myFhirContext.newTerser().getSingleValueOrNull(theSubscription, SubscriptionConstants.SUBSCRIPTION_STATUS, IPrimitiveType.class); return status.getValueAsString(); }

Target:
public String getSubscriptionStatus(IBaseResource theSubscription) { final IPrimitiveType<?> status = myFhirContext.newTerser().getSingleValueOrNull(theSubscription, SubscriptionConstants.SUBSCRIPTION_STATUS, IPrimitiveType.class); if (status == null) { return null; } return status.getValueAsString(); }
Source:
@Test public void dummyRangeShouldSuccessEvenTheBuildIsRunning() throws Exception { FreeStyleProject project = j.createFreeStyleProject("aProject"); project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo 1\r\nping -n 10 127.0.01 >nul") : new Shell("echo 1\nsleep 10s")); assertThat("Job wasn't scheduled properly", project.scheduleBuild(0), equalTo(true)); while(!project.isBuilding()) { System.out.println("Waiting for build to start and sleep 1s..."); Thread.sleep(1000); } if(!project.getBuildByNumber(1).getLog().contains("echo 1")) { Thread.sleep(1000); } final CLICommandInvoker.Result result = command .authorizedTo(Jenkins.READ, Job.READ) .invokeWithArgs("aProject", "1"); assertThat(result, succeeded()); assertThat(result.stdout(), containsString("Builds: 1" + System.lineSeparator())); }

Target:
@Test public void dummyRangeShouldSuccessEvenTheBuildIsRunning() throws Exception { FreeStyleProject project = j.createFreeStyleProject("aProject"); project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo 1\r\nping -n 10 127.0.0.1 >nul") : new Shell("echo 1\nsleep 10s")); assertThat("Job wasn't scheduled properly", project.scheduleBuild(0), equalTo(true)); while(!project.isBuilding()) { System.out.println("Waiting for build to start and sleep 1s..."); Thread.sleep(1000); } if(!project.getBuildByNumber(1).getLog().contains("echo 1")) { Thread.sleep(1000); } final CLICommandInvoker.Result result = command .authorizedTo(Jenkins.READ, Job.READ) .invokeWithArgs("aProject", "1"); assertThat(result, succeeded()); assertThat(result.stdout(), containsString("Builds: 1" + System.lineSeparator())); }
Source:
private static Block serializeStruct(Type type, BlockBuilder builder, Object object) { if (object == null) { requireNonNull(builder, "builder is null"); builder.appendNull(); return null; } List<Type> typeParameters = type.getTypeParameters(); BlockBuilder currentBuilder; boolean builderSynthesized = false; if (builder == null) { builderSynthesized = true; builder = type.createBlockBuilder(null, 1); } currentBuilder = builder.beginBlockEntry(); for (int i = 0; i < typeParameters.size(); i++) { Optional<String> fieldName = type.getTypeSignature().getParameters().get(i).getNamedTypeSignature().getName(); String name = ""; if (fieldName.isPresent()) { name = fieldName.get().toLowerCase(ENGLISH); } Object value = ((Map) object).get(name); serializeObject(typeParameters.get(i), currentBuilder, value); } builder.closeEntry(); if (builderSynthesized) { return (Block) type.getObject(builder, 0); } else { return null; } }

Target:
private static Block serializeStruct(Type type, BlockBuilder builder, Object object) { if (object == null) { requireNonNull(builder, "builder is null"); builder.appendNull(); return null; } List<Type> typeParameters = type.getTypeParameters(); BlockBuilder currentBuilder; boolean builderSynthesized = false; if (builder == null) { builderSynthesized = true; builder = type.createBlockBuilder(null, 1); } currentBuilder = builder.beginBlockEntry(); for (int i = 0; i < typeParameters.size(); i++) { Optional<String> fieldName = type.getTypeSignature().getParameters().get(i).getNamedTypeSignature().getName(); String name = ""; if (fieldName.isPresent()) { name = fieldName.get().toLowerCase(ENGLISH); } Object value = ((Map) object).get(name); serializeObject(typeParameters.get(i), currentBuilder, value); } builder.closeEntry(); if (builderSynthesized) { return (Block) type.getObject(builder, 0); } return null; }
Source:
public ElasticsearchContainer(final DockerImageName dockerImageName) { super(dockerImageName); dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME, DEFAULT_OSS_IMAGE_NAME); if (getDockerImageName().startsWith(DEFAULT_OSS_IMAGE_NAME.getUnversionedPart())) { this.isOss = true; } logger().info("Starting an elasticsearch container using [{}]", dockerImageName); withNetworkAliases("elasticsearch-" + Base58.randomString(6)); withEnv("discovery.type", "single-node"); addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT); setWaitStrategy(new HttpWaitStrategy() .forPort(ELASTICSEARCH_DEFAULT_PORT) .forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED) .withStartupTimeout(Duration.ofMinutes(2))); }

Target:
public ElasticsearchContainer(final DockerImageName dockerImageName) { super(dockerImageName); dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME, DEFAULT_OSS_IMAGE_NAME); if (dockerImageName.isCompatibleWith(DEFAULT_OSS_IMAGE_NAME)) { this.isOss = true; } logger().info("Starting an elasticsearch container using [{}]", dockerImageName); withNetworkAliases("elasticsearch-" + Base58.randomString(6)); withEnv("discovery.type", "single-node"); addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT); setWaitStrategy(new HttpWaitStrategy() .forPort(ELASTICSEARCH_DEFAULT_PORT) .forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED) .withStartupTimeout(Duration.ofMinutes(2))); }
Source:
public void testFeatureFinish() throws Exception { testRepository .createInitialCommit("testFeatureFinish\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); new InitOperation(repository).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null); new FeatureFinishOperation(gfRepo).execute(null); assertEquals(gfRepo.getDevelopFull(), repository.getFullBranch()); String branchName = gfRepo.getFeatureBranchName(MY_FEATURE); RevCommit branchCommit = testRepository .createInitialCommit("testFeatureFinish\n\nbranch commit\n"); assertEquals(findBranch(repository, branchName), null); RevCommit developHead = gfRepo.findHead(); assertEquals(branchCommit, developHead); }

Target:
public void testFeatureFinish() throws Exception { Repository repository = testRepository.getRepository(); GitFlowRepository gfRepo = init("testFeatureFinish\n\nfirst commit\n"); new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null); new FeatureFinishOperation(gfRepo).execute(null); assertEquals(gfRepo.getDevelopFull(), repository.getFullBranch()); String branchName = gfRepo.getFeatureBranchName(MY_FEATURE); RevCommit branchCommit = testRepository .createInitialCommit("testFeatureFinish\n\nbranch commit\n"); assertEquals(findBranch(repository, branchName), null); RevCommit developHead = gfRepo.findHead(); assertEquals(branchCommit, developHead); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CacheQuotaRequirement that = (CacheQuotaRequirement) o; return cacheQuotaScope == that.cacheQuotaScope && Objects.equals(quota, that.quota); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CacheQuotaRequirement that = (CacheQuotaRequirement) o; return Objects.equals(cacheQuotaScope, that.cacheQuotaScope) && Objects.equals(quota, that.quota); }
Source:
private Collection<StreamlineEvent> convert(List<Values> result, final StreamlineEvent inputEvent) { Collection<StreamlineEvent> output = Collections.emptyList(); if (result != null) { if (valuesConverter != null) { output = Collections2.transform(result, new Function<Values, StreamlineEvent>() { @Override public StreamlineEvent apply(Values values) { return valuesConverter.convert(values, inputEvent); } }); } else if (result instanceof StreamlineEvent){ output = Collections.singletonList((StreamlineEvent) result); } } LOG.debug("Expression evaluation result converted to [{}]", result, output); return output; }

Target:
private Collection<StreamlineEvent> convert(List<Values> result, final StreamlineEvent inputEvent) { Collection<StreamlineEvent> output = Collections.emptyList(); if (result != null) { if (valuesConverter != null) { output = Collections2.transform(result, new Function<Values, StreamlineEvent>() { @Override public StreamlineEvent apply(Values values) { return valuesConverter.convert(values, inputEvent); } }); } else if (result instanceof StreamlineEvent) { output = Collections.singletonList((StreamlineEvent) result); } else { throw new IllegalArgumentException("valueConverter is null and result is not an instance of StreamlineEvent"); } } LOG.debug("Expression evaluation result converted to [{}]", result, output); return output; }
Source:
public void markForDeletion(AgentPrincipals agent, String... ids) { Collection<PID> removed = new ArrayList<>(); PID pid = null; for (String id : ids) { pid = PIDs.get(id); Runnable job = new MarkForDeletionJob(pid, agent, repositoryObjectLoader, sparqlUpdateService, aclService); job.run(); removed.add(pid); } if (pid != null) { PID destination = repositoryObjectLoader.getRepositoryObject(pid).getParent().getPid(); operationsMessageSender.sendRemoveOperation(agent.getUsername(), destination, removed); } }

Target:
public void markForDeletion(AgentPrincipals agent, String... ids) { Collection<PID> pids = new ArrayList<>(); for (String id : ids) { PID pid = PIDs.get(id); Runnable job = new MarkForDeletionJob(pid, agent, repositoryObjectLoader, sparqlUpdateService, aclService); job.run(); pids.add(pid); } operationsMessageSender.sendMarkForDeletionOperation(agent.getUsername(), pids); }
Source:
public static void main(String[] args) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer() .host("127.0.0.1") .port(ConfigurationProperties.DEFAULT_HOTROD_PORT) .security().authentication() .username("username") .password("password") .realm("default") .saslMechanism("DIGEST-MD5"); builder.remoteCache("my-cache") .templateName("org.infinispan.DIST_SYNC"); builder.remoteCache("another-cache") .configuration("<infinispan><cache-container><distributed-cache name=\"another-cache\"><encoding media-type=\"application/x-protostream\"/></distributed-cache></cache-container></infinispan>"); RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build()); RemoteCache<String, String> cache = cacheManager.getCache("my-cache"); cache.put("hello", "world"); System.out.printf("key = %s\n", cache.get("key")); cacheManager.stop(); }

Target:
public static void main(String[] args) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer() .host("127.0.0.1") .port(ConfigurationProperties.DEFAULT_HOTROD_PORT) .security().authentication() .username("username") .password("password") .realm("default") .saslMechanism("DIGEST-MD5"); builder.remoteCache("my-cache") .templateName("org.infinispan.DIST_SYNC"); builder.remoteCache("another-cache") .configuration("<infinispan><cache-container><distributed-cache name=\"another-cache\"><encoding media-type=\"application/x-protostream\"/></distributed-cache></cache-container></infinispan>"); try (RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build())) { RemoteCache<String, String> cache = cacheManager.getCache("my-cache"); cache.put("hello", "world"); System.out.printf("key = %s\n", cache.get("hello")); } }
Source:
public String getTableToolContent(@ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); if(mainDescriptor != null) { File tmpDir = Files.createTempDir(); File tempMainDescriptor = null; try { tempMainDescriptor = File.createTempFile("main", "descriptor", tmpDir); Files.write(mainDescriptor.getContent(), tempMainDescriptor, StandardCharsets.UTF_8); File secondaryDescriptor; for (SourceFile secondaryFile : workflowVersion.getSourceFiles()) { if (!secondaryFile.getPath().equals(workflowVersion.getWorkflowPath())) { secondaryDescriptor = new File(tmpDir.getAbsolutePath(), secondaryFile.getPath()); Files.write(secondaryFile.getContent(), secondaryDescriptor, StandardCharsets.UTF_8); } } } catch (IOException e) { e.printStackTrace(); } String result; if(workflow.getDescriptorType().equals("wdl")) { result = getContentWDL(tempMainDescriptor, "tools"); } else{ result = getContentCWL(tempMainDescriptor, tmpDir,"tools"); } return result; } return null; }

Target:
public String getTableToolContent(@ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); if(mainDescriptor != null) { String descFileContent = mainDescriptor.getContent(); Map<String, String> secondaryDescContent = new HashMap<>(); File tmpDir = Files.createTempDir(); File tempMainDescriptor = null; try { tempMainDescriptor = File.createTempFile("main", "descriptor", tmpDir); Files.write(mainDescriptor.getContent(), tempMainDescriptor, StandardCharsets.UTF_8); for (SourceFile secondaryFile : workflowVersion.getSourceFiles()) { if (!secondaryFile.getPath().equals(workflowVersion.getWorkflowPath())) { secondaryDescContent.put(secondaryFile.getPath(),secondaryFile.getContent()); } } } catch (IOException e) { e.printStackTrace(); } String result; if(workflow.getDescriptorType().equals("wdl")) { result = getContentWDL(tempMainDescriptor, Type.TOOLS); } else{ result = getContentCWL(descFileContent, secondaryDescContent, Type.TOOLS); } return result; } return null; }
Source:
public void testPageSourceLazyLoad() throws Exception { Block inputBlock = BlockAssertions.createLongsBlock(0, 10_000); Page input = new Page(inputBlock, new LazyBlock(100, lazyBlock -> { throw new AssertionError("Lazy block should not be loaded"); })); DriverContext driverContext = newDriverContext(); List<RowExpression> projections = ImmutableList.of(field(0, VARCHAR)); Supplier<CursorProcessor> cursorProcessor = expressionCompiler.compileCursorProcessor(Optional.empty(), projections, "key"); PageProcessor pageProcessor = new PageProcessor(Optional.of(new SelectAllFilter()), ImmutableList.of(new LazyPagePageProjection())); ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory factory = new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory( 0, new PlanNodeId("test"), new PlanNodeId("0"), (session, split, columns) -> new SinglePagePageSource(input), cursorProcessor, () -> pageProcessor, ImmutableList.of(), ImmutableList.of(BIGINT)); SourceOperator operator = factory.createOperator(driverContext); operator.addSplit(new Split(new ConnectorId("test"), TestingTransactionHandle.create(), TestingSplit.createLocalSplit())); operator.noMoreSplits(); MaterializedResult expected = toMaterializedResult(driverContext.getSession(), ImmutableList.of(BIGINT), ImmutableList.of(new Page(inputBlock))); MaterializedResult actual = toMaterializedResult(driverContext.getSession(), ImmutableList.of(BIGINT), toPages(operator)); assertEquals(actual.getRowCount(), expected.getRowCount()); assertEquals(actual, expected); }

Target:
public void testPageSourceLazyLoad() throws Exception { Block inputBlock = BlockAssertions.createLongSequenceBlock(0, 100); Page input = new Page(100, inputBlock, new LazyBlock(100, lazyBlock -> { throw new AssertionError("Lazy block should not be loaded"); })); DriverContext driverContext = newDriverContext(); List<RowExpression> projections = ImmutableList.of(field(0, VARCHAR)); Supplier<CursorProcessor> cursorProcessor = expressionCompiler.compileCursorProcessor(Optional.empty(), projections, "key"); PageProcessor pageProcessor = new PageProcessor(Optional.of(new SelectAllFilter()), ImmutableList.of(new LazyPagePageProjection())); ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory factory = new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory( 0, new PlanNodeId("test"), new PlanNodeId("0"), (session, split, columns) -> new SinglePagePageSource(input), cursorProcessor, () -> pageProcessor, ImmutableList.of(), ImmutableList.of(BIGINT)); SourceOperator operator = factory.createOperator(driverContext); operator.addSplit(new Split(new ConnectorId("test"), TestingTransactionHandle.create(), TestingSplit.createLocalSplit())); operator.noMoreSplits(); MaterializedResult expected = toMaterializedResult(driverContext.getSession(), ImmutableList.of(BIGINT), ImmutableList.of(new Page(inputBlock))); MaterializedResult actual = toMaterializedResult(driverContext.getSession(), ImmutableList.of(BIGINT), toPages(operator)); assertEquals(actual.getRowCount(), expected.getRowCount()); assertEquals(actual, expected); }
Source:
public void testReserveFormSuccess() { MockHttpServletRequestBuilder getRequest = MockMvcRequestBuilders.get( "/tours/123/reserve").param("form", ""); when(reserveTourHelper.findTourDetail(any(), eq("123"), any())) .thenReturn(new TourDetailOutput()); try { ResultActions results = mockMvc.perform(getRequest); results.andExpect(status().isOk()); results.andExpect(view().name("reservetour/reserveForm")); results.andExpect(model().attribute("output", notNullValue())); return; } catch (Exception e) { e.printStackTrace(); } fail(); }

Target:
public void testReserveFormSuccess() { MockHttpServletRequestBuilder getRequest = MockMvcRequestBuilders.get( "/tours/123/reserve").param("form", "").with(user(userDetails)); when(reserveTourHelper.findTourDetail(any(ReservationUserDetails.class), eq("123"), any(ReserveTourForm.class))).thenReturn( new TourDetailOutput()); try { ResultActions results = mockMvc.perform(getRequest); results.andExpect(status().isOk()); results.andExpect(view().name("reservetour/reserveForm")); results.andExpect(model().attribute("output", notNullValue())); return; } catch (Exception e) { e.printStackTrace(); } fail(); }
Source:
private Event processCustomEvent(ReadContext readContext) { Configuration conf = Configuration.defaultConfiguration(); Event event = new Event(attributesSize); Object[] data = event.getData(); Object childObject = readContext.read(DEFAULT_ENCLOSING_ELEMENT); readContext = JsonPath.using(conf).parse(childObject); for (MappingPositionData mappingPositionData : this.mappingPositions) { int position = mappingPositionData.getPosition(); Object mappedValue; try { mappedValue = readContext.read(mappingPositionData.getMapping()); if (mappedValue == null) { data[position] = null; } else { data[position] = attributeConverter.getPropertyValue(mappedValue.toString(), streamAttributes.get(position).getType()); } } catch (PathNotFoundException e) { if (failOnMissingAttribute) { throw new ExecutionPlanRuntimeException("Json message " + childObject.toString() + " contains missing attributes. Hence dropping the message."); } data[position] = null; } } return event; }

Target:
private Event processCustomEvent(ReadContext readContext) { Configuration conf = Configuration.defaultConfiguration(); Event event = new Event(attributesSize); Object[] data = event.getData(); Object childObject = readContext.read(DEFAULT_ENCLOSING_ELEMENT); readContext = JsonPath.using(conf).parse(childObject); for (MappingPositionData mappingPositionData : this.mappingPositions) { int position = mappingPositionData.getPosition(); Object mappedValue; try { mappedValue = readContext.read(mappingPositionData.getMapping()); if (mappedValue == null) { data[position] = null; } else { data[position] = attributeConverter.getPropertyValue(mappedValue.toString(), streamAttributes.get(position).getType()); } } catch (PathNotFoundException e) { if (failOnMissingAttribute) { log.error("Json message " + childObject.toString() + " contains missing attributes. Hence dropping the message."); return null; } data[position] = null; } } return event; }
Source:
private VelocityContext buildContext(String[] inputStrs) { VelocityContext context = new VelocityContext(); String[][] tokens = new String[inputStrs.length][]; boolean isFloatingPoint = false; for (int i = 0; i < inputStrs.length; i++) { tokens[i] = inputStrs[i].trim().split("\\s+"); for (int j = 0; j < tokens[i].length; j++) { try { Long.valueOf(tokens[i][0]); } catch (NumberFormatException ex) { isFloatingPoint = true; } } } Map<Object, TemplateVertex> vertexMap = new LinkedHashMap<>(inputStrs.length); for (int i = 0; i < inputStrs.length; i++) { Object id = readId(tokens[i][0], isFloatingPoint); TemplateVertex vertex = vertexMap.get(id); if (vertex == null) { vertex = new TemplateVertex(id); vertexMap.put(id, vertex); } if (tokens[i].length > 1) { for (int j = 1; j < tokens[i].length; j++) { Object nbrId = readId(tokens[i][j], isFloatingPoint); if (!vertexMap.containsKey(nbrId)) { vertexMap.put(nbrId, new TemplateVertex(nbrId)); } vertex.addNeighbor(nbrId); } } } if (isFloatingPoint) { context.put("vertexIdClass", DoubleWritable.class.getSimpleName()); } else { context.put("vertexIdClass", LongWritable.class.getSimpleName()); } context.put("vertices", vertexMap); return context; }

Target:
private VelocityContext buildContext(String[] inputStrs) { VelocityContext context = new VelocityContext(); String[][] tokens = new String[inputStrs.length][]; boolean isFloatingPoint = false; for (int i = 0; i < inputStrs.length; i++) { tokens[i] = inputStrs[i].trim().split("\\s+"); for (int j = 0; j < tokens[i].length; j++) { try { Long.valueOf(tokens[i][0]); } catch (NumberFormatException ex) { isFloatingPoint = true; } } } Map<Object, TemplateVertex> vertexMap = new LinkedHashMap<>(inputStrs.length); for (int i = 0; i < inputStrs.length; i++) { Object id = readId(tokens[i][0], isFloatingPoint); TemplateVertex vertex = vertexMap.get(id); if (vertex == null) { vertex = new TemplateVertex(id); vertexMap.put(id, vertex); } if (tokens[i].length > 1) { for (int j = 1; j < tokens[i].length; j++) { Object nbrId = readId(tokens[i][j], isFloatingPoint); if (!vertexMap.containsKey(nbrId)) { vertexMap.put(nbrId, new TemplateVertex(nbrId)); } vertex.addNeighbor(nbrId); } } } context.put("vertexIdClass", (isFloatingPoint ? DoubleWritable.class.getSimpleName() : LongWritable.class.getSimpleName())); context.put("vertices", vertexMap); return context; }
Source:
private void preprocessParameters(StudentProfileAttributes studentProfile) { studentProfile.shortName = StringHelper.trimIfNotNull(studentProfile.shortName); studentProfile.email = StringHelper.trimIfNotNull(studentProfile.email); studentProfile.gender = Gender.valueOf(StringHelper.trimIfNotNull(studentProfile.gender.name())); studentProfile.nationality = StringHelper.trimIfNotNull(studentProfile.nationality); studentProfile.institute = StringHelper.trimIfNotNull(studentProfile.institute); studentProfile.moreInfo = StringHelper.trimIfNotNull(studentProfile.moreInfo); }

Target:
private void preprocessParameters(StudentProfileAttributes studentProfile) { studentProfile.shortName = StringHelper.trimIfNotNull(studentProfile.shortName); studentProfile.email = StringHelper.trimIfNotNull(studentProfile.email); studentProfile.nationality = StringHelper.trimIfNotNull(studentProfile.nationality); studentProfile.institute = StringHelper.trimIfNotNull(studentProfile.institute); studentProfile.moreInfo = StringHelper.trimIfNotNull(studentProfile.moreInfo); }
Source:
private void setFlowId(final JSONObject metadata) { if (metadata.optString("flow_id") == null || "".equals(metadata.optString("flow_id"))) { metadata.put("flow_id", FlowIdUtils.peek()); } }

Target:
private void setFlowId(final JSONObject metadata) { if ("".equals(metadata.optString("flow_id"))) { metadata.put("flow_id", FlowIdUtils.peek()); } }
Source:
public void execute() { String columnGroup = model.getColumns().get(columnIndex).getHeaderMetaData().get(1).getColumnGroup(); int columnPosition = isRight ? columnIndex + 1 : columnIndex; String columnTitle = columnGroup.toUpperCase() + "-" + (model.getGroupSize(columnGroup) +1); model.insertNewColumn(columnPosition, getScenarioGridColumn(columnId, columnTitle, columnGroup, scenarioGridPanel, scenarioGridLayer)); }

Target:
public void execute() { String columnGroup = model.getColumns().get(columnIndex).getHeaderMetaData().get(1).getColumnGroup(); int columnPosition = isRight ? columnIndex + 1 : columnIndex; FactMappingType factMappingType = FactMappingType.valueOf(columnGroup.toUpperCase()); String columnTitle = FactMapping.getPlaceHolder(factMappingType, (int) (model.getGroupSize(columnGroup) + 1)); model.insertNewColumn(columnPosition, getScenarioGridColumn(columnId, columnTitle, columnGroup, scenarioGridPanel, scenarioGridLayer)); }
Source:
private String getDirectoryInclusionExclusionSelection() { String selection; String includeSelection = getDirectoryInclusionSelection(); String excludeSelection = getDirectoryExclusionSelection(); if (includeSelection != null && excludeSelection != null) { selection = "((" + includeSelection + ") AND (" + excludeSelection + "))"; } else if (includeSelection != null) { selection = "(" + includeSelection + ")"; } else if (excludeSelection != null) { selection = "(" + excludeSelection + ")"; } else { selection = null; } return selection; }

Target:
private String getDirectoryInclusionExclusionSelection() { String selection; String includeSelection = getDirectoryInclusionSelection(); String excludeSelection = getDirectoryExclusionSelection(); if (includeSelection != null && excludeSelection != null) { selection = "(" + includeSelection + ") AND (" + excludeSelection + ")"; } else if (includeSelection != null) { selection = includeSelection; } else if (excludeSelection != null) { selection = excludeSelection; } else { return null; } return "(" + selection + ")"; }
Source:
private void enableHaReservationCheck() { if (Config.<Boolean>getValue(ConfigValues.EnableVdsLoadBalancing)) { log.info("Start HA Reservation check"); Integer interval = Config.<Integer> getValue(ConfigValues.VdsHaReservationIntervalInMinutes); executor.scheduleWithFixedDelay(() -> performHaResevationCheck(), interval, interval, TimeUnit.MINUTES); log.info("Finished HA Reservation check"); } }

Target:
private void enableHaReservationCheck() { if (Config.<Boolean>getValue(ConfigValues.EnableVdsLoadBalancing)) { log.info("Start HA Reservation check"); Integer interval = Config.<Integer> getValue(ConfigValues.VdsHaReservationIntervalInMinutes); executor.scheduleWithFixedDelay(this::performHaResevationCheck, interval, interval, TimeUnit.MINUTES); log.info("Finished HA Reservation check"); } }
Source:
private void initMetrics() { SpawnBalancer.makeGauge("minDiskPercentUsedDiff", () -> minDiskPercentUsedDiff); SpawnBalancer.makeGauge("maxDiskPercentUsedDiff", () -> maxDiskPercentUsedDiff); SpawnBalancer.makeGauge("avgDiskPercentUsedDiff", () -> avgDiskPercentUsedDiff); SpawnBalancer.makeGauge("minTaskPercentDiff", () -> minTaskPercentDiff); SpawnBalancer.makeGauge("minTaskPercentDiff", () -> minTaskPercentDiff); SpawnBalancer.makeGauge("minTaskPercentDiff", () -> minTaskPercentDiff); }

Target:
private void initMetrics() { SpawnBalancer.makeGauge("minDiskPercentUsedDiff", () -> minDiskPercentUsedDiff); SpawnBalancer.makeGauge("maxDiskPercentUsedDiff", () -> maxDiskPercentUsedDiff); SpawnBalancer.makeGauge("avgDiskPercentUsedDiff", () -> avgDiskPercentUsedDiff); SpawnBalancer.makeGauge("minTaskPercentDiff", () -> minTaskPercentDiff); SpawnBalancer.makeGauge("maxTaskPercentDiff", () -> maxTaskPercentDiff); SpawnBalancer.makeGauge("avgTaskPercentDiff", () -> avgTaskPercentDiff); }
Source:
public MetadataInfo(String id, URL url, long bytes, String type, int pixelsHeight, int pixelsWidth) { this.id = id; this.url = url; this.bytes = bytes; this.type = type; if (pixelsHeight < 0 || pixelsHeight > MAX_HEIGHT) { throw new IllegalArgumentException("Image height value must be between 0 and 65536."); } if (pixelsWidth < 0 || pixelsWidth > MAX_HEIGHT) { throw new IllegalArgumentException("Image width value must be between 0 and 65536."); } this.height = pixelsHeight; this.width = pixelsWidth; }

Target:
public MetadataInfo(String id, URL url, long bytes, String type, int pixelsHeight, int pixelsWidth) { this.id = StringUtils.requireNotNullNorEmpty(id, "ID is required."); this.url = url; if (bytes <= 0) { throw new IllegalArgumentException("Number of bytes MUST be greater than 0."); } this.bytes = UInt32.from(bytes); this.type = StringUtils.requireNotNullNorEmpty(type, "Content Type is required."); if (pixelsHeight < 0 || pixelsHeight > MAX_HEIGHT) { throw new IllegalArgumentException("Image height value must be between 0 and 65536."); } if (pixelsWidth < 0 || pixelsWidth > MAX_WIDTH) { throw new IllegalArgumentException("Image width value must be between 0 and 65536."); } this.height = UInt16.from(pixelsHeight); this.width = UInt16.from(pixelsWidth); }
Source:
public void testRequestInterceptorsThroughBuilder() throws Exception { InterceptorCallCounter interceptorCallCounter = new InterceptorCallCounter(); TestReplicationListener listener = new TestReplicationListener(); ReplicatorBuilder replicatorBuilder = ReplicatorBuilder.pull() .to(this.datastore) .from(this.remoteDb.couchClient.getRootUri()) .addRequestInterceptors(interceptorCallCounter) .addResponseInterceptors(interceptorCallCounter); if (TestOptions.COOKIE_AUTH) { CookieInterceptor ci = new CookieInterceptor(this.remoteDb.couchClient.getRootUri().toString(), TestOptions.COUCH_USERNAME, TestOptions.COUCH_PASSWORD); replicatorBuilder.addRequestInterceptors(ci); replicatorBuilder.addResponseInterceptors(ci); } Replicator replicator = replicatorBuilder.build(); replicator.getEventBus().register(listener); replicator.start(); while(replicator.getState() != Replicator.State.COMPLETE && replicator.getState() != Replicator.State.ERROR) { Thread.sleep(50); } Assert.assertEquals(Replicator.State.COMPLETE, replicator.getState()); listener.assertReplicationCompletedOrThrow(); Assert.assertTrue(interceptorCallCounter.interceptorResponseTimesCalled >= 1); Assert.assertTrue(interceptorCallCounter.interceptorRequestTimesCalled >= 1); }

Target:
public void testRequestInterceptorsThroughBuilder() throws Exception { InterceptorCallCounter interceptorCallCounter = new InterceptorCallCounter(); TestReplicationListener listener = new TestReplicationListener(); ReplicatorBuilder replicatorBuilder = ReplicatorBuilder.pull() .to(this.datastore) .from(this.remoteDb.couchClient.getRootUri()) .addRequestInterceptors(interceptorCallCounter) .addResponseInterceptors(interceptorCallCounter); if (TestOptions.COOKIE_AUTH) { CookieInterceptor ci = new CookieInterceptor(TestOptions.COUCH_USERNAME, TestOptions.COUCH_PASSWORD, this.remoteDb.couchClient.getRootUri().toString()); replicatorBuilder.addRequestInterceptors(ci); replicatorBuilder.addResponseInterceptors(ci); } Replicator replicator = replicatorBuilder.build(); replicator.getEventBus().register(listener); replicator.start(); while(replicator.getState() != Replicator.State.COMPLETE && replicator.getState() != Replicator.State.ERROR) { Thread.sleep(50); } Assert.assertEquals(Replicator.State.COMPLETE, replicator.getState()); listener.assertReplicationCompletedOrThrow(); Assert.assertTrue(interceptorCallCounter.interceptorResponseTimesCalled >= 1); Assert.assertTrue(interceptorCallCounter.interceptorRequestTimesCalled >= 1); }
Source:
public static String of(String type, String body){ return new ParsedNotificationsInfos(type, body).toJSON(); }

Target:
public static NotificationValue of(String type, String body) { return new ParsedNotificationsInfos(type, body).notification; }
Source:
public void testFindDuplicateProperties() { initService(); List<DataSetPropertyDTO> input = getDatasetPropertiesDTO(); DataSetPropertyDTO duplicateProperty = input.get(0); input.add(duplicateProperty); List<DataSetPropertyDTO> properties = datasetService.findDuplicateProperties(input); Assert.assertFalse(properties.isEmpty()); Assert.assertEquals(properties.get(0), duplicateProperty); }

Target:
public void testFindDuplicateProperties() { initService(); List<DataSetPropertyDTO> input = getDatasetPropertiesDTO(); DataSetPropertyDTO duplicateProperty = input.get(0); input.add(duplicateProperty); List<DataSetPropertyDTO> properties = datasetService.findDuplicateProperties(input); assertFalse(properties.isEmpty()); assertEquals(properties.get(0), duplicateProperty); }
Source:
protected Invocation buildClientRequest(String url, Collection<WebServiceCredential> creds) throws URISyntaxException { if (StringUtils.equals(url, "<LINK_0>")) { return allowClientToFailWithPoorlyFormatedUrl(url); } else { return super.buildClientRequest(url, creds); } }

Target:
protected Invocation buildClientRequest(String url, Collection<WebServiceCredential> creds) throws URISyntaxException { if (forceUseOfRealClientToTestAttachmentUrls) { return buildClienRequesttWithRealClientObject(url); } else { return super.buildClientRequest(url, creds); } }
Source:
public ChefClient chefClientload(String chefClientName, String token) throws ChefClientExecutionException, EntityNotFoundException { ChefClient chefClient = new ChefClient(); try { chefClient = chefClientDao.getChefClient(chefClientName, token); } catch (EntityNotFoundException e) { String men = "The node is not in the chef-server: " + chefClientName + " : " + e.getMessage(); log.warn ("The node is not in the chef-server."); throw new EntityNotFoundException(ChefClient.class, men, chefClientName); } catch (Exception e) { String message = " An error ocurred invoing the Chef server to load ChefClient named " + chefClientName; log.info(message); throw new ChefClientExecutionException(message, e); } return chefClient; }

Target:
public ChefClient chefClientload(String chefClientName, String token) throws ChefClientExecutionException, EntityNotFoundException { ChefClient chefClient = new ChefClient(); try { chefClient = chefClientDao.getChefClient(chefClientName, token); } catch (EntityNotFoundException e) { String men = "The node is not in the chef-server: " + chefClientName + " : " + e.getMessage(); log.warn (men); throw new EntityNotFoundException(ChefClient.class, men, chefClientName); } catch (Exception e) { String message = " An error ocurred invoing the Chef server to load ChefClient named " + chefClientName; log.info(message); throw new ChefClientExecutionException(message, e); } return chefClient; }
Source:
public void testZookeeperSessionExpiry() throws InterruptedException { String testCluster = "testDeleteTaskWithPrefix"; String connectorType = "connectorType"; Duration timeout = Duration.ofMinutes(1); ZkClientInterceptingAdapter adapter = createInterceptingZkAdapter(testCluster, 5000); adapter.connect(); DatastreamTaskImpl task = new DatastreamTaskImpl(); task.setId("3"); task.setConnectorType(connectorType); task.setZkAdapter(adapter); List<DatastreamTask> tasks = new ArrayList<>(); tasks.add(task); updateInstanceAssignment(adapter, adapter.getInstanceName(), tasks); LOG.info("Acquire from instance1 should succeed"); Assert.assertTrue(expectException(() -> task.acquire(timeout), false)); simulateSessionExpiration(adapter); Thread.sleep(5000); Assert.assertTrue(adapter.getZkStateChangeListener().sessionExpired); }

Target:
public void testZookeeperSessionExpiry() throws InterruptedException { String testCluster = "testDeleteTaskWithPrefix"; String connectorType = "connectorType"; Duration timeout = Duration.ofMinutes(1); ZkClientInterceptingAdapter adapter = createInterceptingZkAdapter(testCluster, 5000); adapter.connect(); DatastreamTaskImpl task = new DatastreamTaskImpl(); task.setId("3"); task.setConnectorType(connectorType); task.setZkAdapter(adapter); List<DatastreamTask> tasks = Collections.singletonList(task); updateInstanceAssignment(adapter, adapter.getInstanceName(), tasks); LOG.info("Acquire from instance1 should succeed"); Assert.assertTrue(expectException(() -> task.acquire(timeout), false)); simulateSessionExpiration(adapter); Thread.sleep(5000); Mockito.verify(adapter, Mockito.times(1)).onSessionExpired(); }
Source:
public SolUiSlider(Rectangle sliderRectangle, String text, float startingValue, int trimAt) { rectangle = sliderRectangle; this.text = text; if (startingValue > 1.0f) { value = 1.0f; } else if (startingValue < 0.0f) { value = 0.0f; } else { value = startingValue; } this.trimAt = trimAt; }

Target:
public SolUiSlider(Rectangle sliderRectangle, String text, float startingValue, int trimAt) { rectangle = sliderRectangle; value = SolMath.clamp(value); this.text = text; this.trimAt = trimAt; }
Source:
public static Message ofLocalized(@Nonnull final String id, @Nonnull final String... parameters) { return Message.of(MessagePart.of(id, parameters)); }

Target:
public static Message ofLocalized(@Nonnull final String id, @Nonnull final String... parameters) { return Message.of(MessagePart.ofLocalized(id, parameters)); }
Source:
private void runFafReplayFile(Path path) throws IOException { byte[] rawReplayBytes = replayFileReader.readRawReplayData(path); Path tempSupComReplayFile = preferencesService.getCacheDirectory().resolve(TEMP_SCFA_REPLAY_FILE_NAME); createDirectories(tempSupComReplayFile.getParent()); Files.copy(new ByteArrayInputStream(rawReplayBytes), tempSupComReplayFile, StandardCopyOption.REPLACE_EXISTING); LocalReplayInfo replayInfo = replayFileReader.parseMetaData(path); String gameType = replayInfo.getFeaturedMod(); Integer replayId = replayInfo.getUid(); Map<String, Integer> modVersions = replayInfo.getFeaturedModVersions(); String mapName = replayInfo.getMapname(); if (gameType.equals("coop")) { mapName = parseMapFolderName(rawReplayBytes); } if (StringUtils.equalsIgnoreCase(mapName, "None")) { String maybeMapGen = parseMapFolderName(rawReplayBytes); if (mapGeneratorService.isGeneratedMap(maybeMapGen)) { mapName = maybeMapGen; } } Set<String> simMods = replayInfo.getSimMods() != null ? replayInfo.getSimMods().keySet() : emptySet(); Integer version = parseSupComVersion(rawReplayBytes); gameService.runWithReplay(tempSupComReplayFile, replayId, gameType, version, modVersions, simMods, mapName); }

Target:
private void runFafReplayFile(Path path) throws IOException { byte[] rawReplayBytes = replayFileReader.readRawReplayData(path); Path tempSupComReplayFile = preferencesService.getCacheDirectory().resolve(TEMP_SCFA_REPLAY_FILE_NAME); createDirectories(tempSupComReplayFile.getParent()); Files.copy(new ByteArrayInputStream(rawReplayBytes), tempSupComReplayFile, StandardCopyOption.REPLACE_EXISTING); LocalReplayInfo replayInfo = replayFileReader.parseMetaData(path); String gameType = replayInfo.getFeaturedMod(); Integer replayId = replayInfo.getUid(); Map<String, Integer> modVersions = replayInfo.getFeaturedModVersions(); String mapName = parseMapFolderName(rawReplayBytes); Set<String> simMods = replayInfo.getSimMods() != null ? replayInfo.getSimMods().keySet() : emptySet(); Integer version = parseSupComVersion(rawReplayBytes); gameService.runWithReplay(tempSupComReplayFile, replayId, gameType, version, modVersions, simMods, mapName); }
Source:
public void dependentProcessSucceeded() throws Exception { bundles[0].setProcessValidity("2014-06-01T04:00Z","2014-06-01T04:02Z"); bundles[0].submitAndScheduleAllFeeds(); bundles[0].submitAndScheduleProcess(); InstanceUtil.waitTillInstancesAreCreated(cluster1, bundles[0].getProcessData(), 0); OozieUtil.createMissingDependencies(cluster1, ENTITY_TYPE.PROCESS, bundles[0].getProcessName(), 0, 0); InstanceUtil.waitForBundleToReachState(cluster1, bundles[0].getProcessName(), Job.Status.SUCCEEDED, 20); FeedMerlin feed = new FeedMerlin(bundles[0].getDataSets().get(0)); feed.addProperty("someProp","someVal"); AssertUtil.assertSucceeded(prism.getFeedHelper().update(feed.toString(), feed.toString())); Assert.assertEquals(OozieUtil.getNumberOfBundle(prism, ENTITY_TYPE.FEED, Util.readEntityName(feed .toString() )),2); }

Target:
public void dependentProcessSucceeded() throws Exception { bundles[0].setProcessValidity("2014-06-01T04:00Z","2014-06-01T04:02Z"); bundles[0].submitAndScheduleAllFeeds(); bundles[0].submitAndScheduleProcess(); InstanceUtil.waitTillInstancesAreCreated(cluster1, bundles[0].getProcessData(), 0); OozieUtil.createMissingDependencies(cluster1, ENTITY_TYPE.PROCESS, bundles[0].getProcessName(), 0, 0); InstanceUtil.waitForBundleToReachState(cluster1, bundles[0].getProcessName(), Job.Status.SUCCEEDED, 20); FeedMerlin feed = new FeedMerlin(bundles[0].getDataSets().get(0)); feed.addProperty("someProp","someVal"); AssertUtil.assertSucceeded(prism.getFeedHelper().update(feed.toString(), feed.toString())); Assert.assertEquals(OozieUtil.getNumberOfBundle(prism, ENTITY_TYPE.FEED, feed.getName()),2); }
Source:
private C getConf(C conf) { Preconditions.checkNotNull(auths, "Authorizations cannot be null"); conf.setInfer(useInference); conf.setTablePrefix(prefix); conf.setInt("sc.cloudbase.numPartitions", 3); conf.set(RdfCloudTripleStoreConfiguration.CONF_QUERY_AUTH, auths); if (visibilities != null) { conf.set(RdfCloudTripleStoreConfiguration.CONF_CV, visibilities); } conf.setDisplayQueryPlan(displayPlan); return conf; }

Target:
private C getConf(C conf) { conf.setInfer(useInference); conf.setTablePrefix(prefix); conf.setInt("sc.cloudbase.numPartitions", 3); conf.setAuths(auths); if (visibilities != null) { conf.setCv(visibilities); } conf.setDisplayQueryPlan(displayPlan); return conf; }
Source:
private <T extends SectionBreakpoint> void saveBreakpoint(final T bId, final Map<FullSourceCoordinate, BreakpointEnabling<T>> breakpoints) { FullSourceCoordinate coord = bId.getCoordinate(); BreakpointEnabling<T> existingBP = breakpoints.get(coord); if (existingBP == null) { WebDebugger.log("SetSectionBreakpoint: " + bId); existingBP = new BreakpointEnabling<T>(bId); breakpoints.put(coord, existingBP); } else { existingBP.setEnabled(bId.isEnabled()); } }

Target:
private <T extends SectionBreakpoint> void saveBreakpoint(final T bId, final Map<FullSourceCoordinate, BreakpointEnabling<T>> breakpoints) { FullSourceCoordinate coord = bId.getCoordinate(); BreakpointEnabling<T> existingBP = breakpoints.get(coord); if (existingBP == null) { existingBP = new BreakpointEnabling<T>(bId); breakpoints.put(coord, existingBP); } else { existingBP.setEnabled(bId.isEnabled()); } }
Source:
private String parseToken(InputStream inputStream) throws IOException { if (identityPoolCredentialSource.credentialFormatType == CredentialFormatType.TEXT) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder token = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { token.append(line); } return token.toString(); } JsonFactory jsonFactory = OAuth2Utils.JSON_FACTORY; JsonObjectParser parser = new JsonObjectParser(jsonFactory); GenericJson fileContents = parser.parseAndClose(inputStream, OAuth2Utils.UTF_8, GenericJson.class); if (!fileContents.containsKey(identityPoolCredentialSource.subjectTokenFieldName)) { throw new IOException("Invalid subject token field name. No subject token was found."); } return (String) fileContents.get(identityPoolCredentialSource.subjectTokenFieldName); }

Target:
private String parseToken(InputStream inputStream) throws IOException { if (identityPoolCredentialSource.credentialFormatType == CredentialFormatType.TEXT) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); return CharStreams.toString(reader); } JsonFactory jsonFactory = OAuth2Utils.JSON_FACTORY; JsonObjectParser parser = new JsonObjectParser(jsonFactory); GenericJson fileContents = parser.parseAndClose(inputStream, StandardCharsets.UTF_8, GenericJson.class); if (!fileContents.containsKey(identityPoolCredentialSource.subjectTokenFieldName)) { throw new IOException("Invalid subject token field name. No subject token was found."); } return (String) fileContents.get(identityPoolCredentialSource.subjectTokenFieldName); }