auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean getNext(EtlKey key, BytesWritable payload, BytesWritable pKey) throws IOException { if (hasNext()) { MessageAndOffset msgAndOffset = messageIter.next(); Message message = msgAndOffset.message(); ByteBuffer buf = message.payload(); int origSize = buf.remaining(); byte[] bytes = new byte[origSize]; buf.get(bytes, buf.position(), origSize); payload.set(bytes, 0, origSize); buf = message.key(); if (buf != null) { origSize = buf.remaining(); bytes = new byte[origSize]; buf.get(bytes, buf.position(), origSize); <START> pKey.set(bytes, 0, origSize); <END> } else { pKey.setSize(0); } key.clear(); key.set(kafkaRequest.getTopic(), kafkaRequest.getLeaderId(), kafkaRequest.getPartition(), currentOffset, msgAndOffset.offset() + 1, message.checksum()); key.setMessageSize(msgAndOffset.message().size()); currentOffset = msgAndOffset.offset() + 1; currentCount++; return true; } else { return false; } }</code><technical_language>do message.key() is null</technical_language>

Target:
public boolean getNext(EtlKey key, BytesWritable payload, BytesWritable pKey) throws IOException { if (hasNext()) { MessageAndOffset msgAndOffset = messageIter.next(); Message message = msgAndOffset.message(); ByteBuffer buf = message.payload(); int origSize = buf.remaining(); byte[] bytes = new byte[origSize]; buf.get(bytes, buf.position(), origSize); payload.set(bytes, 0, origSize); buf = message.key(); if (buf != null) { origSize = buf.remaining(); bytes = new byte[origSize]; buf.get(bytes, buf.position(), origSize); pKey.set(bytes, 0, origSize); } else { log.warn("Received message with null message.key(): " + msgAndOffset); pKey.setSize(0); } key.clear(); key.set(kafkaRequest.getTopic(), kafkaRequest.getLeaderId(), kafkaRequest.getPartition(), currentOffset, msgAndOffset.offset() + 1, message.checksum()); key.setMessageSize(msgAndOffset.message().size()); currentOffset = msgAndOffset.offset() + 1; currentCount++; return true; } else { return false; } }
Source:
<code>private void setDate(Date newDate) { Calendar calendar = Calendar.getInstance(); <START> calendar.setTime(newDate); <END> this.ms = calendar.get(Calendar.MILLISECOND); this.zone_offset = calendar.get(Calendar.ZONE_OFFSET); this.dst_offset = calendar.get(Calendar.DST_OFFSET); this.date.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)); this.date.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)); }</code><technical_language>NPE newDate is null</technical_language>

Target:
private void setDate(Date newDate) { if (newDate != null) { Calendar calendar = Calendar.getInstance(); calendar.setTime(newDate); this.ms = calendar.get(Calendar.MILLISECOND); this.zoneOffset = calendar.get(Calendar.ZONE_OFFSET); this.dstOffset = calendar.get(Calendar.DST_OFFSET); this.date.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)); this.date.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)); } }
Source:
<code>public static Long timeToLong(String value) { Pattern timeValuePattern = Pattern.compile("\\d+"); Pattern durationPattern = Pattern.compile("\\D+"); Matcher timeMatcher = timeValuePattern.matcher(value); Matcher durationMatcher = durationPattern.matcher(value); int timeValue; TimePeriod.Duration duration; if (timeMatcher.find() && durationMatcher.find()) { duration = normalizeDuration(durationMatcher.group(0).trim()); timeValue = Integer.parseInt(timeMatcher.group(0)); try { switch (duration) { case SECONDS: return Expression.Time.sec(timeValue).value(); case MINUTES: return Expression.Time.minute(timeValue).value(); case HOURS: return Expression.Time.hour(timeValue).value(); case DAYS: return Expression.Time.day(timeValue).value(); case YEARS: return Expression.Time.year(timeValue).value(); default: return Expression.Time.month(timeValue).value(); } } catch (NoSuchDurationException e) { throw new NoSuchDurationException("Duration" + timeValue + "does not exists", e); <START> } <END> } else { throw new NoSuchDurationException("Provided retention parameter cannot be identified. retention " + "period: " + value + "."); } }</code><technical_language>catching NoSuchDurationException throwing again? is throwing NoSuchDurationException here</technical_language>

Target:
public static Long timeToLong(String value) { Pattern timeValuePattern = Pattern.compile("\\d+"); Pattern durationPattern = Pattern.compile("\\D+"); Matcher timeMatcher = timeValuePattern.matcher(value); Matcher durationMatcher = durationPattern.matcher(value); int timeValue; TimePeriod.Duration duration; if (timeMatcher.find() && durationMatcher.find()) { duration = normalizeDuration(durationMatcher.group(0).trim()); timeValue = Integer.parseInt(timeMatcher.group(0)); switch (duration) { case SECONDS: return Expression.Time.sec(timeValue).value(); case MINUTES: return Expression.Time.minute(timeValue).value(); case HOURS: return Expression.Time.hour(timeValue).value(); case DAYS: return Expression.Time.day(timeValue).value(); case YEARS: return Expression.Time.year(timeValue).value(); default: return Expression.Time.month(timeValue).value(); } } else { throw new SiddhiAppValidationException("Provided retention parameter cannot be identified. retention " + "period: " + value + "."); } }
Source:
<code>public Query visit(LikeExpr likeExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) likeExpr.getChild(); String[] propertyPath = propertyValueExpr.getPropertyPath(); ensureNotAnalyzed(propertyPath); String lucenePattern = likeExpr.getPattern() .replace(LUCENE_MULTIPLE_CHARACTERS_WILDCARD, "\\" + LUCENE_MULTIPLE_CHARACTERS_WILDCARD) .replace(LUCENE_SINGLE_CHARACTER_WILDCARD, "\\" + LUCENE_SINGLE_CHARACTER_WILDCARD) .replace("%", LUCENE_MULTIPLE_CHARACTERS_WILDCARD) <START> .replace("_", LUCENE_SINGLE_CHARACTER_WILDCARD); <END> return applyFieldBridge(propertyPath, queryBuilder.keyword().wildcard().onField(StringHelper.join(propertyPath))) .matching(lucenePattern).createQuery(); }</code><technical_language>I this perform a single loop characters a switch statement</technical_language>

Target:
public Query visit(LikeExpr likeExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) likeExpr.getChild(); String[] propertyPath = propertyValueExpr.getPropertyPath(); ensureNotAnalyzed(propertyPath); StringBuilder lucenePattern = new StringBuilder(likeExpr.getPattern()); for (int i = 0; i < lucenePattern.length(); i++) { switch (lucenePattern.charAt(i)) { case LUCENE_MULTIPLE_CHARACTERS_WILDCARD: case LUCENE_SINGLE_CHARACTER_WILDCARD: lucenePattern.insert(i, '\\'); i++; break; case '%': lucenePattern.setCharAt(i, LUCENE_MULTIPLE_CHARACTERS_WILDCARD); break; case '_': lucenePattern.setCharAt(i, LUCENE_SINGLE_CHARACTER_WILDCARD); break; } } return applyFieldBridge(propertyPath, queryBuilder.keyword().wildcard().onField(StringHelper.join(propertyPath))) .matching(lucenePattern.toString()).createQuery(); }
Source:
<code>public Optional<String> getCommitTemplateContent() { if (commitTemplatePath != null) { File commitTemplateFile = new <START> File(commitTemplatePath); <END> try { return Optional.ofNullable( RawParseUtils.decode(IO.readFully(commitTemplateFile))); } catch (IOException e) { LOG.error(e.getMessage(), e); } } return Optional.empty(); }</code><technical_language>Standard C git performs tilde expansion commit.template</technical_language>

Target:
public String getCommitTemplateContent() throws FileNotFoundException, IOException { if (commitTemplatePath != null) { File commitTemplateFile = new File( resolveHomePath(commitTemplatePath)); return RawParseUtils.decode(commitMessageEncoding, IO.readFully(commitTemplateFile)); } return null; }
Source:
<code>public void testRegularAndRuntimeParametersAreEqualWithScan() { CloudBigtableScanConfiguration withRegularParameters = config.toBuilder().withConfiguration("somekey", "somevalue").build(); CloudBigtableScanConfiguration withRuntimeParameters = new CloudBigtableScanConfiguration.Builder() .withTableId(StaticValueProvider.of(TABLE)) .withProjectId(StaticValueProvider.of(PROJECT)) .withInstanceId(StaticValueProvider.of(INSTANCE)) .withScan(new Scan(START_ROW, STOP_ROW)) .withConfiguration("somekey", StaticValueProvider.of("somevalue")) .build(); <START> Assert.assertNotSame(withRegularParameters, withRuntimeParameters); <END> Assert.assertEquals(withRegularParameters, withRuntimeParameters); ReadRowsRequest request = withRegularParameters.getRequest(); withRegularParameters = withRegularParameters.toBuilder().withRequest(request).build(); withRuntimeParameters = withRuntimeParameters.toBuilder().withRequest(StaticValueProvider.of(request)).build(); Assert.assertNotSame(withRegularParameters, withRuntimeParameters); Assert.assertEquals(withRegularParameters, withRuntimeParameters); }</code><technical_language>assertNotSame sense here, please remove it</technical_language>

Target:
public void testRegularAndRuntimeParametersAreEqualWithScan() { CloudBigtableScanConfiguration withRegularParameters = config.toBuilder().withConfiguration("somekey", "somevalue").build(); CloudBigtableScanConfiguration withRuntimeParameters = new CloudBigtableScanConfiguration.Builder() .withTableId(StaticValueProvider.of(TABLE)) .withProjectId(StaticValueProvider.of(PROJECT)) .withInstanceId(StaticValueProvider.of(INSTANCE)) .withScan(new Scan(START_ROW, STOP_ROW)) .withConfiguration("somekey", StaticValueProvider.of("somevalue")) .build(); Assert.assertEquals(withRegularParameters, withRuntimeParameters); ReadRowsRequest request = withRegularParameters.getRequest(); withRegularParameters = withRegularParameters.toBuilder().withRequest(request).build(); withRuntimeParameters = withRuntimeParameters.toBuilder().withRequest(StaticValueProvider.of(request)).build(); Assert.assertEquals(withRegularParameters, withRuntimeParameters); }
Source:
<code>public void testHeaderWithInvalidRegexp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.invalid.header")); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; String message = ""; try { verify(checkConfig, getPath("InputRegexpHeader5.java"), expected); } catch (IllegalArgumentException ex) { message = ex.getMessage(); } <START> assertEquals("line 1 in header specification is not a regular expression", message); <END> }</code><technical_language>move assert statement catch block add fail() catch</technical_language>

Target:
public void testHeaderWithInvalidRegexp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.invalid.header")); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; try { verify(checkConfig, getPath("InputRegexpHeader5.java"), expected); fail("IllegalArgumentException is expected"); } catch (IllegalArgumentException ex) { assertEquals("line 1 in header specification is not a regular expression", ex.getMessage()); } }
Source:
<code>public static IRegistrationFieldView getInstance(LayoutInflater inflater, RegistrationFormField field) { RegistrationFieldType fieldType = field.getFieldType(); if (fieldType.equals(RegistrationFieldType.EMAIL)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationEmailView(field, view); } <START> else if (fieldType.equals(RegistrationFieldType.CONFIRM_EMAIL)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationEmailView(field, view); } <END> else if (fieldType.equals(RegistrationFieldType.PASSWORD)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationPasswordView(field, view); } else if (fieldType.equals(RegistrationFieldType.TEXT)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationTextView(field, view); } else if (fieldType.equals(RegistrationFieldType.TEXTAREA)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationTextAreaView(field, view); } else if (fieldType.equals(RegistrationFieldType.MULTI)) { View view = inflater.inflate(R.layout.view_register_spinner, null); return new RegistrationSelectView(field, view); } else if (fieldType.equals(RegistrationFieldType.PLAINTEXT)) { return null; } else { logger.error(new Exception( String.format("Unknown field type found for field named: %s in RegistrationDescription, skipping it!", field.getName()) )); return null; } }</code><technical_language>field type is EMAIL of field CONFIRM_EMAIL is of lines of code</technical_language>

Target:
public static IRegistrationFieldView getInstance(LayoutInflater inflater, RegistrationFormField field) { RegistrationFieldType fieldType = field.getFieldType(); if (fieldType.equals(RegistrationFieldType.EMAIL)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationEmailView(field, view); } else if (fieldType.equals(RegistrationFieldType.PASSWORD)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationPasswordView(field, view); } else if (fieldType.equals(RegistrationFieldType.TEXT)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationTextView(field, view); } else if (fieldType.equals(RegistrationFieldType.TEXTAREA)) { View view = inflater.inflate(R.layout.view_register_edit_text, null); return new RegistrationTextAreaView(field, view); } else if (fieldType.equals(RegistrationFieldType.MULTI)) { View view = inflater.inflate(R.layout.view_register_spinner, null); return new RegistrationSelectView(field, view); } else if (fieldType.equals(RegistrationFieldType.PLAINTEXT)) { return null; } else { logger.error(new Exception( String.format("Unknown field type found for field named: %s in RegistrationDescription, skipping it!", field.getName()) )); return null; } }
Source:
<code>private static String getSchemaContent( final Util.PropertyList connectInfo, final String catalogUrl) { String dynProcName = connectInfo.get( RolapConnectionProperties.DynamicSchemaProcessor.name() ); String catalogStr = connectInfo.get( RolapConnectionProperties.CatalogContent.name() ); if (Util.isEmpty(catalogStr)) { if (Util.isEmpty(catalogUrl)) { throw MondrianResource.instance().ConnectStringMandatoryProperties.ex( RolapConnectionProperties.Catalog.name(), RolapConnectionProperties.CatalogContent.name()); } if (!Util.isEmpty(dynProcName)) { catalogStr = processDynamicSchema( dynProcName, catalogUrl, null, connectInfo); } if (Util.isEmpty(catalogStr)) { try { catalogStr = Util.readVirtualFileAsString(catalogUrl); } catch (IOException e) { throw Util.newError( e,"loading schema from url " + catalogUrl); } } } else { if (!Util.isEmpty(dynProcName)) { <START> catalogStr = catalogStr = processDynamicSchema( dynProcName, null, catalogStr, connectInfo ); <END> } } return catalogStr; }</code><technical_language>catalogStr = catalogStr =</technical_language>

Target:
private static String getSchemaContent( final Util.PropertyList connectInfo, final String catalogUrl) { String dynProcName = connectInfo.get( RolapConnectionProperties.DynamicSchemaProcessor.name() ); String catalogStr = connectInfo.get( RolapConnectionProperties.CatalogContent.name() ); if (Util.isEmpty(catalogStr)) { if (Util.isEmpty(catalogUrl)) { throw MondrianResource.instance().ConnectStringMandatoryProperties.ex( RolapConnectionProperties.Catalog.name(), RolapConnectionProperties.CatalogContent.name()); } if (!Util.isEmpty(dynProcName)) { catalogStr = processDynamicSchema( dynProcName, catalogUrl, null, connectInfo); } if (Util.isEmpty(catalogStr)) { try { catalogStr = Util.readVirtualFileAsString(catalogUrl); } catch (IOException e) { throw Util.newError( e,"loading schema from url " + catalogUrl); } } } else { if (!Util.isEmpty(dynProcName)) { catalogStr = processDynamicSchema( dynProcName, null, catalogStr, connectInfo ); } } return catalogStr; }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <START> setRetainInstance(true); <END> setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog); }</code><technical_language>This is considered a bad practice. retain a fragment for a dialog returns view, onCreateView return null. a DialogFragment (they leak rotation), RN in manifest do destroy activity do need this line</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog); }
Source:
<code>static CodeCoverageMetrics convertCobertura(CoverageResult result) { if (result == null) { return null; } float packagesCoverage = getCoveragePercentage(result, CoverageMetric.PACKAGES); float filesCoverage = getCoveragePercentage(result, CoverageMetric.FILES); float classesCoverage = getCoveragePercentage(result, CoverageMetric.CLASSES); float methodCoverage = getCoveragePercentage(result, CoverageMetric.METHOD); float lineCoverage = getCoveragePercentage(result, CoverageMetric.LINE); float conditionalCoverage = getCoveragePercentage(result, CoverageMetric.CONDITIONAL); <START> float linesCovered = result.getCoverage(CoverageMetric.LINE).numerator; <END> float linesTested = result.getCoverage(CoverageMetric.LINE).denominator; return new CodeCoverageMetrics( packagesCoverage, filesCoverage, classesCoverage, methodCoverage, lineCoverage, conditionalCoverage, linesCovered, linesTested ); }</code><technical_language>lets long</technical_language>

Target:
static CodeCoverageMetrics convertCobertura(CoverageResult result) { if (result == null) { return null; } float packagesCoverage = getCoveragePercentage(result, CoverageMetric.PACKAGES); float filesCoverage = getCoveragePercentage(result, CoverageMetric.FILES); float classesCoverage = getCoveragePercentage(result, CoverageMetric.CLASSES); float methodCoverage = getCoveragePercentage(result, CoverageMetric.METHOD); float lineCoverage = getCoveragePercentage(result, CoverageMetric.LINE); float conditionalCoverage = getCoveragePercentage(result, CoverageMetric.CONDITIONAL); long linesCovered = (long) result.getCoverage(CoverageMetric.LINE).numerator; long linesTested = (long) result.getCoverage(CoverageMetric.LINE).denominator; return new CodeCoverageMetrics( packagesCoverage, filesCoverage, classesCoverage, methodCoverage, lineCoverage, conditionalCoverage, linesCovered, linesTested ); }
Source:
<code>public Optional<Either<L, R>> subSequence(Either<L, R> seg, int start, int end) { return seg.unify(ll -> seg.unify(l -> lOps.subSequence(l, start, end).map(Either::left), e -> Optional.empty()), rr -> seg.unify(e -> Optional.empty(), <START> r -> rOps.subSequence(r, start, end).map(Either::right))); <END> }</code><technical_language>This code simplified java return seg.unify(l -> lOps.subSequence(l, start, end).map(Either::left), r -> rOps.subSequence(r, start, end).map(Either::right));</technical_language>

Target:
public Either<L, R> subSequence(Either<L, R> seg, int start, int end) { return seg.map(l -> lOps.subSequence(l, start, end), r -> rOps.subSequence(r, start, end)); }
Source:
<code>public void testFileNullException() throws IOException { String fakeData = "SomeRandomFakeData"; ByteArrayInputStream is = new ByteArrayInputStream(fakeData.getBytes("UTF-8")); boolean success = false; encoder.encode(is, file, new Options()); <START> success = encoder.encode(is, null, new Options()); <END> assertTrue(success); }</code><technical_language>If verify NPE is thrown pass a null File, use: java assertThrows(NullPointerException.class () -> encoder.encode(is, null, new Options()); verify specific exception is thrown. interface Glide support lambdas</technical_language>

Target:
public void testFileNullException() throws IOException { String fakeData = "SomeRandomFakeData"; file.createNewFile(); final ByteArrayInputStream is = new ByteArrayInputStream(fakeData.getBytes("UTF-8")); final boolean[] success = {false}; class EncodeNPETest implements ThrowingRunnable { @Override public void run() throws Throwable { success[0] = encoder.encode(is, null, new Options()); } } assertThrows(NullPointerException.class, new EncodeNPETest()); }
Source:
<code>public Family createFamily(User creator) { <START> return create(creator.getProfileDocument()); <END> }</code><technical_language>creator null, this needs a check</technical_language>

Target:
public Family createFamily(User creator) { return create(creator != null ? creator.getProfileDocument() : null); }
Source:
<code>private Request prepareMetadataQuery(String query) { HttpUriBuilder uriBuilder = uriBuilderFrom(druidBroker).replacePath(SQL_ENDPOINT); return setContentTypeHeaders(preparePost()) .setUri(uriBuilder.build()) <START> .setBodyGenerator(createStaticBodyGenerator(createRequestBody(query, DruidResultFormat.OBJECT, false))) <END> .build(); }</code><technical_language>static import OBJECT, ARRAY_LINES ...</technical_language>

Target:
private Request prepareMetadataQuery(String query) { HttpUriBuilder uriBuilder = uriBuilderFrom(druidBroker).replacePath(SQL_ENDPOINT); return setContentTypeHeaders(preparePost()) .setUri(uriBuilder.build()) .setBodyGenerator(createStaticBodyGenerator(createRequestBody(query, OBJECT, false))) .build(); }
Source:
<code>public Analyzer open(Assembler a, Resource root, Mode mode) { if (root.hasProperty(TextVocab.pTokenizer)) { <START> Resource tokenizerResource = (Resource) root.getProperty(TextVocab.pTokenizer).getObject(); <END> String tokenizer = tokenizerResource.getLocalName(); List<String> filters; if (root.hasProperty(TextVocab.pFilters)) { Resource filtersResource = (Resource) root.getProperty(TextVocab.pFilters).getObject(); filters = toFilterList(filtersResource); } else { filters = new ArrayList<>(); } return new ConfigurableAnalyzer(TextIndexLucene.VER, tokenizer, filters); } else { throw new TextIndexException("text:tokenizer setting is required by ConfigurableAnalyzer"); } }</code><technical_language>Resource::getPropertyResourceValue more readable here? (No cast.)</technical_language>

Target:
public Analyzer open(Assembler a, Resource root, Mode mode) { if (root.hasProperty(TextVocab.pTokenizer)) { Resource tokenizerResource = root.getPropertyResourceValue(TextVocab.pTokenizer); String tokenizer = tokenizerResource.getLocalName(); List<String> filters; if (root.hasProperty(TextVocab.pFilters)) { Resource filtersResource = root.getPropertyResourceValue(TextVocab.pFilters); filters = toFilterList(filtersResource); } else { filters = new ArrayList<>(); } return new ConfigurableAnalyzer(TextIndexLucene.VER, tokenizer, filters); } else { throw new TextIndexException("text:tokenizer setting is required by ConfigurableAnalyzer"); } }
Source:
<code>void testSerializeAndDeserializeList() { objectMapper.activateDefaultTyping( objectMapper.getPolymorphicTypeValidator(), <START> ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE <END> ); SimpleSerializableType toSerialize = new SimpleSerializableType("first", time, new SimpleSerializableType("nested")); SerializedObject<String> serialized = testSubject.serialize(singletonList(toSerialize), String.class); List<SimpleSerializableType> actual = testSubject.deserialize(serialized); assertEquals(1, actual.size()); assertEquals(toSerialize.getValue(), actual.get(0).getValue()); assertEquals(toSerialize.getNested().getValue(), actual.get(0).getNested().getValue()); }</code><technical_language>NON_CONCRETE_AND_ARRAYS (the JacksonSerializer)</technical_language>

Target:
void testSerializeAndDeserializeList() { objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_CONCRETE_AND_ARRAYS); SimpleSerializableType toSerialize = new SimpleSerializableType("first", time, new SimpleSerializableType("nested")); SerializedObject<String> serialized = testSubject.serialize(singletonList(toSerialize), String.class); List<SimpleSerializableType> actual = testSubject.deserialize(serialized); assertEquals(1, actual.size()); assertEquals(toSerialize.getValue(), actual.get(0).getValue()); assertEquals(toSerialize.getNested().getValue(), actual.get(0).getNested().getValue()); }
Source:
<code>public <R> Try<R> of(CheckedFunction1<? super T1, ? extends R> f) { return Try.of(() -> { final R result; try (T1 t1 = t1Supplier.get()) { <START> result = f.apply(t1); <END> } return result; }); }</code><technical_language>choose @sputnikci @codecov-io complaining :p open a @codecov-io issue instead of making code uglier</technical_language>

Target:
public <R> Try<R> of(CheckedFunction1<? super T1, ? extends R> f) { return Try.of(() -> { try (T1 t1 = t1Supplier.get()) { return f.apply(t1); } }); }
Source:
<code>protected void reorderNode( String workspaceName, NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey parent, Path newPath, Path oldPath, Path reorderedBeforePath ) { String nodeKey = nodeKey(key); index().remove(nodeKey, valueOf(oldPath)); <START> index().add(nodeKey, valueOf(newPath)); <END> }</code><technical_language>this change of indexed information for other nodes _after_ reorderedBeforePath</technical_language>

Target:
protected void reorderNode( String workspaceName, NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey parent, Path newPath, Path oldPath, Path reorderedBeforePath ) { if (newPath.getLastSegment().hasIndex() || oldPath.getLastSegment().hasIndex()) { } }
Source:
<code>public String getLiteral(Geometry geometry) { String str = Wkt.newEncoder(Wkt.Dialect.POSTGIS_EWKT_1).encode(geometry); if (geometry.getSRID() > -1) { return "geometry::STGeomFromText('" + str + "', " + geometry.getSRID() + ")"; } else { <START> return "geometry::STGeomFromText('" + str + "', 4326)"; <END> } }</code><technical_language>SQLServer's default geometry.getSRID()? good point. is it</technical_language>

Target:
public String getLiteral(Geometry geometry) { String str = Wkt.newEncoder(Wkt.Dialect.POSTGIS_EWKT_1).encode(geometry); if (geometry.getSRID() > -1) { return "geometry::STGeomFromText('" + str + "', " + geometry.getSRID() + ")"; } else { return "geometry::STGeomFromText('" + str + "', " + DEFAULT_SRID + ")"; } }
Source:
<code>protected ConfigurationValidation validateConnectorConfiguration() { if (isFieldValueNotSet(testField)) { <START> return ConfigurationValidation.notValid("testField canont be empty"); <END> } return ConfigurationValidation.valid(); }</code><technical_language>Typo in</technical_language>

Target:
protected ConfigurationValidation validateConnectorConfiguration() { if (isFieldValueNotSet(testField)) { return ConfigurationValidation.notValid("testField cannot be empty"); } return ConfigurationValidation.valid(); }
Source:
<code>private Metacard resultsMapper(Map map) { <START> LOGGER.debug("Starting result processing..."); <END> String title = safeGet(map, "title", String.class); String description = safeGet(map, "description", String.class); List<String> descriptors = safeGetList(map, "descriptors", String.class); if (anyNull(title, description, descriptors)) { LOGGER.debug("Invalid entry in results.json"); return null; } ResultTemplateMetacardImpl metacard = new ResultTemplateMetacardImpl(title, description); metacard.setResultDescriptors(new HashSet<>(descriptors)); return metacard; }</code><technical_language>trace</technical_language>

Target:
private Metacard resultsMapper(Map map) { String title = safeGet(map, Core.TITLE, String.class); String description = safeGet(map, Core.DESCRIPTION, String.class); List<String> descriptors = safeGetList(map, "descriptors", String.class); if (anyNull(title, description, descriptors)) { return null; } AttributeGroupMetacard metacard = new AttributeGroupMetacard(title, description); metacard.setGroupDescriptors(new HashSet<>(descriptors)); return metacard; }
Source:
<code>public boolean evaluate(int content) { <START> if (content == 1) { return true; } else { return false; } <END> }</code><technical_language>return content == 1</technical_language>

Target:
public boolean evaluate(int content) { return content == 1; }
Source:
<code>public BitWorld() { <START> dynamicBodies = new ArrayList<>(); <END> pendingAdds = new ArrayList<>(); pendingRemoves = new ArrayList<>(); occupiedSpaces = new HashMap<>(); pendingResolutions = new HashMap<>(); contacts = new HashMap<>(); }</code><technical_language>need this line of green 31</technical_language>

Target:
public BitWorld() { pendingAdds = new ArrayList<>(); pendingRemoves = new ArrayList<>(); occupiedSpaces = new HashMap<>(); pendingResolutions = new HashMap<>(); contacts = new HashMap<>(); }
Source:
<code>public Response getChildrenByParentId(@PathParam("parentId") String parentId) { if (parentId == null) { String errorMessage = "The parameter of the parent ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } List<DeviceOrganizationMetadataHolder> result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getChildrenByParentId(parentId); if (result == null) { String msg = "No children connected to device"; <START> log.error(msg); <END> return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving children of device"; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }</code><technical_language>IMO, this is error. log a debug log</technical_language>

Target:
public Response getChildrenByParentId(@PathParam("parentId") String parentId) { if (parentId == null) { String errorMessage = "The parameter of the parent ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } List<DeviceOrganizationMetadataHolder> result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getChildrenByParentId(parentId); if (result == null) { String msg = "No children connected to device"; if (log.isDebugEnabled()) { log.debug(msg); } return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving children of device"; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }
Source:
<code>public void testProcessEvent() throws UnsupportedEncodingException, NoSuchAlgorithmException { final APIEvent event = new APIEvent(EventStrings.API_EVENT); event.setAPIId("123"); event.setAuthority("AAD"); event.setAuthorityType("AAD"); event.setExtendedExpiresOnSetting(true); event.setIdToken(AuthenticationContextTest.TEST_IDTOKEN); event.setLoginHint("pii@pii.com"); final Map<String, String> dispatchMap = new HashMap(); event.processEvent(dispatchMap); assertFalse(dispatchMap.isEmpty()); <START> assertTrue(dispatchMap.containsKey(EventStrings.AUTHORITY_TYPE)); <END> assertTrue(dispatchMap.containsKey(EventStrings.EXTENDED_EXPIRES_ON_SETTING)); assertFalse(dispatchMap.containsKey(EventStrings.API_ERROR_CODE)); assertFalse(dispatchMap.containsKey(EventStrings.API_ERROR_CODE)); final String email = dispatchMap.get(EventStrings.LOGIN_HINT); assertTrue(email.equals(StringExtensions.createHash("pii@pii.com"))); }</code><technical_language>add check for values for other parameters for Login_Hint #Resolved</technical_language>

Target:
public void testProcessEvent() throws UnsupportedEncodingException, NoSuchAlgorithmException { final APIEvent event = new APIEvent(EventStrings.API_EVENT); event.setAPIId("123"); event.setAuthority("AAD"); event.setAuthorityType("AAD"); event.setExtendedExpiresOnSetting(true); event.setIdToken(AuthenticationContextTest.TEST_IDTOKEN); event.setLoginHint("pii@pii.com"); final Map<String, String> dispatchMap = new HashMap(); event.processEvent(dispatchMap); assertFalse(dispatchMap.isEmpty()); assertTrue(dispatchMap.containsKey(EventStrings.AUTHORITY_TYPE)); assertTrue(dispatchMap.containsKey(EventStrings.EXTENDED_EXPIRES_ON_SETTING)); assertFalse(dispatchMap.containsKey(EventStrings.API_ERROR_CODE)); assertTrue(dispatchMap.containsKey(EventStrings.TENANT_ID)); assertTrue(dispatchMap.containsKey(EventStrings.DEVICE_ID)); assertTrue(dispatchMap.containsKey(EventStrings.CLIENT_ID)); assertTrue(dispatchMap.containsKey(EventStrings.APPLICATION_VERSION)); assertTrue(dispatchMap.containsKey(EventStrings.USER_ID)); final String email = dispatchMap.get(EventStrings.LOGIN_HINT); assertTrue(email.equals(StringExtensions.createHash("pii@pii.com"))); }
Source:
<code>public void shouldFailWhenCreatingExistingChildNameDocument() { try (CloseableCoreSession bobSession = CoreInstance.openCoreSession(coreSession.getRepositoryName(), "bob")) { createDocument(bobSession, folder, DOCUMENT_NAME); } try (CloseableCoreSession jamesSession = CoreInstance.openCoreSession(coreSession.getRepositoryName(), "james")) { createDocument(jamesSession, folder, DOCUMENT_NAME); fail("should throw a ConcurrentUpdateException"); } catch (ConcurrentUpdateException cue) { assertEquals(SC_CONFLICT, cue.getStatusCode()); String mongoDBName = Framework.getProperties().getProperty(MONGODB_DBNAME_PROPERTY); assertTrue( cue.getMessage() .contains(String.format( "E11000 duplicate key error collection: %s.test index: ecm:parentId_1_ecm:name_1 dup key: { : \"%s\", : \"%s\" }", mongoDBName, folder.getId(), DOCUMENT_NAME))); <START> <END> } }</code><technical_language>This is complex, care detailed format of human-readable message MongoDB returns. check for presence of "E11000 duplicate key error" folder id, avoid this complexity (which white-box testing)</technical_language>

Target:
public void shouldFailWhenCreatingExistingChildNameDocument() { try (CloseableCoreSession bobSession = CoreInstance.openCoreSession(coreSession.getRepositoryName(), "bob")) { createDocument(bobSession, folder, DOCUMENT_NAME); } try (CloseableCoreSession jamesSession = CoreInstance.openCoreSession(coreSession.getRepositoryName(), "james")) { createDocument(jamesSession, folder, DOCUMENT_NAME); fail("should throw a ConcurrentUpdateException"); } catch (ConcurrentUpdateException cue) { assertEquals(SC_CONFLICT, cue.getStatusCode()); String message = cue.getMessage(); assertTrue(message, message.contains("E11000 duplicate key error collection")); assertTrue(message, message.contains(DOCUMENT_NAME)); assertTrue(message, message.contains(folder.getId())); } }
Source:
<code>public void schedulePeriodicBackgroundJob(int delay){ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if(preferences.getBoolean(context.getResources().getString(R.string.preference_real_time_sync), false)) { Runnable runnable = new Runnable() { @Override public void run() { if (!isJobAlreadyScheduled(context)) { handleScheduledPeriodicDataSyncJob(); <START> Log.e(getClass().getSimpleName(), "============Background task is scheduled============="); <END> } else { Log.e(getClass().getSimpleName(), "There is already a background service running."); } } }; Handler handler = new Handler(); handler.postDelayed(runnable, delay); } }</code><technical_language>Remove Unnecessary logging</technical_language>

Target:
public void schedulePeriodicBackgroundJob(int delay){ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if(preferences.getBoolean(context.getResources().getString(R.string.preference_real_time_sync), false)) { Runnable runnable = new Runnable() { @Override public void run() { if (!isJobAlreadyScheduled(context)) { handleScheduledPeriodicDataSyncJob(); } } }; Handler handler = new Handler(); handler.postDelayed(runnable, delay); } }
Source:
<code><START> private static VCFTextTransformer getTextTransformerForVCFVersion(final VCFHeaderVersion targetVersion) { <END> return targetVersion.isAtLeastAsRecentAs(VCFHeaderVersion.VCF4_3) ? new VCFTextTransformer() : new VCFPassThruTextTransformer(); }</code><technical_language>this is overridable, moving VCFTextTransformer a factory method, e.g. VCFTextTransformer.fromVersion(). Another place for this is VCFHeaderVersion, e.g. VCFHeaderVersion.createTextTransformer()</technical_language>

Target:
private VCFTextTransformer getTextTransformerForVCFVersion(final VCFHeaderVersion targetVersion) { return targetVersion != null && targetVersion.isAtLeastAsRecentAs(VCFHeaderVersion.VCF4_3) ? percentEncodingTextTransformer : passThruTextTransformer; }
Source:
<code>public void setupContext() { super.setup(); <START> String zone = api.getConfiguredZones().iterator().next(); <END> quotaApi = api.getQuotaApi(zone); }</code><technical_language>Iterables.getFirst() instead</technical_language>

Target:
public void setupContext() { super.setup(); String zone = Iterables.getFirst(api.getConfiguredZones(), "nova"); quotaApi = api.getQuotaApi(zone); }
Source:
<code>public Chunk getChunk(final long splitStart, final long splitEnd) { if (splitStart >= splitEnd) { throw new IllegalArgumentException(String.format("Split start (%s) must be less than end (%s)", splitStart, splitEnd)); } <START> long lastVirtualOffset = virtualOffsets[virtualOffsets.length - 1]; <END> long maxEnd = BlockCompressedFilePointerUtil.getBlockAddress(lastVirtualOffset); long actualSplitStart = Math.min(splitStart, maxEnd); long actualSplitEnd = Math.min(splitEnd, maxEnd); long virtualSplitStart = BlockCompressedFilePointerUtil.makeFilePointer(actualSplitStart); long virtualSplitEnd = BlockCompressedFilePointerUtil.makeFilePointer(actualSplitEnd); long virtualSplitStartAlignment = ceiling(virtualSplitStart); long virtualSplitEndAlignment = ceiling(virtualSplitEnd); if (virtualSplitStartAlignment == virtualSplitEndAlignment) { return null; } return new Chunk(virtualSplitStartAlignment, virtualSplitEndAlignment); }</code><technical_language>lots more finals</technical_language>

Target:
public Chunk getChunk(final long splitStart, final long splitEnd) { if (splitStart >= splitEnd) { throw new IllegalArgumentException(String.format("Split start (%s) must be less than end (%s)", splitStart, splitEnd)); } final long lastVirtualOffset = virtualOffsets[virtualOffsets.length - 1]; final long maxEnd = BlockCompressedFilePointerUtil.getBlockAddress(lastVirtualOffset); final long actualSplitStart = Math.min(splitStart, maxEnd); final long actualSplitEnd = Math.min(splitEnd, maxEnd); final long virtualSplitStart = BlockCompressedFilePointerUtil.makeFilePointer(actualSplitStart); final long virtualSplitEnd = BlockCompressedFilePointerUtil.makeFilePointer(actualSplitEnd); final long virtualSplitStartAlignment = ceiling(virtualSplitStart); final long virtualSplitEndAlignment = ceiling(virtualSplitEnd); if (virtualSplitStartAlignment == virtualSplitEndAlignment) { return null; } return new Chunk(virtualSplitStartAlignment, virtualSplitEndAlignment); }
Source:
<code>public void handleSetAlarmNotificationsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSetAlarmNotificationsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Set Alarm Notifications Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } <START> this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() <END> .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
public void handleSetAlarmNotificationsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSetAlarmNotificationsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Set Alarm Notifications Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
<code>public Response moveFileAnswers(@QueryParam("count") Integer count) { if (count == null || count < 0) { return Response.status(Status.BAD_REQUEST).build(); } EnvironmentUser user = environmentUserController.findEnvironmentUserByUserEntity(sessionController.getLoggedUserEntity()); if (user == null || user.getRole() == null || user.getRole().getArchetype() != EnvironmentRoleArchetype.ADMINISTRATOR) { return Response.status(Status.FORBIDDEN).build(); } int bytes = 0; int totalBytes = 0; int totalFiles = 0; Long currentId = fileAnswerUtils.getLastEntityId(); List<Long> answerIds = workspaceMaterialFileFieldAnswerDAO.listIdsByLargerAndLimit(currentId, count); for (Long answerId : answerIds) { try { WorkspaceMaterialFileFieldAnswer answer = workspaceMaterialFileFieldAnswerDAO.findById(answerId); if (answer != null) { bytes = fileAnswerUtils.relocateToFileSystem(answer); if (bytes > 0) { totalBytes += bytes; totalFiles++; } currentId = answerId; } } catch (IOException e) { logger.log(Level.SEVERE, String.format("Failed to relocate WorkspaceMaterialFileFieldAnswer %d", currentId), e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } <START> fileAnswerUtils.setLastEntityId(currentId); <END> return Response.ok(String.format("Moved %d files (%d bytes) with latest entity at %d", totalFiles, totalBytes, currentId)).build(); }</code><technical_language>problems if batch is big operation times out (does time out - database timeout?)? id is updated</technical_language>

Target:
public Response moveFileAnswers(@QueryParam("count") Integer count) { if (count == null || count < 0) { return Response.status(Status.BAD_REQUEST).build(); } EnvironmentUser user = environmentUserController.findEnvironmentUserByUserEntity(sessionController.getLoggedUserEntity()); if (user == null || user.getRole() == null || user.getRole().getArchetype() != EnvironmentRoleArchetype.ADMINISTRATOR) { return Response.status(Status.FORBIDDEN).build(); } int bytes = 0; int totalBytes = 0; int totalFiles = 0; Long currentId = fileAnswerUtils.getLastEntityId(); List<Long> answerIds = workspaceMaterialFileFieldAnswerDAO.listIdsByLargerAndLimit(currentId, count); for (Long answerId : answerIds) { try { WorkspaceMaterialFileFieldAnswer answer = workspaceMaterialFileFieldAnswerDAO.findById(answerId); if (answer != null) { bytes = fileAnswerUtils.relocateToFileSystem(answer); if (bytes > 0) { totalBytes += bytes; totalFiles++; } currentId = answerId; } fileAnswerUtils.setLastEntityId(currentId); } catch (IOException e) { logger.log(Level.SEVERE, String.format("Failed to relocate WorkspaceMaterialFileFieldAnswer %d", currentId), e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } return Response.ok(String.format("Moved %d files (%d bytes) with latest entity at %d", totalFiles, totalBytes, currentId)).build(); }
Source:
<code>public void cancel() { WorkItem workItem = getWorkItem(); if (workItem != null && workItem.getState() != WorkItem.COMPLETED && workItem.getState() != WorkItem.ABORTED) { try { ((WorkItemManager) ((ProcessInstance) getProcessInstance()) .getKnowledgeRuntime().getWorkItemManager()).internalAbortWorkItem(workItemId); } catch (WorkItemHandlerNotFoundException wihnfe) { getProcessInstance().setState(ProcessInstance.STATE_ABORTED); throw wihnfe; } } if (processInstanceId > -1) { ProcessInstance processInstance = null; InternalKnowledgeRuntime kruntime = ((ProcessInstance) getProcessInstance()).getKnowledgeRuntime(); RuntimeManager manager = (RuntimeManager) kruntime.getEnvironment().get(EnvironmentName.RUNTIME_MANAGER); if (manager != null) { try { org.kie.api.runtime.manager.Context<?> context = ProcessInstanceIdContext.get(processInstanceId); String caseId = (String) kruntime.getEnvironment().get(EnvironmentName.CASE_ID); if (caseId != null) { context = CaseContext.get(caseId); } RuntimeEngine runtime = manager.getRuntimeEngine(context); <START> KieRuntime managedkruntime = (KieRuntime) runtime.getKieSession(); <END> processInstance = (ProcessInstance) managedkruntime.getProcessInstance(processInstanceId); } catch (SessionNotFoundException e) { } } else { processInstance = (ProcessInstance) kruntime.getProcessInstance(processInstanceId); } if (processInstance != null) { processInstance.setState(ProcessInstance.STATE_ABORTED); } } super.cancel(); }</code><technical_language>This part in exceptionHandlingCompleted() method. extracted a method</technical_language>

Target:
public void cancel() { WorkItem workItem = getWorkItem(); if (workItem != null && workItem.getState() != WorkItem.COMPLETED && workItem.getState() != WorkItem.ABORTED) { try { ((WorkItemManager) ((ProcessInstance) getProcessInstance()) .getKnowledgeRuntime().getWorkItemManager()).internalAbortWorkItem(workItemId); } catch (WorkItemHandlerNotFoundException wihnfe) { getProcessInstance().setState(ProcessInstance.STATE_ABORTED); throw wihnfe; } } if (exceptionHandlingProcessInstanceId > -1) { ProcessInstance processInstance = null; KieRuntime kruntime = getKieRuntimeForSubprocess(); processInstance = (ProcessInstance) kruntime.getProcessInstance(exceptionHandlingProcessInstanceId); if (processInstance != null) { processInstance.setState(ProcessInstance.STATE_ABORTED); } } super.cancel(); }
Source:
<code>public SongMetadata remove(SongMetadata meta) { SongMetadata removeMeta = meta; boolean removed = musicList.remove(meta); if (!removed) { removed = playedList.remove(meta); <START> if(!removed){ <END> removeMeta = null; } } return removeMeta; }</code><technical_language>I this code clearer. remove musicList remove either. java boolean success; SongMetadata removeMeta = meta; if(musicList.contains(meta)) { success = musicList.remove(meta); } else if(playedList.contains(meta){ success = playedList.remove(meta) } else { success = false; Log.wtf(TAG, "Asked remove unknown object); } if(!success){ removeMeta = null; }</technical_language>

Target:
public SongMetadata remove(SongMetadata meta) { boolean success; SongMetadata removeMeta = meta; if(musicList.contains(meta)) { success = musicList.remove(meta); } else if(playedList.contains(meta)){ success = playedList.remove(meta); } else { success = false; Log.wtf(TAG, "Asked to remove unknown object"); } if(!success){ removeMeta = null; } return removeMeta; }