auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<DMNSimpleTimeZone> buildTimeZones() { final List<DMNSimpleTimeZone> timeZones = new ArrayList<>(); final String[] names = getNames(); for (String name : names) { final double offset = getOffset(name); final String format = getOffsetString(name); timeZones.add(new DMNSimpleTimeZone(name, offset, format)); } return timeZones; }

Target:
private List<DMNSimpleTimeZone> buildTimeZones() { final List<DMNSimpleTimeZone> timeZones = new ArrayList<>(); final String[] names = getNames(); for (String name : names) { final double offset = getOffset(name); final String offsetString = getOffsetString(name); timeZones.add(new DMNSimpleTimeZone(name, offset, offsetString)); } return timeZones; }
Source:
public void overwriteValidation() { Document validator = Document.parse("{ jelly : { $ne : 'rhubarb' } }"); ValidationOptions options = new ValidationOptions() .validator(validator) .validationLevel(ValidationLevel.MODERATE) .validationAction(ValidationAction.ERROR); MongoDatabase database = getMongoClient().getDatabase(TEST_DB_NAME); database.getCollection("validation").drop(); database.createCollection("validation", new CreateCollectionOptions().validationOptions(options)); assertEquals(validator, getValidator(database)); Document rhubarb = new Document("jelly", "rhubarb").append("number", 20); database.getCollection("validation").insertOne(new Document("jelly", "grape")); try { database.getCollection("validation").insertOne(rhubarb); fail("Document should have failed validation"); } catch (MongoWriteException e) { assertTrue(e.getMessage().contains("Document failed validation")); } getMorphia().map(DocumentValidation.class); getDs().enableDocumentValidation(); assertEquals(Document.parse(DocumentValidation.class.getAnnotation(Validation.class).value()), getValidator(database)); try { database.getCollection("validation").insertOne(rhubarb); } catch (MongoWriteException e) { assertFalse(e.getMessage().contains("Document failed validation")); } try { getDs().save(new DocumentValidation("John", 1, new Date())); fail("Document should have failed validation"); } catch (WriteConcernException e) { assertTrue(e.getMessage().contains("Document failed validation")); } getDs().enableDocumentValidation(); }

Target:
public void overwriteValidation() { Document validator = Document.parse("{ jelly : { $ne : 'rhubarb' } }"); ValidationOptions options = new ValidationOptions() .validator(validator) .validationLevel(ValidationLevel.MODERATE) .validationAction(ValidationAction.ERROR); MongoDatabase database = getMongoClient().getDatabase(TEST_DB_NAME); database.getCollection("validation").drop(); database.createCollection("validation", new CreateCollectionOptions().validationOptions(options)); assertEquals(validator, getValidator()); Document rhubarb = new Document("jelly", "rhubarb").append("number", 20); database.getCollection("validation").insertOne(new Document("jelly", "grape")); try { database.getCollection("validation").insertOne(rhubarb); fail("Document should have failed validation"); } catch (MongoWriteException e) { assertTrue(e.getMessage().contains("Document failed validation")); } getMorphia().map(DocumentValidation.class); getDs().enableDocumentValidation(); assertEquals(Document.parse(DocumentValidation.class.getAnnotation(Validation.class).value()), getValidator()); try { database.getCollection("validation").insertOne(rhubarb); } catch (MongoWriteException e) { assertFalse(e.getMessage().contains("Document failed validation")); } try { getDs().save(new DocumentValidation("John", 1, new Date())); fail("Document should have failed validation"); } catch (WriteConcernException e) { assertTrue(e.getMessage().contains("Document failed validation")); } }
Source:
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { super.init(site, input); fSite = site; fResourceManager = new LocalResourceManager(JFaceResources.getResources()); try { final InputStream content = getInputContent(); fTestSuiteModel = UnitTestHelper.loadTestSuite(content); content.close(); fTestSuiteModel.setResource(getFile()); fTestSuiteModel.eAdapters().add(getSynchronizationAdapter()); syncViewModelAndModel(); } catch (final IOException e) { final Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e); throw new PartInitException(status); } catch (final CoreException e) { final Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e); throw new PartInitException(status); } setPartName(getEditorInput().getName()); firePropertyChange(PROP_TITLE); ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE); }

Target:
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { super.init(site, input); fSite = site; fResourceManager = new LocalResourceManager(JFaceResources.getResources()); try { final InputStream content = getInputContent(); fTestSuiteModel = UnitTestHelper.loadTestSuite(content); content.close(); fTestSuiteModel.setResource(getFile()); fSynchronizationAdapter = (EContentAdapter) getSynchronizationAdapter(); updateViewModelFromFileModel(); } catch (final IOException e) { final Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e); throw new PartInitException(status); } catch (final CoreException e) { final Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e); throw new PartInitException(status); } setPartName(getEditorInput().getName()); firePropertyChange(PROP_TITLE); ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE); }
Source:
private boolean isCandidate(Container container, String criteria) { try { return expressionParser.parseExpression(criteria).getValue(evaluationContext, container.getAttributes(), Boolean.class); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE)) { LOG.debug("candidate not contain an attribute referenced in the criteria {}", criteria); } return false; } catch (EvaluationException e) { LOG.debug("candidate not a match due to evaluation exception", e); return false; } }

Target:
private boolean isCandidate(Container container, String criteria) { try { return expressionParser.parseExpression(criteria).getValue(evaluationContext, container.getAttributes(), Boolean.class); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE)) { LOG.debug("candidate does not contain an attribute referenced in the criteria {}", criteria); } return false; } catch (EvaluationException e) { LOG.debug("candidate not a match due to evaluation exception", e); return false; } }
Source:
static void normalizeAndLogReadCounts(final ReadCountCollection readCounts, final Logger logger) { final RealMatrix counts = readCounts.counts(); final int columnCount = counts.getColumnDimension(); final Median medianCalculator = new Median(); for (int i = 0; i < columnCount; i++) { final double[] colCounts = counts.getColumn(i); final double median = medianCalculator.evaluate(colCounts); final double invMedian = 1.0 / median; for (int j = 0; j < colCounts.length; j++) { colCounts[j] = Math.log(Math.max(EPSILON, colCounts[j] * invMedian)) * INV_LN_2; } counts.setColumn(i, colCounts); } logger.info("Counts normalized by the column median and changed into bits."); }

Target:
static void normalizeAndLogReadCounts(final ReadCountCollection readCounts, final Logger logger) { final RealMatrix counts = readCounts.counts(); final Median medianCalculator = new Median(); final double[] medians = IntStream.range(0, counts.getColumnDimension()).mapToDouble(col -> medianCalculator.evaluate(counts.getColumn(col))).toArray(); counts.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() { @Override public double visit(final int row, final int column, final double value) { return Math.log(Math.max(EPSILON, value / medians[column])) * INV_LN_2; } }); logger.info("Counts normalized by the column median and log2'd."); }
Source:
public void testWhenAnyResultFirstCancelled() { runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<Void>> tasks = new ArrayList<Task<Void>>(); final Task<Void> firstToCompleteCancelled = Task.callInBackground(new Callable<Void>() { @Override public Void call() throws Exception { Thread.sleep(50); throw new CancellationException(); } }); tasks.addAll(launchTasksWithRandomCompletions(10)); tasks.add(firstToCompleteCancelled); return Task.whenAnyResult(tasks).continueWith(new Continuation<Task<Void>, Object>() { @Override public Object then(Task<Task<Void>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(task.getResult(), firstToCompleteCancelled); assertTrue(task.getResult().isCompleted()); assertTrue(task.getResult().isCancelled()); assertFalse(task.getResult().isFaulted()); return null; } }); } }); }

Target:
public void testWhenAnyResultFirstCancelled() { runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<Integer>> tasks = new ArrayList<>(); final Task<Integer> firstToCompleteCancelled = Task.callInBackground(new Callable<Integer>() { @Override public Integer call() throws Exception { Thread.sleep(50); throw new CancellationException(); } }); tasks.addAll(launchTasksWithRandomCompletions(5)); tasks.add(firstToCompleteCancelled); tasks.addAll(launchTasksWithRandomCompletions(5)); return Task.whenAnyResult(tasks).continueWith(new Continuation<Task<Integer>, Object>() { @Override public Object then(Task<Task<Integer>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(firstToCompleteCancelled, task.getResult()); assertTrue(task.getResult().isCompleted()); assertTrue(task.getResult().isCancelled()); assertFalse(task.getResult().isFaulted()); return null; } }); } }); }
Source:
public boolean servesCoverage(String coverageId) { if (coverageId == null || coverageId.length() == 0) { return false; } return contents.getCoverageSummary().stream() .anyMatch(c -> coverageId.equals(c.getCoverageId())); }

Target:
public boolean servesCoverage(String coverageId) { if (coverageId == null || coverageId.isEmpty()) { return false; } return contents.getCoverageSummary().stream() .anyMatch(c -> coverageId.equals(c.getCoverageId())); }
Source:
public String getFileName() { if (title != null) { return title; } if (url != null) { return AndroidUtil.getFileNameFromPath(url); } return ""; }

Target:
public String getFileName() { if (title != null) { return title; } else if (url != null) { return AndroidUtil.getFileNameFromPath(url); } return ""; }
Source:
public static Set<ColumnStatisticType> getSupportedColumnStatistics(Type type) { if (type.equals(BOOLEAN)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_TRUE_VALUES); } if (isNumericType(type) || type.equals(DATE) || type.equals(TIMESTAMP)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } if (isVarcharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES, MAX_VALUE_SIZE_IN_BYTES, AVERAGE_VALUE_SIZE_IN_BYTES); } if (isCharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES); } if (type.equals(VARBINARY)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MAX_VALUE_SIZE_IN_BYTES, AVERAGE_VALUE_SIZE_IN_BYTES); } return ImmutableSet.of(); }

Target:
public static Set<ColumnStatisticType> getSupportedColumnStatistics(Type type) { if (type.equals(BOOLEAN)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_TRUE_VALUES); } if (isNumericType(type) || type.equals(DATE) || type.equals(TIMESTAMP)) { return ImmutableSet.of(MIN_VALUE, MAX_VALUE, NUMBER_OF_DISTINCT_VALUES, NUMBER_OF_NON_NULL_VALUES); } if (isVarcharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES); } if (isCharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES); } if (type.equals(VARBINARY)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES); } if (type instanceof ArrayType || type instanceof RowType || type instanceof MapType) { return ImmutableSet.of(); } throw new IllegalArgumentException("Unsupported type: " + type); }
Source:
public synchronized void reportProcessingUpdate( final ReportProgressEvent event ) { final int activity = event.getActivity(); if ( firstPageMode && ReportProgressEvent.GENERATING_CONTENT == activity && page > 0 ) { this.status = AsyncExecutionStatus.CONTENT_AVAILABLE; } this.activity = getActivityCode( activity ); this.progress = (int) ReportProgressEvent.computePercentageComplete( event, true ); this.page = event.getPage(); this.row = event.getRow(); }

Target:
public synchronized void reportProcessingUpdate( final ReportProgressEvent event ) { final int activity = event.getActivity(); if ( firstPageMode && ReportProgressEvent.GENERATING_CONTENT == activity && page > 0 ) { this.status = AsyncExecutionStatus.CONTENT_AVAILABLE; } updateState( event, activity ); }
Source:
public Mask parseFromInput(String input, ParserContext context) throws InputParseException { if (input.startsWith("##")) { Extent extent = Request.request().getEditSession(); BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); if (category == null) { throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\''); } else { return new BlockCategoryMask(extent, category); } } return null; }

Target:
public Mask parseFromInput(String input, ParserContext context) throws InputParseException { if (!input.startsWith("##")) { return null; } Extent extent = Request.request().getEditSession(); BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); if (category == null) { throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\''); } else { return new BlockCategoryMask(extent, category); } }
Source:
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws Exception { CommandContext commandContext = Context.getCommandContext(); ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); ExecutionEntity executionEntity = (ExecutionEntity) execution; CallActivity callActivity = (CallActivity) executionEntity.getCurrentFlowElement(); for (IOParameter ioParameter : callActivity.getOutParameters()) { Object value = null; if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) { Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim()); value = expression.getValue(subProcessInstance); } else { value = subProcessInstance.getVariable(ioParameter.getSource()); } execution.setVariable(ioParameter.getTarget(), value); } Map<String, Object> outboundVariables = getOutBoundVariables(commandContext, execution,subProcessInstance.getVariables()); if (outboundVariables != null) { execution.getParent().setVariables(outboundVariables); } }

Target:
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws Exception { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); ExecutionEntity executionEntity = (ExecutionEntity) execution; CallActivity callActivity = (CallActivity) executionEntity.getCurrentFlowElement(); for (IOParameter ioParameter : callActivity.getOutParameters()) { Object value = null; if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) { Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim()); value = expression.getValue(subProcessInstance); } else { value = subProcessInstance.getVariable(ioParameter.getSource()); } execution.setVariable(ioParameter.getTarget(), value); } Map<String, Object> outboundVariables = calculateOutBoundVariables(execution, subProcessInstance.getVariables()); if (outboundVariables != null) { execution.setVariables(outboundVariables); } }
Source:
private void publishEvent(final TreeCacheEvent event) { System.out.println(event); if ( treeState.get() != TreeState.CLOSED ) { executorService.submit(new Runnable() { @Override public void run() { { try { callListeners(event); } catch ( Exception e ) { handleException(e); } } } }); } }

Target:
private void publishEvent(final TreeCacheEvent event) { if ( treeState.get() != TreeState.CLOSED ) { executorService.submit(new Runnable() { @Override public void run() { { try { callListeners(event); } catch ( Exception e ) { handleException(e); } } } }); } }
Source:
private static Iterable<ITmfEventAspect<?>> getExperimentAspects( final TmfExperiment experiment) { List<ITmfTrace> traces = experiment.getTraces(); ImmutableSet.Builder<ITmfEventAspect<?>> builder = new ImmutableSet.Builder<>(); builder.add(TmfBaseAspects.getTraceNameAspect()); String commonTraceType = getCommonTraceType(experiment); if (commonTraceType != null) { builder.addAll(traces.get(0).getEventAspects()); } else { for (ITmfTrace trace : traces) { Iterable<ITmfEventAspect<?>> traceAspects = trace.getEventAspects(); builder.addAll(traceAspects); } } return builder.build(); }

Target:
private static Iterable<ITmfEventAspect<?>> getExperimentAspects( final TmfExperiment experiment) { List<ITmfTrace> traces = experiment.getTraces(); ImmutableSet.Builder<ITmfEventAspect<?>> builder = new ImmutableSet.Builder<>(); builder.add(TmfBaseAspects.getTraceNameAspect()); String commonTraceType = getCommonTraceType(experiment); if (commonTraceType != null) { builder.addAll(traces.get(0).getEventAspects()); } else { for (ITmfTrace trace : traces) { builder.addAll(trace.getEventAspects()); } } return builder.build(); }
Source:
protected Feature getFeature(JSONObject jsonObject) throws ActionParamsException, JSONException, FactoryException { Feature feature = new Feature(); OskariLayer layer = getLayer(jsonObject.optString("layerId")); String srsName = JSONHelper.getStringFromJSON(jsonObject, "srsName", "EPSG:3067"); CoordinateReferenceSystem crs = CRS.decode(srsName); WFSLayerConfiguration lc = getWFSConfiguration(layer.getId()); feature.setLayerName(layer.getName()); feature.setNamespace(lc.getFeatureNamespace()); feature.setNamespaceURI(lc.getFeatureNamespaceURI()); feature.setGMLGeometryProperty(lc.getGMLGeometryProperty()); feature.setId(jsonObject.getString("featureId")); if(jsonObject.has("featureFields")) { JSONArray jsonArray = jsonObject.getJSONArray("featureFields"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject property = jsonArray.getJSONObject(i); if(property.getString("value").isEmpty()) { continue; } feature.addProperty(property.getString("key"), property.getString("value")); } } if (jsonObject.has("geometries")) { JSONObject geometries = jsonObject.getJSONObject("geometries"); String geometryType = geometries.getString("type"); if(!isAllowedGeomType(geometryType)) { throw new ActionParamsException("Invalid geometry type: " + geometryType); } JSONArray data = geometries.getJSONArray("data"); feature.setGeometry(getGeometry(geometryType, data, getSrid(srsName, 3067))); } return feature; }

Target:
protected Feature getFeature(JSONObject jsonObject) throws ActionParamsException, JSONException, FactoryException { Feature feature = new Feature(); OskariLayer layer = getLayer(jsonObject.optString("layerId")); String srsName = JSONHelper.getStringFromJSON(jsonObject, "srsName", "EPSG:3067"); CoordinateReferenceSystem crs = CRS.decode(srsName); WFSLayerConfiguration lc = getWFSConfiguration(layer.getId()); feature.setLayerName(layer.getName()); feature.setNamespace(lc.getFeatureNamespace()); feature.setNamespaceURI(lc.getFeatureNamespaceURI()); feature.setGMLGeometryProperty(lc.getGMLGeometryProperty()); feature.setId(jsonObject.getString("featureId")); if(jsonObject.has("featureFields")) { JSONArray jsonArray = jsonObject.getJSONArray("featureFields"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject property = jsonArray.getJSONObject(i); feature.addProperty(property.getString("key"), property.getString("value")); } } if (jsonObject.has("geometries")) { JSONObject geometries = jsonObject.getJSONObject("geometries"); String geometryType = geometries.getString("type"); if(!isAllowedGeomType(geometryType)) { throw new ActionParamsException("Invalid geometry type: " + geometryType); } JSONArray data = geometries.getJSONArray("data"); Geometry geometry = getGeometry(geometryType, data, getSrid(srsName, 3067)); if(ProjectionHelper.isFirstAxisNorth(crs)) { ProjectionHelper.flipFeatureYX(geometry); } feature.setGeometry(geometry); } return feature; }
Source:
public void testOrder() throws Exception { Map<String, String> env = new HashMap(); env.put("PGHOST", "fromenv"); env.put("PGUSER", "fromenv"); env.put("PGDATABASE", "fromenv"); Properties info = new Properties(); PGProperty.PG_DBNAME.set(info, "frominfo"); PGProperty.USER.set(info, "frominfo"); String url = "jdbc:postgresql:?user=fromurl"; Properties props = PropertyLoader.load(url, info, env); assertNotNull(props); System.out.println(props.get(PGProperty.PG_HOST.getName())); System.out.println(props.getProperty(PGProperty.PG_HOST.getName())); assertTrue(PGProperty.PG_HOST.isPresent(props)); assertEquals("fromenv", PGProperty.PG_HOST.get(props)); assertTrue(PGProperty.PG_PORT.isPresent(props)); assertEquals(5432, PGProperty.PG_PORT.getInt(props)); assertTrue(PGProperty.USER.isPresent(props)); assertEquals("fromurl", PGProperty.USER.get(props)); assertTrue(PGProperty.PG_DBNAME.isPresent(props)); assertEquals("frominfo", PGProperty.PG_DBNAME.get(props)); }

Target:
public void testOrder() throws Exception { Map<String, String> env = new HashMap(); env.put("PGHOST", "fromenv"); env.put("PGPORT", "5433"); env.put("PGDATABASE", "fromenv"); Properties info = new Properties(); PGProperty.PG_DBNAME.set(info, "frominfo"); PGProperty.PG_PORT.set(info, "5434"); String url = "jdbc:postgresql:?PGPORT=5435"; Properties props = PropertyLoader.load(url, info, env); assertNotNull(props); assertTrue(PGProperty.PG_HOST.isPresent(props)); assertEquals("fromenv", PGProperty.PG_HOST.get(props)); assertTrue(PGProperty.PG_PORT.isPresent(props)); assertEquals(5435, PGProperty.PG_PORT.getInt(props)); assertTrue(PGProperty.USER.isPresent(props)); assertTrue(PGProperty.PG_DBNAME.isPresent(props)); assertEquals("frominfo", PGProperty.PG_DBNAME.get(props)); }
Source:
public void addPrivateKey(String host, byte[] key) throws SshKeyStoreException { try { final String sshKeyAttributeName = sshKeyAttributeName(host, PRIVATE); final Map<String, String> keys = getSshKeys(); if (keys.get(sshKeyAttributeName) != null) { throw new SshKeyStoreException("Private key for host: '" + host + "' already exists."); } keys.put(sshKeyAttributeName, new String(key)); updateSshKeys(keys); } catch (ApiException | IOException | JsonParseException e) { throw new SshKeyStoreException("Failed to add private key for host '" + host + "'. ", e); } }

Target:
public void addPrivateKey(String host, byte[] key) throws SshKeyStoreException { try { final String sshKeyAttributeName = sshKeyAttributeName(host, PRIVATE); final Map<String, String> keys = getSshKeys(); if (keys.containsKey(sshKeyAttributeName)) { throw new SshKeyStoreException("Private key for host: '" + host + "' already exists."); } keys.put(sshKeyAttributeName, new String(key)); updateSshKeys(keys); } catch (ApiException | IOException | JsonParseException e) { throw new SshKeyStoreException("Failed to add private key for host '" + host + "'. ", e); } }
Source:
public void preInit(FMLPreInitializationEvent event) { if(!ENABLE)return; FMLLog.info("{Artem226} Preinit test mod"); BlockEvent.RandomTickEvent.RandomBlockTickEventRegistry.registerEventForBlock(BlockFire.class); MinecraftForge.EVENT_BUS.register(this); }

Target:
public void preInit(FMLPreInitializationEvent event) { if(!ENABLE)return; FMLLog.info("[RandomBlockTickEventTest] Preinit test mod"); BlockEvent.RandomTickEvent.RandomBlockTickEventRegistry.registerBlockForEvent(BlockFire.class); MinecraftForge.EVENT_BUS.register(this); }
Source:
public final Mono<KeyRecord> get(Policy policy, Key key) throws AerospikeException { return Mono.create(sink -> aerospikeClient.get(eventLoops.next(), new RecordListener() { @Override public void onSuccess(Key key, Record record) { sink.success(new KeyRecord(key, record)); } @Override public void onFailure(AerospikeException exception) { sink.error(exception); } }, policy, key)); }

Target:
public final Mono<KeyRecord> get(Policy policy, Key key) throws AerospikeException { return Mono.create(sink -> aerospikeClient.get( eventLoops.next(), new ReactorRecordListener(sink), policy, key)); }
Source:
public void setBankState(State bankState) { LOG.info("setBankState, setting bank state to: " + ToStringBuilder.reflectionToString(bankState)); this.bankState = bankState; }

Target:
public void setBankState(State bankState) { if (LOG.isDebugEnabled()) { LOG.debug("setBankState, setting bank state to: " + buildToStringBuilderString(bankState)); } this.bankState = bankState; }
Source:
private void pull(final PullParams params, final ProgressMonitor progressMonitor, final URI dockerDaemonUri) throws IOException, InterruptedException { final String registry = params.getRegistry(); final AuthConfigs authConfigs = params.getAuthConfigs(); try (DockerConnection connection = connectionFactory.openConnection(dockerDaemonUri) .method("POST") .path("/images/create") .query("fromImage", params.getImageFqn()) .header("X-Registry-Auth", authManager.getXRegistryAuthHeaderValue( registry != null ? registry : DEFAULT_REGISTRY, authConfigs != null ? authConfigs.getConfigs() : null))) { addQueryParamIfNotNull(connection, "tag", params.getTag()); final DockerResponse response = connection.request(); if (OK.getStatusCode() != response.getStatus()) { throw getDockerException(response); } try (InputStream responseStream = response.getInputStream()) { JsonMessageReader<ProgressStatus> progressReader = new JsonMessageReader<>(responseStream, ProgressStatus.class); final ValueHolder<IOException> errorHolder = new ValueHolder<>(); final Runnable runnable = new Runnable() { @Override public void run() { try { ProgressStatus progressStatus; while ((progressStatus = progressReader.next()) != null) { progressMonitor.updateProgress(progressStatus); } } catch (IOException e) { errorHolder.set(e); } synchronized (this) { notify(); } } }; executor.execute(runnable); synchronized (runnable) { runnable.wait(); } final IOException ioe = errorHolder.get(); if (ioe != null) { throw ioe; } } } }

Target:
private void pull(final PullParams params, final ProgressMonitor progressMonitor, final URI dockerDaemonUri) throws IOException, InterruptedException { final String registry = params.getRegistry(); try (DockerConnection connection = connectionFactory.openConnection(dockerDaemonUri) .method("POST") .path("/images/create") .query("fromImage", params.getFullRepo()) .header("X-Registry-Auth", authManager.getXRegistryAuthHeaderValue( firstNonNull(registry, DEFAULT_REGISTRY_VALUE), params.getAuthConfigs()))) { addQueryParamIfNotNull(connection, "tag", params.getTag()); final DockerResponse response = connection.request(); if (OK.getStatusCode() != response.getStatus()) { throw getDockerException(response); } try (InputStream responseStream = response.getInputStream()) { JsonMessageReader<ProgressStatus> progressReader = new JsonMessageReader<>(responseStream, ProgressStatus.class); final ValueHolder<IOException> errorHolder = new ValueHolder<>(); final Runnable runnable = new Runnable() { @Override public void run() { try { ProgressStatus progressStatus; while ((progressStatus = progressReader.next()) != null) { progressMonitor.updateProgress(progressStatus); } } catch (IOException e) { errorHolder.set(e); } synchronized (this) { notify(); } } }; executor.execute(runnable); synchronized (runnable) { runnable.wait(); } final IOException ioe = errorHolder.get(); if (ioe != null) { throw ioe; } } } }
Source:
public void visitVariable(VariableTree tree) { if (insideTryStatement && !insideLambdaExpression && isResourceResolver(tree) && !resourceResolversInTryWithResources .contains(getResourceResolver(tree))) { context.reportIssue(this, tree, RULE_MESSAGE); } super.visitVariable(tree); }

Target:
public void visitVariable(VariableTree tree) { if (isResourceResolverUsedProperly(tree)) { context.reportIssue(this, tree, RULE_MESSAGE); } super.visitVariable(tree); }
Source:
private void addLastTakenPicture() { try { WPMediaUtils.scanMediaFile(this, mMediaCapturePath); File f = new File(mMediaCapturePath); Uri capturedImageUri = Uri.fromFile(f); if (addMedia(capturedImageUri, true)) { this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); } else { ToastUtils.showToast(this, R.string.gallery_error, Duration.SHORT); } } catch (RuntimeException e) { AppLog.e(T.EDITOR, e); } catch (OutOfMemoryError e) { AppLog.e(T.EDITOR, e); } }

Target:
private void addLastTakenPicture() { try { WPMediaUtils.scanMediaFile(this, mMediaCapturePath); File f = new File(mMediaCapturePath); Uri capturedImageUri = Uri.fromFile(f); if (addMedia(capturedImageUri, true)) { this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); } else { ToastUtils.showToast(this, R.string.gallery_error, Duration.SHORT); } } catch (RuntimeException | OutOfMemoryError e) { AppLog.e(T.EDITOR, e); } }
Source:
public Response handle(Request request) { final CountDeviceTypeRequest req = (CountDeviceTypeRequest) request.getBody(); final long count = deviceTypeDao.count(req.getName(), req.getNamePattern(), req.getPrincipal()); final EntityCountResponse entityCountResponse = new EntityCountResponse(count); return Response.newBuilder() .withBody(new CountDeviceTypeResponse(entityCountResponse)) .buildSuccess(); }

Target:
public Response handle(Request request) { final CountDeviceTypeRequest req = (CountDeviceTypeRequest) request.getBody(); final long count = deviceTypeDao.count(req.getName(), req.getNamePattern(), req.getPrincipal()); final CountResponse countResponse = new CountResponse(count); return Response.newBuilder() .withBody(countResponse) .buildSuccess(); }
Source:
private void removeFromMap(View child) { this.map.get(child).child = null;; this.map.remove(child); }

Target:
private void removeFromMap(View child) { this.map.get(child).child = null; this.map.remove(child); }
Source:
private UpdateProgress processContent(Content content, Action action) { String contentCrid = idGenerator.generateContentCrid(content); log.debug("Processing Content {}", contentCrid); try { if (!Action.DELETE.equals(action)) { Payload p = payloadCreator.payloadFrom(contentCrid, content); if (shouldSave(HashType.CONTENT, contentCrid, p)) { taskStore.save(taskCreator.taskFor(idGenerator.generateContentCrid(content), content, p, action)); payloadHashStore.saveHash(HashType.CONTENT, contentCrid, p.hash()); } else { log.debug("Existing hash found for Content {}, not updating", contentCrid); } } return UpdateProgress.SUCCESS; } catch (Exception e) { log.error("Failed to createDefault payload for content {}", content.getCanonicalUri(), e); Task task = taskStore.save(taskCreator.taskFor(idGenerator.generateContentCrid(content), content, action, Status.FAILED)); taskStore.updateWithLastError(task.id(), exceptionToString(e)); return UpdateProgress.FAILURE; } }

Target:
private UpdateProgress processContent(Content content, Action action) { String contentCrid = idGenerator.generateContentCrid(content); log.debug("Processing Content {}", contentCrid); try { if (!Action.DELETE.equals(action)) { Payload p = payloadCreator.payloadFrom(contentCrid, content); if (shouldSave(HashType.CONTENT, contentCrid, p)) { taskStore.save(taskCreator.taskFor(idGenerator.generateContentCrid(content), content, p, action)); payloadHashStore.saveHash(HashType.CONTENT, contentCrid, p.hash()); } else { log.debug("Existing hash found for Content {}, not updating", contentCrid); } } return UpdateProgress.SUCCESS; } catch (Exception e) { log.error("Failed to create payload for content {}", content.getCanonicalUri(), e); Task task = taskStore.save(taskCreator.taskFor(idGenerator.generateContentCrid(content), content, action, Status.FAILED)); taskStore.updateWithLastError(task.id(), exceptionToString(e)); return UpdateProgress.FAILURE; } }
Source:
public void testCanonicalServiceName() throws Exception { AzureBlobStorageTestAccount testAccount = AzureBlobStorageTestAccount.createMock(); Configuration conf = testAccount.getFileSystem().getConf(); String authority = testAccount.getFileSystem().getUri().getAuthority(); URI defaultUri = new URI("wasbs", authority, null, null, null); conf.set(FS_DEFAULT_NAME_KEY, defaultUri.toString()); final FileSystem fs0 = FileSystem.get(conf); intercept(IllegalArgumentException.class, "java.net.UnknownHostException", ()-> { fs0.getCanonicalServiceName(); }); FileSystem.closeAll(); conf.setBoolean(RETURN_URI_AS_CANONICAL_SERVICE_NAME_PROPERTY_NAME, true); FileSystem fs1 = FileSystem.get(conf); Assert.assertEquals("getCanonicalServiceName() should return URI", fs1.getUri().toString(), fs1.getCanonicalServiceName()); }

Target:
public void testCanonicalServiceName() throws Exception { AzureBlobStorageTestAccount testAccount = AzureBlobStorageTestAccount.createMock(); Configuration conf = testAccount.getFileSystem().getConf(); String authority = testAccount.getFileSystem().getUri().getAuthority(); URI defaultUri = new URI("wasbs", authority, null, null, null); conf.set(FS_DEFAULT_NAME_KEY, defaultUri.toString()); try { FileSystem fs0 = FileSystem.get(conf); intercept(IllegalArgumentException.class, "java.net.UnknownHostException", () -> { fs0.getCanonicalServiceName(); }); conf.setBoolean(RETURN_URI_AS_CANONICAL_SERVICE_NAME_PROPERTY_NAME, true); FileSystem fs1 = FileSystem.newInstance(defaultUri, conf); Assert.assertEquals("getCanonicalServiceName() should return URI", fs1.getUri().toString(), fs1.getCanonicalServiceName()); } finally { testAccount.cleanup(); FileSystem.closeAll(); } }
Source:
private RecordingCommand getImportCommand() { return new RecordingCommand(this.modelSet.getTransactionalEditingDomain()) { @Override protected void doExecute() { PackageImport importPrimitivePack = rootElement.createPackageImport((org.eclipse.uml2.uml.Package) primitiveTypes); if (!rootElement.getPackageImports().contains(importPrimitivePack)) { rootElement.getPackageImports().add(importPrimitivePack); } if (umlMetamodel != null) { PackageImport importMetamodelPack = rootElement.createPackageImport((org.eclipse.uml2.uml.Package) umlMetamodel); if (!rootElement.getPackageImports().contains(importMetamodelPack)) { rootElement.getPackageImports().add(importMetamodelPack); } } try { rootElement.eResource().save(Collections.EMPTY_MAP); } catch (IOException e) { Activator.log.error(e); } } }; }

Target:
private RecordingCommand getImportCommand() { return new RecordingCommand(this.modelSet.getTransactionalEditingDomain()) { @Override protected void doExecute() { if (!rootElement.getImportedPackages().contains(primitiveTypes)) { rootElement.createPackageImport((org.eclipse.uml2.uml.Package) primitiveTypes); } if (umlMetamodel != null) { if (!rootElement.getImportedPackages().contains(umlMetamodel)) { rootElement.createPackageImport((org.eclipse.uml2.uml.Package) umlMetamodel); } } } }; }
Source:
private static void attachShutdownHook() { Runtime.getRuntime().addShutdownHook( new Thread() { @Override public void run() { LOGGER.info("JMXFetch is closing"); LogManager.shutdown(); } } ); }

Target:
private static void attachShutdownHook() { Runtime.getRuntime().addShutdownHook( new Thread() { @Override public void run() { log.info("JMXFetch is closing"); LogManager.shutdown(); } } ); }
Source:
ColumnDef(ColumnDefName columnDefName, String sqlTypeName, boolean isNull, Integer maxLength, Integer scale, boolean isPK) { this.columnDefName = columnDefName; this.dataType = PDataType.fromSqlTypeName(SchemaUtil.normalizeIdentifier(sqlTypeName)); this.isNull = isNull; if (this.dataType == PDataType.CHAR) { if (maxLength == null) { throw new IllegalArgumentException(sqlTypeName + " must declare a length"); } } else if (this.dataType == PDataType.DECIMAL) { maxLength = maxLength == null ? PDataType.MAX_PRECISION : maxLength; } else if (this.dataType != PDataType.VARCHAR) { maxLength = null; } this.maxLength = maxLength; if (this.dataType == PDataType.DECIMAL) { scale = scale == null || scale > maxLength ? maxLength : scale; this.scale = scale; } else { this.scale = null; } this.isPK = isPK; }

Target:
ColumnDef(ColumnDefName columnDefName, String sqlTypeName, boolean isNull, Integer maxLength, Integer scale, boolean isPK) { this.columnDefName = columnDefName; this.dataType = PDataType.fromSqlTypeName(SchemaUtil.normalizeIdentifier(sqlTypeName)); this.isNull = isNull; if (this.dataType == PDataType.CHAR) { if (maxLength == null) { throw new IllegalArgumentException(sqlTypeName + " must declare a length"); } scale = null; } else if (this.dataType == PDataType.DECIMAL) { maxLength = maxLength == null ? PDataType.MAX_PRECISION : maxLength; scale = scale == null ? PDataType.DEFAULT_SCALE : scale > maxLength ? maxLength : scale; } else if (this.dataType != PDataType.VARCHAR) { maxLength = null; scale = null; } else { scale = null; } this.maxLength = maxLength; this.scale = scale; this.isPK = isPK; }
Source:
public SchedulePage setStartTimeDate(String startTime) { String from = getTimeElement(startTime, "hours"); from = from + ":"+ getTimeElement(startTime, "minutes"); String fromMeridian = getTimeElement(startTime, "meridian"); if(BROWSER.equalsIgnoreCase("ie")) { startTimeTxtBox.clear(); startTimeTxtBox.sendKeys(startTime); } else if (BROWSER.equalsIgnoreCase("firefox")) { startTimeTxtBox.clear(); startTimeTxtBox.sendKeys(startTime); } else { setStartTime(startTime, fromMeridian); setStartTime(startTime, fromMeridian); } return this; }

Target:
public SchedulePage setStartTimeDate(String startTime) { String from = getTimeElement(startTime, "hours"); from = from + ":"+ getTimeElement(startTime, "minutes"); String fromMeridian = getTimeElement(startTime, "meridian"); if(BROWSER.equalsIgnoreCase("ie")) { startTimeTxtBox.clear(); startTimeTxtBox.sendKeys(startTime); } else if (BROWSER.equalsIgnoreCase("firefox")) { startTimeTxtBox.clear(); startTimeTxtBox.sendKeys(startTime); } else { setStartTime(startTime, fromMeridian); } return this; }
Source:
public CompletionStage<Boolean> reload() { if (supportsReloading()) { CompletableFuture<Boolean> result = new CompletableFuture<>(); RunOrSchedule.on(singleThreaded.adminExecutor, () -> singleThreaded.reload(result)); return result; } else { return CompletableFutures.failedFuture( new UnsupportedOperationException( "This instance of DefaultDriverConfigLoader does not support reloading")); } }

Target:
public final CompletionStage<Boolean> reload() { if (supportsReloading) { CompletableFuture<Boolean> result = new CompletableFuture<>(); RunOrSchedule.on(singleThreaded.adminExecutor, () -> singleThreaded.reload(result)); return result; } else { return CompletableFutures.failedFuture( new UnsupportedOperationException( "This instance of DefaultDriverConfigLoader does not support reloading")); } }
Source:
ReviewHarness(String testIdent, PrivilegeLevel privilegeLevel) throws Exception { this.testIdent = testIdent; gerritHarness = GerritFixture.current().harness(); git = gerritHarness.project().getGitProject(privilegeLevel); connector = new GerritConnector(); repository = GerritFixture.current().singleRepository(); UserCredentials credentials = GerritFixture.current().getCredentials(privilegeLevel); repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), credentials.getPassword()), true); client = gerritHarness.client(privilegeLevel); provider = new GerritRemoteFactoryProvider(client); provider.setService(new JobRemoteService()); provider.setDataLocator(new TestDataLocator()); }

Target:
ReviewHarness(String testIdent, PrivilegeLevel privilegeLevel) throws Exception { this.testIdent = testIdent; gerritHarness = GerritFixture.current().harness(); git = gerritHarness.project().getGitProject(privilegeLevel); connector = new GerritConnector(); repository = GerritFixture.current().singleRepository(); client = gerritHarness.client(privilegeLevel); provider = new GerritRemoteFactoryProvider(client); provider.setService(new JobRemoteService()); provider.setDataLocator(new TestDataLocator()); }
Source:
public String getPort() { String port = System.getProperty(this.port); if (port == null) { port = getPort(getProtocol()); } return port; }

Target:
public String getPort() { return System.getProperty(this.port, getPort(getProtocol())); }
Source:
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { if (stateIn.has(BlockStateProperties.WATERLOGGED) && stateIn.get(BlockStateProperties.WATERLOGGED)) { worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn)); } return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos); }

Target:
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { if(stateIn.has(BlockStateProperties.WATERLOGGED)&&stateIn.get(BlockStateProperties.WATERLOGGED)) worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn)); return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos); }
Source:
public Set<Execution> getAllExecutions() { List<Execution> allExecutions = null; LinkedHashSet<Execution> allOrderedExecutions = null; if (useCache) { if (allExecutionsCache != null) { allExecutions = Lists.newArrayList(allExecutionsCache); } allOrderedExecutions = allOrderedExecutionsCache; } if (allOrderedExecutions == null) { if (allExecutions == null) { allExecutions = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), Execution.notationPredicate())) { Option<Execution> exec = ISequenceElementAccessor.getExecution(node); assert exec.some() : INTERNAL_ERROR; allExecutions.add(exec.get()); } if (useCache) { allExecutionsCache = Lists.newArrayList(allExecutions); } } Collections.sort(allExecutions, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedExecutions = Sets.newLinkedHashSet(allExecutions); if (useCache) { allOrderedExecutionsCache = allOrderedExecutions; } } return allOrderedExecutions; }

Target:
public Set<Execution> getAllExecutions() { List<Execution> allExecutions = null; LinkedHashSet<Execution> allOrderedExecutions = null; if (useCache) { if (allExecutionsCache != null) { allExecutions = Lists.newArrayList(allExecutionsCache); } allOrderedExecutions = allOrderedExecutionsCache; } if (allOrderedExecutions == null) { if (allExecutions == null) { allExecutions = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), Execution.notationPredicate())) { Option<Execution> exec = ISequenceElementAccessor.getExecution(node); assert exec.some() : INTERNAL_ERROR; allExecutions.add(exec.get()); } if (useCache) { allExecutionsCache = allExecutions; } } Collections.sort(allExecutions, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedExecutions = Sets.newLinkedHashSet(allExecutions); if (useCache) { allOrderedExecutionsCache = allOrderedExecutions; } } return allOrderedExecutions; }
Source:
public ResultValidator expectEvents(Object... expectedEvents) { if (expectedEvents.length != publishedEvents.size()) { reporter.reportWrongEvent(publishedEvents, Arrays.asList(expectedEvents), actualException); } Iterator<EventMessage<?>> iterator = publishedEvents.iterator(); for (Object expectedEvent : expectedEvents) { EventMessage actualEvent = iterator.next(); if (EventMessage.class.isInstance(expectedEvent)) { EventMessage<?> expectedEventMessage = (EventMessage<?>) expectedEvent; if (!verifyEventEquality(expectedEventMessage.getPayload(), actualEvent.getPayload()) || !verifyMetaDataEquality(expectedEventMessage.getMetaData(), actualEvent.getMetaData())) { reporter.reportWrongEvent(publishedEvents, Arrays.asList(expectedEvents), actualException); } } else if (!verifyEventEquality(expectedEvent, actualEvent.getPayload())) { reporter.reportWrongEvent(publishedEvents, Arrays.asList(expectedEvents), actualException); } } return this; }

Target:
public ResultValidator expectEvents(Object... expectedEvents) { if (expectedEvents.length != publishedEvents.size()) { reporter.reportWrongEvent(publishedEvents, Arrays.asList(expectedEvents), actualException); } Iterator<EventMessage<?>> iterator = publishedEvents.iterator(); for (Object expectedEvent : expectedEvents) { EventMessage actualEvent = iterator.next(); if (!verifyEventEquality(expectedEvent, actualEvent.getPayload())) { reporter.reportWrongEvent(publishedEvents, Arrays.asList(expectedEvents), actualException); } } return this; }
Source:
public Fluid setColor(Color color) { this.color = (color.getAlpha()<<24) + (color.getRed()<<16) + (color.getGreen()<<8) + color.getBlue(); return this; }

Target:
public Fluid setColor(Color color) { this.color = color.getRGB(); return this; }
Source:
public OrderByOperator( OperatorContext operatorContext, List<Type> sourceTypes, List<Integer> outputChannels, int expectedPositions, List<Integer> sortChannels, List<SortOrder> sortOrder, PagesIndex.Factory pagesIndexFactory, boolean spillEnabled, Optional<SpillerFactory> spillerFactory) { requireNonNull(pagesIndexFactory, "pagesIndexFactory is null"); this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.outputChannels = Ints.toArray(requireNonNull(outputChannels, "outputChannels is null")); this.sortChannels = ImmutableList.copyOf(requireNonNull(sortChannels, "sortChannels is null")); this.sortOrder = ImmutableList.copyOf(requireNonNull(sortOrder, "sortOrder is null")); this.sourceTypes = sourceTypes; this.localUserMemoryContext = operatorContext.localUserMemoryContext(); this.localRevocableMemoryContext = operatorContext.localRevocableMemoryContext(); this.spillerFactory = spillerFactory; this.pageIndex = pagesIndexFactory.newPagesIndex(sourceTypes, expectedPositions); this.spillEnabled = spillEnabled; }

Target:
public OrderByOperator( OperatorContext operatorContext, List<Type> sourceTypes, List<Integer> outputChannels, int expectedPositions, List<Integer> sortChannels, List<SortOrder> sortOrder, PagesIndex.Factory pagesIndexFactory, boolean spillEnabled, Optional<SpillerFactory> spillerFactory) { requireNonNull(pagesIndexFactory, "pagesIndexFactory is null"); this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.outputChannels = Ints.toArray(requireNonNull(outputChannels, "outputChannels is null")); this.sortChannels = ImmutableList.copyOf(requireNonNull(sortChannels, "sortChannels is null")); this.sortOrder = ImmutableList.copyOf(requireNonNull(sortOrder, "sortOrder is null")); this.sourceTypes = sourceTypes; this.pagesIndexUserMemoryContext = operatorContext.localUserMemoryContext(); this.pagesIndexRevocableMemoryContext = operatorContext.localRevocableMemoryContext(); this.spillerFactory = spillerFactory; this.pageIndex = pagesIndexFactory.newPagesIndex(sourceTypes, expectedPositions); this.spillEnabled = spillEnabled; }
Source:
public synchronized PartitionUpsertMetadataManager getOrCreatePartitionManager(int partitionId) { if(!_partitionMetadataManagerMap.containsKey(partitionId)) { _partitionMetadataManagerMap.put(partitionId, new PartitionUpsertMetadataManager(partitionId)); } return _partitionMetadataManagerMap.get(partitionId); }

Target:
public PartitionUpsertMetadataManager getOrCreatePartitionManager(int partitionId) { return _partitionMetadataManagerMap.computeIfAbsent(partitionId, k -> new PartitionUpsertMetadataManager()); }