auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void upsertWifiInfo(final Long accountId, final WifiInfo wifiInfo) { final Optional<DeviceAccountPair> deviceAccountPairOptional = deviceDAO.getMostRecentSensePairByAccountId(accountId); if (deviceAccountPairOptional.isPresent()) { final String mostRecentlyPairedSenseId = deviceAccountPairOptional.get().externalDeviceId; if (mostRecentlyPairedSenseId.equals(wifiInfo.senseId)) { wifiInfoDAO.put(wifiInfo); } else { <START> LOGGER.debug("Account attempted to update wifi info for not sense but the most recently paired sense is {}", accountId, wifiInfo.senseId, mostRecentlyPairedSenseId); <END> } } }</code><technical_language>"for sense"</technical_language>

Target:
public Boolean upsertWifiInfo(final Long accountId, final WifiInfo wifiInfo) throws InvalidWifiInfoException { final Optional<DeviceAccountPair> deviceAccountPairOptional = deviceDAO.getMostRecentSensePairByAccountId(accountId); if (deviceAccountPairOptional.isPresent()) { final String mostRecentlyPairedSenseId = deviceAccountPairOptional.get().externalDeviceId; if (mostRecentlyPairedSenseId.equals(wifiInfo.senseId)) { return wifiInfoDAO.put(wifiInfo); } LOGGER.debug("Account attempted to update wifi info for sense but the most recently paired sense is {}", accountId, wifiInfo.senseId, mostRecentlyPairedSenseId); throw new InvalidWifiInfoException(String.format("Mismatch account id from token and input object")); } throw new InvalidWifiInfoException(String.format("No associated account found for sense %s", wifiInfo.senseId)); }
Source:
<code>public void returnsEmptyIteratorOnInvalidPartRequest() throws IOException { final Request req = create( Joiner.on(CR).join( "Content-Disposition: form-data; name=\"address\"", "", "443 N Wolfe Rd, Sunnyvale, CA 94085", <START> "Content-Disposition: form-data; name=\"data\"; filename=\"a.zip\"" <END> ) ); final RqMultipart multi = new RqMultipart(req); MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); }</code><technical_language>@ekondrashev new joiner ; character avoid line length checkstyle suppression</technical_language>

Target:
public void returnsEmptyIteratorOnInvalidPartRequest() throws IOException { final Request req = create( Joiner.on(CR).join( "Content-Disposition: form-data; name=\"address\"", "", "443 N Wolfe Rd, Sunnyvale, CA 94085" ), "Content-Disposition: form-data; name=\"data\"; filename=\"a.zip\"" ); final RqMultipart multi = new RqMultipart(req); MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); }
Source:
<code>public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, Path temporaryFolder, Statement base) throws Throwable { container = null; File temporaryFile = temporaryFolder.toFile(); <START> if (Files.notExists(temporaryFolder)) { <END> temporaryFile = new File(temporaryFolder.toString()); temporaryFile.mkdirs(); } FileUtil.setPermission(temporaryFile, FsPermission.getDirDefault()); try { LOGGER.info("Setting up in {}", getName(), temporaryFolder.getRoot()); container = createHiveServerContainer(scripts, target, temporaryFolder); base.evaluate(); return container; } finally { tearDown(); } }</code><technical_language>suggestion if (Files.notExists(temporaryFile)) { checking File Path here</technical_language>

Target:
public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, Path temporaryFolder, Statement base) throws Throwable { container = null; File temporaryFile = temporaryFolder.toFile(); if (!temporaryFile.exists()) { temporaryFile.mkdirs(); } FileUtil.setPermission(temporaryFile, FsPermission.getDirDefault()); try { LOGGER.info("Setting up in {}", getName(), temporaryFolder.getRoot()); container = createHiveServerContainer(scripts, target, temporaryFolder); base.evaluate(); return container; } finally { tearDown(); } }
Source:
<code>private ChoiceBuilder(Class<?> clazz, Signature signature) { <START> this.clazz = clazz; <END> this.signature = requireNonNull(signature, "signature is null"); }</code><technical_language>add requireNonNull for clazz</technical_language>

Target:
private ChoiceBuilder(Class<?> clazz, Signature signature) { this.clazz = requireNonNull(clazz, "clazz is null"); this.signature = requireNonNull(signature, "signature is null"); }
Source:
<code>public void should_pass_if_size_of_actual_is_greater_than_expected_size() { <START> strings.assertHasSizeLessThanOrEqualTo(someInfo(), "Han", 3); <END> }</code><technical_language>assertHasSizeGreaterThanOrEqualTo expected in should_pass_if_size_of_actual_is_equal_to_expected_size</technical_language>

Target:
public void should_pass_if_size_of_actual_is_greater_than_expected_size() { strings.assertHasSizeGreaterThanOrEqualTo(someInfo(), "Han", 2); }
Source:
<code>public void testWeldStandaloneInitialisation() throws Exception { WeldContainer weld = new Weld().initialize(); CDITestingBean testedBean = weld.instance().select(CDITestingBean.class).get(); testedBean.putValueInCache("test", "abcd"); String retrievedValue = testedBean.getValueFromCache("test"); assertEquals(retrievedValue, "abcd"); <START> weld.shutdown(); <END> }</code><technical_language>this in a finally block</technical_language>

Target:
public void testWeldStandaloneInitialisation() throws Exception { WeldContainer weld = null; try { weld = new Weld().initialize(); CDITestingBean testedBean = weld.instance().select(CDITestingBean.class).get(); testedBean.putValueInCache("test", "abcd"); String retrievedValue = testedBean.getValueFromCache("test"); assertEquals(retrievedValue, "abcd"); } finally { if(weld != null) { weld.shutdown(); } } }
Source:
<code>public SavingsTransaction applyFeeToSavingsAccount(String accountId, String amount, String notes) throws MambuApiException { if (accountId == null || accountId.trim().isEmpty()) { throw new IllegalArgumentException("Account ID must not be null or empty"); } <START> <END> ParamsMap paramsMap = new ParamsMap(); paramsMap.addParam(TYPE, TYPE_FEE); paramsMap.addParam(AMOUNT, amount); paramsMap.addParam(NOTES, notes); String urlString = new String(mambuAPIService.createUrl(SAVINGS + "/" + accountId + "/" + TRANSACTIONS)); String jsonResponse = mambuAPIService.executeRequest(urlString, paramsMap, Method.POST); SavingsTransaction transaction = GsonUtils.createGson().fromJson(jsonResponse, SavingsTransaction.class); return transaction; }</code><technical_language>Please add some checks amount well, e.g. non-null 0. sense amount param of type a BigDecimal</technical_language>

Target:
public SavingsTransaction applyFeeToSavingsAccount(String accountId, String amount, String notes) throws MambuApiException { if (accountId == null || accountId.trim().isEmpty()) { throw new IllegalArgumentException("Account ID must not be null or empty"); } if (amount == null || amount.trim().isEmpty()) { throw new IllegalArgumentException("Amount must not be null or empty"); } ParamsMap paramsMap = new ParamsMap(); paramsMap.addParam(TYPE, TYPE_FEE); paramsMap.addParam(AMOUNT, amount); paramsMap.addParam(NOTES, notes); String urlString = new String(mambuAPIService.createUrl(SAVINGS + "/" + accountId + "/" + TRANSACTIONS)); String jsonResponse = mambuAPIService.executeRequest(urlString, paramsMap, Method.POST); SavingsTransaction transaction = GsonUtils.createGson().fromJson(jsonResponse, SavingsTransaction.class); return transaction; }
Source:
<code>public void testClarifiedExceptionsForUnsupportedClassTypes() { class LocalClass implements DataSerializable { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } } DataSerializable anonymousInstance = new DataSerializable() { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } }; DataSerializable[] throwingInstances = {new LocalClass(), anonymousInstance, new NonStaticMemberClass()}; for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance)); } catch (HazelcastSerializationException e) { <START> assertTrue(e.getCause() instanceof NoSuchMethodException); <END> assertTrue(e.getCause().getMessage().contains("can't conform to DataSerializable")); assertTrue(e.getCause().getCause() instanceof NoSuchMethodException); continue; } fail("deserialization is expected to fail"); } for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance), throwingInstance.getClass()); } catch (HazelcastSerializationException e) { assertTrue(e.getCause() instanceof InstantiationException); assertTrue(e.getCause().getMessage().contains("can't conform to DataSerializable")); assertTrue(e.getCause().getCause() instanceof InstantiationException); continue; } fail("deserialization is expected to fail"); } }</code><technical_language>assertTrue() calls a message including class name, a failure produce AssertionError a line number, is nice debug. fail() include class name</technical_language>

Target:
public void testClarifiedExceptionsForUnsupportedClassTypes() { class LocalClass implements DataSerializable { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } } DataSerializable anonymousInstance = new DataSerializable() { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } }; DataSerializable[] throwingInstances = {new LocalClass(), anonymousInstance, new NonStaticMemberClass()}; for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance)); } catch (HazelcastSerializationException e) { assertInstanceOf(NoSuchMethodException.class, e.getCause()); assertContains(e.getCause().getMessage(), "can't conform to DataSerializable"); assertInstanceOf(NoSuchMethodException.class, e.getCause().getCause()); continue; } fail("deserialization of '" + throwingInstance.getClass() + "' is expected to fail"); } for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance), throwingInstance.getClass()); } catch (HazelcastSerializationException e) { assertInstanceOf(InstantiationException.class, e.getCause()); assertContains(e.getCause().getMessage(), "can't conform to DataSerializable"); assertInstanceOf(InstantiationException.class, e.getCause().getCause()); continue; } fail("deserialization of '" + throwingInstance.getClass() + "' is expected to fail"); } }
Source:
<code>public Map<String, Object> saveNewQuestion( @RequestBody QuestionPayload payLoad) { final QuestionDto questionDto = payLoad.getQuestion(); final Map<String, Object> response = new HashMap<String, Object>(); List<QuestionOptionDto> qoResults = new ArrayList<QuestionOptionDto>(); QuestionDto dto = null; RestStatusDto statusDto = new RestStatusDto(); statusDto.setStatus("failed"); statusDto.setMessage("Cannot create question"); if (questionDto != null) { Question q = null; if (questionDto.getSourceId() == null) { q = newQuestion(questionDto); } else { q = copyQuestion(questionDto); } QuestionDtoMapper qdm = new QuestionDtoMapper(); dto = qdm.transform(q); statusDto.setStatus("ok"); statusDto.setMessage(""); <START> <END> if (q.getType() == Question.Type.OPTION) { Map<Integer, QuestionOption> qoMap = questionOptionDao.listOptionByQuestion(dto .getKeyId()); List<Long> qoList = new ArrayList<Long>(); for (QuestionOption qo : qoMap.values()) { QuestionOptionDto qoDto = new QuestionOptionDto(); BeanUtils.copyProperties(qo, qoDto, new String[] { "translationMap" }); qoDto.setKeyId(qo.getKey().getId()); qoList.add(qo.getKey().getId()); qoResults.add(qoDto); } dto.setQuestionOptions(qoList); } } response.put("meta", statusDto); response.put("questionOptions", qoResults); response.put("question", dto); return response; }</code><technical_language>infact line 357 - 371 is copied pasted in functions. I suggest extracting a single function reuse</technical_language>

Target:
public Map<String, Object> saveNewQuestion( @RequestBody QuestionPayload payLoad) { final QuestionDto questionDto = payLoad.getQuestion(); final Map<String, Object> response = new HashMap<String, Object>(); List<QuestionOptionDto> qoResults = new ArrayList<QuestionOptionDto>(); QuestionDto dto = null; RestStatusDto statusDto = new RestStatusDto(); statusDto.setStatus("failed"); statusDto.setMessage("Cannot create question"); if (questionDto != null) { Question q = null; if (questionDto.getSourceId() == null) { q = newQuestion(questionDto); } else { q = copyQuestion(questionDto); } QuestionDtoMapper qdm = new QuestionDtoMapper(); dto = qdm.transform(q); statusDto.setStatus("ok"); statusDto.setMessage(""); qoResults = attachAnyOptions(dto); } response.put("meta", statusDto); response.put("questionOptions", qoResults); response.put("question", dto); return response; }
Source:
<code>public boolean contains(long address) { int retryCount = 0; while (true) { try { StreamLogSegment segment = segmentManager.getStreamLogSegment(address); return segment.contains(address); } catch (ClosedSegmentException e) { log.warn("Segment channel closed by compactor, retry for another time."); if (retryCount++ == CLOSE_SEGMENT_EXCEPTION_RETRY) { throw e; } } } <START> } <END></code><technical_language>English is a bit strange. change : '..., retry.'</technical_language>

Target:
public boolean contains(long address) { StreamLogSegment segment = segmentManager.getStreamLogSegment(address); return segment.contains(address); }
Source:
<code>public Iterable<ProcessorEntity> getEntitiesWithPartition(String partitionKey) { <START> String partitionFilter = TableQuery.generateFilterCondition(this.PARTITION_KEY, TableQuery.QueryComparisons.EQUAL, partitionKey); <END> TableQuery<ProcessorEntity> partitionQuery = TableQuery.from(ProcessorEntity.class).where(partitionFilter); return table.execute(partitionQuery); }</code><technical_language>nit: s/this.PARTITION_KEY/PARTITION_KEY/</technical_language>

Target:
public Iterable<ProcessorEntity> getEntitiesWithPartition(String partitionKey) { String partitionFilter = TableQuery.generateFilterCondition(PARTITION_KEY, TableQuery.QueryComparisons.EQUAL, partitionKey); TableQuery<ProcessorEntity> partitionQuery = TableQuery.from(ProcessorEntity.class).where(partitionFilter); return table.execute(partitionQuery); }
Source:
<code><START> public void testDelayedAuditWithMultipleBookieFailures() throws Exception { <END> LedgerHandle lh1 = createAndAddEntriesToLedger(); Long ledgerId = lh1.getId(); LOG.debug("Created ledger : " + ledgerId); ledgerList.add(ledgerId); lh1.close(); CountDownLatch underReplicaLatch = registerUrLedgerWatcher(ledgerList.size()); baseConf.setLostBookieRecoveryDelay(10); String shutdownBookie1 = shutDownNonAuditorBookie(); assertFalse("audit of lost bookie isn't delayed", underReplicaLatch.await(3, TimeUnit.SECONDS)); assertEquals("under replicated ledgers identified when it was not expected", 0, urLedgerList.size()); String shutdownBookie2 = shutDownNonAuditorBookie(); Thread.sleep(2000); assertTrue("Ledger is not marked as underreplicated:" + ledgerId, urLedgerList.contains(ledgerId)); Map<Long, String> urLedgerData = getUrLedgerData(urLedgerList); String data = urLedgerData.get(ledgerId); assertTrue("Bookie " + shutdownBookie1 + shutdownBookie2 + " are not listed in the ledger as missing replicas :" + data, data.contains(shutdownBookie1) && data.contains(shutdownBookie2)); }</code><technical_language>This testcase laptop fails sometimes, I attached logs JIRA</technical_language>

Target:
public void testDelayedAuditWithMultipleBookieFailures() throws Exception { Thread.sleep(1000); LedgerHandle lh1 = createAndAddEntriesToLedger(); Long ledgerId = lh1.getId(); LOG.debug("Created ledger : " + ledgerId); ledgerList.add(ledgerId); lh1.close(); CountDownLatch underReplicaLatch = registerUrLedgerWatcher(ledgerList.size()); baseConf.setLostBookieRecoveryDelay(10); String shutdownBookie1 = shutDownNonAuditorBookie(); assertFalse("audit of lost bookie isn't delayed", underReplicaLatch.await(3, TimeUnit.SECONDS)); assertEquals("under replicated ledgers identified when it was not expected", 0, urLedgerList.size()); String shutdownBookie2 = shutDownNonAuditorBookie(); Thread.sleep(2000); assertTrue("Ledger is not marked as underreplicated:" + ledgerId, urLedgerList.contains(ledgerId)); Map<Long, String> urLedgerData = getUrLedgerData(urLedgerList); String data = urLedgerData.get(ledgerId); assertTrue("Bookie " + shutdownBookie1 + shutdownBookie2 + " are not listed in the ledger as missing replicas :" + data, data.contains(shutdownBookie1) && data.contains(shutdownBookie2)); }
Source:
<code>protected NuxeoPrincipal getAuthor(DocumentModel docModel) { String author = null; if (docModel.hasSchema(COMMENT_SCHEMA)) { author = (String) docModel.getPropertyValue(COMMENT_AUTHOR); } else if (StringUtils.isEmpty(author)) { String[] contributors = (String[]) docModel.getProperty("dublincore", "contributors"); <START> author = contributors[0]; <END> } return Framework.getService(UserManager.class).getPrincipal(author); }</code><technical_language>changing code, for: java String[] contributors = (String[]) docModel.getPropertyValue("dc:contributors"); prefered get a property (using xpath)</technical_language>

Target:
protected NuxeoPrincipal getAuthor(DocumentModel docModel) { String author = null; if (docModel.hasSchema(COMMENT_SCHEMA)) { author = (String) docModel.getPropertyValue(COMMENT_AUTHOR_PROPERTY); } if (StringUtils.isBlank(author)) { String[] contributors = (String[]) docModel.getPropertyValue("dc:contributors"); author = contributors[0]; } NuxeoPrincipal principal = Framework.getService(UserManager.class).getPrincipal(author); if (principal == null) { log.debug("Principal not found: {}", author); } return principal; }
Source:
<code>protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int w = MeasureSpec.getSize(widthMeasureSpec); int h = MeasureSpec.getSize(heightMeasureSpec); if(w == 0 || h == 0) { w = Math.max(w, h); } else { w = Math.min(w, h); } <START> h = w; <END> setMeasuredDimension(w,w); }</code><technical_language>This assignment useless</technical_language>

Target:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int canvasWidth = MeasureSpec.getSize(widthMeasureSpec); int canvasHeight = MeasureSpec.getSize(heightMeasureSpec); int squareCanvasDimension = Math.min(canvasWidth, canvasHeight); if (squareCanvasDimension <= 0) { squareCanvasDimension = Math.max(canvasWidth, canvasHeight); } setMeasuredDimension(squareCanvasDimension, squareCanvasDimension); }
Source:
<code>public void publishKeyPressedShort(String id) { for (AKM868BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { if (provider.getId(itemName).equals(id) && provider.getChannel(itemName).equals("1")) { <START> logger.debug("Publishing state for: "+itemName+" -state: ON"); <END> eventPublisher.postUpdate(itemName, OnOffType.ON ); } } } }</code><technical_language>parameterised logging</technical_language>

Target:
public void publishKeyPressedShort(String id) { for (AKM868BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { if (provider.getId(itemName).equals(id) && provider.getChannel(itemName).equals("1")) { logger.debug("Publishing state for -state: ON",itemName); eventPublisher.postUpdate(itemName, OnOffType.ON ); } } } }
Source:
<code>protected void cancel() { setWindow(null); <START> setConfirmWindow(null); <END> }</code><technical_language>is harm in setting confirmWindow null, setting it, is need set null</technical_language>

Target:
protected void cancel() { setWindow(null); }
Source:
<code>public void testRealBbcTxlogRegularExamples() { assertTxlogNitroScore("THE HOUSING ENFORCERS", "Episode 2", "The Housing Enforcers", scoreOnMatch); <START> assertTxlogNitroScore("!MPOSSIBLE", "Episode 7", "Impossible", scoreOnMismatch); <END> }</code><technical_language>this equiv</technical_language>

Target:
public void testRealBbcTxlogRegularExamples() { assertTxlogNitroScore("THE HOUSING ENFORCERS", "Episode 2", "The Housing Enforcers", scoreOnMatch); }
Source:
<code>public Boolean isPasswordEnabled() { <START> return passwordEnabled; <END> }</code><technical_language>a ternary operator like, var == null ? false : var</technical_language>

Target:
public boolean isPasswordEnabled() { return passwordEnabled == null ? false : passwordEnabled; }
Source:
<code>public void addBreakpoint(Breakpoint breakpoint) throws DebuggerException { try { Location location = breakpoint.getLocation(); pendingBreakpoints.add(location); library.setBreakpoint(location.getTarget(), location.getLineNumber()); <START> debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint)); <END> } catch (NodeJsDebuggerTerminatedException e) { disconnect(); throw e; } catch (NodeJsDebuggerException e) { throw new DebuggerException("Can't add breakpoint: " + breakpoint + ". " + e.getMessage(), e); } }</code><technical_language>If need checkActivatedBreakpoints method, code related pendingBreakpoints vanished</technical_language>

Target:
public void addBreakpoint(Breakpoint breakpoint) throws DebuggerException { try { Location location = breakpoint.getLocation(); library.setBreakpoint(location.getTarget(), location.getLineNumber()); debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint)); } catch (NodeJsDebuggerTerminatedException e) { disconnect(); throw e; } catch (NodeJsDebuggerException e) { throw new DebuggerException("Can't add breakpoint: " + breakpoint + ". " + e.getMessage(), e); } }
Source:
<code>public void resourceChanged(IResourceChangeEvent event) { if(!active) { return; } if (event.getType() == IResourceChangeEvent.PRE_CLOSE && event.getResource() != null && event.getResource().getType() == IResource.PROJECT) { final IProject project = (IProject) event.getResource(); try { final JaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project); if (metamodel != null) { <START> synchronized(metamodel) { <END> Logger.debug("Removing JAX-RS Metamodel before closing project " + project.getName()); metamodel.remove(); } } } catch (CoreException e) { Logger.error("Error while removing JAX-RS Metamodel", e); } } }</code><technical_language>is this synchronized call needed anymore ? metamodel threadsafe</technical_language>

Target:
public void resourceChanged(IResourceChangeEvent event) { if(!active) { return; } if (event.getType() == IResourceChangeEvent.PRE_CLOSE && event.getResource() != null && event.getResource().getType() == IResource.PROJECT) { final IProject project = (IProject) event.getResource(); try { final JaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project); if (metamodel != null) { Logger.debug("Removing JAX-RS Metamodel before closing project " + project.getName()); metamodel.remove(); } } catch (CoreException e) { Logger.error("Error while removing JAX-RS Metamodel", e); } } }
Source:
<code>public List<ChartSeries> getChartSeries() { <START> return checkNotNull(ImmutableList.copyOf(fSeries)); <END> }</code><technical_language>do ImmutableList.copyOf() constructor, return list directly. This ensure constrcutor's caller modify list stored in this class</technical_language>

Target:
public List<ChartSeries> getChartSeries() { return fSeries; }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BytesValues that = (BytesValues) o; <START> return values.length == that.values.length && nullAllowed == that.nullAllowed && deepEquals(values, that.values); <END> }</code><technical_language>values.length == that.values.length is redundant deepEquals includes this check - qualify deepEquals for consistency Arrays.equals elsewhere: Arrays.deepEquals - put conjunct a separate line? return nullAllowed == that.nullAllowed && Arrays.deepEquals(values, that.values);</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BytesValues that = (BytesValues) o; return nullAllowed == that.nullAllowed && Arrays.deepEquals(values, that.values); }
Source:
<code>private int getUnixFileMode(final String pathAsString) { final Path path = Paths.get(pathAsString); if (this.forcedFileMode != null) { return this.getModeValue(path); } try { int unixMode = (int) Files.getAttribute(path, "unix:mode"); if ("OS/390".equals(SystemUtils.OS_NAME) || "z/OS".equals(SystemUtils.OS_NAME) || "zOS".equals(SystemUtils.OS_NAME) ) { unixMode &= TarConstants.MAXID; unixMode |= Files.isDirectory(path) ? 040000 : 0100000; } return unixMode; <START> } catch (IOException | UnsupportedOperationException e) { <END> int mode = DEFAULT_FILE_MODE; if (Files.isDirectory(path)) { mode = DEFAULT_DIR_MODE; } else if (Files.isExecutable(path)) { mode |= 0111; } return mode; } }</code><technical_language>a thought: is necessary decide truncate based system type, do it? Linux is supported _container OS_, ensuring matter unixMode get, right bounds</technical_language>

Target:
private int getUnixFileMode(final String pathAsString) { final Path path = Paths.get(pathAsString); if (this.forcedFileMode != null) { return this.getModeValue(path); } return getUnixFileMode(path); }
Source:
<code>public boolean getShowFastViewBars() { return <START> getWindowConfigurer().getShowFastViewBars(); <END> }</code><technical_language>return false update WorkbenchWindowConfigurer</technical_language>

Target:
public boolean getShowFastViewBars() { return false; }
Source:
<code>private MethodReference getFactoryMethod(List<MapperReference> mapperReferences, List<SourceMethod> methods, Type returnType) { MethodReference result = null; for ( SourceMethod method : methods ) { if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping() && method.getSourceParameters().size() == 0 ) { List<Type> paramterTypes = MethodSelectors.getParameterTypes( typeFactory, method.getParameters(), null, returnType ); <START> if ( ( paramterTypes.isEmpty() && method.getReturnType().equals( returnType ) ) <END> || method.matches( paramterTypes, returnType ) ) { if ( result == null ) { MapperReference mapperReference = findMapperReference( mapperReferences, method ); result = new MethodReference( method, mapperReference, SourceMethod.containsTargetTypeParameter( method.getParameters() ) ? returnType : null ); } else { messager.printMessage( Kind.ERROR, String.format( "Ambiguous factory methods: \"%s\" conflicts with \"%s\".", result, method ), method.getExecutable() ); } } } } return result; }</code><technical_language>Is method.getReturnType().equals( returnType ) required here? method matcher do this already</technical_language>

Target:
private MethodReference getFactoryMethod(List<MapperReference> mapperReferences, List<SourceMethod> methods, Type returnType) { MethodReference result = null; for ( SourceMethod method : methods ) { if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping() && method.getSourceParameters().size() == 0 ) { List<Type> parameterTypes = MethodSelectors.getParameterTypes( typeFactory, method.getParameters(), null, returnType ); if ( method.matches( parameterTypes, returnType ) ) { if ( result == null ) { MapperReference mapperReference = findMapperReference( mapperReferences, method ); result = new MethodReference( method, mapperReference, null ); } else { messager.printMessage( Kind.ERROR, String.format( "Ambiguous factory methods: \"%s\" conflicts with \"%s\".", result, method ), method.getExecutable() ); } } } } return result; }
Source:
<code>public void testStorage1() throws Exception { HashMapDB<byte[]> stateDb = new HashMapDB<>(); RepositoryRoot repo = new RepositoryRoot(stateDb, null); byte[] addr1 = decode("aaaa"); repo.createAccount(addr1); <START> repo.addStorageRow(addr1, DataWord.of(1), DataWord.of(111)); <END> repo.commit(); byte[] root1 = repo.getRoot(); System.out.println(repo.dumpStateTrie()); RepositoryRoot repo2 = new RepositoryRoot(stateDb, root1); DataWord val1 = repo.getStorageValue(addr1, DataWord.of(1)); assert DataWord.of(111).equals(val1); Repository repo3 = repo2.startTracking(); repo3.addStorageRow(addr1, DataWord.of(2), DataWord.of(222)); repo3.addStorageRow(addr1, DataWord.of(1), DataWord.of(333)); assert DataWord.of(333).equals(repo3.getStorageValue(addr1, DataWord.of(1))); assert DataWord.of(222).equals(repo3.getStorageValue(addr1, DataWord.of(2))); assert DataWord.of(111).equals(repo2.getStorageValue(addr1, DataWord.of(1))); Assert.assertNull(repo2.getStorageValue(addr1, DataWord.of(2))); repo3.commit(); assert DataWord.of(333).equals(repo2.getStorageValue(addr1, DataWord.of(1))); assert DataWord.of(222).equals(repo2.getStorageValue(addr1, DataWord.of(2))); repo2.commit(); RepositoryRoot repo4 = new RepositoryRoot(stateDb, repo2.getRoot()); assert DataWord.of(333).equals(repo4.getStorageValue(addr1, DataWord.of(1))); assert DataWord.of(222).equals(repo4.getStorageValue(addr1, DataWord.of(2))); }</code><technical_language>@mkalinin a bit doebalsa :) This is a test</technical_language>

Target:
public void testStorage1() throws Exception { HashMapDB<byte[]> stateDb = new HashMapDB<>(); RepositoryRoot repo = new RepositoryRoot(stateDb, null); byte[] addr1 = decode("aaaa"); repo.createAccount(addr1); repo.addStorageRow(addr1, DataWord.ONE, DataWord.of(111)); repo.commit(); byte[] root1 = repo.getRoot(); System.out.println(repo.dumpStateTrie()); RepositoryRoot repo2 = new RepositoryRoot(stateDb, root1); DataWord val1 = repo.getStorageValue(addr1, DataWord.ONE); assert DataWord.of(111).equals(val1); Repository repo3 = repo2.startTracking(); repo3.addStorageRow(addr1, DataWord.of(2), DataWord.of(222)); repo3.addStorageRow(addr1, DataWord.ONE, DataWord.of(333)); assert DataWord.of(333).equals(repo3.getStorageValue(addr1, DataWord.ONE)); assert DataWord.of(222).equals(repo3.getStorageValue(addr1, DataWord.of(2))); assert DataWord.of(111).equals(repo2.getStorageValue(addr1, DataWord.ONE)); Assert.assertNull(repo2.getStorageValue(addr1, DataWord.of(2))); repo3.commit(); assert DataWord.of(333).equals(repo2.getStorageValue(addr1, DataWord.ONE)); assert DataWord.of(222).equals(repo2.getStorageValue(addr1, DataWord.of(2))); repo2.commit(); RepositoryRoot repo4 = new RepositoryRoot(stateDb, repo2.getRoot()); assert DataWord.of(333).equals(repo4.getStorageValue(addr1, DataWord.ONE)); assert DataWord.of(222).equals(repo4.getStorageValue(addr1, DataWord.of(2))); }
Source:
<code>public void run() { ILogger logger = getLogger(); InternalPartitionServiceImpl partitionService = getService(); if (!partitionService.areMigrationTasksAllowed()) { if (logger.isFinestEnabled()) { logger.finest("Migration is paused! Cannot process request. partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); return; } final int permits = acquirePermits(); if (permits == 0) { if (logger.isFinestEnabled()) { <START> logger.finest("Not enough permits available! Cannot process request. partitionId=" <END> + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); return; } sendOperationsForNamespaces(permits); if (!namespaces.isEmpty()) { if (logger.isFinestEnabled()) { logger.finest("Not enough permits available! Cannot process request. partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); } }</code><technical_language>Minor: log this target is wrong</technical_language>

Target:
public void run() { InternalPartitionServiceImpl partitionService = getService(); if (!partitionService.areMigrationTasksAllowed()) { ILogger logger = getLogger(); if (logger.isFinestEnabled()) { logger.finest("Migration is paused! Cannot process request. partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); return; } if (!checkPartitionOwner()) { sendRetryResponse(); return; } int permits = partitionService.getReplicaManager().tryAcquireReplicaSyncPermits(namespaces.size()); if (permits == 0) { logNotEnoughPermits(); sendRetryResponse(); return; } sendOperationsForNamespaces(permits); if (!namespaces.isEmpty()) { logNotEnoughPermits(); sendRetryResponse(); } }
Source:
<code><START> private Object invertGeometryCoordinates(Geometry geometry) throws TransformException { <END> return transformer.transform(geometry); }</code><technical_language>Works a bit weird return Object, returning a Geometry (that's transformer.tranfsorm method does). a critical issue, fix if like</technical_language>

Target:
private Geometry invertGeometryCoordinates(Geometry geometry) throws TransformException { return transformer.transform(geometry); }
Source:
<code>public void testAddAdminUnit() throws Exception { String label = "admin_label"; MvcResult result = mvc.perform(post("/edit/create/adminUnit/" + CONTENT_ROOT_ID) .param("label", label) <START> .param("patronOnly", (String) null)) <END> .andExpect(status().is2xxSuccessful()) .andReturn(); treeIndexer.indexAll(baseAddress); assertChildContainerAdded(contentRoot, label, AdminUnit.class); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(CONTENT_ROOT_ID, respMap.get("pid")); assertEquals("create", respMap.get("action")); }</code><technical_language>leave parameter for this case</technical_language>

Target:
public void testAddAdminUnit() throws Exception { String label = "admin_label"; MvcResult result = mvc.perform(post("/edit/create/adminUnit/" + CONTENT_ROOT_ID) .param("label", label)) .andExpect(status().is2xxSuccessful()) .andReturn(); treeIndexer.indexAll(baseAddress); assertChildContainerAdded(contentRoot, label, AdminUnit.class); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(CONTENT_ROOT_ID, respMap.get("pid")); assertEquals("create", respMap.get("action")); assertPatronDoesNotHaveNonePermission(contentRoot, label); }
Source:
<code>public void eventDispatched(IResumedDMEvent e) { if (e instanceof IContainerResumedDMEvent) { fCommandCache.setContextAvailable(e.getDMContext(), false); } if (e.getReason() != StateChangeReason.STEP) { IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class); if (memoryDMC != null) { <START> fCommandCache.reset(memoryDMC); <END> for (IMemoryDMContext ctx : fMemoryCaches.keySet() ) { if (ctx.equals(memoryDMC) || DMContexts.isAncestorOf(ctx, memoryDMC)) { fMemoryCaches.get(ctx).reset(); } } } } }</code><technical_language>fCommandCache stores MI command GDB for a context. guess is IMemorySpaceDMC. In case, I cleared parent IMemoryDMC resumes. If right, able trigger this issue requesting exact memory a resume suspend; guess is a cached MI command returned values</technical_language>

Target:
public void eventDispatched(IResumedDMEvent e) { if (e instanceof IContainerResumedDMEvent) { fCommandCache.setContextAvailable(e.getDMContext(), false); } if (e.getReason() != StateChangeReason.STEP) { IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class); if (memoryDMC != null) { fCommandCache.reset(memoryDMC); memoryCacheReset(memoryDMC); } } }
Source:
<code>public static void main(String[] args) { LOGGER.info("Use superpower: sky launch"); <START> Superpower skyLaunch = new SkyLaunch(); <END> skyLaunch.activate(); LOGGER.info("Use superpower: ground dive"); Superpower groundDive = new GroundDive(); groundDive.activate(); }</code><technical_language>Java's local variable type inference (var) in code this. Please check too</technical_language>

Target:
public static void main(String[] args) { LOGGER.info("Use superpower: sky launch"); var skyLaunch = new SkyLaunch(); skyLaunch.activate(); LOGGER.info("Use superpower: ground dive"); var groundDive = new GroundDive(); groundDive.activate(); }
Source:
<code>public void onResponse(Frame responseFrame) { if (timeoutFuture != null) { timeoutFuture.cancel(true); } Message message = responseFrame.message; LOG.debug("[{}] Got response {}", logPrefix, responseFrame.message); if (message instanceof Rows) { Rows rows = (Rows) message; ByteBuffer pagingState = rows.getMetadata().pagingState; AdminRequestHandler nextHandler = (pagingState == null) ? null : this.copy(pagingState); setFinalResult(new AdminResult(rows, nextHandler, channel.protocolVersion())); <START> } else if (message instanceof Prepared <END> || message instanceof com.datastax.oss.protocol.internal.response.result.Void) { setFinalResult(null); } else { setFinalError(new UnexpectedResponseException(debugString, message)); } }</code><technical_language>I broaden scope of this check message instanceof Result - Rows a special case of Result handled in previous if block</technical_language>

Target:
public void onResponse(Frame responseFrame) { if (timeoutFuture != null) { timeoutFuture.cancel(true); } Message message = responseFrame.message; LOG.debug("[{}] Got response {}", logPrefix, responseFrame.message); if (message instanceof Rows) { Rows rows = (Rows) message; ByteBuffer pagingState = rows.getMetadata().pagingState; AdminRequestHandler nextHandler = (pagingState == null) ? null : this.copy(pagingState); setFinalResult(new AdminResult(rows, nextHandler, channel.protocolVersion())); } else if (message instanceof Result) { setFinalResult(null); } else { setFinalError(new UnexpectedResponseException(debugString, message)); } }
Source:
<code>public void applyOpenKey(KeyArgs omKeyArgs, KeyInfo keyInfo, long clientID) throws IOException { if(isAclEnabled) { checkAcls(ResourceType.KEY, StoreType.OZONE, ACLType.READ, omKeyArgs.getVolumeName(), omKeyArgs.getBucketName(), omKeyArgs.getKeyName()); } boolean auditSuccess = true; try { keyManager.applyOpenKey(omKeyArgs, keyInfo, clientID); } catch (Exception ex) { metrics.incNumKeyAllocateFails(); auditSuccess = false; AUDIT.logWriteFailure(buildAuditMessageForFailure( OMAction.APPLY_ALLOCATE_KEY, (omKeyArgs == null) ? null : toAuditMap(omKeyArgs), ex)); throw ex; } finally { if(auditSuccess){ AUDIT.logWriteSuccess(buildAuditMessageForSuccess( <START> OMAction.ALLOCATE_KEY, (omKeyArgs == null) ? null : <END> toAuditMap(omKeyArgs))); } } }</code><technical_language>OMAction APPLY_ALLOCATE_KEY</technical_language>

Target:
public void applyOpenKey(KeyArgs omKeyArgs, KeyInfo keyInfo, long clientID) throws IOException { if(isAclEnabled) { checkAcls(ResourceType.KEY, StoreType.OZONE, ACLType.READ, omKeyArgs.getVolumeName(), omKeyArgs.getBucketName(), omKeyArgs.getKeyName()); } boolean auditSuccess = true; try { keyManager.applyOpenKey(omKeyArgs, keyInfo, clientID); } catch (Exception ex) { metrics.incNumKeyAllocateFails(); auditSuccess = false; AUDIT.logWriteFailure(buildAuditMessageForFailure( OMAction.APPLY_ALLOCATE_KEY, (omKeyArgs == null) ? null : toAuditMap(omKeyArgs), ex)); throw ex; } finally { if(auditSuccess){ AUDIT.logWriteSuccess(buildAuditMessageForSuccess( OMAction.APPLY_ALLOCATE_KEY, (omKeyArgs == null) ? null : toAuditMap(omKeyArgs))); } } }
Source:
<code><START> public List<String> getDevSupportInfos() { <END> final UserAccount cachedCurrentUser = getUserAccountManager().getCachedCurrentUser(); final String currentUserString = (cachedCurrentUser == null) ? "" : usersToString(cachedCurrentUser); final List<UserAccount> users = getUserAccountManager().getAuthenticatedUsers(); final String usersString = (users == null || users.isEmpty()) ? "" : usersToString(users.toArray(new UserAccount[0])); List<String> devInfos = new ArrayList<>(Arrays.asList( "SDK Version", SDK_VERSION, "App Type", getAppType(), "User Agent", getUserAgent(), "Browser Login Enabled", isBrowserLoginEnabled() + "", "IDP Enabled", isIDPLoginFlowEnabled() + "", "Identity Provider", isIdentityProvider() + "", "Current User", currentUserString, "Authenticated Users", usersString )); devInfos.addAll(getDevInfosFor(BootConfig.getBootConfig(context).asJSON(), "BootConfig")); RuntimeConfig runtimeConfig = RuntimeConfig.getRuntimeConfig(context); devInfos.addAll(Arrays.asList("Managed?", runtimeConfig.isManagedApp() + "")); if (runtimeConfig.isManagedApp()) { devInfos.addAll(getDevInfosFor(runtimeConfig.asJSON(), "Managed Pref")); } return devInfos; }</code><technical_language>usersToString handles null. problem is toArray() call a null value. add a usersToString method takes a List parameter. java private String usersToString(List<UserAccount> userAccounts) { return userAccounts == null ? usersToString(userAccounts.toArray(new UserAccount[0])); } replace java "Authenticated Users", usersToString(getUserAccountManager().getAuthenticatedUsers().toArray(new UserAccount[0])) java "Authenticated Users", usersToString(getUserAccountManager().getAuthenticatedUsers())</technical_language>

Target:
public List<String> getDevSupportInfos() { List<String> devInfos = new ArrayList<>(Arrays.asList( "SDK Version", SDK_VERSION, "App Type", getAppType(), "User Agent", getUserAgent(), "Browser Login Enabled", isBrowserLoginEnabled() + "", "IDP Enabled", isIDPLoginFlowEnabled() + "", "Identity Provider", isIdentityProvider() + "", "Current User", usersToString(getUserAccountManager().getCachedCurrentUser()), "Authenticated Users", usersToString(getUserAccountManager().getAuthenticatedUsers()) )); devInfos.addAll(getDevInfosFor(BootConfig.getBootConfig(context).asJSON(), "BootConfig")); RuntimeConfig runtimeConfig = RuntimeConfig.getRuntimeConfig(context); devInfos.addAll(Arrays.asList("Managed?", runtimeConfig.isManagedApp() + "")); if (runtimeConfig.isManagedApp()) { devInfos.addAll(getDevInfosFor(runtimeConfig.asJSON(), "Managed Pref")); } return devInfos; }
Source:
<code>private void verifyFailureTags(final ArgumentCaptor<Map<String, String>> argumentCaptor, final Throwable throwable) { final Map<String, String> failureTags = MetricsUtils.newFailureTagsMapForException(throwable); Assert.assertTrue(argumentCaptor.getValue().get(MetricsConstants.TagKeys.STATUS). equals(failureTags.get(MetricsConstants.TagKeys.STATUS))); <START> Assert.assertTrue(argumentCaptor.getValue().get(MetricsConstants.TagKeys.EXCEPTION_CLASS). <END> equals(failureTags.get(MetricsConstants.TagKeys.EXCEPTION_CLASS))); verifyCommonTags(argumentCaptor); }</code><technical_language>If assertEquals(x, y) assertTrue(x.equals(y)) error messages in case of failed assertion show comparing provide a more helpful message</technical_language>

Target:
private void verifyFailureTags(final ArgumentCaptor<Map<String, String>> argumentCaptor, final Throwable throwable) { final Map<String, String> failureTags = MetricsUtils.newFailureTagsMapForException(throwable); Assert.assertEquals(argumentCaptor.getValue().get(MetricsConstants.TagKeys.STATUS), failureTags.get(MetricsConstants.TagKeys.STATUS)); Assert.assertEquals(argumentCaptor.getValue().get(MetricsConstants.TagKeys.EXCEPTION_CLASS), failureTags.get(MetricsConstants.TagKeys.EXCEPTION_CLASS)); verifyCommonTags(argumentCaptor); }
Source:
<code>private void relaunchSimplenote() { final UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); device.pressHome(); final String launcherPackage = device.getLauncherPackageName(); assertThat(launcherPackage, notNullValue()); device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT); Context context = ApplicationProvider.getApplicationContext(); <START> final Intent intent = context.getPackageManager() .getLaunchIntentForPackage(SIMPLENOTE_PACKAGE); <END> intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); device.wait(Until.hasObject(By.pkg(SIMPLENOTE_PACKAGE).depth(0)), LAUNCH_TIMEOUT); }</code><technical_language>suggestion String packageName = context.getPackageName(); final Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); packageName context.getPackageName() mentioned above</technical_language>

Target:
private void relaunchSimplenote() { final UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); device.pressHome(); final String launcherPackage = device.getLauncherPackageName(); assertThat(launcherPackage, notNullValue()); device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT); Context context = ApplicationProvider.getApplicationContext(); String packageName = context.getPackageName(); final Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); device.wait(Until.hasObject(By.pkg(packageName).depth(0)), LAUNCH_TIMEOUT); }
Source:
<code>public void removeDataObserver(ChartDataBase dataComponent) { <START> dataSourceObservers.remove(dataComponent); <END> if (dataSourceObservers.isEmpty()) { dataPollService.shutdown(); dataPollService = null; } }</code><technical_language>add remove synchronized dataSourceObservers chance extension do a separate thread introducing a race condition</technical_language>

Target:
public synchronized void removeDataObserver(ChartDataBase dataComponent) { dataSourceObservers.remove(dataComponent); if (dataSourceObservers.isEmpty()) { dataPollService.shutdown(); dataPollService = null; } }
Source:
<code>private static void checkDoNotMockAnnotationForType(Class<?> type) { <START> if (type == null) { <END> return; } if (SAFE_DONOTMOCK_ENFORCED_CLASSES.contains(type)) { return; } DO_NOT_MOCK_ENFORCER.checkTypeForDoNotMockViolation(type).ifPresent(message -> { throw new DoNotMockException(message); }); checkDoNotMockAnnotationForType(type.getSuperclass()); Arrays.stream(type.getInterfaces()).forEach(MockitoCore::checkDoNotMockAnnotationForType); SAFE_DONOTMOCK_ENFORCED_CLASSES.add(type); }</code><technical_language>I suggest drop this conditional, type null (unless wrong :-)</technical_language>

Target:
private static void checkDoNotMockAnnotationForType(Class<?> type) { if (type == null) { return; } if (MOCKABLE_CLASSES.contains(type)) { return; } String warning = DO_NOT_MOCK_ENFORCER.checkTypeForDoNotMockViolation(type); if (warning != null) { throw new DoNotMockException(warning); } checkDoNotMockAnnotationForType(type.getSuperclass()); for (Class<?> aClass : type.getInterfaces()) { checkDoNotMockAnnotationForType(aClass); } MOCKABLE_CLASSES.add(type); }
Source:
<code>public void testCallsiteAnalysis() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); String uuid = String.valueOf(fTrace.getUUID()); List<@NonNull ITmfCallsite> cs = module.getCallsites(uuid, <START> TmfStrings.cpu(), "0", <END> 42); assertEquals(EXPECTED, cs); assertEquals(Collections.emptyList(), module.getCallsites("Hello", TmfStrings.cpu(), "0", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "1", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "0", 12)); assertEquals(EXPECTED, module.getCallsites(uuid, TmfStrings.cpu(), "0", 55)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "..", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "..", 42)); }</code><technical_language>Get TmfCpuAspect</technical_language>

Target:
public void testCallsiteAnalysis() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); TmfCpuAspect cpuAspect = null; for(ITmfEventAspect<?> oaspect : trace.getEventAspects()) { if(oaspect instanceof TmfCpuAspect) { cpuAspect = (TmfCpuAspect) oaspect; } } assertNotNull(cpuAspect); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); String uuid = String.valueOf(fTrace.getUUID()); String cpu = cpuAspect.getDeviceType(); List<@NonNull ITmfCallsite> cs = module.getCallsites(uuid, cpu, "0", 42); assertEquals(EXPECTED, cs); assertEquals(Collections.emptyList(), module.getCallsites("Hello", cpu, "0", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "1", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "0", 12)); assertEquals(EXPECTED, module.getCallsites(uuid, cpu, "0", 55)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); }