auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public OtpCredentialLoader(String credentialName, String algorithmAttributeName, String hashAttributeName, String seedAttributeName, String sequenceAttributeName) { Assert.assertNotNull(credentialName); Assert.assertNotNull(algorithmAttributeName); Assert.assertNotNull(hashAttributeName); Assert.assertNotNull(seedAttributeName); Assert.assertNotNull(sequenceAttributeName); this.myCredentialName = credentialName; this.algorithmAttributeName = algorithmAttributeName; this.hashAttributeName = hashAttributeName; this.seedAttributeName = seedAttributeName; this.sequenceAttributeName = sequenceAttributeName; }

Target:
public OtpCredentialLoader(String credentialName, String algorithmAttributeName, String hashAttributeName, String seedAttributeName, String sequenceAttributeName) { Assert.checkNotNullParam("credentialName", credentialName); Assert.checkNotNullParam("algorithmAttributeName", algorithmAttributeName); Assert.checkNotNullParam("hashAttributeName", hashAttributeName); Assert.checkNotNullParam("seedAttributeName", seedAttributeName); Assert.checkNotNullParam("sequenceAttributeName", sequenceAttributeName); this.myCredentialName = credentialName; this.algorithmAttributeName = algorithmAttributeName; this.hashAttributeName = hashAttributeName; this.seedAttributeName = seedAttributeName; this.sequenceAttributeName = sequenceAttributeName; }
Source:
private static String getCanonicalName(String account, String shareName, String filePath) { return ImplUtils.isNullOrEmpty(filePath) ? String.format("/file/%s/%s/%s",account, shareName, filePath.replace("\\", "/")) : String.format("/file/%s/%s",account, shareName); }

Target:
private static String getCanonicalName(String account, String shareName, String filePath) { return !ImplUtils.isNullOrEmpty(filePath) ? String.format("/file/%s/%s/%s", account, shareName, filePath.replace("\\", "/")) : String.format("/file/%s/%s", account, shareName); }
Source:
private String getGcLogFileLocation() { String fileLocation; if(!isJava8OrBelow()) { String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE9_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { Matcher fileLocationMatcher = Pattern.compile(GCLOGS_JRE9_LOCATION).matcher(gcLogSwitch); if(fileLocationMatcher.matches()) { fileLocation = fileLocationMatcher.group("location"); } else { LOGGER.fine("No GC Logging custom file location found."); fileLocation = null; } } } else { String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { fileLocation = gcLogSwitch.substring(GCLOGS_JRE_SWITCH.length()); } } return fileLocation; }

Target:
private String getGcLogFileLocation() { String fileLocation; if(isJava8OrBelow()) { String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { fileLocation = gcLogSwitch.substring(GCLOGS_JRE_SWITCH.length()); } } else { String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE9_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { Matcher fileLocationMatcher = Pattern.compile(GCLOGS_JRE9_LOCATION).matcher(gcLogSwitch); if(fileLocationMatcher.matches()) { fileLocation = fileLocationMatcher.group("location"); } else { LOGGER.fine("No GC Logging custom file location found."); fileLocation = null; } } } return fileLocation; }
Source:
public int purgeCatalog(long expirationTime, int maxSize) { int n = 0; try { log.debug("purging.. '{}' tasks ended almost seconds ago.", maxSize, expirationTime); n = tapeRecallDAO.purgeCompletedTasks(expirationTime, maxSize); } catch (DataAccessException e) { log.error("Unable to takeover a task {}", e); } return n; }

Target:
public int purgeCatalog(long expirationTime, int maxSize) { log.debug("purging '{}' completed tasks older than '{}' seconds ...", maxSize, expirationTime); try { return tapeRecallDAO.purgeCompletedTasks(expirationTime, maxSize); } catch (DataAccessException e) { log.error("Unable to takeover a task {}", e); return 0; } }
Source:
public static MoreLikeThisQueryBuilder.Item[] getItems(Object value) { RepositoryManager rm = Framework.getService(RepositoryManager.class); String repo = rm.getDefaultRepository().getName(); ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); String esIndex = esa.getIndexNameForRepository(repo); String[] values; if (value instanceof Object[]) { values = (String[]) value; } else { values = new String[] { (String) value }; } MoreLikeThisQueryBuilder.Item[] ret = new MoreLikeThisQueryBuilder.Item[values.length]; for (int i = 0; i < values.length; i++) { ret[i] = new MoreLikeThisQueryBuilder.Item(esIndex, DOC_TYPE, values[i]); } return ret; }

Target:
public static MoreLikeThisQueryBuilder.Item[] getItems(Object value) { RepositoryManager rm = Framework.getService(RepositoryManager.class); String repo = rm.getDefaultRepository().getName(); ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); String esIndex = esa.getIndexNameForRepository(repo); String[] values; if (value instanceof String[]) { values = (String[]) value; } else { values = new String[] { (String) value }; } MoreLikeThisQueryBuilder.Item[] ret = new MoreLikeThisQueryBuilder.Item[values.length]; for (int i = 0; i < values.length; i++) { ret[i] = new MoreLikeThisQueryBuilder.Item(esIndex, DOC_TYPE, values[i]); } return ret; }
Source:
public Session cassandraSession() { log.debug("Creating Spring Bean for cassandra session"); Session session; try { session = Cluster.builder().addContactPoints(configurationContext.getCassandraHostsQuorum().split(",")) .withPort(9042) .build().connect(); } catch (Exception e) { session = null; } return session; }

Target:
public Session cassandraSession() { log.debug("Creating Spring Bean for cassandra session"); Session session; try { session = Cluster.builder().addContactPoints(configurationContext.getCassandraHostsQuorum().split(",")) .withPort(configurationContext.getCassandraPort()) .build().connect(); } catch (Exception e) { session = null; } return session; }
Source:
public void setup() throws ConnectionException { context = new AstyanaxContext.Builder() .forCluster(CLUSTER_NAME) .forKeyspace(KEYSPACE_NAME) .withAstyanaxConfiguration(new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) .setCqlVersion("3.0.0") .setTargetCassandraVersion("1.2") ) .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("Atlas") .setPort(PORT) .setMaxBlockedThreadsPerHost(CLIENT_THREADS) .setMaxConnsPerHost(CLIENT_THREADS) .setMaxConns(CLIENT_THREADS * 5) .setConnectTimeout(CONNECTION_TIMEOUT) .setSeeds(SEEDS) ) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); context.start(); cqlStatement = context.getClient().prepareCqlStatement(); store = new CassandraEquivalenceSummaryStore(context, 1000); }

Target:
public void setup() throws Exception { context = new AstyanaxContext.Builder() .forCluster(CLUSTER_NAME) .forKeyspace(KEYSPACE_NAME) .withAstyanaxConfiguration(new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) .setCqlVersion("3.0.0") .setTargetCassandraVersion("1.2") ) .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("Atlas") .setPort(PORT) .setMaxBlockedThreadsPerHost(CLIENT_THREADS) .setMaxConnsPerHost(CLIENT_THREADS) .setMaxConns(CLIENT_THREADS * 5) .setConnectTimeout(CONNECTION_TIMEOUT) .setSeeds(SEEDS) ) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); context.start(); cqlStatement = context.getClient().prepareCqlStatement(); store = new CassandraEquivalenceSummaryStore(context, 1000); }
Source:
public String getFirstName() { return sanitizeText(rawData.optString(CONTACT_FIELDS[1])); }

Target:
public String getFirstName() { return sanitizeText(rawData.optString(FIRST_NAME)); }
Source:
public void shouldAllowProcessorToProcessApiRequestFromPlugin() throws Exception { String api = "api-uri"; GoPluginApiRequestProcessor processor = mock(GoPluginApiRequestProcessor.class); GoApiRequest goApiRequest = mock(GoApiRequest.class); when(goApiRequest.api()).thenReturn(api); DefaultGoApplicationAccessor goApplicationAccessor = new DefaultGoApplicationAccessor(); goApplicationAccessor.registerProcessorFor(api, processor); processor.process(goApiRequest); verify(processor).process(goApiRequest); }

Target:
public void shouldAllowProcessorToProcessApiRequestFromPlugin() throws Exception { String api = "api-uri"; GoPluginApiRequestProcessor processor = mock(GoPluginApiRequestProcessor.class); GoApiRequest goApiRequest = mock(GoApiRequest.class); when(goApiRequest.api()).thenReturn(api); DefaultGoApplicationAccessor goApplicationAccessor = new DefaultGoApplicationAccessor(); goApplicationAccessor.registerProcessorFor(api, processor); goApplicationAccessor.submit(goApiRequest); verify(processor).process(goApiRequest); }
Source:
public void updateEditorPages(int activatedPage) { removeAllPages(); addPages(); if (backToActivePage > 0 && backToActivePage < this.getPageCount()) { setActivePage(backToActivePage); } else { setActivePage(0); } setPartName(getPartName()); }

Target:
public void updateEditorPages(int activatedPage) { updateEditorPages(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.simple_drawee_view); mSimpleDraweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AnimatedDrawableSupport animatable = (AnimatedDrawableSupport)mSimpleDraweeView.getController().getAnimatable(); if (animatable.isRunning()) { animatable.pause(); } else { animatable.start(); } } }); final EditText editText = (EditText) findViewById(R.id.uri_edit_text); editText.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { final boolean isEnterKeyDown = (actionId == EditorInfo.IME_NULL) && (event.getAction() == KeyEvent.ACTION_DOWN); if (isEnterKeyDown || actionId == EditorInfo.IME_ACTION_DONE) { updateImageUri(Uri.parse(v.getText().toString())); } return false; } }); final Button clearButton = (Button) findViewById(R.id.clear_uri); clearButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editText.getText().clear(); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.simple_drawee_view); mSimpleDraweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AnimatedDrawable animatable = (AnimatedDrawable)mSimpleDraweeView.getController().getAnimatable(); if (animatable.isRunning()) { animatable.pause(); } else { animatable.start(); } } }); final EditText editText = (EditText) findViewById(R.id.uri_edit_text); editText.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { final boolean isEnterKeyDown = (actionId == EditorInfo.IME_NULL) && (event.getAction() == KeyEvent.ACTION_DOWN); if (isEnterKeyDown || actionId == EditorInfo.IME_ACTION_DONE) { updateImageUri(Uri.parse(v.getText().toString())); } return false; } }); final Button clearButton = (Button) findViewById(R.id.clear_uri); clearButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editText.getText().clear(); } }); }
Source:
public void updateFormTitle(Form form, ISelection selection) { if (selection instanceof IStructuredSelection) { boolean semanticElementFound = false; IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element != null) { SiriusInputDescriptor inputDescriptor = new SiriusInputDescriptor(element); EObject semanticElement = inputDescriptor.getSemanticElement(); if (semanticElement != null) { updateFormText(form, semanticElement); form.setImage(ExtendedImageRegistry.INSTANCE.getImage(new EditingDomainServices().getLabelProviderImage(semanticElement))); } } if (!semanticElementFound) { form.setText(""); form.setImage(null); } } }

Target:
public void updateFormTitle(Form form, ISelection selection) { if (selection instanceof IStructuredSelection) { boolean semanticElementFound = false; IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element != null) { SiriusInputDescriptor inputDescriptor = new SiriusInputDescriptor(element); EObject semanticElement = inputDescriptor.getSemanticElement(); if (semanticElement != null) { semanticElementFound = true; updateFormText(form, semanticElement); form.setImage(ExtendedImageRegistry.INSTANCE.getImage(new EditingDomainServices().getLabelProviderImage(semanticElement))); } } if (!semanticElementFound) { form.setText(""); form.setImage(null); } } }
Source:
public String selectBroker(String table) { if (table == null) { List<String> list = allBrokerListRef.get(); if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } else { return null; } } String tableName = table.replace(OFFLINE_SUFFIX, "").replace(REALTIME_SUFFIX, ""); List<String> list = tableToBrokerListMapRef.get().get(tableName); if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } return null; }

Target:
public String selectBroker(String table) { if (table == null) { List<String> list = _allBrokerListRef.get(); if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } else { return null; } } String tableName = table.replace(ExternalViewReader.OFFLINE_SUFFIX, "").replace(ExternalViewReader.REALTIME_SUFFIX, ""); List<String> list = _tableToBrokerListMapRef.get().get(tableName); if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } return null; }
Source:
public String toString() { switch (this) { case CBR: return "Constant"; case VBR: return "Variable"; default: return super.toString(); } }

Target:
public String toString() { switch (this) { case CONSTANT: return "Constant"; case VARIABLE: return "Variable"; default: return super.toString(); } }
Source:
public void localeThreeLetterRegionalVariantResolves() { assertThat("A locale with a 3-letter coe and regional variant resolves correctly", LanguageUtil.getLocale("yue_TW").getDisplayName().equals("yue (Taiwan)")); assertThat("A locale with a 3-letter coe and regional variant resolves correctly", LanguageUtil.getLocale("yue-TW").getDisplayName().equals("yue (Taiwan)")); }

Target:
public void localeThreeLetterRegionalVariantResolves() { assertThat("A locale with a 2-letter code and regional variant resolves correctly", "yue (Taiwan)", is(LanguageUtil.getLocale("yue-TW").getDisplayName())); assertThat("A locale with a 2-letter code and regional variant resolves correctly", "yue (Taiwan)", is(LanguageUtil.getLocale("yue_TW").getDisplayName())); }
Source:
public void flush(boolean force) { for (int partition = 0; partition < pageBuilders.size(); partition++) { PageBuilder partitionPageBuilder = pageBuilders.get(partition); if (!partitionPageBuilder.isEmpty() && (force || partitionPageBuilder.isFull())) { Page pageSplit = partitionPageBuilder.build(); partitionPageBuilder.reset(); memoryTracker.accept(pageSplit.getRetainedSizeInBytes()); buffers.get(partition).accept(new PageReference(pageSplit, 1, () -> memoryTracker.accept(-pageSplit.getRetainedSizeInBytes()))); } } }

Target:
private void flush(boolean force) { for (int partition = 0; partition < pageBuilders.size(); partition++) { PageBuilder partitionPageBuilder = pageBuilders.get(partition); if (!partitionPageBuilder.isEmpty() && (force || partitionPageBuilder.isFull())) { Page pageSplit = partitionPageBuilder.build(); partitionPageBuilder.reset(); memoryTracker.accept(pageSplit.getRetainedSizeInBytes()); buffers.get(partition).accept(new PageReference(pageSplit, 1, () -> memoryTracker.accept(-pageSplit.getRetainedSizeInBytes()))); } } }
Source:
private boolean canBumpEpoch() { return !isTransactional() || apiVersions.get(transactionCoordinator.idString()).apiVersion(ApiKeys.INIT_PRODUCER_ID).maxVersion >= 3; }

Target:
boolean canBumpEpoch() { if (!isTransactional()) { return true; } return coordinatorSupportsBumpingEpoch; }
Source:
private void update(SessionOSData newSessionData) { if (fViewer == null || fViewer.getControl() == null) return; if (fViewer.getControl().isDisposed()) return; if (newSessionData == null) { fSessionData = null; if (fWrongType) hideTable(Messages.OSView_4); else if (fMultiple) hideTable(Messages.OSView_14); else hideTable(Messages.OSView_15); fResourceClassEditor.setEnabled(false); fRefreshAction.setEnabled(false); return; } if (newSessionData != fSessionData) { fSessionData = newSessionData; updateSessionDataContents(); } }

Target:
private void update(SessionOSData newSessionData) { if (fViewer == null || fViewer.getControl() == null) return; if (fViewer.getControl().isDisposed()) return; if (newSessionData == null) { fSessionData = null; if (fMultiple) hideTable(Messages.OSView_14); else if (fWrongType) hideTable(Messages.OSView_4); else hideTable(Messages.OSView_15); fResourceClassEditor.setEnabled(false); fRefreshAction.setEnabled(false); return; } if (newSessionData != fSessionData) { fSessionData = newSessionData; updateSessionDataContents(); } }
Source:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { String destination = "/" + remaining.replaceAll(":", "/"); StompConfiguration config = getConfiguration().copy(); setProperties(config, parameters); StompEndpoint endpoint = new StompEndpoint(uri, this, config, destination); setProperties(endpoint, parameters); if (config.getSslContextParameters() == null) { config.setSslContextParameters(retrieveGlobalSslContextParameters()); } endpoint.setHeaderFilterStrategy(getHeaderFilterStrategy()); return endpoint; }

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { String destination = "/" + remaining.replaceAll(":", "/"); StompConfiguration config = getConfiguration().copy(); setProperties(config, parameters); StompEndpoint endpoint = new StompEndpoint(uri, this, config, destination); endpoint.setHeaderFilterStrategy(getHeaderFilterStrategy()); setProperties(endpoint, parameters); if (config.getSslContextParameters() == null) { config.setSslContextParameters(retrieveGlobalSslContextParameters()); } return endpoint; }
Source:
public void checkDeprecatedAssignment(Assignment assignment) { JvmIdentifiableElement feature = assignment.getFeature(); if (feature instanceof JvmOperation) { JvmOperation operation = (JvmOperation) feature; if (DeprecationUtil.isDeprecated(operation)) { warning( "The '" + operation.getQualifiedName() + "' is deprecated.", assignment, Mwe2Package.Literals.ASSIGNMENT__FEATURE_NAME, DEPRECATED_ELEMENT); } } }

Target:
public void checkDeprecatedAssignment(Assignment assignment) { JvmIdentifiableElement feature = assignment.getFeature(); if (feature instanceof JvmOperation) { JvmOperation operation = (JvmOperation) feature; if (DeprecationUtil.isDeprecated(operation)) { warning( "The '" + operation.getQualifiedName() + "' is deprecated.", assignment, Mwe2Package.Literals.ASSIGNMENT__FEATURE, DEPRECATED_ELEMENT); } } }
Source:
public JsonElement serialize(ITmfStateInterval src, @Nullable Type typeOfSrc, @Nullable JsonSerializationContext context) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(TmfIntervalStrings.START, src.getStartTime()); jsonObject.addProperty(TmfIntervalStrings.END, src.getEndTime()); jsonObject.addProperty(TmfIntervalStrings.QUARK, src.getAttribute()); Object value = src.getValue(); if (value == null) { jsonObject.addProperty(TmfIntervalStrings.TYPE, TmfIntervalStrings.NULL); return jsonObject; } if (value.getClass().isInstance(CustomStateValue.class)) { jsonObject.addProperty(TmfIntervalStrings.TYPE, TmfIntervalStrings.CUSTOM); } else { jsonObject.addProperty(TmfIntervalStrings.TYPE, value.getClass().getName()); } if (value instanceof CustomStateValue) { CustomStateValue customValue = (CustomStateValue) value; int size = customValue.getSerializedSize(); ByteBuffer buffer = ByteBuffer.allocate(size); buffer.clear(); ISafeByteBufferWriter sbbw = SafeByteBufferFactory.wrapWriter(buffer, size); customValue.serialize(sbbw); byte[] serializedValue = buffer.array(); jsonObject.addProperty(TmfIntervalStrings.VALUE, Base64.getEncoder().encodeToString(serializedValue)); } else if (value instanceof Number) { Number number = (Number) value; jsonObject.addProperty(TmfIntervalStrings.VALUE, number); } else if (value instanceof String) { jsonObject.addProperty(TmfIntervalStrings.VALUE, (String) value); } else { jsonObject.addProperty(TmfIntervalStrings.VALUE, value.toString()); } return jsonObject; }

Target:
public JsonElement serialize(ITmfStateInterval src, @Nullable Type typeOfSrc, @Nullable JsonSerializationContext context) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(TmfIntervalStrings.START, src.getStartTime()); jsonObject.addProperty(TmfIntervalStrings.END, src.getEndTime()); jsonObject.addProperty(TmfIntervalStrings.QUARK, src.getAttribute()); Object value = src.getValue(); if (value == null) { jsonObject.addProperty(TmfIntervalStrings.TYPE, TmfIntervalStrings.NULL); return jsonObject; } if (value.getClass().isInstance(CustomStateValue.class)) { jsonObject.addProperty(TmfIntervalStrings.TYPE, CustomStateValue.class.toString()); } else { jsonObject.addProperty(TmfIntervalStrings.TYPE, value.getClass().getName()); } if (value instanceof CustomStateValue) { CustomStateValue customValue = (CustomStateValue) value; int size = customValue.getSerializedSize(); ByteBuffer buffer = ByteBuffer.allocate(size); buffer.clear(); ISafeByteBufferWriter sbbw = SafeByteBufferFactory.wrapWriter(buffer, size); customValue.serialize(sbbw); byte[] serializedValue = buffer.array(); jsonObject.addProperty(TmfIntervalStrings.VALUE, Base64.getEncoder().encodeToString(serializedValue)); } else if (value instanceof Number) { Number number = (Number) value; jsonObject.addProperty(TmfIntervalStrings.VALUE, number); } else if (value instanceof String) { jsonObject.addProperty(TmfIntervalStrings.VALUE, (String) value); } else { jsonObject.addProperty(TmfIntervalStrings.VALUE, value.toString()); } return jsonObject; }
Source:
public List<String> getNestedPathHierarchyForObject(String absoluteObjectPath) { Optional<List<String>> nestedDocumentPath = indexModels.stream() .map( indexModel -> indexModel.getObjectNode( absoluteObjectPath ) ) .filter( Objects::nonNull ) .map( fieldNode -> Optional.ofNullable( fieldNode.getNestedPathHierarchy() ) ) .reduce( (nestedDocumentPath1, nestedDocumentPath2) -> { if ( Objects.equals( nestedDocumentPath1, nestedDocumentPath2 ) ) { return nestedDocumentPath1; } throw log.conflictingNestedDocumentPathHierarchyForProjection( absoluteObjectPath, nestedDocumentPath1.orElse( null ), nestedDocumentPath2.orElse( null ), getIndexesEventContext() ); } ) .orElse( Optional.empty() ); return nestedDocumentPath.orElse( null ); }

Target:
public List<String> getNestedPathHierarchyForObject(String absoluteObjectPath) { Optional<List<String>> nestedDocumentPath = indexModels.stream() .map( indexModel -> indexModel.getObjectNode( absoluteObjectPath ) ) .filter( Objects::nonNull ) .map( node -> Optional.ofNullable( node.getNestedPathHierarchy() ) ) .reduce( (nestedDocumentPath1, nestedDocumentPath2) -> { if ( Objects.equals( nestedDocumentPath1, nestedDocumentPath2 ) ) { return nestedDocumentPath1; } throw log.conflictingNestedDocumentPathHierarchy( absoluteObjectPath, nestedDocumentPath1.orElse( null ), nestedDocumentPath2.orElse( null ), getIndexesEventContext() ); } ) .orElse( Optional.empty() ); return nestedDocumentPath.orElse( null ); }
Source:
public static AuthUI getInstance(@NonNull FirebaseApp app) { AuthUI authUi; synchronized (INSTANCES) { authUi = INSTANCES.get(app); if (authUi == null) { INSTANCES.put(app, authUi = new AuthUI(app)); } } return authUi; }

Target:
public static AuthUI getInstance(@NonNull FirebaseApp app) { AuthUI authUi; synchronized (INSTANCES) { authUi = INSTANCES.get(app); if (authUi == null) { authUi = new AuthUI(app); INSTANCES.put(app, authUi); } } return authUi; }
Source:
public LimitedOutputStream createFile() throws IOException { if (bytesUsed.get() >= maxBytesUsed) { throw new TemporaryStorageFullException(maxBytesUsed); } synchronized (files) { if (closed) { throw new ISE("Closed"); } FileUtils.forceMkdir(storageDirectory); final File theFile = new File(storageDirectory, StringUtils.safeFormat("%08d.tmp", files.size())); final EnumSet<StandardOpenOption> openOptions = EnumSet.of( StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE ); final FileChannel channel = FileChannel.open(theFile.toPath(), openOptions); files.add(theFile); return new LimitedOutputStream(theFile, Channels.newOutputStream(channel)); } }

Target:
public LimitedOutputStream createFile() throws IOException { if (bytesUsed.get() >= maxBytesUsed) { throw new TemporaryStorageFullException(maxBytesUsed); } synchronized (files) { if (closed) { throw new ISE("Closed"); } FileUtils.forceMkdir(storageDirectory); final File theFile = new File(storageDirectory, StringUtils.format("%08d.tmp", files.size())); final EnumSet<StandardOpenOption> openOptions = EnumSet.of( StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE ); final FileChannel channel = FileChannel.open(theFile.toPath(), openOptions); files.add(theFile); return new LimitedOutputStream(theFile, Channels.newOutputStream(channel)); } }
Source:
private static Person getByEmail(ZulipApp app, String email) { try { return getByEmail(app.getDatabaseHelper().getDao( Person.class), email); } catch (SQLException e) { e.printStackTrace(); } return null; }

Target:
private static Person getByEmail(ZulipApp app, String email) { try { return getByEmail(app.getDatabaseHelper().getDao( Person.class), email); } catch (SQLException e) { ZLog.logException(e); } return null; }
Source:
public InputStream getLineAsStream() throws IOException { return IOUtils.toInputStream(getLine(), "UTF-8"); }

Target:
public InputStream getLineAsStream() throws IOException { return new ByteArrayInputStream(getLine().getBytes()); }
Source:
public List<CDPStructuredFlowEvent> getFlow() { return flow != null ? flow : Collections.emptyList(); }

Target:
public List<CDPStructuredFlowEvent> getFlow() { return flow; }
Source:
public static GermplasmListNewColumnsInfo generateAddedColumnsInfo() { final GermplasmListNewColumnsInfo newColumnsInfo = new GermplasmListNewColumnsInfo(1); final LinkedHashMap<String, List<ListDataColumnValues>> columnValuesMap = new LinkedHashMap<>(); for (final String column : ADDED_COLUMNS) { final List<ListDataColumnValues> valuesList = new ArrayList<>(); for (int x = 1; x <= NO_OF_LIST_ENTRIES; x++) { valuesList.add(new ListDataColumnValues(column, x, column + ":" + x)); newColumnsInfo.addColumn(column); } columnValuesMap.put(column, valuesList); } newColumnsInfo.setColumnValuesMap(columnValuesMap); return newColumnsInfo; }

Target:
public static GermplasmListNewColumnsInfo generateAddedColumnsInfo() { final GermplasmListNewColumnsInfo newColumnsInfo = new GermplasmListNewColumnsInfo(1); final Map<String, List<ListDataColumnValues>> columnValuesMap = new LinkedHashMap<>(); for (final String column : ADDED_COLUMNS) { final List<ListDataColumnValues> valuesList = new ArrayList<>(); for (int x = 1; x <= NO_OF_LIST_ENTRIES; x++) { valuesList.add(new ListDataColumnValues(column, x, column + ":" + x)); newColumnsInfo.addColumn(column); } columnValuesMap.put(column, valuesList); } newColumnsInfo.setColumnValuesMap(columnValuesMap); return newColumnsInfo; }
Source:
public void executeQueueTest() { try { startResource(); QueueCapability queueCapability = (QueueCapability) networkResource.getCapability(getOSPFInformation(CAPABILIY_TYPE)); queueCapability.execute(); stopResource(); } catch (ResourceException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } catch (ProtocolException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }

Target:
public void executeQueueTest() throws ResourceException, ProtocolException { startResource(); QueueCapability queueCapability = (QueueCapability) networkResource.getCapability(getOSPFInformation(CAPABILIY_TYPE)); queueCapability.execute(); stopResource(); }
Source:
protected void doExecute() { final IBatchMerger2 merger = new BatchMerger(mergerRegistry); if (leftToRight) { merger.copyAllLeftToRight(differences, new BasicMonitor()); } else { merger.copyAllRightToLeft(differences, new BasicMonitor()); } }

Target:
protected void doExecute() { final IBatchMerger merger = new BatchMerger(mergerRegistry); if (leftToRight) { merger.copyAllLeftToRight(differences, new BasicMonitor()); } else { merger.copyAllRightToLeft(differences, new BasicMonitor()); } }
Source:
public void testLegacyQueryContext() { MemoryPool generalPool = new MemoryPool(GENERAL_POOL, new DataSize(10, BYTE)); MemoryPool systemPool = new MemoryPool(SYSTEM_POOL, new DataSize(10, BYTE)); try (LocalQueryRunner localQueryRunner = new LocalQueryRunner(TEST_SESSION)) { LegacyQueryContext queryContext = new LegacyQueryContext( new QueryId("query"), new DataSize(10, BYTE), generalPool, systemPool, new TestingGcMonitor(), localQueryRunner.getExecutor(), localQueryRunner.getScheduler(), new DataSize(0, BYTE), new SpillSpaceTracker(new DataSize(0, BYTE))); TaskStateMachine taskStateMachine = new TaskStateMachine(TaskId.valueOf("task-id"), taskNotificationExecutor); TaskContext taskContext = queryContext.addTaskContext(taskStateMachine, TEST_SESSION, false, false); LocalMemoryContext systemContext = taskContext.localSystemMemoryContext(); ListenableFuture<?> blocked = systemContext.setBytes(10); assertTrue(blocked.isDone()); assertEquals(systemPool.getReservedBytes(), 10); assertEquals(generalPool.getReservedBytes(), 0); systemContext.close(); assertEquals(systemPool.getReservedBytes(), 0); assertEquals(generalPool.getReservedBytes(), 0); } }

Target:
public void testLegacyQueryContext() { MemoryPool generalPool = new MemoryPool(GENERAL_POOL, new DataSize(10_000, BYTE)); MemoryPool systemPool = new MemoryPool(SYSTEM_POOL, new DataSize(10_000, BYTE)); try (LocalQueryRunner localQueryRunner = new LocalQueryRunner(TEST_SESSION)) { LegacyQueryContext queryContext = new LegacyQueryContext( new QueryId("query"), new DataSize(10, BYTE), generalPool, systemPool, new TestingGcMonitor(), localQueryRunner.getExecutor(), localQueryRunner.getScheduler(), new DataSize(0, BYTE), new SpillSpaceTracker(new DataSize(0, BYTE))); TaskStateMachine taskStateMachine = new TaskStateMachine(TaskId.valueOf("task-id"), taskNotificationExecutor); TaskContext taskContext = queryContext.addTaskContext(taskStateMachine, TEST_SESSION, false, false); LocalMemoryContext systemContext = taskContext.localSystemMemoryContext(); ListenableFuture<?> blocked = systemContext.setBytes(10_000); assertTrue(blocked.isDone()); assertEquals(systemPool.getReservedBytes(), 10_000); assertEquals(generalPool.getReservedBytes(), 0); systemContext.close(); assertEquals(systemPool.getReservedBytes(), 0); assertEquals(generalPool.getReservedBytes(), 0); } }
Source:
public void setAuthData(ExternalOAuth externalOAuth) { for (FormGroup formGroup : form) { for (FormField formField : formGroup.getFields()) { if (formField.getId().equals("access_token")) { ((StringFormField)formField).setValue(externalOAuth.token()); } if (formField.getId().equals("expires_in")) { ((StringFormField)formField).setValue("" + externalOAuth.expiresIn()); } } } }

Target:
public BookingForm setAuthData(ExternalOAuth externalOAuth) { for (FormGroup formGroup : form) { for (FormField formField : formGroup.getFields()) { if (formField.getId() != null && formField.getId().equals(FormField.ACCESS_TOKEN)) { ((StringFormField) formField).setValue(externalOAuth.token()); } if (formField.getId().equals(FormField.EXPIRES_IN)) { ((StringFormField) formField).setValue("" + externalOAuth.expiresIn()); } if (formField.getId().equals(FormField.REFRESH_TOKEN) && externalOAuth.refreshToken() != null) { ((StringFormField) formField).setValue("" + externalOAuth.refreshToken()); } } } return this; }
Source:
protected void endMoveVmCommand() { incrementDbGeneration(); endActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }

Target:
protected void endMoveVmCommand() { boolean vmExists = (getVm() != null); if (vmExists) { incrementDbGeneration(); } endActionOnAllImageGroups(); if (vmExists) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }
Source:
private ComponentImpl createReferencePluginComponent( String pluginRef, FileContentProvider contentProvider) throws InfrastructureException { ExtendedPluginFQN fqn = pluginFQNParser.evaluateFqn(pluginRef, contentProvider); ComponentImpl component = new ComponentImpl(PLUGIN_COMPONENT_TYPE, pluginRef); if (!isNullOrEmpty(fqn.getId())) { component.setId(fqn.getId()); } if (!isNullOrEmpty(fqn.getReference())) { component.setReference(fqn.getReference()); } return component; }

Target:
private ComponentImpl createReferencePluginComponent( String pluginRef, FileContentProvider contentProvider) throws InfrastructureException { ExtendedPluginFQN fqn = pluginFQNParser.evaluateFqn(pluginRef, contentProvider); ComponentImpl component = new ComponentImpl(); component.setType(PLUGIN_COMPONENT_TYPE); if (!isNullOrEmpty(fqn.getId())) { component.setId(fqn.getId()); } if (!isNullOrEmpty(fqn.getReference())) { component.setReference(fqn.getReference()); } return component; }
Source:
public void writeData(SliceOutput sliceOutput) { if (!stripeOffsets.isEmpty()) { Slice compressionSlice = utf8Slice(compressionCodec.name()); sliceOutput.writeInt(compressionSlice.length()); size += SIZE_OF_INT; sliceOutput.writeBytes(compressionSlice); size += compressionSlice.length(); sliceOutput.writeInt(stripeOffsets.size()); size += SIZE_OF_INT; for (long offset : stripeOffsets) { sliceOutput.writeLong(offset); size += SIZE_OF_LONG; } } size += FOOTER_LENGTH_IN_BYTES; sliceOutput.writeInt(toIntExact(size())); }

Target:
public void writeData(SliceOutput sliceOutput) { if (!stripeOffsets.isEmpty()) { sliceOutput.writeInt(compressionSlice.length()); sliceOutput.writeBytes(compressionSlice); sliceOutput.writeInt(stripeOffsets.size()); for (long offset : stripeOffsets) { sliceOutput.writeLong(offset); } } sliceOutput.writeInt(toIntExact(size())); }
Source:
private final void sendIntent() { Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); try { mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel); } catch (RemoteException e) { } int icon = getIcon(mBatteryLevel); intent.putExtra("status", mBatteryStatus); intent.putExtra("health", mBatteryHealth); intent.putExtra("present", mBatteryPresent); intent.putExtra("level", mBatteryLevel); intent.putExtra("scale", BATTERY_SCALE); intent.putExtra("icon-small", icon); intent.putExtra("plugged", mPlugType); intent.putExtra("voltage", mBatteryVoltage); intent.putExtra("temperature", mBatteryTemperature); intent.putExtra("technology", mBatteryTechnology); if (false) { Log.d(TAG, "updateBattery level:" + mBatteryLevel + " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus + " health:" + mBatteryHealth + " present:" + mBatteryPresent + " voltage: " + mBatteryVoltage + " temperature: " + mBatteryTemperature + " technology: " + mBatteryTechnology + " AC powered:" + mAcOnline + " USB powered:" + mUsbOnline + " icon:" + icon ); } ActivityManagerNative.broadcastStickyIntent(intent, null); }

Target:
private final void sendIntent() { Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); try { mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel); } catch (RemoteException e) { } int icon = getIcon(mBatteryLevel); intent.putExtra("status", mBatteryStatus); intent.putExtra("health", mBatteryHealth); intent.putExtra("present", mBatteryPresent); intent.putExtra("level", mBatteryLevel); intent.putExtra("scale", BATTERY_SCALE); intent.putExtra("icon-small", icon); intent.putExtra("plugged", mPlugType); intent.putExtra("voltage", mBatteryVoltage); intent.putExtra("temperature", mBatteryTemperature); intent.putExtra("technology", mBatteryTechnology); if (false) { Log.d(TAG, "updateBattery level:" + mBatteryLevel + " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus + " health:" + mBatteryHealth + " present:" + mBatteryPresent + " voltage: " + mBatteryVoltage + " temperature: " + mBatteryTemperature + " technology: " + mBatteryTechnology + " AC powered:" + mAcOnline + " USB powered:" + mUsbOnline + " icon:" + icon ); } ActivityManagerNative.broadcastStickyIntent(intent, null); }
Source:
private void addPatternToCombo(Combo comb) { for (AbstractUndoRecordingCommand command : patterns) { comb.add(command.getLabel()); } }

Target:
private void addPatternToCombo(Combo comb) { for (IPatternProvider pattern : patterns) { comb.add(pattern.getLabel()); } }
Source:
protected void eventHandle(@Nullable ITmfEvent event) { if (event == null) { return; } final String eventName = event.getName(); if (eventName.equals(fLayout.eventSchedSwitch())) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfEventField content = event.getContent(); long ts = event.getTimestamp().getValue(); Long prevTid = (Long) content.getField(fLayout.fieldPrevTid()).getValue(); final ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); Integer currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(ss), cpu.toString()); Integer cumulativeTimeQuark = ss.getQuarkRelativeAndAdd(currentCPUNode, prevTid.toString()); Long startTime = fLastStartTimes.get(cpu); if (startTime == null) { startTime = fTraceStart; } StateSystemBuilderUtils.incrementAttributeLong(ss, ts, cumulativeTimeQuark, ts - startTime); fLastStartTimes.put(cpu, ts); } }

Target:
protected void eventHandle(@Nullable ITmfEvent event) { if (event == null) { return; } final String eventName = event.getName(); if (eventName.equals(fLayout.eventSchedSwitch())) { final ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfEventField content = event.getContent(); Long prevTid = content.getFieldValue(Long.class, fLayout.fieldPrevTid()); if (prevTid == null) { return; } int currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(ss), cpu.toString()); int cumulativeTimeQuark = ss.getQuarkRelativeAndAdd(currentCPUNode, prevTid.toString()); Long startTime = fLastStartTimes.getOrDefault(cpu, fTraceStart); long ts = event.getTimestamp().getValue(); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, cumulativeTimeQuark, ts - startTime); fLastStartTimes.put(cpu, ts); } }
Source:
public void testListAvailabilityZones() throws Exception { AvailabilityZoneAPI availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne"); FluentIterable<? extends AvailabilityZone> zones = availabilityZoneApi.list(); for (AvailabilityZone zone : zones) { Assert.assertNotNull(zone.getName()); Assert.assertTrue(zone.getZoneState().isAvailable()); } }

Target:
public void testListAvailabilityZones() throws Exception { AvailabilityZoneAPI availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne"); FluentIterable<? extends AvailabilityZone> zones = availabilityZoneApi.list(); for (AvailabilityZone zone : zones) { assertNotNull(zone.getName()); assertTrue(zone.getState().available(), "zone: " + zone.getName() + " is not available."); } }
Source:
public void setTaskStatusDown(Task task) { setTaskStatusDown(Arrays.asList()); }

Target:
public void setTaskStatusDown(Task task) { setTaskStatusDown(Arrays.asList(task)); }
Source:
private SymbolicConstraint simplifyConstraint(SymbolicConstraint constraint) { constraint.normalize(); SymbolicConstraint simplifiedConstraint = new SymbolicConstraint(constraint.termContext()); simplifiedConstraint.addAll( Maps.difference(constraint.substitution(), substitution()).entriesOnlyOnLeft()); List<Equality> equalities = new LinkedList<>(constraint.equalities()); equalities.removeAll(equalities()); for (Equality equality : equalities) { simplifiedConstraint.add(equality.leftHandSide, equality.rightHandSide); } simplifiedConstraint.simplify(); Map<Term, Term> substitution = new HashMap<>(); for (Equality e1:equalities()) { if (e1.rightHandSide.isGround()) { substitution.put(e1.leftHandSide,e1.rightHandSide); } if (e1.leftHandSide.isGround()) { substitution.put(e1.rightHandSide,e1.leftHandSide); } } simplifiedConstraint = (SymbolicConstraint) substituteTerms(simplifiedConstraint, substitution); simplifiedConstraint.renormalize(); simplifiedConstraint.simplify(); return simplifiedConstraint; }

Target:
private SymbolicConstraint simplifyConstraint(SymbolicConstraint constraint) { constraint.normalize(); SymbolicConstraint simplifiedConstraint = new SymbolicConstraint(constraint.termContext()); MapDifference<Variable, Term> mapDifference = Maps.difference( constraint.substitution(), substitution()); simplifiedConstraint.addAll(mapDifference.entriesOnlyOnLeft()); for (Entry<Variable, ValueDifference<Term>> entry : mapDifference.entriesDiffering().entrySet()) { simplifiedConstraint.add(entry.getKey(), entry.getValue().leftValue()); } List<Equality> equalities = new LinkedList<>(constraint.equalities()); equalities.removeAll(equalities()); simplifiedConstraint.addAll(equalities); simplifiedConstraint.simplify(); Map<Term, Term> substitution = new HashMap<>(); for (Equality e1:equalities()) { if (e1.rightHandSide.isGround()) { substitution.put(e1.leftHandSide,e1.rightHandSide); } if (e1.leftHandSide.isGround()) { substitution.put(e1.rightHandSide,e1.leftHandSide); } } simplifiedConstraint = (SymbolicConstraint) substituteTerms(simplifiedConstraint, substitution); simplifiedConstraint.renormalize(); simplifiedConstraint.simplify(); return simplifiedConstraint; }
Source:
private BlackboardAttribute.Type getLastWriteAttribute() throws TskCoreException { if (shellBagLastWriteAttributeType == null) { try { shellBagLastWriteAttributeType = tskCase.getBlackboard().getOrAddAttributeType(SHELLBAG_ATTRIBUTE_LAST_WRITE, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME, Bundle.Shellbag_Last_Write_Attribute_Display_Name()); } catch (BlackboardException ex) { throw new TskCoreException(String.format("Failed to get costume attribute %s", SHELLBAG_ATTRIBUTE_LAST_WRITE), ex); } } return shellBagLastWriteAttributeType; }

Target:
private BlackboardAttribute.Type getLastWriteAttribute() throws TskCoreException { if (shellBagLastWriteAttributeType == null) { try { shellBagLastWriteAttributeType = tskCase.getBlackboard().getOrAddAttributeType(SHELLBAG_ATTRIBUTE_LAST_WRITE, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME, Bundle.Shellbag_Last_Write_Attribute_Display_Name()); } catch (BlackboardException ex) { throw new TskCoreException(String.format("Failed to get custom attribute %s", SHELLBAG_ATTRIBUTE_LAST_WRITE), ex); } } return shellBagLastWriteAttributeType; }
Source:
private ExecutionGraphNode downsampler(final Metric metric, final String interpolator, final Downsampler downsampler) { FillPolicy policy = downsampler.getFillPolicy().getPolicy(); DownsampleConfig.Builder ds = (DownsampleConfig.Builder) DownsampleConfig.newBuilder() .setAggregator(downsampler.getAggregator()) .setInterval(downsampler.getInterval()) .setFill(policy != null && policy != FillPolicy.NONE ? true : false) .setId("downsample_" + metric.getId()) .addInterpolatorConfig(NumericInterpolatorConfig.newBuilder() .setFillPolicy(policy) .setRealFillPolicy(FillWithRealPolicy.NONE) .setId(interpolator) .setType(NumericType.TYPE.toString()) .build()); if (!Strings.isNullOrEmpty(downsampler.getTimezone())) { ds.setTimeZone(downsampler.getTimezone()); } return ExecutionGraphNode.newBuilder() .setId(metric.getId() + "_Downsampler") .setType("Downsample") .setConfig(ds.build()) .addSource(metric.getId()) .build(); }

Target:
private ExecutionGraphNode downsampler(final Metric metric, final String interpolator, final Downsampler downsampler) { FillPolicy policy = downsampler.getFillPolicy().getPolicy(); DownsampleConfig.Builder ds = (DownsampleConfig.Builder) DownsampleConfig.newBuilder() .setAggregator(downsampler.getAggregator()) .setInterval(downsampler.getInterval()) .setFill(policy != null && policy != FillPolicy.NONE) .setId("downsample_" + metric.getId()) .addInterpolatorConfig(NumericInterpolatorConfig.newBuilder() .setFillPolicy(policy) .setRealFillPolicy(FillWithRealPolicy.NONE) .setId(interpolator) .setType(NumericType.TYPE.toString()) .build()); if (!Strings.isNullOrEmpty(downsampler.getTimezone())) { ds.setTimeZone(downsampler.getTimezone()); } return ExecutionGraphNode.newBuilder() .setId(metric.getId() + "_Downsampler") .setType("Downsample") .setConfig(ds.build()) .addSource(metric.getId()) .build(); }
Source:
protected List<MimeMessage> prepareMailToBeSent() throws MessagingException, IOException, EntityDoesNotExistException { Emails emailManager = new Emails(); log.info("Fetching recipient emails for pending comments in course : " + courseId); Set<String> recipients = commentsLogic.getRecipientEmailsForSendingComments(courseId); if (recipients == null) { log.severe("Recipient emails for pending comments in course : " + courseId + " could not be fetched"); } return emailManager.generatePendingCommentsClearedEmails(courseId, recipients); }

Target:
protected List<MimeMessage> prepareMailToBeSent() throws MessagingException, IOException, EntityDoesNotExistException { log.info("Fetching recipient emails for pending comments in course : " + courseId); Set<String> recipients = commentsLogic.getRecipientEmailsForSendingComments(courseId); if (recipients == null) { log.severe("Recipient emails for pending comments in course : " + courseId + " could not be fetched"); } return new Emails().generatePendingCommentsClearedEmails(courseId, recipients); }