auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void perform(GraphRewrite event, EvaluationContext context, JspSourceFileModel sourceFile) { TypeReferenceService typeReferenceService = new TypeReferenceService(event.getGraphContext()); try { sourceFile.setPackageName(""); JavaClassService javaClassService = new JavaClassService(event.getGraphContext()); JavaClassModel classModel = javaClassService.create(); classModel.setPackageName(""); classModel.setSimpleName(sourceFile.getFileName()); classModel.setQualifiedName(sourceFile.getFileName()); classModel.setExtends(javaClassService.getOrCreatePhantom("javax.servlet.http.HttpServlet")); sourceFile.addJavaClass(classModel); Iterable<ClassReference> references = getClassReferences(typeReferenceService, sourceFile); for (ClassReference reference : references) { JavaTypeReferenceModel typeReference = typeReferenceService.createTypeReference(sourceFile, reference.getLocation(), reference.getResolutionStatus(), reference.getLineNumber(), reference.getColumn(), reference.getLength(), reference.getQualifiedName(), reference.getLine()); } } catch (Exception e) { ClassificationService classificationService = new ClassificationService(event.getGraphContext()); classificationService.attachClassification(context, sourceFile, UNPARSEABLE_JSP_CLASSIFICATION, UNPARSEABLE_JSP_DESCRIPTION); <START> if (! Boolean.TRUE.equals(sourceFile.isIgnoreParseError())) <END> sourceFile.setParseError("JSP file could not be parsed: " + e.getMessage()); } }</code><technical_language>prefer storing parse error dealing display presentation level</technical_language>

Target:
public void perform(GraphRewrite event, EvaluationContext context, JspSourceFileModel sourceFile) { TypeReferenceService typeReferenceService = new TypeReferenceService(event.getGraphContext()); try { sourceFile.setPackageName(""); JavaClassService javaClassService = new JavaClassService(event.getGraphContext()); JavaClassModel classModel = javaClassService.create(); classModel.setPackageName(""); classModel.setSimpleName(sourceFile.getFileName()); classModel.setQualifiedName(sourceFile.getFileName()); classModel.setExtends(javaClassService.getOrCreatePhantom("javax.servlet.http.HttpServlet")); sourceFile.addJavaClass(classModel); Iterable<ClassReference> references = getClassReferences(typeReferenceService, sourceFile); for (ClassReference reference : references) { JavaTypeReferenceModel typeReference = typeReferenceService.createTypeReference(sourceFile, reference.getLocation(), reference.getResolutionStatus(), reference.getLineNumber(), reference.getColumn(), reference.getLength(), reference.getQualifiedName(), reference.getLine()); } } catch (Exception e) { ClassificationService classificationService = new ClassificationService(event.getGraphContext()); classificationService.attachClassification(context, sourceFile, UNPARSEABLE_JSP_CLASSIFICATION, UNPARSEABLE_JSP_DESCRIPTION); sourceFile.setParseError("JSP file could not be parsed: " + e.getMessage()); } }
Source:
<code>private static void createBucket(String volumeName, String bucketName) throws IOException { OmBucketInfo bucketInfo = OmBucketInfo.newBuilder() .setVolumeName(volumeName) <START> .setBucketName(bucketName) <END> .build(); String bucketKey = metadataManager.getBucketKey(volumeName, bucketName); metadataManager.getBucketTable().put(bucketKey, bucketInfo); metadataManager.getBucketTable().addCacheEntry(new CacheKey<>(bucketKey), new CacheValue<>(Optional.of(bucketInfo), 1L)); }</code><technical_language>@bharatviswa504 some test utility methods for this hide detail table/cache updated directly</technical_language>

Target:
private static void createBucket(String volumeName, String bucketName) throws IOException { OmBucketInfo bucketInfo = OmBucketInfo.newBuilder() .setVolumeName(volumeName) .setBucketName(bucketName) .build(); TestOMRequestUtils.addBucketToOM(metadataManager, bucketInfo); }
Source:
<code>private Result executeCmd(String cmd) throws IOException, InterruptedException { PrintStream stdout = listener.getLogger(); PrintStream stderr = listener.getLogger(); KeyMaterial registryKey = null; try { <START> registryKey = registry.materialize(build); <END> EnvVars env = new EnvVars(); env.putAll(build.getEnvironment(listener)); env.putAll(registryKey.env()); boolean result = launcher.launch() .envs(env) .pwd(build.getWorkspace()) .stdout(stdout) .stderr(stderr) .cmdAsSingleString(cmd) .start().join() == 0; String stdoutStr = stdout.toString(); return new Result(result, stdoutStr); } finally { if (registryKey != null) { registryKey.close(); } } }</code><technical_language>Declare in initializer try block, finally block need check for null</technical_language>

Target:
private Result executeCmd(String cmd) throws IOException, InterruptedException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); TeeOutputStream stdout = new TeeOutputStream(listener.getLogger(), baos); PrintStream stderr = listener.getLogger(); KeyMaterial registryKey = getRegistry().newKeyMaterialFactory(build).materialize(); KeyMaterial serverKey = server == null ? null : server.newKeyMaterialFactory(build).materialize(); logger.log(Level.FINER, "Executing: {0}", cmd); try { EnvVars env = new EnvVars(); env.putAll(build.getEnvironment(listener)); env.putAll(registryKey.env()); if (serverKey != null) { env.putAll(serverKey.env()); } boolean result = launcher.launch() .envs(env) .pwd(build.getWorkspace()) .stdout(stdout) .stderr(stderr) .cmdAsSingleString(cmd) .start().join() == 0; String stdoutStr = null; try { Computer computer = Computer.currentComputer(); if (computer != null) { Charset charset = computer.getDefaultCharset(); if (charset != null) { baos.flush(); stdoutStr = baos.toString(charset.name()); } } } catch (UnsupportedEncodingException e) { logger.log(Level.FINE, "Unable to get stdout from launched command: {}", e); } return new Result(result, stdoutStr); } finally { registryKey.close(); if (serverKey != null) { serverKey.close(); } } }
Source:
<code>public MetadataSerializer() { <START> this(null); <END> }</code><technical_language>passing a null type in mean</technical_language>

Target:
public MetadataSerializer() { super(CloudBlobMetadata.class); }
Source:
<code>protected int getPriorityFromTaintFrame(TaintFrame fact, int offset) throws DataflowAnalysisException { Taint mvcResultTaint = fact.getStackValue(offset); if (!mvcResultTaint.isSafe()) { Taint parameterTaint = fact.getStackValue(0); <START> if ( !parameterTaint.isSafe() <END> || (parameterTaint.getConstantValue() != null && parameterTaint.getConstantValue().toLowerCase().equals(VULNERABLE_CONTENT_TYPE)) ) { return getPriority(mvcResultTaint); } } return Priorities.IGNORE_PRIORITY; }</code><technical_language>of simply : if(!parameterTaint.isSafe() || VULNERABLE_CONTENT_TYPE.equalsIgnoreCase(parameterTaint.getConstantValue())) {</technical_language>

Target:
protected int getPriorityFromTaintFrame(TaintFrame fact, int offset) throws DataflowAnalysisException { Taint mvcResultTaint = fact.getStackValue(offset); if (!mvcResultTaint.isSafe()) { Taint parameterTaint = fact.getStackValue(0); if ( !parameterTaint.isSafe() || VULNERABLE_CONTENT_TYPE.equalsIgnoreCase(parameterTaint.getConstantValue())) { return getPriority(mvcResultTaint); } } return Priorities.IGNORE_PRIORITY; }
Source:
<code>protected void setFullScreen(boolean fullscreen) { try { if (youTubePlayer != null) { youTubePlayer.setFullscreen(fullscreen); } <START> } catch (IllegalStateException e) { <END> logger.error(e); releaseYoutubePlayer(); initializeYoutubePlayer(); } }</code><technical_language>Apply try catch this line</technical_language>

Target:
protected void setFullScreen(boolean fullscreen) { if (youTubePlayer != null) { try { youTubePlayer.setFullscreen(fullscreen); } catch (IllegalStateException e) { logger.error(e); releaseYoutubePlayer(); initializeYoutubePlayer(); } } }
Source:
<code>public Object[][] getArraysAndLists() { return new Object[][]{ <START> { <END> new Object[][]{ {1, 2}, {3, 4} }, Arrays.asList( Arrays.asList(1, 2), Arrays.asList(3, 4) ) }, { new Object[][]{ {1} }, Arrays.asList( Arrays.asList(1) ) }, { new Object[][]{ {1, 2, 3}, {4, 5, 6} }, Arrays.asList( Arrays.asList(1, 2, 3), Arrays.asList(4, 5, 6) ) }, { new Object[][]{ {1}, {2}, {3}, {4} }, Arrays.asList( Arrays.asList(1), Arrays.asList(2), Arrays.asList(3), Arrays.asList(4) ) } }; }</code><technical_language>add empty set, add actual products of more 2 lists (i.e. more element each) add a prodcut empty set add a product a empty set object</technical_language>

Target:
public Object[][] getArraysAndLists() { return new Object[][]{ { new Object[][]{ {1, 2}, {3, 4} }, Arrays.asList( Arrays.asList(1, 2), Arrays.asList(3, 4) ) }, { new Object[][]{ {1} }, Arrays.asList( Arrays.asList(1) ) }, { new Object[][]{ {1, 2, 3}, {4, 5, 6} }, Arrays.asList( Arrays.asList(1, 2, 3), Arrays.asList(4, 5, 6) ) }, { new Object[][]{ {1}, {2}, {3}, {4} }, Arrays.asList( Arrays.asList(1), Arrays.asList(2), Arrays.asList(3), Arrays.asList(4) ) }, }; }
Source:
<code>public void initialize(URI uri, Configuration conf) throws IOException { super.initialize(uri, conf); try { this.vfs = tryInitializeMountingViewFs(uri, conf); } catch (IOException ioe) { LOGGER.debug( "Mount tree initialization failed with the reason => {}. Falling" + " back to regular DFS initialization. Please" + " re-initialize" + " the fs after updating mount point.", ioe.getMessage()); <START> super.initialize(uri, conf); <END> return; } setConf(conf); defaultDFS = (DistributedFileSystem) this.vfs.getFallbackFileSystem(); Preconditions .checkNotNull("In ViewHDFS fallback link is mandatory.", defaultDFS); dfs = defaultDFS.dfs; }</code><technical_language>Do need initialize twice? is done L132</technical_language>

Target:
public void initialize(URI uri, Configuration conf) throws IOException { super.initialize(uri, conf); try { this.vfs = tryInitializeMountingViewFs(uri, conf); } catch (IOException ioe) { LOGGER.debug(new StringBuilder("Mount tree initialization failed with ") .append("the reason => {}. Falling back to regular DFS") .append(" initialization. Please re-initialize the fs after updating") .append(" mount point.").toString(), ioe.getMessage()); super.initDFSClient(uri, conf); super.setWorkingDirectory(super.getHomeDirectory()); return; } setConf(conf); defaultDFS = (DistributedFileSystem) this.vfs.getFallbackFileSystem(); dfs = (defaultDFS != null) ? defaultDFS.dfs : null; super.setWorkingDirectory(this.vfs.getHomeDirectory()); }
Source:
<code>public String getOption() { final Function<Path, FileTime> createTimeComp = path -> { try { return Files.readAttributes(path, BasicFileAttributes.class).creationTime(); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }; try (final Stream<Path> dirContents = Files.list(UNPACK_DIRECTORY.toPath())) { return dirContents .max(Comparator.comparing(createTimeComp)) .map(Path::toAbsolutePath) <START> .map(Path::toString) <END> .map( s -> { System.err.println(s); return s; }) .map(s -> StringUtils.replace(super.getOption(), KARAF_HOME, s)) .map(s -> s.replace('\\', '/')) .map(s -> s.replace("/bin/..", "/")) .map(s -> s.replace("c:", "C:")) .map(s -> s.replace("C:", "/C:")) .map(s -> s + "/") .orElseGet(super::getOption); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }</code><technical_language>This is Optional a stream is peek operation</technical_language>

Target:
public String getOption() { final Function<Path, FileTime> createTimeComp = path -> { try { return Files.readAttributes(path, BasicFileAttributes.class).creationTime(); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }; try (final Stream<Path> dirContents = Files.list(UNPACK_DIRECTORY.toPath())) { return dirContents .max(Comparator.comparing(createTimeComp)) .map(Path::toAbsolutePath) .map(Path::toString) .map( s -> { LOGGER.error(s); return s; }) .map(s -> StringUtils.replace(super.getOption(), KARAF_HOME, s)) .map(s -> s.replace('\\', '/')) .map(s -> s.replace("/bin/..", "/")) .map(s -> s.replace("c:", "C:")) .map(s -> s.replace("C:", "/C:")) .map(s -> s + "/") .orElseGet(super::getOption); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }
Source:
<code>public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseAttributes course = logic.getCourse(courseId); StudentAttributes student = null; if (userInfo.isInstructor) { String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { throw new UnauthorizedAccessException(Const.ErrorMessages.UNAUTHORIZED_ACCESS); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); } else if (userInfo.isStudent) { student = logic.getStudentForGoogleId(courseId, userInfo.id); if (student == null) { throw new UnauthorizedAccessException(Const.ErrorMessages.UNAUTHORIZED_ACCESS); } gateKeeper.verifyAccessible(student, course); } else { <START> Optional<StudentAttributes> studentCheck = getUnregisteredStudent(); <END> if (studentCheck.isPresent()) { student = studentCheck.get(); gateKeeper.verifyAccessible(student, course); } else { throw new UnauthorizedAccessException(Const.ErrorMessages.UNAUTHORIZED_ACCESS); } } }</code><technical_language>Try this: suggestion StudentAttributes student = getUnregisteredStudent().orElseThrow(...);</technical_language>

Target:
public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseAttributes course = logic.getCourse(courseId); StudentAttributes student = null; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String regKey = getRequestParamValue(Const.ParamsNames.REGKEY); if (studentEmail != null) { student = logic.getStudentForEmail(courseId, studentEmail); if (student == null || !userInfo.isInstructor) { throw new UnauthorizedAccessException(UNAUTHORIZED_ACCESS); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); } else if (regKey != null) { getUnregisteredStudent().orElseThrow(() -> new UnauthorizedAccessException(UNAUTHORIZED_ACCESS)); } else { if (!userInfo.isStudent) { throw new UnauthorizedAccessException(UNAUTHORIZED_ACCESS); } student = logic.getStudentForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(student, course); } }
Source:
<code>protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList( MethodMatcher.create() <START> .typeDefinition(TypeCriteria.is("javax.crypto.Cipher")) <END> .name("getInstance") .withAnyParameters()); }</code><technical_language>string is TypeCriteria.is()</technical_language>

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList( MethodMatcher.create() .typeDefinition("javax.crypto.Cipher") .name("getInstance") .withAnyParameters()); }
Source:
<code>private void validate(GetTokensByCodeParams params) { if (Strings.isNullOrEmpty(params.getCode())) { throw new HttpException(ErrorResponseCode.BAD_REQUEST_NO_CODE); } if (Strings.isNullOrEmpty(params.getState())) { throw new HttpException(ErrorResponseCode.BAD_REQUEST_NO_STATE); } try { <START> if (!getStateService().isExpiredObjectPresent(params.getState()) && !getStateService().isExpiredObjectPresent(Utils.decode(params.getState()))) { <END> throw new HttpException(ErrorResponseCode.BAD_REQUEST_STATE_NOT_VALID); } } catch (Exception e) { Log.error(e.getMessage(), e); throw new HttpException(ErrorResponseCode.BAD_REQUEST_STATE_NOT_VALID); } }</code><technical_language>Put isExpiredObjectPresent, check encoded decoded (it cover other places this method called)</technical_language>

Target:
private void validate(GetTokensByCodeParams params) { if (Strings.isNullOrEmpty(params.getCode())) { throw new HttpException(ErrorResponseCode.BAD_REQUEST_NO_CODE); } if (Strings.isNullOrEmpty(params.getState())) { throw new HttpException(ErrorResponseCode.BAD_REQUEST_NO_STATE); } try { if (!getStateService().isExpiredObjectPresent(getStateService().encodeExpiredObject(params.getState(), ExpiredObjectType.STATE))) { throw new HttpException(ErrorResponseCode.BAD_REQUEST_STATE_NOT_VALID); } } catch (Exception e) { Log.error(e.getMessage(), e); throw new HttpException(ErrorResponseCode.BAD_REQUEST_STATE_NOT_VALID); } }
Source:
<code>public void run() { while(this.interval > 0 && Cloud.getInstance().getStatus() == Cloud.Status.DBX_CONNECTED) { try { Thread.sleep(this.interval * 1000 * 60); SwingUtilities.invokeLater(new Runnable(){ @Override public void run(){ <START> new DbxFileActions().saveProgress(DbxUtil.getDbxClient(), drtc, false); <END> } }); } catch (InterruptedException ex) { break; } } }</code><technical_language>is this wrapped in SwingUtilities.invokeLater()</technical_language>

Target:
public void run() { while(this.interval > 0 && Cloud.getInstance().getStatus() == Cloud.Status.DBX_CONNECTED) { try { Thread.sleep(this.interval * 1000 * 60); SwingUtilities.invokeLater(new Runnable(){ @Override public void run(){ new DbxFileActions().saveProgress(DbxUtil.getDbxClient(), drtc, false); } }); } catch (InterruptedException ex) { LOGGER.log("You change the setting of remote auto sync."); break; } } }
Source:
<code>public void setEnableScheduledScanJobs(boolean enabled) { <START> this.mScheduledScanJobsEnabled = enabled; <END> }</code><technical_language>reason for this. here? asking mixed majority of cases included it</technical_language>

Target:
public void setEnableScheduledScanJobs(boolean enabled) { if (isAnyConsumerBound()) { LogManager.e(TAG, "ScanJob may not be configured because a consumer is" + " already bound."); throw new IllegalStateException("Method must be called before calling bind()"); } if (enabled && android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { LogManager.e(TAG, "ScanJob may not be configured because JobScheduler is not" + " availble prior to Android 5.0"); return; } mScheduledScanJobsEnabled = enabled; }
Source:
<code>private String createActiveBondTooltipMessage(Bond bond, HostInterfaceLineModel lineModel) { List<String> bondProperties = new <START> LinkedList<>(); <END> String adPartnerMac = Objects.toString(bond.getAdPartnerMac(), ""); bondProperties.add(messages.bondAdPartnerMac(adPartnerMac)); String adAggregatorId = Objects.toString(bond.getAdAggregatorId(), ""); bondProperties.add(messages.bondAdAggregatorId(adAggregatorId)); for (HostInterface nic : lineModel.getInterfaces()) { String nicName = nic.getName(); String nicAggregatorId = Objects.toString(nic.getInterface().getAdAggregatorId()); bondProperties.add(messages.bondSlaveAdAggregatorId(nicName, nicAggregatorId)); } return StringUtils.join(bondProperties, "\n"); }</code><technical_language>I guess a plain ArrayList work well</technical_language>

Target:
private String createActiveBondTooltipMessage(Bond bond, HostInterfaceLineModel lineModel) { List<String> bondProperties = new ArrayList<>(); String adPartnerMac = Objects.toString(bond.getAdPartnerMac(), ""); bondProperties.add(messages.bondAdPartnerMac(adPartnerMac)); String adAggregatorId = Objects.toString(bond.getAdAggregatorId(), ""); bondProperties.add(messages.bondAdAggregatorId(adAggregatorId)); for (HostInterface nic : lineModel.getInterfaces()) { String nicName = nic.getName(); String nicAggregatorId = Objects.toString(nic.getInterface().getAdAggregatorId()); bondProperties.add(messages.bondSlaveAdAggregatorId(nicName, nicAggregatorId)); } return StringUtils.join(bondProperties, "\n"); }
Source:
<code>public String reportProblemForAll() { for (Task task : this.steps) { this.currentStep = task; this.myDav.uploadFromHome(this.currentStep.getProcess()); this.problem.setId(getIdForCorrection(this.problemTask)); serviceManager.getWorkflowService().setProblem(getProblem()); try { setCurrentStep(serviceManager.getWorkflowService().reportProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setFehlerMeldung("correctionReportProblem"); <START> logger.error(e.getMessage(), e); <END> } } setProblem(serviceManager.getWorkflowService().getProblem()); this.problemTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }</code><technical_language>setErrorMessage</technical_language>

Target:
public String reportProblemForAll() { for (Task task : this.steps) { this.currentStep = task; this.myDav.uploadFromHome(this.currentStep.getProcess()); this.problem.setId(getIdForCorrection(this.problemTask)); serviceManager.getWorkflowControllerService().setProblem(getProblem()); try { setCurrentStep(serviceManager.getWorkflowControllerService().reportProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setErrorMessage("correctionReportProblem", logger, e); } } setProblem(serviceManager.getWorkflowControllerService().getProblem()); this.problemTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }
Source:
<code>public boolean subsumes(final PartitionKey other) { <START> return IntStream.range(0, keys.length).allMatch(i -> keys[i] == null || keys[i].equals(other.keys[i])); <END> }</code><technical_language>Objects.equals(keys[i], other.keys[i]) throw a NPE if other.keys[i] is null, do want it</technical_language>

Target:
public boolean subsumes(final PartitionKey other) { return IntStream.range(0, keys.length).allMatch(i -> keys[i] == null || Objects.equals(keys[i], other.keys[i])); }
Source:
<code>private void addAddress(List<DiscoveryNode> discoveredNodes, EndpointAddress endpointAddress) { Map<String, Object> properties = endpointAddress.getAdditionalProperties(); String ip = endpointAddress.getIp(); InetAddress inetAddress = mapAddress(ip); int port = (this.port > 0) ? this.port : getServicePort(properties); <START> logger.fine("Discovered node: " + ip + " port: " + port); <END> Address address = new Address(inetAddress, port); discoveredNodes.add(new SimpleDiscoveryNode(address, properties)); }</code><technical_language>Please uniform logging code in DnsEndpointResolver, i.e., log port number check log level here</technical_language>

Target:
private void addAddress(List<DiscoveryNode> discoveredNodes, EndpointAddress endpointAddress) { Map<String, Object> properties = endpointAddress.getAdditionalProperties(); String ip = endpointAddress.getIp(); InetAddress inetAddress = mapAddress(ip); int port = (this.port > 0) ? this.port : getServicePort(properties); if (logger.isFineEnabled()) { logger.fine("Discovered node: " + ip + " port: " + port); } Address address = new Address(inetAddress, port); discoveredNodes.add(new SimpleDiscoveryNode(address, properties)); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } <START> if (o == null || getClass() != o.getClass()) { <END> return false; } ErrorResult that = (ErrorResult) o; return err == that.err && Objects.equals(path, that.path); }</code><technical_language>changing this line</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ErrorResult)) { return false; } ErrorResult that = (ErrorResult) o; return err == that.err && Objects.equals(path, that.path); }
Source:
<code>public CompletableFuture<Void> visitKeySetCommand(InvocationContext ctx, KeySetCommand command) throws Throwable { return ctx.onReturn((ctx1, command1, rv, throwable) -> { if (throwable != null) throw throwable; CacheSet<K> set = (CacheSet<K>) rv; return CompletableFuture.completedFuture( new AbstractDelegatingKeyCacheSet<K, V>(Caches.getCacheWithFlags(cache, command), set) { @Override public CloseableIterator<K> iterator() { <START> <END> return new CloseableIteratorMapper<>(super.iterator(), e -> processRetVal(e, null)); } @Override public CloseableSpliterator<K> spliterator() { return new IteratorAsSpliterator.Builder<>(iterator()) .setEstimateRemaining(super.spliterator().estimateSize()).setCharacteristics( Spliterator.CONCURRENT | Spliterator.DISTINCT | Spliterator.NONNULL).get(); } }); }); }</code><technical_language>need new lines :)</technical_language>

Target:
public CompletableFuture<Void> visitKeySetCommand(InvocationContext ctx, KeySetCommand command) throws Throwable { return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { if (throwable != null) throw throwable; CacheSet<K> set = (CacheSet<K>) rv; return CompletableFuture.completedFuture( new AbstractDelegatingKeyCacheSet<K, V>(Caches.getCacheWithFlags(cache, ((KeySetCommand) rCommand)), set) { @Override public CloseableIterator<K> iterator() { return new CloseableIteratorMapper<>(super.iterator(), e -> processRetVal(e, null)); } @Override public CloseableSpliterator<K> spliterator() { return new IteratorAsSpliterator.Builder<>(iterator()) .setEstimateRemaining(super.spliterator().estimateSize()).setCharacteristics( Spliterator.CONCURRENT | Spliterator.DISTINCT | Spliterator.NONNULL).get(); } }); }); }
Source:
<code>public abstract void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException; public abstract void processCancellationBarrier(CancelCheckpointMarker cancelBarrier) throws IOException; public abstract void processEndOfPartition() throws IOException; public abstract long getLatestCheckpointId(); public long getAlignmentDurationNanos() { if (startOfAlignmentTimestamp <= 0) { <START> return FutureUtils.getOrDefault(latestAlignmentDurationNanos, 0L); <END> } else { return System.nanoTime() - startOfAlignmentTimestamp; } }</code><technical_language>Potential NPE (fixed proper getOrDefault)</technical_language>

Target:
public abstract void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException; public abstract void processCancellationBarrier(CancelCheckpointMarker cancelBarrier) throws IOException; public abstract void processEndOfPartition() throws IOException; public abstract long getLatestCheckpointId(); public long getAlignmentDurationNanos() { if (isDuringAlignment()) { return System.nanoTime() - startOfAlignmentTimestamp; } else { return FutureUtils.getOrDefault(latestAlignmentDurationNanos, 0L); } }
Source:
<code>static WorkloadTask generatePrototype(JTestDescription jTestDescription) { WorkloadTask prototype = new WorkloadTask(); <START> prototype.setCalibrator(new OneNodeCalibrator()); <END> prototype.setDescription(jTestDescription.getDescription()); QueryPoolScenarioFactory scenarioFactory = new QueryPoolScenarioFactory(); scenarioFactory.setQueryProvider(jTestDescription.getQueries()); scenarioFactory.setEndpointProvider(jTestDescription.getEndpoints()); scenarioFactory.setInvokerClazz(jTestDescription.getInvokerClass()); scenarioFactory.setLoadBalancer(new SimpleCircularLoadBalancer() {{ setPairSupplierFactory(new RoundRobinPairSupplierFactory()); }}); prototype.setScenarioFactory(scenarioFactory); prototype.setName(jTestDescription.getId()); return prototype; }</code><technical_language>this is hardcoded? want another implementations of Calibrator</technical_language>

Target:
public static WorkloadTask generatePrototype(JTestDescription jTestDescription) { WorkloadTask prototype = new WorkloadTask(); prototype.setCalibrator(new OneNodeCalibrator()); prototype.setDescription(jTestDescription.getDescription()); QueryPoolScenarioFactory scenarioFactory = new QueryPoolScenarioFactory(); scenarioFactory.setQueryProvider(jTestDescription.getQueries()); scenarioFactory.setEndpointProvider(jTestDescription.getEndpoints()); scenarioFactory.setInvokerClazz(jTestDescription.getInvoker().getClass()); scenarioFactory.setLoadBalancer(new SimpleCircularLoadBalancer() {{ setPairSupplierFactory(new RoundRobinPairSupplierFactory()); }}); prototype.setScenarioFactory(scenarioFactory); prototype.setName(jTestDescription.getId()); ManagedList collectors = new ManagedList(); collectors.add(getSuccessRateMetric()); collectors.add(ReflectionProvider.ofClass(DurationCollector.class)); collectors.add(ReflectionProvider.ofClass(InformationCollector.class)); ValidationCollectorProvider validationCollectorProvider = new ValidationCollectorProvider(); validationCollectorProvider.setValidator(ReflectionProvider.ofClass(NotNullResponseValidator.class)); collectors.add(validationCollectorProvider); prototype.setCollectors(collectors); prototype.setTestListeners(newArrayList(new CollectThreadsTestListener())); return prototype; }
Source:
<code><START> protected static VdcParameter create(String name, Class javaType, String uuidStr) { <END> UUID uuid = UUID.fromString(uuidStr); synchronized (parametersMap) { VdcParameter param = parametersMap.get(uuid); if (param != null) { throw new InvalidParameterUuidException(name, param.getUuid(), param.getName()); } param = new VdcParameter(name, javaType.getName(), uuid); parametersMap.put(uuid, param); return param; } }</code><technical_language>I prefer create in VdcParameter, delegate method here. of VdcParametersMeta is optional, for developer easier integration IDE, no</technical_language>

Target:
protected static VdcParameter create(String name, Class javaType, String uuidStr) { return VdcParameter.create(name, javaType, uuidStr); }
Source:
<code>public static IASTName getMemberDeclaration(ICPPMember member, IASTTranslationUnit contextTu, CRefactoringContext context, IProgressMonitor pm) throws CoreException, OperationCanceledException { IBinding classBinding = member.getClassOwner(); if (classBinding instanceof ICPPTemplateInstance) <START> classBinding = ((ICPPTemplateInstance) classBinding).getTemplateDefinition(); <END> IBinding memberBinding = member; if (member instanceof ICPPMethodSpecialization) memberBinding = ((ICPPMethodSpecialization) member).getSpecializedBinding(); IASTName classDefintionName = getDefinition(classBinding, contextTu, context, pm); if (classDefintionName == null) return null; IASTCompositeTypeSpecifier compositeTypeSpecifier = ASTQueries.findAncestorWithType(classDefintionName, IASTCompositeTypeSpecifier.class); IASTTranslationUnit ast = classDefintionName.getTranslationUnit(); IIndex index = context.getIndex(); if (index == null) { return null; } IASTName[] memberDeclarationNames = ast.getDeclarationsInAST(index.adaptBinding(memberBinding)); for (IASTName name : memberDeclarationNames) { if (name.getPropertyInParent() == IASTDeclarator.DECLARATOR_NAME) { IASTDeclaration declaration = ASTQueries.findAncestorWithType(name, IASTDeclaration.class); if (declaration.getParent() == compositeTypeSpecifier) { return name; } } } return null; }</code><technical_language>I this a bit more I this is correct. Consider this code: template<class T> class Base { public: virtual ~Base(); virtual void foo() { } }; template<> class Base<int> { public: virtual void foo() { } }; If calling getMemberDeclaration ICPPMember of foo, wrongly in Base class (not specialized), I think</technical_language>

Target:
public static IASTName getMemberDeclaration(ICPPMember member, IASTTranslationUnit contextTu, CRefactoringContext context, IProgressMonitor pm) throws CoreException, OperationCanceledException { IBinding classBinding = member.getClassOwner(); IBinding memberBinding = member; if (member instanceof ICPPSpecialization) memberBinding = ((ICPPSpecialization) member).getSpecializedBinding(); IASTName classDefintionName = getDefinition(classBinding, contextTu, context, pm); if (classDefintionName == null) { if (classBinding instanceof ICPPTemplateInstance) classBinding = ((ICPPTemplateInstance) classBinding).getTemplateDefinition(); classDefintionName = getDefinition(classBinding, contextTu, context, pm); if (classDefintionName == null) return null; } IASTCompositeTypeSpecifier compositeTypeSpecifier = ASTQueries.findAncestorWithType(classDefintionName, IASTCompositeTypeSpecifier.class); IASTTranslationUnit ast = classDefintionName.getTranslationUnit(); IIndex index = context.getIndex(); if (index == null) { return null; } IASTName[] memberDeclarationNames = ast.getDeclarationsInAST(index.adaptBinding(memberBinding)); for (IASTName name : memberDeclarationNames) { if (name.getPropertyInParent() == IASTDeclarator.DECLARATOR_NAME) { IASTDeclaration declaration = ASTQueries.findAncestorWithType(name, IASTDeclaration.class); if (declaration.getParent() == compositeTypeSpecifier) { return name; } } } return null; }
Source:
<code>private void registerNotification(SensorListener sensorListener) throws ConnectionException { if (!sensorListener.getXdk().isConnected()) { connect(sensorListener.getXdk()); } switch (sensorListener.getSensorType()) { case "ACCELERATION_X": case "ACCELERATION_Y": case "ACCELERATION_Z": case "GYROSCOPE_X": case "GYROSCOPE_Y": case "GYROSCOPE_Z": case "QUATERNION_M": case "QUATERNION_X": case "QUATERNION_Y": case "QUATERNION_Z": sensorListener.getXdk().disableHighNotifications(); sensorListener.getXdk().enableHighNotifications(SensorListener.getSensorConsumer(sensorListener)); break; case "LIGHT": case "NOISE": case "PRESURE": case "TEMPERATURE": case "HUMIDITY": case "SD_CARD_DETECT_STATUS": sensorListener.getXdk().disableLowNotifications(); sensorListener.getXdk().enableLowNotifications(SensorListener.getSensorConsumer(sensorListener), m1); break; case "BUTTON_STATUS": sensorListener.getXdk().disableLowNotifications(); <START> waitFor(1000); <END> sensorListener.getXdk().enableLowNotifications(SensorListener.getSensorConsumer(sensorListener), m1); break; case "MAGNETIC_X": case "MAGNETIC_Y": case "MAGNETIC_Z": case "MAGNETOMETER_RESISTENCE": case "LED_STATUS": case "VOLTAGE_LEM": sensorListener.getXdk().disableLowNotifications(); sensorListener.getXdk().enableLowNotifications(SensorListener.getSensorConsumer(sensorListener), m2); break; default: } }</code><technical_language>this needs a timeout of 1 second</technical_language>

Target:
private void registerNotification(SensorListener sensorListener) throws ConnectionException { if (!sensorListener.getXdk().isConnected()) { connect(sensorListener.getXdk()); } switch (sensorListener.getSensorType()) { case "ACCELERATION_X": case "ACCELERATION_Y": case "ACCELERATION_Z": case "GYROSCOPE_X": case "GYROSCOPE_Y": case "GYROSCOPE_Z": case "QUATERNION_M": case "QUATERNION_X": case "QUATERNION_Y": case "QUATERNION_Z": sensorListener.getXdk().disableHighNotifications(); sensorListener.getXdk().enableHighNotifications(SensorListener.getSensorConsumer(sensorListener)); break; case "LIGHT": case "NOISE": case "PRESSURE": case "TEMPERATURE": case "HUMIDITY": case "SD_CARD_DETECT_STATUS": case "BUTTON_STATUS": sensorListener.getXdk().disableLowNotifications(); sensorListener.getXdk().enableLowNotifications(SensorListener.getSensorConsumer(sensorListener), MESSAGE_ONE); break; case "MAGNETIC_X": case "MAGNETIC_Y": case "MAGNETIC_Z": case "MAGNETOMETER_RESISTENCE": case "LED_STATUS": case "VOLTAGE_LEM": sensorListener.getXdk().disableLowNotifications(); sensorListener.getXdk().enableLowNotifications(SensorListener.getSensorConsumer(sensorListener), MESSAGE_TWO); break; default: } }
Source:
<code>protected void updateExpiration(final String tokenId, long expiration) { synchronized (tokenExpirations) { <START> if (tokenExpirations.containsKey(tokenId)) { tokenExpirations.replace(tokenId, expiration); } else { tokenExpirations.put(tokenId, expiration); } <END> } }</code><technical_language>Map.replace runs a containsKey: default implementation is equivalent to, for this map: if (map.containsKey(key)) { return map.put(key, value); } else return null; I a simple put is enough: want expiration in tokenExpirations</technical_language>

Target:
protected void updateExpiration(final String tokenId, long expiration) { synchronized (tokenExpirations) { tokenExpirations.put(tokenId, expiration); } }
Source:
<code>public List<Component> analyze(String command) { if (!command.contains(" add ")) { return new ArrayList<>(); } command = command.replace(Commands.Apk.asString(), ""); String[] words = command.split("\\s"); <START> List<String> packets = new ArrayList<>(); <END> boolean skipNextWord = false; for (String word : words) { if (!skipNextWord) { if (word.length() > 0 && word.charAt(0) != '-') { packets.add(word); } if (word.equals("add")) { packets.clear(); } if (word.equals("--repository")) { skipNextWord = true; } } else { skipNextWord = false; } } return parseComponents(packets); }</code><technical_language>correct term "tokens"</technical_language>

Target:
public List<Component> analyze(String command) { if (!command.contains(" add ")) { return new ArrayList<>(); } command = command.replace(Commands.Apk.asString(), ""); String[] words = command.split("\\s"); List<String> packages = new ArrayList<>(); boolean skipNextWord = false; for (String word : words) { if (!skipNextWord) { if (word.length() > 0 && word.charAt(0) != '-') { packages.add(word); } if (word.equals("add")) { packages.clear(); } if (word.equals("--repository")) { skipNextWord = true; } } else { skipNextWord = false; } } return parseComponents(packages); }
Source:
<code>private void removeYarnTask(RMContainer rmContainer) { if (containersNotNull(rmContainer)){ Protos.TaskID taskId = containerToTaskId(rmContainer); state.makeTaskKillable(taskId); Optional<Node> optNode = retrieveNode(rmContainer); if (optNode.isPresent()) { <START> RMNode rmNode = optNode.get().getNode().getRMNode(); <END> Resource resource = rmContainer.getContainer().getResource(); decrementNodeCapacity(rmNode, resource); LOGGER.info("Removed task yarn_{} with exit status freeing cpu and mem.", rmContainer.getContainer().toString(), rmContainer.getContainerExitStatus(), resource.getVirtualCores(), resource.getMemory()); } else { LOGGER.warn("The Node for the host was not found", rmContainer.getContainer().getNodeId().getHost()); } } }</code><technical_language>While a fan of optionals this usage is a bit overkill, in fact I this clear cost of extra object creation</technical_language>

Target:
private void removeYarnTask(RMContainer rmContainer) { if (containersNotNull(rmContainer)){ Protos.TaskID taskId = containerToTaskId(rmContainer); state.makeTaskKillable(taskId); Node node = retrieveNode(rmContainer); if (node != null) { RMNode rmNode = node.getNode().getRMNode(); Resource resource = rmContainer.getContainer().getResource(); decrementNodeCapacity(rmNode, resource); LOGGER.info("Removed task yarn_{} with exit status freeing cpu and mem.", rmContainer.getContainer().toString(), rmContainer.getContainerExitStatus(), resource.getVirtualCores(), resource.getMemory()); } else { LOGGER.warn("The Node for the host was not found", rmContainer.getContainer().getNodeId().getHost()); } } }
Source:
<code>private void processSuite(TestSuiteModel ts) { for (TestCaseModel tc : ts.getTestcase()) { if (tc.getError() != null) { <START> System.out.println(); <END> } } for (TestCaseModel tc : ts.getTestcase()) { tc.postProcess(); } ts.postProcess(); processedTestSuites.add(ts); }</code><technical_language>do need this check</technical_language>

Target:
private void processSuite(TestSuiteModel ts) { for (TestCaseModel tc : ts.getTestcase()) { tc.postProcess(); } ts.postProcess(); processedTestSuites.add(ts); }
Source:
<code>private List<HostCertificate> loadSavedCertificates() { List<HostCertificate> savedItems = new ArrayList<>(); String value = getPreferenceStore().getString(ALLOWED_CERTIFICATES_NEW); if (!StringUtils.isBlank(value)) { String[] tokens = value.split(SEPARATOR); <START> for (int i = 0; i + 4 <= tokens.length;) { <END> boolean accepted = Boolean.toString(Boolean.TRUE).equals(tokens[i++]); X509Certificate certificate = createCertificate(tokens[i++]); if (certificate == null) { continue; } HostCertificate hostCertificate = new HostCertificate(accepted, certificate); if(hostCertificate.isValid()) { savedItems.add(hostCertificate); } } } return savedItems; }</code><technical_language>reason for +4 increment store items certificate</technical_language>

Target:
private synchronized List<HostCertificate> loadSavedCertificates() { List<HostCertificate> savedItems = new ArrayList<>(); String value = getPreferenceStore().getString(ALLOWED_CERTIFICATES_NEW); if (!StringUtils.isBlank(value)) { String[] tokens = value.split(SEPARATOR); for (int i = 0; i + 2 <= tokens.length;) { boolean accepted = Boolean.toString(Boolean.TRUE).equals(tokens[i++]); X509Certificate certificate = createCertificate(tokens[i++]); if (certificate == null) { continue; } HostCertificate hostCertificate = new HostCertificate(accepted, certificate); if (hostCertificate.isValid()) { savedItems.add(hostCertificate); } } } return savedItems; }
Source:
<code>public EventBuffer(EventStream delegate, EventUpcaster upcasterChain, Serializer serializer, boolean disableEventBlacklisting) { this.delegate = delegate; this.eventStream = EventUtils.upcastAndDeserializeTrackedEvents( StreamSupport.stream(new SimpleSpliterator<>(this::poll), false), new GrpcMetaDataAwareSerializer(serializer), getOrDefault(upcasterChain, NoOpEventUpcaster.INSTANCE) ).iterator(); this.serializer = serializer; this.disableEventBlacklisting = disableEventBlacklisting; delegate.onAvailable(() -> { lock.lock(); try { dataAvailable.signalAll(); } finally { lock.unlock(); } }); <START> logger.debug("Now, with adjusted poll operation!"); <END> }</code><technical_language>I advertising ;-)</technical_language>

Target:
public EventBuffer(EventStream delegate, EventUpcaster upcasterChain, Serializer serializer, boolean disableEventBlacklisting) { this.delegate = delegate; this.serializer = serializer; this.disableEventBlacklisting = disableEventBlacklisting; this.eventStream = EventUtils.upcastAndDeserializeTrackedEvents( StreamSupport.stream(new SimpleSpliterator<>(this::poll), false), new GrpcMetaDataAwareSerializer(serializer), getOrDefault(upcasterChain, NoOpEventUpcaster.INSTANCE) ).iterator(); delegate.onAvailable(() -> { lock.lock(); try { dataAvailable.signalAll(); } finally { lock.unlock(); } }); }
Source:
<code>public ArrayList<VdcQueryReturnValue> runMultipleQueries( ArrayList<VdcQueryType> queryTypeList, ArrayList<VdcQueryParametersBase> queryParamsList) { int size = queryTypeList == null ? 0 : queryTypeList.size(); log.debug("Server: RunMultipleQuery invoked! [amount of queries: {}]", size); ArrayList<VdcQueryReturnValue> ret = new ArrayList<>(); if (queryTypeList != null && queryParamsList != null && queryTypeList.size() == queryParamsList.size()) { for (int i = 0; i < queryTypeList.size(); i++) { debugQuery(queryTypeList.get(i), queryParamsList.get(i)); ret.add(runQuery(queryTypeList.get(i), queryParamsList.get(i))); } } else { log.error( "Wrong multi query usage: the query types and parameters" + " must not be null or be equally long. Types '{}' Params '{}'", <START> queryTypeList, <END> queryParamsList); } for (VdcQueryReturnValue vqrv : ret) { log.debug("VdcQueryReturnValue '{}'", vqrv); } log.debug("Server: RunMultipleQuery result [amount of queries: {}]", ret.size()); return ret; }</code><technical_language>I log actual values of parameters, potentially sensitive information want in log file</technical_language>

Target:
public ArrayList<VdcQueryReturnValue> runMultipleQueries( ArrayList<VdcQueryType> queryTypeList, ArrayList<VdcQueryParametersBase> queryParamsList) { int size = queryTypeList == null ? 0 : queryTypeList.size(); log.debug("Server: RunMultipleQuery invoked! [amount of queries: {}]", size); ArrayList<VdcQueryReturnValue> ret = new ArrayList<>(); if (queryTypeList != null && queryParamsList != null && queryTypeList.size() == queryParamsList.size()) { String correlationId = CorrelationIdTracker.getCorrelationId(); for (int i = 0; i < queryTypeList.size(); i++) { if (queryParamsList.get(i).getCorrelationId() == null) { queryParamsList.get(i).setCorrelationId(correlationId); } debugQuery(queryTypeList.get(i), queryParamsList.get(i)); ret.add(runQuery(queryTypeList.get(i), queryParamsList.get(i))); } } else { log.error( "Wrong multi query usage: the query types and parameters must not be null " + " or be equally long. Types length '{}' vs params length '{}'", queryTypeList == null ? 0 : queryTypeList.size(), queryParamsList == null ? 0 : queryParamsList.size() ); } for (VdcQueryReturnValue vqrv : ret) { log.debug("VdcQueryReturnValue '{}'", vqrv); } log.debug("Server: RunMultipleQuery result [amount of queries: {}]", ret.size()); return ret; }
Source:
<code>protected void SyncSearch() { if (getEntity() == null) { return; } super.SyncSearch(); AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object ReturnValue) { StorageDiskListModel storageDiskListModel = (StorageDiskListModel) model; storageDiskListModel.setItems((ArrayList<DiskImage>) ((VdcQueryReturnValue) ReturnValue).getReturnValue()); } }); StorageDomainQueryParametersBase parameters = new StorageDomainQueryParametersBase((getEntity()).getId()); parameters.setRefresh(getIsQueryFirstTime()); <START> Frontend.RunQuery(VdcQueryType.GetAllDisksByStorageDomainId, parameters, query); <END> }</code><technical_language>I personally RunQuery create call anonymous class in statement, right query is executed instead of callback happens, matter of style I guess want consider</technical_language>

Target:
protected void SyncSearch() { if (getEntity() == null) { return; } super.SyncSearch(); StorageDomainQueryParametersBase parameters = new StorageDomainQueryParametersBase((getEntity()).getId()); parameters.setRefresh(getIsQueryFirstTime()); Frontend.RunQuery(VdcQueryType.GetAllDisksByStorageDomainId, parameters, new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object ReturnValue) { StorageDiskListModel storageDiskListModel = (StorageDiskListModel) model; storageDiskListModel.setItems((ArrayList<DiskImage>) ((VdcQueryReturnValue) ReturnValue).getReturnValue()); } })); }
Source:
<code>public void testGetProducerInfoCompleteClient() { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("3"); serverSpan.setParentId("2"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("3"); clientSpan.setParentId("2"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); Span midSpan = new Span(); midSpan.setId("2"); midSpan.setParentId("1"); Span topServerSpan = new Span(); topServerSpan.setId("1"); topServerSpan.setParentId("1"); topServerSpan.setAnnotations(serverAnnotations()); BinaryAnnotation ba2 = new BinaryAnnotation(); ba2.setKey("http.url"); ba2.setValue("http://myhost:8080/originaluri"); topServerSpan.setBinaryAnnotations(Arrays.asList(ba2)); try { spanCache.store(null, Arrays.asList(serverSpan, clientSpan, midSpan, topServerSpan), SpanUniqueIdGenerator::toUnique); <START> } catch (CacheException e) { <END> fail("Failed to store span"); } ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals("/originaluri", pi.getSourceUri()); }</code><technical_language>I catch this test Error a failure</technical_language>

Target:
public void testGetProducerInfoCompleteClient() throws CacheException { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("3"); serverSpan.setParentId("2"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("3"); clientSpan.setParentId("2"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); Span midSpan = new Span(); midSpan.setId("2"); midSpan.setParentId("1"); Span topServerSpan = new Span(); topServerSpan.setId("1"); topServerSpan.setParentId("1"); topServerSpan.setAnnotations(serverAnnotations()); BinaryAnnotation ba2 = new BinaryAnnotation(); ba2.setKey("http.url"); ba2.setValue("http://myhost:8080/originaluri"); topServerSpan.setBinaryAnnotations(Arrays.asList(ba2)); spanCache.store(null, Arrays.asList(serverSpan, clientSpan, midSpan, topServerSpan), SpanUniqueIdGenerator::toUnique); ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals("/originaluri", pi.getSourceUri()); }