auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Array<?> getSelectedNodes() { <START> return tree.getSelectionModel().getSelectedNodes(); <END> }</code><technical_language>getSelectedNodes() returns Array<TreeNode<?>> return instead of simple Array<?></technical_language>

Target:
public Array<TreeNode<?>> getSelectedNodes() { return tree.getSelectionModel().getSelectedNodes(); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; <START> final HttpServletResponse httpResponse = (HttpServletResponse) response; <END> if (cacheFilterPatternMathes(httpRequest)) { HttpServletResponseWrapper responseWrapper = getCacheHeaderResponseWrapper(httpResponse); httpResponse.setHeader(CACHE_CONTROL, CACHE_YEAR); httpResponse.setHeader(EXPIRES, getNowPlusYearHttpDate()); chain.doFilter(request, responseWrapper); } else if (noCacheFilterPatternMatches(httpRequest)) { chain.doFilter(request, response); httpResponse.setHeader(CACHE_CONTROL, NO_CACHE); httpResponse.setHeader(EXPIRES, getYesterdayHttpDate()); } else { chain.doFilter(request, response); } }</code><technical_language>please consider instanceOf check</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final HttpServletResponse httpResponse = (HttpServletResponse) response; if (cacheFilterPatternMatches(httpRequest)) { HttpServletResponseWrapper responseWrapper = getCacheHeaderResponseWrapper(httpResponse); httpResponse.setHeader(CACHE_CONTROL, CACHE_YEAR); httpResponse.setHeader(EXPIRES, getNowPlusYearHttpDate()); chain.doFilter(request, responseWrapper); } else if (noCacheFilterPatternMatches(httpRequest)) { chain.doFilter(request, response); httpResponse.setHeader(CACHE_CONTROL, NO_CACHE); httpResponse.setHeader(EXPIRES, getYesterdayHttpDate()); } else { chain.doFilter(request, response); } }
Source:
<code>private void updateEid() { boolean shouldHaveEid = false; String eid = null; if (mTelephonyManager.getPhoneCount() > PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM) { Map<Integer, Integer> slotMapping = mTelephonyManager.getLogicalToPhysicalSlotMapping(); <START> Integer physicalSlotId <END> = slotMapping.get(mSlotId); if (physicalSlotId != null) { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); for (UiccCardInfo info : infos) { if (info.getSlotIndex() == physicalSlotId.intValue()) { if (info.isEuicc()) { shouldHaveEid = true; eid = info.getEid(); if (TextUtils.isEmpty(eid)) { eid = mEuiccManager.createForCardId(info.getCardId()).getEid(); } } break; } } } } else { if (mEuiccManager.isEnabled()) { shouldHaveEid = true; eid = mEuiccManager.getEid(); } } if (TextUtils.isEmpty(eid)) { if (!shouldHaveEid) { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } } else { mDialog.setText(EID_INFO_VALUE_ID, eid); } }</code><technical_language>this int getOrDefault? int physicalSlotId = slotMapping.getOrDefault(mSlotId, -1); if (physicalSlotId != -1) { // for loop }</technical_language>

Target:
private void updateEid() { boolean shouldHaveEid = false; String eid = null; if (mTelephonyManager.getPhoneCount() > PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM) { Map<Integer, Integer> mapping = mTelephonyManager.getLogicalToPhysicalSlotMapping(); int pSlotId = mapping.getOrDefault(mSlotId, SubscriptionManager.INVALID_SIM_SLOT_INDEX); if (pSlotId != SubscriptionManager.INVALID_SIM_SLOT_INDEX) { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); for (UiccCardInfo info : infos) { if (info.getSlotIndex() == pSlotId) { if (info.isEuicc()) { shouldHaveEid = true; eid = info.getEid(); if (TextUtils.isEmpty(eid)) { eid = mEuiccManager.createForCardId(info.getCardId()).getEid(); } } break; } } } } else if (mEuiccManager.isEnabled()) { shouldHaveEid = true; eid = mEuiccManager.getEid(); } if (!shouldHaveEid) { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } else if (!TextUtils.isEmpty(eid)) { mDialog.setText(EID_INFO_VALUE_ID, eid); } }
Source:
<code>protected ReversedScannerCallable createScannerCallable() { <START> int replicaId = (scan.getConsistency() == Consistency.TIMELINE) ? scan.getReplicaId() : 0; <END> return new ReversedScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, this.rpcControllerFactory, replicaId); }</code><technical_language>This is a bit strange, TIMELINE means send request primary if in time, switch secondary replicas. IIRC design is that, if targetReplicaId is -1, follow rule of STRONG TIMELINE, if targetReplicaId is -1, specific replica directly</technical_language>

Target:
protected ReversedScannerCallable createScannerCallable() { return new ReversedScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, this.rpcControllerFactory, getScanReplicaId()); }
Source:
<code>private void preRenderSetupSceneReflectiveRefractive() { <START> sceneReflectiveRefractive = dynamicFBM.getFBO(REFRACTIVE_REFLECTIVE_URN); <END> sceneReflectiveRefractive.bind(); if (isHeadUnderWater) { GL11.glDisable(GL11.GL_CULL_FACE); } }</code><technical_language>thinking. FBMs, especially dynamic ones, a bit more simple collections do regenerate FBOs needed. _However_ point of view of a node basically simple maps notify subscribers of changes. So, fact this type of line exist process() moved update(). change FBM interface write: sceneReflectiveRefractive = dynamicFBOs.get(REFRACTIVE_REFLECTIVE);</technical_language>

Target:
private void preRenderSetupSceneReflectiveRefractive() { sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE); sceneReflectiveRefractive.bind(); if (isHeadUnderWater) { GL11.glDisable(GL11.GL_CULL_FACE); } }
Source:
<code>public int getUnmeteredDevices(String os) { if (os.equalsIgnoreCase("Android")) { <START> return getAccountSettings().getUnmeteredDevices().get("ANDROID"); <END> } else if (os.equalsIgnoreCase("IOS")) { return getAccountSettings().getUnmeteredDevices().get("IOS"); } else { return 0; } }</code><technical_language>NPE for getAccountSettings()</technical_language>

Target:
public int getUnmeteredDevices(String os) { AccountSettings accountSettings = getAccountSettings(); if (accountSettings == null) { return 0; } else if (os.equalsIgnoreCase("ANDROID")) { return getAccountSettings().getUnmeteredDevices().get("ANDROID"); } else if (os.equalsIgnoreCase("IOS")) { return getAccountSettings().getUnmeteredDevices().get("IOS"); } else { return 0; } }
Source:
<code>private List<CertificationCriterionEntity> getAllEntities() { Query query = entityManager.createQuery( "SELECT cce " + "FROM CertificationCriterionEntity cce " + "WHERE cce.id IN ( " + "SELECT c.id FROM CertificationCriterionEntity c " + "LEFT JOIN c.certificationResult cr " + "LEFT JOIN cr.certifiedProduct cp " + "LEFT JOIN cr.certificationResultTestTool crtt " + "LEFT JOIN crtt.testTool tt " <START> + "WHERE (tt.retired = true AND cp.icsCode = '1') OR (tt.retired = false) AND c.deleted = false)" <END> , CertificationCriterionEntity.class); List<CertificationCriterionEntity> result = query.getResultList(); return result; }</code><technical_language>I want "icsCode >= 1". ICS means "Inherited Certification Status" (i think?) is a boolean a count of number of times inherited... larger 1</technical_language>

Target:
private List<CertificationCriterionEntity> getAllEntities() { Query query = entityManager.createQuery( "SELECT cce " + "FROM CertificationCriterionEntity cce " + "WHERE cce.id IN ( " + "SELECT c.id FROM CertificationCriterionEntity c " + "LEFT JOIN c.certificationResult cr " + "LEFT JOIN cr.certifiedProduct cp " + "LEFT JOIN cr.certificationResultTestTool crtt " + "LEFT JOIN crtt.testTool tt " + "WHERE (tt.retired = true AND CAST(cp.icsCode as integer) >= 1) OR (tt.retired = false) AND c.deleted = false)" , CertificationCriterionEntity.class); List<CertificationCriterionEntity> result = query.getResultList(); return result; }
Source:
<code>public void bindFieldNull() throws SQLException { final List<Schema> nullableTypes = Arrays.asList( Schema.INT8_SCHEMA, Schema.INT16_SCHEMA, Schema.INT32_SCHEMA, Schema.INT64_SCHEMA, Schema.FLOAT32_SCHEMA, Schema.FLOAT64_SCHEMA, Schema.BOOLEAN_SCHEMA, Schema.BYTES_SCHEMA, <START> Schema.STRING_SCHEMA <END> ); int index = 0; for (Schema schema : nullableTypes) { verifyBindField(++index, schema, null).setObject(index, null); } }</code><technical_language>add logical types' schemas</technical_language>

Target:
public void bindFieldNull() throws SQLException { final List<Schema> nullableTypes = Arrays.asList( Schema.INT8_SCHEMA, Schema.INT16_SCHEMA, Schema.INT32_SCHEMA, Schema.INT64_SCHEMA, Schema.FLOAT32_SCHEMA, Schema.FLOAT64_SCHEMA, Schema.BOOLEAN_SCHEMA, Schema.BYTES_SCHEMA, Schema.STRING_SCHEMA, Decimal.schema(0), Date.SCHEMA, Time.SCHEMA, Timestamp.SCHEMA ); int index = 0; for (Schema schema : nullableTypes) { verifyBindField(++index, schema, null).setObject(index, null); } }
Source:
<code>public InputStream copyContainer(String containerId, String path) throws DockerException, InterruptedException { final String apiVersion = version().apiVersion(); final int versionComparison = compareVersion(apiVersion, "1.20"); if (versionComparison < 0) { <START> return doCopyContainer(containerId, path); <END> } else { return doArchiveContainer(containerId, path); } }</code><technical_language>This right design me. I expect copyContainer method do depending version of docker connected to. I methods for API endpoints: copyContainer wraps /containers/{id}/copy archiveContainer wraps /containers/{id}/archive. DockerClient.copyContainer marked @Deprecated</technical_language>

Target:
public InputStream copyContainer(String containerId, String path) throws DockerException, InterruptedException { final String apiVersion = version().apiVersion(); final int versionComparison = compareVersion(apiVersion, "1.24"); if (versionComparison >= 0) { throw new UnsupportedApiVersionException(apiVersion); } final WebTarget resource = resource() .path("containers").path(containerId).path("copy"); final JsonNodeFactory nf = JsonNodeFactory.instance; final JsonNode params = nf.objectNode().set("Resource", nf.textNode(path)); try { return request(POST, InputStream.class, resource, resource.request(APPLICATION_OCTET_STREAM_TYPE), Entity.json(params)); } catch (DockerRequestException e) { switch (e.status()) { case 404: throw new ContainerNotFoundException(containerId, e); default: throw e; } } }
Source:
<code>public void viewInfoUpdated() { <START> this.reinitialize(); <END> }</code><technical_language>* is super.reinitialize() public? * If want super.reinitialize() protected, this class "open up" instead of defining a new method: @Override public void reinitialize() { super.reinitialize(); }</technical_language>

Target:
public void viewInfoUpdated() { reinitialize(); }
Source:
<code>protected void addMetaList(String key, Object value, Hashtable<String, Object> meta) { <START> Vector list = (Vector) meta.get(key); <END> meta.remove(key); addMeta(key, value, meta); Object newValue = meta.get(key); meta.remove(key); if (newValue != null) { if (list == null) { list = new Vector(); } list.add(newValue); meta.put(key, list); } else if (list != null) { meta.put(key, list); } }</code><technical_language>need get, remove us. (Also below.)</technical_language>

Target:
protected void addMetaList(String key, Object value, Hashtable<String, Object> meta) { Vector list = (Vector) meta.remove(key); addMeta(key, value, meta); Object newValue = meta.remove(key); if (newValue != null) { if (list == null) { list = new Vector(); } list.add(newValue); meta.put(key, list); } else if (list != null) { meta.put(key, list); } }
Source:
<code>public ImmutableHideData asImmutable() { <START> return new ImmutableSpongeHideData(this.enchantments, this.attributes, this.unbreakable, this.canDestroy, this.canPlace, this.miscellaneous); <END> }</code><technical_language>36 possibilities, cache immutable version</technical_language>

Target:
public ImmutableHideData asImmutable() { return ImmutableDataCachingUtil.getManipulator(ImmutableSpongeHideData.class, this.enchantments, this.attributes, this.unbreakable, this.canDestroy, this.canPlace, this.miscellaneous); }
Source:
<code>public void startService() { super.startService(); <START> this.addServoEventListener(this); <END> }</code><technical_language>this servo listen starts up</technical_language>

Target:
public void startService() { super.startService(); if (isEventsEnabled) { this.addServoEventListener(this); } }
Source:
<code>public static <T, R> Single<R> zip(final Single<? extends T>[] singles, final FuncN<? extends R> zipper) { return Single.create(new Single.OnSubscribe<R>() { @Override public void call(final SingleSubscriber<? super R> subscriber) { final AtomicInteger wip = new AtomicInteger(singles.length); final AtomicBoolean once = new AtomicBoolean(); final Object[] values = new Object[singles.length]; CompositeSubscription compositeSubscription = new CompositeSubscription(); subscriber.add(compositeSubscription); for (int i = 0; i < singles.length; i++) { if (compositeSubscription.isUnsubscribed() || once.get()) { break; } final int j = i; SingleSubscriber<T> singleSubscriber = new SingleSubscriber<T>() { @Override public void onSuccess(T value) { values[j] = value; if (wip.decrementAndGet() == 0) { R r; try { r = zipper.call(values); } catch (Throwable e) { Exceptions.throwIfFatal(e); <START> subscriber.onError(e); <END> return; } subscriber.onSuccess(r); } } @Override public void onError(Throwable error) { if (once.compareAndSet(false, true)) { subscriber.onError(error); } else { RxJavaPlugins.getInstance().getErrorHandler().handleError(error); } } }; compositeSubscription.add(singleSubscriber); if (compositeSubscription.isUnsubscribed() || once.get()) { break; } singles[i].subscribe(singleSubscriber); } } }); }</code><technical_language>This this.onError avoid error races</technical_language>

Target:
public static <T, R> Single<R> zip(final Single<? extends T>[] singles, final FuncN<? extends R> zipper) { return Single.create(new Single.OnSubscribe<R>() { @Override public void call(final SingleSubscriber<? super R> subscriber) { final AtomicInteger wip = new AtomicInteger(singles.length); final AtomicBoolean once = new AtomicBoolean(); final Object[] values = new Object[singles.length]; CompositeSubscription compositeSubscription = new CompositeSubscription(); subscriber.add(compositeSubscription); for (int i = 0; i < singles.length; i++) { if (compositeSubscription.isUnsubscribed() || once.get()) { break; } final int j = i; SingleSubscriber<T> singleSubscriber = new SingleSubscriber<T>() { @Override public void onSuccess(T value) { values[j] = value; if (wip.decrementAndGet() == 0) { R r; try { r = zipper.call(values); } catch (Throwable e) { Exceptions.throwIfFatal(e); onError(e); return; } subscriber.onSuccess(r); } } @Override public void onError(Throwable error) { if (once.compareAndSet(false, true)) { subscriber.onError(error); } else { RxJavaPlugins.getInstance().getErrorHandler().handleError(error); } } }; compositeSubscription.add(singleSubscriber); if (compositeSubscription.isUnsubscribed() || once.get()) { break; } singles[i].subscribe(singleSubscriber); } } }); }
Source:
<code>private HttpPipeline setupPipeline(HttpClient httpClient) { List<HttpPipelinePolicy> policies = new ArrayList<>(); HttpLogOptions httpLogOptions = new HttpLogOptions(); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RetryPolicy()); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); <START> HttpClient client = httpClient != null ? httpClient : HttpClient.createDefault(); <END> return new HttpPipelineBuilder().httpClient(client) .policies(policies.toArray(new HttpPipelinePolicy[0])).build(); }</code><technical_language>This line removed if pass default client suggested above</technical_language>

Target:
private HttpPipeline setupPipeline(HttpClient httpClient) { List<HttpPipelinePolicy> policies = new ArrayList<>(); HttpLogOptions httpLogOptions = new HttpLogOptions(); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RetryPolicy()); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); return new HttpPipelineBuilder().httpClient(httpClient) .policies(policies.toArray(new HttpPipelinePolicy[0])).build(); }
Source:
<code>public T get(Prolog engine) { T r = getOrNull(engine); if (r == null) { <START> String msg = key.toString(); <END> throw new SystemException(msg); } return r; }</code><technical_language>Hmm, I simplify code inline msg: throw new SystemException("No " + key + " available");</technical_language>

Target:
public T get(Prolog engine) { T obj = getOrNull(engine); if (obj == null) { obj = createValue(engine); if (obj == null) { throw new SystemException("No " + key + " available"); } set(engine, obj); } return obj; }
Source:
<code>private void convertRequireForAlreadyConverted(ModuleImport moduleImport) { String originalPath = moduleImport.requiredNamespace.replace(alreadyConvertedPrefix + ".", "").replace(".", "/"); String referencedFile = pathUtil.getImportPath(moduleImport.originalImportNode.getSourceFileName(), originalPath); Node importSpec = IR.empty(); if (moduleImport.isDestructuringImport) { importSpec = new Node(Token.IMPORT_SPECS); importSpec.setShorthandProperty(true); for (String fullLocalName : moduleImport.fullLocalNames) { Node spec = new Node(Token.IMPORT_SPEC, IR.name(fullLocalName)); spec.setShorthandProperty(true); importSpec.addChildToBack(spec); } } else if (moduleImport.isFullModuleImport()) { String fullLocalName = moduleImport.fullLocalNames.get(0); <START> importSpec = Node.newString(Token.IMPORT_STAR, fullLocalName); <END> if (destructuringAssignments.containsKey(fullLocalName)) { importSpec = destructuringAssignments.get(fullLocalName); Node destructuringLhs = importSpec.getParent(); Node assignmentNode = destructuringLhs.getParent(); importSpec.detach(); assignmentNode.getParent().removeChild(assignmentNode); } } Node importNode = new Node(Token.IMPORT, IR.empty(), importSpec, Node.newString(referencedFile)); nodeComments.replaceWithComment(moduleImport.originalImportNode, importNode); compiler.reportChangeToEnclosingScope(importNode); }</code><technical_language>move this else branch</technical_language>

Target:
private void convertRequireForAlreadyConverted(ModuleImport moduleImport) { String originalPath = moduleImport.requiredNamespace.replace(alreadyConvertedPrefix + ".", "").replace(".", "/"); String referencedFile = pathUtil.getImportPath(moduleImport.originalImportNode.getSourceFileName(), originalPath); Node importSpec = IR.empty(); if (moduleImport.isDestructuringImport) { importSpec = new Node(Token.IMPORT_SPECS); importSpec.setShorthandProperty(true); for (String fullLocalName : moduleImport.fullLocalNames) { Node spec = new Node(Token.IMPORT_SPEC, IR.name(fullLocalName)); spec.setShorthandProperty(true); importSpec.addChildToBack(spec); } } else if (moduleImport.isFullModuleImport()) { String fullLocalName = moduleImport.fullLocalNames.get(0); if (!destructuringAssignments.containsKey(fullLocalName)) { importSpec = Node.newString(Token.IMPORT_STAR, fullLocalName); } else { importSpec = destructuringAssignments.get(fullLocalName); Node destructuringLhs = importSpec.getParent(); Node assignmentNode = destructuringLhs.getParent(); importSpec.detach(); assignmentNode.getParent().removeChild(assignmentNode); } } Node importNode = new Node(Token.IMPORT, IR.empty(), importSpec, Node.newString(referencedFile)); nodeComments.replaceWithComment(moduleImport.originalImportNode, importNode); compiler.reportChangeToEnclosingScope(importNode); }
Source:
<code>public void testAddingOptionalField() throws IOException { Schema oldSchema = SchemaBuilder.record("record") .fields() .requiredLong("category_id") .optionalString("name") .endRecord(); Schema newSchema = AvroSchemaConverter.convertToSchema( <START> TableSchema.builder() <END> .field("category_id", DataTypes.BIGINT().notNull()) .field("name", DataTypes.STRING().nullable()) .field("description", DataTypes.STRING().nullable()) .build().toRowDataType().getLogicalType() ); byte[] serializedRecord = AvroTestUtils.writeRecord( new GenericRecordBuilder(oldSchema) .set("category_id", 1L) .set("name", "test") .build(), oldSchema ); GenericDatumReader<GenericRecord> datumReader = new GenericDatumReader<>( oldSchema, newSchema); GenericRecord newRecord = datumReader.read( null, DecoderFactory.get().binaryDecoder(serializedRecord, 0, serializedRecord.length, null)); assertThat( newRecord, equalTo(new GenericRecordBuilder(newSchema) .set("category_id", 1L) .set("name", "test") .set("description", null) .build())); }</code><technical_language>DataType directly. advertise TableSchema anymore</technical_language>

Target:
public void testAddingOptionalField() throws IOException { Schema oldSchema = SchemaBuilder.record("record") .fields() .requiredLong("category_id") .optionalString("name") .endRecord(); Schema newSchema = AvroSchemaConverter.convertToSchema( DataTypes.ROW( DataTypes.FIELD("category_id", DataTypes.BIGINT().notNull()), DataTypes.FIELD("name", DataTypes.STRING().nullable()), DataTypes.FIELD("description", DataTypes.STRING().nullable()) ).getLogicalType() ); byte[] serializedRecord = AvroTestUtils.writeRecord( new GenericRecordBuilder(oldSchema) .set("category_id", 1L) .set("name", "test") .build(), oldSchema ); GenericDatumReader<GenericRecord> datumReader = new GenericDatumReader<>( oldSchema, newSchema); GenericRecord newRecord = datumReader.read( null, DecoderFactory.get().binaryDecoder(serializedRecord, 0, serializedRecord.length, null)); assertThat( newRecord, equalTo(new GenericRecordBuilder(newSchema) .set("category_id", 1L) .set("name", "test") .set("description", null) .build())); }
Source:
<code>public void checkNegativeCallParameters(PatternCompositionConstraint constraint) { Predicate<ValueReference> isSingleUseVariable = new Predicate<ValueReference>() { @Override public boolean apply(ValueReference input) { if (input instanceof VariableValue) { VariableValue variableValue = (VariableValue) input; return variableValue.getValue().getVar().startsWith("_"); } else { return false; } } }; if (constraint.isNegative() && Iterables.all(constraint.getCall().getParameters(), isSingleUseVariable)) { <START> warning("A negative pattern call should reference at least one used variable", PatternLanguagePackage.Literals.PATTERN_COMPOSITION_CONSTRAINT__CALL, <END> IssueCodes.NEGATIVE_PATTERN_CALL_WITH_ONLY_SINGLE_USE_VARIABLES); } }</code><technical_language>I "should" is a bit strong here... I suggest rephrasing this</technical_language>

Target:
public void checkNegativeCallParameters(PatternCompositionConstraint constraint) { Predicate<ValueReference> isSingleUseVariable = new Predicate<ValueReference>() { @Override public boolean apply(ValueReference input) { if (input instanceof VariableValue) { VariableValue variableValue = (VariableValue) input; return variableValue.getValue().getVar().startsWith("_"); } else { return false; } } }; if (constraint.isNegative() && Iterables.all(constraint.getCall().getParameters(), isSingleUseVariable)) { warning("This negative pattern call is a global constraint: " + "it expresses that there are no matches of the called pattern at all. " + "Make sure this is intentional!", PatternLanguagePackage.Literals.PATTERN_COMPOSITION_CONSTRAINT__CALL, IssueCodes.NEGATIVE_PATTERN_CALL_WITH_ONLY_SINGLE_USE_VARIABLES); } }
Source:
<code>public static HDHTEntryType fromInt(int i) { <START> HDHTEntryType type = intToTypeMap.get(Integer.valueOf(i)); <END> return type; }</code><technical_language>unnecessary boxing</technical_language>

Target:
public static HDHTEntryType fromInt(int i) { return intToTypeMap.get(i); }
Source:
<code>public List<String> listConsumerGroups(String name) { File mqRoot = new File(basePath.toFile(), name); if (!exists(name)) { <START> throw new IllegalArgumentException("Unknown Log: " + name); <END> } return Arrays.stream(mqRoot.list((dir, rep) -> new File(dir, rep).isDirectory() && ChronicleLogOffsetTracker.isOffsetTracker(rep))).map(ChronicleLogOffsetTracker::getGroupFromDirectory).collect(Collectors.toList()); }</code><technical_language>Path</technical_language>

Target:
public List<String> listConsumerGroups(String name) { Path logRoot = basePath.resolve(name); if (!Files.exists(logRoot)) { throw new IllegalArgumentException("Unknown Log: " + name); } try { return Files.list(logRoot) .filter(Files::isDirectory) .map(Path::getFileName) .map(Path::toString) .filter(ChronicleLogOffsetTracker::isOffsetTracker) .map(ChronicleLogOffsetTracker::getGroupFromDirectory) .collect(Collectors.toList()); } catch (IOException e) { throw new IllegalArgumentException("Cannot access Log: " + name, e); } }
Source:
<code><START> public AbstractJcrNode addAclNode( String relPath, <END> String primaryNodeTypeName ) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException { checkSession(); return addNode(relPath, primaryNodeTypeName, null, true); }</code><technical_language>This protected public. @okulikov, changes change access modifiers of modified methods limited possible</technical_language>

Target:
protected AbstractJcrNode addAclNode( String relPath, String primaryNodeTypeName ) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException { checkSession(); return addNode(relPath, primaryNodeTypeName, null, true); }
Source:
<code>public void do_not_delete_default_profile() { QualityProfileDto profile = QualityProfileTesting.newQualityProfileDto() .setDefault(true); <START> db.qualityProfileDao().insert(dbSession, profile); <END> dbSession.commit(); dbSession.clearCache(); try { List<ActiveRuleChange> changes = factory.delete(dbSession, profile.getKey(), false); dbSession.commit(); activeRuleIndexer.index(changes); fail(); } catch (BadRequestException e) { assertThat(e).hasMessage("The profile marked as default can not be deleted: " + profile.getKey()); assertThat(db.qualityProfileDao().selectAll(dbSession)).hasSize(1); } }</code><technical_language>considered db.qualityProfiles().insertQualityProfiles? save calling dbSession.commit() I dbSession.clearCache() is useful (not in UTs DBTester QP Rules, I useless legacy code)</technical_language>

Target:
public void do_not_delete_default_profile() { QualityProfileDto profile = QualityProfileTesting.newQualityProfileDto() .setOrganizationUuid(organization.getUuid()) .setDefault(true); db.qualityProfileDao().insert(dbSession, profile); dbSession.commit(); try { List<ActiveRuleChange> changes = factory.delete(dbSession, profile.getKey(), false); dbSession.commit(); activeRuleIndexer.index(changes); fail(); } catch (BadRequestException e) { assertThat(e).hasMessage("The profile marked as default can not be deleted: " + profile.getKey()); assertThat(db.qualityProfileDao().selectAll(dbSession, organization)).hasSize(1); } }
Source:
<code><START> public ITypedElement getAncestor() { <END> return CompareUtils.getFileRevisionTypedElement(gitPath, getAncestorCommit(), getRepository(), ancestorId); }</code><technical_language>Please return null a compare is meaningless in this case</technical_language>

Target:
public ITypedElement getAncestor() { if (objectExist(getAncestorCommit(), ancestorId)) return CompareUtils.getFileRevisionTypedElement(gitPath, getAncestorCommit(), getRepository(), ancestorId); return null; }
Source:
<code>protected void purgeExpired(Collection<String> expiredKeys, long timeout) { final ThreadPoolExecutor executor = new ThreadPoolExecutor(3, 3, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); final Set<String> expired = new ConcurrentHashSet<String>(); for (String key : expiredKeys) expired.add(key); final Set<Object> incorrect = new ConcurrentHashSet<Object>(); final AdvancedCacheWriter.PurgeListener purgeListener = new AdvancedCacheWriter.PurgeListener() { @Override public void entryPurged(Object key) { if (!expired.remove(key)) { incorrect.add(key); } } }; long start = System.nanoTime(); for (;;) { try { executor.submit(new Callable<Void>() { @Override public Void call() throws Exception { cl.purge(executor, purgeListener); return null; } }).get(); } catch (Exception e) { throw new RuntimeException("Purge has thrown an exception", e); } <START> assertTrue(incorrect.isEmpty()); <END> if (expired.isEmpty() || !storePurgesAllExpired()) { return; } if (System.nanoTime() > start + TimeUnit.MILLISECONDS.toNanos(timeout)) { throw new IllegalStateException("Purge has timed out"); } else { Thread.yield(); } } }</code><technical_language>assertEquals(Collections.emptySet(), incorrect) print contents of incorrect set</technical_language>

Target:
protected void purgeExpired(Collection<String> expiredKeys, long timeout) { final ThreadPoolExecutor executor = new ThreadPoolExecutor(3, 3, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); final Set<String> expired = new ConcurrentHashSet<String>(); for (String key : expiredKeys) expired.add(key); final Set<Object> incorrect = new ConcurrentHashSet<Object>(); final AdvancedCacheWriter.PurgeListener purgeListener = new AdvancedCacheWriter.PurgeListener() { @Override public void entryPurged(Object key) { if (!expired.remove(key)) { incorrect.add(key); } } }; long start = System.nanoTime(); for (;;) { try { executor.submit(new Callable<Void>() { @Override public Void call() throws Exception { cl.purge(executor, purgeListener); return null; } }).get(); } catch (Exception e) { throw new RuntimeException("Purge has thrown an exception", e); } assertEquals(Collections.emptySet(), incorrect); if (expired.isEmpty() || !storePurgesAllExpired()) { return; } if (System.nanoTime() > start + TimeUnit.MILLISECONDS.toNanos(timeout)) { throw new IllegalStateException("Purge has timed out"); } else { Thread.yield(); } } }
Source:
<code>public void testSetTargetTaskThreadPoolSizeIllegalArgument() { InstanceConfig testConfig = new InstanceConfig("testConfig"); <START> testConfig.setTargetTaskThreadPoolSize(0); <END> }</code><technical_language>consider allowing 0. Negative values sense allowed</technical_language>

Target:
public void testSetTargetTaskThreadPoolSizeIllegalArgument() { InstanceConfig testConfig = new InstanceConfig("testConfig"); testConfig.setTargetTaskThreadPoolSize(-1); }
Source:
<code>public Builder builder() { return new Builder(this); <START> } <END></code><technical_language>This method static need pass this argument constructor</technical_language>

Target:
public static Builder builder() { return new Builder(); }
Source:
<code>public long getFixedRate() { <START> return 5 * 1000; END> }</code><technical_language>this a property</technical_language>

Target:
public long getFixedRate() { return this.userMetricsProperties.getRate(); }
Source:
<code>private OverPeriodDateAttribute copyWithUriQualifier(final OverPeriodDateAttribute attribute, final ObjQualifierConverter objQualifierConverter) { if (attribute.getAttribute() instanceof IdentifierObjQualifier) { final IdentifierObjQualifier attributeIdentifier = (IdentifierObjQualifier) attribute.getAttribute(); return objQualifierConverter.convertToUriQualifier(attributeIdentifier) .map(uriObjQualifier -> new OverPeriodDateAttribute(uriObjQualifier, attribute.getPeriodsAgo())) <START> .orElseThrow(() -> new IllegalArgumentException(format("The converter cannot convert identifier '%s'!", attributeIdentifier))); <END> } return attribute; }</code><technical_language>I recommend more explicit message, "Supplied converter provides conversion for..."</technical_language>

Target:
private OverPeriodDateAttribute copyWithUriQualifier(final OverPeriodDateAttribute attribute, final ObjQualifierConverter objQualifierConverter) { return ObjIdentifierUtilities.copyIfNecessary( attribute, attribute.getAttribute(), uriObjQualifier -> new OverPeriodDateAttribute(uriObjQualifier, attribute.getPeriodsAgo()), objQualifierConverter ); }
Source:
<code>public AuthenticationResult createEscalatedAuthenticationResult() { <START> return new AuthenticationResult(internalClientUsername, authorizerName, "basic", null); <END> }</code><technical_language>do hard code "basic"</technical_language>

Target:
public AuthenticationResult createEscalatedAuthenticationResult() { return new AuthenticationResult(internalClientUsername, authorizerName, null, null); }
Source:
<code>public void testAddingNewFormat() { settings.put("citation.prioritized_types", "WAV, Adobe PDF, Microsoft Word, RTF, Postscript"); when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext"); when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword"); when(bitstreamFormat3.getMIMEType()).thenReturn("audio/x-wav"); when(bitstream1.getSize()).thenReturn(new Long(100)); when(bitstream2.getSize()).thenReturn(new Long(200)); <START> when(bitstream3.getSize()).thenReturn(new Long(300)); <END> List<Bitstream> toSort = bundle.getBitstreams(); Collections.sort(toSort, new GoogleBitstreamComparator(context, settings)); assertEquals("bitstream3", toSort.get(0).getName()); assertEquals("bitstream2", toSort.get(1).getName()); assertEquals("bitstream1", toSort.get(2).getName()); }</code><technical_language>For clarity, consider making sizes in this test</technical_language>

Target:
public void testAddingNewFormat() { settings.put("citation.prioritized_types", "WAV, Adobe PDF, Microsoft Word, RTF, Postscript"); when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext"); when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword"); when(bitstreamFormat3.getMIMEType()).thenReturn("audio/x-wav"); when(bitstream1.getSize()).thenReturn(new Long(300)); when(bitstream2.getSize()).thenReturn(new Long(200)); when(bitstream3.getSize()).thenReturn(new Long(100)); List<Bitstream> toSort = bundle.getBitstreams(); Collections.sort(toSort, new GoogleBitstreamComparator(context, settings)); assertEquals("bitstream3 has the type with the highest priority (thus ignoring its size) and should come first", "bitstream3", toSort.get(0).getName()); assertEquals("bitstream2 has a type with a priority higher than bitstream1 (size is ignored) and should come second", "bitstream2", toSort.get(1).getName()); assertEquals("bitstream1 has a type with the lowest priority in this bundle eventhough it is the largest bitstream and should come last", "bitstream1", toSort.get(2).getName()); }
Source:
<code>protected void configureServlets() { bind(HttpPluginServlet.class); <START> serve("/plugins/*").with(HttpPluginServlet.class); <END> filter("/a/*").through(RequireIdentifiedUserFilter.class); serveRegex("^/(?:a/)?plugins/(.*)?$").with(HttpPluginServlet.class); bind(StartPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ReloadPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ModuleGenerator.class) .to(HttpAutoRegisterModuleGenerator.class); install(new CacheModule() { @Override protected void configure() { cache(PLUGIN_RESOURCES, ResourceKey.class, Resource.class) .maximumWeight(2 << 20) .weigher(ResourceWeigher.class); } }); }</code><technical_language>Is this line needed? I this URL is covered new regular expression added below. accessing HttpPluginServlet authentication results in internal server error. exception occurs checking if user admin privileges (because user is provided). HttpPluginServlet accessible authentication (so this internal server error happen)? java.lang.ClassCastException: com.google.gerrit.server.AnonymousUser cast com.google.gerrit.server.IdentifiedUser com.google.gerrit.httpd.RestApiServlet.checkRequiresCapability(RestApiServlet.java:104) com.google.gerrit.httpd.RestApiServlet.service(RestApiServlet.java:85) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.google.gerrit.httpd.plugins.HttpPluginServlet.service(HttpPluginServlet.java:192) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) ..</technical_language>

Target:
protected void configureServlets() { bind(HttpPluginServlet.class); serve("/plugins/*").with(HttpPluginServlet.class); serveRegex("^/(?:a/)?plugins/(.*)?$").with(HttpPluginServlet.class); bind(StartPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ReloadPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ModuleGenerator.class) .to(HttpAutoRegisterModuleGenerator.class); install(new CacheModule() { @Override protected void configure() { cache(PLUGIN_RESOURCES, ResourceKey.class, Resource.class) .maximumWeight(2 << 20) .weigher(ResourceWeigher.class); } }); }
Source:
<code>public List<Integer> queryMonthlyMetrics(String targetType, String targetId, String name, LocalDate from, LocalDate to) { List<Integer> result = new ArrayList<>(); LocalDate date = from; <START> while (!date.isAfter(to)) { <END> result.add(queryMetric(getMonthlyMetricType(), targetType, targetId, name, date.getYear(), date.getMonthValue(), null)); date = date.plusMonths(1); } return result; }</code><technical_language>add a saveguard for extremely broad ranges</technical_language>

Target:
public List<Integer> queryMonthlyMetrics(String targetType, String targetId, String name, LocalDate from, LocalDate to) { List<Integer> result = new ArrayList<>(); LocalDate date = from; AtomicInteger limit = new AtomicInteger(MAX_MONTHLY_METRICS); while (!date.isAfter(to) && limit.decrementAndGet() > 0) { result.add(queryMetric(getMonthlyMetricType(), targetType, targetId, name, date.getYear(), date.getMonthValue(), null)); date = date.plusMonths(1); } return result; }
Source:
<code>public void onStart() { super.onStart(); ((AlertDialog) getDialog()).getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> submit(getEnteredEmail()); <END> } }); }</code><technical_language>nit: questionable if getEnteredEmail() is necessary</technical_language>

Target:
public void onStart() { super.onStart(); ((AlertDialog) getDialog()).getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { submit(editText.getText().toString().trim()); } }); }
Source:
<code>public void changeDiffPreferences(final AccountDiffPreference diffPref, AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>(){ public VoidResult run(ReviewDb db) throws OrmException, Failure, <START> NoSuchProjectException, NoSuchGroupException { <END> Id accountId = getAccountId(); diffPref.setAccountId(accountId); final AccountDiffPreference p = db.accountDiffPreferences().get(accountId); if (p == null) { db.accountDiffPreferences().insert(Collections.singleton(diffPref)); } else { db.accountDiffPreferences().update(Collections.singleton(diffPref)); } return VoidResult.INSTANCE; } }); }</code><technical_language>exceptions throw here. Copy paste error</technical_language>

Target:
public void changeDiffPreferences(final AccountDiffPreference diffPref, AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>(){ public VoidResult run(ReviewDb db) throws OrmException { Account.Id accountId = getAccountId(); if (!diffPref.getAccountId().equals(getAccountId())) { throw new IllegalArgumentException("diffPref.getAccountId() " + diffPref.getAccountId() + " doesn't match" + "the accountId of the signed in user " + getAccountId()); } db.accountDiffPreferences().upsert(Collections.singleton(diffPref)); return VoidResult.INSTANCE; } }); }
Source:
<code>void setUpPatchSetNav(JsArray<RevisionInfo> list, DiffInfo.FileMeta meta) { InlineHyperlink baseLink = null; InlineHyperlink selectedLink = null; if (sideA) { baseLink = createLink(PatchUtil.C.patchBase(), null); linkPanel.add(baseLink); } if (meta == null) { emptyFile = true; } for (int i = 0; i < list.length(); i++) { RevisionInfo r = list.get(i); InlineHyperlink link = createLink( String.valueOf(r._number()), new PatchSet.Id(changeId, r._number())); linkPanel.add(link); if (revision != null && r._number() == revision.get()) { selectedLink = link; } } if (selectedLink != null) { selectedLink.setStyleName(style.selected()); } else if (sideA) { baseLink.setStyleName(style.selected()); } <START> Anchor downloadLink = createDownloadLink(); <END> if (downloadLink != null) { linkPanel.add(downloadLink); } }</code><technical_language>Wrap this: if (meta != null && !Patch.COMMIT_MSG.equals(path)) { linkPanel.add(createDownloadLink()); }</technical_language>

Target:
void setUpPatchSetNav(JsArray<RevisionInfo> list, DiffInfo.FileMeta meta) { InlineHyperlink baseLink = null; InlineHyperlink selectedLink = null; if (sideA) { baseLink = createLink(PatchUtil.C.patchBase(), null); linkPanel.add(baseLink); } for (int i = 0; i < list.length(); i++) { RevisionInfo r = list.get(i); InlineHyperlink link = createLink( String.valueOf(r._number()), new PatchSet.Id(changeId, r._number())); linkPanel.add(link); if (revision != null && r._number() == revision.get()) { selectedLink = link; } } if (selectedLink != null) { selectedLink.setStyleName(style.selected()); } else if (sideA) { baseLink.setStyleName(style.selected()); } if (meta != null && !Patch.COMMIT_MSG.equals(path)) { linkPanel.add(createDownloadLink()); } }
Source:
<code>private File consumeFileUpload(Representation entity) { File uploadedFile = null; final DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(UPLOAD_THRESHOLD); final RestletFileUpload fileUploadUtil = new RestletFileUpload(factory); try { final RepresentationContext context = new RepresentationContext(entity); final FileItemIterator iterator = fileUploadUtil.getItemIterator(context); while (iterator.hasNext()) { final FileItemStream fis = iterator.next(); if (UPLOAD_FILE_KEY.equals(fis.getFieldName())) { <START> uploadedFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp"); <END> uploadedFile.deleteOnExit(); try (FileOutputStream fos = new FileOutputStream(uploadedFile)) { ByteUtils.write(fis.openStream(), fos); fos.flush(); } break; } } } catch (FileUploadException | IOException ex) { throw new RuntimeException("Failed to upload and process file", ex); } return uploadedFile; }</code><technical_language>need a UUID key File.createTempFile(...), adds a suffix unique already. a prefix humans a hint of is about, "GeoGig_ImportFile"</technical_language>

Target:
private File consumeFileUpload(Representation entity) { File uploadedFile = null; final DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(UPLOAD_THRESHOLD); final RestletFileUpload fileUploadUtil = new RestletFileUpload(factory); try { final RepresentationContext context = new RepresentationContext(entity); final FileItemIterator iterator = fileUploadUtil.getItemIterator(context); while (iterator.hasNext()) { final FileItemStream fis = iterator.next(); if (UPLOAD_FILE_KEY.equals(fis.getFieldName())) { Preconditions.checkState(uploadedFile == null, FILE_UPLOAD_ERROR_TMPL, UPLOAD_FILE_KEY); uploadedFile = File.createTempFile("geogig-" + UPLOAD_FILE_KEY + "-", ".tmp"); uploadedFile.deleteOnExit(); try (FileOutputStream fos = new FileOutputStream(uploadedFile)) { ByteUtils.write(fis.openStream(), fos); fos.flush(); } } } Preconditions.checkNotNull(uploadedFile, FILE_UPLOAD_ERROR_TMPL, UPLOAD_FILE_KEY); } catch (Exception ex) { if (uploadedFile != null) { uploadedFile.delete(); } uploadedFile = null; } return uploadedFile; }
Source:
<code>public boolean filter(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { <START> System.out.println(""); <END> MDC.put("X-Request-Id", UUID.randomUUID().toString()); return true; }</code><technical_language>this removed</technical_language>

Target:
public boolean filter(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { MDC.put("X-Request-Id", UUID.randomUUID().toString()); return true; }
Source:
<code>private void testColumnStats(String schema, TpchTable<?> table, TpchColumn<?> column, Constraint<ColumnHandle> constraint, ColumnStatistics expected) { TpchTableHandle tableHandle = tpchMetadata.getTableHandle(session, new SchemaTableName(schema, table.getTableName())); TableStatistics tableStatistics = tpchMetadata.getTableStatistics(session, tableHandle, constraint); ColumnHandle columnHandle = tpchMetadata.getColumnHandles(session, tableHandle).get(column.getSimplifiedColumnName()); ColumnStatistics actual = tableStatistics.getColumnStatistics().get(columnHandle); EstimateAssertion estimateAssertion = new EstimateAssertion(TOLERANCE); estimateAssertion.assertClose( <START> actual.getOnlyRangeColumnStatistics().getDistinctValuesCount(), <END> expected.getOnlyRangeColumnStatistics().getDistinctValuesCount(), "distinctValuesCount"); estimateAssertion.assertClose( actual.getOnlyRangeColumnStatistics().getDataSize(), expected.getOnlyRangeColumnStatistics().getDataSize(), "dataSize"); estimateAssertion.assertClose( actual.getNullsFraction(), expected.getNullsFraction(), "nullsFraction"); estimateAssertion.assertClose( actual.getOnlyRangeColumnStatistics().getLowValue(), expected.getOnlyRangeColumnStatistics().getLowValue(), "lowValue"); estimateAssertion.assertClose( actual.getOnlyRangeColumnStatistics().getHighValue(), expected.getOnlyRangeColumnStatistics().getHighValue(), "highValue"); }</code><technical_language>nit: extract .getOnlyRangeColumnStatistics() variables unwrap, similar do in TPC-DS test</technical_language>

Target:
private void testColumnStats(String schema, TpchTable<?> table, TpchColumn<?> column, Constraint<ColumnHandle> constraint, ColumnStatistics expected) { TpchTableHandle tableHandle = tpchMetadata.getTableHandle(session, new SchemaTableName(schema, table.getTableName())); TableStatistics tableStatistics = tpchMetadata.getTableStatistics(session, tableHandle, constraint); ColumnHandle columnHandle = tpchMetadata.getColumnHandles(session, tableHandle).get(column.getSimplifiedColumnName()); ColumnStatistics actual = tableStatistics.getColumnStatistics().get(columnHandle); EstimateAssertion estimateAssertion = new EstimateAssertion(TOLERANCE); RangeColumnStatistics actualRange = actual.getOnlyRangeColumnStatistics(); RangeColumnStatistics expectedRange = expected.getOnlyRangeColumnStatistics(); estimateAssertion.assertClose(actualRange.getDistinctValuesCount(), expectedRange.getDistinctValuesCount(), "distinctValuesCount"); estimateAssertion.assertClose(actualRange.getDataSize(), expectedRange.getDataSize(), "dataSize"); estimateAssertion.assertClose(actual.getNullsFraction(), expected.getNullsFraction(), "nullsFraction"); estimateAssertion.assertClose(actualRange.getLowValue(), expectedRange.getLowValue(), "lowValue"); estimateAssertion.assertClose(actualRange.getHighValue(), expectedRange.getHighValue(), "highValue"); }
Source:
<code>public void testTextPlainException() { <START> Exception decode = decode(MediaType.TEXT_PLAIN, 42, "errorbody"); <END> assertThat(decode, is(instanceOf(RuntimeException.class))); assertThat(decode.getMessage(), is("Error 42. Reason: reason. Body:\nerrorbody")); }</code><technical_language>switch 42</technical_language>

Target:
public void testTextPlainException() { Exception decode = decode(MediaType.TEXT_PLAIN, STATUS_42, "errorbody"); assertThat(decode, is(instanceOf(RuntimeException.class))); assertThat(decode.getMessage(), is("Error 42. Reason: reason. Body:\nerrorbody")); }