auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean runTest() { <START> Display display = mContext.getWindowManager().getDefaultDisplay(); boolean passing = checkEqualsAndLog(R.string.tv_hdr_display_is_hdr, false, display.isHdr()); passing &= hasNoHdrCapabilities(display, this); return passing; } <END></code><technical_language>isNotHdr(display)? hide logging for readability</technical_language>

Target:
public void runTest() { Display display = mContext.getWindowManager().getDefaultDisplay(); getAsserter() .withFailureMessage("Display.isHdr()") .that(display.isHdr()) .isTrue(); getAsserter() .withFailureMessage("Display.getHdrCapabilities()") .that(display.getHdrCapabilities().getSupportedHdrTypes()) .isEmpty(); }
Source:
<code>public void testGetCustomPeriod() throws InterruptedException, ParseException { server.enqueue( new MockResponse().setBody(stringFromResource("/monitoringcenters/get.json")) ); GenericDateQueryOptions options = new GenericDateQueryOptions(); String startStr = "11-11-2012"; String endStr = "11-11-2013"; DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); Date end = dateFormat.parse(endStr); Date start = dateFormat.parse(startStr); options.CustomPeriod(start, end); MonitoringCenter result = monitoringCenterApi().get("serverId", options); assertNotNull(result); assertEquals(server.getRequestCount(), 1); <START> assertSent(server, "GET", "/monitoring_center/serverId?period=CUSTOM&start_date=" + URLEncoder.encode(FormatDateToISO8601(start)) + "&end_date=" + URLEncoder.encode(FormatDateToISO8601(end))); <END> }</code><technical_language>Put expected date a string literal, serializing date expected</technical_language>

Target:
public void testGetCustomPeriod() throws InterruptedException, ParseException { server.enqueue( new MockResponse().setBody(stringFromResource("/monitoringcenters/get.json")) ); GenericDateQueryOptions options = new GenericDateQueryOptions(); String startStr = "11-11-2012"; String endStr = "11-11-2013"; DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); Date end = dateFormat.parse(endStr); Date start = dateFormat.parse(startStr); options.customPeriod(start, end); MonitoringCenter result = monitoringCenterApi().get("serverId", options); assertNotNull(result); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/monitoring_center/serverId?period=CUSTOM&start_date=2012-11-11T00%3A00%3A00Z&end_date=2013-11-11T00%3A00%3A00Z"); }
Source:
<code>public Supplier<Flux<Message<String>>> sendMessageToTopicOne() { return () -> Flux.fromStream( Stream.generate( new Supplier<Message<String>>() { @Override public Message<String> get() { try { Thread.sleep(10000); } finally { <START> Random rand = new Random(); <END> Message<String> message = MessageBuilder.withPayload("message-" + rand.nextInt(1000)).build(); LOGGER.info( "Sending a message via the output binder to topic-one! Payload: " + message.getPayload()); return message; } } })) .subscribeOn(Schedulers.elastic()) .share(); }</code><technical_language>Ok, this earlier - possibly a classvar static reused</technical_language>

Target:
public Supplier<Flux<Message<String>>> sendMessageToTopicOne() { return () -> Flux.fromStream( Stream.generate( new Supplier<Message<String>>() { @Override public Message<String> get() { try { Thread.sleep(10000); } finally { Message<String> message = MessageBuilder.withPayload("message-" + rand.nextInt(1000)).build(); LOGGER.info( "Sending a message via the output binder to topic-one! Payload: " + message.getPayload()); return message; } } })) .subscribeOn(Schedulers.elastic()) .share(); }
Source:
<code>public <T> List<T> toPOJO(final QueryResult queryResult, final Class<T> clazz, final String measurementName) throws InfluxDBMapperException { Objects.requireNonNull(queryResult, "queryResult"); Objects.requireNonNull(clazz, "clazz"); throwExceptionIfResultWithError(queryResult); cacheMeasurementClass(clazz); List<T> result = new LinkedList<T>(); <START> if (measurementName == null || measurementName.isEmpty()) <END> { throw new IllegalArgumentException("measurementName must not be null or empty"); } queryResult.getResults().stream() .filter(internalResult -> Objects.nonNull(internalResult) && Objects.nonNull(internalResult.getSeries())) .forEach(internalResult -> { internalResult.getSeries().stream() .filter(series -> series.getName().equals(measurementName)) .forEachOrdered(series -> { parseSeriesAs(series, clazz, result); }); }); return result; }</code><technical_language>Please move verification top of method. IMO Objects.requireNonNull(measurementName, "measurementName"); enough code resilient empty string</technical_language>

Target:
public <T> List<T> toPOJO(final QueryResult queryResult, final Class<T> clazz, final String measurementName) throws InfluxDBMapperException { Objects.requireNonNull(measurementName, "measurementName"); Objects.requireNonNull(queryResult, "queryResult"); Objects.requireNonNull(clazz, "clazz"); throwExceptionIfResultWithError(queryResult); cacheMeasurementClass(clazz); List<T> result = new LinkedList<T>(); queryResult.getResults().stream() .filter(internalResult -> Objects.nonNull(internalResult) && Objects.nonNull(internalResult.getSeries())) .forEach(internalResult -> { internalResult.getSeries().stream() .filter(series -> series.getName().equals(measurementName)) .forEachOrdered(series -> { parseSeriesAs(series, clazz, result); }); }); return result; }
Source:
<code>public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { <START> HttpServletRequest req = (HttpServletRequest) request; String lengthHeader = req.getHeader("Content-Length"); if(lengthHeader != null && !isSizeWithinBoundaries(lengthHeader)) { throw new MaxUploadSizeExceededException(multipartConfigElement.getMaxFileSize()); } chain.doFilter(request, response); <END> }</code><technical_language>suggestion HttpServletRequest req = (HttpServletRequest) request; String lengthHeader = req.getHeader("Content-Length"); if(lengthHeader != null && !isSizeWithinBoundaries(lengthHeader)) { throw new MaxUploadSizeExceededException(multipartConfigElement.getMaxFileSize()); } chain.doFilter(request, response);</technical_language>

Target:
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; String lengthHeader = req.getHeader(CONTENT_LENGTH); if(StringUtils.isNotEmpty(lengthHeader)) { checkIfSizeInBoundaries(lengthHeader); } chain.doFilter(request, response); }
Source:
<code>public boolean supportsSecureHardware() { try (SelfDestroyKey sdk = new SelfDestroyKey(TEST_KEY_ALIAS)) { <START> return validateKeySecurityLevel(SECURE_HARDWARE, sdk.key); <END> } catch (Throwable ignored) { return false; } }</code><technical_language>follow code style in this file: suggestion return validateKeySecurityLevel(SecurityLevel.SECURE_HARDWARE, sdk.key);</technical_language>

Target:
public boolean supportsSecureHardware() { if (null != isSupportsSecureHardware) return isSupportsSecureHardware.get(); synchronized (_sync) { if (null != isSupportsSecureHardware) return isSupportsSecureHardware.get(); isSupportsSecureHardware = new AtomicBoolean(false); SelfDestroyKey sdk = null; try { sdk = new SelfDestroyKey(TEST_KEY_ALIAS); final boolean newValue = validateKeySecurityLevel(SECURE_HARDWARE, sdk.key); isSupportsSecureHardware.set(newValue); } catch (Throwable ignored) { } finally { if (null != sdk) sdk.close(); } } return isSupportsSecureHardware.get(); }
Source:
<code>protected List<RefNode> getRefNodes(RevCommit commit, Repository repo, String refPrefix) { List<Ref> availableBranches = new ArrayList<Ref>(); List<RefNode> nodes = new ArrayList<RefNode>(); try { <START> Map<String, Ref> localBranches = repo.getRefDatabase().getRefs( <END> refPrefix); for (Ref branch : localBranches.values()) { if (branch.getLeaf().getObjectId().equals(commit.getId())) { availableBranches.add(branch); } } RepositoryNode repoNode = new RepositoryNode(null, repo); for (Ref ref : availableBranches) { nodes.add(new RefNode(repoNode, repo, ref)); } } catch (IOException e) { } return nodes; }</code><technical_language>if refPrefix "refs/remotes/origin/" this yield local branches</technical_language>

Target:
protected List<RefNode> getRefNodes(RevCommit commit, Repository repo, String refPrefix) { List<Ref> availableBranches = new ArrayList<Ref>(); List<RefNode> nodes = new ArrayList<RefNode>(); try { Map<String, Ref> branches = repo.getRefDatabase().getRefs( refPrefix); for (Ref branch : branches.values()) { if (branch.getLeaf().getObjectId().equals(commit.getId())) availableBranches.add(branch); } RepositoryNode repoNode = new RepositoryNode(null, repo); for (Ref ref : availableBranches) nodes.add(new RefNode(repoNode, repo, ref)); } catch (IOException e) { } return nodes; }
Source:
<code>public BaseAveragerFactory(String name, int numBuckets, String fieldName, Integer cycleSize) { this.name = name; this.numBuckets = numBuckets; this.fieldName = fieldName; this.cycleSize = (cycleSize != null) ? cycleSize : DEFAULT_PERIOD; Preconditions.checkNotNull(name, "Must have a valid, non-null averager name"); Preconditions.checkNotNull(fieldName, "Must have a valid, non-null field name"); Preconditions.checkArgument(this.cycleSize > 0, "Cycle size must be greater than zero"); Preconditions.checkArgument(numBuckets > 0, "Bucket size must be greater than zero"); <START> Preconditions.checkArgument(this.cycleSize < numBuckets, "Cycle size must be less than the bucket size"); <END> Preconditions.checkArgument(numBuckets % this.cycleSize == 0, "cycleSize must devide numBuckets without a remainder"); }</code><technical_language>wondering cycleSize smaller numBuckets. if numBuckets = 1</technical_language>

Target:
public BaseAveragerFactory(String name, int numBuckets, String fieldName, Integer cycleSize) { this.name = name; this.numBuckets = numBuckets; this.fieldName = fieldName; this.cycleSize = (cycleSize != null) ? cycleSize : DEFAULT_PERIOD; Preconditions.checkNotNull(name, "Must have a valid, non-null averager name"); Preconditions.checkNotNull(fieldName, "Must have a valid, non-null field name"); Preconditions.checkArgument(this.cycleSize > 0, "Cycle size must be greater than zero"); Preconditions.checkArgument(numBuckets > 0, "Bucket size must be greater than zero"); Preconditions.checkArgument(!(this.cycleSize > numBuckets), "Cycle size must be less than the bucket size"); Preconditions.checkArgument(numBuckets % this.cycleSize == 0, "cycleSize must devide numBuckets without a remainder"); }
Source:
<code>public void testAllVisible() throws Exception { when(cqlClient.executeQuery(any())) .thenReturn(Futures.immediateFuture(Optional.of(Value.create(PtBytes.toBytes("dummy"), 11)))) .thenReturn(Futures.immediateFuture(Optional.of(Value.create(PtBytes.toBytes("dummy"), 13)))); Map<Cell, Long> request = ImmutableMap.of(VISIBLE_CELL_1, TIMESTAMP, VISIBLE_CELL_2, TIMESTAMP); AsyncCellLoader asyncCellLoader = AsyncCellLoader.create(cqlClient, testExecutor, DEFAULT_KEYSPACE); Map<Cell, Value> result = asyncCellLoader.loadAllWithTimestamp(DEFAULT_TABLE, request).get(); <START> assertThat(result.isEmpty()).isFalse(); <END> assertThat(result.containsKey(VISIBLE_CELL_1)).isTrue(); assertThat(result.containsKey(VISIBLE_CELL_2)).isTrue(); }</code><technical_language>map assertions</technical_language>

Target:
public void testAllVisible() throws Exception { setUpVisibleCells(VISIBLE_CELL_1, VISIBLE_CELL_2); Map<Cell, Long> request = ImmutableMap.of( VISIBLE_CELL_1, TIMESTAMP, VISIBLE_CELL_2, TIMESTAMP); Map<Cell, Value> result = asyncCellLoader.loadAllWithTimestamp(TABLE, request).get(); assertThat(result) .containsOnlyKeys(VISIBLE_CELL_1, VISIBLE_CELL_2); }
Source:
<code>private static String getFileNamePrefix(String path, int objectId) { StringBuilder name; int f = objectId % SysProperties.LOB_FILES_PER_DIRECTORY; if (f > 0) { <START> name = new StringBuilder(SysProperties.FILE_SEPARATOR + objectId); <END> } else { name = new StringBuilder(); } objectId /= SysProperties.LOB_FILES_PER_DIRECTORY; while (objectId > 0) { f = objectId % SysProperties.LOB_FILES_PER_DIRECTORY; name.insert(0, SysProperties.FILE_SEPARATOR + f + Constants.SUFFIX_LOBS_DIRECTORY); objectId /= SysProperties.LOB_FILES_PER_DIRECTORY; } name = new StringBuilder(FileUtils.toRealPath(path + Constants.SUFFIX_LOBS_DIRECTORY + name)); return name.toString(); }</code><technical_language>concatenation is new StringBuilder()</technical_language>

Target:
private static String getFileNamePrefix(String path, int objectId) { String name; int f = objectId % SysProperties.LOB_FILES_PER_DIRECTORY; if (f > 0) { name = SysProperties.FILE_SEPARATOR + objectId; } else { name = ""; } objectId /= SysProperties.LOB_FILES_PER_DIRECTORY; while (objectId > 0) { f = objectId % SysProperties.LOB_FILES_PER_DIRECTORY; name = SysProperties.FILE_SEPARATOR + f + Constants.SUFFIX_LOBS_DIRECTORY + name; objectId /= SysProperties.LOB_FILES_PER_DIRECTORY; } name = FileUtils.toRealPath(path + Constants.SUFFIX_LOBS_DIRECTORY + name); return name; }
Source:
<code>private void checkIfPageIsSaved() { if (getActivity() != null && getTitle() != null) { <START> pageSaved = SavedPage.PERSISTENCE_HELPER.savedPageExists(app, getTitle()); <END> } }</code><technical_language>Do want do database IO main thread</technical_language>

Target:
private void checkIfPageIsSaved() { if (getActivity() != null && getTitle() != null) { new SavedPageCheckTask(getTitle(), app) { @Override public void onFinish(Boolean exists) { setPageSaved(exists); setSavedPageCheckComplete(true); } }.execute(); } }
Source:
<code>public Date getProjectStartDate() { <START> List<ISprintPlanDesc> sprintList = this.loadListPlans(); <END> return DateUtil.dayFilter(sprintList.get(0).getStartDate()); }</code><technical_language>I hate 'this'</technical_language>

Target:
public Date getProjectStartDate() { List<ISprintPlanDesc> sprintList = loadListPlans(); return DateUtil.dayFilter(sprintList.get(0).getStartDate()); }
Source:
<code>protected boolean canDoAction() { <START> boolean canDo = false; <END> if (!Guid.isNullOrEmpty(getParameters().getUserId())) { DbUser dbUser = getDbFacade().getDbUserDao().get(getParameters().getUserId()); if (dbUser == null) { addCanDoActionMessage(EngineMessage.USER_MUST_EXIST_IN_DB); return false; } UserProfile userProfile = getDbFacade().getUserProfileDao().getByUserId(getParameters().getUserId()); if (userProfile == null || StringUtils.isEmpty(userProfile.getSshPublicKey())) { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_PROFILE_NOT_EXIST); return false; } canDo = true; } else if (StringUtils.isNotEmpty(getParameters().getAuthzName()) && StringUtils.isNotEmpty(getParameters().getUserName())) { DbUser dbUser = getDbFacade().getDbUserDao().getByUsernameAndDomain(getParameters().getUserName(), getParameters().getAuthzName()); if (dbUser == null) { addCanDoActionMessage(EngineMessage.USER_MUST_EXIST_IN_DB); return false; } } else if (StringUtils.isNotEmpty(getParameters().getAuthzName()) && StringUtils.isNotEmpty(getParameters().getExternalId()) && StringUtils.isNotEmpty(getParameters().getNamespace())) { DbUser dbUser = getDbFacade().getDbUserDao().getByExternalId(getParameters().getAuthzName(), getParameters().getExternalId()); if (dbUser == null) { addCanDoActionMessage(EngineMessage.USER_MUST_EXIST_IN_DB); return false; } AuthenticationProfile profile = getProfileByAuthzName(getParameters().getAuthzName()); if (profile == null) { log.error("Can't login because authentication profile '{}' doesn't exist.", getParameters().getAuthzName()); addCanDoActionMessage(EngineMessage.USER_FAILED_TO_AUTHENTICATE); return false; } canDo = true; } return canDo; }</code><technical_language>need for this local variable. end of method return true - if a failure, returned 'false'</technical_language>

Target:
protected boolean canDoAction() { if (getDbUser() == null) { return failCanDoAction(EngineMessage.USER_MUST_EXIST_IN_DB); } return true; }
Source:
<code>public HiveNotReadableException(SchemaTableName tableName, Optional<String> partition, String message) { <START> super(HIVE_PARTITION_NOT_READABLE, format("Table '%s'%s is not readable: %s", tableName, partition.map(name -> " partition '" + name + "'").orElse(""), message)); <END> this.tableName = requireNonNull(tableName, "tableName is null"); this.partition = requireNonNull(partition, "partition is null"); }</code><technical_language>This is hard read. adding a method java super(HIVE_PARTITION_NOT_READABLE, format("%s is readable: %s", objectName(tableName, partition), message);</technical_language>

Target:
public HiveNotReadableException(SchemaTableName tableName, Optional<String> partition, String message) { super(partition.isPresent() ? HIVE_PARTITION_NOT_READABLE : HIVE_TABLE_READ_ONLY, composeMessage(tableName, partition, message)); this.tableName = requireNonNull(tableName, "tableName is null"); this.partition = requireNonNull(partition, "partition is null"); }
Source:
<code>public void visitNode(Tree tree) { if (hasSemantic()) { if (tree.is(Tree.Kind.REMAINDER)) { BinaryExpressionTree remainderTree = (BinaryExpressionTree) tree; <START> if (isIntegralOne(remainderTree.rightOperand()) && isIntOrLong(remainderTree)) { <END> reportIssue(remainderTree.operatorToken(), "Remove this computation of % 1, which always evaluates to zero."); } } else { MethodInvocationTree mit = (MethodInvocationTree) tree; if (isConstantWithLiteral(mit) || isTruncation(mit) || isConstantWithZero(mit) || isConstantWithZeroOrOne(mit)) { reportIssue(mit.methodSelect(), String.format("Remove this silly call to \"Math.%s\"", mit.symbol().name())); } } } }</code><technical_language>@benzonico isIntegral( method in this class reuse. False negative in case type is a boxed type, ie. java.lang.Integer</technical_language>

Target:
public void visitNode(Tree tree) { if (hasSemantic()) { if (tree.is(Tree.Kind.REMAINDER)) { BinaryExpressionTree remainderTree = (BinaryExpressionTree) tree; if (isIntegralOne(remainderTree.rightOperand()) && isIntOrLong(remainderTree.leftOperand())) { reportIssue(remainderTree.operatorToken(), "Remove this computation of % 1, which always evaluates to zero."); } } else { MethodInvocationTree mit = (MethodInvocationTree) tree; if (isConstantWithLiteral(mit) || isTruncation(mit) || isConstantWithZero(mit) || isConstantWithZeroOrOne(mit)) { reportIssue(mit.methodSelect(), String.format("Remove this silly call to \"Math.%s\"", mit.symbol().name())); } } } }
Source:
<code>private boolean isReadFromNormal(final GATKRead rec) { <START> return normalSampleName != null && ReadUtils.getSampleName(rec, header) == normalSampleName; <END> }</code><technical_language>equals(normalSampleName) instead of == normalSampleName</technical_language>

Target:
private boolean isReadFromNormal(final GATKRead rec) { return normalSampleName != null && ReadUtils.getSampleName(rec, header).equals(normalSampleName); }
Source:
<code>private void closeJob(JobTable.Job job, Exception cause) { job.asConnection().ifPresent( jobManagerConnection -> disconnectJobManagerConnection(jobManagerConnection, cause)); job.close(); <START> blobCacheService.getPermanentBlobService().releaseJob(job.getJobId()); <END> }</code><technical_language>adding a ShutdownHook JobTable, this is called automatically job is closed? setup in createJobServices</technical_language>

Target:
private void closeJob(JobTable.Job job, Exception cause) { job.asConnection().ifPresent( jobManagerConnection -> disconnectJobManagerConnection(jobManagerConnection, cause)); job.close(); }
Source:
<code>public Field(String field) { <START> <END> if (field.startsWith(Group.SCHEMA)) { fieldName = field.substring(Group.SCHEMA.length() + 1).toLowerCase(Locale.ENGLISH); } else { fieldName = field.toLowerCase(Locale.ENGLISH); } queryField = GroupQueryField.fromString(fieldName); if (queryField == null) { throw new IllegalArgumentException(String.format("Unable to parse %s, extensions not supported for groups", field)); } }</code><technical_language>Please remove this empty line</technical_language>

Target:
public Field(String field) { if (field.toLowerCase().startsWith(Group.SCHEMA.toLowerCase())) { if (field.charAt(Group.SCHEMA.length()) == '.') { throw new IllegalArgumentException(String.format("Period (.) is not a valid field separator: %s", field)); } name = field.substring(Group.SCHEMA.length() + 1).toLowerCase(Locale.ENGLISH); } else { name = field.toLowerCase(Locale.ENGLISH); } queryField = GroupQueryField.fromString(name); if (queryField == null) { throw new IllegalArgumentException(String.format("Unable to parse %s, extensions not supported for groups", field)); } }
Source:
<code>public final This withoutActionsFrom(final This permission) { <START> return withActionBits(permission.getActionBits()); <END> }</code><technical_language>this withoutActionBits(permission.getActionBits())</technical_language>

Target:
public final This withoutActionsFrom(final This permission) { return withoutActionBits(permission.getActionBits()); }
Source:
<code>public String toString() { return FPFile.class.getSimpleName() <START> + ", filename " + filename <END> + ", type " + type; }</code><technical_language>Nitpick: "filename:" "type:" "filename" "type"</technical_language>

Target:
public String toString() { return FPFile.class.getSimpleName() + ", filename: " + filename + ", type: " + type; }
Source:
<code>public <START> Response<TreeSet<String>> <END> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (Strings.isNullOrEmpty(input.add) && Strings .isNullOrEmpty(input.remove))) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<>(); Set<String> toAdd = new HashSet<>(extractTags(input.add)); Set<String> toRemove = new HashSet<>(extractTags(input.remove)); if (existingHashtags != null && !existingHashtags.isEmpty()) { updatedHashtags.addAll(existingHashtags); toAdd.removeAll(existingHashtags); toRemove.retainAll(existingHashtags); } if (toAdd.size() > 0 || toRemove.size() > 0) { updatedHashtags.addAll(toAdd); updatedHashtags.removeAll(toRemove); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); } return Response.ok(new TreeSet<String>(updatedHashtags)); }</code><technical_language>Set</technical_language>

Target:
public Response<TreeSet<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (input.add == null && input.remove == null)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<>(); Set<String> toAdd = new HashSet<>(extractTags(input.add)); Set<String> toRemove = new HashSet<>(extractTags(input.remove)); if (existingHashtags != null && !existingHashtags.isEmpty()) { updatedHashtags.addAll(existingHashtags); toAdd.removeAll(existingHashtags); toRemove.retainAll(existingHashtags); } if (toAdd.size() > 0 || toRemove.size() > 0) { updatedHashtags.addAll(toAdd); updatedHashtags.removeAll(toRemove); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); } return Response.ok(new TreeSet<String>(updatedHashtags)); }
Source:
<code>public void review(final CertifiedProductSearchDetails listing) { for (CertificationResult cert : listing.getCertificationResults()) { if (cert.isSuccess()) { if (cert.getTestToolsUsed() != null && cert.getTestToolsUsed().size() > 0) { Iterator<CertificationResultTestTool> testToolIter = cert.getTestToolsUsed().iterator(); while (testToolIter.hasNext()) { CertificationResultTestTool testTool = testToolIter.next(); if (StringUtils.isEmpty(testTool.getTestToolName())) { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolName", cert.getNumber())); } else { if (StringUtils.isEmpty(testTool.getTestToolVersion())) { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getTestToolName(), cert.getNumber())); } TestToolDTO tt = testToolDao.getByName(testTool.getTestToolName()); if (tt != null && tt.isRetired()) { listing.getWarningMessages() .add(msgUtil.getMessage("listing.criteria.retiredTestToolNotAllowed", testTool.getTestToolName(), cert.getNumber())); <START> } else if (tt == null) { <END> listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.testToolNotFoundAndRemoved", cert.getNumber(), testTool.getTestToolName())); testToolIter.remove(); } } } } } } }</code><technical_language>confused. Assuming this is a "non-pending" reviewer, if TT is !null retired, give a warning; great. give error? If null? TTs required? If case, error message name "testToolNotFoundAndRemoved" is wrong message named badly. If this _is_ a pending reviewer, removing TTs; give error remove themselves, match error name</technical_language>

Target:
public void review(final CertifiedProductSearchDetails listing) { for (CertificationResult cert : listing.getCertificationResults()) { if (cert.isSuccess()) { if (cert.getTestToolsUsed() != null && cert.getTestToolsUsed().size() > 0) { Iterator<CertificationResultTestTool> testToolIter = cert.getTestToolsUsed().iterator(); while (testToolIter.hasNext()) { CertificationResultTestTool testTool = testToolIter.next(); if (StringUtils.isEmpty(testTool.getTestToolName())) { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolName", cert.getNumber())); } else { if (StringUtils.isEmpty(testTool.getTestToolVersion())) { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getTestToolName(), cert.getNumber())); } TestToolDTO tt = testToolDao.getByName(testTool.getTestToolName()); if (tt != null && tt.isRetired()) { listing.getWarningMessages() .add(msgUtil.getMessage("listing.criteria.retiredTestToolNotAllowed", testTool.getTestToolName(), cert.getNumber())); } else if (tt == null) { listing.getErrorMessages().add(msgUtil.getMessage("listing.criteria.testToolNotFound", cert.getNumber(), testTool.getTestToolName())); } } } } } } }
Source:
<code>private boolean sendAutomaticSavepoint(Query query, EnumSet<QueryFlag> flags) throws IOException { if ((!flags.contains(QueryFlag.SUPPRESS_BEGIN) || getTransactionState() == TransactionState.OPEN) && query != restoreToAutoSave && getAutoSave() != AutoSave.NEVER && (getAutoSave() == AutoSave.ALWAYS || !(query instanceof SimpleQuery) || ((SimpleQuery) query).getFields() != null)) { EnumSet<QueryFlag> flags2 = EnumSet.copyOf(flags); flags2.add(QueryFlag.NO_RESULTS); flags2.add(QueryFlag.NO_METADATA); <START> flags2.add(QueryFlag.EXECUTE_AS_SIMPLE); <END> sendOneQuery(autoSaveQuery, SimpleQuery.NO_PARAMETERS, 1, 0, flags2); return true; } return false; }</code><technical_language>_if main query is simple_ part is missing, expressed this: EnumSet<QueryFlag> flags2 = EnumSet.copyOf(flags); flags2.retainAll(EnumSet.of(EXECUTE_AS_SIMPLE)) flags2.add(NO_RESULTS) flags2.add(NO_METADATA)</technical_language>

Target:
private boolean sendAutomaticSavepoint(Query query, EnumSet<QueryFlag> flags) throws IOException { if ((!flags.contains(QueryFlag.SUPPRESS_BEGIN) || getTransactionState() == TransactionState.OPEN) && query != restoreToAutoSave && getAutoSave() != AutoSave.NEVER && (getAutoSave() == AutoSave.ALWAYS || !(query instanceof SimpleQuery) || ((SimpleQuery) query).getFields() != null)) { EnumSet<QueryFlag> flags2 = EnumSet.of(QueryFlag.NO_RESULTS, QueryFlag.NO_METADATA); updateQueryMode(flags2); if (flags.contains(QueryFlag.EXECUTE_AS_SIMPLE)) { flags2.add(QueryFlag.EXECUTE_AS_SIMPLE); } sendOneQuery(autoSaveQuery, SimpleQuery.NO_PARAMETERS, 1, 0, flags2); return true; } return false; }
Source:
<code>private String getFieldName(AssignmentExpressionTree tree) { ExpressionTree variable = tree.variable(); if (variable.is(Kind.MEMBER_SELECT)) { <START> variable = ((MemberSelectExpressionTree) variable).expression(); <END> } return ((IdentifierTree) variable).name(); }</code><technical_language>expression field name</technical_language>

Target:
private String getFieldName(AssignmentExpressionTree tree) { ExpressionTree variable = tree.variable(); if (variable.is(Kind.MEMBER_SELECT)) { variable = ((MemberSelectExpressionTree) variable).identifier(); } return ((IdentifierTree) variable).name(); }
Source:
<code>protected boolean canDoAction() { if (isImagesAlreadyOnTarget() && !validateImagesOnStorage(vmFromConfiguration, ovfEntityData)) { return false; } <START> return super.canDoAction(); <END> }</code><technical_language>if refactoring this method.. I call super.canDoAction do rest of validations (let's template is null - user get storage-related error instead of basic null template), do think</technical_language>

Target:
protected boolean canDoAction() { if (isImagesAlreadyOnTarget() && !validateUnregisteredEntity(vmFromConfiguration, ovfEntityData)) { return false; } setImagesWithStoragePoolId(getStorageDomain().getStoragePoolId(), getVm().getImages()); return super.canDoAction(); }
Source:
<code>private static int dropForTier( final int numToDrop, final NavigableSet<ServerHolder> holdersInTier, final DataSegment segment, final BalancerStrategy balancerStrategy ) { int numDropped = 0; final NavigableSet<ServerHolder> isServingSubset = <START> holdersInTier.stream().filter(s -> s.isServingSegment(segment)).collect(Collectors.toCollection(TreeSet::new)); <END> final Iterator<ServerHolder> iterator = balancerStrategy.pickServersToDrop(segment, isServingSubset); while (numDropped < numToDrop) { if (!iterator.hasNext()) { log.warn("Wtf, holder was null? I have no servers serving [%s]?", segment.getIdentifier()); break; } final ServerHolder holder = iterator.next(); if (holder.isServingSegment(segment)) { holder.getPeon().dropSegment(segment, null); ++numDropped; } } return numDropped; }</code><technical_language>a (now pointless) check for isServingSegment below. removed confuse people</technical_language>

Target:
private static int dropForTier( final int numToDrop, final NavigableSet<ServerHolder> holdersInTier, final DataSegment segment, final BalancerStrategy balancerStrategy ) { int numDropped = 0; final NavigableSet<ServerHolder> isServingSubset = holdersInTier.stream().filter(s -> s.isServingSegment(segment)).collect(Collectors.toCollection(TreeSet::new)); final Iterator<ServerHolder> iterator = balancerStrategy.pickServersToDrop(segment, isServingSubset); while (numDropped < numToDrop) { if (!iterator.hasNext()) { log.warn("Wtf, holder was null? I have no servers serving [%s]?", segment.getIdentifier()); break; } final ServerHolder holder = iterator.next(); if (holder.isServingSegment(segment)) { holder.getPeon().dropSegment(segment, null); ++numDropped; } else { log.warn( "Server [%s] is no longer serving segment [%s], skipping drop.", holder.getServer().getName(), segment.getIdentifier() ); } } return numDropped; }
Source:
<code>public List<Step> readSteps() throws IOException, WrongRepositoryStateException { if (repo.getRepositoryState() == RepositoryState.REBASING_INTERACTIVE) return loadSteps(); throw new WrongRepositoryStateException( <START> "Not in rebase interactive state"); <END> }</code><technical_language>externalize error message</technical_language>

Target:
public List<Step> readSteps() throws IOException, WrongRepositoryStateException { if (repo.getRepositoryState() == RepositoryState.REBASING_INTERACTIVE) return loadSteps(); throw new WrongRepositoryStateException(MessageFormat.format(JGitText .get().wrongRepositoryState, repo.getRepositoryState().name())); }
Source:
<code>public DiffCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("l", "left", true, "load left ontology from file"); o.addOption("L", "left-iri", true, "load left ontology from IRI"); o.addOption("r", "right", true, "load right ontology from file"); o.addOption("R", "right-iri", true, "load right ontology from IRI"); o.addOption("o", "output", true, "save results to file"); o.addOption( null, "labels", true, "if true, append labels after entity IRIs in the simple format output"); <START> o.addOption("f", "format", true, "format for diff output: simple (default) | html | markdown"); <END> options = o; }</code><technical_language>other formats actual formats (HTML MD) simple is plain-text. instead of simple, txt text for plain-text</technical_language>

Target:
public DiffCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("l", "left", true, "load left ontology from file"); o.addOption("L", "left-iri", true, "load left ontology from IRI"); o.addOption("r", "right", true, "load right ontology from file"); o.addOption("R", "right-iri", true, "load right ontology from IRI"); o.addOption("o", "output", true, "save results to file"); o.addOption( null, "labels", true, "if true, append labels after entity IRIs in the text format output"); o.addOption( "f", "format", true, "format for diff output: plain (default) | pretty | html | markdown"); options = o; }
Source:
<code>private void assertTimerEventMultiple(InterruptingTimerEventExecutionSet executionSet, String timerValue, String timeCycleLanguage, boolean isInterrupting, String slaDueDate) { assertNotNull(executionSet); assertNotNull(executionSet.getTimerSettings()); assertEquals(timerValue, executionSet.getTimerSettings().getValue().getTimeCycle()); assertEquals(timeCycleLanguage, executionSet.getTimerSettings().getValue().getTimeCycleLanguage()); assertNull(executionSet.getTimerSettings().getValue().getTimeDuration()); assertNull(executionSet.getTimerSettings().getValue().getTimeDate()); <START> if (getMarshallerType() == Marshaller.NEW) { <END> assertNotNull(executionSet.getIsInterrupting()); assertEquals(isInterrupting, executionSet.getIsInterrupting().getValue()); assertNotNull(executionSet.getSlaDueDate()); assertEquals(slaDueDate, executionSet.getSlaDueDate().getValue()); } }</code><technical_language>sense refactor this? code in methods below</technical_language>

Target:
private void assertTimerEventMultiple(InterruptingTimerEventExecutionSet executionSet, String timerValue, String timeCycleLanguage, boolean isInterrupting, String slaDueDate) { assertNotNull(executionSet); assertNotNull(executionSet.getTimerSettings()); assertEquals(timerValue, executionSet.getTimerSettings().getValue().getTimeCycle()); assertEquals(timeCycleLanguage, executionSet.getTimerSettings().getValue().getTimeCycleLanguage()); assertNull(executionSet.getTimerSettings().getValue().getTimeDuration()); assertNull(executionSet.getTimerSettings().getValue().getTimeDate()); assertStartEventIsInterrupting(executionSet, isInterrupting); assertStartEventSlaDueDate(executionSet, slaDueDate); }
Source:
<code>public void addToTotal(Student student) { if (null == student.getFederalRace()) { totalWhite.add(student); } else { <START> switch (student.getFederalRace()) { <END> case "W": totalWhite.add(student); break; case "B": totalBlack.add(student); break; case "A": totalAsian.add(student); break; case "I": if (student.getFederalEthnicity().equals("YES")) { totalHispanic.add(student); } else { totalIndian.add(student); } break; case "P": totalPacific.add(student); break; case "H": totalHispanic.add(student); break; } } }</code><technical_language>string literals constants twice</technical_language>

Target:
public void addToTotal(Student student) { if (null == student.getFederalRace()) { totalWhite.add(student); } else { switch (student.getFederalRace()) { case WHITE: totalWhite.add(student); break; case BLACK: totalBlack.add(student); break; case ASIAN: totalAsian.add(student); break; case INDIAN: if (student.getFederalEthnicity().equals("YES")) { totalHispanic.add(student); } else { totalIndian.add(student); } break; case PACIFIC: totalPacific.add(student); break; } } }
Source:
<code>private List<InputValueDefinition> createInputValueDefinitions(List<Map<String, Object>> args) { List<InputValueDefinition> result = new ArrayList<>(); for (Map<String, Object> arg : args) { Type argType = createTypeIndirection((Map<String, Object>) arg.get("type")); InputValueDefinition.Builder inputValueDefinition = InputValueDefinition.newInputValueDefinition().name((String) arg.get("name")).type(argType); <START> inputValueDefinition.description(toDescription((String) arg.get("description"))); <END> String valueLiteral = (String) arg.get("defaultValue"); if (valueLiteral != null) { Value defaultValue = AstValueHelper.valueFromAst(valueLiteral); inputValueDefinition.defaultValue(defaultValue); } result.add(inputValueDefinition.build()); } return result; }</code><technical_language>toDescription((String) input.get("description") String toDescription(Map<String, Object> input) - code</technical_language>

Target:
private List<InputValueDefinition> createInputValueDefinitions(List<Map<String, Object>> args) { List<InputValueDefinition> result = new ArrayList<>(); for (Map<String, Object> arg : args) { Type argType = createTypeIndirection((Map<String, Object>) arg.get("type")); InputValueDefinition.Builder inputValueDefinition = InputValueDefinition.newInputValueDefinition().name((String) arg.get("name")).type(argType); inputValueDefinition.description(toDescription(arg)); String valueLiteral = (String) arg.get("defaultValue"); if (valueLiteral != null) { Value defaultValue = AstValueHelper.valueFromAst(valueLiteral); inputValueDefinition.defaultValue(defaultValue); } result.add(inputValueDefinition.build()); } return result; }
Source:
<code>private MaplayerGroup populateFromRequest(JSONObject mapLayerGroupJSON) throws ActionException { MaplayerGroup maplayerGroup = new MaplayerGroup(); try{ JSONObject locales = mapLayerGroupJSON.getJSONObject(KEY_LOCALES); int parentId = mapLayerGroupJSON.optInt(KEY_PARENT_ID, -1); boolean selectable = mapLayerGroupJSON.optBoolean(KEY_SELECTABLE, true); Iterator<?> keys = locales.keys(); while( keys.hasNext() ) { String locale = (String)keys.next(); String name = locales.getString(locale); maplayerGroup.setName(locale, name); } maplayerGroup.setParentId(parentId); maplayerGroup.setSelectable(selectable); } catch(JSONException ex) { log.error("Cannot populate maplayergroup from request", ex); <START> throw new ActionException("Cannot populate maplayergroup from request"); <END> } return maplayerGroup; }</code><technical_language>log throw leads excessive logging. remove log.error add "cause exception" ActionException parameter</technical_language>

Target:
private MaplayerGroup populateFromRequest(JSONObject mapLayerGroupJSON) throws ActionException { MaplayerGroup maplayerGroup = new MaplayerGroup(); try{ JSONObject locales = mapLayerGroupJSON.getJSONObject(KEY_LOCALES); int parentId = mapLayerGroupJSON.optInt(KEY_PARENT_ID, -1); boolean selectable = mapLayerGroupJSON.optBoolean(KEY_SELECTABLE, true); Iterator<?> keys = locales.keys(); while( keys.hasNext() ) { String locale = (String)keys.next(); String name = locales.getString(locale); maplayerGroup.setName(locale, name); } maplayerGroup.setParentId(parentId); maplayerGroup.setSelectable(selectable); } catch(JSONException ex) { throw new ActionException("Cannot populate maplayer group from request", ex); } return maplayerGroup; }
Source:
<code>public NullValue withNewChildren(NodeChildrenContainer newChildren) { if (!newChildren.isEmpty()) { throw new IllegalArgumentException("Cannot pass non-empty newChildren to Node that doesn't hold children"); } return this; <START> } <END></code><technical_language>Yeah - defintely common method if this is needed @Override public NullValue withNewChildren(NodeChildrenContainer newChildren) { return NodeChildrenContainer.assertNotEmpty(newChildren); }</technical_language>

Target:
public NullValue withNewChildren(NodeChildrenContainer newChildren) { assertNewChildrenAreEmpty(newChildren); return this; }
Source:
<code>public void delete_quality_gates() { OrganizationDto org = db.organizations().insert(); OrganizationDto otherOrg = db.organizations().insert(); QGateWithOrgDto qualityGate = db.qualityGates().insertQualityGate(org); QGateWithOrgDto qualityGateInOtherOrg = db.qualityGates().insertQualityGate(otherOrg); logInAsAdministrator(org); sendRequest(org); <START> <END> verifyOrganizationDoesNotExist(org); assertThat(db.select("select uuid as \"uuid\" from quality_gates")) .extracting(row -> (String) row.get("uuid")) .containsOnly(qualityGateInOtherOrg.getUuid()); assertThat(db.select("select organization_uuid as \"organizationUuid\" from org_quality_gates")) .extracting(row -> (String) row.get("organizationUuid")) .containsOnly(otherOrg.getUuid()); }</code><technical_language>I check built-in is destroyed</technical_language>

Target:
public void delete_quality_gates() { OrganizationDto org = db.organizations().insert(); OrganizationDto otherOrg = db.organizations().insert(); QGateWithOrgDto qualityGate = db.qualityGates().insertQualityGate(org); QGateWithOrgDto qualityGateInOtherOrg = db.qualityGates().insertQualityGate(otherOrg); logInAsAdministrator(org); sendRequest(org); verifyOrganizationDoesNotExist(org); assertThat(db.select("select uuid as \"uuid\" from quality_gates")) .extracting(row -> (String) row.get("uuid")) .containsOnly(qualityGateInOtherOrg.getUuid(), qualityGateFinder.getBuiltInQualityGate(db.getSession()).getUuid()); assertThat(qualityGateFinder.getBuiltInQualityGate(db.getSession())).isNotNull(); assertThat(db.select("select organization_uuid as \"organizationUuid\" from org_quality_gates")) .extracting(row -> (String) row.get("organizationUuid")) .containsOnly(otherOrg.getUuid()); }
Source:
<code>public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap bootstrap, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations, boolean jandexStrategyDisabled) { DiscoveryStrategy returnValue = null; final Iterator<Metadata<DiscoveryStrategy>> iterator = ServiceLoader.load(DiscoveryStrategy.class, resourceLoader).iterator(); if (iterator != null && iterator.hasNext()) { final DiscoveryStrategy candidate = iterator.next().getValue(); if (candidate != null) { candidate.setResourceLoader(resourceLoader); candidate.setBootstrap(bootstrap); candidate.setInitialBeanDefiningAnnotations(initialBeanDefiningAnnotations); returnValue = candidate; } } else if (jandexStrategyDisabled) { CommonLogger.LOG.jandexDiscoveryStrategyDisabled(); <START> } else if (Jandex.isJandexAvailable(resourceLoader)) { <END> CommonLogger.LOG.usingJandex(); try { returnValue = Jandex.createJandexDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); } catch (Exception e) { throw CommonLogger.LOG.unableToInstantiate(Jandex.JANDEX_DISCOVERY_STRATEGY_CLASS_NAME, Arrays.toString(new Object[] { resourceLoader, bootstrap, initialBeanDefiningAnnotations }), e); } } if (returnValue == null) { returnValue = new ReflectionDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); } return returnValue; }</code><technical_language>swapped checks for jandexStrategyDisabled Jandex.isJandexAvailable(resourceLoader). Please in original order logging is meant happen in case Jandex is deliberately used</technical_language>

Target:
public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap bootstrap, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations, boolean jandexStrategyDisabled) { DiscoveryStrategy returnValue = null; final Iterator<Metadata<DiscoveryStrategy>> iterator = ServiceLoader.load(DiscoveryStrategy.class, resourceLoader).iterator(); if (iterator != null && iterator.hasNext()) { final DiscoveryStrategy candidate = iterator.next().getValue(); if (candidate != null) { candidate.setResourceLoader(resourceLoader); candidate.setBootstrap(bootstrap); candidate.setInitialBeanDefiningAnnotations(initialBeanDefiningAnnotations); CommonLogger.LOG.usingServiceLoaderSourcedDiscoveryStrategy(candidate); returnValue = candidate; } } else if (Jandex.isJandexAvailable(resourceLoader)) { if (jandexStrategyDisabled) { CommonLogger.LOG.jandexDiscoveryStrategyDisabled(); } else { CommonLogger.LOG.usingJandex(); try { returnValue = Jandex.createJandexDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); } catch (Exception e) { throw CommonLogger.LOG.unableToInstantiate(Jandex.JANDEX_DISCOVERY_STRATEGY_CLASS_NAME, Arrays.toString(new Object[] { resourceLoader, bootstrap, initialBeanDefiningAnnotations }), e); } } } if (returnValue == null) { returnValue = new ReflectionDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); } return returnValue; }
Source:
<code>public void testSerialization() throws IOException, ClassNotFoundException { BinaryAnnotation binaryAnnotation = new BinaryAnnotation(); binaryAnnotation.setKey("http.method"); binaryAnnotation.setValue("GET"); binaryAnnotation.setEndpoint(createEndpoint("bonjour", "127.0.0.2", 8090)); binaryAnnotation.setType(AnnotationType.STRING); Span span = new Span(Arrays.asList(binaryAnnotation)); span.setAnnotations(serverAnnotations()); Span deserializedSPan = (Span)deserialize(serialize(span)); <START> Assert.assertEquals(span.binaryAnnotationMapping(), deserializedSPan.binaryAnnotationMapping()); <END> Assert.assertEquals(span.getBinaryAnnotations(), deserializedSPan.getBinaryAnnotations()); Assert.assertEquals(span.getAnnotations(), deserializedSPan.getAnnotations()); }</code><technical_language>assertEquals - checking 'span' 'deserializedSPan'? (possibly lowercase P :)</technical_language>

Target:
public void testSerialization() throws IOException, ClassNotFoundException { BinaryAnnotationMappingDeriver.clearStorage(); String testResourcesPath = getClass().getClassLoader().getResource(".").getPath(); BinaryAnnotationMappingDeriver mappingDeriver = BinaryAnnotationMappingDeriver.getInstance(testResourcesPath + "test-binary-annotations-mapping.json"); BinaryAnnotation stringAnnotation = new BinaryAnnotation(); stringAnnotation.setKey("http.method"); stringAnnotation.setValue("GET"); stringAnnotation.setEndpoint(createEndpoint("bonjour", "127.0.0.2", 8090)); stringAnnotation.setType(AnnotationType.STRING); BinaryAnnotation binaryAnnotationWithMapping = new BinaryAnnotation(); binaryAnnotationWithMapping.setKey("foo"); binaryAnnotationWithMapping.setValue("value"); binaryAnnotationWithMapping.setEndpoint(createEndpoint("bonjour2", "127.0.1.2", 8090)); binaryAnnotationWithMapping.setType(AnnotationType.DOUBLE); Span span = new Span(Arrays.asList(stringAnnotation, binaryAnnotationWithMapping)); span.setAnnotations(serverAnnotations()); Span deserializedSpan = (Span)deserialize(serialize(span)); Assert.assertEquals(span, deserializedSpan); Assert.assertEquals(new HashSet<>(Arrays.asList( new AbstractMap.SimpleEntry<>("http.method", "GET"), new AbstractMap.SimpleEntry<>("foo.detail", "value"))), deserializedSpan.binaryAnnotationMapping().getNodeDetails().entrySet()); Assert.assertEquals(new HashSet<>(Arrays.asList( new Property("foo.prop", "value", PropertyType.Number))), new HashSet<>(deserializedSpan.binaryAnnotationMapping().getProperties())); Assert.assertEquals("foo.modified", deserializedSpan.binaryAnnotationMapping().getComponentType()); Assert.assertEquals("foo.endpoint", deserializedSpan.binaryAnnotationMapping().getEndpointType()); }