auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void removeAdditionalListeners() { super.removeAdditionalListeners(); ActivityPartition activityPartition = getUMLElement(); if (activityPartition == null) { return; } getDiagramEventBroker().removeNotificationListener(activityPartition, this); ConnectableElement el = (ConnectableElement) activityPartition.getRepresents(); if (el != null) { getDiagramEventBroker().removeNotificationListener(el, this); if (el.getType() != null) { getDiagramEventBroker().removeNotificationListener(el.getType(), this); } } }

Target:
protected void removeAdditionalListeners() { super.removeAdditionalListeners(); ActivityPartition activityPartition = getUMLElement(); if (activityPartition == null) { return; } getDiagramEventBroker().removeNotificationListener(activityPartition, this); Element el = activityPartition.getRepresents(); if (el != null) { getDiagramEventBroker().removeNotificationListener(el, this); } }
Source:
private Record updateRecordsWithHeader(Record record) throws IOException { List<Column> columnList = sasFileReader.getColumns(); Object[] rows = sasFileReader.readNext(); headers = new ArrayList<>(); for (Column col : sasFileReader.getColumns()) { headers.add(Field.create(col.getName())); } LinkedHashMap<String, Field> listMap = new LinkedHashMap<>(); for (int i = 0; i < columnList.size(); i++) { String key; Field header = (headers != null) ? headers.get(i) : null; if (header != null) { key = header.getValueAsString(); } else { key = Integer.toString(i); } listMap.put(key, Field.create(Field.Type.STRING, rows[i])); } record.set(Field.createListMap(listMap)); return record; }

Target:
private Record updateRecordsWithHeader(Record record) throws IOException { currentOffset = Integer.valueOf(sasFileReader.getOffset()); record = context.createRecord(id + "::" + currentOffset); Object rows[] = sasFileReader.readNext(); if (rows == null || rows.length == 0) { eof = true; return null; } headers = new ArrayList<Field>(); for (Column col : sasFileReader.getColumns()) { headers.add(Field.create(col.getName())); } LinkedHashMap<String, Field> listMap = new LinkedHashMap<String, Field>(); for (int i = 0; i < columnlist.size(); i++) { Field header = headers.get(i); String key = header.getValueAsString(); if (rows[i] == null) { listMap.put(key, Field.create(Field.Type.STRING, "")); } listMap.put(key, Field.create(Field.Type.STRING, rows[i])); } record.set(Field.createListMap(listMap)); return record; }
Source:
private void runAction(VdcActionType action, VdcActionParametersBase param) { if (getConfirmWindow() == null) { return; } ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); if (model.getProgress() != null) { return; } model.startProgress(null); Frontend.getInstance().runAction(action, param, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); localModel.stopProgress(); setConfirmWindow(null); } }); }

Target:
private void runAction(VdcActionType action, VdcActionParametersBase param) { if (getConfirmWindow() == null) { return; } ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); model.startProgress(null); Frontend.getInstance().runAction(action, param, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); localModel.stopProgress(); setConfirmWindow(null); } }); }
Source:
public List<Network> getAllByLabelForCluster(String label, Guid clusterId) { List<Network> networksInCluster = getAllForCluster(clusterId, null, false); List<Network> labeledNetworks = new ArrayList<>(); for (Network network : networksInCluster) { if (StringUtils.equals(network.getLabel(), label)) { labeledNetworks.add(network); } } return labeledNetworks; }

Target:
public List<Network> getAllByLabelForCluster(String label, Guid clusterId) { List<Network> networksInCluster = getAllForCluster(clusterId); List<Network> labeledNetworks = new ArrayList<>(); for (Network network : networksInCluster) { if (StringUtils.equals(network.getLabel(), label)) { labeledNetworks.add(network); } } return labeledNetworks; }
Source:
private String getCacheSubcommandDesc(CacheCommand cmd) { switch (cmd) { case LIST: return "Show information about caches, groups or sequences that match a regular expression. When executed without parameters, this subcommand prints the list of caches."; case CONTENTION: return "Show the keys that are point of contention for multiple transactions."; case IDLE_VERIFY: return "Verify counters and hash sums of primary and backup partitions for the specified caches/cache groups on an idle cluster and print out the differences, if any. " + "Cache filtering options configure the set of caches that will be processed by " + IDLE_VERIFY + " command. " + "Default value for the set of cache names (or cache group names) is all user cache groups. Default value for " + EXCLUDE_CACHES + " is empty set. " + "Therefore, the set of all caches is sequently filtered by cache name regexps, by cache type (if specified) and after that by exclude regexps."; case VALIDATE_INDEXES: return "Validate indexes on an idle cluster and print out the keys that are missing in the indexes."; case DISTRIBUTION: return "Prints the information about partition distribution."; case RESET_LOST_PARTITIONS: return "Reset the state of lost partitions for the specified caches."; default: throw new IllegalArgumentException("Unknown command: " + cmd); } }

Target:
private String getCacheSubcommandDesc(CacheCommand cmd) { switch (cmd) { case LIST: return "Show information about caches, groups or sequences that match a regular expression. When executed without parameters, this subcommand prints the list of caches."; case CONTENTION: return "Show the keys that are point of contention for multiple transactions."; case IDLE_VERIFY: return "Verify counters and hash sums of primary and backup partitions for the specified caches/cache " + "groups on an idle cluster and print out the differences, if any. When no parameters are specified, " + "all user caches are verified. Cache filtering options configure the set of caches that will be " + "processed by " + IDLE_VERIFY + " command. If cache names are specified, in form of regular " + "expressions, only matching caches will be verified. Caches matched by regexes specified after " + EXCLUDE_CACHES + " parameter will be excluded from verification. Using parameter " + CACHE_FILTER + " you can verify: only " + USER + " caches, only user " + PERSISTENT + " caches, only user " + NOT_PERSISTENT + " caches, only " + SYSTEM + " caches, or " + ALL + " of the above."; case VALIDATE_INDEXES: return "Validate indexes on an idle cluster and print out the keys that are missing in the indexes."; case DISTRIBUTION: return "Prints the information about partition distribution."; case RESET_LOST_PARTITIONS: return "Reset the state of lost partitions for the specified caches."; default: throw new IllegalArgumentException("Unknown command: " + cmd); } }
Source:
public void execute(DocumentReference documentReference, DocumentReference authorReference, String version) { MentionsData data = new MentionsData() .setDocumentReference(documentReference.toString()) .setAuthorReference(Objects.toString(authorReference, "")) .setVersion(version) .setWikiId(documentReference.getWikiReference().getName()); try { this.queue.put(data); } catch (InterruptedException e) { this.logger .warn("Error while adding the task to the mentions analysis queue. Cause [{}]", data, getRootCauseMessage(e)); } }

Target:
public void execute(DocumentReference documentReference, DocumentReference authorReference, String version) { MentionsData mentionsData = new MentionsData() .setDocumentReference(this.serializer.serialize(documentReference)); if (authorReference != null) { mentionsData = mentionsData .setAuthorReference(this.serializer.serialize(authorReference)); } MentionsData data = mentionsData .setVersion(version) .setWikiId(documentReference.getWikiReference().getName()); try { this.queue.put(data); } catch (InterruptedException e) { this.logger .warn("Error while adding the task to the mentions analysis queue. Cause [{}]", data, getRootCauseMessage(e)); } }
Source:
private String getDisplayNameFromContentResolver(Uri uri) { String displayName = null; String mimeType = getContentResolver().getType(uri); if (mimeType != null) { String displayNameColumn; if (mimeType.startsWith("image/")) { displayNameColumn = MediaStore.Images.ImageColumns.DISPLAY_NAME; } else if (mimeType.startsWith("video/")) { displayNameColumn = MediaStore.Video.VideoColumns.DISPLAY_NAME; } else if (mimeType.startsWith("audio/")) { displayNameColumn = MediaStore.Audio.AudioColumns.DISPLAY_NAME; } else { displayNameColumn = MediaStore.Files.FileColumns.DISPLAY_NAME; } Cursor cursor = null; try { cursor = getContentResolver().query( uri, new String[]{displayNameColumn}, null, null, null ); if (cursor != null) { cursor.moveToFirst(); displayName = cursor.getString(cursor.getColumnIndex(displayNameColumn)); } } catch (Exception e) { Log.e(TAG, "Could not retrieve display name for " + uri.toString(), e); } finally { if (cursor != null) { cursor.close(); } } } return displayName; }

Target:
private String getDisplayNameFromContentResolver(Uri uri) { String displayName = null; String mimeType = getContentResolver().getType(uri); if (mimeType != null) { String displayNameColumn; if (mimeType.startsWith("image/")) { displayNameColumn = MediaStore.Images.ImageColumns.DISPLAY_NAME; } else if (mimeType.startsWith("video/")) { displayNameColumn = MediaStore.Video.VideoColumns.DISPLAY_NAME; } else if (mimeType.startsWith("audio/")) { displayNameColumn = MediaStore.Audio.AudioColumns.DISPLAY_NAME; } else { displayNameColumn = MediaStore.Files.FileColumns.DISPLAY_NAME; } Cursor cursor = getContentResolver().query( uri, new String[]{displayNameColumn}, null, null, null ); if (cursor != null) { cursor.moveToFirst(); displayName = cursor.getString(cursor.getColumnIndex(displayNameColumn)); } if (cursor != null) { cursor.close(); } } return displayName; }
Source:
public boolean isInExclusiveGroup() { return grouping.equals(Grouping.EXCLUSIVE); }

Target:
public boolean isInExclusiveGroup() { return grouping == Grouping.EXCLUSIVE; }
Source:
public static Collection<ExportConfig> exportConfigs() { return Arrays.asList(new ExportConfig[] { new ExportConfig(TestType.FILE, "org.voltdb.exportclient.ExportToFileClient", new Pair<String, String>("type", "csv"), new Pair<String, String>("nonce", "basic1")), new ExportConfig(TestType.HTTP, "org.voltdb.exportclient.HttpExportClient", new Pair<String, String>("method", "post"), new Pair<String, String>("type", "form")), new ExportConfig(TestType.JDBC, "org.voltdb.exportclient.JDBCExportClient", new Pair<String, String>("jdbcdriver", HSQL_DRIVER), new Pair<String, String>("jdbcurl", JDBC_URL), new Pair<String, String>("jdbcuser", JDBC_USER)), }); }

Target:
public static Collection<ExportConfig> exportConfigs() { return Arrays.asList( new ExportConfig(TestType.FILE, "org.voltdb.exportclient.ExportToFileClient", new Pair<String, String>("type", "csv"), new Pair<String, String>("nonce", "basic1")), new ExportConfig(TestType.HTTP, "org.voltdb.exportclient.HttpExportClient", new Pair<String, String>("method", "post"), new Pair<String, String>("type", "form")), new ExportConfig(TestType.JDBC, "org.voltdb.exportclient.JDBCExportClient", new Pair<String, String>("jdbcdriver", HSQL_DRIVER), new Pair<String, String>("jdbcurl", JDBC_URL), new Pair<String, String>("jdbcuser", JDBC_USER)) ); }
Source:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_PLACEHOLDER_CREATION) { updateStage(LiveDiskMigrateStage.VM_REPLICATE_DISK_START); replicateDiskStart(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_START); syncImageData(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END); return true; } if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END) { updateStage(LiveDiskMigrateStage.VM_REPLICATE_DISK_FINISH); completeLiveMigration(); updateStage(LiveDiskMigrateStage.SOURCE_IMAGE_DELETION); LiveStorageMigrationHelper.removeImage(this, getParameters().getSourceStorageDomainId(), getParameters() .getImageGroupID(), getParameters().getDestinationImageId(), AuditLogType .USER_MOVE_IMAGE_GROUP_FAILED_TO_DELETE_SRC_IMAGE); return true; } return false; }

Target:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_PLACEHOLDER_CREATION) { updateStage(LiveDiskMigrateStage.VM_REPLICATE_DISK_START); replicateDiskStart(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_START); syncImageData(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END); return true; } if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END) { updateStage(LiveDiskMigrateStage.VM_REPLICATE_DISK_FINISH); completeLiveMigration(); updateStage(LiveDiskMigrateStage.SOURCE_IMAGE_DELETION); LiveStorageMigrationHelper.removeImage(this, getParameters().getSourceStorageDomainId(), getParameters() .getImageGroupID(), getParameters().getDestinationImageId(), AuditLogType .USER_MOVE_IMAGE_GROUP_FAILED_TO_DELETE_SRC_IMAGE); return false; } return false; }
Source:
int[] scores() { return highScores; }

Target:
int[] scores() { return highScores.clone(); }
Source:
private void configureImageView(ThemeViewHolder themeViewHolder, String screenshotURL) { String requestURL = (String) themeViewHolder.imageView.getTag(); if (requestURL == null) { requestURL = screenshotURL; themeViewHolder.imageView.setDefaultImageResId(R.drawable.theme_loading); themeViewHolder.imageView.setTag(requestURL); } if (!requestURL.equals(screenshotURL)) { requestURL = screenshotURL; } int mViewWidth = AppPrefs.getThemeImageSizeWidth(); themeViewHolder.imageView.setImageUrl(requestURL + THEME_IMAGE_PARAMETER + mViewWidth, WPNetworkImageView.ImageType.PHOTO); }

Target:
private void configureImageView(ThemeViewHolder themeViewHolder, String screenshotURL) { String requestURL = (String) themeViewHolder.imageView.getTag(); if (requestURL == null) { requestURL = screenshotURL; themeViewHolder.imageView.setDefaultImageResId(R.drawable.theme_loading); themeViewHolder.imageView.showDefaultImage(); themeViewHolder.imageView.setTag(requestURL); } if (!requestURL.equals(screenshotURL)) { requestURL = screenshotURL; } int mViewWidth = AppPrefs.getThemeImageSizeWidth(); themeViewHolder.imageView.setImageUrl(requestURL + THEME_IMAGE_PARAMETER + mViewWidth, WPNetworkImageView.ImageType.PHOTO); }
Source:
public void buildEnvironmentFor(Job job, EnvVars env, TaskListener listener) throws IOException, InterruptedException { for (Object property : job.getProperties().values()) { if (property instanceof EnvInjectJobProperty) { EnvInjectJobProperty jobProperty = (EnvInjectJobProperty) property; EnvInjectJobPropertyInfo jobPropertyInfo = jobProperty.getInfo(); Map<String, String> result = jobPropertyInfo.getPropertiesContentMap(new HashMap<String, String>()); if (result != null) { env.putAll(result); } } } }

Target:
public void buildEnvironmentFor(Job job, EnvVars env, TaskListener listener) throws IOException, InterruptedException { EnvInjectJobProperty jobProperty = (EnvInjectJobProperty) job.getProperty(EnvInjectJobProperty.class); if (jobProperty != null) { EnvInjectJobPropertyInfo jobPropertyInfo = jobProperty.getInfo(); Map<String, String> result = jobPropertyInfo.getPropertiesContentMap(env); if (result != null) { env.putAll(result); } } }
Source:
public void bindConsumer(MessageChannel inputChannel, String inputChannelName) { String channelBindingTarget = this.channelBindingServiceProperties.getBindingDestination(inputChannelName); String transport = this.channelBindingServiceProperties.getBinder(inputChannelName); Binder<MessageChannel> binder = binderFactory.getBinder(transport); if (BinderUtils.isChannelPubSub(channelBindingTarget)) { BindingProperties bindingProperties = this.channelBindingServiceProperties.getBindings() .get(inputChannelName); String group = bindingProperties == null ? null : bindingProperties.getGroup(); binder.bindPubSubConsumer(removePrefix(channelBindingTarget), inputChannel, consumerGroup(inputChannelName), this.channelBindingServiceProperties.getConsumerProperties(inputChannelName)); } else { binder.bindConsumer(channelBindingTarget, inputChannel, this.channelBindingServiceProperties.getConsumerProperties(inputChannelName)); } }

Target:
public void bindConsumer(MessageChannel inputChannel, String inputChannelName) { String channelBindingTarget = this.channelBindingServiceProperties.getBindingDestination(inputChannelName); Binder<MessageChannel> binder = getBinderForChannel(inputChannelName); if (BinderUtils.isChannelPubSub(channelBindingTarget)) { binder.bindPubSubConsumer(removePrefix(channelBindingTarget), inputChannel, consumerGroup(inputChannelName), this.channelBindingServiceProperties.getConsumerProperties(inputChannelName)); } else { binder.bindConsumer(channelBindingTarget, inputChannel, this.channelBindingServiceProperties.getConsumerProperties(inputChannelName)); } }
Source:
private void setTokenRefreshCredentials(LogicalPlan dag, Configuration conf) throws IOException { String principal; String keytab = null; String keytabPath = conf.get(StramClientUtils.KEY_TAB_FILE); if ((principal = StramUserLogin.getPrincipal()) == null) { principal = conf.get(StramUserLogin.DT_AUTH_PRINCIPAL); if (keytabPath == null) { keytab = conf.get(StramUserLogin.DT_AUTH_KEYTAB); } } else { if (keytabPath == null) { keytab = StramUserLogin.getKeytab(); } } if (keytab != null) { Path localKeyTabPath = new Path(keytab); try (FileSystem fs = StramClientUtils.newFileSystemInstance(conf)) { Path destPath = new Path(StramClientUtils.getDTDFSRootDir(fs, conf), localKeyTabPath.getName()); if (!fs.exists(destPath)) { fs.copyFromLocalFile(false, false, localKeyTabPath, destPath); } keytabPath = destPath.toString(); } } if ((principal != null) && (keytabPath != null)) { dag.setAttribute(LogicalPlan.PRINCIPAL, principal); dag.setAttribute(LogicalPlan.KEY_TAB_FILE, keytabPath); } else { LOG.warn("Credentials for refreshing tokens not available, application may not be able to run indefinitely"); } }

Target:
private void setTokenRefreshCredentials(LogicalPlan dag, Configuration conf) throws IOException { String principal = StramUserLogin.getPrincipal(); String keytabPath = conf.get(StramClientUtils.KEY_TAB_FILE); if (keytabPath == null) { String keytab = StramUserLogin.getKeytab(); if (keytab != null) { Path localKeyTabPath = new Path(keytab); try (FileSystem fs = StramClientUtils.newFileSystemInstance(conf)) { Path destPath = new Path(StramClientUtils.getDTDFSRootDir(fs, conf), localKeyTabPath.getName()); if (!fs.exists(destPath)) { fs.copyFromLocalFile(false, false, localKeyTabPath, destPath); } keytabPath = destPath.toString(); } } } if ((principal != null) && (keytabPath != null)) { dag.setAttribute(LogicalPlan.PRINCIPAL, principal); dag.setAttribute(LogicalPlan.KEY_TAB_FILE, keytabPath); } else { LOG.warn("Credentials for refreshing tokens not available, application may not be able to run indefinitely"); } }
Source:
public static String getDepartmentsMapping() throws IOException { InputStream mappingSourceStream = Indexer.class.getResourceAsStream("/search/departments/departments-mapping.json"); String mappingSource = IOUtils.toString(mappingSourceStream); elasticSearchLog("departmentsMapping").addParameter("mappingSource", mappingSource).log(); return mappingSource; }

Target:
public static String getDepartmentsMapping() throws IOException { try (InputStream mappingSourceStream = ZebedeeContentIndexer.class.getResourceAsStream("/search/departments/departments-mapping.json")) { String mappingSource = IOUtils.toString(mappingSourceStream); elasticSearchLog("departmentsMapping").addParameter("mappingSource", mappingSource).log(); return mappingSource; } }
Source:
private String buildShardingKey() { return _clusterName.charAt(0) == '/' ? _clusterName : SLASH + _clusterName; }

Target:
private String buildShardingKey() { return _clusterName.charAt(0) == '/' ? _clusterName : "/" + _clusterName; }
Source:
public void acknowledge() { if (this.ackClient != null || !this.ackClient.equals(MqttPahoMessageDrivenChannelAdapter.this.client)) { try { this.ackClient.messageArrivedComplete(this.id, this.qos); } catch (MqttException e) { throw new IllegalStateException(e); } } else { throw new IllegalStateException("Client has changed"); } }

Target:
public void acknowledge() { if (this.ackClient != null) { try { this.ackClient.messageArrivedComplete(this.id, this.qos); } catch (MqttException e) { throw new IllegalStateException(e); } } else { throw new IllegalStateException("Client has changed"); } }
Source:
public void visitMethodInvocation(MethodInvocationTree tree) { if (isFindMethod(tree) && (slingQueryWasNotUsed() || "$".equals(slingQueryName) || SLING_QUERY.equals(slingQueryName))) { slingQueries.replace(slingQueryName, slingQueryStates.FINDUSED); } else if (isSearchStrategyMethod(tree)) { slingQueries.replace(slingQueryName, slingQueryStates.STRATEGYUSED); } super.visitMethodInvocation(tree); }

Target:
public void visitMethodInvocation(MethodInvocationTree tree) { if (isFindMethod(tree) && (slingQueryWasNotUsed() || isThisANewSlingQuery())) { slingQueries.replace(currentSlingQueryVariableName, SlingQueryStates.FIND_USED_WITHOUT_STRATEGY); } else if (isSearchStrategyMethod(tree)) { slingQueries.replace(currentSlingQueryVariableName, SlingQueryStates.STRATEGY_USED); ignoreIssues = true; } if (DOLLAR_SIGN.equals(tree.methodSelect().firstToken().text()) && isDollarCase()) { context.reportIssue(this, tree, RULE_MESSAGE); } else if (isFindMethod(tree)) { findMethodUsed = true; } else if (isSearchStrategyMethod(tree)) { searchStrategyMethodUsed = true; } super.visitMethodInvocation(tree); }
Source:
public org.eclipse.core.resources.IProject getProject(IReferencePoint referencePoint) { return referencePointToProjectMapper.get(referencePoint); }

Target:
public IProject getProject(IReferencePoint referencePoint) { checkArgument(referencePoint, "Reference point is null"); return referencePointToProjectMapper.get(referencePoint); }
Source:
public SamplingDistribution(Operator child, int sampleSize, SamplingType sampleType, Long randomSeed) { this(child, sampleType, randomSeed); this.sampleSize = sampleSize; Preconditions.checkState(this.sampleSize >= 0, "Sample Size must be >= 0: %s", this.sampleSize); }

Target:
public SamplingDistribution(Operator child, int sampleSize, SamplingType sampleType, Long randomSeed) { this(child, sampleType, randomSeed); Preconditions.checkArgument(sampleSize >= 0, "Sample Size must be >= 0: %s", sampleSize); this.sampleSize = sampleSize; }
Source:
public Result filterUnitsThatCanMove( final Collection<Unit> units, final Map<Unit, Collection<Unit>> dependentUnits) { final Collection<Unit> transportsToLoad = getPossibleTransportsToLoad(units, dependentUnits, route); List<Unit> best = new ArrayList<>(units); if (route.getStart().isWater() && route.getEnd().isWater() && !route.isLoad()) { best = CollectionUtils.getMatches(best, Matches.unitIsLand().negate()); } if (route.isUnload()) { best = CollectionUtils.getMatches(best, Matches.unitIsNotSea()); } if (!units.isEmpty()) { best.sort(getUnitComparator(best).reversed()); } MoveValidationResultWithDependents lastResult = validateMoveWithDependents(best, dependentUnits, transportsToLoad); final MoveValidationResult allUnitsResult = lastResult.getResult(); if (!allUnitsResult.isMoveValid()) { if (!nonCombat && route.isUnload() && Matches.isTerritoryEnemy(player, data).test(route.getEnd())) { lastResult = validateMoveWithDependents(best, dependentUnits, transportsToLoad); } while (!best.isEmpty() && !lastResult.getResult().isMoveValid()) { best = best.subList(1, best.size()); lastResult = validateMoveWithDependents(best, dependentUnits, transportsToLoad); } } @Nullable String errorMessage = null; @Nullable String warningMessage = null; if (!allUnitsResult.isMoveValid()) { @Nullable String message = allUnitsResult.getError(); if (message == null) { message = allUnitsResult.getDisallowedUnitWarning(0); } if (message == null) { message = allUnitsResult.getUnresolvedUnitWarning(0); } if (!lastResult.getResult().isMoveValid()) { errorMessage = message; } else { warningMessage = message; } } return new Result(lastResult.getUnitsWithDependents(), errorMessage, warningMessage); }

Target:
public FilterOperationResult filterUnitsThatCanMove( final Collection<Unit> units, final Map<Unit, Collection<Unit>> dependentUnits) { final Collection<Unit> transportsToLoad = getPossibleTransportsToLoad(units, dependentUnits, route); List<Unit> best = getInitialUnitList(units); MoveValidationResultWithDependents lastResult = validateMoveWithDependents(best, dependentUnits, transportsToLoad); final MoveValidationResult allUnitsResult = lastResult.getResult(); if (!allUnitsResult.isMoveValid()) { if (!nonCombat && route.isUnload() && Matches.isTerritoryEnemy(player, data).test(route.getEnd())) { best = CollectionUtils.getMatches(best, Matches.unitCanInvade()); lastResult = validateMoveWithDependents(best, dependentUnits, transportsToLoad); } while (!best.isEmpty() && !lastResult.getResult().isMoveValid()) { best = best.subList(1, best.size()); lastResult = validateMoveWithDependents(best, dependentUnits, transportsToLoad); } } return new FilterOperationResult(allUnitsResult, lastResult); }
Source:
public static void copyFile(InputStream inputStream, OutputStream outputStream) throws IOException { if (inputStream == null || outputStream == null) { if (outputStream != null) { try { outputStream.close(); } catch (Exception e) { } } return; } try ( AutoCloseable closeable = () -> IOUtils.copy(inputStream, outputStream) ) { } catch (Exception e) { e.printStackTrace(); } }

Target:
public static void copyFile(InputStream inputStream, OutputStream outputStream) throws IOException { if (inputStream == null || outputStream == null) { if (outputStream != null) { IOUtils.closeQuietly(outputStream); } return; } try { IOUtils.copy(inputStream, outputStream); } finally { IOUtils.closeQuietly(outputStream); } }
Source:
public static String trl(@NonNull String locale, @NonNull String key, @NonNull Object ... args) { ResourceBundle rb; try { rb = ResourceBundle.getBundle(BASE_NAME, Locale.forLanguageTag(locale)); } catch (MissingResourceException ex) { throw new MissingResourceException("Missing locale '" + locale + "'. class=" + ex.getClassName(), ex.getClassName(), ex.getKey()); } String result; if (rb.containsKey(key)) { result = rb.getString(key); } else { ResourceBundle fallback = ResourceBundle.getBundle(BASE_NAME, Locale.forLanguageTag(FALLBACK_LOCALE)); if (fallback.containsKey(key)) { result = fallback.getString(key); } else { throw new MissingTranslationException("Could not find translation for key '" + key + "' in fallback locale", locale, key); } } for (int i = 0; i != args.length; i++) { result = result.replaceAll("\\{" + i + "\\}", args[i].toString()); } return result; }

Target:
public static String trl(@NonNull String locale, @NonNull String key, @NonNull Object ... args) { ResourceBundle rb = getResource(locale); String result; if (rb.containsKey(key)) { result = rb.getString(key); } else { ResourceBundle fallback = ResourceBundle.getBundle(BASE_NAME, Locale.forLanguageTag(FALLBACK_LOCALE)); if (fallback.containsKey(key)) { result = fallback.getString(key); } else { throw new MissingTranslationException("Could not find translation for key '" + key + "' in fallback locale", locale, key); } } result = result.replaceAll("\\\\&", "\0"); result = ChatColor.translateAlternateColorCodes('&', result); result = result.replaceAll("\0", "&"); for (int i = 0; i != args.length; i++) { result = result.replace("{" + i + "}", args[i].toString()); } return result; }
Source:
public Page<FactoryImpl> getByUser(String userId, int maxItems, long skipCount) { requireNonNull(userId); final Pair<String, String> factoryCreator = Pair.of("creator.userId", userId); long totalCount = countFactoriesByAttributes(singletonList(factoryCreator)); return new Page<>( getFactoriesByAttributes(maxItems, skipCount, singletonList(factoryCreator)), skipCount, maxItems, totalCount); }

Target:
public Page<FactoryImpl> getByUser(String userId, int maxItems, long skipCount) throws ServerException { requireNonNull(userId); final Pair<String, String> factoryCreator = Pair.of("creator.userId", userId); try { long totalCount = countFactoriesByAttributes(singletonList(factoryCreator)); return new Page<>( getFactoriesByAttributes(maxItems, skipCount, singletonList(factoryCreator)), skipCount, maxItems, totalCount); } catch (RuntimeException ex) { throw new ServerException(ex.getMessage(), ex); } }
Source:
public void shouldUseMergeFunctionToHandleKeysCollisions() { final Seq<Tuple2<String, Integer>> input = Vector.of(Tuple.of("a",2), Tuple.of("a",55), Tuple.of("a",3), Tuple.of("b",2)); Map<String, Seq<Integer>> m = input.toMap( Tuple2::_1, t -> Vector.of(t._2), Seq::appendAll); assertThat(m.containsKey("a")).isTrue(); assertThat(m.get("a").get().size()).isEqualTo(3); assertThat(m.containsKey("b")).isTrue(); assertThat(m.get("b").get().size()).isEqualTo(1); Map<String, Integer> m1 = input.toMap( Tuple2::_1, Tuple2::_2, Integer::sum); assertThat(m1.containsKey("a")).isTrue(); assertThat(m1.get("a").get()).isEqualTo(60); assertThat(m1.containsKey("b")).isTrue(); assertThat(m1.get("b").get()).isEqualTo(2); Map<String, Integer> m2 = input.toMap( Function.identity(), Integer::sum); assertThat(m2.containsKey("a")).isTrue(); assertThat(m2.get("a").get()).isEqualTo(60); assertThat(m2.containsKey("b")).isTrue(); assertThat(m2.get("b").get()).isEqualTo(2); }

Target:
public void shouldUseMergeFunctionToHandleKeysCollisions() { final Seq<Tuple2<String, Integer>> input = Vector.of(Tuple.of("a",2), Tuple.of("a",55), Tuple.of("a",3), Tuple.of("b",2)); Map<String, Seq<Integer>> m = input.toMap( Tuple2::_1, t -> Vector.of(t._2), Seq::appendAll); assertThat(m.containsKey("a")).isTrue(); assertThat(m.get("a").get().size()).isEqualTo(3); assertThat(m.containsKey("b")).isTrue(); assertThat(m.get("b").get().size()).isEqualTo(1); }
Source:
private static int determineMajorJavaVersion() { int version = (int) Double.parseDouble(System.getProperty("java.class.version")); switch (version) { case 46: return 2; case 47: return 3; case 48: return 4; case 49: return 5; case 50: return 6; case 51: return 7; case 52: return 8; case 53: return 9; case 54: return 10; case 55: return 11; default: return 6; } }

Target:
private static int determineMajorJavaVersion() { int version = (int) Double.parseDouble(System.getProperty("java.class.version")); switch (version) { case 50: return 6; case 51: return 7; case 52: return 8; case 53: return 9; case 54: return 10; case 55: return 11; default: return 6; } }
Source:
public FeedbackQuestionAttributes(FeedbackQuestion fq) { this.feedbackQuestionId = fq.getId(); this.feedbackSessionName = fq.getFeedbackSessionName(); this.courseId = fq.getCourseId(); this.creatorEmail = fq.getCreatorEmail(); this.questionMetaData = fq.getQuestionMetaData(); this.questionNumber = fq.getQuestionNumber(); this.questionType = fq.getQuestionType(); this.questionIsCompulsory = fq.isQuestionIsCompulsory(); this.giverType = fq.getGiverType(); this.recipientType = fq.getRecipientType(); this.numberOfEntitiesToGiveFeedbackTo = fq.getNumberOfEntitiesToGiveFeedbackTo(); this.showResponsesTo = new ArrayList<FeedbackParticipantType>(fq.getShowResponsesTo()); this.showGiverNameTo = new ArrayList<FeedbackParticipantType>(fq.getShowGiverNameTo()); this.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(fq.getShowRecipientNameTo()); this.createdAt = fq.getCreatedAt(); this.updatedAt = fq.getUpdatedAt(); removeIrrelevantVisibilityOptions(); }

Target:
public FeedbackQuestionAttributes(FeedbackQuestion fq) { this.feedbackQuestionId = fq.getId(); this.feedbackSessionName = fq.getFeedbackSessionName(); this.courseId = fq.getCourseId(); this.creatorEmail = fq.getCreatorEmail(); this.questionMetaData = fq.getQuestionMetaData(); this.questionNumber = fq.getQuestionNumber(); this.questionType = fq.getQuestionType(); this.isQuestionCompulsory = fq.isQuestionCompulsory(); this.giverType = fq.getGiverType(); this.recipientType = fq.getRecipientType(); this.numberOfEntitiesToGiveFeedbackTo = fq.getNumberOfEntitiesToGiveFeedbackTo(); this.showResponsesTo = new ArrayList<FeedbackParticipantType>(fq.getShowResponsesTo()); this.showGiverNameTo = new ArrayList<FeedbackParticipantType>(fq.getShowGiverNameTo()); this.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(fq.getShowRecipientNameTo()); this.createdAt = fq.getCreatedAt(); this.updatedAt = fq.getUpdatedAt(); removeIrrelevantVisibilityOptions(); }
Source:
public void removePaymentAccount(String id) { PaymentAccount paymentAccount = user.getPaymentAccount(id); if (paymentAccount == null) { throw new NotFoundException(format("Payment account %s not found", id)); } boolean isPaymentAccountUsed = openOfferManager.getObservableList().stream() .anyMatch(openOffer -> id.equals(openOffer.getOffer().getMakerPaymentAccountId())); if (isPaymentAccountUsed) { throw new PaymentAccountInUseException(format("Payment account %s is used for open offer", id)); } isPaymentAccountUsed = tradeManager.getTradableList().stream() .anyMatch(trade -> { Offer offer = trade.getOffer(); return null != offer && id.equals(offer.getMakerPaymentAccountId()) || id.equals(trade.getTakerPaymentAccountId()); }); if (isPaymentAccountUsed) { throw new PaymentAccountInUseException(format("Payment account %s is used for open trade", id)); } user.removePaymentAccount(paymentAccount); }

Target:
public boolean removePaymentAccount(String id) { PaymentAccount paymentAccount = user.getPaymentAccount(id); if (paymentAccount == null) { throw new NotFoundException(format("Payment account %s not found", id)); } return removePaymentAccount(paymentAccount); }
Source:
StreamProcessor createStreamProcessor(Config config, ApplicationDescriptorImpl<? extends ApplicationDescriptor> appDesc, StreamProcessor.StreamProcessorLifecycleListenerFactory listenerFactory, Optional<ExternalContext> externalContextOptional) { TaskFactory taskFactory = TaskFactoryUtil.getTaskFactory(appDesc); Map<String, MetricsReporter> reporters = new HashMap<>(); String processorId = createProcessorId(new ApplicationConfig(config)); appDesc.getMetricsReporterFactories().forEach((name, factory) -> reporters.put(name, factory.getMetricsReporter(name, processorId, config))); return new StreamProcessor(config, processorId, reporters, taskFactory, appDesc.getApplicationContainerContextFactory(), appDesc.getApplicationTaskContextFactory(), externalContextOptional, listenerFactory, null); }

Target:
StreamProcessor createStreamProcessor(Config config, ApplicationDescriptorImpl<? extends ApplicationDescriptor> appDesc, StreamProcessor.StreamProcessorLifecycleListenerFactory listenerFactory, Optional<ExternalContext> externalContextOptional) { TaskFactory taskFactory = TaskFactoryUtil.getTaskFactory(appDesc); Map<String, MetricsReporter> reporters = new HashMap<>(); String processorId = createProcessorId(new ApplicationConfig(config)); appDesc.getMetricsReporterFactories().forEach((name, factory) -> reporters.put(name, factory.getMetricsReporter(name, processorId, config))); return new StreamProcessor(processorId, config, reporters, taskFactory, appDesc.getApplicationContainerContextFactory(), appDesc.getApplicationTaskContextFactory(), externalContextOptional, listenerFactory, null); }
Source:
public boolean equals(Object obj) { if(this == obj) { return true; } if(obj.getClass() != this.getClass()) { return false; } ResolverConfiguration other = (ResolverConfiguration) obj; return this.resolveWorkspaceProjects == other.resolveWorkspaceProjects && Objects.equals(this.selectedProfiles, other.selectedProfiles) && Objects.equals(this.lifecycleMappingId, other.lifecycleMappingId) && Objects.equals(this.properties, other.properties); }

Target:
public boolean equals(Object obj) { if(this == obj) { return true; } if(obj == null) { return false; } if(obj.getClass() != this.getClass()) { return false; } ResolverConfiguration other = (ResolverConfiguration) obj; return this.resolveWorkspaceProjects == other.resolveWorkspaceProjects && Objects.equals(this.selectedProfiles, other.selectedProfiles) && Objects.equals(this.lifecycleMappingId, other.lifecycleMappingId) && Objects.equals(this.properties, other.properties); }
Source:
public SubQueryInfo getSubQueryInfo() { return subQueryInfoStack.peekLast(); }

Target:
public SubQueryInfo getSubQueryInfo() { return subQueryInfo; }
Source:
private void processConfKey(Writer writer, String param) throws ParseException, IOException, ServiceException, SQLException { String value = tajoConf.get(param); if (value != null) { writer.write(value); } else { writer.write("Configuration a is missing."); } writer.write("\n"); }

Target:
private void processConfKey(Writer writer, String param) throws ParseException, IOException, ServiceException, SQLException { String value = tajoClient.getConf().getTrimmed(param); if (value == null) { for(TajoConf.ConfVars vars : TajoConf.ConfVars.values()) { if (vars.varname.equalsIgnoreCase(param)) { value = tajoClient.getConf().getVar(vars); break; } } } if (value != null) { writer.write(value); } else { writer.write("Configuration " + param + " is missing."); } writer.write("\n"); }
Source:
public Iterable<DoubleSegment> getParts() { List<DoubleSegment> result = new ArrayList<>(); result.add(getTopEdge()); result.add(getLeftEdge()); result.add(getRightEdge()); result.add(getBottomEdge()); return result; }

Target:
public List<DoubleSegment> getParts() { return asList(getTopEdge(), getLeftEdge(), getRightEdge(), getBottomEdge()); }
Source:
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<CosmosUserProperties> expectedUsers = createdUsers; assertThat(expectedUsers).isNotEmpty(); int expectedPageSize = (expectedUsers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosUserProperties> validator = new FeedResponseListValidator.Builder<CosmosUserProperties>() .totalSize(expectedUsers.size()) .exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList())) .numberOfPages(expectedPageSize) .pageSatisfy(0, new FeedResponseValidator.Builder<CosmosUserProperties>() .requestChargeGreaterThanOrEqualTo(1.0).build()) .build(); validateQuerySuccess(queryObservable.byPage(maxItemCount), validator, 10000); }

Target:
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<CosmosUserProperties> expectedUsers = createdUsers; assertThat(expectedUsers).isNotEmpty(); int expectedPageSize = (expectedUsers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosUserProperties> validator = new FeedResponseListValidator.Builder<CosmosUserProperties>() .totalSize(expectedUsers.size()) .exactlyContainsIdsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList())) .numberOfPages(expectedPageSize) .pageSatisfy(0, new FeedResponseValidator.Builder<CosmosUserProperties>() .requestChargeGreaterThanOrEqualTo(1.0).build()) .build(); validateQuerySuccess(queryObservable.byPage(maxItemCount), validator, 10000); }
Source:
public void init() { caseService = new CallerMock<>(caseManagementService); when(caseManagementService.getCaseInstances(any(CaseInstanceSearchRequest.class))).thenReturn(caseInstanceSummaryList); presenter.setCaseService(caseService); when(view.getCaseInstanceSearchRequest()).thenReturn(new CaseInstanceSearchRequest()); doAnswer((i) ->{ presenter.refreshData(); return null; }).when(actions).onRefreshCaseClick(any(MouseEvent.class)); }

Target:
public void init() { caseService = new CallerMock<>(caseManagementService); when(caseManagementService.getCaseInstances(any(CaseInstanceSearchRequest.class))).thenReturn(caseInstanceSummaryList); presenter.setCaseService(caseService); when(view.getCaseInstanceSearchRequest()).thenReturn(new CaseInstanceSearchRequest()); }
Source:
public void start(BundleContext context) throws Exception { super.start(context); Hashtable<String, String> properties = new Hashtable<String, String>(2); properties.put(DebugOptions.LISTENER_SYMBOLICNAME, PLUGIN_ID); debugRegistration = context.registerService(DebugOptionsListener.class, Policy.DEBUG_OPTIONS_LISTENER, properties); ComparePlugin.getDefault().setCappingDisabled( getPreferenceStore().getBoolean( ComparePreferencePage.CAPPING_DISABLED)); }

Target:
public void start(BundleContext context) throws Exception { super.start(context); Hashtable<String, String> properties = new Hashtable<>(2); properties.put(DebugOptions.LISTENER_SYMBOLICNAME, PLUGIN_ID); debugRegistration = context.registerService(DebugOptionsListener.class, Policy.DEBUG_OPTIONS_LISTENER, properties); ComparePlugin.getDefault().setCappingDisabled( getPreferenceStore().getBoolean( ComparePreferencePage.CAPPING_DISABLED)); }
Source:
public HttpRequest filter(HttpRequest request) throws HttpException { String endpoint = request.getEndpoint().toString(); Pattern pattern = Pattern.compile("/[^/]*$"); Matcher matcher = pattern.matcher(endpoint); matcher.find(); String encodable = matcher.group(); String encoded = encodable.replace(".", "%2e"); String newEndpoint = matcher.replaceFirst(encoded); return request.toBuilder().endpoint(newEndpoint).build(); }

Target:
public HttpRequest filter(HttpRequest request) throws HttpException { String endpoint = request.getEndpoint().toString(); Matcher matcher = pattern.matcher(endpoint); if(!matcher.find()) return request; String encodable = matcher.group(); String encoded = encodable.replace(".", "%2e"); String newEndpoint = matcher.replaceFirst(encoded); return request.toBuilder().endpoint(newEndpoint).build(); }
Source:
public synchronized Collection<@Nullable V> values() { final Collection<V> values = new LinkedList<>(); for (final ExpiringCache<V> item : items.values()) { values.add(item.getValue()); } return values; }

Target:
public synchronized Collection<@Nullable V> values() { final Collection<@Nullable V> values = new LinkedList<>(); for (final ExpiringCache<@Nullable V> item : items.values()) { values.add(item.getValue()); } return values; }
Source:
public boolean containsArgument(final String requestName, final String argName) { if(typeMapper.containsKey(requestName) && typeMapper.get(requestName).containsKey(argName)) { return true; } return false; }

Target:
public boolean containsArgument(final String requestName, final String argName) { return typeMapper.containsKey(requestName) && typeMapper.get(requestName).containsKey(argName); }
Source:
public void testAbortAndRestartTwice() throws Exception { FreeStyleProject testproject = j.createFreeStyleProject(); AbsoluteTimeOutStrategy strategy = new AbsoluteTimeOutStrategy(Integer.toString(3)); AbortAndRestartOperation operation = new AbortAndRestartOperation(2); LinkedList<BuildTimeOutOperation> list = new LinkedList<BuildTimeOutOperation>(); list.add(operation); BuildTimeoutWrapper wrapper = new BuildTimeoutWrapper(strategy,list,""); testproject.getBuildWrappersList().add(wrapper); if(System.getProperty("os.name").contains("Windows")){ BatchFile builder = new BatchFile("ping -n 500 127.0.0.1 &amp;gt;nul"); testproject.getBuildersList().add(builder); }else{ Shell builder = new Shell("sleep 500"); testproject.getBuildersList().add(builder); } assertTrue(testproject.getBuilds().size()==0); testproject.scheduleBuild(new Cause.UserIdCause()); try{ Thread.sleep((3*60*1000)+20000); }catch(InterruptedException e){ } assertTrue(testproject.getFirstBuild() != null); assertTrue(testproject.getFirstBuild().equals(testproject.getLastBuild())); assertEquals(testproject.getBuilds().size(), 1); try{ Thread.sleep((3*60*1000)+20000); }catch(InterruptedException e){ } try{ Thread.sleep((3*60*1000)+20000); }catch(InterruptedException e){ } assertTrue(testproject.getFirstBuild() != null); assertFalse(testproject.getFirstBuild().equals(testproject.getLastBuild())); assertEquals(testproject.getBuilds().size(), 3); Thread.sleep(5000); assertEquals(testproject.getBuilds().size(), 3); assertEquals(Result.ABORTED, testproject.getBuildByNumber(1).getResult()); assertEquals(Result.ABORTED, testproject.getBuildByNumber(2).getResult()); assertEquals(Result.ABORTED, testproject.getBuildByNumber(3).getResult()); }

Target:
public void testAbortAndRestartTwice() throws Exception { FreeStyleProject testproject = j.createFreeStyleProject(); QuickBuildTimeOutStrategy strategy = new QuickBuildTimeOutStrategy(5000); AbortAndRestartOperation operation = new AbortAndRestartOperation("2"); LinkedList<BuildTimeOutOperation> list = new LinkedList<BuildTimeOutOperation>(); list.add(operation); BuildTimeoutWrapper wrapper = new BuildTimeoutWrapper(strategy,list,""); testproject.getBuildWrappersList().add(wrapper); testproject.getBuildersList().add(new SleepBuilder(5*60*1000)); assertTrue(testproject.getBuilds().size()==0); testproject.scheduleBuild(new Cause.UserIdCause()); j.waitUntilNoActivityUpTo(25000); assertNotNull(testproject.getFirstBuild()); assertFalse(testproject.getFirstBuild().equals(testproject.getLastBuild())); assertEquals(testproject.getBuilds().size(), 3); assertEquals(Result.ABORTED, testproject.getBuildByNumber(1).getResult()); assertEquals(Result.ABORTED, testproject.getBuildByNumber(2).getResult()); assertEquals(Result.ABORTED, testproject.getBuildByNumber(3).getResult()); }
Source:
static void scheduleCMClearer(Configuration conf) { if (MetastoreConf.getBoolVar(conf, ConfVars.REPLCMENABLED)) { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor( new BasicThreadFactory.Builder() .namingPattern(CM_THREAD_NAME_PREFIX + "%d") .daemon(true) .build()); for (Path cmroot : cmRootMapping.values()) { executor.scheduleAtFixedRate(new CMClearer(cmroot.toString(), MetastoreConf.getTimeVar(conf, ConfVars.REPLCMRETIAN, TimeUnit.SECONDS), conf), 0, MetastoreConf.getTimeVar(conf, ConfVars.REPLCMINTERVAL, TimeUnit.SECONDS), TimeUnit.SECONDS); } } }

Target:
static void scheduleCMClearer(Configuration conf) { if (MetastoreConf.getBoolVar(conf, ConfVars.REPLCMENABLED)) { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor( new BasicThreadFactory.Builder() .namingPattern(CM_THREAD_NAME_PREFIX + "%d") .daemon(true) .build()); executor.scheduleAtFixedRate(new CMClearer(encryptionZones, MetastoreConf.getTimeVar(conf, ConfVars.REPLCMRETIAN, TimeUnit.SECONDS), conf), 0, MetastoreConf.getTimeVar(conf, ConfVars.REPLCMINTERVAL, TimeUnit.SECONDS), TimeUnit.SECONDS); } }
Source:
public void tearDown() throws Exception { ofNullable(service).ifPresent(AppiumDriverLocalService::stop); if (stream != null) { stream.close(); } ofNullable(file).ifPresent(fileArg -> { if (file.exists()) { file.delete(); } }); System.clearProperty(APPIUM_PATH); ofNullable(pathToAppiumNodeInProperties).ifPresent(s -> System.setProperty(APPIUM_PATH, s)); }

Target:
public void tearDown() throws Exception { ofNullable(service).ifPresent(AppiumDriverLocalService::stop); if (stream != null) { stream.close(); } ofNullable(testLogFile).ifPresent(savedTestLogFile -> { if (savedTestLogFile.exists()) { savedTestLogFile.delete(); } }); System.clearProperty(APPIUM_PATH); ofNullable(PATH_TO_APPIUM_NODE_IN_PROPERTIES).ifPresent(s -> setProperty(APPIUM_PATH, s)); }