auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Map<String, String> buildClientUserAgentMap() { String[] propertyNames = {"os.name", "os.version", "os.arch", "java.version", "java.vendor", "java.vm.version", "java.vm.vendor"}; Map<String, String> clientUserAgentMap = new HashMap<>(); for (String propertyName : propertyNames) { clientUserAgentMap.put(propertyName, System.getProperty(propertyName)); } clientUserAgentMap.put("bindings.version", Stripe.VERSION); clientUserAgentMap.put("lang", "Java"); clientUserAgentMap.put("publisher", "Stripe"); if (Stripe.getAppInfo() != null) { clientUserAgentMap.put("application", ApiResource.GSON.toJson(Stripe.getAppInfo())); } Set<String> keySet = new HashSet<>(clientUserAgentMap.keySet()); for (String key: keySet) { String value = clientUserAgentMap.get(key); clientUserAgentMap.remove(key); <START> String formattedKey = key.replace('.', '_'); <END> clientUserAgentMap.put(formattedKey, value); } return clientUserAgentMap; }</code><technical_language>This library's programming style dictates this variable definition top of this block, line declares value. move this line omit variable put key.replace() call clientUserAgentMap.put() call</technical_language>

Target:
private static Map<String, String> buildClientUserAgentMap() { String[] propertyNames = {"os.name", "os.version", "os.arch", "java.version", "java.vendor", "java.vm.version", "java.vm.vendor"}; Map<String, String> clientUserAgentMap = new HashMap<>(); for (String propertyName : propertyNames) { clientUserAgentMap.put(propertyName, System.getProperty(propertyName)); } clientUserAgentMap.put("bindings.version", Stripe.VERSION); clientUserAgentMap.put("lang", "Java"); clientUserAgentMap.put("publisher", "Stripe"); if (Stripe.getAppInfo() != null) { clientUserAgentMap.put("application", ApiResource.GSON.toJson(Stripe.getAppInfo())); } Set<String> keySet = new HashSet<>(clientUserAgentMap.keySet()); for (String key: keySet) { String value = clientUserAgentMap.get(key); String formattedKey = key.replace('.', '_'); clientUserAgentMap.remove(key); clientUserAgentMap.put(formattedKey, value); } return clientUserAgentMap; }
Source:
<code>public List<Project> getUserProjects(User user) { ArrayList<Project> array = new ArrayList<Project>(); List<Project> projects = getProjects(); <START> for (Project project : projects) { <END> Permission perm = project.getUserPermission(user); if (perm != null && (perm.isPermissionSet(Type.ADMIN) || perm .isPermissionSet(Type.READ))) { array.add(project); } } return array; }</code><technical_language>safe combine</technical_language>

Target:
public List<Project> getUserProjects(User user) { ArrayList<Project> userProjects = new ArrayList<>(); for (Project project : getProjects()) { Permission perm = project.getUserPermission(user); if (perm != null && (perm.isPermissionSet(Type.ADMIN) || perm .isPermissionSet(Type.READ))) { userProjects.add(project); } } return userProjects; }
Source:
<code>public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); <START> if (calledFunction.getSymbol() instanceof ITmfStateValue) { <END> ITmfStateValue symbol = ((ITmfStateValue) calledFunction.getSymbol()); switch (symbol.getType()) { case LONG: Long longAddress = symbol.unboxLong(); symbolText = provider.getSymbolText(longAddress); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } return symbolText; case STRING: return symbol.unboxStr(); case INTEGER: Integer intAddress = symbol.unboxInt(); symbolText = provider.getSymbolText(intAddress); if (symbolText == null) { return "0x" + Integer.toHexString(intAddress); } return symbolText; case DOUBLE: case NULL: case CUSTOM: default: break; } } } } return null; }</code><technical_language>this a Long String now</technical_language>

Target:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; Object symbol = calledFunction.getSymbol(); if (symbol instanceof Long) { Long longAddress = (Long)symbol; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); symbolText = provider.getSymbolText(longAddress); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } return symbolText; } return String.valueOf(symbol); } } return null; }
Source:
<code>public Optional<String> getCurrentSuggestion() { <START> if (currentSuggestionIndex.isPresent() && isValidSuggestionIndex()) { <END> return Optional.of(getSuggestedLabel()); } return Optional.empty(); }</code><technical_language>isValidSuggestionIndex() checked in assertion, a programmer error if returns false</technical_language>

Target:
public Optional<String> getCurrentSuggestion() { if (currentSuggestionIndex.isPresent()) { assert isValidSuggestionIndex(); return Optional.of(getSuggestedLabel()); } return Optional.empty(); }
Source:
<code>public void handle_shouldUnvoidMembersAssociatedWithThePatient() throws Exception { executeDataSet(COHORT_XML); CohortService cs = Context.getCohortService(); Cohort cohort = cs.getCohort(2); Patient patient = Context.getPatientService().getPatient(7); CohortMembership membership = new CohortMembership(patient); cs.addMembershipToCohort(cohort, membership); Assert.assertTrue(cohort.contains(patient)); patient = Context.getPatientService().voidPatient(patient, "Void Reason"); Assert.assertTrue(patient.getVoided()); Assert.assertTrue(membership.getVoided()); Assert.assertNotNull(membership.getDateVoided()); Assert.assertNotNull(membership.getVoidedBy()); Assert.assertNotNull(membership.getVoidReason()); <START> patient.setVoided(false); <END> User user = Context.getUserService().getUser(1); new PatientDataUnvoidHandler().handle(patient, user, patient.getDateVoided(), null); Assert.assertFalse(membership.getVoided()); Assert.assertNull(membership.getDateVoided()); Assert.assertNull(membership.getVoidedBy()); Assert.assertNull(membership.getVoidReason()); }</code><technical_language>get rid of line 175 job of code call that, reality is AOP unvoid method reset fields, this reason test is troubling you</technical_language>

Target:
public void handle_shouldUnvoidMembersAssociatedWithThePatient() throws Exception { executeDataSet(COHORT_XML); CohortService cs = Context.getCohortService(); Cohort cohort = cs.getCohort(2); Patient patient = Context.getPatientService().getPatient(7); CohortMembership membership = new CohortMembership(patient.getPatientId()); cs.addMembershipToCohort(cohort, membership); Assert.assertTrue(cohort.contains(patient)); patient = Context.getPatientService().voidPatient(patient, "Void Reason"); Assert.assertTrue(patient.getVoided()); Assert.assertTrue(membership.getVoided()); Assert.assertNotNull(membership.getDateVoided()); Assert.assertNotNull(membership.getVoidedBy()); Assert.assertNotNull(membership.getVoidReason()); Context.getPatientService().unvoidPatient(patient); Assert.assertFalse(membership.getVoided()); Assert.assertNull(membership.getDateVoided()); Assert.assertNull(membership.getVoidedBy()); Assert.assertNull(membership.getVoidReason()); }
Source:
<code>private String load(IResource resource) { IProject project = resource.getProject(); String dcName = ResourceUtils.getDeploymentConfigNameFor(resource); if (StringUtils.isEmpty(dcName)) { return null; } IDeploymentConfig dc = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, project.getName(), dcName); if (dc == null) { return null; } <START> IDeploymentImageChangeTrigger trigger = getImageChangeTrigger(dc.getTriggers()); <END> if (trigger == null) { return null; } DockerImageURI uri = trigger.getFrom(); return getImageStreamTag(uri, resource.getNamespace()); }</code><technical_language>@adietish i remove</technical_language>

Target:
private String load(IResource resource) throws CoreException { IDeploymentConfig dc = ResourceUtils.getDeploymentConfigFor(resource, connection); if (dc == null) { return null; } IDeploymentImageChangeTrigger trigger = getImageChangeTrigger(dc.getTriggers()); if (trigger == null) { return null; } DockerImageURI uri = trigger.getFrom(); return getImageStreamTag(uri, resource.getNamespace()); }
Source:
<code>private Description convertMethodInvocations( Symbol.MethodSymbol methodSymbol, MethodInvocationTree methodInvocation, LambdaExpressionTree root, VisitorState state) { List<Symbol> methodParams = getSymbols(methodInvocation.getArguments()); List<Symbol> lambdaParam = getSymbols(root.getParameters()); if (!methodParams.equals(lambdaParam)) { return Description.NO_MATCH; } <START> boolean isLocal = ASTHelpers.getReceiver(methodInvocation) == null; <END> return buildDescription(root) .setMessage(MESSAGE) .addFix(buildFix(methodSymbol, methodInvocation, root, state, isLocal)) .build(); }</code><technical_language>I handle a receiver IdentifierTree name "this" well. Worth a test case if (review thumbs)</technical_language>

Target:
private Description convertMethodInvocations( Symbol.MethodSymbol methodSymbol, MethodInvocationTree methodInvocation, LambdaExpressionTree root, VisitorState state) { List<Symbol> methodParams = getSymbols(methodInvocation.getArguments()); List<Symbol> lambdaParam = getSymbols(root.getParameters()); if (!methodParams.equals(lambdaParam)) { return Description.NO_MATCH; } return buildFix(methodSymbol, methodInvocation, root, state, isLocal(methodInvocation)) .map(fix -> buildDescription(root).setMessage(MESSAGE).addFix(fix).build()) .orElse(Description.NO_MATCH); }
Source:
<code>public void addError(AuditEvent event) { final String xpathQuery = XpathFileGeneratorAstFilter.findCorrespondingXpathQuery(event); if (xpathQuery != null) { printXmlHeader(); final File file = new File(event.getFileName()); writer.println("<suppress-xpath"); writer.print(" files=\""); writer.print(file.getName()); writer.println(QUOTE_CHAR); final String checkName = PackageObjectFactory.getShortFromFullModuleNames(event.getSourceName()); writer.print(" checks=\""); writer.print(checkName); writer.println(QUOTE_CHAR); if (event.getModuleId() != null) { writer.print(" id=\""); writer.print(event.getModuleId()); <START> writer.println(QUOTE_CHAR); <END> } writer.print(" query=\""); writer.print(xpathQuery); writer.println("\"/>"); } }</code><technical_language>@romani print check name if module id is populated? display check name in violation if id is given</technical_language>

Target:
public void addError(AuditEvent event) { final String xpathQuery = XpathFileGeneratorAstFilter.findCorrespondingXpathQuery(event); if (xpathQuery != null) { printXmlHeader(); final File file = new File(event.getFileName()); writer.println("<suppress-xpath"); writer.print(" files=\""); writer.print(file.getName()); writer.println(QUOTE_CHAR); if (event.getModuleId() == null) { final String checkName = PackageObjectFactory.getShortFromFullModuleNames(event.getSourceName()); writer.print(" checks=\""); writer.print(checkName); } else { writer.print(" id=\""); writer.print(event.getModuleId()); } writer.println(QUOTE_CHAR); writer.print(" query=\""); writer.print(xpathQuery); writer.println("\"/>"); } }
Source:
<code>@Test void testFilterWithProject() { assertModel(MODEL) <START> .with(CalciteConnectionProperty.TOP_DOWN_OPT.camelName(), false) <END> .query("SELECT STREAM MSG_PARTITION,MSG_OFFSET,MSG_VALUE_BYTES FROM KAFKA.MOCKTABLE" + " WHERE MSG_OFFSET>0") .limit(1) .returnsUnordered( "MSG_PARTITION=0; MSG_OFFSET=1; MSG_VALUE_BYTES=myvalue1") .explainContains( "PLAN=EnumerableCalc(expr#0..4=[{inputs}], expr#5=[0], expr#6=[>($t2, $t5)], MSG_PARTITION=[$t0], MSG_OFFSET=[$t2], MSG_VALUE_BYTES=[$t4], $condition=[$t6])\n" + " EnumerableInterpreter\n" + " BindableTableScan(table=[[KAFKA, MOCKTABLE, (STREAM)]])"); }</code><technical_language>@XuQianJin-Stars Do insight</technical_language>

Target:
@Test void testFilterWithProject() { assertModel(MODEL) .with(CalciteConnectionProperty.TOPDOWN_OPT.camelName(), false) .query("SELECT STREAM MSG_PARTITION,MSG_OFFSET,MSG_VALUE_BYTES FROM KAFKA.MOCKTABLE" + " WHERE MSG_OFFSET>0") .limit(1) .returnsUnordered( "MSG_PARTITION=0; MSG_OFFSET=1; MSG_VALUE_BYTES=myvalue1") .explainContains( "PLAN=EnumerableCalc(expr#0..4=[{inputs}], expr#5=[0], expr#6=[>($t2, $t5)], MSG_PARTITION=[$t0], MSG_OFFSET=[$t2], MSG_VALUE_BYTES=[$t4], $condition=[$t6])\n" + " EnumerableInterpreter\n" + " BindableTableScan(table=[[KAFKA, MOCKTABLE, (STREAM)]])"); }
Source:
<code>public void dump(Protocol protocol) { TP tp = (TP) protocol; boolean dump = false; <START> dump = checkThreadPool((ThreadPoolExecutor) tp.getThreadPool(), "Regular") || dump; <END> try { Field f = TP.class.getDeclaredField("internal_pool"); f.setAccessible(true); dump = checkThreadPool((ThreadPoolExecutor) f.get(tp), "Internal") || dump; } catch (Exception e) { log.error("Failed to get internal pool"); } TimeScheduler timer = tp.getTimer(); try { Field f = timer.getClass().getDeclaredField("pool"); f.setAccessible(true); dump = checkThreadPool((ThreadPoolExecutor) f.get(timer), "Timer") || dump; } catch (Exception e) { log.error("Failed to get timer thread pool: " + timer.getClass()); } if (dump) Utils.threadDump(); }</code><technical_language>I call "JGroups" "Common", handles regular OOB messages</technical_language>

Target:
public void dump(Protocol protocol) { TP tp = (TP) protocol; boolean dump = false; dump = checkThreadPool((ThreadPoolExecutor) tp.getThreadPool(), "JGroups") || dump; try { Field f = TP.class.getDeclaredField("internal_pool"); f.setAccessible(true); dump = checkThreadPool((ThreadPoolExecutor) f.get(tp), "Internal") || dump; } catch (Exception e) { log.error("Failed to get internal pool"); } TimeScheduler timer = tp.getTimer(); try { Field f = timer.getClass().getDeclaredField("pool"); f.setAccessible(true); dump = checkThreadPool((ThreadPoolExecutor) f.get(timer), "Timer") || dump; } catch (Exception e) { log.error("Failed to get timer thread pool: " + timer.getClass()); } if (dump) Utils.threadDump(); }
Source:
<code>public void write(CorfuPayloadMsg<WriteRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { <START> log.trace("log write: global: {}, streams: {}", msg.getPayload().getToken(), <END> msg.getPayload().getData().getBackpointerMap()); try { LogData logData = (LogData) msg.getPayload().getData(); logData.setEpoch(msg.getEpoch()); dataCache.put(msg.getPayload().getGlobalAddress(), logData); r.sendResponse(ctx, msg, CorfuMsgType.WRITE_OK.msg()); } catch (OverwriteException ex) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_OVERWRITE.payloadMsg(ex.getOverWriteCause().getId())); } catch (DataOutrankedException e) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_OUTRANKED.msg()); } catch (ValueAdoptedException e) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_VALUE_ADOPTED.payloadMsg(e .getReadResponse())); } }</code><technical_language>this debug level</technical_language>

Target:
public void write(CorfuPayloadMsg<WriteRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { log.debug("log write: global: {}, streams: {}", msg.getPayload().getToken(), msg.getPayload().getData().getBackpointerMap()); try { LogData logData = (LogData) msg.getPayload().getData(); logData.setEpoch(msg.getEpoch()); dataCache.put(msg.getPayload().getGlobalAddress(), logData); r.sendResponse(ctx, msg, CorfuMsgType.WRITE_OK.msg()); } catch (OverwriteException ex) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_OVERWRITE.payloadMsg(ex.getOverWriteCause().getId())); } catch (DataOutrankedException e) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_OUTRANKED.msg()); } catch (ValueAdoptedException e) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_VALUE_ADOPTED.payloadMsg(e .getReadResponse())); } }
Source:
<code>private static ExpressionEvaluator getExpressionEvaluator(String transformExpression) { ExpressionEvaluator expressionEvaluator = null; <START> if (transformExpression != null && !transformExpression.isEmpty()) { <END> if (transformExpression.startsWith(GroovyExpressionEvaluator.getGroovyExpressionPrefix())) { expressionEvaluator = new GroovyExpressionEvaluator(transformExpression); } } return expressionEvaluator; }</code><technical_language>(nit) transformExpression null. Suggest moving this check caller</technical_language>

Target:
private static ExpressionEvaluator getExpressionEvaluator(String transformExpression) { ExpressionEvaluator expressionEvaluator = null; if (transformExpression.startsWith(GroovyExpressionEvaluator.getGroovyExpressionPrefix())) { expressionEvaluator = new GroovyExpressionEvaluator(transformExpression); } return expressionEvaluator; }
Source:
<code>void close() { <START> isOpen.set(false); <END> Iterator<DeleteOperation> iter = operationIdTodeleteOperation.values().iterator(); while (iter.hasNext()) { DeleteOperation deleteOperation = iter.next(); NonBlockingRouter.completeOperation(deleteOperation.getFutureResult(), deleteOperation.getCallback(), null, new RouterException("Cannot process operation because Router is closed.", RouterErrorCode.RouterClosed)); iter.remove(); } }</code><technical_language>do this a compareAndSet() if block</technical_language>

Target:
void close() { if (isOpen.compareAndSet(true, false)) { Iterator<DeleteOperation> iter = deleteOperations.iterator(); while (iter.hasNext()) { DeleteOperation deleteOperation = iter.next(); NonBlockingRouter.completeOperation(deleteOperation.getFutureResult(), deleteOperation.getCallback(), null, new RouterException("Aborted operation because Router is closed.", RouterErrorCode.RouterClosed)); iter.remove(); } } }
Source:
<code>public Double getDouble() { if (byteBuffer.position() + 8 > limit) { <START> throw new LimitReachedException(); <END> } long aLong = byteBuffer.getLong(); return Double.longBitsToDouble(aLong); }</code><technical_language>checks limit. wrong limit a ByteBuffer built in? wrong BufferUnderflowException getLong give you</technical_language>

Target:
public Double getDouble() { if (byteBuffer.position() + 8 > limit) { throw new LimitReachedException(); } return byteBuffer.getDouble(); }
Source:
<code>public void testNotEnoughForMultipleDiskAndDomainsAllDomainsFail() { <START> ArrayList<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, 4); <END> imagesDisks.addAll(mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID2, 4)); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(10, STORAGE_DOMAIN_ID); mockStorageDomainDAOGetForStoragePool(10, STORAGE_DOMAIN_ID2); assertFalse("Validation should fail. Second domain should not have enough free space for request.", cmd.isEnoughSpaceToMergeSnapshots()); }</code><technical_language>this defined a List<DiskImage></technical_language>

Target:
public void testNotEnoughForMultipleDiskAndDomainsAllDomainsFail() { List<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, IMAGE_ACTUAL_SIZE_GB); imagesDisks.addAll(mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID2, IMAGE_ACTUAL_SIZE_GB)); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(10, STORAGE_DOMAIN_ID); mockStorageDomainDAOGetForStoragePool(10, STORAGE_DOMAIN_ID2); assertFalse("Validation should fail. Second domain should not have enough free space for request.", cmd.isEnoughSpaceToMergeSnapshots()); }
Source:
<code>public MappingProject cloneMappingProject(String mappingProjectId) { MappingProject mappingProject = mappingProjectRepository.getMappingProject(mappingProjectId); if (mappingProject == null) { <START> throw new UnknownMappingProjectException(mappingProjectId); <END> } String mappingProjectName = mappingProject.getName(); String clonedMappingProjectName; for (int i = 1; ; ++i) { if (i == 1) { clonedMappingProjectName = mappingProjectName + " - Copy"; } else { clonedMappingProjectName = mappingProjectName + " - Copy (" + i + ")"; } if (mappingProjectRepository.getMappingProjects(new QueryImpl<>().eq(NAME, clonedMappingProjectName)) .isEmpty()) { break; } } return cloneMappingProject(mappingProject, clonedMappingProjectName); }</code><technical_language>another case for UnknownEntityException</technical_language>

Target:
public MappingProject cloneMappingProject(String mappingProjectId) { MappingProject mappingProject = mappingProjectRepository.getMappingProject(mappingProjectId); if (mappingProject == null) { throw new UnknownEntityException(mappingProjectMetaData, mappingProjectId); } String mappingProjectName = mappingProject.getName(); String clonedMappingProjectName; for (int i = 1; ; ++i) { if (i == 1) { clonedMappingProjectName = mappingProjectName + " - Copy"; } else { clonedMappingProjectName = mappingProjectName + " - Copy (" + i + ")"; } if (mappingProjectRepository.getMappingProjects(new QueryImpl<>().eq(NAME, clonedMappingProjectName)) .isEmpty()) { break; } } return cloneMappingProject(mappingProject, clonedMappingProjectName); }
Source:
<code>public void testGetStartingSequenceNumberWhereCrossSettingStartNumberIsNull() { this.crossSetting.getCrossNameSetting().setStartNumber(null); final CrossNameSetting setting = new CrossNameSetting(); <START> setting.setStartNumber(0); <END> setting.setPrefix("A"); final int startingSequenceNumber = this.crossingService.getStartingSequenceNumber(setting); Assert.assertEquals("The starting sequence number should be " + startingSequenceNumber, CrossingServiceImplTest.NEXT_NUMBER.intValue(), startingSequenceNumber); }</code><technical_language>In this test, start number is null zero. Please create a test is null</technical_language>

Target:
public void testGetStartingSequenceNumberWhereCrossSettingStartNumberIsNull() { final CrossNameSetting setting = new CrossNameSetting(); setting.setStartNumber(null); setting.setPrefix("A"); final int startingSequenceNumber = this.crossingService.getStartingSequenceNumber(setting); Assert.assertEquals("The starting sequence number should be " + startingSequenceNumber, CrossingServiceImplTest.NEXT_NUMBER.intValue(), startingSequenceNumber); }
Source:
<code>public void cloneForRevision_shouldSetAllTheRelevantFields() throws Exception { DrugOrder drugOrder = new DrugOrder(); Drug drug = new Drug(); drug.setConcept(new Concept()); drugOrder.setDrug(drug); OrderTest.assertThatAllFieldsAreCopied(drugOrder, "cloneForRevision", "creator", "dateCreated", "action", "changedBy", "dateChanged", "voided", "dateVoided", "voidedBy", "voidReason", "encounter", "orderNumber", <START> "orderer", "previousOrder", "dateActivated", "dateStopped", "accessionNumber", "orderGroup", <END> "sortWeight"); }</code><technical_language>here, orderGroup sortWeight need cloned undo this change</technical_language>

Target:
public void cloneForRevision_shouldSetAllTheRelevantFields() throws Exception { DrugOrder drugOrder = new DrugOrder(); Drug drug = new Drug(); drug.setConcept(new Concept()); drugOrder.setDrug(drug); OrderTest.assertThatAllFieldsAreCopied(drugOrder, "cloneForRevision", "creator", "dateCreated", "action", "changedBy", "dateChanged", "voided", "dateVoided", "voidedBy", "voidReason", "encounter", "orderNumber", "orderer", "previousOrder", "dateActivated", "dateStopped", "accessionNumber"); }
Source:
<code><START> private void logFormStartEvent(boolean isFormReload){ <END> try { JSONObject eventDetails = new JSONObject(); eventDetails.put("patientuuid", formData.getPatientUuid()); eventDetails.put("formDataUuid", formData.getUuid()); if (isEncounterForm()) { if(isFormReload) { logEvent("RESUME_ENCOUNTER_FORM", eventDetails.toString()); } else { logEvent("OPEN_ENCOUNTER_FORM", eventDetails.toString()); } } else { if(isFormReload) { logEvent("RESUME_REGISTRATION_FORM", eventDetails.toString()); } else { logEvent("OPEN_REGISTRATION_FORM", eventDetails.toString()); } } } catch (JSONException e) { Log.e(getClass().getSimpleName(),"Cannot create log",e); } }</code><technical_language>I add demographic update relationship forms also. logged encounter forms currently done</technical_language>

Target:
private void logFormStartEvent(boolean isFormReload){ try { JSONObject eventDetails = new JSONObject(); eventDetails.put("patientuuid", formData.getPatientUuid()); eventDetails.put("formDataUuid", formData.getUuid()); eventDetails.put("formDiscriminator", formData.getDiscriminator()); if(isFormReload) { logEvent("RESUME_FORM", eventDetails.toString()); } else { logEvent("OPEN_FORM", eventDetails.toString()); } } catch (JSONException e) { Log.e(getClass().getSimpleName(),"Cannot create event log",e); } }
Source:
<code>public void onUserRestrictionsChanged() { final Bundle restrictions = mUserManager.getUserRestrictions(); final boolean newlyDisallowed = restrictions.getBoolean(UserManager.DISALLOW_CONFIG_TETHERING); final boolean prevDisallowed = mDisallowTethering; mDisallowTethering = newlyDisallowed; final boolean tetheringDisallowedChanged = (newlyDisallowed != prevDisallowed); if (!tetheringDisallowedChanged) { return; } if (!newlyDisallowed) { mNotificationUpdater.tetheringRestrictionLifted(); return; } mNotificationUpdater.notifyTetheringDisabledByRestriction(); <START> if (mWrapper.getTetheredIfaces().length != 0) { <END> mWrapper.untetherAll(); } }</code><technical_language>This is reaching pretty deep implementation detail of "wrapper". untetherAll() idempotent ? If is, call always</technical_language>

Target:
public void onUserRestrictionsChanged() { final Bundle restrictions = mUserManager.getUserRestrictions(); final boolean newlyDisallowed = restrictions.getBoolean(UserManager.DISALLOW_CONFIG_TETHERING); final boolean prevDisallowed = mDisallowTethering; mDisallowTethering = newlyDisallowed; final boolean tetheringDisallowedChanged = (newlyDisallowed != prevDisallowed); if (!tetheringDisallowedChanged) { return; } if (!newlyDisallowed) { mNotificationUpdater.tetheringRestrictionLifted(); return; } mNotificationUpdater.notifyTetheringDisabledByRestriction(); mWrapper.untetherAll(); }
Source:
<code>public StartupErrorFilterModel(Throwable t) { errorAtStartup = t; StringWriter sw = new StringWriter(); log.error(t); <START> stacktrace = sw.toString(); <END> }</code><technical_language>This call log.error(t). set stacktrace = ExceptionUtil.getStackTrace(t);</technical_language>

Target:
public StartupErrorFilterModel(Throwable t) { errorAtStartup = t; stacktrace = ExceptionUtils.getStackTrace(t); }
Source:
<code>private void checkVersion(Object migrationMechanism, String expectedVersion) { Field field = migrationMechanism.getClass().getDeclaredFields()[0]; field.setAccessible(true); try { Object version = field.get(migrationMechanism); assertEquals("The migration mechanism doesn't have the expected version", expectedVersion, version); } catch (IllegalArgumentException e) { <START> e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); <END> } }</code><technical_language>replaced fail() calls</technical_language>

Target:
private void checkVersion(Object migrationMechanism, String expectedVersion) { Field field = migrationMechanism.getClass().getDeclaredFields()[0]; field.setAccessible(true); try { Object version = field.get(migrationMechanism); assertEquals("The migration mechanism doesn't have the expected version", expectedVersion, version); } catch (IllegalArgumentException e) { fail("Cannot verify the migration version: " + e.getMessage()); } catch (SecurityException e) { fail("Cannot verify the migration version: " + e.getMessage()); } catch (IllegalAccessException e) { fail("Cannot verify the migration version: " + e.getMessage()); } }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder("---------------- SyntaxContainer ---------------------"); <START> sb.append("\n"); <END> sb.append("mOrigText = "); sb.append(mOrigText); sb.append(LINE_SEPARATOR); sb.append("Valid = "); sb.append(Boolean.toString(mValid)); sb.append(LINE_SEPARATOR); sb.append("Error = "); sb.append(mError.toString()); sb.append(LINE_SEPARATOR); sb.append("CrossRefObjlist = "); for (String cro : getCrossRefObjList()) { sb.append(cro + ", "); } sb.append("Syntax object list:"); for (SyntaxObject obj : mObjList) { sb.append(" "); sb.append(LINE_SEPARATOR); sb.append(obj.toString()); } return sb.toString(); }</code><technical_language>replace this LINE_SEPARATOR</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder("---------------- SyntaxContainer ---------------------"); sb.append(LINE_SEPARATOR); sb.append("mOrigText = "); sb.append(mOrigText); sb.append(LINE_SEPARATOR); sb.append("Valid = "); sb.append(Boolean.toString(mValid)); sb.append(LINE_SEPARATOR); sb.append("Error = "); sb.append(mError.toString()); sb.append(LINE_SEPARATOR); sb.append("CrossRefObjlist = "); for (String cro : getCrossRefObjList()) { sb.append(cro).append(", "); } sb.append("Syntax object list:"); for (SyntaxObject obj : mObjList) { sb.append(" "); sb.append(LINE_SEPARATOR); sb.append(obj.toString()); } return sb.toString(); }
Source:
<code>public static boolean isUpdateShow(String showId, long currentTime, Context context) { final Cursor show = context.getContentResolver().query(Shows.buildShowUri(showId), new String[] { Shows._ID, Shows.LASTUPDATED }, null, null, null); boolean update = false; if (show != null) { if (show.moveToFirst()) { long lastUpdateTime = show.getLong(1); if (currentTime - lastUpdateTime > DateUtils.HOUR_IN_MILLIS * 12) { <START> update = true; <END> } } show.close(); } return update; }</code><technical_language>is this slipping by? mistakes playing catch-up..</technical_language>

Target:
public static boolean isUpdateShow(String showId, long currentTime, Context context) { final Cursor show = context.getContentResolver().query(Shows.buildShowUri(showId), new String[] { Shows._ID, Shows.LASTUPDATED }, null, null, null); boolean isUpdate = false; if (show != null) { if (show.moveToFirst()) { long lastUpdateTime = show.getLong(1); if (currentTime - lastUpdateTime > DateUtils.HOUR_IN_MILLIS * 12) { isUpdate = true; } } show.close(); } return isUpdate; }
Source:
<code>public List<Patient> getAll() { List<Patient> patients = new ArrayList<>(); try { session = hibernateUtil.getSessionFactory().openSession(); Query query = session.createQuery("select new Patient(p) from Patient p"); patients = query.list(); <START> LOG.trace("DAO-getAll-patients-count: " + patients.size()); <END> } catch (HibernateException e) { LOG.error("Could not retrieve users: {}", e.getLocalizedMessage(), e); } finally { HibernateUtil.closeSession(session, false); } return patients; }</code><technical_language>missing log's parameter</technical_language>

Target:
public List<Patient> getAll() { List<Patient> patients = new ArrayList<>(); try { session = hibernateUtil.getSessionFactory().openSession(); Query query = session.createQuery("select new Patient(p) from Patient p"); patients = query.list(); LOG.trace("DAO-getAll-patients-count: {}" , patients.size()); } catch (HibernateException e) { LOG.error("Could not retrieve users: {}", e.getLocalizedMessage(), e); } finally { HibernateUtil.closeSession(session, false); } return patients; }
Source:
<code>private boolean isValidWeightSize() { if (rubricWeightsForEachCell.size() != numOfRubricSubQuestions) { return false; } for (int i = 0; i < rubricWeightsForEachCell.size(); i++) { <START> if (rubricWeightsForEachCell.get(i).size() != numOfRubricChoices) { <END> return false; } } return true; }</code><technical_language>stream allMatch code clearer here? :D</technical_language>

Target:
private boolean isValidWeightSize() { if (rubricWeightsForEachCell.size() != numOfRubricSubQuestions) { return false; } return rubricWeightsForEachCell.stream().allMatch(x -> x.size() == numOfRubricChoices); }
Source:
<code>private AuditLogable createExternalMacsAuditLog(VM vm, Set<String> externalMacs) { AuditLogable logable = new AuditLogableImpl(); <START> logable.setVmName(vm.getName()); <END> logable.addCustomValue("MACAddr", externalMacs.stream().collect(Collectors.joining(", "))); return logable; }</code><technical_language>pls maintain VM ID, in addition name: logable.setVmId(vm.getId());</technical_language>

Target:
private AuditLogable createExternalMacsAuditLog(VM vm, Set<String> externalMacs) { AuditLogable logable = new AuditLogableImpl(); logable.setVmId(vm.getId()); logable.setVmName(vm.getName()); logable.addCustomValue("MACAddr", externalMacs.stream().collect(Collectors.joining(", "))); return logable; }
Source:
<code>public @ResponseBody CacheStatus getCacheStatus() { CacheStatus response = new CacheStatus(); CacheManager manager = CacheManager.getInstance(); boolean anyPending = false; List<String> cacheNames = CacheInitializor.getPreInitializedCaches(); <START> for(int i = 0; i < cacheNames.size(); i++) { <END> Cache currCache = manager.getCache(cacheNames.get(i)); if(currCache == null || currCache.getKeysNoDuplicateCheck().size() == 0) { anyPending = true; } } if(anyPending) { response.setStatus(CacheStatusName.PENDING.name()); } else { response.setStatus(CacheStatusName.OK.name()); } return response; }</code><technical_language>I minor, checkstyle complains if( instead of if ( similarly for/try/catch/etc</technical_language>

Target:
public @ResponseBody CacheStatus getCacheStatus() { CacheStatus response = new CacheStatus(); CacheManager manager = CacheManager.getInstance(); boolean anyPending = false; List<String> cacheNames = CacheInitializor.getPreInitializedCaches(); for (int i = 0; i < cacheNames.size(); i++) { Cache currCache = manager.getCache(cacheNames.get(i)); if (currCache == null || currCache.getKeysNoDuplicateCheck().size() == 0) { anyPending = true; } } if (anyPending) { response.setStatus(CacheStatusName.INITIALIZING.name()); } else { response.setStatus(CacheStatusName.OK.name()); } return response; }
Source:
<code><START> public void testAssignable() { <END> System.out.println("Integer.class.isAssignable: " + Integer.class.isAssignableFrom(Number.class)); System.out.println("Number.class.isAssignable : " + Number.class.isAssignableFrom(Integer.class)); System.out.println("Double.class.isAssignable : " + Double.class.isAssignableFrom(Integer.class)); System.out.println("Integer.class.isAssignable: " + Integer.class.isAssignableFrom(Double.class)); System.out.println("Number.class.isAssignable : " + Number.class.isAssignableFrom(int.class)); System.out.println("Integer.class.isAssignable: " + Integer.class.isAssignableFrom(int.class)); System.out.println("int.class.isAssignable : " + int.class.isAssignableFrom(Integer.class)); }</code><technical_language>this test assert anything, I remove it</technical_language>

Target:
public void testAssignable() { assertFalse("Integer.class.isAssignable: ", Integer.class.isAssignableFrom(Number.class)); assertTrue("Number.class.isAssignable : ", Number.class.isAssignableFrom(Integer.class)); assertFalse("Double.class.isAssignable : ", Double.class.isAssignableFrom(Integer.class)); assertFalse("Integer.class.isAssignable: ", Integer.class.isAssignableFrom(Double.class)); assertFalse("Number.class.isAssignable : ", Number.class.isAssignableFrom(int.class)); assertFalse("Integer.class.isAssignable: ", Integer.class.isAssignableFrom(int.class)); assertFalse("int.class.isAssignable : ", int.class.isAssignableFrom(Integer.class)); }
Source:
<code>private Set<Guid> getVolumeChain() { List<String> vmIds = new ArrayList<>(); vmIds.add(getParameters().getVmId().toString()); VDS vds = getVdsDAO().get(getParameters().getVdsId()); Map[] vms = (Map[]) (new FullListVDSCommand<>( <START> new FullListVDSCommandParameters(vds, vmIds)).executeWithReturnValue()); <END> if (vms == null || vms.length == 0) { log.error("Failed to retrieve VM information"); return null; } Map vm = (Map) vms[0]; if (vm == null || vm.get(VdsProperties.vm_guid) == null) { log.error("Received incomplete VM information"); return null; } Guid vmId = new Guid((String) vm.get(VdsProperties.vm_guid)); if (!vmId.equals(getParameters().getVmId())) { log.error("Invalid VM returned when querying status: expected '{}', got '{}'", getParameters().getVmId(), vmId); return null; } Set<Guid> images = new HashSet<>(); DiskImage activeDiskImage = getParameters().getActiveImage(); for (Object o : (Object[]) vm.get(VdsProperties.Devices)) { Map device = (Map<String, Object>) o; if (VdsProperties.Disk.equals(device.get(VdsProperties.Type)) && activeDiskImage.getId().equals(Guid.createGuidFromString( (String) device.get(VdsProperties.ImageId)))) { Object[] volumeChain = (Object[]) device.get("volumeChain"); for (Object v : volumeChain) { Map<String, Object> volume = (Map<String, Object>) v; images.add(Guid.createGuidFromString((String) volume.get(VdsProperties.VolumeId))); } break; } } return images; }</code><technical_language>changing well</technical_language>

Target:
private Set<Guid> getVolumeChain() { List<String> vmIds = new ArrayList<>(); vmIds.add(getParameters().getVmId().toString()); VDS vds = getVdsDAO().get(getParameters().getVdsId()); Map[] vms = (Map[]) runVdsCommand( VDSCommandType.FullList, new FullListVDSCommandParameters(vds, vmIds)).getReturnValue(); if (vms == null || vms.length == 0) { log.error("Failed to retrieve VM information"); return null; } Map vm = (Map) vms[0]; if (vm == null || vm.get(VdsProperties.vm_guid) == null) { log.error("Received incomplete VM information"); return null; } Guid vmId = new Guid((String) vm.get(VdsProperties.vm_guid)); if (!vmId.equals(getParameters().getVmId())) { log.error("Invalid VM returned when querying status: expected '{}', got '{}'", getParameters().getVmId(), vmId); return null; } Set<Guid> images = new HashSet<>(); DiskImage activeDiskImage = getParameters().getActiveImage(); for (Object o : (Object[]) vm.get(VdsProperties.Devices)) { Map device = (Map<String, Object>) o; if (VdsProperties.Disk.equals(device.get(VdsProperties.Type)) && activeDiskImage.getId().equals(Guid.createGuidFromString( (String) device.get(VdsProperties.ImageId)))) { Object[] volumeChain = (Object[]) device.get("volumeChain"); for (Object v : volumeChain) { Map<String, Object> volume = (Map<String, Object>) v; images.add(Guid.createGuidFromString((String) volume.get(VdsProperties.VolumeId))); } break; } } return images; }
Source:
<code>protected void calcRepulsion(N node1) { Point fvd1 = getFRData(node1); if (fvd1 == null) { return; } frNodeData.put(node1, Point.ORIGIN); ForceObject<N> nodeForceObject = new ForceObject(node1, layoutModel.apply(node1)) { @Override <START> protected void addForceFrom(ForceObject other, Optional userData) { <END> double dx = this.p.x - other.p.x; double dy = this.p.y - other.p.y; log.trace("dx, dy:{},{}", dx, dy); double dist = Math.sqrt(dx * dx + dy * dy); dist = Math.max(EPSILON, dist); log.trace("dist:{}", dist); double force = (repulsion_constant * repulsion_constant) / dist; log.trace("force:{}", force); f = f.add(force * (dx / dist), force * (dy / dist)); } }; tree.visit(nodeForceObject, Optional.empty()); frNodeData.put(node1, nodeForceObject.f); }</code><technical_language>purpose of Optional user data? AFAICT used, in wrong places</technical_language>

Target:
protected void calcRepulsion(N node1) { Point fvd1 = getFRData(node1); if (fvd1 == null) { return; } frNodeData.put(node1, Point.ORIGIN); ForceObject<N> nodeForceObject = new ForceObject(node1, layoutModel.apply(node1)) { @Override protected void addForceFrom(ForceObject other) { double dx = this.p.x - other.p.x; double dy = this.p.y - other.p.y; log.trace("dx, dy:{},{}", dx, dy); double dist = Math.sqrt(dx * dx + dy * dy); dist = Math.max(EPSILON, dist); log.trace("dist:{}", dist); double force = (repulsion_constant * repulsion_constant) / dist; log.trace("force:{}", force); f = f.add(force * (dx / dist), force * (dy / dist)); } }; tree.visit(nodeForceObject); frNodeData.put(node1, nodeForceObject.f); }
Source:
<code>public void setReturnValueFailure(VDSReturnValue returnValueFailure) { <START> setSucceeded(false); <END> final EngineFault engineFault = new EngineFault(); engineFault.setError(returnValueFailure.getVdsError().getCode()); engineFault.setMessage(returnValueFailure.getVdsError().getMessage()); getReturnValue().setFault(engineFault); }</code><technical_language>this is redundant - is false explicitly set true</technical_language>

Target:
public void setReturnValueFailure(VDSReturnValue returnValueFailure) { final EngineFault engineFault = new EngineFault(); engineFault.setError(returnValueFailure.getVdsError().getCode()); engineFault.setMessage(returnValueFailure.getVdsError().getMessage()); getReturnValue().setFault(engineFault); }
Source:
<code>public List<InputRow> parseBatch(Map<String, Object> theMap) { final List<String> dimensions = parseSpec.getDimensionsSpec().hasCustomDimensions() ? parseSpec.getDimensionsSpec().getDimensionNames() <START> : new ArrayList<>( <END> Sets.difference( theMap.keySet(), parseSpec.getDimensionsSpec() .getDimensionExclusions() ) ); final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: %s", theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp.getMillis(), dimensions, theMap)); }</code><technical_language>Please remove useless import com.google.common.collect.Lists</technical_language>

Target:
public List<InputRow> parseBatch(Map<String, Object> theMap) { final List<String> dimensions = parseSpec.getDimensionsSpec().hasCustomDimensions() ? parseSpec.getDimensionsSpec().getDimensionNames() : Lists.newArrayList( Sets.difference( theMap.keySet(), parseSpec.getDimensionsSpec() .getDimensionExclusions() ) ); final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: %s", theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp.getMillis(), dimensions, theMap)); }
Source:
<code>public ImmutableList<Double> values() { ImmutableList.Builder<Double> builder = ImmutableList.builder(); valueStream().forEach(builder::add); <START> return builder.build(); <END> }</code><technical_language>return valueStream().boxed().collect(toImmutableList());</technical_language>

Target:
public DoubleStream values() { return Arrays.stream(points).filter(this::isValidPoint); }
Source:
<code>public void shouldCorrectlyPropagateDeltaToSecondaryServer_whenAppending() { String key = "key"; String baseValue = "value-"; jedis1.set(key, baseValue); for (int i = 0; i < SET_SIZE; i++) { <START> jedis1.set(key, String.valueOf(i)); <END> String server1LocalValue = server1.invoke(() -> { InternalCache cache = ClusterStartupRule.getCache(); Region<ByteArrayWrapper, RedisData> region = cache.getRegion("__REDIS_DATA"); Region<ByteArrayWrapper, RedisData> localRegion = PartitionRegionHelper.getLocalData(region); RedisData localValue = localRegion.get(new ByteArrayWrapper(key.getBytes())); return localValue.toString(); }); String server2LocalValue = server2.invoke(() -> { InternalCache cache = ClusterStartupRule.getCache(); Region<ByteArrayWrapper, RedisData> region = cache.getRegion("__REDIS_DATA"); Region<ByteArrayWrapper, RedisData> localRegion = PartitionRegionHelper.getLocalData(region); RedisData localValue = localRegion.get(new ByteArrayWrapper(key.getBytes())); return localValue.toString(); }); assertThat(server1LocalValue).isEqualTo(server2LocalValue); } }</code><technical_language>I want this "append" instead of "set"</technical_language>

Target:
public void shouldCorrectlyPropagateDeltaToSecondaryServer_whenAppending() { String key = "key"; String baseValue = "value-"; jedis1.set(key, baseValue); for (int i = 0; i < ITERATION_COUNT; i++) { jedis1.append(key, String.valueOf(i)); byte[] server1LocalValue = server1.invoke(() -> (byte[]) getLocalData(key, r -> { RedisData localValue = r.get(new ByteArrayWrapper(key.getBytes())); try { return BlobHelper.serializeToBlob(localValue); } catch (IOException e) { throw new RuntimeException(e); } })); byte[] server2LocalValue = server2.invoke(() -> (byte[]) getLocalData(key, r -> { RedisData localValue = r.get(new ByteArrayWrapper(key.getBytes())); try { return BlobHelper.serializeToBlob(localValue); } catch (IOException e) { throw new RuntimeException(e); } })); assertThat(Arrays.equals(server1LocalValue, server2LocalValue)); } }
Source:
<code>public TaskStateModel createNewStateModel(String resourceName, String partitionKey) { <START> if (_taskExecutor == null) { <END> int taskThreadPoolSize = getTaskThreadPoolSize(); updateLiveInstanceWithThreadPoolSize(taskThreadPoolSize); initializeTaskExecutor(taskThreadPoolSize); initializeTaskMonitor(); } return new TaskStateModel(_manager, _taskFactoryRegistry, _taskExecutor, _timerTaskExecutor); }</code><technical_language>safe, add a sync control this block. is guarantee call createNewStateModel in parallel in future. put logics initializeTaskExecutor()</technical_language>

Target:
public TaskStateModel createNewStateModel(String resourceName, String partitionKey) { return new TaskStateModel(_manager, _taskFactoryRegistry, _taskExecutor, _timerTaskExecutor); }
Source:
<code>public boolean isFulfilled(@NonNull ITmfTrace trace) { if (trace instanceof ITmfTraceWithPreDefinedEvents) { <START> @SuppressWarnings("null") <END> Map<@NonNull String, @NonNull Collection<@NonNull String>> traceEvents = TmfEventTypeCollectionHelper.getEventFieldNames((((ITmfTraceWithPreDefinedEvents) trace).getContainedEventTypes())); Set<String> mandatoryValues = getValues(ValuePriorityLevel.MANDATORY); for (String eventType : fEventTypes) { Collection<String> fields = traceEvents.get(eventType); if (fields != null) { return fields.containsAll(mandatoryValues); } } return false; } return true; }</code><technical_language>If multimap in TmfEventTypeCollectionHelper#getEventFieldNames, SuppressWarning</technical_language>

Target:
public boolean isFulfilled(@NonNull ITmfTrace trace) { if ((trace instanceof ITmfTraceWithPreDefinedEvents) && fEventNames.iterator().hasNext()) { Multimap<@NonNull String, @NonNull String> traceEvents = TmfEventTypeCollectionHelper.getEventFieldNames((((ITmfTraceWithPreDefinedEvents) trace).getContainedEventTypes())); Set<String> mandatoryValues = getValues(ValuePriorityLevel.MANDATORY); for (String eventType : fEventNames) { Collection<@NonNull String> fields = traceEvents.get(eventType); return fields.containsAll(mandatoryValues); } return false; } return true; }