auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isEnabled() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = page.getActivePart(); if (part == null) { return false; } ISelectionProvider selectionProvider = part.getSite().getSelectionProvider(); if (selectionProvider == null) { return false; } ISelection selection = selectionProvider.getSelection(); Object firstElement = ((IStructuredSelection) selection).getFirstElement(); final TmfCommonProjectElement traceElem = (firstElement instanceof TmfTraceElement) ? ((TmfTraceElement) firstElement).getElementUnderTraceFolder() : (TmfCommonProjectElement) firstElement; <START> ITmfTrace trace = traceElem.getTrace(); if (!(trace instanceof OpenTracingTrace)) { return false; } <END> String path = trace.getPath(); int arraySize = 0; try (FileReader fileReader = new FileReader(path)) { try (JsonReader reader = new JsonReader(fileReader);) { Gson gson = new Gson(); JsonObject object = gson.fromJson(reader, JsonObject.class); arraySize = object.get(DATA_KEY).getAsJsonArray().size(); reader.close(); } catch (IOException e) { return false; } fileReader.close(); } catch (IOException e1) { return false; } return arraySize > 1; }</code><technical_language>traceElem.getTraceType() verify if this is openTracing trace. This trace need opened in order work</technical_language>

Target:
public boolean isEnabled() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = page.getActivePart(); if (part == null) { return false; } ISelectionProvider selectionProvider = part.getSite().getSelectionProvider(); if (selectionProvider == null) { return false; } ISelection selection = selectionProvider.getSelection(); Object firstElement = ((IStructuredSelection) selection).getFirstElement(); final TmfCommonProjectElement traceElem = (firstElement instanceof TmfTraceElement) ? ((TmfTraceElement) firstElement).getElementUnderTraceFolder() : (TmfCommonProjectElement) firstElement; if (!traceElem.getTraceType().equals(TRACE_TYPE_ID)) { return false; } int arraySize = 0; try (FileReader fileReader = new FileReader(traceElem.getLocation().getPath())) { try (JsonReader reader = new JsonReader(fileReader);) { Gson gson = new Gson(); JsonObject object = gson.fromJson(reader, JsonObject.class); arraySize = object.get(DATA_KEY).getAsJsonArray().size(); reader.close(); } catch (IOException e) { return false; } fileReader.close(); } catch (IOException e1) { return false; } return arraySize > 1; }
Source:
<code>public Value<String> lockToken() { <START> return new SpongeValue<String>(Keys.LOCK_TOKEN, this.getValue()); <END> }</code><technical_language>here, include default arg of ""</technical_language>

Target:
public Value<String> lockToken() { return new SpongeValue<String>(Keys.LOCK_TOKEN, "", this.getValue()); }
Source:
<code>public void getAverageDownloadProgress(final DataCallback<Integer> callback) { IDatabase db = DatabaseFactory.getInstance( DatabaseFactory.TYPE_DATABASE_NATIVE ); db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>() { @Override public void onResult(List<VideoModel> result) { long[] dmids = new long[result.size()]; for (int i=0; i< result.size(); i++) { dmids[i] = result.get(i).getDmId(); <START> logger.debug("xxxxxxxx =" +dmids[i]); <END> } int averageProgress = dm.getAverageProgressForDownloads(dmids); callback.onResult(averageProgress); } @Override public void onFail(Exception ex) { callback.onFail(ex); } }); }</code><technical_language>this logger improved removed</technical_language>

Target:
public void getAverageDownloadProgress(final DataCallback<Integer> callback) { IDatabase db = DatabaseFactory.getInstance( DatabaseFactory.TYPE_DATABASE_NATIVE ); db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>() { @Override public void onResult(List<VideoModel> result) { long[] dmids = new long[result.size()]; for (int i=0; i< result.size(); i++) { dmids[i] = result.get(i).getDmId(); } int averageProgress = dm.getAverageProgressForDownloads(dmids); callback.onResult(averageProgress); } @Override public void onFail(Exception ex) { callback.onFail(ex); } }); }
Source:
<code>public void testDynamicLinkUniqueAfterTransition() throws Exception { AnalysisMock.get() .ccSupport() .setupCcToolchainConfig( mockToolsConfig, CcToolchainConfig.builder() .withFeatures( CppRuleClasses.COPY_DYNAMIC_LIBRARIES_TO_BINARY, CppRuleClasses.SUPPORTS_DYNAMIC_LINKER)); prepareCustomTransition(); scratch.file( "transition/BUILD", "load(':custom_transition.bzl', 'apply_custom_transition')", "cc_binary(", " name = \"main\",", " srcs = [\"main.cc\"],", " linkstatic = 0,", " deps = [", " \"dep2\",", " \"dep3\",", " ],", ")", "", "apply_custom_transition(", " name = \"dep1\",", " deps = [", " \":dep2\",", " ],", ")", "", "cc_library(", " name = \"dep2\",", " srcs = [\"test.cc\"],", " hdrs = [\"test.h\"],", ")", "", "cc_library(", " name = \"dep3\",", " srcs = [\"other_test.cc\"],", " hdrs = [\"other_test.h\"],", ")"); <START> <END> assertNoEvents(); }</code><technical_language>do getConfiguredTarget("//transition:main") do assertNoEvents(). 100% events try analyze target</technical_language>

Target:
public void testDynamicLinkUniqueAfterTransition() throws Exception { AnalysisMock.get() .ccSupport() .setupCcToolchainConfig( mockToolsConfig, CcToolchainConfig.builder() .withFeatures( CppRuleClasses.COPY_DYNAMIC_LIBRARIES_TO_BINARY, CppRuleClasses.SUPPORTS_DYNAMIC_LINKER)); prepareCustomTransition(); scratch.file( "transition/BUILD", "load(':custom_transition.bzl', 'apply_custom_transition')", "cc_binary(", " name = \"main\",", " srcs = [\"main.cc\"],", " linkstatic = 0,", " deps = [", " \"dep2\",", " \"dep3\",", " ],", ")", "", "apply_custom_transition(", " name = \"dep1\",", " deps = [", " \":dep2\",", " ],", ")", "", "cc_library(", " name = \"dep2\",", " srcs = [\"test.cc\"],", " hdrs = [\"test.h\"],", ")", "", "cc_library(", " name = \"dep3\",", " srcs = [\"other_test.cc\"],", " hdrs = [\"other_test.h\"],", ")"); getConfiguredTarget(" assertNoEvents(); }
Source:
<code>protected void executeCommand() { UpdateNicsVmInterfaceParametersFactory parameters = calculateRequiredParameters(getExistingNics()); invokeActionType(VdcActionType.AddVmInterface, parameters.createVnicParameters); invokeActionType(VdcActionType.UpdateVmInterface, parameters.updateVnicParameters); <START> invokeActionType(VdcActionType.RemoveVmInterface, parameters.removeVnicParameters); <END> if (getParameters().reorderNics) { VmOperationParameterBase reorderParams = new VmOperationParameterBase(getParameters().vmId); runInternalAction(VdcActionType.ReorderVmNics, reorderParams); } getReturnValue().setSucceeded(true); }</code><technical_language>IMO, this is a weird usage of 'factory class'. conform standard of factory pattern I suggest calculateRequiredParameters renamed create...Factory return factory class (without calling createParameters method). here, call createCreateVnicParameters(), createUpdateVnicParameters() createRemoveVnicParameters(). factory class produce needed data instantiation of factory class return in methods, API point of view more similar standard factory classes in java</technical_language>

Target:
protected void executeCommand() { UpdateNicsVmInterfaceParametersFactory parametersFactory = createUpdateNicsVmInterfaceParametersFactory(); invokeActionType(VdcActionType.AddVmInterface, parametersFactory.createCreateVnicParameters()); invokeActionType(VdcActionType.UpdateVmInterface, parametersFactory.createUpdateVnicParameters()); invokeActionType(VdcActionType.RemoveVmInterface, parametersFactory.createRemoveVnicParameters()); if (getParameters().reorderNics) { VmOperationParameterBase reorderParams = new VmOperationParameterBase(getParameters().vmId); runInternalAction(VdcActionType.ReorderVmNics, reorderParams); } getReturnValue().setSucceeded(true); }
Source:
<code>public void invalidate(final Collection<String> geocodes) { if (storedOverlay != null) { storedOverlay.invalidate(geocodes); } if (liveOverlay != null) { liveOverlay.invalidate(geocodes); } if (wpOverlay != null) { <START> final Set<Geocache> baseCaches = DataStore.loadCaches(geocodes, LoadFlags.LOAD_WAYPOINTS); <END> final Collection<String> invalidWpCodes = new ArrayList<String>(); for (final Geocache cache : baseCaches) { final List<Waypoint> wl = cache.getWaypoints(); for (final Waypoint w : wl) { invalidWpCodes.add(w.getGpxId()); } } wpOverlay.invalidate(invalidWpCodes); } }</code><technical_language>this waypoint overlay implement provide a method call here, do think</technical_language>

Target:
public void invalidate(final Collection<String> geocodes) { if (storedOverlay != null) { storedOverlay.invalidate(geocodes); } if (liveOverlay != null) { liveOverlay.invalidate(geocodes); } if (wpOverlay != null) { wpOverlay.invalidateWaypoints(geocodes); } }
Source:
<code>public void checkHandlesMoveColumnsToWithMultipleMetadata() throws ModelSynchronizer.MoveColumnVetoException { final MoveColumnToMetaData md0 = mock(MoveColumnToMetaData.class); final MoveColumnToMetaData md1 = mock(MoveColumnToMetaData.class); final AttributeColumnSynchronizer synchronizer = new AttributeColumnSynchronizer(); when(md0.getColumn()).thenReturn(mock(AttributeCol52.class)); when(md1.getColumn()).thenReturn(mock(AttributeCol52.class)); <START> assertFalse(synchronizer.handlesMoveColumnsTo(new ArrayList<MoveColumnToMetaData>() {{ <END> add(md0); add(md1); }})); }</code><technical_language>Arrays.asList() remove boilerplate</technical_language>

Target:
public void checkHandlesMoveColumnsToWithMultipleMetadata() throws ModelSynchronizer.MoveColumnVetoException { final MoveColumnToMetaData md0 = mock(MoveColumnToMetaData.class); final MoveColumnToMetaData md1 = mock(MoveColumnToMetaData.class); final AttributeColumnSynchronizer synchronizer = new AttributeColumnSynchronizer(); when(md0.getColumn()).thenReturn(mock(AttributeCol52.class)); when(md1.getColumn()).thenReturn(mock(AttributeCol52.class)); assertFalse(synchronizer.handlesMoveColumnsTo(Arrays.asList(md0, md1))); }
Source:
<code>public boolean isBlockEvictable(long blockId) { boolean pinned = isBlockPinned(blockId); boolean locked = isBlockLocked(blockId); boolean marked = isBlockMarked(blockId); <START> LOG.debug("Block: {}. Pinned: {}, Locked: {}, Marked: {}", blockId, pinned, locked, marked); <END> return !pinned && !locked && !marked; }</code><technical_language>do want this message</technical_language>

Target:
public boolean isBlockEvictable(long blockId) { boolean pinned = isBlockPinned(blockId); boolean locked = isBlockLocked(blockId); boolean marked = isBlockMarked(blockId); boolean isEvictable = !pinned && !locked && !marked; if (!isEvictable) { LOG.debug("Block not evictable: {}. Pinned: {}, Locked: {}, Marked: {}", blockId, pinned, locked, marked); } return isEvictable; }
Source:
<code>public Class<?> getReturnType(Class<?> firstArgumentType) { <START> return Integer.class; <END> }</code><technical_language>I JPA requires this return a Long</technical_language>

Target:
public Class<?> getReturnType(Class<?> firstArgumentType) { return Long.class; }
Source:
<code><START> private InternalObjectNode getDocumentDefinition(String itemId, String partitionKeyValue) { <END> final InternalObjectNode properties = new InternalObjectNode(String.format("{ " + "\"id\": \"%s\", " + "\"mypk\": \"%s\", " + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}" , itemId, partitionKeyValue)); return properties; }</code><technical_language>please rely InternalObjectNode for new tests. want move end users ObjectNode instead tests get samples. Please a pojo ObjectNode</technical_language>

Target:
private ItemSample getDocumentDefinition(String itemId, String partitionKeyValue) { ItemSample itemSample = new ItemSample(); itemSample.id = itemId; itemSample.mypk = partitionKeyValue; itemSample.sgmts = "[[6519456, 1471916863], [2498434, 1455671440]]"; return itemSample; }
Source:
<code>public void storeMessage(final MessageTree tree, final MessageId id) throws IOException { String domain = id.getDomain(); String key = domain + id.getIpAddress() + id.getTimestamp(); int abs = key.hashCode(); if (abs < 0) { abs = -abs; } int bucketIndex = abs % m_gzipThreads; m_processMessages[bucketIndex]++; LinkedBlockingQueue<MessageItem> items = m_messageQueues.get(bucketIndex); boolean result = items.offer(new MessageItem(tree, id)); if (!result) { m_error++; if (m_error % (CatConstants.ERROR_COUNT * 10) == 0) { m_logger.error("Error when offer message tree to gzip queue! overflow :" + m_error + ". Gzip thread :" + bucketIndex); } m_serverStateManager.addMessageDumpLoss(1); } m_total++; Long value = m_totals.get(domain); if (value == null) { m_totals.put(domain, 1L); } else { m_totals.put(domain, value + 1); } if (m_total % (CatConstants.SUCCESS_COUNT) == 0) { logState(tree); } if (value != null && value % CatConstants.SUCCESS_COUNT == 0) { Long lastTotalSize = m_lastTotalSizes.get(domain); if(lastTotalSize == null){ lastTotalSize = 0L; } double amount = m_totalSizes.get(domain) - lastTotalSize; <START> m_lastTotalSizes.put(domain, m_totalSizes.get(domain)); <END> m_serverStateManager.addMessageSize(domain, amount); m_serverStateManager.addMessageSize(amount); } }</code><technical_language>call m_totalSizes.get(domain) twice</technical_language>

Target:
public void storeMessage(final MessageTree tree, final MessageId id) throws IOException { String domain = id.getDomain(); String key = domain + id.getIpAddress() + id.getTimestamp(); int abs = key.hashCode(); if (abs < 0) { abs = -abs; } int bucketIndex = abs % m_gzipThreads; m_processMessages[bucketIndex]++; LinkedBlockingQueue<MessageItem> items = m_messageQueues.get(bucketIndex); boolean result = items.offer(new MessageItem(tree, id)); if (!result) { m_error++; if (m_error % (CatConstants.ERROR_COUNT * 10) == 0) { m_logger.error("Error when offer message tree to gzip queue! overflow :" + m_error + ". Gzip thread :" + bucketIndex); } m_serverStateManager.addMessageDumpLoss(1); } m_total++; Long value = m_totals.get(domain); if (value == null) { m_totals.put(domain, 1L); } else { m_totals.put(domain, value + 1); } if (m_total % (CatConstants.SUCCESS_COUNT) == 0) { logState(tree); } if (value != null && value % CatConstants.SUCCESS_COUNT == 0) { Long lastTotalSize = m_lastTotalSizes.get(domain); Long totalSize = m_totalSizes.get(domain); if(lastTotalSize == null){ lastTotalSize = 0L; } double amount = totalSize - lastTotalSize; m_lastTotalSizes.put(domain, totalSize); m_serverStateManager.addMessageSize(domain, amount); } }
Source:
<code>public ESat isEntailed() { if (iv.isInstantiated()) { if (!set.envelopeContains(iv.getValue())) { return ESat.FALSE; } else { if (set.kernelContains(iv.getValue())) { return ESat.TRUE; } else { return ESat.UNDEFINED; } } } else { int minVal = iv.getLB(); int maxVal = iv.getUB(); boolean all = true; for (int i = minVal; i <= maxVal; i = iv.nextValue(i)) { if (!set.kernelContains(i)) { all = false; break; } } if (all) { return ESat.TRUE; } <START> for (int i = minVal; i <= maxVal; i = iv.nextValue(i)) { <END> if (set.envelopeContains(i)) { return ESat.UNDEFINED; } } return ESat.FALSE; } }</code><technical_language>this is a bounded variable, next variable is i+1. Replace iv.nextValue(i) i++</technical_language>

Target:
public ESat isEntailed() { if (iv.isInstantiated()) { if (!set.envelopeContains(iv.getValue())) { return ESat.FALSE; } else { if (set.kernelContains(iv.getValue())) { return ESat.TRUE; } else { return ESat.UNDEFINED; } } } else { int lb = iv.getLB(); int ub = iv.getUB(); boolean all = true; for (int i = lb; i <= ub; i++) { if (!set.kernelContains(i)) { all = false; break; } } if (all) { return ESat.TRUE; } for (int i = lb; i <= ub; i++) { if (set.envelopeContains(i)) { return ESat.UNDEFINED; } } return ESat.FALSE; } }
Source:
<code>private Path expandPath(Path path) { List<Path> fileDirectories = getFileDirectoriesAsPaths(); <START> Optional<Path> Fpath = FileHelper.expandFilenameAsPath(path.toString(), fileDirectories); <END> if (Fpath.isPresent()) { return Fpath.get(); } else { return path; } }</code><technical_language>lowerCase variable</technical_language>

Target:
private Path expandPath(Path path) { List<Path> fileDirectories = getFileDirectoriesAsPaths(); return FileHelper.expandFilenameAsPath(path.toString(), fileDirectories).orElse(path); }
Source:
<code>static void assertLinesMatch(List<String> expectedLines, List<String> actualLines, String message) { <START> assertLinesMatch(expectedLines, actualLines, () -> message); <END> }</code><technical_language>suggestion assertLinesMatch(expectedLines, actualLines, (Object) message);</technical_language>

Target:
static void assertLinesMatch(List<String> expectedLines, List<String> actualLines, String message) { assertLinesMatch(expectedLines, actualLines, (Object) message); }
Source:
<code>public void getCandidateApplicationsByCandidateIdShouldThrowIllegalArgumentExceptionWhenCandidateIdIsNull() { <START> given(candidateRepository.findOne(null)).willThrow(IllegalArgumentException.class); <END> statesService.getCandidateApplicationsByCandidateId(null); }</code><technical_language>remove this line</technical_language>

Target:
public void getCandidateApplicationsByCandidateIdShouldThrowIllegalArgumentExceptionWhenCandidateIdIsNull() { statesService.getCandidateApplicationsByCandidateId(null); }
Source:
<code>protected void onDestroy() { if (mFormLoaderTask != null) { mFormLoaderTask.setFormLoaderListener(null); if (mFormLoaderTask.getStatus() == AsyncTask.Status.FINISHED) { mFormLoaderTask.cancel(true); mFormLoaderTask.destroy(); } } if (mSaveToDiskTask != null) { mSaveToDiskTask.setFormSavedListener(null); if (mSaveToDiskTask.getStatus() == AsyncTask.Status.FINISHED) { mSaveToDiskTask.cancel(false); } } <START> if (mNoGPSReceiver == null) { <END> unregisterReceiver(mNoGPSReceiver); } super.onDestroy(); }</code><technical_language>I this condition is inverted</technical_language>

Target:
protected void onDestroy() { if (mFormLoaderTask != null) { mFormLoaderTask.setFormLoaderListener(null); if (mFormLoaderTask.getStatus() == AsyncTask.Status.FINISHED) { mFormLoaderTask.cancel(true); mFormLoaderTask.destroy(); } } if (mSaveToDiskTask != null) { mSaveToDiskTask.setFormSavedListener(null); if (mSaveToDiskTask.getStatus() == AsyncTask.Status.FINISHED) { mSaveToDiskTask.cancel(false); } } if (mNoGPSReceiver != null) { unregisterReceiver(mNoGPSReceiver); } super.onDestroy(); }
Source:
<code>public Collection<PsiElement> getPsiTargets(PsiElement psiElement) { Collection<PsiElement> targets = new ArrayList<>(); String directiveName = psiElement.getText().substring(1); <START> FileBasedIndexImpl.getInstance().getFilesWithKey( <END> BladeCustomDirectivesStubIndex.KEY, new HashSet<>(Collections.singletonList(directiveName)), virtualFile -> { PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(virtualFile); if(psiFile == null) { return true; } psiFile.acceptChildren(new BladeCustomDirectivesVisitor(hit -> { if(directiveName.equals(hit.second)) { targets.add(hit.first); } })); return true; }, ProjectScope.getAllScope(getProject())); return targets; }</code><technical_language>FileBasedIndex right Impl is implementation</technical_language>

Target:
public Collection<PsiElement> getPsiTargets(PsiElement psiElement) { Collection<PsiElement> targets = new ArrayList<>(); String directiveName = psiElement.getText().substring(1); FileBasedIndex.getInstance().getFilesWithKey( BladeCustomDirectivesStubIndex.KEY, new HashSet<>(Collections.singletonList(directiveName)), virtualFile -> { PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(virtualFile); if(psiFile == null) { return true; } psiFile.acceptChildren(new BladeCustomDirectivesVisitor(hit -> { if(directiveName.equals(hit.second)) { targets.add(hit.first); } })); return true; }, ProjectScope.getAllScope(getProject())); return targets; }
Source:
<code>private List<ShardSpec> determinePartitions( final Interval interval, final int targetPartitionSize, final QueryGranularity queryGranularity ) throws IOException { log.info("Determining partitions for interval[%s] with targetPartitionSize[%d]", interval, targetPartitionSize); final FirehoseFactory firehoseFactory = ingestionSchema.getIOConfig().getFirehoseFactory(); HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); try (Firehose firehose = firehoseFactory.connect(ingestionSchema.getDataSchema().getParser())) { while (firehose.hasMore()) { final InputRow inputRow = firehose.nextRow(); if (interval.contains(inputRow.getTimestampFromEpoch())) { final List<Object> groupKey = Rows.toGroupKey( queryGranularity.truncate(inputRow.getTimestampFromEpoch()), inputRow ); collector.add( <START> hashFunction.hashBytes(jsonMapper.writeValueAsBytes(groupKey)) <END> .asBytes() ); } } } final double numRows = collector.estimateCardinality(); log.info("Estimated approximately [%,f] rows of data.", numRows); int numberOfShards = (int) Math.ceil(numRows / targetPartitionSize); if ((double) numberOfShards > numRows) { numberOfShards = (int) numRows; } log.info("Will require [%,d] shard(s).", numberOfShards); final List<ShardSpec> shardSpecs = Lists.newArrayList(); if (numberOfShards == 1) { shardSpecs.add(new NoneShardSpec()); } else { for (int i = 0; i < numberOfShards; ++i) { shardSpecs.add( new HashBasedNumberedShardSpec( i, numberOfShards, HadoopDruidIndexerConfig.jsonMapper ) ); } } return shardSpecs; }</code><technical_language>of jsonMappers modules loaded</technical_language>

Target:
private List<ShardSpec> determinePartitions( final Interval interval, final int targetPartitionSize, final QueryGranularity queryGranularity ) throws IOException { log.info("Determining partitions for interval[%s] with targetPartitionSize[%d]", interval, targetPartitionSize); final FirehoseFactory firehoseFactory = ingestionSchema.getIOConfig().getFirehoseFactory(); HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); try (Firehose firehose = firehoseFactory.connect(ingestionSchema.getDataSchema().getParser())) { while (firehose.hasMore()) { final InputRow inputRow = firehose.nextRow(); if (interval.contains(inputRow.getTimestampFromEpoch())) { final List<Object> groupKey = Rows.toGroupKey( queryGranularity.truncate(inputRow.getTimestampFromEpoch()), inputRow ); collector.add( hashFunction.hashBytes(jsonMapper.writeValueAsBytes(groupKey)).asBytes() ); } } } final double numRows = collector.estimateCardinality(); log.info("Estimated approximately [%,f] rows of data.", numRows); int numberOfShards = (int) Math.ceil(numRows / targetPartitionSize); if ((double) numberOfShards > numRows) { numberOfShards = (int) numRows; } log.info("Will require [%,d] shard(s).", numberOfShards); final List<ShardSpec> shardSpecs = Lists.newArrayList(); if (numberOfShards == 1) { shardSpecs.add(new NoneShardSpec()); } else { for (int i = 0; i < numberOfShards; ++i) { shardSpecs.add(new HashBasedNumberedShardSpec(i, numberOfShards, jsonMapper)); } } return shardSpecs; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_authentication); getUsernameEdit().setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { <START> getUsernameEdit().setOnFocusChangeListener(new View.OnFocusChangeListener() { <END> @Override public void onFocusChange(View view, boolean b) { if (b) { imageView.setImageDrawable(null); } } }); return false; } }); getPasswordEdit().setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { getPasswordEdit().setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if (b) { imageView.setImageDrawable(null); } } }); return false; } }); setUpInjections(); setUpAuthentication(); }</code><technical_language>Setting a listener another listener? seriously? This a new copy of focus listener time touch EditText. This simplified! Please revise code</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_authentication); imageView = (ImageView) findViewById(R.id.logo); getUsernameEdit().setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { FocusListener(view); return false; } }); getPasswordEdit().setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { FocusListener(view); return false; } }); setUpInjections(); setUpAuthentication(); }
Source:
<code>private Optional<Activity> findOverlappingActivitySameApp(ActivityPayload payload, GoalDto matchingGoal) { Optional<DayActivity> dayActivity = findExistingDayActivity(payload, matchingGoal.getGoalId()); if (!dayActivity.isPresent()) { return Optional.empty(); } List<Activity> overlappingOfSameApp = activityRepository.findOverlappingOfSameApp(dayActivity.get(), payload.deviceAnonymizedId, matchingGoal.getActivityCategoryId(), payload.application.orElse(null), payload.startTime.toLocalDateTime(), payload.endTime.toLocalDateTime()); if (overlappingOfSameApp.isEmpty()) { return Optional.empty(); } <START> else if (overlappingOfSameApp.size() == 1) <END> { return Optional.of(overlappingOfSameApp.get(0)); } else { String relatedTo = payload.application.isPresent() ? MessageFormat.format("same app ''{0}'' activity", payload.application.get()) : "network activity"; String overlappingActivities = overlappingOfSameApp.stream() .map(overlappingActivity -> overlappingActivity.toString()).collect(Collectors.joining(", ")); logger.warn( "Multiple overlapping activities of {0} found. The payload has start time {1} and end time {2}. The overlapping activities are: {3}. The day activity ID is {4} and the activity category ID is {5}.", relatedTo, payload.startTime.toLocalDateTime(), payload.endTime.toLocalDateTime(), overlappingActivities, dayActivity.get().getId(), matchingGoal.getActivityCategoryId()); return Optional.of(overlappingOfSameApp.get(0)); } }</code><technical_language>Else necessary here</technical_language>

Target:
private Optional<Activity> findOverlappingActivitySameApp(ActivityPayload payload, GoalDto matchingGoal) { Optional<DayActivity> dayActivity = findExistingDayActivity(payload, matchingGoal.getGoalId()); if (!dayActivity.isPresent()) { return Optional.empty(); } List<Activity> overlappingOfSameApp = activityRepository.findOverlappingOfSameApp(dayActivity.get(), payload.deviceAnonymizedId, matchingGoal.getActivityCategoryId(), payload.application.orElse(null), payload.startTime.toLocalDateTime(), payload.endTime.toLocalDateTime()); if (overlappingOfSameApp.isEmpty()) { return Optional.empty(); } if (overlappingOfSameApp.size() == 1) { return Optional.of(overlappingOfSameApp.get(0)); } String overlappingActivitiesKind = payload.application.isPresent() ? MessageFormat.format("app activities of ''{0}''", payload.application.get()) : "network activities"; String overlappingActivities = overlappingOfSameApp.stream().map(overlappingActivity -> overlappingActivity.toString()) .collect(Collectors.joining(", ")); logger.warn( "Multiple overlapping found. The payload has start time and end time {}. The day activity ID is and the activity category ID is {}. The overlapping activities are: {}.", overlappingActivitiesKind, payload.startTime.toLocalDateTime(), payload.endTime.toLocalDateTime(), dayActivity.get().getId(), matchingGoal.getActivityCategoryId(), overlappingActivities); return Optional.of(overlappingOfSameApp.get(0)); }
Source:
<code>public void should_fail_if_actual_is_null() { final Throwable throwable = null; final Throwable expected = new Throwable(); AssertionError actual = expectAssertionError( () -> throwables.assertHasRootCause(someInfo(), throwable, expected) ); assertThat(actual) <START> .hasMessage(actualIsNull()); <END> }</code><technical_language>minor: join line</technical_language>

Target:
public void should_fail_if_actual_is_null() { final Throwable throwable = null; final Throwable expected = new Throwable(); AssertionError actual = expectAssertionError(() -> throwables.assertHasRootCause(INFO, throwable, expected)); assertThat(actual).hasMessage(actualIsNull()); }
Source:
<code>public void testCloseSuccessfulChunkedInput() throws Exception { int chunks = 10; TestChunkedInput input = new TestChunkedInput(chunks); EmbeddedChannel ch = new EmbeddedChannel(new ChunkedWriteHandler()); ch.writeAndFlush(input).sync(); for (int i = 0; i < chunks; i++) { ByteBuf buf = ch.readOutbound(); assertEquals(i, buf.readInt()); buf.release(); } <START> assertTrue(input.closed); <END> }</code><technical_language>please call channel.finish() assert return value</technical_language>

Target:
public void testCloseSuccessfulChunkedInput() { int chunks = 10; TestChunkedInput input = new TestChunkedInput(chunks); EmbeddedChannel ch = new EmbeddedChannel(new ChunkedWriteHandler()); assertTrue(ch.writeOutbound(input)); for (int i = 0; i < chunks; i++) { ByteBuf buf = ch.readOutbound(); assertEquals(i, buf.readInt()); buf.release(); } assertTrue(input.isClosed()); assertFalse(ch.finish()); }
Source:
<code>public void setWidth(int desiredWidth, int desiredScale, boolean errorOnTrunc) throws StandardException { int sourceWidth; if ( (_clobValue == null ) && (getString() == null) ) { return; } sourceWidth = getLength(); if (sourceWidth < desiredWidth) { if (!(this instanceof SQLVarchar)) { StringBuffer strbuf; strbuf = new StringBuffer(getString()); <START> for ( ; sourceWidth < desiredWidth-1; sourceWidth++) <END> { strbuf.append(' '); } setValue(new String(strbuf)); } } else if (sourceWidth > desiredWidth && desiredWidth > 0) { try { hasNonBlankChars(getString(), desiredWidth, sourceWidth); } catch (StandardException se) { if (errorOnTrunc) { throw se; } String source = getString(); int transferSize = getUTF8Length(source, 0, desiredWidth); int dataSize = transferSize + getUTF8Length(source, desiredWidth, source.length()); DataTruncation warning = new DataTruncation( -1, false, true, dataSize, transferSize); warning.initCause(se); StatementContext statementContext = (StatementContext) ContextService.getContext(ContextId.LANG_STATEMENT); Activation activation = statementContext.getActivation(); if (activation != null) { activation.getResultSet().addWarning(warning); } } setValue(getString().substring(0, desiredWidth)); } }</code><technical_language>remove StringBuffer replace StringBuilder</technical_language>

Target:
public void setWidth(int desiredWidth, int desiredScale, boolean errorOnTrunc) throws StandardException { int sourceWidth; if ( (_clobValue == null ) && (getString() == null) ) { return; } sourceWidth = getLength(); if (sourceWidth < desiredWidth) { if (!(this instanceof SQLVarchar)) { StringBuilder strBuilder; strBuilder = new StringBuilder(getString()); for ( ; sourceWidth < desiredWidth-1; sourceWidth++) { strBuilder.append(' '); } setValue(new String(strBuilder)); } } else if (sourceWidth > desiredWidth && desiredWidth > 0) { try { hasNonBlankChars(getString(), desiredWidth, sourceWidth); } catch (StandardException se) { if (errorOnTrunc) { throw se; } String source = getString(); int transferSize = getUTF8Length(source, 0, desiredWidth); int dataSize = transferSize + getUTF8Length(source, desiredWidth, source.length()); DataTruncation warning = new DataTruncation( -1, false, true, dataSize, transferSize); warning.initCause(se); StatementContext statementContext = (StatementContext) ContextService.getContext(ContextId.LANG_STATEMENT); Activation activation = statementContext.getActivation(); if (activation != null) { activation.getResultSet().addWarning(warning); } } setValue(getString().substring(0, desiredWidth)); } }
Source:
<code>protected void addVmStatic() { logImportEvents(); getVm().getStaticData().setId(getVmId()); getVm().getStaticData().setCreationDate(new Date()); getVm().getStaticData().setClusterId(getParameters().getClusterId()); <START> getVm().setStoragePoolId(getDcId()); <END> getVm().getStaticData().setMinAllocatedMem(computeMinAllocatedMem()); getVm().getStaticData().setQuotaId(getParameters().getQuotaId()); if (!VmHandler.validateDedicatedVdsExistOnSameCluster(getVm().getStaticData(), null)) { getVm().setDedicatedVmForVdsList(Collections.<Guid>emptyList()); } if (getVm().getOriginalTemplateGuid() != null && !VmTemplateHandler.BLANK_VM_TEMPLATE_ID.equals(getVm().getOriginalTemplateGuid())) { VmTemplate originalTemplate = getVmTemplateDao().get(getVm().getOriginalTemplateGuid()); if (originalTemplate != null) { getVm().getStaticData().setOriginalTemplateName(originalTemplate.getName()); } } if (getParameters().getCopyCollapse()) { getVm().setVmtGuid(VmTemplateHandler.BLANK_VM_TEMPLATE_ID); } getVmStaticDao().save(getVm().getStaticData()); getCompensationContext().snapshotNewEntity(getVm().getStaticData()); }</code><technical_language>I it, is right place for dcId is unrelated VmStatic. I in init method execute method - raised a good point for need validate dcId==cluster.dcId (if supplied in parameters), I 'init' method is right place</technical_language>

Target:
protected void addVmStatic() { logImportEvents(); getVm().getStaticData().setId(getVmId()); getVm().getStaticData().setCreationDate(new Date()); getVm().getStaticData().setClusterId(getParameters().getClusterId()); getVm().getStaticData().setMinAllocatedMem(computeMinAllocatedMem()); getVm().getStaticData().setQuotaId(getParameters().getQuotaId()); if (!VmHandler.validateDedicatedVdsExistOnSameCluster(getVm().getStaticData(), null)) { getVm().setDedicatedVmForVdsList(Collections.<Guid>emptyList()); } if (getVm().getOriginalTemplateGuid() != null && !VmTemplateHandler.BLANK_VM_TEMPLATE_ID.equals(getVm().getOriginalTemplateGuid())) { VmTemplate originalTemplate = getVmTemplateDao().get(getVm().getOriginalTemplateGuid()); if (originalTemplate != null) { getVm().getStaticData().setOriginalTemplateName(originalTemplate.getName()); } } if (getParameters().getCopyCollapse()) { getVm().setVmtGuid(VmTemplateHandler.BLANK_VM_TEMPLATE_ID); } getVmStaticDao().save(getVm().getStaticData()); getCompensationContext().snapshotNewEntity(getVm().getStaticData()); }
Source:
<code>private void registerPushResources(Bundle pushBundle) { <START> Hashtable<String, Object> properties = new Hashtable<>(); <END> properties.put("osgi.http.whiteboard.servlet.pattern", "/VAADIN/static/push/*"); servletRegistration.compareAndSet(null, pushBundle.getBundleContext().registerService(Servlet.class, new PushResourceServlet(pushBundle), properties)); }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Replace synchronized class "Hashtable" unsynchronized "HashMap". [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private void registerPushResources(Bundle pushBundle) { Hashtable<String, Object> properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/VAADIN/static/push/*"); servletPushRegistration.compareAndSet(null, pushBundle.getBundleContext().registerService(Servlet.class, new ResourceServlet(pushBundle, "/META-INF/resources/VAADIN/static/push"), properties)); }
Source:
<code>public String toString() { <START> return String.format("CertificateSerialDTO []"); <END> }</code><technical_language>String.format need a formatted</technical_language>

Target:
public String toString() { Date expiration = this.getExpiration(); String date = expiration != null ? String.format("%1$tF %1$tT%1$tz", expiration) : null; return String.format( "CertificateSerialDTO [id: %s, serial: %s, expiration: %s, collected: %s, revoked: %s]", this.getId(), this.getSerial(), date, this.isCollected(), this.isRevoked()); }
Source:
<code>public boolean verifyServicesCombination(Set<Service> services) { final Sets.SetView<Service> missingServices = Sets.difference(REQUIRED_SERVICES, services); final Sets.SetView<Service> unsupportedServices = Sets.intersection(UNSUPPORTED_SERVICES, services); final Sets.SetView<Service> wantedServices = Sets.intersection(NUAGE_ONLY_SERVICES, new HashSet<>()); if (!missingServices.isEmpty()) { throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " requires services: " + missingServices); } if (!unsupportedServices.isEmpty()) { <START> s_logger.debug("Unable to support services combination. The services " + unsupportedServices + " are not supported by Nuage VSP."); <END> return false; } if (!wantedServices.isEmpty()) { throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " does not support services to be implemented by another provider: " + wantedServices); } return true; }</code><technical_language>this message logged WARN instead of DEBUG</technical_language>

Target:
public boolean verifyServicesCombination(Set<Service> services) { Preconditions.checkNotNull(services); final Sets.SetView<Service> missingServices = Sets.difference(REQUIRED_SERVICES, services); final Sets.SetView<Service> unsupportedServices = Sets.intersection(UNSUPPORTED_SERVICES, services); final Sets.SetView<Service> wantedServices = Sets.intersection(NUAGE_ONLY_SERVICES, new HashSet<>()); if (!missingServices.isEmpty()) { throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " requires services: " + missingServices); } if (!unsupportedServices.isEmpty()) { s_logger.debug("Unable to support services combination. The services " + unsupportedServices + " are not supported by Nuage VSP."); return false; } if (!wantedServices.isEmpty()) { throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " does not support services to be implemented by another provider: " + wantedServices); } return true; }
Source:
<code>private void buildStatisticsTree(final ITmfTrace trace, final TmfTimeRange timeRange, final boolean isGlobal) { final TmfStatisticsTreeNode statTree = TmfStatisticsTreeManager.getStatTreeRoot(getTreeID()); final TmfStatisticsTree statsData = TmfStatisticsTreeManager.getStatTree(getTreeID()); if (statsData == null) { return; } synchronized (statsData) { if (isGlobal) { statTree.resetGlobalValue(); } else { statTree.resetTimeRangeValue(); } for (final ITmfTrace aTrace : TmfTraceManager.getTraceSet(trace)) { if (!isListeningTo(aTrace)) { continue; } final TmfStatisticsModule statsMod = aTrace.getAnalysisModuleOfClass(TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } Thread statsThread = new Thread("Statistics update") { @Override public void run() { statsMod.waitForInitialization(); ITmfStatistics stats = statsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } long start = timeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); long end = timeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); ITmfStateSystem ss = statsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } <START> while(!ss.waitUntilBuilt(500)) { <END> Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(isGlobal, map); } Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(isGlobal, map); } }; statsThread.start(); return; } } }</code><technical_language>I this extracted a clear constant. (next patch so) a user-definable constant</technical_language>

Target:
private void buildStatisticsTree(final ITmfTrace trace, final TmfTimeRange timeRange, final boolean isGlobal) { final TmfStatisticsTreeNode statTree = TmfStatisticsTreeManager.getStatTreeRoot(getTreeID()); final TmfStatisticsTree statsData = TmfStatisticsTreeManager.getStatTree(getTreeID()); if (statsData == null) { return; } synchronized (statsData) { if (isGlobal) { statTree.resetGlobalValue(); } else { statTree.resetTimeRangeValue(); } for (final ITmfTrace aTrace : TmfTraceManager.getTraceSet(trace)) { if (!isListeningTo(aTrace)) { continue; } final TmfStatisticsModule statsMod = aTrace.getAnalysisModuleOfClass(TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } Thread statsThread = new Thread("Statistics update") { @Override public void run() { statsMod.waitForInitialization(); ITmfStatistics stats = statsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } long start = timeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); long end = timeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); ITmfStateSystem ss = statsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } while(!ss.waitUntilBuilt(LIVE_UPDATE_DELAY)) { Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(isGlobal, map); } Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(isGlobal, map); } }; statsThread.start(); return; } } }
Source:
<code>static String usingOffsetPrefix(SecorConfig config) { <START> return config.getString("secor.offsets.prefix", "offset="); <END> }</code><technical_language>In secor, convention default is in secor.common.properties, in Java code. need 2nd argument for default</technical_language>

Target:
static String usingOffsetPrefix(SecorConfig config) { return config.getString("secor.offsets.prefix"); }
Source:
<code>protected void <START> setSeries(String seriesName, double[] seriesValues) { if (seriesName == null) { throw new IllegalArgumentException("seriesName cannot be null"); } if (seriesValues == null) { throw new IllegalArgumentException("Series values cannot be null"); } <END> String seriesType = getSeriesType(seriesName); fModelBuilder.addYSeries( new YSeries( seriesType, getSeriesColor(seriesName), getWidth(seriesName), getSeriesStyle(seriesType), seriesName, seriesValues)); }</code><technical_language>@NonNull Objects.requireNotNull</technical_language>

Target:
protected void setSeries(String seriesName, double[] seriesValues) { Objects.requireNonNull(seriesName); Objects.requireNonNull(seriesValues); String seriesType = getSeriesType(seriesName); fModelBuilder.addYSeries( new YSeries( seriesType, getSeriesColor(seriesName), getWidth(seriesName), getSeriesStyle(seriesType), seriesName, seriesValues)); }
Source:
<code>public void unregisterPercentLength(AndroidViewComponent component, PercentStorageRecord.Dim dim) { <START> for (Integer key : dimChanges.keySet()) { <END> dimChanges.remove(generateHashCode(component, dim)); } }</code><technical_language>need for loop more. call remove line 716 remove entry if exists do if exist. changes map, result in a ConcurrentModificationException written modifying loop while iterating it</technical_language>

Target:
public void unregisterPercentLength(AndroidViewComponent component, PercentStorageRecord.Dim dim) { dimChanges.remove(generateHashCode(component, dim)); }
Source:
<code><START> private static ComputerLauncher getDelegate(ComputerLauncher launcher) { <END> try { Method getDelegate = launcher.getClass().getMethod("getDelegate"); return ComputerLauncher.class.isAssignableFrom(getDelegate.getReturnType()) ? (ComputerLauncher) getDelegate .invoke(launcher) : null; } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { return null; } }</code><technical_language>CheckForNull</technical_language>

Target:
private static ComputerLauncher getDelegate(ComputerLauncher launcher) { try { Method getDelegate = launcher.getClass().getMethod("getDelegate"); if (ComputerLauncher.class.isAssignableFrom(getDelegate.getReturnType())) { return (ComputerLauncher) getDelegate.invoke(launcher); } } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } try { Method getLauncher = launcher.getClass().getMethod("getLauncher"); if (ComputerLauncher.class.isAssignableFrom(getLauncher.getReturnType())) { return (ComputerLauncher) getLauncher.invoke(launcher); } } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } return null; }
Source:
<code>protected String resolveSystemProperty(String key) { try { <START> String value = System.getProperty(key); <END> if (value == null) { value = System.getenv(key); } return value; } catch (Throwable ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Could not access system property '" + key + "': " + ex); } return null; } }</code><technical_language>above, GeoWebCacheExtensions.getProperty allow more options set a property</technical_language>

Target:
protected String resolveSystemProperty(String key) { try { String value = GeoWebCacheExtensions.getProperty(key); if (value == null) { value = System.getenv(key); } return value; } catch (Throwable ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Could not access system property '" + key + "': " + ex); } return null; } }
Source:
<code>public void testConfigurationWithFile() throws Exception { URL url = getClass().getClassLoader().getResource("hazelcast-default.yaml"); <START> assertNotNull(url); <END> String decodedURL = URLDecoder.decode(url.getFile(), "UTF-8"); System.setProperty("hazelcast.config", decodedURL); Config config = new YamlConfigBuilder().build(); URL file = new URL("file:"); URL encodedURL = new URL(file, decodedURL); assertEquals(encodedURL, config.getConfigurationUrl()); }</code><technical_language>Again, avoid assertions in middle of tests</technical_language>

Target:
public void testConfigurationWithFile() throws Exception { URL url = getClass().getClassLoader().getResource("hazelcast-default.yaml"); String decodedURL = URLDecoder.decode(url.getFile(), "UTF-8"); System.setProperty("hazelcast.config", decodedURL); Config config = new YamlConfigBuilder().build(); URL file = new URL("file:"); URL encodedURL = new URL(file, decodedURL); assertEquals(encodedURL, config.getConfigurationUrl()); }
Source:
<code>public void onBrowserEvent(Context context, Element parent, T value, NativeEvent event, ValueUpdater<T> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); int eventX = event.getClientX(); int eventY = event.getClientY(); if ("click".equals(event.getType())) { EventTarget eventTarget = event.getEventTarget(); if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) { menuPanelPopup.asPopupPanel().showAndFitToScreen(eventX, eventY); } } else if("mouseover".equals(event.getType())) { if (isVisible(value)) { parent.getStyle().setBorderColor("#96B7D6"); } } <START> else { END> parent.getStyle().setBorderColor("transparent"); } }</code><technical_language>NLS required</technical_language>

Target:
public void onBrowserEvent(Context context, Element parent, T value, NativeEvent event, ValueUpdater<T> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); int eventX = event.getClientX(); int eventY = event.getClientY(); if ("click".equals(event.getType())) { EventTarget eventTarget = event.getEventTarget(); if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) { menuPanelPopup.asPopupPanel().showAndFitToScreen(eventX, eventY); } } else if("mouseover".equals(event.getType())) { if (isVisible(value)) { parent.getFirstChildElement().getStyle().setBorderColor("#96B7D6"); } } else { parent.getFirstChildElement().getStyle().setBorderColor("transparent"); } }
Source:
<code>private List<Field> sortByFieldName(List<Field> fields) { <START> return fields.stream().sorted((o1, o2) -> o1.getName().compareTo(o2.getName())).collect(Collectors.toList()); <END> }</code><technical_language>Collections.sort(fields, (o1, o2) -> {})? save turn this a list a stream, a list</technical_language>

Target:
private List<Field> sortByFieldName(List<Field> fields) { Collections.sort(fields, Comparator.comparing(Field::getName)); return fields; }
Source:
<code>public static boolean isIdentitySample(Sample sample) { if (!isDetailedSample(sample)) return false; <START> return sample instanceof Identity || ((DetailedSample) sample).getSampleClass().getSampleCategory().equals(Identity.CATEGORY_NAME); <END> }</code><technical_language>Needs null checks. in methods</technical_language>

Target:
public static boolean isIdentitySample(Sample sample) { if (!isDetailedSample(sample)) return false; return sample instanceof Identity || safeCategoryCheck(sample, Identity.CATEGORY_NAME); }