auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void customTagsAreWrittenToDb() throws Exception { TAGS.put("custom","customTag"); InfluxDbWriter writer = getTestInfluxDbWriterWithDefaultSettings(); writer.doWrite(dummyServer(), dummyQuery(), results); verify(influxDB).write(messageCaptor.capture()); BatchPoints batchPoints = messageCaptor.getValue(); assertThat(batchPoints.getDatabase()).isEqualTo(DATABASE_NAME); List<Point> points = batchPoints.getPoints(); assertThat(points).hasSize(1); Point point = points.get(0); assertThat(point.lineProtocol()).contains("custom=customTag"); }

Target:
public void customTagsAreWrittenToDb() throws Exception { ImmutableMap<String, String> tags = ImmutableMap.of("customTag", "customValue"); InfluxDbWriter writer = getTestInfluxDbWriterWithCustomTags(tags); writer.doWrite(dummyServer(), dummyQuery(), results); verify(influxDB).write(messageCaptor.capture()); BatchPoints batchPoints = messageCaptor.getValue(); assertThat(batchPoints.getDatabase()).isEqualTo(DATABASE_NAME); List<Point> points = batchPoints.getPoints(); assertThat(points).hasSize(1); Point point = points.get(0); assertThat(point.lineProtocol()).contains("customTag=customValue"); }
Source:
public void reset(ColumnValueSelector selector) { isNullResult = true; delegate.reset(selector); }

Target:
public void reset(ColumnValueSelector selector) { if (selector.isNull()) { isNullResult = true; } else { isNullResult = false; delegate.reset(selector); } }
Source:
protected boolean createKeys(List<Long> list) { if (skCase == null) { return true; } interestingResults.getArtifactIds(setName).forEach((id) -> { try { BlackboardArtifact art = skCase.getBlackboardArtifact(id); artifactHits.put(id, art); list.add(id); } catch (TskCoreException ex) { logger.log(Level.WARNING, "TSK Exception occurred", ex); } }); return true; }

Target:
protected boolean createKeys(List<Long> list) { if (skCase == null) { return true; } interestingResults.getArtifactIds(setName).forEach((id) -> { try { BlackboardArtifact art = skCase.getBlackboardArtifact(id); artifactHits.put(id, art); list.add(id); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "TSK Exception occurred", ex); } }); return true; }
Source:
ReceiveConfig(Config config) { allowCreates = true; allowDeletes = !config.getBoolean("receive", "denydeletes", false); allowNonCommitToHead = config.getBoolean("receivepack", "allowNonCommitToHead", false); allowNonFastForwards = !config.getBoolean("receive", "denynonfastforwards", false); allowOfsDelta = config.getBoolean("repack", "usedeltabaseoffset", true); allowPushOptions = config.getBoolean("receive", "pushoptions", false); maxCommandBytes = config.getLong("receive", "maxCommandBytes", 3 << 20); maxDiscardBytes = config.getLong("receive", "maxCommandDiscardBytes", -1); signedPush = SignedPushConfig.KEY.parse(config); }

Target:
ReceiveConfig(Config config) { allowCreates = true; allowDeletes = !config.getBoolean("receive", "denydeletes", false); allowNonCommitToHead = config.getBoolean("receive", "allowNonCommitToHead", false); allowNonFastForwards = !config.getBoolean("receive", "denynonfastforwards", false); allowOfsDelta = config.getBoolean("repack", "usedeltabaseoffset", true); allowPushOptions = config.getBoolean("receive", "pushoptions", false); maxCommandBytes = config.getLong("receive", "maxCommandBytes", 3 << 20); maxDiscardBytes = config.getLong("receive", "maxCommandDiscardBytes", -1); signedPush = SignedPushConfig.KEY.parse(config); }
Source:
public static Color getSystemForegroundColor(Display display) { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); Color foreground = colorRegistry.get(JFacePreferences.INFORMATION_FOREGROUND_COLOR); if (foreground == null) { return JFaceColors.getInformationViewerForegroundColor(display); } return foreground; }

Target:
private static Color getSystemForegroundColor(Display display) { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); Color foreground = colorRegistry.get(JFacePreferences.INFORMATION_FOREGROUND_COLOR); if (foreground == null) { return JFaceColors.getInformationViewerForegroundColor(display); } return foreground; }
Source:
protected T newInstance(final String alias, final CacheConfiguration<?, ?> cacheConfiguration) { Class<? extends T> clazz = null; for (ServiceConfiguration<?> serviceConfiguration : cacheConfiguration.getServiceConfigurations()) { if(cacheLevelConfig.isAssignableFrom(serviceConfiguration.getClass()) && !configAdded.contains(serviceConfiguration)) { clazz = cacheLevelConfig.cast(serviceConfiguration).getClazz(); configAdded.add(serviceConfiguration); break; } } if(clazz == null) { clazz = getPreconfigured(alias); } try { return clazz != null ? clazz.newInstance() : null; } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }

Target:
protected T newInstance(final String alias, final CacheConfiguration<?, ?> cacheConfiguration) { Class<? extends T> clazz = null; for (ServiceConfiguration<?> serviceConfiguration : cacheConfiguration.getServiceConfigurations()) { if(cacheLevelConfig.isAssignableFrom(serviceConfiguration.getClass())) { clazz = cacheLevelConfig.cast(serviceConfiguration).getClazz(); } } return newInstance(alias, clazz); }
Source:
public Secret getSecret(String projectId, String secretId) throws IOException { try (SecretManagerServiceClient client = SecretManagerServiceClient.create()) { SecretName name = SecretName.of(projectId, secretId); GetSecretRequest request = GetSecretRequest.newBuilder().setName(name.toString()).build(); Secret secret = client.getSecret(request); String replication = ""; if (secret.getReplication().getAutomatic() != null) { replication = "AUTOMATIC"; } else if (secret.getReplication().getUserManaged() != null) { replication = "MANAGED"; } System.out.printf("Secret %s, replication %s\n", secret.getName(), replication); return secret; } }

Target:
public void getSecret(String projectId, String secretId) throws IOException { try (SecretManagerServiceClient client = SecretManagerServiceClient.create()) { SecretName name = SecretName.of(projectId, secretId); GetSecretRequest request = GetSecretRequest.newBuilder().setName(name.toString()).build(); Secret secret = client.getSecret(request); String replication = ""; if (secret.getReplication().getAutomatic() != null) { replication = "AUTOMATIC"; } else if (secret.getReplication().getUserManaged() != null) { replication = "MANAGED"; } else { throw new IllegalStateException("Unknown replication type"); } System.out.printf("Secret %s, replication %s\n", secret.getName(), replication); } }
Source:
ValueCache(final JSONObject param) { type = ModelStructureCache.ValueType.get(param.getString("type")); if (type == ModelStructureCache.ValueType.ENUM) { enumNames = new ArrayList<String>(); JSONObject enumOrigin = null; String enumOriginName = param.getString("enum_origin"); enumOrigin = ModelStructureCache.getEnumOrigin(enumOriginName); JSONArray enums = enumOrigin.getJSONObject("structure") .getJSONArray("enums"); for (int num = 0; num < enums.length(); num++) enumNames.add(enums.getString(num)); } else enumNames = null; }

Target:
ValueCache(final JSONObject param) { type = ModelStructureCache.ValueType.get(param.getString("type")); if (type == ModelStructureCache.ValueType.ENUM) { enumNames = new ArrayList<String>(); String enumOriginName = param.getString("enum_origin"); JSONObject enumOrigin = ModelStructureCache.getEnumOrigin(enumOriginName); JSONArray enums = enumOrigin.getJSONObject("structure") .getJSONArray("enums"); for (int num = 0; num < enums.length(); num++) enumNames.add(enums.getString(num)); } else enumNames = null; }
Source:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); boolean clearCompensation = true; try { endSuccessfully(); } catch (Exception e) { clearCompensation = false; } finally { if (clearCompensation) { if (getCommandCompensationPhase() == CommandCompensationPhase.END_COMMAND) { getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); } } else { if (getCommandCompensationPhase() == CommandCompensationPhase.END_COMMAND) { compensate(); } } } }

Target:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); boolean clearCompensation = true; try { endSuccessfully(); } catch (Exception e) { clearCompensation = false; } finally { if (getCommandCompensationPhase() == NonTransactiveCommandAttribute.CommandCompensationPhase.END_COMMAND) { if (clearCompensation) { getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); } else { compensate(); } } } }
Source:
private Collection<ValueFrequency> moveUniqueToEnd(Collection<ValueFrequency> valueCounts) { ValueFrequency uniqueValueFrequency = null; for (ValueFrequency valueFrequency : valueCounts) { if ("<unique>".equals(valueFrequency.getName())) { uniqueValueFrequency = valueFrequency; break; } } if (uniqueValueFrequency != null) { List<ValueFrequency> valueCountsList = new ArrayList<>(valueCounts); valueCountsList.remove(uniqueValueFrequency); valueCountsList.add(uniqueValueFrequency); return valueCountsList; } else { return valueCounts; } }

Target:
private Collection<ValueFrequency> moveUniqueToEnd(Collection<ValueFrequency> valueCounts) { ValueFrequency uniqueValueFrequency = null; for (ValueFrequency valueFrequency : valueCounts) { if ("<unique>".equals(valueFrequency.getName())) { uniqueValueFrequency = valueFrequency; break; } } if (uniqueValueFrequency != null) { final List<ValueFrequency> valueCountsList = new ArrayList<>(valueCounts); valueCountsList.remove(uniqueValueFrequency); valueCountsList.add(uniqueValueFrequency); return valueCountsList; } else { return valueCounts; } }
Source:
public static String resolveRelativeVolumeBinding(File baseDir, String bindingString) { if (!baseDir.isAbsolute()) { throw new IllegalArgumentException("Base directory '" + baseDir + "' must be absolute."); } String[] pathParts = bindingString.split(":"); String localPath = pathParts[0]; String serverPath = (pathParts.length > 1) ? pathParts[1] : ""; if (localPath.startsWith("./")) { localPath = new File(baseDir, localPath.substring(2)).getAbsolutePath(); } if (localPath.startsWith("~/")) { localPath = new File(System.getProperty("user.home"), localPath.substring(2)).getAbsolutePath(); } if (serverPath.length() > 0) { return String.format("%s:%s", localPath, serverPath); } return localPath; }

Target:
public static String resolveRelativeVolumeBinding(File baseDir, String bindingString) { String[] pathParts = bindingString.split(":"); String localPath = pathParts[0]; if (isRelativePath(localPath)) { File resolvedFile; if (isUserHomeRelativePath(localPath)) { resolvedFile = resolveAbsolutely(prepareUserHomeRelativePath(localPath), System.getProperty("user.home")); } else { if (!baseDir.isAbsolute()) { throw new IllegalArgumentException("Base directory '" + baseDir + "' must be absolute."); } resolvedFile = resolveAbsolutely(localPath, baseDir.getAbsolutePath()); } try { localPath = resolvedFile.getCanonicalFile().getAbsolutePath(); } catch (IOException e) { throw new RuntimeException("Unable to canonicalize '" + resolvedFile + "'"); } } if (pathParts.length > 1) { pathParts[0] = localPath; return join(":", pathParts); } return localPath; }
Source:
public void performAction() { FileSet selectedFiles; selectedFiles = mainFrame.getActiveTable().getSelectedFiles(); if(command.hasKeywordToken() && selectedFiles.size() == 0) return; if(selectedFiles.getBaseFolder().getURL().getScheme().equals(FileProtocols.FILE) && (selectedFiles.getBaseFolder().hasAncestor(LocalFile.class))) { try {ProcessRunner.execute(command.getTokens(selectedFiles), selectedFiles.getBaseFolder());} catch(Exception e) { InformationDialog.showErrorDialog(mainFrame); LOGGER.debug("Failed to execute command: " + command.getCommand(), e); } } else { ProgressDialog progressDialog = new ProgressDialog(mainFrame, Translator.get("copy_dialog.copying")); progressDialog.start(new TempOpenWithJob(new ProgressDialog(mainFrame, Translator.get("copy_dialog.copying")), mainFrame, selectedFiles, command)); } }

Target:
public void performAction() { FileSet selectedFiles; selectedFiles = mainFrame.getActiveTable().getSelectedFiles(); if(command.hasSelectedFileKeyword() && selectedFiles.size() == 0) return; if(selectedFiles.getBaseFolder().getURL().getScheme().equals(FileProtocols.FILE) && (selectedFiles.getBaseFolder().hasAncestor(LocalFile.class))) { try {ProcessRunner.execute(command.getTokens(selectedFiles), selectedFiles.getBaseFolder());} catch(Exception e) { InformationDialog.showErrorDialog(mainFrame); LOGGER.debug("Failed to execute command: " + command.getCommand(), e); } } else { ProgressDialog progressDialog = new ProgressDialog(mainFrame, Translator.get("copy_dialog.copying")); progressDialog.start(new TempOpenWithJob(new ProgressDialog(mainFrame, Translator.get("copy_dialog.copying")), mainFrame, selectedFiles, command)); } }
Source:
public LoadChangeType getChangeType() { return null; }

Target:
public LoadChangeType getChangeType() { return LoadChangeType.attribute; }
Source:
public void handle(ServerNotification notification) { SonarLintTelemetry telemetry = SonarLintUtils.getService(SonarLintTelemetry.class); boolean isSonarCloud; try { ProjectBindingManager bindingManager = SonarLintUtils.getService(myProject, ProjectBindingManager.class); ServerConnection server = bindingManager.getServerConnection(); isSonarCloud = server.isSonarCloud(); } catch (InvalidBindingException e) { return; } telemetry.devNotificationsReceived(); Notification notif = SERVER_NOTIFICATIONS_GROUP.createNotification( "<b>" + (isSonarCloud ? "SonarCloud" : "SonarQube") + " Notification</b>", createMessage(notification, isSonarCloud), NotificationType.INFORMATION, new NotificationListener.UrlOpeningListener(false) { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) { SonarLintTelemetry telemetry = SonarLintUtils.getService(SonarLintTelemetry.class); telemetry.devNotificationsClicked(); super.hyperlinkActivated(notification, event); notification.hideBalloon(); } }); notif.setIcon(isSonarCloud ? SonarLintIcons.ICON_SONARCLOUD_16 : SonarLintIcons.ICON_SONARQUBE_16); notif.setImportant(true); notif.notify(myProject); }

Target:
public void handle(ServerNotification notification) { SonarLintTelemetry telemetry = SonarLintUtils.getService(SonarLintTelemetry.class); telemetry.devNotificationsReceived(); Notification notif = SERVER_NOTIFICATIONS_GROUP.createNotification( "<b>" + (isSonarCloud ? "SonarCloud" : "SonarQube") + " Notification</b>", createMessage(notification, isSonarCloud), NotificationType.INFORMATION, new NotificationListener.UrlOpeningListener(false) { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) { SonarLintTelemetry telemetry = SonarLintUtils.getService(SonarLintTelemetry.class); telemetry.devNotificationsClicked(); super.hyperlinkActivated(notification, event); notification.hideBalloon(); } }); notif.setIcon(isSonarCloud ? SonarLintIcons.ICON_SONARCLOUD_16 : SonarLintIcons.ICON_SONARQUBE_16); notif.setImportant(true); notif.notify(myProject); }
Source:
private void doAdvertisement() throws IOException, ServiceNotAuthorizedException { PacketLineOut pktLineOut = new PacketLineOut(out); try { String line; while ((line = in.readString()) != PacketLineIn.END) { if (!line.startsWith("repositoryaccess ")) throw new TransportException(MessageFormat.format( JGitText.get().expectedGot, "repositoryaccess", line)); Repository r = null; try { r = openRepository(line.substring( "repositoryaccess ".length())); } finally { if (r != null) r.close(); } } pktLineOut.writeString("ACK"); } catch (TransportException e) { pktLineOut.writeString("ERR " + e.getMessage()); } catch (ServiceNotEnabledException e) { pktLineOut.writeString("ERR " + e.getMessage()); } finally { pktLineOut.flush(); } }

Target:
private void doAdvertisement() throws IOException, ServiceNotAuthorizedException { PacketLineOut pktLineOut = new PacketLineOut(out); try { String line; while ((line = in.readString()) != PacketLineIn.END) { if (!line.startsWith("repositoryaccess ")) throw new TransportException(MessageFormat.format( JGitText.get().expectedGot, "repositoryaccess", line)); Repository r = openRepository( line.substring("repositoryaccess ".length())); r.close(); } pktLineOut.writeString("ACK"); } catch (TransportException e) { pktLineOut.writeString("ERR " + e.getMessage()); } catch (ServiceNotEnabledException e) { pktLineOut.writeString("ERR " + e.getMessage()); } finally { pktLineOut.flush(); } }
Source:
static RedshiftConnectionConfig configure(SecretProvider secrets, Config params) { return ImmutableRedshiftConnectionConfig.builder() .host(secrets.getSecretOptional("host").or(() -> params.get("host", String.class))) .port(secrets.getSecretOptional("port").transform(Integer::parseInt).or(() -> params.get("port", int.class, 5439))) .user(secrets.getSecretOptional("user").or(() -> params.get("user", String.class))) .password(secrets.getSecretOptional("password").or(params.getOptional("password", String.class))) .database(secrets.getSecretOptional("database").or(() -> params.get("database", String.class))) .ssl(secrets.getSecretOptional("ssl").transform(Boolean::parseBoolean).or(() -> params.get("ssl", boolean.class, false))) .connectTimeout(secrets.getSecretOptional("connect_timeout").transform(DurationParam::parse).or(() -> params.get("connect_timeout", DurationParam.class, DurationParam.of(Duration.ofSeconds(30))))) .socketTimeout(secrets.getSecretOptional("socket_timeout").transform(DurationParam::parse).or(() -> params.get("socket_timeout", DurationParam.class, DurationParam.of(Duration.ofSeconds(1800))))) .schema(secrets.getSecretOptional("schema").or(params.getOptional("schema", String.class))) .build(); }

Target:
public static RedshiftConnectionConfig configure(SecretProvider secrets, Config params) { return ImmutableRedshiftConnectionConfig.builder() .host(secrets.getSecretOptional("host").or(() -> params.get("host", String.class))) .port(secrets.getSecretOptional("port").transform(Integer::parseInt).or(() -> params.get("port", int.class, 5439))) .user(secrets.getSecretOptional("user").or(() -> params.get("user", String.class))) .password(secrets.getSecretOptional("password")) .database(secrets.getSecretOptional("database").or(() -> params.get("database", String.class))) .ssl(secrets.getSecretOptional("ssl").transform(Boolean::parseBoolean).or(() -> params.get("ssl", boolean.class, false))) .connectTimeout(params.get("connect_timeout", DurationParam.class, DurationParam.of(Duration.ofSeconds(30)))) .socketTimeout(params.get("socket_timeout", DurationParam.class, DurationParam.of(Duration.ofSeconds(1800)))) .schema(secrets.getSecretOptional("schema").or(params.getOptional("schema", String.class))) .build(); }
Source:
private boolean isEndOfScope(final DetailAST lastAnnotationNode, final DetailAST node) { DetailAST checkNode = node; while (!checkNode.equals(lastAnnotationNode)) { switch (checkNode.getType()) { case TokenTypes.RCURLY: case TokenTypes.RBRACK: while (checkNode.getNextSibling() == null) { checkNode = checkNode.getParent(); } checkNode = checkNode.getNextSibling(); break; default: return false; } } return true; }

Target:
private boolean isEndOfScope(final DetailAST lastAnnotationNode, final DetailAST node) { DetailAST checkNode = node; boolean endOfScope = true; while (endOfScope && !checkNode.equals(lastAnnotationNode)) { switch (checkNode.getType()) { case TokenTypes.RCURLY: case TokenTypes.RBRACK: while (checkNode.getNextSibling() == null) { checkNode = checkNode.getParent(); } checkNode = checkNode.getNextSibling(); break; default: endOfScope = false; } } return endOfScope; }
Source:
public void extractBackgroundValues() { List<InstanceGiven> backgroundGivens = runnerHelper.extractBackgroundValues(background, classLoader, expressionEvaluatorFactory); assertEquals(3, backgroundGivens.size()); for (InstanceGiven backgroundGiven : backgroundGivens) { if (backgroundGiven.getFactIdentifier().equals(personFactIdentifier)) { assertEquals(personFactIdentifier, backgroundGiven.getFactIdentifier()); Person person = (Person) backgroundGiven.getValue(); assertEquals(NAME, person.getFirstName()); } else if (backgroundGiven.getFactIdentifier().equals(disputeFactIdentifier)) { assertEquals(disputeFactIdentifier, backgroundGiven.getFactIdentifier()); Dispute dispute = (Dispute) backgroundGiven.getValue(); assertEquals(AMOUNT, dispute.getAmount(), 0.1); } else { fail(); } } FactMappingValue notValid = backgroundData1.addOrUpdateMappingValue(disputeFactIdentifier, amountGivenExpressionIdentifier, "notValid"); assertThatThrownBy(() -> runnerHelper.extractBackgroundValues(background, classLoader, expressionEvaluatorFactory)) .isInstanceOf(ScenarioException.class) .hasMessage("Error in BACKGROUND data"); assertEquals(FactMappingValueStatus.FAILED_WITH_EXCEPTION, notValid.getStatus()); assertTrue(notValid.getExceptionMessage().startsWith("Impossible to parse")); }

Target:
public void extractBackgroundValues() { Background emptyBackground = new Background(); List<InstanceGiven> emptyBackgroundGivens = runnerHelper.extractBackgroundValues(emptyBackground, classLoader, expressionEvaluatorFactory); assertEquals(0, emptyBackgroundGivens.size()); emptyBackground.addData(); emptyBackgroundGivens = runnerHelper.extractBackgroundValues(emptyBackground, classLoader, expressionEvaluatorFactory); assertEquals(0, emptyBackgroundGivens.size()); List<InstanceGiven> backgroundGivens = runnerHelper.extractBackgroundValues(this.background, classLoader, expressionEvaluatorFactory); assertEquals(3, backgroundGivens.size()); for (InstanceGiven backgroundGiven : backgroundGivens) { if (backgroundGiven.getFactIdentifier().equals(personFactIdentifier)) { assertEquals(personFactIdentifier, backgroundGiven.getFactIdentifier()); Person person = (Person) backgroundGiven.getValue(); assertEquals(NAME, person.getFirstName()); } else if (backgroundGiven.getFactIdentifier().equals(disputeFactIdentifier)) { assertEquals(disputeFactIdentifier, backgroundGiven.getFactIdentifier()); Dispute dispute = (Dispute) backgroundGiven.getValue(); assertEquals(AMOUNT, dispute.getAmount(), 0.1); } else { fail(); } } FactMappingValue notValid = backgroundData1.addOrUpdateMappingValue(disputeFactIdentifier, amountGivenExpressionIdentifier, "notValid"); assertThatThrownBy(() -> runnerHelper.extractBackgroundValues(this.background, classLoader, expressionEvaluatorFactory)) .isInstanceOf(ScenarioException.class) .hasMessage("Error in BACKGROUND data"); assertEquals(FactMappingValueStatus.FAILED_WITH_EXCEPTION, notValid.getStatus()); assertTrue(notValid.getExceptionMessage().startsWith("Impossible to parse")); }
Source:
public LoggerServiceImpl() { args = new HashMap<>(); actions = new HashMap<>(); actions.put( "log-record", new Runnable() { @Override public void run() { logrecord(); } } ); }

Target:
public LoggerServiceImpl() { actions.put( "log-record", new Runnable() { @Override public void run() { logrecord(); } } ); }
Source:
public RawType(byte[] bytes, String mimeType) { this.bytes = bytes; this.mimeType = mimeType; }

Target:
public RawType(byte[] bytes, String mimeType) { if (mimeType == null) { throw new IllegalArgumentException("mimeType argument must not be null"); } else if (mimeType.isEmpty()) { throw new IllegalArgumentException("mimeType argument must not be blank"); } this.bytes = bytes; this.mimeType = mimeType; }
Source:
public ActionResponse execute(Query parameter) { List<String> ids = new ArrayList<>(); try { SearchRequest searchRequest = getRequestBuilder(parameter); SearchResponse searchResponse = getConnection() .getClient() .search(searchRequest, RequestOptions.DEFAULT); String scrollId = searchResponse.getScrollId(); SearchHits searchHits = searchResponse.getHits(); for(SearchHit searchHit : searchHits) { ids.add(searchHit.getId()); } while(ids.size() < parameter.getLimit()){ SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId); scrollRequest.scroll(TimeValue.timeValueSeconds(elasticsearchTuningConfig.getScrollTimeInSeconds())); SearchResponse searchScrollResponse = getConnection().getClient().scroll(scrollRequest, RequestOptions.DEFAULT); scrollId = searchScrollResponse.getScrollId(); SearchHits hits = searchScrollResponse.getHits(); if (hits.getHits().length == 0){ return getResponse(parameter, searchHits, ids); } for(SearchHit searchHit : hits) { ids.add(searchHit.getId()); } } if (ids.size() > parameter.getLimit()){ ids = new ArrayList<>(ids.subList(0, parameter.getLimit())); } return getResponse(parameter, searchHits, ids); }catch (IOException e){ throw FoxtrotExceptions.createQueryExecutionException(parameter, e); } }

Target:
public ActionResponse execute(Query parameter) { if (parameter.isScrollRequest()) { return executeScrollRequest(parameter); } return executeRequest(parameter); }
Source:
private boolean updateRngDevice() { if (!getParameters().isUpdateRngDevice()) { return true; } VdcQueryReturnValue query = runInternalQuery(VdcQueryType.GetRngDevice, new IdQueryParameters(getParameters().getVmId())); List<VmRngDevice> rngDevs = query.getReturnValue(); VdcReturnValueBase rngCommandResult = null; if (rngDevs.isEmpty()) { if (getParameters().getRngDevice() != null) { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); rngCommandResult = runInternalAction(VdcActionType.AddRngDevice, params, cloneContextAndDetachFromParent()); } } else { if (getParameters().getRngDevice() == null) { RngDeviceParameters params = new RngDeviceParameters(rngDevs.get(0), true); rngCommandResult = runInternalAction(VdcActionType.RemoveRngDevice, params, cloneContextAndDetachFromParent()); } else { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); params.getRngDevice().setDeviceId(rngDevs.get(0).getDeviceId()); rngCommandResult = runInternalAction(VdcActionType.UpdateRngDevice, params, cloneContextAndDetachFromParent()); } } if (rngCommandResult != null && !rngCommandResult.getSucceeded()) { return false; } return true; }

Target:
private void updateRngDevice() { if (!getParameters().isUpdateRngDevice()) { return; } VdcQueryReturnValue query = runInternalQuery(VdcQueryType.GetRngDevice, new IdQueryParameters(getParameters().getVmId())); List<VmRngDevice> rngDevs = query.getReturnValue(); VdcReturnValueBase rngCommandResult = null; if (rngDevs.isEmpty()) { if (getParameters().getRngDevice() != null) { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); rngCommandResult = runInternalAction(VdcActionType.AddRngDevice, params, cloneContextAndDetachFromParent()); } } else { if (getParameters().getRngDevice() == null) { RngDeviceParameters params = new RngDeviceParameters(rngDevs.get(0), true); rngCommandResult = runInternalAction(VdcActionType.RemoveRngDevice, params, cloneContextAndDetachFromParent()); } else { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); params.getRngDevice().setDeviceId(rngDevs.get(0).getDeviceId()); rngCommandResult = runInternalAction(VdcActionType.UpdateRngDevice, params, cloneContextAndDetachFromParent()); } } if (rngCommandResult != null && !rngCommandResult.getSucceeded()) { log.error("Updating RNG device of VM ({}) failed. Old RNG device = {}. New RNG device = {}.", getVm().getName(), getVm().getId(), rngDevs.isEmpty() ? null : rngDevs.get(0), getParameters().getRngDevice()); } }
Source:
protected void processRecord(ComputationContext context, Record record) { try { BulkCommand command = getBulkCommandJson(record.data); if (!kvStore.compareAndSet(record.key + STATE, SCHEDULED.toString(), BUILDING.toString())) { log.error("Discard record: " + record + " because it's already building"); return; } try (CloseableCoreSession session = CoreInstance.openCoreSession(command.getRepository(), command.getUsername())) { ScrollResult<String> scroll = session.scroll(command.getQuery(), scrollBatchSize, scrollKeepAliveSeconds); long documentCount = 0; while (scroll.hasResults()) { List<String> docIds = scroll.getResults(); docIds.forEach(docId -> context.produceRecord(command.getOperation(), record.key + '/' + docId, record.data)); documentCount += docIds.size(); scroll = session.scroll(scroll.getScrollId()); TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } context.askForCheckpoint(); kvStore.put(record.key + STATE, COMPLETED.toString()); kvStore.put(record.key + SCROLLED_DOCUMENT_COUNT, documentCount); } } catch (NuxeoException e) { log.error("Discard invalid record: " + record, e); } }

Target:
protected void processRecord(ComputationContext context, Record record) { KeyValueStore kvStore = getKeyValueStore(); try { BulkCommand command = getBulkCommandJson(record.data); if (!kvStore.compareAndSet(record.key + STATE, SCHEDULED.toString(), BUILDING.toString())) { log.error("Discard record: " + record + " because it's already building"); return; } try (CloseableCoreSession session = CoreInstance.openCoreSession(command.getRepository(), command.getUsername())) { ScrollResult<String> scroll = session.scroll(command.getQuery(), scrollBatchSize, scrollKeepAliveSeconds); long documentCount = 0; while (scroll.hasResults()) { List<String> docIds = scroll.getResults(); docIds.forEach(docId -> context.produceRecord(command.getOperation(), record.key + '/' + docId, record.data)); documentCount += docIds.size(); context.askForCheckpoint(); scroll = session.scroll(scroll.getScrollId()); TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } kvStore.put(record.key + STATE, COMPLETED.toString()); kvStore.put(record.key + SCROLLED_DOCUMENT_COUNT, documentCount); } } catch (NuxeoException e) { log.error("Discard invalid record: " + record, e); } }
Source:
public void whenListVersionsListedOrdered() throws Exception { final EventTypeSchemaBase schemaBase = new EventTypeSchemaBase(EventTypeSchemaBase.Type.JSON_SCHEMA, "schema"); final EventType eventType = EventTypeTestBuilder.builder() .name("test_et_name_schemarepositorytest") .schema(new EventTypeSchema(schemaBase, "1.0.2", DateTime.now())) .build(); insertEventType(eventType); insertSchema(eventType); eventType.setSchema(new EventTypeSchema(schemaBase, "2.10.3", DateTime.now())); insertSchema(eventType); eventType.setSchema(new EventTypeSchema(schemaBase, "10.0.0", DateTime.now())); insertSchema(eventType); final List<EventTypeSchema> schemas = repository.getSchemas("test_et_name_schemarepositorytest", 0, 3); Assert.assertEquals(3, schemas.size()); Assert.assertEquals(new Version("10.0.0"), schemas.get(0).getVersion()); Assert.assertEquals(new Version("2.10.3"), schemas.get(1).getVersion()); Assert.assertEquals(new Version("1.0.2"), schemas.get(2).getVersion()); final int count = repository.getSchemasCount("test_et_name_schemarepositorytest"); Assert.assertEquals(3, count); }

Target:
public void whenListVersionsListedOrdered() throws Exception { final EventTypeSchemaBase schemaBase = new EventTypeSchemaBase(EventTypeSchemaBase.Type.JSON_SCHEMA, "schema"); final EventType eventType = EventTypeTestBuilder.builder() .name("test_et_name_schemarepositorytest") .build(); insertEventType(eventType); eventType.setSchema(new EventTypeSchema(schemaBase, "1.0.2", DateTime.parse("2016-12-07T10:44:16.378+01:00"))); insertSchema(eventType); eventType.setSchema(new EventTypeSchema(schemaBase, "2.10.3", DateTime.parse("2016-12-07T10:54:16.778+01:00"))); insertSchema(eventType); eventType.setSchema(new EventTypeSchema(schemaBase, "10.0.0", DateTime.parse("2016-12-07T10:57:16.200+01:00"))); insertSchema(eventType); final List<EventTypeSchema> schemas = repository.getSchemas("test_et_name_schemarepositorytest", 0, 3); Assert.assertEquals(3, schemas.size()); Assert.assertEquals(new Version("10.0.0"), schemas.get(0).getVersion()); Assert.assertEquals(new Version("2.10.3"), schemas.get(1).getVersion()); Assert.assertEquals(new Version("1.0.2"), schemas.get(2).getVersion()); final int count = repository.getSchemasCount("test_et_name_schemarepositorytest"); Assert.assertEquals(3, count); }
Source:
public void reloadConfig() { EventBuilder ebldr = new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_SUCCESSFUL_UEI, getName()); ebldr.addParam(EventConstants.PARM_DAEMON_NAME, "DroolsCorrelationEngine-" + m_name); try { LOG.info("Reloading configuration for engine {}", m_name); EngineConfiguration cfg = JaxbUtils.unmarshal(EngineConfiguration.class, m_configPath); Optional<RuleSet> opt = cfg.getRuleSetCollection().stream().filter(rs -> rs.getName().equals(getName())).findFirst(); if (opt.isPresent()) { marshallStateToDisk(true); opt.get().updateEngine(this); initialize(); } else { ebldr.setUei(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI); ebldr.addParam(EventConstants.PARM_REASON, "RuleSet not found on " + m_configPath); } } catch (Exception e) { ebldr.setUei(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI); ebldr.addParam(EventConstants.PARM_REASON, e.getMessage()); } finally { if (ebldr != null) sendEvent(ebldr.getEvent()); } }

Target:
public void reloadConfig() { EventBuilder ebldr = new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_SUCCESSFUL_UEI, getName()); ebldr.addParam(EventConstants.PARM_DAEMON_NAME, "DroolsCorrelationEngine-" + m_name); try { LOG.info("Reloading configuration for engine {}", m_name); EngineConfiguration cfg = JaxbUtils.unmarshal(EngineConfiguration.class, m_configPath); Optional<RuleSet> opt = cfg.getRuleSetCollection().stream().filter(rs -> rs.getName().equals(getName())).findFirst(); if (opt.isPresent()) { marshallStateToDisk(true); opt.get().updateEngine(this); initialize(); } else { ebldr.setUei(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI); ebldr.addParam(EventConstants.PARM_REASON, "RuleSet not found on " + m_configPath); } } catch (Exception e) { ebldr.setUei(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI); ebldr.addParam(EventConstants.PARM_REASON, e.getMessage()); } finally { sendEvent(ebldr.getEvent()); } }
Source:
private long timeDelay(SyncTimer timer) { long start = System.currentTimeMillis(); timer.delay(); return System.currentTimeMillis() - start; }

Target:
private long timeDelay(SyncTimer timer) { long start = System.currentTimeMillis(); timer.delay(); long duration = System.currentTimeMillis() - start; return duration; }
Source:
public CommitUpdate getCommitUpdate(long startTs) { Optional<IdentifiedVersion> startVersion = timestampMap.getStartVersion(startTs); Optional<CommitInfo> maybeCommitInfo = timestampMap.getCommitInfo(startTs); checkConditionOrThrow(!maybeCommitInfo.isPresent() || !startVersion.isPresent(), "start or commit info not processed for start timestamp"); CommitInfo commitInfo = maybeCommitInfo.get(); ClientLogEvents update = eventLog.getEventsBetweenVersions(startVersion, commitInfo.commitVersion()); if (update.clearCache()) { return ImmutableInvalidateAll.builder().build(); } return constructCommitUpdate(commitInfo, update.events()); }

Target:
public CommitUpdate getCommitUpdate(long startTs) { Optional<IdentifiedVersion> startVersion = timestampStateStore.getStartVersion(startTs); Optional<CommitInfo> maybeCommitInfo = timestampStateStore.getCommitInfo(startTs); assertTrue(maybeCommitInfo.isPresent() && startVersion.isPresent(), "start or commit info not processed for start timestamp"); CommitInfo commitInfo = maybeCommitInfo.get(); ClientLogEvents update = eventLog.getEventsBetweenVersions(startVersion, commitInfo.commitVersion()); if (update.clearCache()) { return ImmutableInvalidateAll.builder().build(); } return createCommitUpdate(commitInfo, update.events()); }
Source:
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int horizontalMargin = getResources().getDimensionPixelOffset(R.dimen.list_item_horizontal_margin); int verticalMargin = getResources().getDimensionPixelOffset(R.dimen.list_item_vertical_margin); outRect.left = horizontalMargin; outRect.right = horizontalMargin; outRect.top = verticalMargin; outRect.bottom = verticalMargin; }

Target:
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { outRect.left = horizontalMargin; outRect.right = horizontalMargin; outRect.top = verticalMargin; outRect.bottom = verticalMargin; }
Source:
protected ScanInterpreter getInterpreter(final CommandLine cl, final String tableName, final Shell shellState) throws Exception { Class<? extends ScanInterpreter> clazz = null; try { if (cl.hasOption(interpreterOpt.getOpt())) { shellState.getReader().println( "WARNING: Scan Interpreter option is deprecated and will be removed in 2.1.\n"); clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(interpreterOpt.getOpt()), ScanInterpreter.class); } else if (cl.hasOption(formatterInterpeterOpt.getOpt())) { shellState.getReader().println( "WARNING: Scan Interpreter option is deprecated and will be removed in 2.1.\n"); clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()), ScanInterpreter.class); } } catch (ClassNotFoundException e) { shellState.getReader().println("Interpreter class could not be loaded.\n" + e.getMessage()); } if (clazz == null) clazz = InterpreterCommand.getCurrentInterpreter(tableName, shellState); if (clazz == null) clazz = DefaultScanInterpreter.class; return clazz.newInstance(); }

Target:
protected ScanInterpreter getInterpreter(final CommandLine cl, final String tableName, final Shell shellState) throws Exception { Class<? extends ScanInterpreter> clazz = null; try { if (cl.hasOption(interpreterOpt.getOpt())) { Shell.log.warn( "Scan Interpreter option is deprecated and will be removed in a future version.\n"); clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(interpreterOpt.getOpt()), ScanInterpreter.class); } else if (cl.hasOption(formatterInterpeterOpt.getOpt())) { Shell.log.warn( "Scan Interpreter option is deprecated and will be removed in a future version.\n"); clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()), ScanInterpreter.class); } } catch (ClassNotFoundException e) { shellState.getReader().println("Interpreter class could not be loaded.\n" + e.getMessage()); } if (clazz == null) clazz = InterpreterCommand.getCurrentInterpreter(tableName, shellState); if (clazz == null) clazz = DefaultScanInterpreter.class; return clazz.newInstance(); }
Source:
public boolean appliesToAlert(Alert alert) { if (!isEnabled()) { log.debug("Filter disabled"); return false; } if (getRuleId() != alert.getPluginId()) { log.debug( "Filter didnt match plugin id: " + getRuleId() + " != " + alert.getPluginId()); return false; } if (!matchesStringOrRegex("URL", getUrl(), isUrlRegex(), alert.getUri())) { return false; } if (!matchesStringOrRegex( "Parameter", getParameter(), isParameterRegex(), alert.getParam())) { return false; } if (!matchesStringOrRegex("Attack", getAttack(), isAttackRegex(), alert.getAttack())) { return false; } if (!matchesStringOrRegex( "Evidence", getEvidence(), isEvidenceRegex(), alert.getEvidence())) { return false; } return true; }

Target:
public boolean appliesToAlert(Alert alert) { if (!isEnabled()) { if (log.isDebugEnabled()) { log.debug("Filter disabled"); } return false; } if (getRuleId() != alert.getPluginId()) { if (log.isDebugEnabled()) { log.debug( "Filter didnt match plugin id: " + getRuleId() + " != " + alert.getPluginId()); } return false; } if (!matchesStringOrRegex("URL", getUrl(), isUrlRegex(), alert.getUri())) { return false; } if (!matchesStringOrRegex( "Parameter", getParameter(), isParameterRegex(), alert.getParam())) { return false; } if (!matchesStringOrRegex("Attack", getAttack(), isAttackRegex(), alert.getAttack())) { return false; } if (!matchesStringOrRegex( "Evidence", getEvidence(), isEvidenceRegex(), alert.getEvidence())) { return false; } return true; }
Source:
public void testPrimaryOwnerChangingDuringRemove() throws Exception { doTest(TestWriteOperation.REMOVE_EXACT); }

Target:
public void testPrimaryOwnerChangingDuringRemove() throws Exception { doTest(TestWriteOperation.REMOVE); }
Source:
public void testCookieForStateLessClientForAnonUser() throws HttpException, IOException { GlobalConfigurationResource settings = SettingsMessageUtil.getCurrentSettings(); settings.setSecurityAnonymousAccessEnabled( true ); SettingsMessageUtil.save( settings ); TestContext context = TestContainer.getInstance().getTestContext(); String username = context.getAdminUsername(); String password = context.getPassword(); String url = this.getBaseNexusUrl() + "content/"; Header header = new Header("User-Agent", "Java/1.6" ); HttpClient httpClient = new HttpClient(); GetMethod getMethod = new GetMethod( url ); getMethod.addRequestHeader( header ); Assert.assertEquals( httpClient.executeMethod( getMethod ), 200 ); Cookie sessionCookie = this.getSessionCookie( httpClient.getState().getCookies() ); Assert.assertNull( sessionCookie, "Session Cookie is set" ); }

Target:
public void testCookieForStateLessClientForAnonUser() throws HttpException, IOException { GlobalConfigurationResource settings = SettingsMessageUtil.getCurrentSettings(); settings.setSecurityAnonymousAccessEnabled( true ); SettingsMessageUtil.save( settings ); TestContext context = TestContainer.getInstance().getTestContext(); String username = context.getAdminUsername(); String password = context.getPassword(); String url = this.getBaseNexusUrl() + "content/"; Header header = new Header("User-Agent", "Java/1.6" ); HttpClient httpClient = new HttpClient(); GetMethod getMethod = new GetMethod( url ); getMethod.addRequestHeader( header ); Assert.assertEquals( executeAndRelease( httpClient, getMethod ), 200 ); Cookie sessionCookie = this.getSessionCookie( httpClient.getState().getCookies() ); Assert.assertNull( sessionCookie, "Session Cookie is set" ); }
Source:
public Collection<RepositoryResource> getMatchingResources(FilterPredicate... predicates) throws RepositoryBackendException { ResourceCollector<RepositoryResource> resources = new ResourceCollector<RepositoryResource>(DuplicatePolicy.ALLOW_DUPLICATES); Map<FilterableAttribute, Collection<String>> filters = new HashMap<FilterableAttribute, Collection<String>>(); for (FilterPredicate predicate : predicates) { filters.put(predicate.getAttribute(), predicate.getValues()); } RepositoryReadableClient client = createClient(); try { Collection<Asset> assets = client.getFilteredAssets(filters); for (Asset ass : assets) { RepositoryResource res = ResourceFactory.getInstance().createResourceFromAsset(ass, this); resources.add(res); } } catch (IOException ioe) { throw new RepositoryBackendIOException("Failed to obtain the assets from massive", ioe, this); } catch (RequestFailureException e) { throw new RepositoryBackendRequestFailureException(e, this); } return resources.getResourceCollection(); }

Target:
public Collection<RepositoryResource> getMatchingResources(FilterPredicate... predicates) throws RepositoryBackendException { List<RepositoryResource> resources = new ArrayList<RepositoryResource>(); Map<FilterableAttribute, Collection<String>> filters = new HashMap<FilterableAttribute, Collection<String>>(); for (FilterPredicate predicate : predicates) { filters.put(predicate.getAttribute(), predicate.getValues()); } RepositoryReadableClient client = createClient(); try { Collection<Asset> assets = client.getFilteredAssets(filters); for (Asset ass : assets) { RepositoryResource res = ResourceFactory.getInstance().createResourceFromAsset(ass, this); resources.add(res); } } catch (IOException ioe) { throw new RepositoryBackendIOException("Failed to obtain the assets from massive", ioe, this); } catch (RequestFailureException e) { throw new RepositoryBackendRequestFailureException(e, this); } return resources; }
Source:
public DataSet<ExecRow> writeORCFile(int[] baseColumnMap, int[] partitionBy, String location, String compression, OperationContext context) { try { Dataset<Row> insertDF = SpliceSpark.getSession().createDataFrame( rdd.map(new SparkSpliceFunctionWrapper<>(new CountWriteFunction(context))).map(new LocatedRowToRowFunction()), context.getOperation().getExecRowDefinition().schema()); String[] partitionByCols = new String[partitionBy.length]; StructField[] fields = context.getOperation().getExecRowDefinition().schema().fields(); for (int i = 0; i < partitionBy.length; i++) { partitionByCols[i] = fields[partitionBy[i]].name(); } if (partitionBy.length > 0) { List<Column> repartitionCols = new ArrayList(); for (int i = 0; i < partitionBy.length; i++) { repartitionCols.add(new Column(fields[partitionBy[i]].name())); } insertDF = insertDF.repartition(scala.collection.JavaConversions.asScalaBuffer(repartitionCols).toList()); } insertDF.write().option(SPARK_COMPRESSION_OPTION,compression) .partitionBy(partitionByCols) .mode(SaveMode.Append).orc(location); ValueRow valueRow=new ValueRow(1); valueRow.setColumn(1,new SQLLongint(context.getRecordsWritten())); return new SparkDataSet<>(SpliceSpark.getContext().parallelize(Collections.singletonList(valueRow), 1)); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public DataSet<ExecRow> writeORCFile(int[] baseColumnMap, int[] partitionBy, String location, String compression, OperationContext context) { try { String[] colNames = ((DMLWriteOperation) context.getOperation()).getColumnNames(); DataValueDescriptor[] dvds = context.getOperation().getExecRowDefinition().getRowArray(); StructField[] fields = new StructField[colNames.length]; for (int i=0 ; i<colNames.length ; i++){ fields[i] = dvds[i].getStructField(colNames[i]); } StructType tableSchema = DataTypes.createStructType(fields); Dataset<Row> insertDF = SpliceSpark.getSession().createDataFrame( rdd.map(new SparkSpliceFunctionWrapper<>(new CountWriteFunction(context))).map(new LocatedRowToRowFunction()), tableSchema); String[] partitionByCols = new String[partitionBy.length]; for (int i = 0; i < partitionBy.length; i++) { partitionByCols[i] = colNames[partitionBy[i]]; } if (partitionBy.length > 0) { List<Column> repartitionCols = new ArrayList(); for (int i = 0; i < partitionBy.length; i++) { repartitionCols.add(new Column(colNames[partitionBy[i]])); } insertDF = insertDF.repartition(scala.collection.JavaConversions.asScalaBuffer(repartitionCols).toList()); } insertDF.write().option(SPARK_COMPRESSION_OPTION,compression) .partitionBy(partitionByCols) .mode(SaveMode.Append).orc(location); ValueRow valueRow=new ValueRow(1); valueRow.setColumn(1,new SQLLongint(context.getRecordsWritten())); return new SparkDataSet<>(SpliceSpark.getContext().parallelize(Collections.singletonList(valueRow), 1)); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public OptimalAssignment convertFrom(ClusterModel clusterModel) { _optimalAssignableNodes = new ArrayList<>(clusterModel.getAssignableNodes().values()); return this; }

Target:
public OptimalAssignment convertFrom(ClusterModel clusterModel) { return this; }
Source:
private boolean addMedia(Uri mediaUri) { if (mediaUri != null && !MediaUtils.isInMediaStore(mediaUri) && !mediaUri.toString().startsWith("/")) { mediaUri = MediaUtils.downloadExternalMedia(this, mediaUri); } if (mediaUri == null) { return false; } boolean isVideo = MediaUtils.isVideo(mediaUri.toString()); boolean isLocal = !URLUtil.isNetworkUrl(mediaUri.toString()); trackAddMediaEvents(isVideo, false); if (mShowNewEditor) { return addMediaVisualEditor(mediaUri); } else { return addMediaLegacyEditor(mediaUri, isVideo); } }

Target:
private boolean addMedia(Uri mediaUri) { if (mediaUri != null && !MediaUtils.isInMediaStore(mediaUri) && !mediaUri.toString().startsWith("/")) { mediaUri = MediaUtils.downloadExternalMedia(this, mediaUri); } if (mediaUri == null) { return false; } boolean isVideo = MediaUtils.isVideo(mediaUri.toString()); trackAddMediaEvents(isVideo, false); if (mShowNewEditor) { return addMediaVisualEditor(mediaUri); } else { return addMediaLegacyEditor(mediaUri, isVideo); } }