auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void updateRoutes() { if(this.service == null && !routes.isEmpty()) { List<IRoute> oldRoutes = new ArrayList<>(this.routes); this.routes.clear(); firePropertyChange(PROPERTY_ROUTES, oldRoutes, this.routes); firePropertyChange(PROPERTY_ROUTE, this.route, null); } else if(this.service != null) { List<IRoute> oldRoutes = new ArrayList<>(this.routes); this.routes.clear(); List<IRoute> newRoutes = routeMap.get(this.service.getProject()); if(newRoutes != null) { this.routes.addAll(newRoutes); } IRoute oldRoute = this.route; firePropertyChange(PROPERTY_ROUTES, oldRoutes, this.routes); updateRoute(oldRoute); } }

Target:
protected void updateRoutes() { IRoute routeToReset = null; if(this.service == null && !routes.isEmpty()) { List<IRoute> oldRoutes = new ArrayList<>(this.routes); this.routes.clear(); firePropertyChange(PROPERTY_ROUTES, oldRoutes, this.routes); routeToReset = null; } else if(this.service != null) { List<IRoute> oldRoutes = new ArrayList<>(this.routes); this.routes.clear(); List<IRoute> newRoutes = routeMap.get(this.service.getProject()); if(newRoutes != null) { this.routes.addAll(newRoutes); } routeToReset = this.route; firePropertyChange(PROPERTY_ROUTES, oldRoutes, this.routes); } else { return; } setRoute(routeToReset); }
Source:
private boolean checkStoragePoolMatchQuota(QuotaConsumptionParametersWrapper parameters, QuotaConsumptionParameter param) { Quota quota = param.getQuota(); if (param instanceof QuotaStorageConsumptionParameter) { QuotaStorageConsumptionParameter paramstorage = (QuotaStorageConsumptionParameter) param; if (paramstorage.getStorageDomainId() == null) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); log.errorFormat("Quota storage parameters from command: {0} are missing storage domain id", parameters.getAuditLogable().getClass().getName()); return false; } boolean storageDomainInQuota = false; if(quota.getGlobalQuotaStorage() != null) { storageDomainInQuota = quota.getGlobalQuotaStorage().getStorageId().equals(paramstorage.getStorageDomainId()); } else { for (QuotaStorage quotaStorage : quota.getQuotaStorages()) { if (quotaStorage.getStorageId().equals(paramstorage.getStorageDomainId())) { storageDomainInQuota = true; break; } } } if (!storageDomainInQuota) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); log.errorFormat("Quota storage parameters from command: {0}. Storage domain does not match quota", parameters.getAuditLogable().getClass().getName()); return false; } } return true; }

Target:
private boolean checkStoragePoolMatchQuota(QuotaConsumptionParametersWrapper parameters, QuotaConsumptionParameter param) { Quota quota = param.getQuota(); QuotaStorageConsumptionParameter paramstorage = (QuotaStorageConsumptionParameter) param; if (paramstorage.getStorageDomainId() == null) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); log.errorFormat("Quota storage parameters from command: {0} are missing storage domain id", parameters.getAuditLogable().getClass().getName()); return false; } boolean storageDomainInQuota = false; if(quota.getGlobalQuotaStorage() != null) { storageDomainInQuota = quota.getGlobalQuotaStorage().getStorageId().equals(paramstorage.getStorageDomainId()); } else { for (QuotaStorage quotaStorage : quota.getQuotaStorages()) { if (quotaStorage.getStorageId().equals(paramstorage.getStorageDomainId())) { storageDomainInQuota = true; break; } } } if (!storageDomainInQuota) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); log.errorFormat("Quota storage parameters from command: {0}. Storage domain does not match quota", parameters.getAuditLogable().getClass().getName()); return false; } return true; }
Source:
protected <D> void startLoad(DataSource<D> dataSource, int loaderId, DataConsumer<D> consumer) { getActivity().getSupportLoaderManager().destroyLoader(loaderId); getActivity().getSupportLoaderManager() .initLoader(loaderId, null, new DataLoader<D>(getActivity(), dataSource, consumer)).forceLoad(); }

Target:
protected <D> void startLoad(DataSource<D> dataSource, int loaderId, DataConsumer<D> consumer) { getActivity().getSupportLoaderManager() .initLoader(loaderId, null, new DataLoader<D>(getActivity(), dataSource, consumer)).forceLoad(); }
Source:
public static void init() throws FileNotFoundException, IOException, DBException { Properties props = new Properties(); props.load(new FileReader("src/test/resources/workload_rest")); rc.setProperties(props); rc.init(); ByteArrayOutputStream out = new ByteArrayOutputStream(SUCCESS_RESPONSE.length()); GZIPOutputStream gzip = new GZIPOutputStream(out); gzip.write(SUCCESS_RESPONSE.getBytes("UTF-8")); gzip.close(); GZIP_SUCCESS_REPONSE = out.toByteArray(); while (!Utils.available(port)) { port++; } wireMockRule = new WireMockClassRule(WireMockConfiguration.wireMockConfig().port(port)); wireMockRule.start(); }

Target:
public static void init() throws IOException, DBException, ServletException, LifecycleException, InterruptedException { String webappDirLocation = IntegrationTest.class.getClassLoader().getResource("WebContent").getPath(); while (!Utils.available(port)) { port++; } tomcat = new Tomcat(); tomcat.setPort(Integer.valueOf(port)); Context context = tomcat.addWebapp("/webService", new File(webappDirLocation).getAbsolutePath()); Tomcat.addServlet(context, "jersey-container-servlet", resourceConfig()); context.addServletMapping("/rest/*", "jersey-container-servlet"); tomcat.start(); Thread.sleep(1000); Properties props = new Properties(); props.load(new FileReader(RestClientTest.class.getClassLoader().getResource("workload_rest").getPath())); props.setProperty("url.prefix", props.getProperty("url.prefix").replaceAll("PORT", port.toString())); rc.setProperties(props); rc.init(); }
Source:
public String getCheckIdUrl(CredentialsStore store) throws UnsupportedEncodingException { ModelObject context = store.getContext(); for (ContextResolver r : ExtensionList.lookup(ContextResolver.class)) { String token = r.getToken(context); if (token != null) { return Jenkins.getActiveInstance().getRootUrlFromRequest() + "/descriptorByName/" + clazz.getName() + "/checkId?provider=" + r.getClass().getName() + "&token=" + URLEncoder.encode(token, "UTF-8"); } } return Jenkins.getActiveInstance().getRootUrlFromRequest() + "/descriptorByName/" + clazz.getName() + "/checkId?provider=null&token=null"; }

Target:
public String getCheckIdUrl(CredentialsStore store) throws UnsupportedEncodingException { ModelObject context = store.getContext(); for (ContextResolver r : ExtensionList.lookup(ContextResolver.class)) { String token = r.getToken(context); if (token != null) { return Jenkins.getActiveInstance().getRootUrlFromRequest() + "/" + getDescriptorUrl() + "/checkId?provider=" + r.getClass().getName() + "&token=" + URLEncoder.encode(token, "UTF-8"); } } return Jenkins.getActiveInstance().getRootUrlFromRequest() + "/" + getDescriptorUrl() + "/checkId?provider=null&token=null"; }
Source:
private static String toHiveType(int sqlType) { switch (sqlType) { case Types.INTEGER: case Types.SMALLINT: return HIVE_TYPE_INT; case Types.VARCHAR: case Types.CHAR: case Types.LONGVARCHAR: case Types.NVARCHAR: case Types.NCHAR: case Types.LONGNVARCHAR: case Types.DATE: case Types.TIME: case Types.TIMESTAMP: case Types.CLOB: return HIVE_TYPE_STRING; case Types.NUMERIC: case Types.DECIMAL: case Types.FLOAT: case Types.DOUBLE: case Types.REAL: return HIVE_TYPE_DOUBLE; case Types.BIT: case Types.BOOLEAN: return HIVE_TYPE_BOOLEAN; case Types.TINYINT: return HIVE_TYPE_TINYINT; case Types.BIGINT: return HIVE_TYPE_BIGINT; default: return null; } }

Target:
public static String toHiveType(int sqlType) { switch (sqlType) { case Types.INTEGER: case Types.SMALLINT: return HIVE_TYPE_INT; case Types.VARCHAR: case Types.CHAR: case Types.LONGVARCHAR: case Types.NVARCHAR: case Types.NCHAR: case Types.LONGNVARCHAR: case Types.DATE: case Types.TIME: case Types.TIMESTAMP: case Types.CLOB: return HIVE_TYPE_STRING; case Types.NUMERIC: case Types.DECIMAL: case Types.FLOAT: case Types.DOUBLE: case Types.REAL: return HIVE_TYPE_DOUBLE; case Types.BIT: case Types.BOOLEAN: return HIVE_TYPE_BOOLEAN; case Types.TINYINT: return HIVE_TYPE_TINYINT; case Types.BIGINT: return HIVE_TYPE_BIGINT; default: return null; } }
Source:
Bitmap decodeAsset(Uri uri, PicassoBitmapOptions bitmapOptions) throws IOException { String path = Utils.cropScheme(uri.toString(), SCHEME_ASSETS); AssetManager assets = context.getAssets(); if (bitmapOptions != null && bitmapOptions.inJustDecodeBounds) { BitmapFactory.decodeStream(assets.open(path), null, bitmapOptions); calculateInSampleSize(bitmapOptions); } return decodeStream(assets.open(path), bitmapOptions); }

Target:
Bitmap decodeAsset(Uri uri, PicassoBitmapOptions bitmapOptions) throws IOException { String path = uri.getPath().substring(1); AssetManager assets = context.getAssets(); if (bitmapOptions != null && bitmapOptions.inJustDecodeBounds) { BitmapFactory.decodeStream(assets.open(path), null, bitmapOptions); calculateInSampleSize(bitmapOptions); } return decodeStream(assets.open(path), bitmapOptions); }
Source:
public String getTableToolContent(@ApiParam(hidden = true) @Parameter(hidden = true, name = "user")@Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkOptionalAuthRead(user, workflow); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); if (workflowVersion == null) { throw new CustomWebApplicationException("workflow version " + workflowVersionId + " does not exist", HttpStatus.SC_BAD_REQUEST); } if (workflowVersion.getToolTableJson() != null) { return workflowVersion.getToolTableJson(); } SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); if (mainDescriptor != null) { Set<SourceFile> secondaryDescContent = extractDescriptorAndSecondaryFiles(workflowVersion); LanguageHandlerInterface lInterface = LanguageHandlerFactory.getInterface(workflow.getFileType()); final String toolTableJson = lInterface.getContent(workflowVersion.getWorkflowPath(), mainDescriptor.getContent(), secondaryDescContent, LanguageHandlerInterface.Type.TOOLS, toolDAO); if (workflowVersion.isFrozen()) { LOG.warn("workflow version " + workflowVersionId + " is frozen without a mainDescriptor"); } else { workflowVersion.setToolTableJson(toolTableJson); } return toolTableJson; } return null; }

Target:
public String getTableToolContent(@ApiParam(hidden = true) @Parameter(hidden = true, name = "user")@Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkOptionalAuthRead(user, workflow); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); if (workflowVersion == null) { throw new CustomWebApplicationException("workflow version " + workflowVersionId + " does not exist", HttpStatus.SC_BAD_REQUEST); } if (workflowVersion.getToolTableJson() != null) { return workflowVersion.getToolTableJson(); } SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); if (mainDescriptor != null) { Set<SourceFile> secondaryDescContent = extractDescriptorAndSecondaryFiles(workflowVersion); LanguageHandlerInterface lInterface = LanguageHandlerFactory.getInterface(workflow.getFileType()); final String toolTableJson = lInterface.getContent(workflowVersion.getWorkflowPath(), mainDescriptor.getContent(), secondaryDescContent, LanguageHandlerInterface.Type.TOOLS, toolDAO); if (workflowVersion.isFrozen()) { LOG.warn("workflow version " + workflowVersionId + " is frozen without toolTableJson"); } else { workflowVersion.setToolTableJson(toolTableJson); } return toolTableJson; } return null; }
Source:
public void notifyCacheEntryCreated(K key, V value, Metadata metadata, boolean pre, InvocationContext ctx, FlagAffectedCommand command) { if (!cacheEntryCreatedListeners.isEmpty() && (clusteringDependentLogic == null || clusteringDependentLogic.shouldCommit(command, ctx, key, false).isLocal())) { EventImpl<K, V> e = EventImpl.createEvent(cache, CACHE_ENTRY_CREATED); configureEvent(e, key, value, metadata, pre, ctx, command, null, null); boolean isLocalNodePrimaryOwner = clusteringDependentLogic.localNodeIsPrimaryOwner(key); boolean sendEvents = !ctx.isInTxScope(); try { for (CacheEntryListenerInvocation<K, V> listener : cacheEntryCreatedListeners) { listener.invoke(e, isLocalNodePrimaryOwner); } if (sendEvents) { eventManager.sendEvents(); sendEvents = false; } } finally { if (sendEvents) { eventManager.dropEvents(); } } } }

Target:
public void notifyCacheEntryCreated(K key, V value, Metadata metadata, boolean pre, InvocationContext ctx, FlagAffectedCommand command) { if (!cacheEntryCreatedListeners.isEmpty() && clusteringDependentLogic.commitType(command, ctx, key, false).isLocal()) { EventImpl<K, V> e = EventImpl.createEvent(cache, CACHE_ENTRY_CREATED); configureEvent(e, key, value, metadata, pre, ctx, command, null, null); boolean isLocalNodePrimaryOwner = clusteringDependentLogic.localNodeIsPrimaryOwner(key); boolean sendEvents = !ctx.isInTxScope(); try { for (CacheEntryListenerInvocation<K, V> listener : cacheEntryCreatedListeners) { listener.invoke(new EventWrapper<>(e.getKey(), e), isLocalNodePrimaryOwner); } if (sendEvents) { eventManager.sendEvents(); sendEvents = false; } } finally { if (sendEvents) { eventManager.dropEvents(); } } } }
Source:
protected Set<Guid> validateAndUpdateHostsInPlacementPolicy(VmPlacementPolicy placementPolicy) { Set<Guid> hostsGuidsSet = new HashSet<Guid>(); if (placementPolicy.isSetHost()) { Host host = placementPolicy.getHost(); if(host.isSetId() || host.isSetName()) { validateParameters(placementPolicy, "host.id|name"); updateIdForSingleHost(host, hostsGuidsSet); } } if (placementPolicy.isSetHosts() && placementPolicy.getHosts().getHosts().size() > 0) { for (Host host : placementPolicy.getHosts().getHosts()) { validateParameters(host, "id|name"); updateIdForSingleHost(host, hostsGuidsSet); } } return hostsGuidsSet; }

Target:
protected Set<Guid> validateAndUpdateHostsInPlacementPolicy(VmPlacementPolicy placementPolicy) { Set<Guid> hostsGuidsSet = new HashSet<Guid>(); if (placementPolicy.isSetHost()) { Host host = placementPolicy.getHost(); if(host.isSetId() || host.isSetName()) { updateIdForSingleHost(host, hostsGuidsSet); } } if (placementPolicy.isSetHosts() && placementPolicy.getHosts().getHosts().size() > 0) { for (Host host : placementPolicy.getHosts().getHosts()) { validateParameters(host, "id|name"); updateIdForSingleHost(host, hostsGuidsSet); } } return hostsGuidsSet; }
Source:
public List<Exception> getExceptions() { List<Exception> exceptions = new ArrayList<Exception>(); Throwable currentThrowable = throwable; while (currentThrowable != null) { exceptions.add(new Exception(config, currentThrowable)); currentThrowable = currentThrowable.getCause(); } return exceptions; }

Target:
protected List<Exception> getExceptions() { List<Exception> exceptions = new ArrayList<Exception>(); Throwable currentThrowable = throwable; while (currentThrowable != null) { exceptions.add(new Exception(config, currentThrowable)); currentThrowable = currentThrowable.getCause(); } return exceptions; }
Source:
protected void populateModel(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.populateModel(context, operation, resource); final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String connectorName = address.getLastElement().getValue(); validateDuplicatedResources(context, address, connectorName, resource); }

Target:
protected void populateModel(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.populateModel(context, operation, resource); context.addStep(operation, HttpConnectorValidationStep.INSTANCE, OperationContext.Stage.MODEL); }
Source:
private SetRequestParameter getSeasonsRequest(final ClientConnection conn, final List<SeasonProfile> seasonProfileList) throws IOException { final RequestParameterFactory factory = new RequestParameterFactory(CLASS_ID, OBIS_CODE, 7); final DataObject seasonsArray = this.seasonProfileConverter.convert(seasonProfileList); LOGGER.info("getSeasonsRequest: debug output: {}", this.dlmsHelperService.getDebugInfo(seasonsArray)); final AccessResultCode accesResultCode = AccessResultCode.SUCCESS; final SetRequestParameter request = factory.createSetRequestParameter(seasonsArray); return request; }

Target:
private SetRequestParameter getSeasonsRequest(final ClientConnection conn, final List<SeasonProfile> seasonProfileList) throws IOException { final RequestParameterFactory factory = new RequestParameterFactory(CLASS_ID, OBIS_CODE, 7); final DataObject seasonsArray = this.seasonProfileConverter.convert(seasonProfileList); LOGGER.info("getSeasonsRequest: debug output: {}", this.dlmsHelperService.getDebugInfo(seasonsArray)); final SetRequestParameter request = factory.createSetRequestParameter(seasonsArray); return request; }
Source:
ElasticsearchBackendImpl(ElasticsearchClientImplementor client, GsonProvider gsonProvider, String name, ElasticsearchWorkBuilderFactory workFactory, Gson userFacingGson, ElasticsearchAnalysisDefinitionRegistry analysisDefinitionRegistry, MultiTenancyStrategy multiTenancyStrategy) { this.client = client; this.name = name; this.orchestratorFactory = new ElasticsearchWorkOrchestratorFactory( new LogErrorHandler(), client, gsonProvider, workFactory ); this.analysisDefinitionRegistry = analysisDefinitionRegistry; this.multiTenancyStrategy = multiTenancyStrategy; this.queryOrchestrator = orchestratorFactory.createStreamOrchestrator( name ); this.eventContext = EventContexts.fromBackendName( name ); this.indexingContext = new IndexingBackendContext( eventContext, workFactory, multiTenancyStrategy, orchestratorFactory ); this.searchContext = new SearchBackendContext( eventContext, workFactory, userFacingGson, ( String elasticsearchIndexName ) -> { String result = hibernateSearchIndexNamesByElasticsearchIndexNames.get( elasticsearchIndexName ); if ( result == null ) { throw log.elasticsearchResponseUnknownIndexName( elasticsearchIndexName, eventContext ); } return result; }, multiTenancyStrategy, queryOrchestrator ); }

Target:
ElasticsearchBackendImpl(ElasticsearchClientImplementor client, GsonProvider gsonProvider, String name, ElasticsearchWorkBuilderFactory workFactory, Gson userFacingGson, ElasticsearchAnalysisDefinitionRegistry analysisDefinitionRegistry, MultiTenancyStrategy multiTenancyStrategy) { this.client = client; this.name = name; this.orchestratorFactory = new ElasticsearchWorkOrchestratorFactory( new LogErrorHandler(), client, gsonProvider, workFactory ); this.userFacingGson = userFacingGson; this.analysisDefinitionRegistry = analysisDefinitionRegistry; this.multiTenancyStrategy = multiTenancyStrategy; this.queryOrchestrator = orchestratorFactory.createStreamOrchestrator( "Elasticsearch query orchestrator for backend " + name ); this.eventContext = EventContexts.fromBackendName( name ); this.indexingContext = new IndexingBackendContext( eventContext, workFactory, multiTenancyStrategy, orchestratorFactory ); this.searchContext = new SearchBackendContext( eventContext, workFactory, userFacingGson, ( String elasticsearchIndexName ) -> { String result = hibernateSearchIndexNamesByElasticsearchIndexNames.get( elasticsearchIndexName ); if ( result == null ) { throw log.elasticsearchResponseUnknownIndexName( elasticsearchIndexName, eventContext ); } return result; }, multiTenancyStrategy, queryOrchestrator ); }
Source:
public void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { leftHashTable = new TupleHashTable(getLeft().getSchema(), leftCompareColumns); rightHashTable = new TupleHashTable(getRight().getSchema(), rightCompareColumns); leftHashTable.name = "op" + getOpId() + "left"; rightHashTable.name = "op" + getOpId() + "right"; ans = new TupleBatchBuffer(getSchema()); nonBlocking = (QueryExecutionMode) execEnvVars.get(MyriaConstants.EXEC_ENV_VAR_EXECUTION_MODE) == QueryExecutionMode.NON_BLOCKING; }

Target:
public void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { leftHashTable = new TupleHashTable(getLeft().getSchema(), leftCompareColumns); rightHashTable = new TupleHashTable(getRight().getSchema(), rightCompareColumns); leftHashTable.name = "op" + getOpId() + ".left"; rightHashTable.name = "op" + getOpId() + ".right"; ans = new TupleBatchBuffer(getSchema()); nonBlocking = (QueryExecutionMode) execEnvVars.get(MyriaConstants.EXEC_ENV_VAR_EXECUTION_MODE) == QueryExecutionMode.NON_BLOCKING; }
Source:
public void setUp() { Properties prop = new Properties(); String propFileName = "config.properties"; InputStream inputStream = App.class.getClassLoader().getResourceAsStream(propFileName); if (inputStream != null) { try { prop.load(inputStream); } catch (IOException e) { System.out.println(propFileName + " was not found. Defaulting to non-interactive mode."); } String property = prop.getProperty("INTERACTIVE_MODE"); if (property.equalsIgnoreCase("YES")) { interactiveMode = true; } } }

Target:
public void setUp() { Properties prop = new Properties(); InputStream inputStream = App.class.getClassLoader().getResourceAsStream(PROP_FILE_NAME); if (inputStream != null) { try { prop.load(inputStream); } catch (IOException e) { System.out.println(PROP_FILE_NAME + " was not found. Defaulting to non-interactive mode."); } String property = prop.getProperty("INTERACTIVE_MODE"); if (property.equalsIgnoreCase("YES")) { interactiveMode = true; } } }
Source:
public void add(final int index, final T element) { try { this.origin.add(index, element); } catch (final IndexOutOfBoundsException ex) { throw new IllegalArgumentException(this.message, ex); } }

Target:
public void add(final int index, final T element) { try { this.origin.add(index, element); } catch (final IndexOutOfBoundsException ex) { throw this.wrapException(ex); } }
Source:
public void should_notGenerateOpenApi_when_EndpointIsNotUsed() throws Exception { File generatedOpenApiJson = Paths .get(baseDir, DEFAULT_CONNECT_OPENAPI_JSON_FILE).toFile(); Assert.assertFalse(generatedOpenApiJson.exists()); devModeInitializer.onStartup(classes, servletContext); Assert.assertFalse( "Should not generate OpenAPI spec if Endpoint is not used.", generatedOpenApiJson.exists()); }

Target:
public void should_notGenerateOpenApi_when_EndpointIsNotUsed() throws Exception { File generatedOpenApiJson = Paths .get(baseDir, DEFAULT_CONNECT_OPENAPI_JSON_FILE).toFile(); Assert.assertFalse(generatedOpenApiJson.exists()); devModeInitializer.onStartup(classes, servletContext); Mockito.verify(taskGenerateConnect, times(0)).execute(); }
Source:
public void retrieveApplicationsAndTheirNumbers() { ApplicationsDao dao = manager.getApplicationsDao(); List<Application> apps = dao.getApplications(new Sid("ACae6e420f425248d6a26948c17a9e2acf"), true); Assert.assertEquals(5, apps.size()); Assert.assertNotNull(searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers()); Assert.assertEquals("Three (3) numbers should be bound to this application", searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers().size(), 3); Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000004"),apps).getNumbers()); Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000005"),apps).getNumbers()); }

Target:
public void retrieveApplicationsAndTheirNumbers() { ApplicationsDao dao = manager.getApplicationsDao(); List<Application> apps = dao.getApplicationsWithNumbers(new Sid("ACae6e420f425248d6a26948c17a9e2acf")); Assert.assertEquals(5, apps.size()); Assert.assertNotNull(searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers()); Assert.assertEquals("Three (3) numbers should be bound to this application", 3, searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers().size()); Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000004"),apps).getNumbers()); Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000005"),apps).getNumbers()); }
Source:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource("schemas/common.xsd"), new ClassPathResource("schemas/adhocmanagement.xsd"), new ClassPathResource("schemas/configurationmanagement.xsd"), new ClassPathResource("schemas/deviceinstallation.xsd"), new ClassPathResource("schemas/devicemanagement.xsd"), new ClassPathResource("schemas/firmwaremanagement.xsd") }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }

Target:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource(COMMON_XSD_PATH), new ClassPathResource(ADHOC_MANAGEMENT_XSD_PATH), new ClassPathResource(CONFIGURATION_MANAGEMENT_XSD_PATH), new ClassPathResource(DEVICE_INSTALLATION_XSD_PATH), new ClassPathResource(DEVICE_MANAGEMENT_XSD_PATH), new ClassPathResource(FIRMWARE_MANAGEMENT_XSD_PATH) }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }
Source:
public CohortDefinition getPatientsInState() { InStateCohortDefinition cd = new InStateCohortDefinition(); cd.addParameter(new Parameter("states", "reporting.parameter.states", ProgramWorkflowState.class, List.class, null)); cd.addParameter(new Parameter("onOrAfter", "reporting.parameter.startDate", Date.class)); cd.addParameter(new Parameter("onOrBefore", "reporting.parameter.endDate", Date.class)); cd.addParameter(new Parameter("onDate", "reporting.parameter.date", Date.class)); return cd; }

Target:
public CohortDefinition getPatientsInState() { InStateCohortDefinition cd = new InStateCohortDefinition(); cd.addParameter(new Parameter("states", "reporting.parameter.states", ProgramWorkflowState.class, List.class, null)); cd.addParameter(new Parameter("onOrAfter", "reporting.parameter.onOrAfter", Date.class)); cd.addParameter(new Parameter("onOrBefore", "reporting.parameter.onOrBefore", Date.class)); cd.addParameter(new Parameter("onDate", "reporting.parameter.date", Date.class)); return cd; }
Source:
public ValueMatcher makeMatcher(ColumnSelectorFactory columnSelectorFactory) { final DimensionSelector dimensionSelector = columnSelectorFactory.makeDimensionSelector(dimension); if (dimensionSelector == null) { return new BooleanValueMatcher(value == null || "".equals(value)); } else { final int valueId = dimensionSelector.lookupId(value); return new ValueMatcher() { @Override public boolean matches() { final IndexedInts row = dimensionSelector.getRow(); final int size = row.size(); for (int i = 0; i < size; ++i) { if (row.get(i) == valueId) { return true; } } return false; } }; } }

Target:
public ValueMatcher makeMatcher(ColumnSelectorFactory columnSelectorFactory) { final DimensionSelector dimensionSelector = columnSelectorFactory.makeDimensionSelector(dimension); if (dimensionSelector == null) { return new BooleanValueMatcher(Strings.isNullOrEmpty(value)); } else { final int valueId = dimensionSelector.lookupId(value); return new ValueMatcher() { @Override public boolean matches() { final IndexedInts row = dimensionSelector.getRow(); final int size = row.size(); for (int i = 0; i < size; ++i) { if (row.get(i) == valueId) { return true; } } return false; } }; } }
Source:
protected void setUp() throws Exception { source = "void foo() {\r\n\r\n for(int i = 0; i < 10; i++){\r\n\r\n }\r\n\r\n for(int j = 0; j < 10; j++){\r\n\r\n }\r\n\r\n}"; expectedSource = "void foo() {\r\n\r\n\tfor (int i = 0; i < 10; i++)\r\n\t\t;\r\n\r\n\r\n for(int j = 0; j < 10; j++){\r\n\r\n }\r\n\r\n}"; forReplaced = false; super.setUp(); }

Target:
protected void setUp() throws Exception { source = "void foo() {\n" + "\n" + " for(int i = 0; i < 10; i++){\n" + "\n" + " }\n" + "\n" + " for(int j = 0; j < 10; j++){\n" + "\n" + " }\n" + "\n" + "}"; expectedSource = "void foo() {\n" + "\n" + " for (int i = 0; i < 10; i++)\n" + " ;\n" + "\n" + "\n" + " for(int j = 0; j < 10; j++){\n" + "\n" + " }\n" + "\n" + "}"; forReplaced = false; super.setUp(); }
Source:
private void audit(Context ctx, Object result, String cmd, Multimap<String, ?> params) { final long created = ctx == null ? TimeUtil.nowMs() : ctx.created; final SshSession session = ctx == null ? null : ctx.getSession(); final String sid = session == null ? null : IdGenerator.format(session.getSessionId()); final CurrentUser user = session == null ? null : session.getCurrentUser(); auditService.dispatch(new SshAuditEvent(sid, user, cmd, created, params, result)); }

Target:
private void audit(Context ctx, Object result, String cmd, Multimap<String, ?> params) { final SshSession session = ctx == null ? null : ctx.getSession(); auditService.dispatch(new SshAuditEvent(extractSessionId(session), extractCurrentUser(session), cmd, extractCreated(ctx), params, result)); }
Source:
public Iterable<ConstraintViolation<?>> validateCustomAttributes(RemoteDataSetDef dataSetDef, Object... params) { Set<ConstraintViolation<RemoteDataSetDef>> _violations = validator.validate(dataSetDef, RemoteDataSetDefValidation.class, SQLDataSetDefValidation.class, SQLDataSetDefDbSQLValidation.class); return toIterable(_violations); }

Target:
public Iterable<ConstraintViolation<?>> validateCustomAttributes(RemoteDataSetDef dataSetDef, Object... params) { Set<ConstraintViolation<RemoteDataSetDef>> violations = validator.validate(dataSetDef, RemoteDataSetDefValidation.class, SQLDataSetDefValidation.class, SQLDataSetDefDbSQLValidation.class); return toIterable(violations); }
Source:
private void setHostHeader(String hostHeader) { if (Boolean.TRUE.equals(getInherit())) { return; } if (!hostHeader.trim().isEmpty()) { Map<String, String> headers = Optional.ofNullable(getHeaders()).orElseGet(LinkedHashMap::new); headers.put(HttpHeaders.HOST, hostHeader); setHeaders(headers); } }

Target:
private void setHostHeader(String hostHeader) { if (!hostHeader.trim().isEmpty()) { Map<String, String> headers = Optional.ofNullable(getHeaders()).orElseGet(LinkedHashMap::new); headers.put(HttpHeaders.HOST, hostHeader); setHeaders(headers); } }
Source:
protected void endWithFailure() { vmPoolMonitor.startingVmCompleted(getVmId(), "endWithFailure"); if (shouldEndSnapshotCreation()) { ActionReturnValue actionReturnValue = backend.endAction(ActionType.CreateSnapshotForVm, getParameters().getImagesParameters().get(0), cloneContext().withoutExecutionContext() .withoutLock()); setSucceeded(actionReturnValue.getSucceeded()); } else { super.endWithFailure(); } }

Target:
protected void endWithFailure() { if (shouldEndSnapshotCreation()) { ActionReturnValue actionReturnValue = backend.endAction(ActionType.CreateSnapshotForVm, getParameters().getImagesParameters().get(0), cloneContext().withoutExecutionContext() .withoutLock()); setSucceeded(actionReturnValue.getSucceeded()); } else { super.endWithFailure(); } if (getVm().getVmPoolId() != null) { vmPoolMonitor.startingVmCompleted(getVmId(), "endWithFailure"); } }
Source:
protected void init(final Repository repository, final String gitDir) { try { final String outputEncoding = repository != null ? repository .getConfig().getString("i18n", null, "logOutputEncoding") : null; if (ins == null) { ins = new FileInputStream(FileDescriptor.in); } if (outs == null) outs = new FileOutputStream(FileDescriptor.out); BufferedWriter bufw; if (outputEncoding != null) bufw = new BufferedWriter(new OutputStreamWriter(outs, outputEncoding)); else bufw = new BufferedWriter(new OutputStreamWriter(outs)); out = new PrintWriter(bufw); outw = new ThrowingPrintWriter(bufw); if (err == null) { err = System.err; } } catch (IOException e) { throw die(CLIText.get().cannotCreateOutputStream); } if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }

Target:
protected void init(final Repository repository, final String gitDir) { try { final String outputEncoding = repository != null ? repository .getConfig().getString("i18n", null, "logOutputEncoding") : null; if (ins == null) ins = new FileInputStream(FileDescriptor.in); if (outs == null) outs = new FileOutputStream(FileDescriptor.out); BufferedWriter bufw; if (outputEncoding != null) bufw = new BufferedWriter(new OutputStreamWriter(outs, outputEncoding)); else bufw = new BufferedWriter(new OutputStreamWriter(outs)); out = new PrintWriter(bufw); outw = new ThrowingPrintWriter(bufw); if (err == null) err = System.err; } catch (IOException e) { throw die(CLIText.get().cannotCreateOutputStream); } if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }
Source:
private List<String> getAssignedVariablesNames(StatementTree currentStatement) { ExpressionTree variable = null; if (currentStatement.is(Kind.EXPRESSION_STATEMENT)) { ExpressionTree expression = ((ExpressionStatementTree) currentStatement).expression(); if (expression instanceof AssignmentExpressionTree) { variable = ((AssignmentExpressionTree) expression).variable(); } else if (expression.is(Kind.ASSIGNMENT_BY_REFERENCE)) { variable = ((AssignmentByReferenceTree) expression).variable(); } } List<String> names = new LinkedList<>(); if (variable != null) { if (variable.is(Kind.VARIABLE_IDENTIFIER)) { names.add(((VariableIdentifierTree) variable).variableExpression().text()); } else if (variable.is(Kind.LIST_EXPRESSION)) { names.addAll(getVariablesFromList((ListExpressionTree) variable)); } } return names; }

Target:
private List<String> getAssignedVariablesNames(StatementTree currentStatement) { ExpressionTree variable = null; if (currentStatement.is(Kind.EXPRESSION_STATEMENT)) { ExpressionTree expression = ((ExpressionStatementTree) currentStatement).expression(); if (expression instanceof AssignmentExpressionTree) { variable = ((AssignmentExpressionTree) expression).variable(); } else if (expression.is(Kind.ASSIGNMENT_BY_REFERENCE)) { variable = ((AssignmentByReferenceTree) expression).variable(); } } List<String> names = new ArrayList<>(); if (variable != null) { if (variable.is(Kind.VARIABLE_IDENTIFIER)) { names.add(((VariableIdentifierTree) variable).variableExpression().text()); } else if (variable.is(Kind.LIST_EXPRESSION)) { names.addAll(getVariablesFromList((ListExpressionTree) variable)); } } return names; }
Source:
public String enqueueSetDeviceLifecycleStatusRequest(final String organisationIdentification, final String deviceIdentification, final DeviceLifecycleStatus deviceLifecycleStatus) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.domainHelperService.findActiveDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.SET_DEVICE_LIFECYCLE_STATUS); LOGGER.debug("enqueueSetDeviceLifecycleStatusRequest called with organisation and device {}", organisationIdentification, deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus newDeviceLifecycleStatus = com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus .valueOf(deviceLifecycleStatus.name()); final CommonRequestMessage message = new CommonRequestMessage( CommonRequestMessageType.SET_DEVICE_LIFECYCLE_STATUS, correlationUid, organisationIdentification, deviceIdentification, newDeviceLifecycleStatus, null); this.commonRequestMessageSender.send(message); return correlationUid; }

Target:
public String enqueueSetDeviceLifecycleStatusRequest(final String organisationIdentification, final String deviceIdentification, final DeviceLifecycleStatus deviceLifecycleStatus) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.domainHelperService.findActiveDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.SET_DEVICE_LIFECYCLE_STATUS); LOGGER.debug( "enqueueSetDeviceLifecycleStatusRequest called with organisation {}, deviceLifecycleStatus and deviceIdentifcation {}", organisationIdentification, deviceLifecycleStatus.name(), deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus newDeviceLifecycleStatus = com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus .valueOf(deviceLifecycleStatus.name()); final CommonRequestMessage message = new CommonRequestMessage( CommonRequestMessageType.SET_DEVICE_LIFECYCLE_STATUS, correlationUid, organisationIdentification, deviceIdentification, newDeviceLifecycleStatus, null); this.commonRequestMessageSender.send(message); return correlationUid; }
Source:
public static String readLine(Reader in, int sizeHint) throws IOException { StringBuilder buf = sizeHint > 0 ? new StringBuilder(sizeHint) : new StringBuilder(); int i; while ((i = in.read()) != -1) { char c = (char) i; buf.append(c); if (c == '\n') { break; } } return buf.toString(); }

Target:
public static String readLine(Reader in, int sizeHint) throws IOException { if (in.markSupported()) { if (sizeHint <= 0) { sizeHint = 1024; } StringBuilder sb = new StringBuilder(sizeHint); char[] buf = new char[sizeHint]; while (true) { in.mark(sizeHint); int n = in.read(buf); for (int i = 0; i < n; i++) { if (buf[i] == '\n') { in.reset(); skipFully(in, ++i); sb.append(buf, 0, i); return sb.toString(); } } if (n > 0) { sb.append(buf, 0, n); } if (n < buf.length) { in.reset(); skipFully(in, n); return sb.toString(); } } } else { StringBuilder buf = sizeHint > 0 ? new StringBuilder(sizeHint) : new StringBuilder(); int i; while ((i = in.read()) != -1) { char c = (char) i; buf.append(c); if (c == '\n') { break; } } return buf.toString(); } }
Source:
public OrcishMine(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}"); this.subtype.add(SubType.AURA); TargetPermanent auraTarget = new TargetLandPermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.DestroyPermanent)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.ORE.createInstance(3)), "with three ore counters on it")); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), TargetController.YOU, false)); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), "enchanted land", false)); this.addAbility(new OrcishMineAbility()); }

Target:
public OrcishMine(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}"); this.subtype.add(SubType.AURA); TargetPermanent auraTarget = new TargetLandPermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.DestroyPermanent)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.ORE.createInstance(3)), "with three ore counters on it")); this.addAbility(new OrTriggeredAbility(Zone.BATTLEFIELD, new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), new BeginningOfUpkeepTriggeredAbility(null, TargetController.YOU, false), new BecomesTappedAttachedTriggeredAbility(null, "enchanted land"))); this.addAbility(new OrcishMineAbility()); }
Source:
public MapSqlParameterMapper<GlusterHookEntity> getBatchMapper() { throw new RuntimeException("Unsupported operation"); }

Target:
public MapSqlParameterMapper<GlusterHookEntity> getBatchMapper() { throw new NotImplementedException("Unsupported operation"); }
Source:
public static String computeHash(InputStream stream, long length) throws IOException { int chunkSizeForFile = (int) Math.min(HASH_CHUNK_SIZE, length); byte[] chunkBytes = new byte[(int) Math.min(2 * HASH_CHUNK_SIZE, length)]; DataInputStream in = new DataInputStream(stream); in.readFully(chunkBytes, 0, chunkSizeForFile); long position = chunkSizeForFile; long tailChunkPosition = length - chunkSizeForFile; while (position < tailChunkPosition && (position += in.skip(tailChunkPosition - position)) >= 0); in.readFully(chunkBytes, chunkSizeForFile, chunkBytes.length - chunkSizeForFile); long head = computeHashForChunk(ByteBuffer.wrap(chunkBytes, 0, chunkSizeForFile)); long tail = computeHashForChunk(ByteBuffer.wrap(chunkBytes, chunkBytes.length - chunkSizeForFile, chunkSizeForFile)); in.close(); return String.format("%016x", length + head + tail); }

Target:
public static String computeHash(InputStream stream, long length) throws IOException { int chunkSizeForFile = (int) Math.min(HASH_CHUNK_SIZE, length); byte[] chunkBytes = new byte[(int) Math.min(2 * HASH_CHUNK_SIZE, length)]; long head; long tail; try (DataInputStream in = new DataInputStream(stream)) { in.readFully(chunkBytes, 0, chunkSizeForFile); long position = chunkSizeForFile; long tailChunkPosition = length - chunkSizeForFile; while (position < tailChunkPosition && (position += in.skip(tailChunkPosition - position)) >= 0); in.readFully(chunkBytes, chunkSizeForFile, chunkBytes.length - chunkSizeForFile); head = computeHashForChunk(ByteBuffer.wrap(chunkBytes, 0, chunkSizeForFile)); tail = computeHashForChunk(ByteBuffer.wrap(chunkBytes, chunkBytes.length - chunkSizeForFile, chunkSizeForFile)); } return String.format("%016x", length + head + tail); }
Source:
public void noNavigatorSomeFactoryInstalled() throws Exception { assertThat(ExtensionList.lookup(SCMNavigatorDescriptor.class), contains(instanceOf(SingleSCMNavigator.DescriptorImpl.class))); assertThat(ExtensionList.lookup(MultiBranchProjectFactoryDescriptor.class), contains(instanceOf(OrganizationFolderTest.MockFactoryDescriptor.class))); assertThat(newItemTypes(), containsInAnyOrder()); }

Target:
public void noNavigatorSomeFactoryInstalled() throws Exception { assumeThat(ExtensionList.lookup(SCMNavigatorDescriptor.class), hasSize(1)); assumeThat(ExtensionList.lookup(SCMNavigatorDescriptor.class).get(0).getClass(), is(SingleSCMNavigator.DescriptorImpl.class)); assumeThat(ExtensionList.lookup(MultiBranchProjectFactoryDescriptor.class), hasSize(1)); assertThat(newItemTypes(), containsInAnyOrder()); }
Source:
protected Completion createCompletion() { Completion completion = new TimeStressorCompletion(duration); if (numOperations > 0) { long countPerNode = numOperations / getExecutingSlaves().size(); long modCountPerNode = numOperations % getExecutingSlaves().size(); if (getExecutingSlaveIndex() + 1 <= modCountPerNode) { countPerNode++; } completion = new CountStressorCompletion(countPerNode); } return completion; }

Target:
protected Completion createCompletion() { if (numOperations > 0) { long countPerNode = numOperations / getExecutingSlaves().size(); long modCountPerNode = numOperations % getExecutingSlaves().size(); if (getExecutingSlaveIndex() + 1 <= modCountPerNode) { countPerNode++; } return new CountStressorCompletion(countPerNode); } else { return new TimeStressorCompletion(duration); } }
Source:
public void putAll(Map<Term, Term> map) { Preconditions.checkArgument(!setEntries, "Cannot put in new key-value pair once the entries are set."); for (Map.Entry<Term, Term> e : map.entrySet()) { entries.put(e.getKey(), e.getValue()); } }

Target:
public void putAll(Map<Term, Term> map) { entries.putAll(map); }
Source:
protected List<Properties> createSweeperJobProps(String topic, Path inputDir, Path outputDir, FileSystem fs, CamusSweeperMetrics metrics) throws IOException { LOG.info("creating hourly sweeper job props: topic=" + topic + ", inputDir=" + inputDir + ", outputDir=" + outputDir); List<Properties> jobPropsList = new ArrayList<Properties>(); if (!fs.exists(inputDir)) { LOG.warn("inputdir " + inputDir + " does not exist. Skipping topic " + topic); return jobPropsList; } for (FileStatus f : fs.globStatus(new Path(inputDir, "* *"))) { DateTime folderHour = getFolderHour(f.getPath(), inputDir); if (shouldProcessHour(folderHour)) { Properties jobProps = createJobProps(topic, f.getPath(), folderHour, outputDir, fs, metrics); if (jobProps != null) { jobPropsList.add(jobProps); } } } return jobPropsList; }

Target:
protected List<Properties> createSweeperJobProps(String topic, Path inputDir, Path outputDir, FileSystem fs, CamusSweeperMetrics metrics) throws IOException { LOG.info("creating hourly sweeper job props: topic=" + topic + ", inputDir=" + inputDir + ", outputDir=" + outputDir); List<Properties> jobPropsList = new ArrayList<Properties>(); if (!fs.exists(inputDir)) { LOG.warn("inputdir " + inputDir + " does not exist. Skipping topic " + topic); return jobPropsList; } for (FileStatus f : fs.globStatus(new Path(inputDir, HOURLY_FOLDER_STRUCTURE))) { DateTime folderHour = getFolderHour(f.getPath(), inputDir); if (shouldProcessHour(folderHour)) { Properties jobProps = createJobProps(topic, f.getPath(), folderHour, outputDir, fs, metrics); if (jobProps != null) { jobPropsList.add(jobProps); } } } return jobPropsList; }
Source:
private IgniteCache<Integer, BinaryObject> populateCache(Ignite ignite) { CacheConfiguration<Integer, BinaryObject> cacheConfiguration = new CacheConfiguration<>(); cacheConfiguration.setName("TEST_" + UUID.randomUUID()); IgniteCache<Integer, BinaryObject> cache = ignite.createCache(cacheConfiguration).withKeepBinary(); BinaryObjectBuilder builder = ignite.binary().builder("testType"); for (int i = 0; i < NUMBER_OF_SAMPLES; i++) { BinaryObject value = builder.setField("label", (i < HALF)? 0.0 : 1.0) .setField("feat1", new Random().nextDouble()) .build(); cache.put(i, value); } return cache; }

Target:
private IgniteCache<Integer, BinaryObject> populateCache(Ignite ignite) { CacheConfiguration<Integer, BinaryObject> cacheConfiguration = new CacheConfiguration<>(); cacheConfiguration.setName("TEST_" + UUID.randomUUID()); IgniteCache<Integer, BinaryObject> cache = ignite.createCache(cacheConfiguration).withKeepBinary(); BinaryObjectBuilder builder = ignite.binary().builder("testType"); for (int i = 0; i < NUMBER_OF_SAMPLES; i++) { if (i < HALF) cache.put(i, builder.setField("feature1", 0.0).setField("label", 0.0).build()); else cache.put(i, builder.setField("feature1", 10.0).setField("label", 1.0).build()); } return cache; }
Source:
public List<ClusterNode> mapKeyToPrimaryAndBackupsList(K key) { A.notNull(key, "key"); return cctx.affinity().nodesByPartition(partition(key), topologyVersion()); }

Target:
@Override public List<ClusterNode> mapKeyToPrimaryAndBackupsList(K key) { A.notNull(key, "key"); return cctx.affinity().nodesByPartition(partition(key), topologyVersion()); }