auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public NonAnnotatedVariantsMongoReader(MongoOperations template, String collectionsVariantsName, String studyId) { if (studyId == null) { throw new IllegalArgumentException("NonAnnotatedVariantsMongoReader needs a non-null studyId " + "(it can take a studyId or an empty string for reading every study)"); } delegateReader = new MongoDbCursorItemReader(); delegateReader.setTemplate(template); delegateReader.setCollection(collectionsVariantsName); BasicDBObjectBuilder queryBuilder = BasicDBObjectBuilder.start(); if (!studyId.isEmpty()) { queryBuilder.add(STUDY_KEY, studyId); } DBObject query = queryBuilder.add("annot.ct.so", new BasicDBObject("$exists", false)).get(); delegateReader.setQuery(query); String[] fields = {"chr", "start", "end", "ref", "alt"}; delegateReader.setFields(fields); converter = new DBObjectToVariantConverter(); }

Target:
public NonAnnotatedVariantsMongoReader(MongoOperations template, String collectionsVariantsName, String studyId) { delegateReader = new MongoDbCursorItemReader(); delegateReader.setTemplate(template); delegateReader.setCollection(collectionsVariantsName); BasicDBObjectBuilder queryBuilder = BasicDBObjectBuilder.start(); if (studyId != null && !studyId.isEmpty()) { queryBuilder.add(STUDY_KEY, studyId); } DBObject query = queryBuilder.add("annot.ct.so", new BasicDBObject("$exists", false)).get(); delegateReader.setQuery(query); String[] fields = {"chr", "start", "end", "ref", "alt"}; delegateReader.setFields(fields); converter = new DBObjectToVariantConverter(); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof FileAndName)) { return false; } FileAndName other = (FileAndName) obj; if (fConfiguration == null) { if (other.fConfiguration != null) { return false; } } else if (!fConfiguration.equals(other.fConfiguration)) { return false; } if (file == null) { if (other.file != null) { return false; } } else if (!file.equals(other.file)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof FileAndName)) { return false; } FileAndName other = (FileAndName) obj; if (fTraceTypeId == null) { if (other.fTraceTypeId != null) { return false; } } else if (!fTraceTypeId.equals(other.fTraceTypeId)) { return false; } if (fFile == null) { if (other.fFile != null) { return false; } } else if (!fFile.equals(other.fFile)) { return false; } return true; }
Source:
public boolean isType(TileEntity tile, EnumFacing dir) { if(tile instanceof IGridHost && tile.hasCapability(LPStorageMonitorableAccessor.STORAGE_MONITORABLE_ACCESSOR_CAPABILITY, dir)) { return true; } return false; }

Target:
public boolean isType(TileEntity tile, EnumFacing dir) { return tile instanceof IGridHost && tile.hasCapability(LPStorageMonitorableAccessor.STORAGE_MONITORABLE_ACCESSOR_CAPABILITY, dir); }
Source:
public void duplicatedUse() { Response response = keycloakUtil.createUser("developer"); assertThat(409,is(response.getStatus())); response.close(); }

Target:
public void duplicatedUse() { Response response = keycloakUtil.createUser("developer"); assertThat(409,is(response.getStatus())); response.close(); assertThat(7,is(keycloakUtil.getAllGroupsSize())); }
Source:
public String getQuestionResultStatisticsHtml(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } Map<String, Integer> answerFrequency = new LinkedHashMap<String, Integer>(); int numChoicesSelected = getNumberOfResponse(responses, answerFrequency); if (numChoicesSelected == -1) { return ""; } DecimalFormat df = new DecimalFormat("#.##"); StringBuilder fragments = new StringBuilder(); for (Entry<String, Integer> entry : answerFrequency.entrySet()) { fragments.append(Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS_OPTIONFRAGMENT, Slots.MCQ_CHOICE_VALUE, entry.getKey(), Slots.COUNT, entry.getValue().toString(), Slots.PERCENTAGE, df.format(100 * divideOrReturnZero((double) entry.getValue(), numChoicesSelected)))); } return Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS, Slots.FRAGMENTS, fragments.toString()); }

Target:
public String getQuestionResultStatisticsHtml(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } Map<String, Integer> answerFrequency = new LinkedHashMap<String, Integer>(); int numChoicesSelected = getNumberOfResponses(responses, answerFrequency); if (numChoicesSelected == -1) { return ""; } DecimalFormat df = new DecimalFormat("#.##"); StringBuilder fragments = new StringBuilder(); for (Entry<String, Integer> entry : answerFrequency.entrySet()) { fragments.append(Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS_OPTIONFRAGMENT, Slots.MCQ_CHOICE_VALUE, entry.getKey(), Slots.COUNT, entry.getValue().toString(), Slots.PERCENTAGE, df.format(100 * divideOrReturnZero(entry.getValue(), numChoicesSelected)))); } return Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS, Slots.FRAGMENTS, fragments.toString()); }
Source:
protected void onSuccess() { java.io.File tempFile = new java.io.File(tempFilePath); java.io.File finalFile = new java.io.File(finalFilePath); boolean renamedOk = tempFile.renameTo(finalFile); if (renamedOk) { fileTaskMap.remove(fileId); callback.onFileReceived(fileId, documentId, fileName); } else { onFailure(new FileDownloadException("Cannot rename downloaded file", fileId)); } }

Target:
protected void onSuccess() { fileTaskMap.remove(fileId); callback.onFileReceived(fileId, documentId, fileName); }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); @SuppressLint("InflateParams") View view = LayoutInflater.from(getActivity()).inflate(R.layout.color_picker_dialog, null); mProgress = view.findViewById(android.R.id.progress); mPalette = view.findViewById(R.id.color_picker); mPalette.init(mSize, mColumns, this); if (mColors != null) { showPaletteView(); } return new AlertDialog.Builder(activity) .setTitle(mTitleResId) .setView(view) .create(); }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); View view = View.inflate(activity, R.layout.color_picker_dialog, null); mProgress = view.findViewById(android.R.id.progress); mPalette = view.findViewById(R.id.color_picker); mPalette.init(mSize, mColumns, this); if (mColors != null) { showPaletteView(); } return new AlertDialog.Builder(activity) .setTitle(mTitleResId) .setView(view) .create(); }
Source:
public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; if (classTree.symbol().isAbstract()) { for (Tree member : classTree.members()) { if (member.is(Tree.Kind.METHOD)) { checkMethod((MethodTree) member); } } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } Symbol.MethodSymbol method = ((MethodTree) tree).symbol(); if (method.isAbstract() && method.owner().isAbstract()) { checkMethod((JavaSymbol.MethodJavaSymbol) method); } }
Source:
void switchMediaUnit() throws NoSuchMetadataFieldException { try { metadataPanel.preservePhysical(); } catch (InvalidMetadataValueException e) { logger.info(e.getLocalizedMessage()); } metadataPanel.showPhysical(structurePanel.getSelectedMediaUnit()); if (structurePanel.getSelectedMediaUnit().isPresent()) { galleryPanel.updateSelection(structurePanel.getSelectedMediaUnit().get()); for (GalleryMediaContent galleryMediaContent : galleryPanel.getMedias()) { if (structurePanel.getSelectedMediaUnit().get().getMediaFiles().values().contains(galleryMediaContent.getPreviewUri())) { structurePanel.updateLogicalNodeSelection(galleryMediaContent); break; } } } }

Target:
void switchMediaUnit() throws NoSuchMetadataFieldException { try { metadataPanel.preservePhysical(); } catch (InvalidMetadataValueException e) { logger.info(e.getLocalizedMessage(), e); } Optional<MediaUnit> selectedMediaUnit = structurePanel.getSelectedMediaUnit(); metadataPanel.showPhysical(selectedMediaUnit); if (selectedMediaUnit.isPresent()) { galleryPanel.updateSelection(selectedMediaUnit.get()); for (GalleryMediaContent galleryMediaContent : galleryPanel.getMedias()) { if (selectedMediaUnit.get().getMediaFiles().values().contains(galleryMediaContent.getPreviewUri())) { structurePanel.updateLogicalNodeSelection(galleryMediaContent); break; } } } }
Source:
private void switchToTabInConfig(String label) { By selector = ByJQuery.selector("div.gwt-Label:contains(" + label + ")"); Graphene.waitModel(browser).until().element(selector).is().visible(); browser.findElement(selector).click(); }

Target:
private void switchToTabInConfig(String label) { getConfig().switchTo(label); }
Source:
public void migrate(Context context) throws Exception { runner.execute(context.getConnection(), Arrays.asList( SqlCommand.from(ALTER_STREAM_DEFINITION_TABLE_DESC), SqlCommand.from(ALTER_STREAM_DEFINITION_TABLE_ORIG_DEF), SqlCommand.from(ALTER_TASK_DEFINITION_TABLE))); }

Target:
public void migrate(Context context) throws Exception { runner.execute(context.getConnection(), Arrays.asList( SqlCommand.from(ALTER_STREAM_DEFINITION_TABLE_DESC), SqlCommand.from(ALTER_STREAM_DEFINITION_TABLE_ORIG_DEF), SqlCommand.from(ALTER_TASK_DEFINITION_TABLE), SqlCommand.from(UPDATE_STREAM_DEFINITION_TABLE_ORIG_DEF))); ; }
Source:
public void scanFile(JavaFileScannerContext context) { sonarFile = fs.inputFile(fs.predicates().is(context.getFile())); CommentLinesVisitor commentLinesVisitor = createCommentLineVisitorAndFindNoSonar(context); if(isSonarLintContext()) { return; } classTrees.clear(); methods = 0; complexityInMethods = 0; classes = 0; methodComplexityDistribution = new RangeDistributionBuilder(LIMITS_COMPLEXITY_METHODS); super.scanFile(context); int fileComplexity = context.getComplexityNodes(context.getTree()).size(); saveMetricOnFile(CoreMetrics.CLASSES, classes); saveMetricOnFile(CoreMetrics.FUNCTIONS, methods); saveMetricOnFile(CoreMetrics.COMPLEXITY_IN_FUNCTIONS, complexityInMethods); saveMetricOnFile(CoreMetrics.COMPLEXITY_IN_CLASSES, fileComplexity); saveMetricOnFile(CoreMetrics.COMPLEXITY, fileComplexity); saveMetricOnFile(CoreMetrics.COMMENT_LINES, commentLinesVisitor.commentLinesMetric()); saveMetricOnFile(CoreMetrics.STATEMENTS, new StatementVisitor().numberOfStatements(context.getTree())); saveMetricOnFile(CoreMetrics.NCLOC, new LinesOfCodeVisitor().linesOfCode(context.getTree())); saveMetricOnFile(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION, methodComplexityDistribution.build()); RangeDistributionBuilder fileComplexityDistribution = new RangeDistributionBuilder(LIMITS_COMPLEXITY_FILES); saveMetricOnFile(CoreMetrics.FILE_COMPLEXITY_DISTRIBUTION, fileComplexityDistribution.add(fileComplexity).build()); if (isSonarQubeGreaterThanOrEqualTo63()) { saveMetricOnFile(CoreMetrics.COGNITIVE_COMPLEXITY, context.compilationUnitCognitiveComplexity()); } }

Target:
public void scanFile(JavaFileScannerContext context) { sonarFile = fs.inputFile(fs.predicates().is(context.getFile())); CommentLinesVisitor commentLinesVisitor = createCommentLineVisitorAndFindNoSonar(context); if(isSonarLintContext()) { return; } classTrees.clear(); methods = 0; complexityInMethods = 0; classes = 0; methodComplexityDistribution = new RangeDistributionBuilder(LIMITS_COMPLEXITY_METHODS); super.scanFile(context); int fileComplexity = context.getComplexityNodes(context.getTree()).size(); saveMetricOnFile(CoreMetrics.CLASSES, classes); saveMetricOnFile(CoreMetrics.FUNCTIONS, methods); saveMetricOnFile(CoreMetrics.COMPLEXITY_IN_FUNCTIONS, complexityInMethods); saveMetricOnFile(CoreMetrics.COMPLEXITY_IN_CLASSES, fileComplexity); saveMetricOnFile(CoreMetrics.COMPLEXITY, fileComplexity); saveMetricOnFile(CoreMetrics.COMMENT_LINES, commentLinesVisitor.commentLinesMetric()); saveMetricOnFile(CoreMetrics.STATEMENTS, new StatementVisitor().numberOfStatements(context.getTree())); saveMetricOnFile(CoreMetrics.NCLOC, new LinesOfCodeVisitor().linesOfCode(context.getTree())); saveMetricOnFile(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION, methodComplexityDistribution.build()); RangeDistributionBuilder fileComplexityDistribution = new RangeDistributionBuilder(LIMITS_COMPLEXITY_FILES); saveMetricOnFile(CoreMetrics.FILE_COMPLEXITY_DISTRIBUTION, fileComplexityDistribution.add(fileComplexity).build()); if (isSonarQubeGreaterThanOrEqualTo63()) { saveMetricOnFile(CoreMetrics.COGNITIVE_COMPLEXITY, CognitiveComplexityVisitor.compilationUnitComplexity(context.getTree())); } }
Source:
public String getDescription() { return "Returns the type of o as a string ('string', 'date', 'number', 'array', 'boolean', 'error' or a class name)"; }

Target:
public String getDescription() { return "Returns the type of o as a string ('string', 'date', 'number', 'array', 'boolean' or a class name)"; }
Source:
private void startCounterCache() { if (counterCacheStarted.compareAndSet(false, true)) { SecurityActions.getGlobalComponentRegistry(cacheManager) .getComponent(Executor.class, KnownComponentNames.ASYNC_OPERATIONS_EXECUTOR) .execute(() -> { String oldName = Thread.currentThread().getName(); try { SecurityActions.setThreadName(threadName()); cacheManager.getCache(CounterModuleLifecycle.COUNTER_CACHE_NAME); } finally { SecurityActions.setThreadName(oldName); } }); } }

Target:
private void startCounterCache() { if (counterCacheStarted.compareAndSet(false, true)) { SecurityActions.getGlobalComponentRegistry(cacheManager) .getComponent(Executor.class, KnownComponentNames.ASYNC_OPERATIONS_EXECUTOR) .execute(() -> { String oldName = Thread.currentThread().getName(); try { GlobalConfiguration configuration = SecurityActions.getCacheManagerConfiguration(cacheManager); String threadName = "CounterCacheStartThread," + configuration.transport().nodeName(); SecurityActions.setThreadName(threadName); cacheManager.getCache(CounterModuleLifecycle.COUNTER_CACHE_NAME); } finally { SecurityActions.setThreadName(oldName); } }); } }
Source:
private boolean stopSamzaContainer() { boolean hasContainerShutdown = true; if (container != null) { try { container.shutdown(); LOGGER.info("Waiting ms for the container: to shutdown.", taskShutdownMs, container); hasContainerShutdown = containerShutdownLatch.await(taskShutdownMs, TimeUnit.MILLISECONDS); } catch (Exception e) { LOGGER.error("Exception occurred when shutting down the container: {}.", container, e); hasContainerShutdown = false; } LOGGER.info(String.format("Shutdown status of container: %s for stream processor: %s is: %b.", container, processorId, hasContainerShutdown)); } if (!hasContainerShutdown && containerException == null) { containerException = new TimeoutException("Container shutdown timed out."); } return hasContainerShutdown; }

Target:
private boolean stopSamzaContainer() { boolean hasContainerShutdown = true; if (container != null) { try { container.shutdown(); LOGGER.info("Waiting ms for the container: to shutdown.", taskShutdownMs, container); hasContainerShutdown = containerShutdownLatch.await(taskShutdownMs, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOGGER.error("Exception occurred when shutting down the container: {}.", container, e); hasContainerShutdown = false; if (containerException != null) { containerException = e; } } LOGGER.info(String.format("Shutdown status of container: %s for stream processor: %s is: %b.", container, processorId, hasContainerShutdown)); } if (!hasContainerShutdown && containerException == null) { containerException = new TimeoutException("Container shutdown timed out after " + taskShutdownMs + " ms."); } return hasContainerShutdown; }
Source:
public boolean isTrashed(CoreSession session, DocumentRef docRef) { Boolean isTrashed = session.getDocumentSystemProp(docRef, SYSPROP_IS_TRASHED, Boolean.class); return isTrashed != null && isTrashed.booleanValue(); }

Target:
public boolean isTrashed(CoreSession session, DocumentRef docRef) { Boolean isTrashed = session.getDocumentSystemProp(docRef, SYSPROP_IS_TRASHED, Boolean.class); return Boolean.TRUE.equals(isTrashed); }
Source:
private List<OutputFieldInfo> generateOutputFieldInfoForRecord(Schema.Field field, int levelToLimitFlattening) { List<OutputFieldInfo> outputFieldInfos = new ArrayList<>(); Schema schema = field.getSchema(); List<Schema.Field> fields; if (schema.isNullable()) { fields = schema.getNonNullable().getFields(); } else { fields = schema.getFields(); } if (fields == null || fields.size() == 0) { return outputFieldInfos; } for (Schema.Field subField : fields) { outputFieldInfos.addAll(flattenField(subField, levelToLimitFlattening - 1)); } List<OutputFieldInfo> result = new ArrayList<>(); for (OutputFieldInfo outputFieldInfo : outputFieldInfos) { result.add(OutputFieldInfo.fromChild(outputFieldInfo, field)); } return result; }

Target:
private List<OutputFieldInfo> generateOutputFieldInfoForRecord(Schema.Field field, int levelToLimitFlattening) { List<OutputFieldInfo> outputFieldInfos = new ArrayList<>(); Schema schema = field.getSchema(); List<Schema.Field> fields; fields = schema.isNullable() ? schema.getNonNullable().getFields() : schema.getFields(); if (fields == null || fields.size() == 0) { return outputFieldInfos; } for (Schema.Field subField : fields) { outputFieldInfos.addAll(flattenField(subField, levelToLimitFlattening - 1)); } List<OutputFieldInfo> result = new ArrayList<>(); for (OutputFieldInfo outputFieldInfo : outputFieldInfos) { result.add(OutputFieldInfo.fromChild(outputFieldInfo, field)); } return result; }
Source:
List<Field> transform(final List<MeasurementVariable> measurementVariables) { final List<Field> fields = new LinkedList<>(); for (final MeasurementVariable measurementVariable : measurementVariables) { final Field field = new Field(measurementVariable); if (field.getId() == TermId.OBS_UNIT_ID.getId()) { field.setName(PLOT.concat(" ").concat(field.getName())); } if (field.getId() == TermId.SEASON_VAR.getId()) { field.setName(this.getMessage("label.printing.field.season")); } fields.add(field); } return fields; }

Target:
List<Field> transform(final List<MeasurementVariable> measurementVariables) { final List<Field> fields = new LinkedList<>(); for (final MeasurementVariable measurementVariable : measurementVariables) { final Field field = new Field(measurementVariable); if (field.getId().equals(TermId.OBS_UNIT_ID.getId())) { field.setName(PLOT.concat(StringUtils.SPACE).concat(field.getName())); } if (field.getId().equals(TermId.SEASON_VAR.getId())) { field.setName(this.getMessage("label.printing.field.season")); } fields.add(field); } return fields; }
Source:
public RedisClientFactory(String url, List<String> replicaUrls) throws URISyntaxException { JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setTestOnBorrow(true); URI redisURI = new URI(url); this.host = redisURI.getHost(); this.port = redisURI.getPort(); this.password = JedisURIHelper.getPassword(redisURI); JedisPool masterPool = new JedisPool(poolConfig, host, port, Protocol.DEFAULT_TIMEOUT, null); List<JedisPool> replicaPools = new LinkedList<>(); for (String replicaUrl : replicaUrls) { URI replicaURI = new URI(replicaUrl); replicaPools.add(new JedisPool(poolConfig, replicaURI.getHost(), replicaURI.getPort(), 500, Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE, null, false, null , null, null)); } this.jedisPool = new ReplicatedJedisPool(masterPool, replicaPools); }

Target:
public RedisClientFactory(String url, List<String> replicaUrls) throws URISyntaxException { JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setTestOnBorrow(true); URI redisURI = new URI(url); this.host = redisURI.getHost(); this.port = redisURI.getPort(); this.password = JedisURIHelper.getPassword(redisURI); JedisPool masterPool = new JedisPool(poolConfig, redisURI, Protocol.DEFAULT_TIMEOUT); List<JedisPool> replicaPools = new LinkedList<>(); for (String replicaUrl : replicaUrls) { replicaPools.add(new JedisPool(poolConfig, new URI(replicaUrl), 500, Protocol.DEFAULT_TIMEOUT)); } this.jedisPool = new ReplicatedJedisPool(masterPool, replicaPools); }
Source:
public MemoryMappedFileWordList(final RandomAccessFile raf, final boolean caseSensitive, final int cachePercent) throws IOException { super(raf, caseSensitive, cachePercent); final FileChannel channel = file.getChannel(); buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()); final int fileBytes = buffer.capacity(); final int cacheSize = (fileBytes / HUNDRED_PERCENT) * cachePercent; final int cacheOffset = cacheSize == 0 ? fileBytes : cacheSize > fileBytes ? 1 : fileBytes / cacheSize; long pos = 0; String a; String b = null; while (buffer.hasRemaining()) { a = readLine(buffer); if (b != null && comparator.compare(a, b) < 0) { throw new IllegalArgumentException("File is not sorted correctly for this comparator"); } b = a; if (cacheSize > 0 && size % cacheOffset == 0) { cache.put(size, pos); } pos = buffer.position(); size++; } }

Target:
public MemoryMappedFileWordList(final RandomAccessFile raf, final boolean caseSensitive, final int cachePercent) throws IOException { super(raf, caseSensitive, cachePercent); final FileChannel channel = file.getChannel(); buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()); initialize(cachePercent); }
Source:
public void clear() { for (DimensionProperty p : properties) { if(p!=null) p.clear(); } properties.clear(); }

Target:
public void clear() { for (DimensionProperty p : properties) { if (p != null) { p.clear(); } } properties.clear(); }
Source:
public OpenShiftInternalRuntime getRuntime() throws InfrastructureException { Optional<KubernetesRuntimeState> runtimeStateOpt = runtimeStatuses.get(getIdentity()); String workspaceId = getIdentity().getWorkspaceId(); if (!runtimeStateOpt.isPresent()) { return runtimeFactory.create( this, projectFactory.create(workspaceId), getEnvironment().getWarnings()); } KubernetesRuntimeState runtimeState = runtimeStateOpt.get(); LOG.debug("Restoring runtime in workspace '{}'", runtimeState.getRuntimeId(), workspaceId); OpenShiftInternalRuntime runtime = runtimeFactory.create( this, projectFactory.create(workspaceId, runtimeState.getNamespace()), getEnvironment().getWarnings()); runtime.scheduleRuntimeStateChecks(); return runtime; }

Target:
public OpenShiftInternalRuntime getRuntime() throws InfrastructureException { Optional<KubernetesRuntimeState> runtimeStateOpt = runtimeStatuses.get(getIdentity()); String workspaceId = getIdentity().getWorkspaceId(); if (!runtimeStateOpt.isPresent()) { return runtimeFactory.create( this, projectFactory.create(workspaceId), getEnvironment().getWarnings()); } KubernetesRuntimeState runtimeState = runtimeStateOpt.get(); RuntimeIdentity runtimeId = runtimeState.getRuntimeId(); LOG.debug( "Restoring runtime `{}:{}:{}`", runtimeId.getWorkspaceId(), runtimeId.getEnvName(), runtimeId.getOwnerId()); OpenShiftInternalRuntime runtime = runtimeFactory.create( this, projectFactory.create(workspaceId, runtimeState.getNamespace()), getEnvironment().getWarnings()); runtime.scheduleRuntimeStateChecks(); return runtime; }
Source:
private boolean allowsSNS( NodeCache cache ) { RepositoryEnvironment repositoryEnvironment = workspace(cache).repositoryEnvironment(); if ( repositoryEnvironment == null) { return true; } NodeTypes nodeTypes = repositoryEnvironment.nodeTypes(); if (nodeTypes == null) { return true; } Name primaryType = getPrimaryType(cache); if (nodeTypes.isUnorderedCollection(primaryType)) { return false; } Set<Name> mixinTypes = getMixinTypes(cache); return nodeTypes.allowsNameSiblings(primaryType, mixinTypes); }

Target:
private boolean allowsSNS( NodeCache cache ) { Name primaryType = getPrimaryType(cache); Set<Name> mixinTypes = getMixinTypes(cache); RepositoryEnvironment repositoryEnvironment = workspace(cache).repositoryEnvironment(); if ( repositoryEnvironment == null) { return true; } NodeTypes nodeTypes = repositoryEnvironment.nodeTypes(); return nodeTypes == null || nodeTypes.allowsNameSiblings(primaryType, mixinTypes); }
Source:
public int compareTo(Object obj) { return 0; }

Target:
public int compareTo(Object obj) { if (obj instanceof ICommand) return this.compareTo((ICommand)obj); else return 0; }
Source:
public List<AgentInfo> getAllActive() { return getAllLocal() .stream() .filter(agentInfo -> !agentInfo.getState().equals(UNKNOWN)) .filter(agentInfo -> !agentInfo.getState().equals(WRONG_REGION)) .filter(this::activeRegionOnly) .collect(toList()); }

Target:
public List<AgentInfo> getAllActive() { return getAllAttached() .stream() .filter(agentInfo -> !agentInfo.getState().equals(UNKNOWN)) .filter(this::activeRegionOnly) .collect(toList()); }
Source:
private void onOpenPack() throws IOException { final PackIndex idx = idx(); final byte[] buf = new byte[20]; fd.seek(0); fd.readFully(buf, 0, 12); if (RawParseUtils.match(buf, 0, Constants.PACK_SIGNATURE) != 4) { throw new NoPackSignatureException(JGitText.get().notAPACKFile); } final long vers = NB.decodeUInt32(buf, 4); final long packCnt = NB.decodeUInt32(buf, 8); if (vers != 2 && vers != 3) { throw new UnsupportedPackVersionException(MessageFormat.format( JGitText.get().unsupportedPackVersion, Long.valueOf(vers))); } if (packCnt != idx.getObjectCount()) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch, Long.valueOf(packCnt), Long.valueOf(idx.getObjectCount()), getPackFile())); } fd.seek(length - 20); fd.readFully(buf, 0, 20); if (!Arrays.equals(buf, packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch , ObjectId.fromRaw(buf).name() , ObjectId.fromRaw(idx.packChecksum).name() , getPackFile())); } }

Target:
private void onOpenPack() throws IOException { final PackIndex idx = idx(); final byte[] buf = new byte[20]; fd.seek(0); fd.readFully(buf, 0, 12); if (RawParseUtils.match(buf, 0, Constants.PACK_SIGNATURE) != 4) { throw new NoPackSignatureException(JGitText.get().notAPACKFile); } final long vers = NB.decodeUInt32(buf, 4); final long packCnt = NB.decodeUInt32(buf, 8); if (vers != 2 && vers != 3) { throw new UnsupportedPackVersionException(vers); } if (packCnt != idx.getObjectCount()) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch, Long.valueOf(packCnt), Long.valueOf(idx.getObjectCount()), getPackFile())); } fd.seek(length - 20); fd.readFully(buf, 0, 20); if (!Arrays.equals(buf, packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch , ObjectId.fromRaw(buf).name() , ObjectId.fromRaw(idx.packChecksum).name() , getPackFile())); } }
Source:
public void process(CopierData data) { for (DataCopyrule rule : rules) { try { rule.apply(data); } catch (RuntimeException nA) { if (LOG.isInfoEnabled()) { LOG.info("Metadata copy rule »" + rule + "« not applicable for process »" + data.getProcessTitle() + "«. Rule skipped."); } } } }

Target:
public void process(CopierData data) { for (DataCopyrule rule : rules) { try { rule.apply(data); } catch (RuntimeException notApplicable) { if (LOG.isInfoEnabled()) { LOG.info("Rule not applicable for \"" + data.getProcessTitle() + "\", skipped: " + rule); } } } }
Source:
protected void iterationConditionResult(boolean result, PendingFeatureIf annotation, IMethodInvocation invocation) throws Throwable { if (result) { new PendingFeatureInterceptor(annotation.exceptions(), annotation.reason(), PENDING_FEATURE_IF, false) .intercept(invocation); } }

Target:
protected void iterationConditionResult(boolean result, PendingFeatureIf annotation, IMethodInvocation invocation) throws Throwable { if (result) { new PendingFeatureInterceptor(annotation.exceptions(), annotation.reason(), PENDING_FEATURE_IF).intercept(invocation); } }
Source:
public String getEncodedParam(String fileName, String functionName, String type) { String combinedParam = lenientFormat("%s %s %s", fileName, functionName, type); BigInteger uniqueIdentifier = getUniqueIdentifier(combinedParam); BigInteger maxInteger = new BigInteger(Integer.toString(Integer.MAX_VALUE)); if (uniqueIdentifier.compareTo(maxInteger) > 0) { throw new ArithmeticException( "Unique Identifier exceeds value of Integer.MAX_VALUE, could not encode with Base 64 VLQ"); } StringBuilder sb = new StringBuilder(); try { Base64VLQ.encode(sb, uniqueIdentifier.intValue()); } catch (IOException e) { throw new AssertionError("Encountered unexpected IOException error"); } String result = sb.toString(); addParamMapping(result, combinedParam); return result; }

Target:
public String getEncodedParam(String fileName, String functionName, String type) { String combinedParam = lenientFormat("%s %s %s", fileName, functionName, type); long uniqueIdentifier = getUniqueIdentifier(combinedParam); if (uniqueIdentifier > Integer.MAX_VALUE) { throw new ArithmeticException( "Unique Identifier exceeds value of Integer.MAX_VALUE, could not encode with Base 64 VLQ"); } StringBuilder sb = new StringBuilder(); try { Base64VLQ.encode(sb, Math.toIntExact(uniqueIdentifier)); } catch (IOException e) { throw new AssertionError("Encountered unexpected IOException error"); } String result = sb.toString(); addParamMapping(result, combinedParam); return result; }
Source:
public ListItem(String value) { super(); this.value = value; }

Target:
public ListItem(String value) { this.value = value; }
Source:
private void ls(AlluxioURI path, boolean recursive, boolean forceLoadMetadata, boolean dirAsFile, boolean hSize, boolean pinnedOnly, String sortField, boolean reverse, String timestampOption) throws AlluxioException, IOException { Function<URIStatus, Long> timestampFuncion = TIMESTAMP_FIELDS.get(timestampOption); URIStatus pathStatus = mFileSystem.getStatus(path); if (dirAsFile) { if (pinnedOnly && !pathStatus.isPinned()) { return; } printLsString(pathStatus, hSize, timestampFuncion); return; } ListStatusPOptions.Builder optionsBuilder = ListStatusPOptions.newBuilder(); if (forceLoadMetadata) { optionsBuilder.setLoadMetadataType(LoadMetadataPType.ALWAYS); } optionsBuilder.setRecursive(recursive); Timer timer = new Timer(); if (pathStatus.isFolder()) { timer.schedule(new TimerTask() { @Override public void run() { System.out.printf("Getting directory status of %s files or sub-directories " + "may take a while.%n", pathStatus.getLength()); } }, 10000); } Stream<URIStatus> statusStream = mFileSystem.listStatusInStream(path, optionsBuilder.build()); timer.cancel(); if (sortField == null) { statusStream.forEach( status -> { if (!pinnedOnly || status.isPinned()) { printLsString(status, hSize, timestampFuncion); } } ); return; } List<URIStatus> sorted = sortByFieldAndOrder( statusStream.collect(Collectors.toList()), sortField, reverse); for (URIStatus status : sorted) { if (!pinnedOnly || status.isPinned()) { printLsString(status, hSize, timestampFuncion); } } }

Target:
private void ls(AlluxioURI path, boolean recursive, boolean forceLoadMetadata, boolean dirAsFile, boolean hSize, boolean pinnedOnly, String sortField, boolean reverse, String timestampOption) throws AlluxioException, IOException { Function<URIStatus, Long> timestampFunction = TIMESTAMP_FIELDS.get(timestampOption); URIStatus pathStatus = mFileSystem.getStatus(path); if (dirAsFile) { printLsString(pathStatus, hSize, timestampFunction, pinnedOnly, pathStatus.isPinned()); return; } ListStatusPOptions.Builder optionsBuilder = ListStatusPOptions.newBuilder(); if (forceLoadMetadata) { optionsBuilder.setLoadMetadataType(LoadMetadataPType.ALWAYS); } optionsBuilder.setRecursive(recursive); if (sortField == null) { mFileSystem.iterateStatus(path, optionsBuilder.build(), status -> printLsString(status, hSize, timestampFunction, pinnedOnly, status.isPinned())); return; } List<URIStatus> statusList = mFileSystem.listStatus(path, optionsBuilder.build()); List<URIStatus> sorted = sortByFieldAndOrder(statusList, sortField, reverse); for (URIStatus status : sorted) { printLsString(status, hSize, timestampFunction, pinnedOnly, status.isPinned()); } }
Source:
public static boolean isExtensionsAvailable() { final Jenkins jenkins = Jenkins.getInstance(); return jenkins == null ? false : jenkins.getInitLevel().compareTo(InitMilestone.EXTENSIONS_AUGMENTED) >= 0; }

Target:
public static boolean isExtensionsAvailable() { final Jenkins jenkins = Jenkins.getInstance(); return jenkins != null && jenkins.getInitLevel().compareTo(InitMilestone.EXTENSIONS_AUGMENTED) >= 0; }
Source:
protected FluentList<FluentWebElement> find() { FluentListImpl<FluentWebElement> elements = new FluentListImpl<>(); if (this.untilElements != null) { for (FluentWebElement untilElement : this.untilElements) { try { untilElement.getTagName(); elements.add(untilElement); } catch (NoSuchElementException e) { } } } return elements; }

Target:
protected FluentList<FluentWebElement> find() { FluentListImpl<FluentWebElement> elements = new FluentListImpl<>(); if (untilElements != null) { for (FluentWebElement untilElement : untilElements) { try { untilElement.getTagName(); elements.add(untilElement); } catch (NoSuchElementException e) { } } } return elements; }
Source:
public static UserResponse newUserResponse(UserAccountJoinVO usr, Long domainId) { UserResponse response = s_userAccountJoinDao.newUserResponse(usr); if(AccountManager.UseSecretKeyInResponse.value() == false){ response.setSecretKey(null); } if (usr.getAccountRoleId() != null) { Role role = s_roleService.findRole( usr.getAccountRoleId()); if (role != null) { response.setRoleId(role.getUuid()); response.setRoleType(role.getRoleType()); response.setRoleName(role.getName()); } } if (domainId != null && usr.getDomainId() != domainId) response.setIsCallerChildDomain(true); else response.setIsCallerChildDomain(false); return response; }

Target:
public static UserResponse newUserResponse(UserAccountJoinVO usr, Long domainId) { UserResponse response = s_userAccountJoinDao.newUserResponse(usr); if(!AccountManager.UseSecretKeyInResponse.value()){ response.setSecretKey(null); } if (usr.getAccountRoleId() != null) { Role role = s_roleService.findRole( usr.getAccountRoleId()); if (role != null) { response.setRoleId(role.getUuid()); response.setRoleType(role.getRoleType()); response.setRoleName(role.getName()); } } if (domainId != null && usr.getDomainId() != domainId) response.setIsCallerChildDomain(true); else response.setIsCallerChildDomain(false); return response; }
Source:
public void testRebaseWithUnstagedTopicChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "unstaged file2"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(result.getStatus(), Status.CONFLICTS); }

Target:
public void testRebaseWithUnstagedTopicChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "unstaged file2"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(result.getStatus(), Status.CONFLICTS); assertEquals(result.getConflicts().size(), 1); assertEquals(result.getConflicts().get(0), "file2"); }
Source:
private static String clozeText(String txt, String ord, char type) { Matcher n = Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt); if (!n.find()) { return ""; } txt = removeFormattingFromMathjax(txt, ord); Matcher m = Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt); StringBuffer repl = new StringBuffer(); while (m.find()) { String buf; if (type == 'q') { if (!TextUtils.isEmpty(m.group(4))) { buf = "[$4]"; } else { buf = "[...]"; } } else { buf = m.group(2); } StringBuilder replacement = new StringBuilder(); if (m.group(1).equals("c")) { replacement.append("<span class=cloze>"); replacement.append(buf); replacement.append("</span>"); } else { replacement.append(buf); } m.appendReplacement(repl, replacement.toString()); } txt = m.appendTail(repl).toString(); return txt.replaceAll(String.format(Locale.US, clozeReg, "\\d+"), "$2"); }

Target:
private static String clozeText(String txt, String ord, char type) { if (!Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt).find()) { return ""; } txt = removeFormattingFromMathjax(txt, ord); Matcher m = Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt); StringBuffer repl = new StringBuffer(); while (m.find()) { String buf; if (type == 'q') { if (!TextUtils.isEmpty(m.group(4))) { buf = "[$4]"; } else { buf = "[...]"; } } else { buf = m.group(2); } if (m.group(1).equals("c")) { buf = String.format("<span class=cloze>%s</span>", buf); } m.appendReplacement(repl, buf); } txt = m.appendTail(repl).toString(); return txt.replaceAll(String.format(Locale.US, clozeReg, "\\d+"), "$2"); }
Source:
public void aggregate() { if (foundValue == null && !valueSelector.isNull()) { foundValue = valueSelector.getDouble(); } }

Target:
public void aggregate() { if (!isFound) { foundValue = valueSelector.getDouble(); isFound = true; } }
Source:
public void write(String line) { if (!StringUtils.isNotEmpty(line)) { return; } JSONObject payload = new JSONObject(); try { BuildData buildData = new BuildData(this.run, null); payload.put("ddtags", String.join(",", TagsUtil.convertTagsToArray(buildData.getTags()))); payload = buildData.addLogAttributes(payload); payload.put("message", line); payload.put("ddsource", "jenkins"); payload.put("service", "jenkins"); DatadogClient client = ClientFactory.getClient(); if(client == null){ return; } boolean status = client.sendLogs(payload.toString()); if(!status){ client.sendLogs(payload.toString()); } } catch (IOException | InterruptedException e){ String msg = "Failed to send log data. No Further logs will be sent to Datadog."; DatadogUtilities.severe(logger, e, msg); try { errorStream.write(msg.getBytes(charset)); errorStream.flush(); } catch (IOException ex) { ex.printStackTrace(); } } }

Target:
public void write(String line) { if (!StringUtils.isNotEmpty(line)) { return; } JSONObject payload = new JSONObject(); try { BuildData buildData = new BuildData(this.run, null); payload.put("ddtags", String.join(",", TagsUtil.convertTagsToArray(buildData.getTags()))); payload = buildData.addLogAttributes(payload); payload.put("message", line); payload.put("ddsource", "jenkins"); payload.put("service", "jenkins"); DatadogClient client = ClientFactory.getClient(); if(client == null){ return; } boolean status = client.sendLogs(payload.toString()); if(!status){ client.sendLogs(payload.toString()); } } catch (IOException | InterruptedException e){ DatadogUtilities.severe(logger, e, null); } }
Source:
public static void viewStatsSinglePostDetails(Context context, SiteModel site, PostModel post, boolean isPage) { if (post == null) return; org.wordpress.android.ui.stats.models.PostModel postModel = new org.wordpress.android.ui.stats.models.PostModel(site.getSiteId(), String.valueOf(post.getRemotePostId()), post.getTitle(), post.getLink(), isPage ? StatsConstants.ITEM_TYPE_PAGE : StatsConstants.ITEM_TYPE_POST); viewStatsSinglePostDetails(context, postModel); }

Target:
public static void viewStatsSinglePostDetails(Context context, SiteModel site, PostModel post, boolean isPage) { if (post == null) return; StatsPostModel statsPostModel = new StatsPostModel(site.getSiteId(), String.valueOf(post.getRemotePostId()), post.getTitle(), post.getLink(), isPage ? StatsConstants.ITEM_TYPE_PAGE : StatsConstants.ITEM_TYPE_POST); viewStatsSinglePostDetails(context, statsPostModel); }
Source:
public boolean hasError() { return result != null && result.getType() != null && CommandResult.Type.ERROR.equals(result.getType()); }

Target:
public boolean hasError() { return result != null && CommandResult.Type.ERROR.equals(result.getType()); }
Source:
public ExitStatus afterStep(StepExecution stepExecution) { return null; }

Target:
public ExitStatus afterStep(StepExecution stepExecution) { return ExitStatus.COMPLETED; }
Source:
protected String formatIfNotEmpty(String pattern, Object param) { if (param == null ) return ""; return Strings.isNullOrEmpty(param.toString()) ? "" : String.format(pattern, param); }

Target:
protected String formatIfNotEmpty(String pattern, Object param) { return Strings.isNullOrEmpty(nullableToString( param )) ? "" : String.format(pattern, param); }
Source:
public void sendEmail(EmailWrapper wrapper) throws SendGridException { Email email = parseToEmail(wrapper); SendGrid sendgrid = new SendGrid(Config.SENDGRID_APIKEY); sendgrid.send(email); }

Target:
public void sendEmail(EmailWrapper wrapper) throws SendGridException { Email email = parseToEmail(wrapper); SendGrid sendgrid = new SendGrid(Config.SENDGRID_APIKEY); Response response = sendgrid.send(email); if (response.getCode() != SUCCESS_CODE) { log.severe("Email failed to send: " + response.getMessage()); } }
Source:
int prepareContext(Xid xid, boolean onePhaseCommit) { PrepareTransactionOperation operation; Collection<Modification> modifications; try { modifications = toModification(); if (trace) { log.tracef("Preparing transaction xid=%s, remote-cache=%s, modification-size=%d", xid, cacheName, modifications.size()); } if (modifications.isEmpty()) { return XAResource.XA_RDONLY; } } catch (Exception e) { return Integer.MIN_VALUE; } try { int xaReturnCode; do { operation = operationsFactory.newPrepareTransactionOperation(xid, onePhaseCommit, modifications); xaReturnCode = operation.execute().get(); } while (operation.shouldRetry()); return xaReturnCode; } catch (Exception e) { return XAException.XA_RBROLLBACK; } }

Target:
int prepareContext(Xid xid, boolean onePhaseCommit) { PrepareTransactionOperation operation; Collection<Modification> modifications; try { modifications = toModification(); if (trace) { log.tracef("Preparing transaction xid=%s, remote-cache=%s, modification-size=%d", xid, cacheName, modifications.size()); } if (modifications.isEmpty()) { return XAResource.XA_RDONLY; } } catch (Exception e) { return Integer.MIN_VALUE; } try { int xaReturnCode; do { operation = operationsFactory.newPrepareTransactionOperation(xid, onePhaseCommit, modifications); xaReturnCode = operation.execute().get(); } while (operation.shouldRetry()); return xaReturnCode; } catch (Exception e) { log.exceptionDuringPrepare(xid, e); return XAException.XA_RBROLLBACK; } }
Source:
int getHeight() { return this.height; }

Target:
public int getHeight() { return this.height; }
Source:
public static void waitForIndexer(ICProject project) throws InterruptedException { PDOMManager indexManager = CCoreInternals.getPDOMManager(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); try { Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null); project.getProject().refreshLocal(IResource.DEPTH_INFINITE, npm()); workspace.build(IncrementalProjectBuilder.FULL_BUILD, npm()); indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()); workspace.build(IncrementalProjectBuilder.FULL_BUILD, npm()); } catch (CoreException e) { fail(e.getMessage()); } assertTrue(indexManager.isProjectRegistered(project)); assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm())); }

Target:
public static void waitForIndexer(ICProject project) throws InterruptedException { Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null); assertTrue(CCoreInternals.getPDOMManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm())); }
Source:
public void testInValidHostnamesFail() { final Job.Builder b = Job.newBuilder().setName("foo").setVersion("1").setImage("bar"); final String toolonghostname = Strings.repeat("hostname", 8); assertEquals(newHashSet("Invalid hostname (" + toolonghostname + "), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname(toolonghostname).build())); assertEquals(newHashSet("Invalid hostname (%/ RJU&%(=N/U), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("%/ RJU&%(=N/U").build())); assertEquals(newHashSet("Invalid hostname (-), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("-").build())); assertEquals(newHashSet("Invalid hostname (foo17.bar-baz_quux), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("foo17.bar-baz_quux").build())); }

Target:
public void testInValidHostnamesFail() { final Job.Builder b = Job.newBuilder().setName("foo").setVersion("1").setImage("bar"); final String toolonghostname = Strings.repeat("hostname", 8); assertEquals(newHashSet("Invalid hostname (" + toolonghostname + "), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname(toolonghostname).build())); assertEquals(newHashSet("Invalid hostname (%/ RJU&%(=N/U), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("%/ RJU&%(=N/U").build())); assertEquals(newHashSet("Invalid hostname (-), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("-").build())); assertEquals(newHashSet("Invalid hostname (foo17.bar-baz_quux), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("foo17.bar-baz_quux").build())); assertEquals(newHashSet("Invalid hostname (D34DB33F), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("D34DB33F").build())); }
Source:
public Set<SOURCE> getInactiveSources() { Set<SOURCE> inactiveSources = Sets.newHashSet(); inactiveSources.addAll(soundSources.keySet().stream().filter(source -> !isActive(source)).collect(Collectors.toList())); return inactiveSources; }

Target:
public Set<SOURCE> getInactiveSources() { return soundSources.keySet().stream().filter(source -> !isActive(source)).collect(Collectors.toCollection(HashSet::new)); }
Source:
protected Set<Guid> getDisksGuidSet (List<DiskImage> disks) { return disks != null ? disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()) : new HashSet<>(); }

Target:
protected Set<Guid> getDisksGuidSet (List<DiskImage> disks) { return disks != null ? disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()) : Collections.emptySet(); }