auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public WorkflowItemRest upload(HttpServletRequest request, String apiCategory, String model, Integer id, MultipartFile file) throws Exception { Context context = obtainContext(); WorkflowItemRest wsi = findOne(id); XmlWorkflowItem source = wis.find(context, id); List<ErrorRest> errors = new ArrayList<ErrorRest>(); SubmissionConfig submissionConfig = submissionConfigReader.getSubmissionConfigByName(wsi.getSubmissionDefinition().getName()); for (int i = 0; i < submissionConfig.getNumberOfSteps(); i++) { SubmissionStepConfig stepConfig = submissionConfig.getStep(i); ClassLoader loader = this.getClass().getClassLoader(); Class stepClass; try { stepClass = loader.loadClass(stepConfig.getProcessingClassName()); Object stepInstance = stepClass.newInstance(); if (UploadableStep.class.isAssignableFrom(stepClass)) { UploadableStep uploadableStep = (UploadableStep) stepInstance; uploadableStep.doPreProcessing(context, source); ErrorRest err = uploadableStep.upload(context, submissionService, stepConfig, source, file); uploadableStep.doPostProcessing(context, source); if (err != null) { errors.add(err); } } } catch (Exception e) { log.error(e.getMessage(), e); } } wsi = converter.convert(source); if (errors.isEmpty()) { wsi.setStatus(true); } else { wsi.setStatus(false); wsi.getErrors().addAll(errors); } context.commit(); return wsi; }

Target:
public WorkflowItemRest upload(HttpServletRequest request, String apiCategory, String model, Integer id, MultipartFile file) throws Exception { Context context = obtainContext(); WorkflowItemRest wsi = findOne(id); XmlWorkflowItem source = wis.find(context, id); List<ErrorRest> errors = new ArrayList<ErrorRest>(); SubmissionConfig submissionConfig = submissionConfigReader.getSubmissionConfigByName(wsi.getSubmissionDefinition().getName()); for (int i = 0; i < submissionConfig.getNumberOfSteps(); i++) { SubmissionStepConfig stepConfig = submissionConfig.getStep(i); ClassLoader loader = this.getClass().getClassLoader(); Class stepClass; try { stepClass = loader.loadClass(stepConfig.getProcessingClassName()); Object stepInstance = stepClass.newInstance(); if (UploadableStep.class.isAssignableFrom(stepClass)) { UploadableStep uploadableStep = (UploadableStep) stepInstance; uploadableStep.doPreProcessing(context, source); ErrorRest err = uploadableStep.upload(context, submissionService, stepConfig, source, file); uploadableStep.doPostProcessing(context, source); if (err != null) { errors.add(err); } } } catch (Exception e) { log.error(e.getMessage(), e); } } wsi = converter.convert(source); if (!errors.isEmpty()) { wsi.getErrors().addAll(errors); } context.commit(); return wsi; }
Source:
public static SSAInformation convert( AstMethod M, final AstIRFactory.AstIR ir, SSAOptions options, final IntSet values) { try { if (DEBUG) { System.err.println(("starting conversion for " + values)); System.err.println(ir); } if (DEBUG_UNDO) System.err.println((">>> starting " + ir.getMethod())); SSAConversion ssa = new SSAConversion(M, ir, options) { final int limit = ir.getSymbolTable().getMaxValueNumber(); @Override protected boolean skip(int i) { return (i >= 0) && (i <= limit) && (!values.contains(i)); } }; ssa.perform(); if (DEBUG_UNDO) System.err.println(("<<< done " + ir.getMethod())); return ssa.getComputedLocalMap(); } catch (RuntimeException | Error e) { throw e; } }

Target:
public static SSAInformation convert( AstMethod M, final AstIRFactory.AstIR ir, SSAOptions options, final IntSet values) { if (DEBUG) { System.err.println(("starting conversion for " + values)); System.err.println(ir); } if (DEBUG_UNDO) System.err.println((">>> starting " + ir.getMethod())); SSAConversion ssa = new SSAConversion(M, ir, options) { final int limit = ir.getSymbolTable().getMaxValueNumber(); @Override protected boolean skip(int i) { return (i >= 0) && (i <= limit) && (!values.contains(i)); } }; ssa.perform(); if (DEBUG_UNDO) System.err.println(("<<< done " + ir.getMethod())); return ssa.getComputedLocalMap(); }
Source:
public void execute() throws MetaClassNotFoundException, FeatureNotFoundException { Session session = null; if (objectToDelete instanceof DSemanticDecorator) { session = SessionManager.INSTANCE.getSession(((DSemanticDecorator) objectToDelete).getTarget()); } else { session = SessionManager.INSTANCE.getSession(objectToDelete); } ECrossReferenceAdapter semanticCrossReferencer = null; if (session != null) { semanticCrossReferencer = session.getSemanticCrossReferencer(); } accessor.eDelete(objectToDelete, semanticCrossReferencer); }

Target:
public void execute() throws MetaClassNotFoundException, FeatureNotFoundException { Session session = null; if (objectToDelete instanceof DSemanticDecorator) { session = SessionManager.INSTANCE.getSession(((DSemanticDecorator) objectToDelete).getTarget()); } else { session = SessionManager.INSTANCE.getSession(objectToDelete); } ECrossReferenceAdapter semanticCrossReferencer = null; if (session != null) { semanticCrossReferencer = session.getSemanticCrossReferencer(); } accessor.eDelete(objectToDelete, semanticCrossReferencer, danglingEReferencesToIgnores); }
Source:
static public void init(int maxPhraseLength, String path, boolean flatgazetteers) throws IOException { if(gazetteers_map.containsKey(path)) { gazetteers = gazetteers_map.get(path); } else { synchronized (GAZ_INIT_LOCK) { if (flatgazetteers) { gazetteers = new FlatGazetteers(path); } else { gazetteers = new TreeGazetteers(maxPhraseLength, path); } } gazetteers_map.put(path, gazetteers); } }

Target:
static public void init(int maxPhraseLength, String path, boolean flatgazetteers) throws IOException { synchronized (GAZ_INIT_LOCK) { if (flatgazetteers) { if (!gazetteers_map.containsKey(path) || gazetteers_map.get(path) instanceof TreeGazetteers) { gazetteers_map.put(path, new FlatGazetteers(path)); } } else { if (!gazetteers_map.containsKey(path) || gazetteers_map.get(path) instanceof FlatGazetteers) { gazetteers_map.put(path, new TreeGazetteers(maxPhraseLength, path)); } } gazetteers = gazetteers_map.get(path); } }
Source:
private void initColumns(int widthHint, int treeWidgetWidth, String[] visibleColumnIds) { for (TreeColumn treeColumn : getTree().getColumns()) { Object colData = treeColumn.getData(); String columnId = colData instanceof String ? (String) colData : null; Integer width = fColumnSizes.get(colData); if (width == null) { int ans = getInitialColumnWidth(columnId, treeWidgetWidth, visibleColumnIds); if (ans == -1) { treeColumn.setWidth(widthHint); } else { treeColumn.setWidth(ans); } } else { treeColumn.setWidth(width.intValue()); } treeColumn.addControlListener(fListener); } }

Target:
private void initColumns(int widthHint, int treeWidgetWidth, String[] visibleColumnIds) { for (TreeColumn column : getTree().getColumns()) { Object colData = column.getData(); String columnId = colData instanceof String ? (String) colData : null; Integer width = fColumnSizes.get(colData); if (width == null) { int ans = getInitialColumnWidth(columnId, treeWidgetWidth, visibleColumnIds); if (ans == -1) { column.setWidth(widthHint); } else { column.setWidth(ans); } } else { column.setWidth(width.intValue()); } column.addControlListener(fListener); } }
Source:
public void accept() { if (m_eos.get()) return; AtomicBoolean workerInService = new AtomicBoolean(false); while (shouldRun()) { if (!workerInService.get() && !m_eos.get()) { try { KinesisClientLibConfiguration kclConfig = new KinesisClientLibConfiguration(m_config.getAppName(), m_config.getStreamName(), credentials(), UUID.randomUUID().toString()); kclConfig.withRegionName(m_config.getRegion()).withMaxRecords(m_config.getMaxReadBatchSize()) .withInitialPositionInStream(InitialPositionInStream.TRIM_HORIZON) .withIdleTimeBetweenReadsInMillis(m_config.getIdleTimeBetweenReads()) .withTaskBackoffTimeMillis(m_config.getTaskBackoffTimeMillis()).withKinesisClientConfig( KinesisStreamImporterConfig.getClientConfigWithUserAgent(m_config.getAppName())); m_worker = new Worker.Builder().recordProcessorFactory(new RecordProcessorFactory()) .config(kclConfig).build(); info(null, "Starting worker for Kinesis stream %s", m_config.getStreamName()); workerInService.compareAndSet(false, true); m_worker.run(); } catch (Exception e) { rateLimitedLog(Level.ERROR, e, "Error in Kinesis stream importer %s", m_config.getResourceID()); if (null != m_worker) m_worker.shutdown(); if (shouldRun()) { backoffSleep(3); workerInService.compareAndSet(true, false); } } } } m_eos.compareAndSet(false, true); info(null, "The importer stops: %s", m_config.getResourceID().toString()); }

Target:
public void accept() { info(null, "Starting data stream fetcher for " + m_config.getResourceID().toString()); try { KinesisClientLibConfiguration kclConfig = new KinesisClientLibConfiguration(m_config.getAppName(), m_config.getStreamName(), credentials(), UUID.randomUUID().toString()); kclConfig.withRegionName(m_config.getRegion()).withMaxRecords((int) m_config.getMaxReadBatchSize()) .withInitialPositionInStream(InitialPositionInStream.TRIM_HORIZON) .withIdleTimeBetweenReadsInMillis(m_config.getIdleTimeBetweenReads()) .withTaskBackoffTimeMillis(m_config.getTaskBackoffTimeMillis()).withKinesisClientConfig( KinesisStreamImporterConfig.getClientConfigWithUserAgent(m_config.getAppName())); m_worker = new Worker.Builder().recordProcessorFactory(new RecordProcessorFactory()).config(kclConfig) .build(); m_worker.run(); } catch (RuntimeException e) { rateLimitedLog(Level.ERROR, e, "Error in Kinesis stream importer %s", m_config.getResourceID()); if (null != m_worker) m_worker.shutdown(); } info(null, "Data stream fetcher stopped for %s. Callback Rcvd: %d. Submitted: %d", m_config.getResourceID().toString(), m_cbcnt.get(), m_submitCount.get()); }
Source:
public void onCreate() { super.onCreate(); TwitterAuthConfig authConfig = new TwitterAuthConfig(BuildConfig.TWITTER_API_KEY, BuildConfig.TWITTER_API_SECRET); Fabric.with(this, new Crashlytics(), new Twitter(authConfig)); LoggerStarter.start(this); graph = ObjectGraph.create(Modules.list(this)); }

Target:
public void onCreate() { super.onCreate(); LoggerStarter.start(this); graph = ObjectGraph.create(Modules.list(this)); }
Source:
public void shouldMapMeasurementToDefinedMeasurementNameAndRegex() { Map<String, String> measurementMappings = new HashMap<String, String>(); measurementMappings.put("resources", ".*resources.*"); InfluxDbReporter filteredReporter = InfluxDbReporter .forRegistry(registry) .measurementMappings(measurementMappings) .build(influxDb); filteredReporter.report( this.<Gauge>map(), this.<Counter>map(), this.<Histogram>map(), this.map("com.example.resources.RandomResource", mock(Meter.class)), this.<Timer>map() ); final ArgumentCaptor<InfluxDbPoint> influxDbPointCaptor = ArgumentCaptor.forClass(InfluxDbPoint.class); Mockito.verify(influxDb, atLeastOnce()).appendPoints(influxDbPointCaptor.capture()); InfluxDbPoint point = influxDbPointCaptor.getValue(); assertThat(point.getMeasurement()).isEqualTo("resources"); }

Target:
public void shouldMapMeasurementToDefinedMeasurementNameAndRegex() { Map<String, String> measurementMappings = new HashMap<String, String>(); measurementMappings.put("resources", ".*resources.*"); final InfluxDbReporter reporter = InfluxDbReporter .forRegistry(registry) .measurementMappings(measurementMappings) .build(influxDb); reporter.report( this.<Gauge>map(), this.<Counter>map(), this.<Histogram>map(), this.map("com.example.resources.RandomResource", mock(Meter.class)), this.<Timer>map() ); final ArgumentCaptor<InfluxDbPoint> influxDbPointCaptor = ArgumentCaptor.forClass(InfluxDbPoint.class); Mockito.verify(influxDb, atLeastOnce()).appendPoints(influxDbPointCaptor.capture()); InfluxDbPoint point = influxDbPointCaptor.getValue(); assertThat(point.getMeasurement()).isEqualTo("resources"); assertThat(point.getTags()).containsEntry("metricName", "com.example.resources.RandomResource"); }
Source:
public static void bind(final String propName, StringProperty stringProp) { if(props == null) { return; } String storedValue = props.getProperty(propName); if(storedValue != null) { stringProp.set(storedValue); } stringProp.addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> o, String oldValue, String newValue) { props.setProperty(propName, newValue); store(); }}); }

Target:
public static void bind(final String propName, StringProperty stringProp) { if(props == null) { return; } String storedValue = props.getProperty(propName); if(storedValue != null) { stringProp.set(storedValue); } stringProp.addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> o, String oldValue, String newValue) { props.setProperty(propName, newValue); timer.schedule(new TimerTask() { @Override public void run() { if(!awaitingStore) { Platform.runLater(PrefBind::store); awaitingStore = true; } }}, 1000); }}); }
Source:
private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singletonList( String.format("HTTP/1.1 %d %s", status, reason) ), new Filtered<String>( item -> { return !item.startsWith("HTTP/"); }, origin.head() ) ); }

Target:
private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singletonList( String.format("HTTP/1.1 %d %s", status, reason) ), new Filtered<String>( item -> !item.startsWith("HTTP/"), origin.head() ) ); }
Source:
public IndexGeneratorJob( HadoopDruidIndexerConfig config ) { this.config = config; }

Target:
public IndexGeneratorJob( HadoopDruidIndexerConfig config ) { this.config = config; this.jobStats = new IndexGeneratorStats(); }
Source:
private void writeAndFlushNextMessageIfPossible(final Channel channel) throws IOException { if (fatalError || !channel.isWritable()) { return; } BufferAndAvailability next = null; try { while (true) { NetworkSequenceViewReader reader = pollAvailableReader(); if (reader == null) { return; } next = reader.getNextBuffer(); if (next == null) { if (!reader.isReleased()) { continue; } Throwable cause = reader.getFailureCause(); if (cause != null) { ErrorResponse msg = new ErrorResponse( new ProducerFailedException(cause), reader.getReceiverId()); ctx.writeAndFlush(msg); } } else { if (next.moreAvailable()) { registerAvailableReader(reader); } Object msg; if (next.buffer() != null) { msg = new BufferResponse( next.buffer(), reader.getSequenceNumber(), reader.getReceiverId(), next.backlog()); } else { msg = new NettyMessage.AddBacklog(next.backlog(), reader.getReceiverId()); } channel.writeAndFlush(msg).addListener(writeListener); return; } } } catch (Throwable t) { if (next != null) { next.buffer().recycleBuffer(); } throw new IOException(t.getMessage(), t); } }

Target:
private void writeAndFlushNextMessageIfPossible(final Channel channel) throws IOException { if (fatalError || !channel.isWritable()) { return; } ServerOutboundMessage next = null; try { while (true) { NetworkSequenceViewReader reader = pollAvailableReader(); if (reader == null) { return; } next = reader.getNextMessage(); if (next == null) { if (!reader.isReleased()) { continue; } Throwable cause = reader.getFailureCause(); if (cause != null) { ErrorResponse msg = new ErrorResponse( new ProducerFailedException(cause), reader.getReceiverId()); ctx.writeAndFlush(msg); } } else { if (next.isMoreAvailable()) { registerAvailableReader(reader); } channel.writeAndFlush(next.build()).addListener(writeListener); return; } } } catch (Throwable t) { if (next != null) { next.recycle(); } throw new IOException(t.getMessage(), t); } }
Source:
private static Object lockFor(Node node) { return ExtensionList.lookupSingleton(WorkspaceLocatorImpl.class).nodeLocks.computeIfAbsent(node.getNodeName(), name -> new StringBuilder("WorkspaceLocatorImpl lock for ").append(name).toString()); }

Target:
private static Object lockFor(Node node) { try { return ExtensionList.lookupSingleton(WorkspaceLocatorImpl.class).nodeLocks.get(node); } catch (ExecutionException x) { throw new AssertionError(x); } }
Source:
public void beginTraining() { String trainingSetSource = "{training-set-SAS-URL}"; boolean useLabelFile = true; formTrainingAsyncClient.beginTraining(trainingSetSource, useLabelFile).subscribe( recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEach(customFormSubModel -> customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); }); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean }

Target:
public void beginTraining() { String trainingFilesUrl = "{training-set-SAS-URL}"; boolean useTrainingLabels = true; formTrainingAsyncClient.beginTraining(trainingFilesUrl, useTrainingLabels).subscribe( recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEach(customFormSubModel -> customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); }); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean }
Source:
public static String generateMatcher(final ImmutableList<Ds3EnumConstant> enumConstants) { final StringBuilder outputBuilder = new StringBuilder(); final int numConstants = enumConstants.size(); if (numConstants > 0) { for (int currentIndex = 0; currentIndex < numConstants; currentIndex++) { outputBuilder.append(CHelper.indent(1)); if (currentIndex > 0) { outputBuilder.append("} else "); } final String currentEnumName = enumConstants.get(currentIndex).getName(); outputBuilder.append("if (xmlStrcmp(text, (const xmlChar*) \""). append(currentEnumName). append("\") == 0) {").append(System.lineSeparator()); outputBuilder.append(indent(2)).append("return "). append(currentEnumName). append(";").append(System.lineSeparator()); } final String enumName = enumConstants.get(0).getName(); outputBuilder.append(indent(1)).append("} else {").append(System.lineSeparator()); outputBuilder.append(indent(2)).append("ds3_log_message(log, DS3_ERROR, \"ERROR: Unknown value of '%s'. Returning "). append(enumName). append(" for safety.").append(System.lineSeparator()); outputBuilder.append(indent(2)).append("return "). append(enumName). append(";").append(System.lineSeparator()); outputBuilder.append(indent(1)).append("}").append(System.lineSeparator()); return outputBuilder.toString(); } return ""; }

Target:
public static String generateMatcher(final ImmutableList<Ds3EnumConstant> enumConstants) { final StringBuilder outputBuilder = new StringBuilder(); final int numConstants = enumConstants.size(); if (numConstants <= 0) { return ""; } for (int currentIndex = 0; currentIndex < numConstants; currentIndex++) { outputBuilder.append(indent(1)); if (currentIndex > 0) { outputBuilder.append("} else "); } final String currentEnumName = enumConstants.get(currentIndex).getName(); outputBuilder.append("if (xmlStrcmp(text, (const xmlChar*) \""). append(currentEnumName). append("\") == 0) {").append(System.lineSeparator()); outputBuilder.append(indent(2)).append("return "). append(currentEnumName). append(";").append(System.lineSeparator()); } final String enumName = enumConstants.get(0).getName(); outputBuilder.append(indent(1)).append("} else {").append(System.lineSeparator()); outputBuilder.append(indent(2)).append("ds3_log_message(log, DS3_ERROR, \"ERROR: Unknown value of '%s'. Returning "). append(enumName). append(" for safety.").append(System.lineSeparator()); outputBuilder.append(indent(2)).append("return "). append(enumName). append(";").append(System.lineSeparator()); outputBuilder.append(indent(1)).append("}").append(System.lineSeparator()); return outputBuilder.toString(); }
Source:
public WorkStateImpl(String name, List<? extends IAtsUser> assignees, double hoursSpent, int percentComplete) { this.name = name; Conditions.checkNotNullOrContainNull(assignees, "assignees"); this.assignees.addAll(assignees); this.hoursSpent = hoursSpent; this.percentComplete = percentComplete; }

Target:
public WorkStateImpl(String name, List<? extends IAtsUser> assignees, double hoursSpent, int percentComplete) { this.name = name; this.assignees.addAll(assignees); this.hoursSpent = hoursSpent; this.percentComplete = percentComplete; }
Source:
private static String cleanName(Class<?> type) { String simpleName = type.getSimpleName(); int $$idx = simpleName.indexOf("$$"); if ($$idx > 0) { simpleName = simpleName.substring(0, $$idx); } return simpleName; }

Target:
private static String cleanName(Class<?> type) { String simpleName = type.getSimpleName(); int doubleDollarIdx = simpleName.indexOf("$$"); if (doubleDollarIdx > 0) { simpleName = simpleName.substring(0, doubleDollarIdx); } return simpleName; }
Source:
private void loadContent(Tip tip) { if (tip instanceof ISwtTip) { loadContentSWT(tip); } else if (tip instanceof IHtmlTip) { loadContentHtml((IHtmlTip) tip); } else if (tip instanceof IUrlTip) { loadContentUrl((IUrlTip) tip); } else { fTipManager.log(LogUtil.error(getClass(), Messages.TipComposite_12 + tip)); } if (tip instanceof IBrowserFunctionProvider) { Map<String, Function<Object[], Object>> browserFunctions = ((IBrowserFunctionProvider) tip) .getBrowserFunctions(); for (Entry<String, Function<Object[], Object>> bFunctionEntry : browserFunctions.entrySet()) { new BrowserFunction(getBrowser(), bFunctionEntry.getKey()) { @Override public Object function(Object[] arguments) { return bFunctionEntry.getValue().apply(arguments); } }; } } fContentComposite.requestLayout(); }

Target:
private void loadContent(Tip tip) { if (tip instanceof ISwtTip) { loadContentSWT(tip); } else if (tip instanceof IHtmlTip) { loadContentHtml((IHtmlTip) tip); applyBrowserFunctions(tip); } else if (tip instanceof IUrlTip) { loadContentUrl((IUrlTip) tip); applyBrowserFunctions(tip); } else { fTipManager.log(LogUtil.error(getClass(), Messages.TipComposite_12 + tip)); } fContentComposite.requestLayout(); }
Source:
public void replaceAtHead(long key, Chain expect, Chain update) { LongConsumer lambda = (k) -> segmentFor(k).replaceAtHead(k, expect, update); try { lambda.accept(key); } catch (OversizeMappingException e) { consumeOversizeMappingException(key, lambda); } }

Target:
public void replaceAtHead(long key, Chain expect, Chain update) { try { segmentFor(key).replaceAtHead(key, expect, update); } catch (OversizeMappingException e) { consumeOversizeMappingException(key, (long k) -> segmentFor(k).replaceAtHead(k, expect, update)); } }
Source:
private DataPublisher getDataPublisher() throws ConfigurationException { AgentHolder.setConfigPath(getDataAgentConfigPath()); String url = getUrl(); DataPublisher dataPublisher; try { dataPublisher = new DataPublisher(url, getUsername(), getPassword()); } catch (DataEndpointAgentConfigurationException | DataEndpointException | DataEndpointConfigurationException | DataEndpointAuthenticationException | TransportException e) { throw new ConfigurationException("Configuring Data Endpoint Agent failed", e); } return dataPublisher; }

Target:
private DataPublisher getDataPublisher() throws ConfigurationException { AgentHolder.setConfigPath(getDataAgentConfigPath()); String url = getUrl(); DataPublisher dataPublisher; try { dataPublisher = new DataPublisher(url, getUsername(), getPassword()); } catch (DataEndpointAgentConfigurationException e) { LOG.error("Data Endpoint Agent configuration failed: " + e); throw new ConfigurationException("Data Endpoint Agent configuration failed: ", e); } catch (DataEndpointException e) { LOG.error("Communication with Data Endpoint failed: " + e); throw new ConfigurationException("Communication with Data Endpoint failed: ", e); } catch (DataEndpointConfigurationException e) { LOG.error("Parsing Data Endpoint configurations failed: " + e); throw new ConfigurationException("Parsing Data Endpoint configurations failed: ", e); } catch (DataEndpointAuthenticationException e) { LOG.error("Connection to Data Endpoint failed during authentication: " + e); throw new ConfigurationException("Connection to Data Endpoint failed during authentication: ", e); } catch (TransportException e) { LOG.error("Connection failed: " + e); throw new ConfigurationException("Connection failed: ", e); } return dataPublisher; }
Source:
private Long poisonStoreAndGetLastAllocatedTimestamp(Connection connection, Limits limits, TableStatus tableStatus) throws SQLException { long lastAllocated; if (tableStatus == TableStatus.NO_DATA) { lastAllocated = AtlasDbFactory.NO_OP_FAST_FORWARD_TIMESTAMP; } else { lastAllocated = limits.upperLimit().get().value(); } poisonTable(connection); return lastAllocated; }

Target:
private Long poisonStoreAndGetLastAllocatedTimestamp(Connection connection, Limits limits, TableStatus tableStatus) throws SQLException { long lastAllocated = tableStatus == TableStatus.NO_DATA ? AtlasDbFactory.NO_OP_FAST_FORWARD_TIMESTAMP : limits.upperLimit().get().value(); poisonTable(connection); return lastAllocated; }
Source:
protected synchronized void executeFunctionsUponCompletion() { if (uponCompletionFunctions != null) { executeFunctions(uponCompletionFunctions); uponCompletionFunctions = null; } }

Target:
protected void executeFunctionsUponCompletion() { if (uponCompletionFunctions != null) { executeFunctions(uponCompletionFunctions); uponCompletionFunctions = null; } }
Source:
private void createVMFromTemplate() { VmTemplate template = getSelectedItem(); final List<UICommand> commands = new ArrayList<>(); commands.add(UICommand.createDefaultOkUiCommand("OnSaveVm", this)); commands.add(UICommand.createCancelUiCommand("Cancel", this)); AsyncQuery getVmInitQuery = new AsyncQuery(); getVmInitQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { VmTemplate withVmInit = (VmTemplate) result; setupNewVmModel(new UnitVmModel(new NewVmFromTemplateModelBehavior(withVmInit), TemplateListModel.this), withVmInit.getVmType(), getSystemTreeSelectedItem(), commands); } }; AsyncDataProvider.getInstance().getTemplateById(getVmInitQuery, template.getId()); }

Target:
private void createVMFromTemplate() { VmTemplate template = getSelectedItem(); final List<UICommand> commands = new ArrayList<>(); commands.add(UICommand.createDefaultOkUiCommand("OnSaveVm", this)); commands.add(UICommand.createCancelUiCommand("Cancel", this)); AsyncDataProvider.getInstance().getTemplateById(new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VmTemplate withVmInit = (VmTemplate) returnValue; setupNewVmModel(new UnitVmModel(new NewVmFromTemplateModelBehavior(withVmInit), TemplateListModel.this), withVmInit.getVmType(), getSystemTreeSelectedItem(), commands); } }), template.getId()); }
Source:
public final String attemptToPipelineAuthorization(String method, String uri, Supplier<byte[]> entityBodySupplier) { String pipeliningType = authorizationPipeliningType.get(); if (DIGEST.equals(pipeliningType)) { Map<String, String> challenge = lastChallenge.get(); String algorithm = challenge.get(ALGORITHM); return createDigestAuthorizationHeader(method, uri, challenge, algorithm, entityBodySupplier, getDigestFunction(algorithm)); } else if (BASIC.equals(pipeliningType)) { return handleBasic(); } return null; }

Target:
public final String attemptToPipelineAuthorization(String method, String uri, Supplier<byte[]> entityBodySupplier) { String pipeliningType = authorizationPipeliningType.get(); if (DIGEST.equals(pipeliningType)) { Map<String, String> challenge = new HashMap<>(lastChallenge.get()); String algorithm = challenge.get(ALGORITHM); return createDigestAuthorizationHeader(method, uri, challenge, algorithm, entityBodySupplier, getDigestFunction(algorithm)); } else if (BASIC.equals(pipeliningType)) { return handleBasic(); } return null; }
Source:
public void writeJSONAddsContainerWithAllValues() throws ComponentLookupException { Map<String, String> map = new LinkedHashMap<String, String>(); map.put(PROPERTY_1, "datum1"); map.put(PROPERTY_2, "datum2"); PatientData<String> patientData = new DictionaryPatientData<String>(this.DATA_NAME, map); doReturn(patientData).when(this.patient).getData(DATA_NAME); JSONObject json = new JSONObject(); this.mocker.getComponentUnderTest().writeJSON(this.patient, json); Assert.assertNotNull(json.get(DATA_NAME)); Assert.assertTrue(json.get(DATA_NAME) instanceof JSONObject); JSONObject container = json.getJSONObject(DATA_NAME); Assert.assertEquals("datum1", container.get(PROPERTY_1)); Assert.assertEquals("datum2", container.get(PROPERTY_2)); }

Target:
public void writeJSONAddsContainerWithAllValues() throws ComponentLookupException { String datum1 = "datum1"; String datum2 = "datum2"; Map<String, String> map = new LinkedHashMap<>(); map.put(PROPERTY_1, datum1); map.put(PROPERTY_2, datum2); PatientData<String> patientData = new DictionaryPatientData<>(this.DATA_NAME, map); doReturn(patientData).when(this.patient).getData(DATA_NAME); JSONObject json = new JSONObject(); this.mocker.getComponentUnderTest().writeJSON(this.patient, json); Assert.assertNotNull(json.get(DATA_NAME)); Assert.assertTrue(json.get(DATA_NAME) instanceof JSONObject); JSONObject container = json.getJSONObject(DATA_NAME); Assert.assertEquals(datum1, container.get(PROPERTY_1)); Assert.assertEquals(datum2, container.get(PROPERTY_2)); }
Source:
public ItemStack decrStackSize(int i, int j) { if (!_drawer.isDrawerEnabled(i)) return null; IDrawer drawer = _drawer.getDrawer(i); if (drawer == null) return null; return getMultipleItems(ItemIdentifier.get(drawer.getStoredItemPrototype()), j); }

Target:
public ItemStack decrStackSize(int i, int j) { if (!_drawer.isDrawerEnabled(i)) return null; IDrawer drawer = _drawer.getDrawer(i); if (drawer == null || drawer.isEmpty()) return null; int avail = Math.min(j, drawer.getStoredItemCount()); drawer.setStoredItemCount(drawer.getStoredItemCount() - avail); ItemStack stack = drawer.getStoredItemCopy(); stack.stackSize = avail; return stack; }
Source:
default void testListColumnsOneSchema() throws Exception { SchemaTableName schemaTableName1 = schemaTableName("table1"); SchemaTableName schemaTableName2 = schemaTableName("table2"); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); List<ColumnMetadata> columns = ImmutableList.of( new ColumnMetadata("bigint_column", BIGINT), new ColumnMetadata("double_column", DOUBLE)); List<ColumnMetadata> expectedColumns = withSystemColumns(columns); ConnectorTableMetadata tableMetadata11 = new ConnectorTableMetadata(schemaTableName1, columns, getTableProperties()); ConnectorTableMetadata tableMetadata12 = new ConnectorTableMetadata(schemaTableName2, columns, getTableProperties()); try (AutoCloseable cleanup = withTables(session, tableMetadata11, tableMetadata12)) { run(ImmutableList.of( metadata -> assertEquals(metadata.listTableColumns(session, new SchemaTablePrefix()), ImmutableMap.of( schemaTableName1, expectedColumns, schemaTableName2, expectedColumns)), metadata -> assertEquals(metadata.listTableColumns(session, prefixOf(schemaTableName1)), ImmutableMap.of( schemaTableName1, expectedColumns)))); } }

Target:
default void testListColumnsOneSchema() throws Exception { SchemaTableName schemaTableName1 = schemaTableName("table1"); SchemaTableName schemaTableName2 = schemaTableName("table2"); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); List<ColumnMetadata> columns = ImmutableList.of( new ColumnMetadata("bigint_column", BIGINT), new ColumnMetadata("double_column", DOUBLE)); List<ColumnMetadata> expectedColumns = extendWithConnectorSpecificColumns(columns); ConnectorTableMetadata tableMetadata11 = new ConnectorTableMetadata(schemaTableName1, columns, getTableProperties()); ConnectorTableMetadata tableMetadata12 = new ConnectorTableMetadata(schemaTableName2, columns, getTableProperties()); withTables(session, ImmutableList.of(tableMetadata11, tableMetadata12), ImmutableList.of( metadata -> assertEquals(metadata.listTableColumns(session, new SchemaTablePrefix()), ImmutableMap.of( schemaTableName1, expectedColumns, schemaTableName2, expectedColumns)), metadata -> assertEquals(metadata.listTableColumns(session, prefixOf(schemaTableName1)), ImmutableMap.of( schemaTableName1, expectedColumns)))); }
Source:
public void process(Event event) { Map<String, String> dynamicProperties = new HashMap<String, String>(eventPublisherConfiguration.getToAdapterDynamicProperties()); Object outObject; if (traceEnabled) { trace.info(beforeTracerPrefix + event); } if (statisticsEnabled) { eventCounter.inc(); } if (!processingEnabled){ log.info(enable_message); return; } org.wso2.siddhi.core.event.Event siddhiEvent = EventPublisherUtil.convertToSiddhiEvent(event, inputStreamSize); try { if (customMappingEnabled) { outObject = outputMapper.convertToMappedInputEvent(siddhiEvent); } else { outObject = outputMapper.convertToTypedInputEvent(siddhiEvent); } } catch (EventPublisherConfigurationException e) { log.error("Cannot send " + event + " from " + eventPublisherConfiguration.getEventPublisherName(), e); return; } if (traceEnabled) { trace.info(afterTracerPrefix + outObject); } if (dynamicMessagePropertyEnabled) { changeDynamicEventAdapterMessageProperties(siddhiEvent.getData(), dynamicProperties, siddhiEvent.getArbitraryDataMap()); } OutputEventAdapterService eventAdapterService = EventPublisherServiceValueHolder.getOutputEventAdapterService(); eventAdapterService.publish(eventPublisherConfiguration.getEventPublisherName(), dynamicProperties, outObject); }

Target:
public void process(Event event) { Map<String, String> dynamicProperties = new HashMap<String, String>(eventPublisherConfiguration.getToAdapterDynamicProperties()); Object outObject; if (traceEnabled) { trace.info(beforeTracerPrefix + event); } if (statisticsEnabled) { eventCounter.inc(); } if (!processingEnabled) { return; } org.wso2.siddhi.core.event.Event siddhiEvent = EventPublisherUtil.convertToSiddhiEvent(event, inputStreamSize); try { if (customMappingEnabled) { outObject = outputMapper.convertToMappedInputEvent(siddhiEvent); } else { outObject = outputMapper.convertToTypedInputEvent(siddhiEvent); } } catch (EventPublisherConfigurationException e) { log.error("Cannot send " + event + " from " + eventPublisherConfiguration.getEventPublisherName(), e); return; } if (traceEnabled) { trace.info(afterTracerPrefix + outObject); } if (dynamicMessagePropertyEnabled) { changeDynamicEventAdapterMessageProperties(siddhiEvent.getData(), dynamicProperties, siddhiEvent.getArbitraryDataMap()); } OutputEventAdapterService eventAdapterService = EventPublisherServiceValueHolder.getOutputEventAdapterService(); eventAdapterService.publish(eventPublisherConfiguration.getEventPublisherName(), dynamicProperties, outObject); }
Source:
private ContainerConfig buildContainerConfig() { List<String> ports = params.getPorts().stream() .map(Objects::toString).collect(Collectors.toList()); Map<String, List<PortBinding>> portBindings = new HashMap<>(); for (String port : ports) { List<PortBinding> hostPorts = new ArrayList<>(); hostPorts.add(PortBinding.of(ALL_NETWORK_INTERFACES, port)); portBindings.put(port, hostPorts); } HostConfig.Bind configurationFile = HostConfig.Bind.builder() .from("/home/nsx/prometheus.yml") .to("/etc/prometheus/prometheus.yml").build(); HostConfig hostConfig = HostConfig.builder() .privileged(true) .binds(configurationFile) .portBindings(portBindings) .build(); ContainerConfig.Builder builder = ContainerConfig.builder(); builder.hostConfig(hostConfig) .exposedPorts(ports.stream().toArray(String[]::new)) .image(imageName.get(getParams().getNodeType())); if (cmd.containsKey(getParams().getNodeType())) { builder.cmd(cmd.get(getParams().getNodeType())); } return builder.build(); }

Target:
private ContainerConfig buildContainerConfig() { List<String> ports = params.getPorts().stream() .map(Objects::toString).collect(Collectors.toList()); Map<String, List<PortBinding>> portBindings = new HashMap<>(); for (String port : ports) { List<PortBinding> hostPorts = new ArrayList<>(); hostPorts.add(PortBinding.of(ALL_NETWORK_INTERFACES, port)); portBindings.put(port, hostPorts); } HostConfig.Bind configurationFile = HostConfig.Bind.builder() .from("/home/nsx/prometheus.yml") .to("/etc/prometheus/prometheus.yml").build(); HostConfig hostConfig = HostConfig.builder() .privileged(true) .binds(configurationFile) .portBindings(portBindings) .build(); ContainerConfig.Builder builder = ContainerConfig.builder(); builder.hostConfig(hostConfig) .exposedPorts(ports.stream().toArray(String[]::new)) .image(IMAGE_NAME.get(getParams().getNodeType())); if (CMD.containsKey(getParams().getNodeType())) { builder.cmd(CMD.get(getParams().getNodeType())); } return builder.build(); }
Source:
public final Sensor threadLevelSensor(final String threadId, final String sensorName, final RecordingLevel recordingLevel, final Sensor... parents) { final String key = threadSensorPrefix(threadId); synchronized (threadLevelSensors) { final String fullSensorName = key + SENSOR_NAME_DELIMITER + sensorName; return Optional.ofNullable(metrics.getSensor(fullSensorName)) .orElseGet(() -> { threadLevelSensors.putIfAbsent(key, new LinkedList<>()); threadLevelSensors.get(key).push(fullSensorName); return metrics.sensor(fullSensorName, recordingLevel, parents); }); } }

Target:
public final Sensor threadLevelSensor(final String threadId, final String sensorName, final RecordingLevel recordingLevel, final Sensor... parents) { final String key = threadSensorPrefix(threadId); synchronized (threadLevelSensors) { final String fullSensorName = key + SENSOR_NAME_DELIMITER + sensorName; return Optional.ofNullable(metrics.getSensor(fullSensorName)) .orElseGet(() -> { threadLevelSensors.computeIfAbsent(key, ignored -> new LinkedList<>()).push(fullSensorName); return metrics.sensor(fullSensorName, recordingLevel, parents); }); } }
Source:
public V replace(final K key, final V value) throws CacheLoaderException, CacheWriterException { putObserver.begin(); getObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final AtomicReference<V> old = new AtomicReference<V>(); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K k, final V inCache) { if (cacheWriter != null) { try { cacheWriter.write(key, value); } catch (Exception e) { throw newCacheWriterException(e); } } old.set(inCache); return value; } }); try { store.computeIfPresent(key, remappingFunction); } catch (CacheAccessException e) { putObserver.end(PutOutcome.FAILURE); getObserver.end(GetOutcome.FAILURE); try { remappingFunction.apply(key, null); } finally { removeKeysWithStrategy(Collections.singleton(key), e); } } catch (CacheWriterException e) { putObserver.end(PutOutcome.FAILURE); getObserver.end(GetOutcome.FAILURE); removeKeysWithStrategy(Collections.singleton(key), e); throw e; } if (old.get() != null) { getObserver.end(GetOutcome.HIT_NO_LOADER); putObserver.end(PutOutcome.ADDED); } else { getObserver.end(GetOutcome.MISS_NO_LOADER); } return old.get(); }

Target:
public V replace(final K key, final V value) throws CacheLoaderException, CacheWriterException { replaceObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final AtomicReference<V> old = new AtomicReference<V>(); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K k, final V inCache) { if (cacheWriter != null) { try { cacheWriter.write(key, value); } catch (Exception e) { throw newCacheWriterException(e); } } old.set(inCache); return value; } }); try { store.computeIfPresent(key, remappingFunction); } catch (CacheAccessException e) { replaceObserver.end(ReplaceOutcome.FAILURE); try { remappingFunction.apply(key, null); } finally { removeKeysWithStrategy(Collections.singleton(key), e); } } catch (CacheWriterException e) { replaceObserver.end(ReplaceOutcome.FAILURE); removeKeysWithStrategy(Collections.singleton(key), e); throw e; } if (old.get() != null) { replaceObserver.end(ReplaceOutcome.HIT); } else { replaceObserver.end(ReplaceOutcome.MISS); } return old.get(); }
Source:
private String tryAppendTrailingDocumentation(String documentation) { while (pos < data.length) { char c = data[pos]; if (c == ' ' || c == '\t') { pos++; } else if (c == '/') { pos++; break; } else { return documentation; } } if (pos == data.length || (data[pos] != '/' && data[pos] != '*')) { pos--; throw unexpected("expected ' } if (data[pos] == '*' && pos < data.length - 1 && data[pos + 1] == '/') { end = pos - 1; pos += 2; break; } pos++; } } else { while (true) { if (pos == data.length) { end = pos - 1; break; } char c = data[pos++]; if (c == '\n') { newline(); end = pos - 2; break; } } } while (end > start && (data[end] == ' ' || data[end] == '\t')) { end--; } if (end == start) { return documentation; } String trailingDocumentation = new String(data, start, end - start + 1); if (documentation.isEmpty()) { return trailingDocumentation; } return documentation + '\n' + trailingDocumentation; }

Target:
private String tryAppendTrailingDocumentation(String documentation) { while (pos < data.length) { char c = data[pos]; if (c == ' ' || c == '\t') { pos++; } else if (c == '/') { pos++; break; } else { return documentation; } } if (pos == data.length || (data[pos] != '/' && data[pos] != '*')) { pos--; throw unexpected("expected ' } boolean isStar = data[pos] == '*'; pos++; if (pos < data.length && data[pos] == ' ') { pos++; } int start = pos; int end; if (isStar) { while (true) { if (pos == data.length || data[pos] == '\n') { throw unexpected("trailing comment must be closed on the same line"); } if (data[pos] == '*' && pos + 1 < data.length && data[pos + 1] == '/') { end = pos - 1; pos += 2; break; } pos++; } while (pos < data.length) { char c = data[pos++]; if (c == '\n') { newline(); break; } if (c != ' ' && c != '\t') { throw unexpected("no syntax may follow trailing comment"); } } } else { while (true) { if (pos == data.length) { end = pos - 1; break; } char c = data[pos++]; if (c == '\n') { newline(); end = pos - 2; break; } } } while (end > start && (data[end] == ' ' || data[end] == '\t')) { end--; } if (end == start) { return documentation; } String trailingDocumentation = new String(data, start, end - start + 1); if (documentation.isEmpty()) { return trailingDocumentation; } return documentation + '\n' + trailingDocumentation; }
Source:
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!MATCHER.matches(tree, state)) { return NO_MATCH; } List<? extends ExpressionTree> arguments = tree.getArguments(); return describeMatch( tree, SuggestedFix.builder().postfixWith(arguments.get(0), ", -1").build()); }

Target:
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!MATCHER.matches(tree, state)) { return NO_MATCH; } List<? extends ExpressionTree> arguments = tree.getArguments(); return describeMatch( tree, SuggestedFix.builder().postfixWith(getOnlyElement(arguments), ", -1").build()); }
Source:
public ReflectionMappers setColumnNameMatchers(List<ColumnNameMatcher> columnNameMatchers) { synchronized (lock) { this.columnNameMatchers.clear(); this.columnNameMatchers.addAll(columnNameMatchers); } return this; }

Target:
public ReflectionMappers setColumnNameMatchers(List<ColumnNameMatcher> columnNameMatchers) { this.columnNameMatchers = new ArrayList<>(columnNameMatchers); return this; }
Source:
private void validateNewFolderName() { String name = fFolderName.getText(); IWorkspace workspace = fParentFolder.getWorkspace(); IStatus nameStatus = workspace.validateName(name, IResource.FOLDER); if ("".equals(name)) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null)); return; } if (!nameStatus.isOK()) { updateStatus(nameStatus); return; } IPath path = new Path(name); if (fParentFolder.getFolder(path).exists() || fParentFolder.getFile(path).exists()) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null)); return; } updateStatus(new Status(IStatus.OK, Activator.PLUGIN_ID, "")); }

Target:
private void validateNewFolderName() { String name = fFolderName.getText(); IWorkspace workspace = fParentFolder.getWorkspace(); IStatus nameStatus = workspace.validateName(name, IResource.FOLDER); if ("".equals(name)) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null)); return; } if (!nameStatus.isOK()) { updateStatus(nameStatus); return; } if (fParentFolder.findMember(name) != null) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null)); return; } updateStatus(new Status(IStatus.OK, Activator.PLUGIN_ID, "")); }
Source:
protected void prepareOnAffectedNodes(TxInvocationContext<?> ctx, PrepareCommand command, Collection<Address> recipients, boolean sync) { try { RpcOptions rpcOptions; if (sync) { rpcOptions = rpcManager.getRpcOptionsBuilder(ResponseMode.SYNCHRONOUS_IGNORE_LEAVERS, DeliverOrder.NONE).build(); } else { rpcOptions = rpcManager.getDefaultRpcOptions(sync); } Map<Address, Response> responseMap = rpcManager.invokeRemotely(recipients, command, rpcOptions); checkTxCommandResponses(responseMap, command); } finally { transactionRemotelyPrepared(ctx); } }

Target:
protected void prepareOnAffectedNodes(TxInvocationContext<?> ctx, PrepareCommand command, Collection<Address> recipients, boolean sync) { try { RpcOptions rpcOptions; if (sync) { rpcOptions = rpcManager.getRpcOptionsBuilder(ResponseMode.SYNCHRONOUS_IGNORE_LEAVERS, DeliverOrder.NONE).build(); } else { rpcOptions = rpcManager.getDefaultRpcOptions(false); } Map<Address, Response> responseMap = rpcManager.invokeRemotely(recipients, command, rpcOptions); checkTxCommandResponses(responseMap, command); } finally { transactionRemotelyPrepared(ctx); } }
Source:
public Context getSharedSpanBuilder(String spanName, Context context) { return Context.NONE; }

Target:
public Context getSharedSpanBuilder(String spanName, Context context) { throw logger.logExceptionAsError( new UnsupportedOperationException("This operation is not supported in OpenCensus")); }
Source:
public void validate() { super.validate(); String algorithmName = getAlgorithm(); if (algorithmName != null) { if (!PERCEPTRON_VALUE.equals(algorithmName)) { throw new IllegalArgumentException("trainParams are not valid!"); } } }

Target:
public void validate() { super.validate(); String algorithmName = getAlgorithm(); if (algorithmName != null) { if (!PERCEPTRON_VALUE.equals(algorithmName)) { throw new IllegalArgumentException("algorithmName must be PERCEPTRON"); } } }
Source:
private void assertSTGeometries(String wkt, String... expected) { ImmutableList<String> expectedList; if (expected == null) { expectedList = null; } else { expectedList = ImmutableList.copyOf(expected); } assertFunction("transform(ST_Geometries(ST_GeometryFromText('" + wkt + "')), x -> ST_ASText(x))", new ArrayType(VARCHAR), expectedList); }

Target:
private void assertSTGeometries(String wkt, String... expected) { assertFunction(String.format("transform(ST_Geometries(ST_GeometryFromText('%s')), x -> ST_ASText(x))", wkt), new ArrayType(VARCHAR), ImmutableList.copyOf(expected)); }