auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int shutdownAndGetConnectionCount() throws IOException, InterruptedException { try { serverSocket.close(); shutdownLatch.await(1, TimeUnit.SECONDS); <START> serverThread.join(200); <END> assertFalse("serverThread failed to shut down quickly", serverThread.isAlive()); } finally { return connectionAttempts.get(); } }</code><technical_language>200 short this is treated in join upper bound. 200 millis for this is occasionally fast for some slow devices</technical_language>

Target:
public int shutdownAndGetConnectionCount() throws IOException, InterruptedException { try { serverSocket.close(); shutdownLatch.await(1, TimeUnit.SECONDS); serverThread.join(1000); assertFalse("serverThread failed to shut down quickly", serverThread.isAlive()); } finally { return connectionAttempts.get(); } }
Source:
<code>public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); <START> for (Observation obs : getObservations(registrationId)) { <END> try { lock.writeLock().lock(); if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { unsafeRemoveObservation(obs.getId()); removed.add(obs); } } finally { lock.writeLock().unlock(); } } return removed; }</code><technical_language>I move for statement in writeLock block</technical_language>

Target:
public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); try { lock.writeLock().lock(); for (Observation obs : unsafeGetObservations(registrationId)) { if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { unsafeRemoveObservation(obs.getId()); removed.add(obs); } } } finally { lock.writeLock().unlock(); } return removed; }
Source:
<code>public LinkAddress getDestinationLinkAddress() { if <START> (mDestination == <END> null) return null; return new LinkAddress(mDestination.getAddress(), mDestination.getPrefixLength()); }</code><technical_language>Ditto, I destination null</technical_language>

Target:
public LinkAddress getDestinationLinkAddress() { return new LinkAddress(mDestination.getAddress(), mDestination.getPrefixLength()); }
Source:
<code>public void cancelRequestsAndCallback() { mListener = null; <START> } <END></code><technical_language>of this stuff is atomic</technical_language>

Target:
public void cancelRequestsAndCallback() { synchronized(mListenerLock) { mListener = null; } }
Source:
<code>public Node transform(Node node) { final LibraryLinkNode linkNode = (LibraryLinkNode) node; final String baseLocation = linkNode.getStartPosition().getPath(); final String refName = linkNode.getRefName(); final String absoluteLocation = ResourcePathUtils.toAbsoluteLocation(baseLocation, refName); final String currentFile = node.getRootNode().getStartPosition().getPath(); try { absoluteLocations.get().add(currentFile); try (InputStream inputStream = resourceLoader.fetchResource(absoluteLocation)) { if (inputStream == null) { return new IncludeErrorNode("Library cannot be resolved: " + absoluteLocation); } final String content = StreamUtils.toString(inputStream); if ( absoluteLocations.get().add(absoluteLocation) ) { try { absoluteLocations.get().add(absoluteLocation); <START> final Node libraryReference = new Raml10Builder() <END> .build(content, RamlFragment.Library, resourceLoader, absoluteLocation, RamlBuilder.ALL_PHASES); linkNode.setLibraryReference(libraryReference); } finally { absoluteLocations.get().remove(absoluteLocation); } } else { return new IncludeErrorNode("Cyclic dependency in file " + currentFile + " using " + absoluteLocation); } } } catch (IOException e) { return new IncludeErrorNode(String.format("Library cannot be resolved: %s. (%s)", absoluteLocation, e.getMessage())); } finally { absoluteLocations.get().remove(currentFile); } return linkNode; }</code><technical_language>basically RamlBuilder injected new instance</technical_language>

Target:
public Node transform(Node node) { final LibraryLinkNode linkNode = (LibraryLinkNode) node; final String baseLocation = linkNode.getStartPosition().getPath(); final String refName = linkNode.getRefName(); final String absoluteLocation = ResourcePathUtils.toAbsoluteLocation(baseLocation, refName); try { try (InputStream inputStream = resourceLoader.fetchResource(absoluteLocation)) { if (inputStream == null) { return new IncludeErrorNode("Library cannot be resolved: " + absoluteLocation); } final String content = StreamUtils.toString(inputStream); final Node libraryReference = builder .build(content, RamlFragment.Library, resourceLoader, absoluteLocation, RamlBuilder.ALL_PHASES); linkNode.setLibraryReference(libraryReference); } } catch (IOException e) { return new IncludeErrorNode(String.format("Library cannot be resolved: %s. (%s)", absoluteLocation, e.getMessage())); } return linkNode; }
Source:
<code>public static CompilationUnit getKiePMMLModelCompilationUnit(final DataDictionary dataDictionary, final Model model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final String packageName, final String javaTemplate, final String modelClassName) { logger.trace("getKiePMMLModelCompilationUnit {}", dataDictionary, model, packageName); String className = getSanitizedClassName(model.getModelName()); String targetField = getTargetFieldName(dataDictionary, model).orElse(null); List<KiePMMLOutputField> outputFields = getOutputFields(model); CompilationUnit templateCU = getFromFileName(javaTemplate); CompilationUnit cloneCU = templateCU.clone(); cloneCU.setPackageDeclaration(packageName); ClassOrInterfaceDeclaration modelTemplate = cloneCU.getClassByName(modelClassName) <START> .orElseThrow(() -> new KiePMMLException(MAIN_CLASS_NOT_FOUND)); <END> modelTemplate.setName(className); MINING_FUNCTION miningFunction = MINING_FUNCTION.byName(model.getMiningFunction().value()); final ConstructorDeclaration constructorDeclaration = modelTemplate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format("Missing default constructor in ClassOrInterfaceDeclaration %s ", modelTemplate.getName()))); setConstructor(model, constructorDeclaration, modelTemplate.getName(), targetField, miningFunction); addOutputFieldsPopulation(constructorDeclaration.getBody(), outputFields); addFieldTypeMapPopulation(constructorDeclaration.getBody(), fieldTypeMap); return cloneCU; }</code><technical_language>please add modelClassName error message</technical_language>

Target:
public static CompilationUnit getKiePMMLModelCompilationUnit(final DataDictionary dataDictionary, final Model model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final String packageName, final String javaTemplate, final String modelClassName) { logger.trace("getKiePMMLModelCompilationUnit {}", dataDictionary, model, packageName); String className = getSanitizedClassName(model.getModelName()); String targetField = getTargetFieldName(dataDictionary, model).orElse(null); List<KiePMMLOutputField> outputFields = getOutputFields(model); CompilationUnit templateCU = getFromFileName(javaTemplate); CompilationUnit cloneCU = templateCU.clone(); cloneCU.setPackageDeclaration(packageName); ClassOrInterfaceDeclaration modelTemplate = cloneCU.getClassByName(modelClassName) .orElseThrow(() -> new KiePMMLException(MAIN_CLASS_NOT_FOUND + ": " + modelClassName)); modelTemplate.setName(className); MINING_FUNCTION miningFunction = MINING_FUNCTION.byName(model.getMiningFunction().value()); final ConstructorDeclaration constructorDeclaration = modelTemplate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format("Missing default constructor in ClassOrInterfaceDeclaration %s ", modelTemplate.getName()))); setConstructor(model, constructorDeclaration, modelTemplate.getName(), targetField, miningFunction); addOutputFieldsPopulation(constructorDeclaration.getBody(), outputFields); addFieldTypeMapPopulation(constructorDeclaration.getBody(), fieldTypeMap); return cloneCU; }
Source:
<code>public void shouldParseTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:Time\n" + "0,Mattias,13:37\n" + <START> "1,Johan,\"16:20:01\"\n" ); <END> Iterable<DataFactory> dataIterable = dataIterable( data ); Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", TimeValue.time( 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", TimeValue.time( 16, 20, 1, 0, "+00:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }</code><technical_language>I need a case explicit offset here, too</technical_language>

Target:
public void shouldParseTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:Time\n" + "0,Mattias,13:37\n" + "1,Johan,\"16:20:01\"\n" + "2,Bob,07:30-05:00\n" ); Iterable<DataFactory> dataIterable = dataIterable( data ); Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", TimeValue.time( 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", TimeValue.time( 16, 20, 1, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 2L, new Object[]{"name", "Bob", "time", TimeValue.time( 7, 30, 0, 0, "-05:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }
Source:
<code>public RemoveVdsVDSCommand(P parameters) { <START> super(parameters, parameters.isErrorIfHostDoesntExist()); <END> this.parameters = parameters; }</code><technical_language>isErrorIfHostDoesntExist => isNewHost</technical_language>

Target:
public RemoveVdsVDSCommand(P parameters) { super(parameters, parameters.isNewHost()); this.parameters = parameters; }
Source:
<code>public int hashCode() { <START> return getWidth() << 15 | getHeight(); <END> }</code><technical_language>ranges _are_ reasonable, impose arbitrary restrictions <LINK_0> is a thing</technical_language>

Target:
public int hashCode() { return Objects.hash(getFbo().width(), getFbo().height()); }
Source:
<code>private void verifyCopiedData() throws IOException { for (int i = 0; i < numFiles; i++) { String fileName = "file" + i; <START> String inputFileData = FileUtils.readFileToString(new File(inputDirFile, fileName)).trim(); <END> String outputFileData = FileUtils.readFileToString(new File(outputDirName, fileName)).trim(); Assert.assertTrue(inputFileData.equals(outputFileData)); } }</code><technical_language>FileUtils.contentEquals instead</technical_language>

Target:
private void verifyCopiedData() throws IOException { for (int i = 0; i < numFiles; i++) { String fileName = "file" + i; Assert.assertTrue(FileUtils.contentEquals(new File(inputDirFile, fileName), new File(outputDirName, fileName))); } }
Source:
<code>public LegoSensorPortConfigDialogWrapper checkDialogVisible() { <START> viewInteraction.check(matches(isDisplayed())); <END> return this; }</code><technical_language>inRoot(isDialog()) verify text/id youre matching is of a dialog: viewInteraction.inRoot(isDialog()).check(matches(isDisplayed))</technical_language>

Target:
public LegoSensorPortConfigDialogWrapper checkDialogVisible() { viewInteraction.inRoot(isDialog()).check(matches(isDisplayed())); return this; }
Source:
<code>public DbxAutoSync() { super(); <START> this.interval = 1; <END> }</code><technical_language>This constructor invoke this(1) (constructor chaining)</technical_language>

Target:
public DbxAutoSync() { this(1); }
Source:
<code>private InputStream fromBytes(String metacardId, byte[] data) { if (data == null || data.length < MINIMUM_VALID_IMAGE_DATA_SIZE) { LOGGER.debug( <START> String.format( <END> "Image cannot be exported in RTF format, malformed thumbnail data for metacard id: %s", metacardId)); return null; } return new ByteArrayInputStream(data); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Invoke method(s) conditionally. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private InputStream fromBytes(String metacardId, byte[] data) { if (data == null || data.length < MINIMUM_VALID_IMAGE_DATA_SIZE) { LOGGER.debug( "Image cannot be exported in RTF format, malformed thumbnail data for metacard id: {}", metacardId); return null; } return new ByteArrayInputStream(data); }
Source:
<code>public Map<String, ResourceAssignment> getOptimalResourceAssignment() { <START> throw new UnsupportedOperationException("Not implemented yet, depends on #440"); <END> }</code><technical_language>In exception message, including issue id is strange. Please put some descriptions in message</technical_language>

Target:
public Map<String, ResourceAssignment> getOptimalResourceAssignment() { throw new UnsupportedOperationException("Not implemented yet"); }
Source:
<code>public void testMetaDataBlobOperation() throws IOException, MessageFormatException { <START> for (int i = 0; i < 2; i++) { <END> if (i == 0) { metadataContentVersion = MessageFormatRecord.Metadata_Content_Version_V2; } else { metadataContentVersion = MessageFormatRecord.Metadata_Content_Version_V3; } InputAndExpected inputAndExpected = new InputAndExpected(BLOB_ID_VERSION_1_METADATA_CONVERTED, VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0], false, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getFirst(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getFirst()}, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getSecond(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getSecond()}); TransformationOutput output = transformer.transform(inputAndExpected.getInput()); assertNull("output exception should be null", output.getException()); verifyOutput(output.getMsg(), inputAndExpected.getExpected()); } }</code><technical_language>moving this piece of code BlobIdTransformerTest ctor pass in parameters test V2 V3 metadataContent in this class</technical_language>

Target:
public void testMetaDataBlobOperation() throws IOException, MessageFormatException { InputAndExpected inputAndExpected = new InputAndExpected(BLOB_ID_VERSION_1_METADATA_CONVERTED, VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0], false, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getFirst(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getFirst()}, new String[]{BLOB_ID_VERSION_1_DATACHUNK_0_CONVERTED.getSecond(), BLOB_ID_VERSION_1_DATACHUNK_1_CONVERTED.getSecond()}); TransformationOutput output = transformer.transform(inputAndExpected.getInput()); assertNull("output exception should be null", output.getException()); verifyOutput(output.getMsg(), inputAndExpected.getExpected()); }
Source:
<code>public void shouldParsePomFile() { Properties properties = new Properties(); properties.put("test.properties", "test"); properties.put("modules.root.dir", "${basedir}/../.."); properties.put("project.version", "0-27-SNAPSHOT"); Dependency dependency = new Dependency(new DefaultArtifact( "org.motechproject", "motech-osgi-platform", "", "jar", "${project.version}" ), JavaScopes.RUNTIME); <START> InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("pom.xml"); <END> pomInformation = new PomInformation(); pomInformation.parsePom(inputStream); assertEquals(properties, pomInformation.getProperties()); Parent parentFromParsing = pomInformation.getParent(); assertEquals("0.27-SNAPSHOT", parentFromParsing.getVersion()); assertEquals("motech", parentFromParsing.getArtifactId()); assertEquals("org.motechproject", parentFromParsing.getGroupId()); assertTrue(pomInformation.getDependencies().contains(dependency)); }</code><technical_language>close streams</technical_language>

Target:
public void shouldParsePomFile() throws IOException { Properties properties = new Properties(); properties.put("test.properties", "test"); properties.put("modules.root.dir", "${basedir}/../.."); properties.put("project.version", "0-27-SNAPSHOT"); properties.put("project.groupId", "testGroupId"); Dependency dependency = new Dependency(new DefaultArtifact( "${project.groupId}", "motech-osgi-platform", "", "jar", "${project.version}" ), JavaScopes.RUNTIME); try (InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("pom.xml")) { pomInformation = new PomInformation(); pomInformation.parsePom(inputStream); } assertEquals(properties, pomInformation.getProperties()); Parent parentFromParsing = pomInformation.getParent(); assertEquals("0.27-SNAPSHOT", parentFromParsing.getVersion()); assertEquals("motech", parentFromParsing.getArtifactId()); assertEquals("org.motechproject", parentFromParsing.getGroupId()); assertTrue(pomInformation.getDependencies().contains(dependency)); }
Source:
<code>public void testHibernateValidatorContextPayload() { HibernateValidatorConfiguration configuration = getConfiguration(); final Validator validator = configuration.buildValidatorFactory().unwrap( HibernateValidatorFactory.class ) .usingContext().constraintValidatorPayload( Integer.class ) .getValidator(); <START> assertNoViolations( validator.validate( new PayloadDummyEntity( Integer.class ) ) ); <END> }</code><technical_language>Minor formatting issue here</technical_language>

Target:
public void testHibernateValidatorContextPayload() { HibernateValidatorConfiguration configuration = getConfiguration(); Validator validator = configuration.buildValidatorFactory().unwrap( HibernateValidatorFactory.class ) .usingContext().constraintValidatorPayload( Integer.class ) .getValidator(); assertNoViolations( validator.validate( new PayloadDummyEntity( Integer.class ) ) ); assertThat( validator.validate( new PayloadDummyEntity( String.class ) ) ) .containsOnlyViolations( violationOf( PayloadConstraint.class ) ); }
Source:
<code>public void tearDown() throws Exception { bigtableApi.close(); <START> if (server != null) { <END> server.shutdownNow(); server.awaitTermination(); } }</code><technical_language>server null</technical_language>

Target:
public void tearDown() throws Exception { bigtableApi.close(); server.shutdownNow(); server.awaitTermination(); }
Source:
<code>public int visit(IASTExpression expression) { if (decl == null) return PROCESS_SKIP; if (expression instanceof IASTBinaryExpression) { IASTBinaryExpression binary = (IASTBinaryExpression) expression; if ((binary.getOperator() == IASTBinaryExpression.op_equals || binary.getOperator() == IASTBinaryExpression.op_notequals)) { if (referencesThis(binary.getOperand1()) && referencesParameter(binary.getOperand2())) { decl = null; return PROCESS_SKIP; } else if (referencesThis(binary.getOperand2()) && referencesParameter(binary.getOperand1())) { decl = null; return PROCESS_SKIP; } else { <START> reportProblem(MISS_SELF_CHECK_ID, decl); <END> } } else { reportProblem(MISS_SELF_CHECK_ID, decl); } decl = null; return PROCESS_SKIP; } else { reportProblem(MISS_SELF_CHECK_ID, decl); decl = null; return PROCESS_SKIP; } }</code><technical_language>I reporting declaration is a bit much? If implementation of operator is more a lines a bit jarring underlined. reporting declarator is better</technical_language>

Target:
public int visit(IASTExpression expression) { if (!opInfo.isEmpty()) { OperatorEqInfo info = opInfo.peek(); if (info.decl == null) return PROCESS_CONTINUE; if (expression instanceof IASTBinaryExpression) { IASTBinaryExpression binary = (IASTBinaryExpression) expression; if ((binary.getOperator() == IASTBinaryExpression.op_equals || binary.getOperator() == IASTBinaryExpression.op_notequals)) { if (referencesThis(binary.getOperand1()) && referencesParameter(info, binary.getOperand2())) { info.decl = null; } else if (referencesThis(binary.getOperand2()) && referencesParameter(info, binary.getOperand1())) { info.decl = null; } else { reportProblem(MISS_SELF_CHECK_ID, info.decl); } } else { reportProblem(MISS_SELF_CHECK_ID, info.decl); } info.decl = null; } else { reportProblem(MISS_SELF_CHECK_ID, info.decl); info.decl = null; } } return PROCESS_CONTINUE; }
Source:
<code><START> public StoredProcedureQuery createStoredProcedureQuery(String s) { <END> return null; }</code><technical_language>assuming methods required some interface... a proper implementation for them? @epidemia , @sbespalov : do think</technical_language>

Target:
public StoredProcedureQuery createStoredProcedureQuery(String s) { throw new UnsupportedOperationException("createStoredProcedureQuery"); }
Source:
<code>private List<IkePayload> extractChildPayloadsFromMessage(IkeMessage ikeMessage) throws InvalidSyntaxException { IkeSaPayload saPayload = ikeMessage.getPayloadForType(IkePayload.PAYLOAD_TYPE_SA, IkeSaPayload.class); IkeTsPayload tsInitPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_INITIATOR, IkeTsPayload.class); IkeTsPayload tsRespPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_RESPONDER, IkeTsPayload.class); List<IkeNotifyPayload> notifyPayloads = ikeMessage.getPayloadListForType( IkePayload.PAYLOAD_TYPE_NOTIFY, IkeNotifyPayload.class); boolean hasErrorNotify = false; List<IkePayload> list = new LinkedList<>(); for (IkeNotifyPayload payload : notifyPayloads) { if (payload.isBuildChildSaNotify()) { list.add(payload); if (payload.isErrorNotify()) { hasErrorNotify = true; } } } if (!hasErrorNotify && (saPayload == null || tsInitPayload == null || tsRespPayload == null)) { throw new InvalidSyntaxException( <START> "SA, TS-Initiator <END> or TS-Responder payload is missing."); } list.add(saPayload); list.add(tsInitPayload); list.add(tsRespPayload); return list; }</code><technical_language>for errorNotify? Also, throwing InvalidSyntax odd; errorNotify is telling wrong, no? (as opposed other end)</technical_language>

Target:
private List<IkePayload> extractChildPayloadsFromMessage(IkeMessage ikeMessage) throws InvalidSyntaxException { IkeSaPayload saPayload = ikeMessage.getPayloadForType(IkePayload.PAYLOAD_TYPE_SA, IkeSaPayload.class); IkeTsPayload tsInitPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_INITIATOR, IkeTsPayload.class); IkeTsPayload tsRespPayload = ikeMessage.getPayloadForType( IkePayload.PAYLOAD_TYPE_TS_RESPONDER, IkeTsPayload.class); List<IkeNotifyPayload> notifyPayloads = ikeMessage.getPayloadListForType( IkePayload.PAYLOAD_TYPE_NOTIFY, IkeNotifyPayload.class); boolean hasErrorNotify = false; List<IkePayload> list = new LinkedList<>(); for (IkeNotifyPayload payload : notifyPayloads) { if (payload.isNewChildSaNotify()) { list.add(payload); if (payload.isErrorNotify()) { hasErrorNotify = true; } } } if (!hasErrorNotify && (saPayload == null || tsInitPayload == null || tsRespPayload == null)) { throw new InvalidSyntaxException( "SA, TS-Initiator or TS-Responder payload is missing."); } list.add(saPayload); list.add(tsInitPayload); list.add(tsRespPayload); return list; }
Source:
<code>public void testPartitionsNestedCol() { execute( "create table my_table (" + " id int," + " metadata object as (date timestamp with time zone)" + ") clustered into 5 shards " + "partitioned by (metadata['date'])"); ensureYellow(); execute("insert into my_table (id, metadata) values (?, ?), (?, ?)", new Object[]{ 1, new MapBuilder<String, Object>().put("date", "1970-01-01").map(), 2, new MapBuilder<String, Object>().put("date", "2014-05-28").map() }); refresh(); execute("select table_name, partition_ident, values from information_schema.table_partitions order by table_name, partition_ident"); assertEquals(2, response.rowCount()); assertThat(printedTable(response.rows()), <START> is("my_table| 045j2e9n60mj0c9d60og| {metadata['date']=0}\n" + <END> "my_table| 045j4c1h6gmj0d9d68s0| {metadata['date']=1401235200000}\n")); }</code><technical_language>this change here</technical_language>

Target:
public void testPartitionsNestedCol() { execute( "create table my_table (" + " id int," + " metadata object as (date timestamp with time zone)" + ") clustered into 5 shards " + "partitioned by (metadata['date'])"); ensureYellow(); execute("insert into my_table (id, metadata) values (?, ?), (?, ?)", new Object[]{ 1, new MapBuilder<String, Object>().put("date", "1970-01-01").map(), 2, new MapBuilder<String, Object>().put("date", "2014-05-28").map() }); refresh(); execute("select table_name, partition_ident, values from information_schema.table_partitions order by table_name, partition_ident"); assertEquals(2, response.rowCount()); assertThat(printedTable(response.rows()), is("my_table| 04130| {metadata['date']=0}\n" + "my_table| 04732d1g64p36d9i60o30c1g| {metadata['date']=1401235200000}\n")); }
Source:
<code>public boolean isTooLarge(BigInteger value) { BigDecimal scaled = new BigDecimal( value ).multiply( scalingFactor ); return ( scaled.compareTo( BigDecimal.valueOf( Long.MAX_VALUE ) ) > 0 || <START> scaled.compareTo( BigDecimal.valueOf( Long.MIN_VALUE ) ) < 0 <END> ); }</code><technical_language>put BigDecimal.valueOf( Long.MAX_VALUE ) BigDecimal.valueOf( Long.MIN_VALUE ) in constants instead of computing for call of this method</technical_language>

Target:
public boolean isTooLarge(BigInteger value) { BigDecimal scaled = new BigDecimal( value ).multiply( scalingFactor ); return ( scaled.compareTo( NumberScaleConstants.MIN_LONG_AS_BIGDECIMAL ) < 0 || scaled.compareTo( NumberScaleConstants.MAX_LONG_AS_BIGDECIMAL ) > 0 ); }
Source:
<code>private Func1<Metric<?>, Boolean> tagNotExistsFilter(String unwantedTagName) { <START> return tMetric -> { <END> for (String tagName : tMetric.getTags().keySet()) { if(unwantedTagName.equals(tagName)) { return false; } } return true; }; }</code><technical_language>"!tMetric.getTags().keySet().contains(unwantedTagName);"</technical_language>

Target:
private Func1<Metric<?>, Boolean> tagNotExistsFilter(String unwantedTagName) { return tMetric -> !tMetric.getTags().keySet().contains(unwantedTagName); }
Source:
<code>public void setLastUpdate(Date newDate) { <START> this.updatedAt = (keepUpdateTimestamp) ? this.updatedAt : newDate; <END> }</code><technical_language>While one-liners nice all, if clearer here, modifying date keepUpdateTimestamp is true (and otherwise)</technical_language>

Target:
public void setLastUpdate(Date newDate) { if (!keepUpdateTimestamp) { this.updatedAt = newDate; } }
Source:
<code>public void testRemoteKeyNoPull() throws CoreException { <START> class TestNoPullFactory extends TestEClassRemoteFactory { <END> @Override public TestRemoteEClass pull(EPackage parent, String remoteKey, IProgressMonitor monitor) throws CoreException { fail("No retrieve call expected."); return null; } @Override public boolean isPullNeeded(EPackage parent, EClass object, TestRemoteEClass remote) { return false; } } TestManagerEClassHarness harness = new TestManagerEClassHarness(new TestNoPullFactory()) { @Override RemoteEmfConsumer<EPackage, EClass, String, TestRemoteEClass, String, Integer> createConsumer() { return factory.getConsumerForRemoteKey(parent, REMOTE_KEY_1); } }; checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); harness.consumer.retrieve(false); harness.listener.waitForResponse(0, 0); checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); }</code><technical_language>move this of method, OTOH, allergic extensive disucssions test unit changes</technical_language>

Target:
public void testRemoteKeyNoPull() throws CoreException { class TestNoPullFactory extends TestEClassRemoteFactory { @Override public TestRemoteEClass pull(EPackage parent, String remoteKey, IProgressMonitor monitor) throws CoreException { fail("No retrieve call expected."); return null; } @Override public boolean isPullNeeded(EPackage parent, EClass object, TestRemoteEClass remote) { return false; } } TestManagerEClassHarness harness = new TestManagerEClassHarness(new TestNoPullFactory()) { @Override RemoteEmfConsumer<EPackage, EClass, String, TestRemoteEClass, String, Integer> createConsumer() { return factory.getConsumerForRemoteKey(parent, REMOTE_KEY_1); } }; checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); harness.consumer.retrieve(false); harness.listener.waitForResponse(1, 0); checkConsumer(harness.consumer, REMOTE_KEY_1, null, LOCAL_KEY_1, null); }
Source:
<code>protected Request copyRequest(HttpRequest oldRequest, URI newURI) { HttpRequest newRequest = newHttpRequest(oldRequest.getConversation(), newURI); newRequest.method(oldRequest.getMethod()) .version(oldRequest.getVersion()) .body(oldRequest.getBody()) .idleTimeout(oldRequest.getIdleTimeout(), TimeUnit.MILLISECONDS) .timeout(oldRequest.getTimeout(), TimeUnit.MILLISECONDS) .followRedirects(oldRequest.isFollowRedirects()); for (HttpField field : oldRequest.getHeaders()) { HttpHeader header = field.getHeader(); if (HttpHeader.HOST == header) continue; if (HttpHeader.EXPECT == header) continue; if (HttpHeader.COOKIE == header) continue; if (HttpHeader.AUTHORIZATION == header || HttpHeader.PROXY_AUTHORIZATION == header) continue; <START> if (!newRequest.getHeaders().contains(field)) <END> newRequest.header(field); } return newRequest; }</code><technical_language>senses adding a new HttpFields.Mutable.addIfAbsent() API calling newRequest.headers(header -> header.addIfAbsent(field)) preferable style if (!contains) add()</technical_language>

Target:
protected Request copyRequest(HttpRequest oldRequest, URI newURI) { HttpRequest newRequest = newHttpRequest(oldRequest.getConversation(), newURI); newRequest.method(oldRequest.getMethod()) .version(oldRequest.getVersion()) .body(oldRequest.getBody()) .idleTimeout(oldRequest.getIdleTimeout(), TimeUnit.MILLISECONDS) .timeout(oldRequest.getTimeout(), TimeUnit.MILLISECONDS) .followRedirects(oldRequest.isFollowRedirects()); for (HttpField field : oldRequest.getHeaders()) { HttpHeader header = field.getHeader(); if (HttpHeader.HOST == header) continue; if (HttpHeader.EXPECT == header) continue; if (HttpHeader.COOKIE == header) continue; if (HttpHeader.AUTHORIZATION == header || HttpHeader.PROXY_AUTHORIZATION == header) continue; if (!newRequest.getHeaders().contains(field)) newRequest.addHeader(field); } return newRequest; }
Source:
<code>private String maskPassword(String queryString) { <START> return queryString.replaceAll("password=[^&]+", "password=****"); <END> }</code><technical_language>3 asterisk enough? :-)</technical_language>

Target:
private String maskPassword(String queryString) { return queryString.replaceAll("password=[^&]+", "password=***"); }
Source:
<code>public String findAllRecommendationsIdsStartingFrom(Date date) { final Objectify objectify = OfyService.ofy(); final List<TechnologyRecommendation> allRecommendations = <START> objectify.load().type(TechnologyRecommendation.class).list(); <END> final String recommendationsIds = ""; for (TechnologyRecommendation techRecommendation : allRecommendations) { TechnologyComment techComment = techRecommendation.getComment().get(); if (techComment.getTimestamp().after(date)) { recommendationsIds.concat("," + techRecommendation.getId()); } } return recommendationsIds; }</code><technical_language>@felipeaziz , @tsr-thulio @brunoliberal Load Recommendations is a good practice</technical_language>

Target:
public String findAllRecommendationsIdsStartingFrom(Date date) { String recommendationsIds = ""; final Objectify objectify = OfyService.ofy(); final List<TechnologyRecommendation> recommendations = objectify.load().type(TechnologyRecommendation.class) .filter(TechnologyRecommendation.TIMESTAMP + " >" , date).list(); for (TechnologyRecommendation technologyRecommendation : recommendations) { recommendationsIds = recommendationsIds.concat("," + technologyRecommendation.getId()); } return recommendationsIds; }
Source:
<code>public void init() { <START> org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create(); <END> TRACING_TABLE = conf.get(QueryServices.TRACING_STATS_TABLE_NAME_ATTRIB, QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME); }</code><technical_language>Import org.apache.hadoop.conf.Configuration please</technical_language>

Target:
public void init() { Configuration conf = HBaseConfiguration.create(); TRACING_TABLE = conf.get(QueryServices.TRACING_STATS_TABLE_NAME_ATTRIB, QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME); }
Source:
<code>protected void executeForZippedFile(InputStream in) throws Exception { try (ZipInputStream zipInputStream = new ZipInputStream(in)) { ZipEntry entry = zipInputStream.getNextEntry(); <START> while (entry != null && !canHandleFileExtension(Files.getFileExtension(entry.getName()))) { <END> entry = zipInputStream.getNextEntry(); } if (entry == null) { throw Exceptions.createHandled().withNLSKey("FileImportJob.noZippedFileFound").handle(); } process.log(ProcessLog.info() .withNLSKey("FileImportJob.importingZippedFile") .withContext("filename", entry.getName())); executeForStream(entry.getName(), zipInputStream); } }</code><technical_language>process files</technical_language>

Target:
protected void executeForZippedFile(InputStream in) throws Exception { process.log(ProcessLog.info().withNLSKey("FileImportJob.importingZipFile")); try (ZipInputStream zipInputStream = new ZipInputStream(in)) { ZipEntry entry = zipInputStream.getNextEntry(); while (entry != null) { if (!isHiddenFile(entry.getName()) && canHandleFileExtension(Files.getFileExtension(entry.getName()))) { process.log(ProcessLog.info() .withNLSKey("FileImportJob.importingZippedFile") .withContext("filename", entry.getName())); executeForStream(entry.getName(), zipInputStream); return; } entry = zipInputStream.getNextEntry(); } throw Exceptions.createHandled().withNLSKey("FileImportJob.noZippedFileFound").handle(); } }
Source:
<code>private Element createServerElement(Document doc, ClusteringServiceConfiguration clusteringServiceConfiguration) { if (!(clusteringServiceConfiguration.getConnectionSource() instanceof ConnectionSource.ServerList)) { throw new IllegalArgumentException("When connection URL is null, source of connection MUST be of type ConnectionSource.ServerList.class"); } ConnectionSource.ServerList servers = (ConnectionSource.ServerList)clusteringServiceConfiguration.getConnectionSource(); Element rootElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + CLUSTER_ELEMENT_NAME); rootElement.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLNS + TC_CLUSTERED_NAMESPACE_PREFIX, getNamespace().toString()); Element connElement = createConnectionElementWrapper(doc, clusteringServiceConfiguration); servers.getServers().forEach(server -> { Element serverElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + SERVER_ELEMENT_NAME); serverElement.setAttribute(HOST_ATTRIBUTE_NAME, server.getHostName()); <START> if (server.getPort() > 0) { <END> serverElement.setAttribute(PORT_ATTRIBUTE_NAME, Integer.toString(server.getPort())); } connElement.appendChild(serverElement); }); rootElement.appendChild(connElement); return rootElement; }</code><technical_language>Do change access specifiers of protected methods in this class extensions</technical_language>

Target:
private Element createServerElement(Document doc, ClusteringServiceConfiguration clusteringServiceConfiguration) { if (!(clusteringServiceConfiguration.getConnectionSource() instanceof ConnectionSource.ServerList)) { throw new IllegalArgumentException("When connection URL is null, source of connection MUST be of type ConnectionSource.ServerList.class"); } ConnectionSource.ServerList servers = (ConnectionSource.ServerList)clusteringServiceConfiguration.getConnectionSource(); Element rootElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + CLUSTER_ELEMENT_NAME); Element connElement = createConnectionElementWrapper(doc, clusteringServiceConfiguration); servers.getServers().forEach(server -> { Element serverElement = doc.createElement(TC_CLUSTERED_NAMESPACE_PREFIX + COLON + SERVER_ELEMENT_NAME); serverElement.setAttribute(HOST_ATTRIBUTE_NAME, server.getHostName()); if (server.getPort() > 0) { serverElement.setAttribute(PORT_ATTRIBUTE_NAME, Integer.toString(server.getPort())); } connElement.appendChild(serverElement); }); rootElement.appendChild(connElement); return rootElement; }
Source:
<code><START> public String getUnitSymbol() { <END> Unit<?> unit = getUnit(); return unit != null ? unit.toString() : null; }</code><technical_language>add null information</technical_language>

Target:
public @Nullable String getUnitSymbol() { Unit<?> unit = getUnit(); return unit != null ? unit.toString() : null; }
Source:
<code>protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); <START> installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new DurationConstraintLinkSelectionHandlesEditPolicy(this, getEditingDomain())); <END> }</code><technical_language>Modifying generated code is risky. extend EditParts (with a CustomDurationConstraintLinkEditPart), instantiate custom parts in org.eclipse.papyrus.uml.diagram.sequence.providers.CustomEditPartProvider Also, DurationObservationLinkEditPart modified in</technical_language>

Target:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); }
Source:
<code>public void commit(Context context) throws Exception { LinkedHashMap<String, String> partitionSpec = context.partitionSpec(); metaStore.createOrAlterPartition(partitionSpec, context.partitionPath()); <START> if (metaStore.getPartition(partitionSpec).isPresent()) { <END> LOG.warn("partition has existed before current commit, this partition will be altered instead of being created", partitionSpec); } LOG.info("Committed partition to metastore", partitionSpec); }</code><technical_language>NIT: print previous path too, do this: metaStore.getPartition(partitionSpec).ifPresent(path -> LOG.warn("The partition existed current commit," + " path is {}, this partition altered instead of created", partitionSpec, path));</technical_language>

Target:
public void commit(Context context) throws Exception { LinkedHashMap<String, String> partitionSpec = context.partitionSpec(); metaStore.getPartition(partitionSpec).ifPresent(path -> LOG.warn("The partition has existed before current commit," + " the path is {}, this partition will be altered instead of being created", partitionSpec, path)); metaStore.createOrAlterPartition(partitionSpec, context.partitionPath()); LOG.info("Committed partition to metastore", partitionSpec); }
Source:
<code>static int findStringStatisticTruncationPosition(Slice utf8, HiveWriterVersion version) { int length = utf8.length(); int position = 0; while (position < length) { int codePoint = tryGetCodePointAt(utf8, position); if (codePoint < 0) { break; } if (codePoint == REPLACEMENT_CHARACTER_CODE_POINT) { break; } <START> if (version == ORIGINAL && codePoint > REPLACEMENT_CHARACTER_CODE_POINT) { <END> break; } position += lengthOfCodePoint(codePoint); } return position == length ? -1 : position; }</code><technical_language>this is a separate check anyways, I a benefit in comparing FFFD instead of 10000. >= Character.MIN_SUPPLEMENTARY_CODE_POINT instead. more evident code is do way</technical_language>

Target:
static int findStringStatisticTruncationPosition(Slice utf8, HiveWriterVersion version) { int length = utf8.length(); int position = 0; while (position < length) { int codePoint = tryGetCodePointAt(utf8, position); if (codePoint < 0) { break; } if (codePoint == REPLACEMENT_CHARACTER_CODE_POINT) { break; } if (version == ORIGINAL && codePoint >= MIN_SUPPLEMENTARY_CODE_POINT) { break; } position += lengthOfCodePoint(codePoint); } return position; }
Source:
<code>private static <T> Function<Entry<byte[], SortedMap<byte[], T>>, RowResult<T>> createRowResultFunction() { <START> Function<Entry<byte[], SortedMap<byte[], T>>, RowResult<T>> function = e -> RowResult.create(e.getKey(), e.getValue()); <END> return function; }</code><technical_language>I automated stuff this is part 1 of 6, inline function here</technical_language>

Target:
private static <T> Function<Entry<byte[], SortedMap<byte[], T>>, RowResult<T>> createRowResultFunction() { return entry -> RowResult.create(entry.getKey(), entry.getValue()); }
Source:
<code>public String toString() { <START> return ToStringBuilder.reflectionToString(this); <END> }</code><technical_language>a big deal a custom implementation for toString: <LINK_0></technical_language>

Target:
public String toString() { return new XWikiToStringBuilder(this).append("hasParent", hasParent) .append("filterPreference", filterPreference) .append("scopeReference", scopeReference) .append("children", children) .toString(); }
Source:
<code>private String getDependentName(PathAddress address) { <START> if (address !=null && dynamicDependentNameMapper != null) { <END> return RuntimeCapability.buildDynamicCapabilityName(baseDependentName, dynamicDependentNameMapper.apply(address)); } return baseDependentName; }</code><technical_language>address null calling context.getCurrentAddress()</technical_language>

Target:
private String getDependentName(PathAddress address) { if (dynamicDependentNameMapper != null) { return RuntimeCapability.buildDynamicCapabilityName(baseDependentName, dynamicDependentNameMapper.apply(address)); } return baseDependentName; }
Source:
<code>public void freezeAsyncResults() { int DATA_SIZE = 10; Realm realm = looperThread.getRealm(); populateTestRealm(realm, DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); looperThread.keepStrongReference(results); assertFalse(results.isLoaded()); assertTrue(results.isValid()); <START> assertEquals(0, results.size()); <END> RealmResults<AllTypes> frozenResults = results.freeze(); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { assertTrue(results.isLoaded()); assertTrue(results.isValid()); assertEquals(DATA_SIZE, results.size()); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); looperThread.testComplete(); } }); }</code><technical_language>assertFalse(results.isFrozen())</technical_language>

Target:
public void freezeAsyncResults() { int DATA_SIZE = 10; Realm realm = looperThread.getRealm(); populateTestRealm(realm, DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); looperThread.keepStrongReference(results); assertFalse(results.isLoaded()); assertTrue(results.isValid()); assertEquals(0, results.size()); assertFalse(results.isFrozen()); RealmResults<AllTypes> frozenResults = results.freeze(); assertTrue(frozenResults.isFrozen()); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { assertTrue(results.isLoaded()); assertTrue(results.isValid()); assertEquals(DATA_SIZE, results.size()); assertFalse(frozenResults.isLoaded()); assertTrue(frozenResults.isValid()); assertEquals(0, frozenResults.size()); looperThread.testComplete(); } }); }
Source:
<code>public void testExceptionListener() throws Exception { <START> if (broker.isStarted()) { <END> broker.stop(); broker.waitUntilStopped(); } else broker.waitUntilStopped(); broker.setPlugins(new BrokerPlugin[]{new SimpleAuthenticationPlugin(new ArrayList())}); broker.start(true); connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI()); List<Throwable> lsnrExceptions = new LinkedList<>(); Destination dest = new ActiveMQQueue(QUEUE_NAME); try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) { JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer); jmsStreamer.setExceptionListener(new ExceptionListener() { @Override public void onException(JMSException e) { System.out.println("ERROR"); lsnrExceptions.add(e); } }); jmsStreamer.setDestination(dest); try { jmsStreamer.start(); fail("Expecting security exception"); } catch (IgniteException ie) { assertTrue("Caught IgniteException, expected: ", ie.getCause().getCause() instanceof SecurityException); } while(lsnrExceptions.isEmpty()) Thread.sleep(200); assertTrue(lsnrExceptions.size() > 0); try { jmsStreamer.stop(); } catch (Exception ie) { assertTrue("Caught IgniteException, expected: ", ie instanceof IgniteException); } } }</code><technical_language>if (broker.isStarted()) broker.stop() broker.waitUntilStopped();</technical_language>

Target:
public void testExceptionListener() throws Exception { if (broker.isStarted()) broker.stop(); broker.waitUntilStopped(); broker.setPlugins(new BrokerPlugin[]{new SimpleAuthenticationPlugin(new ArrayList())}); broker.start(true); connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI()); final List<Throwable> lsnrExceptions = new LinkedList<>(); final CountDownLatch latch = new CountDownLatch(1); Destination dest = new ActiveMQQueue(QUEUE_NAME); try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) { JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer); jmsStreamer.setExceptionListener(new ExceptionListener() { @Override public void onException(JMSException e) { System.out.println("ERROR"); lsnrExceptions.add(e); latch.countDown(); } }); jmsStreamer.setDestination(dest); GridTestUtils.assertThrowsWithCause(new Callable<Void>() { @Override public Void call() throws Exception { jmsStreamer.start(); return null; } }, SecurityException.class); assertTrue(latch.await(10, TimeUnit.SECONDS)); assertTrue(lsnrExceptions.size() > 0); GridTestUtils.assertThrowsWithCause(new Callable<Void>() { @Override public Void call() throws Exception { jmsStreamer.stop(); return null; } }, IgniteException.class); } }
Source:
<code>public void dispose() { if (cache != null) { for (Object <START> element : <END> cache) { ((BasicContribution) element).dispose(); } cache = null; } }</code><technical_language>rename contribution</technical_language>

Target:
public void dispose() { if (cache != null) { for (Object contribution : cache) { ((BasicContribution) contribution).dispose(); } cache = null; } }
Source:
<code>private static Predicate<MetricName> withTagIsCurrentSuspectedLeader(boolean currentLeader) { return metricName -> metricName.safeTags().containsKey(AtlasDbMetricNames.TAG_CURRENT_SUSPECTED_LEADER) && metricName.safeTags().get(AtlasDbMetricNames.TAG_CURRENT_SUSPECTED_LEADER) <START> .equals(String.valueOf(currentLeader)); <END> }</code><technical_language>nit: this is Optional.ofNullable(metricName.safeTags().get(ADMN.TAG_CURRENT_SUSPECTED_LEADER)).filter(x -> x.equals(String.valueOf(currentLeader)).isPresent(); leave this personal preference</technical_language>

Target:
private static Predicate<MetricName> withTagIsCurrentSuspectedLeader(boolean currentLeader) { return metricName -> Optional.ofNullable(metricName.safeTags().get(AtlasDbMetricNames.TAG_CURRENT_SUSPECTED_LEADER)) .filter(x -> x.equals(String.valueOf(currentLeader))) .isPresent(); }