auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String getDefaultEthDevice() { if (SystemUtils.IS_OS_MAC) { final String defDev = Script.runSimpleBashScript("/sbin/route -n get default 2> /dev/null | grep interface | awk '{print $2}'"); return defDev; } <START> return Script.runSimpleBashScript("ip route | grep default | head -1 | grep -Po '(?<=dev )(\\S+)'"); <END> }</code><technical_language>@rhtyd I run command ubuntu 18.04, I empty result. is normal ? root@mgt118-4:~# ip route | grep default | head -1 | grep -Po '(?<=dev )(\\S+)' root@mgt118-4:~# ip route | grep default | head -1 default 10.11.118.254 dev eth0</technical_language>

Target:
public static String getDefaultEthDevice() { if (SystemUtils.IS_OS_MAC) { final String defDev = Script.runSimpleBashScript("/sbin/route -n get default 2> /dev/null | grep interface | awk '{print $2}'"); return defDev; } return Script.runSimpleBashScript("ip route show default 0.0.0.0/0 | head -1 | awk '{print $5}'"); }
Source:
<code>public void testDecorate() throws Exception { final Language baseLanguage = new LanguageDataGen().languageCode("it").countryCode(null).nextPersisted(); final Language itLanguage = new LanguageDataGen().languageCode("it").countryCode("IT").nextPersisted(); final long expectedBaseId = baseLanguage.getId(); final long expectedItalyId = itLanguage.getId(); final LanguageIdParameterDecorator languageIdParameterDecorator = new LanguageIdParameterDecorator(); final long languageId1 = Long.parseLong(new CachedParameterDecorator(languageIdParameterDecorator).decorate("it_IT")); final long languageId2 = Long.parseLong(new CachedParameterDecorator(languageIdParameterDecorator).decorate("it")); Assert.assertEquals(expectedItalyId, languageId1); Assert.assertEquals(expectedBaseId, languageId2); APILocator.getLanguageAPI().deleteLanguage(baseLanguage); <START> APILocator.getLanguageAPI().deleteLanguage(itLanguage); <END> }</code><technical_language>if purpose of 2 lines is cleaning environment test, a finally guarantee executed test fails (if languages created)</technical_language>

Target:
public void testDecorate() throws Exception { final String[] languageCodes = Locale.getISOLanguages(); final int languageIndex = new Random().nextInt(languageCodes.length); final String languageCode = languageCodes[languageIndex]; final Language baseLanguage = new LanguageDataGen().languageCode(languageCode).countryCode(null).nextPersisted(); final Language itLanguage = new LanguageDataGen().languageCode(languageCode).countryCode("IT").nextPersisted(); final long expectedBaseId = baseLanguage.getId(); final long expectedItalyId = itLanguage.getId(); final LanguageIdParameterDecorator languageIdParameterDecorator = new LanguageIdParameterDecorator(); final long languageId1 = Long.parseLong(new CachedParameterDecorator(languageIdParameterDecorator).decorate(languageCode + "_IT")); final long languageId2 = Long.parseLong(new CachedParameterDecorator(languageIdParameterDecorator).decorate(languageCode)); Assert.assertEquals(expectedItalyId, languageId1); Assert.assertEquals(expectedBaseId, languageId2); }
Source:
<code>public void setRun(Run run) { if (runs.size() < 2) { <START> runs.add(run); <END> } else { throw new IllegalArgumentException("Cannot add more than one run to a container!"); } }</code><technical_language>This result in NPE acts add instead of a set. setRun(Run notNull) is called, runs.size() == 1 true. Change like: if (runs != null && runs.size() > 1) { throw new IllegalStateException("Cannot set single run container multiple runs linked!"); } else { runs = new ArrayList<>(); if (run != null) runs.add(run); }</technical_language>

Target:
public void setRun(Run run) { if (run != null && runs.size() > 1) { throw new IllegalArgumentException("Cannot set single run on a container with multiple runs already linked!"); } else { runs = new ArrayList<>(); if (run != null) runs.add(run); } }
Source:
<code>public StyledString getStyledText(Object element) { String text = super.getText(element); if (text.isEmpty()) { return new StyledString(text); } <START> for (int i = 0; i < fdisabledModels.length; i++) { <END> if (((IPluginModelBase) element).equals(fdisabledModels[i])) { return new StyledString(text, StyledString.DECORATIONS_STYLER); } } return new StyledString(text); }</code><technical_language>This is duplicate code validateitem method</technical_language>

Target:
public StyledString getStyledText(Object element) { String text = super.getText(element); if (text.isEmpty()) { return new StyledString(text); } if (fdisabledModels != null && fdisabledModels.contains(element)) { return new StyledString(text, StyledString.DECORATIONS_STYLER) .append(new StyledString(" (already included as a dependency)", StyledString.COUNTER_STYLER)); } return new StyledString(text); }
Source:
<code>protected void writeVarBinding( VarBinding binding) { writer_.writeElement( VAR_TAG, <START> MapBuilder.of( NAME_ATR, binding.getVar()).put( VALUE_ATR, String.valueOf( binding.getValue())).build()); <END> }</code><technical_language>personally I find combination of of() put() weird. new MapBuilder().put(...).put(...) leave readers wonder</technical_language>

Target:
protected void writeVarBinding( VarBinding binding) { writer_ .element( VAR_TAG) .attribute( NAME_ATR, binding.getVar()) .attribute( VALUE_ATR, String.valueOf( binding.getValue())) .write(); }
Source:
<code>public Block readBlock() throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } if (readOffset > 0) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is missing"); } dataStream.skip(readOffset); } } Block block; if (dataStream == null) { if (presentStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is null but present stream is missing"); } presentStream.skip(nextBatchSize); block = RunLengthEncodedBlock.create(DOUBLE, null, nextBatchSize); } else if (presentStream == null) { block = readNonNullBlock(); } else { boolean[] isNull = new boolean[nextBatchSize]; int nullCount = presentStream.getUnsetBits(nextBatchSize, isNull); if (nullCount == 0) { block = readNonNullBlock(); } else if (nullCount != nextBatchSize) { block = readNullBlock(isNull, nextBatchSize - nullCount); } else { <START> block = readNullBlock(isNull, nextBatchSize - nullCount); <END> } } readOffset = 0; nextBatchSize = 0; return block; }</code><technical_language>This line is for null case, case of (nullCount != nextBatchSize). is this else{} block? block = RunLengthEncodedBlock.create(type, null, nextBatchSize);</technical_language>

Target:
public Block readBlock() throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } if (readOffset > 0) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is missing"); } dataStream.skip(readOffset); } } Block block; if (dataStream == null) { if (presentStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is null but present stream is missing"); } presentStream.skip(nextBatchSize); block = RunLengthEncodedBlock.create(DOUBLE, null, nextBatchSize); } else if (presentStream == null) { block = readNonNullBlock(); } else { boolean[] isNull = new boolean[nextBatchSize]; int nullCount = presentStream.getUnsetBits(nextBatchSize, isNull); if (nullCount == 0) { block = readNonNullBlock(); } else if (nullCount != nextBatchSize) { block = readNullBlock(isNull, nextBatchSize - nullCount); } else { block = RunLengthEncodedBlock.create(DOUBLE, null, nextBatchSize); } } readOffset = 0; nextBatchSize = 0; return block; }
Source:
<code>Config config() { if (atlasConfig == null) { if (config == null) { <START> LOGGER.warn("no archaius2 binding found"); <END> } atlasConfig = NetflixConfig.createConfig(config); } return atlasConfig; }</code><technical_language>this get logged part of createConfig. Do need both</technical_language>

Target:
Config config() { if (atlasConfig == null) { atlasConfig = NetflixConfig.createConfig(config); } return atlasConfig; }
Source:
<code>public FunctionInfo(String name, Type signature) { this.name = name; this.signature = signature; <START> this.requiredBlocks = Collections.EMPTY_LIST; <END> }</code><technical_language>Constructors call other constructors in Java, this work: this(name, signature, ImmutableList.of())</technical_language>

Target:
public FunctionInfo(String name, Type signature) { this(name, signature, Collections.EMPTY_LIST); }
Source:
<code>static Mets readUriToMets(URI xmlFile) throws JAXBException, IOException { FileManagementInterface fileManagementModule = new KitodoServiceLoader<FileManagementInterface>( FileManagementInterface.class).loadModule(); if (fileManagementModule.fileExist(xmlFile)) { JAXBContext jaxbMetsContext = JAXBContext.newInstance(Mets.class); Unmarshaller jaxbUnmarshaller = jaxbMetsContext.createUnmarshaller(); <START> return (Mets) jaxbUnmarshaller.unmarshal(fileManagementModule.getFile(xmlFile)); <END> } else { throw new IOException("File was not found: " + xmlFile.getPath()); } }</code><technical_language>same: FileManagement open URI (since Java interpret it): try (InputStream inputStream = fileManagementModule.read(xmlFile)) { return (Mets) jaxbUnmarshaller.unmarshal(inputStream); }</technical_language>

Target:
static Mets readUriToMets(URI xmlFile) throws JAXBException, IOException { FileManagementInterface fileManagementModule = new KitodoServiceLoader<FileManagementInterface>( FileManagementInterface.class).loadModule(); if (fileManagementModule.fileExist(xmlFile)) { JAXBContext jaxbMetsContext = JAXBContext.newInstance(Mets.class); Unmarshaller jaxbUnmarshaller = jaxbMetsContext.createUnmarshaller(); try (InputStream inputStream = fileManagementModule.read(xmlFile)) { return (Mets) jaxbUnmarshaller.unmarshal(inputStream); } } else { throw new IOException("File was not found: " + xmlFile.getPath()); } }
Source:
<code>static void registerOperations(ManagementResourceRegistration registry, ResourceDescriptionResolver resourceDescriptionResolver) { registry.registerOperationHandler(new SimpleOperationDefinitionBuilder("migrate", resourceDescriptionResolver) .setParameters(ADD_LEGACY_ENTRIES, DRY_RUN) .setRuntimeOnly() <START> .setReplyValueType(ModelType.BOOLEAN) <END> .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), MigrateOperation.MIGRATE_INSTANCE); registry.registerOperationHandler(new SimpleOperationDefinitionBuilder("describe-migration", resourceDescriptionResolver) .addParameter(ADD_LEGACY_ENTRIES) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), MigrateOperation.DESCRIBE_MIGRATION_INSTANCE); }</code><technical_language>This setReplyType(). I this needs provide result all. "outcome" = "success" "failed" part of response happened; "result" "dryRun" param caller knows</technical_language>

Target:
static void registerOperations(ManagementResourceRegistration registry, ResourceDescriptionResolver resourceDescriptionResolver) { registry.registerOperationHandler(new SimpleOperationDefinitionBuilder("migrate", resourceDescriptionResolver) .setParameters(ADD_LEGACY_ENTRIES) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), MigrateOperation.MIGRATE_INSTANCE); registry.registerOperationHandler(new SimpleOperationDefinitionBuilder("describe-migration", resourceDescriptionResolver) .addParameter(ADD_LEGACY_ENTRIES) .setReplyType(ModelType.LIST).setReplyValueType(ModelType.OBJECT) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), MigrateOperation.DESCRIBE_MIGRATION_INSTANCE); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(memFree, other.memFree) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free) && (anonymousHugePages == other.anonymousHugePages) && (highlyAvailableScore == other.highlyAvailableScore) && (highlyAvailableIsConfigured == other.highlyAvailableIsConfigured) && (highlyAvailableIsActive == other.highlyAvailableIsActive) <START> && (highlyAvailableGlobalMaintenance == other.highlyAvailableGlobalMaintenance) <END> && (highlyAvailableLocalMaintenance == other.highlyAvailableLocalMaintenance)); }</code><technical_language>If add uptime in hashCode, in a part of equals method</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(memFree, other.memFree) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free) && (anonymousHugePages == other.anonymousHugePages) && (highlyAvailableScore == other.highlyAvailableScore) && (highlyAvailableIsConfigured == other.highlyAvailableIsConfigured) && (highlyAvailableIsActive == other.highlyAvailableIsActive) && (highlyAvailableGlobalMaintenance == other.highlyAvailableGlobalMaintenance) && (highlyAvailableLocalMaintenance == other.highlyAvailableLocalMaintenance) && uptime == other.uptime); }
Source:
<code>public void testIndicateMissingResponses() { ______TS("Typical case: Hide Missing Responses"); assertEquals(resultsPage.indicateMissingResponsesCheckbox.getAttribute("checked"), "true"); assertFalse(resultsPage.verifyMissingResponsesVisibility()); resultsPage.clickIndicateMissingResponses(); assertEquals(resultsPage.indicateMissingResponsesCheckbox.getAttribute("checked"), null); assertTrue(resultsPage.verifyMissingResponsesVisibility()); resultsPage.clickIndicateMissingResponses(); <START> assertEquals(resultsPage.indicateMissingResponsesCheckbox.getAttribute("checked"), "true"); <END> assertFalse(resultsPage.verifyMissingResponsesVisibility()); }</code><technical_language>replace isSelected() eg. assertTrue(resultsPage.indicateMissingResponsesCheckbox.isSelected()); I doubt this is related current issue testing</technical_language>

Target:
public void testIndicateMissingResponses() { ______TS("Typical case: Hide Missing Responses"); assertTrue(resultsPage.indicateMissingResponsesCheckbox.isSelected()); assertFalse(resultsPage.verifyMissingResponsesVisibility()); resultsPage.clickIndicateMissingResponses(); assertFalse(resultsPage.indicateMissingResponsesCheckbox.isSelected()); assertTrue(resultsPage.verifyMissingResponsesVisibility()); resultsPage.clickIndicateMissingResponses(); assertTrue(resultsPage.indicateMissingResponsesCheckbox.isSelected()); assertFalse(resultsPage.verifyMissingResponsesVisibility()); }
Source:
<code>public SessionData(ICrypter crypter) { <START> this.cypter= crypter; <END> }</code><technical_language>Do need a nonNull check ? newCrypter(IPageContext context) return null. exception idea more clear NPE while below</technical_language>

Target:
public SessionData(ICrypter crypter) { Args.notNull(crypter, "crypter"); this.cypter= crypter; }
Source:
<code>public JsonElement serialize(IncomingTransferAccept src, Type typeOfSrc, JsonSerializationContext context) { JsonObject object = new JsonObject(); if (src.error != null) { object.addProperty(MEMBER_ERROR, src.error.code); } else { <START> object.addProperty(MEMBER_STATUS, src.status.code); <END> object.addProperty(MEMBER_CODE_ATTEMPTS, src.protectionCodeAttemptsAvailable); object.addProperty(MEMBER_EXT_ACTION_URI, src.extActionUri); } return object; }</code><technical_language>Status is known</technical_language>

Target:
public JsonElement serialize(IncomingTransferAccept src, Type typeOfSrc, JsonSerializationContext context) { JsonObject object = new JsonObject(); object.addProperty(MEMBER_STATUS, src.status.code); if (src.error != null) { object.addProperty(MEMBER_ERROR, src.error.code); } else { object.addProperty(MEMBER_CODE_ATTEMPTS, src.protectionCodeAttemptsAvailable); object.addProperty(MEMBER_EXT_ACTION_URI, src.extActionUri); } return object; }
Source:
<code>public void checkFileSize(File file){ if (FileUtil.isFileToBigToUpload(file)) { <START> long overByAmount = (file.length() - FormUploadUtil.MAX_BYTES) / 1024; <END> notifyWarning(StringUtils.getStringRobust(getContext(), R.string.attachment_to_big_to_upload, overByAmount + "")); } else if (FileUtil.isFileOversized(file)) { notifyWarning(StringUtils.getStringRobust(getContext(), R.string.attachment_oversized, FileUtil.getFileSize(file) + "")); } }</code><technical_language>Do overByAmount a useful/actionable piece of information for users? opposed big upload much</technical_language>

Target:
public void checkFileSize(File file){ if (FileUtil.isFileTooBigToUpload(file)) { long overByAmount = (file.length() - FormUploadUtil.MAX_BYTES) / 1024; notifyWarning(StringUtils.getStringRobust(getContext(), R.string.attachment_to_big_to_upload, overByAmount + "")); } else if (FileUtil.isFileOversized(file)) { notifyWarning(StringUtils.getStringRobust(getContext(), R.string.attachment_oversized, FileUtil.getFileSize(file) + "")); } }
Source:
<code>private void addPoint(Series series, ISegment segment, Map<Integer, Predicate<Map<String, String>>> predicates, @Nullable IProgressMonitor monitor) { if (!predicates.isEmpty()) { Map<@NonNull String, @NonNull String> input = getFilterInput(segment); int mask = 0; for (Map.Entry<Integer, Predicate<Map<String, String>>> mapEntry : predicates.entrySet()) { Predicate<Map<String, String>> value = Objects.requireNonNull(mapEntry.getValue()); boolean status = value.test(input); Integer property = Objects.requireNonNull(mapEntry.getKey()); if(status && property != <START> IFilterProperty.DIMMED) { <END> mask |= property; } else if (!status && property == IFilterProperty.DIMMED) { mask |= IFilterProperty.DIMMED; } else if (!status && property == IFilterProperty.EXCLUDE) { mask |= IFilterProperty.EXCLUDE; } } series.addPoint(segment.getStart(), segment.getLength(), mask); }else { series.addPoint(segment.getStart(), segment.getLength(), 0); } }</code><technical_language>This I is in data providers, This exact property is specific TraceCompass client work other clients. a missing whitespace. if this affect other potential clients, a special case for this client, clean, but..</technical_language>

Target:
private void addPoint(Series series, ISegment segment, Map<Integer, Predicate<Map<String, String>>> predicates, @Nullable IProgressMonitor monitor) { if (!predicates.isEmpty()) { Map<@NonNull String, @NonNull String> input = getFilterInput(segment); int mask = 0; for (Map.Entry<Integer, Predicate<Map<String, String>>> mapEntry : predicates.entrySet()) { Predicate<Map<String, String>> value = Objects.requireNonNull(mapEntry.getValue()); boolean status = value.test(input); Integer property = Objects.requireNonNull(mapEntry.getKey()); if(status && property != IFilterProperty.DIMMED) { mask |= property; } else if (!status && property == IFilterProperty.DIMMED) { mask |= IFilterProperty.DIMMED; } else if (!status && property == IFilterProperty.EXCLUDE) { mask |= IFilterProperty.EXCLUDE; } else if (status){ mask |= property; } } series.addPoint(segment.getStart(), segment.getLength(), mask); } else { series.addPoint(segment.getStart(), segment.getLength(), 0); } }
Source:
<code>public void testList() throws StripeException { Map<String, Object> listParams = new HashMap<String, Object>(); listParams.put("limit", 1); BalanceTransactionCollection resources = BalanceTransaction.list(listParams); assertNotNull(resources); verifyRequest( APIResource.RequestMethod.GET, <START> String.format("/v1/balance/history") <END> ); }</code><technical_language>verify params sent? (won't repeat for retrieve, worth fixing all)</technical_language>

Target:
public void testList() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("limit", 1); final BalanceTransactionCollection balanceTransactions = BalanceTransaction.list(params); assertNotNull(balanceTransactions); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/balance/history"), params ); }
Source:
<code>private void checkInsertedValue(String jsonPart1, String jsonPart2) throws DatabaseEngineException { Expression query = select(all()).from(table(TEST_TABLE)); List<Map<String, ResultColumn>> results = dbEngine.query(query); assertEquals("One value inserted", 1, results.size()); Map<String, ResultColumn> firstRow = results.get(0); assertNotNull("Inserted row is not null", firstRow); assertThat("JSon value is as expected", firstRow.get(JSON_COL).toString(), anyOf( <START> is("{" + jsonPart1 + ", " + jsonPart2 + "}"), <END> is("{" + jsonPart2 + ", " + jsonPart1 + "}") )); }</code><technical_language>This fail engine trims spaces returning JSON. I trim them</technical_language>

Target:
private void checkInsertedValue(String jsonPart1, String jsonPart2) throws DatabaseEngineException { Expression query = select(all()).from(table(TEST_TABLE)); List<Map<String, ResultColumn>> results = dbEngine.query(query); assertEquals("One value inserted", 1, results.size()); Map<String, ResultColumn> firstRow = results.get(0); assertNotNull("Inserted row is not null", firstRow); assertThat("JSon value is as expected", firstRow.get(JSON_COL).toString().replaceAll("\\s+", ""), anyOf( is(("{" + jsonPart1 + "," + jsonPart2 + "}").replaceAll("\\s+", "")), is(("{" + jsonPart2 + "," + jsonPart1 + "}").replaceAll("\\s+","")) )); }
Source:
<code>public final void toggleExactMatchMilestone(String milestoneName) { Optional<PickerMilestone> onlyMatchingMilestone = getExactMatchMilestone(currentMilestonesList, milestoneName); <START> toggleMilestone(onlyMatchingMilestone); <END> }</code><technical_language>call this optional, check if present call/not call here</technical_language>

Target:
public final void toggleExactMatchMilestone(String milestoneName) { Optional<PickerMilestone> onlyMatchingMilestone = getExactMatchMilestone(currentMilestonesList, milestoneName); onlyMatchingMilestone.ifPresent(milestone -> toggleMilestone(milestone)); }
Source:
<code>protected MappingElasticsearchConverter createElasticsearchConverter() { <START> MappingElasticsearchConverter mappingElasticsearchConverter = new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext()); <END> mappingElasticsearchConverter.afterPropertiesSet(); return mappingElasticsearchConverter; }</code><technical_language>want hold a reference of mapping context ( MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) in instance</technical_language>

Target:
protected ElasticsearchConverter createElasticsearchConverter() { MappingElasticsearchConverter mappingElasticsearchConverter = new MappingElasticsearchConverter( new SimpleElasticsearchMappingContext()); mappingElasticsearchConverter.afterPropertiesSet(); return mappingElasticsearchConverter; }
Source:
<code>public void seek(long toOffset) throws IOException { <START> boolean resetAndSkip = toOffset < offset; <END> if (toOffset < offset) { reset(); } if (toOffset != 0 && toOffset != offset) { maybeInitialize(); data.skip(toOffset - offset); } offset = toOffset; }</code><technical_language>unused</technical_language>

Target:
public void seek(long toOffset) throws IOException { if (toOffset < offset) { reset(); } maybeInitialize(); ByteStreams.skipFully(data, toOffset - offset); offset = toOffset; }
Source:
<code>private void checkDirtyAndLoad(final ActionEvent actionEvent) throws HeadlessException { final String selectedTemplate = templateList.getText(); final Template template = TemplateManager.getInstance().getTemplateByName(selectedTemplate); if (template == null) { return; } templateList.setValues(TemplateManager.getInstance().reset().getTemplateNames()); final boolean isTestPlan = template.isTestPlan(); if (isTestPlan && !checkDirty(actionEvent)) { return; } ActionRouter.getInstance().doActionNow(new ActionEvent(actionEvent.getSource(), actionEvent.getID(), ActionNames.STOP_THREAD)); final File parent = template.getParent(); File fileToCopy = parent != null ? new File(parent, template.getFileName()) : new File(JMeterUtils.getJMeterHome(), template.getFileName()); <START> File temporaryGeneratedFile = null; <END> try { if (template.getParameters() != null && !template.getParameters().isEmpty()) { File jmxFile = new File(fileToCopy.getAbsolutePath()); Map<String, String> userParameters = getUserParameters(); Configuration templateCfg = TemplateUtil.getTemplateConfig(); try { temporaryGeneratedFile = File.createTempFile(template.getName(), ".output"); fileToCopy = temporaryGeneratedFile; TemplateUtil.processTemplate(jmxFile, temporaryGeneratedFile, templateCfg, userParameters); } catch (IOException | TemplateException ex) { log.error("Error generating output file from template {}", temporaryGeneratedFile, jmxFile, ex); return; } } Load.loadProjectFile(actionEvent, fileToCopy, !isTestPlan, false); this.dispose(); } finally { if(temporaryGeneratedFile != null && !temporaryGeneratedFile.delete()) { log.warn("Could not delete generated output file from template {}", temporaryGeneratedFile, fileToCopy); } } }</code><technical_language>this try block extracted a method? enable show intent of code block method name</technical_language>

Target:
private void checkDirtyAndLoad(final ActionEvent actionEvent) throws HeadlessException { final String selectedTemplate = templateList.getText(); final Template template = TemplateManager.getInstance().getTemplateByName(selectedTemplate); if (template == null) { return; } templateList.setValues(TemplateManager.getInstance().reset().getTemplateNames()); final boolean isTestPlan = template.isTestPlan(); if (isTestPlan && !checkDirty(actionEvent)) { return; } ActionRouter.getInstance().doActionNow(new ActionEvent(actionEvent.getSource(), actionEvent.getID(), ActionNames.STOP_THREAD)); final File parent = template.getParent(); File fileToCopy = parent != null ? new File(parent, template.getFileName()) : new File(JMeterUtils.getJMeterHome(), template.getFileName()); replaceTemplateParametersAndLoad(actionEvent, template, isTestPlan, fileToCopy); }
Source:
<code><START> public List<Descriptor<ComputerLauncher>> computerLauncherDescriptors(@CheckForNull Slave it) { <END> DescriptorExtensionList<ComputerLauncher, Descriptor<ComputerLauncher>> all = Jenkins.getInstance().<ComputerLauncher, Descriptor<ComputerLauncher>>getDescriptorList( ComputerLauncher.class); return it == null ? DescriptorVisibilityFilter.applyType(clazz, all) : DescriptorVisibilityFilter.apply(it, all); }</code><technical_language>@Restricted intended for Jelly views only, IIUC</technical_language>

Target:
public final List<Descriptor<ComputerLauncher>> computerLauncherDescriptors(@CheckForNull Slave it) { DescriptorExtensionList<ComputerLauncher, Descriptor<ComputerLauncher>> all = Jenkins.getInstance().<ComputerLauncher, Descriptor<ComputerLauncher>>getDescriptorList( ComputerLauncher.class); return it == null ? DescriptorVisibilityFilter.applyType(clazz, all) : DescriptorVisibilityFilter.apply(it, all); }
Source:
<code>public void init() { super.init(); <START> eventConsumerImpl = new EventConsumerImpl(); <END> ZAP.getEventBus() .registerConsumer( eventConsumerImpl, HistoryReferenceEventPublisher.getPublisher().getPublisherName()); }</code><technical_language>panel is shown view delay this well, hook</technical_language>

Target:
public void init() { super.init(); }
Source:
<code>public Node transform(Node node) { final SYIncludeNode includeNode = (SYIncludeNode) node; String resourcePath = ResourcePathUtils.toAbsoluteLocation(node.getStartPosition().getPath(), includeNode.getIncludePath()); InputStream inputStream = null; try { if (resourceLoader instanceof ResourceLoaderExtended) { inputStream = ((ResourceLoaderExtended) resourceLoader).fetchResource(resourcePath, this); } else { inputStream = resourceLoader.fetchResource(resourcePath); } if (inputStream == null) { return new IncludeErrorNode("Include cannot be resolved: " + resourcePath); } Node result; String includeContent = StreamUtils.toString(inputStream); if (resourcePath.endsWith(".raml") || resourcePath.endsWith(".yaml") || resourcePath.endsWith(".yml")) { try { RamlHeader ramlHeader = RamlHeader.parse(includeContent); final RamlFragment fragment = ramlHeader.getFragment(); result = NodeParser.parse(resourceLoader, resourcePath, includeContent); if (result != null && isTypedFragment(result, fragment)) { final RamlTypedFragmentNode newNode = new RamlTypedFragmentNode(fragment); result.replaceWith(newNode); result = newNode; } } catch (RamlHeader.InvalidHeaderException e) { result = NodeParser.parse(resourceLoader, resourcePath, includeContent); } } else { result = new StringNodeImpl(includeContent); <START> updatePositionWithResourceUri(result); <END> } if (result == null) { result = new NullNodeImpl(); } return result; } finally { IOUtils.closeQuietly(inputStream); } }</code><technical_language>position null this point a name createTempPositionWithResourceUri line</technical_language>

Target:
public Node transform(Node node) { final SYIncludeNode includeNode = (SYIncludeNode) node; String resourcePath = ResourcePathUtils.toAbsoluteLocation(node.getStartPosition().getPath(), includeNode.getIncludePath()); InputStream inputStream = null; try { if (resourceLoader instanceof ResourceLoaderExtended) { inputStream = ((ResourceLoaderExtended) resourceLoader).fetchResource(resourcePath, this); } else { inputStream = resourceLoader.fetchResource(resourcePath); } if (inputStream == null) { return new IncludeErrorNode("Include cannot be resolved: " + resourcePath); } Node result; String includeContent = StreamUtils.toString(inputStream); if (resourcePath.endsWith(".raml") || resourcePath.endsWith(".yaml") || resourcePath.endsWith(".yml")) { try { RamlHeader ramlHeader = RamlHeader.parse(includeContent); final RamlFragment fragment = ramlHeader.getFragment(); result = NodeParser.parse(resourceLoader, resourcePath, includeContent); if (result != null && isTypedFragment(result, fragment)) { final RamlTypedFragmentNode newNode = new RamlTypedFragmentNode(fragment); result.replaceWith(newNode); result = newNode; } } catch (RamlHeader.InvalidHeaderException e) { result = NodeParser.parse(resourceLoader, resourcePath, includeContent); } } else { result = new StringNodeImpl(includeContent); setTempPositionWithResourceUri(result); } if (result == null) { result = new NullNodeImpl(); } return result; } finally { IOUtils.closeQuietly(inputStream); } }
Source:
<code><START> void compact(CompactionDetails details) throws InterruptedException, IOException, StoreException { <END> if (srcIndex == null) { throw new IllegalStateException("Compactor has not been started"); } checkSanity(details); compactionLog = new CompactionLog(dataDir.getAbsolutePath(), storeId, time, details); resumeCompaction(); }</code><technical_language>related this patch. I feel CompactionDetails in a NavigableSet of Strings (log segment names) instead of a List(Strings)</technical_language>

Target:
void compact(CompactionDetails details) throws IOException, StoreException { if (srcIndex == null) { throw new IllegalStateException("Compactor has not been initialized"); } else if (compactionLog != null) { throw new IllegalStateException("There is already a compaction in progress"); } checkSanity(details); compactionLog = new CompactionLog(dataDir.getAbsolutePath(), storeId, time, details); resumeCompaction(); }
Source:
<code><START> public AuthorizationFramework getAuthorizationFramework() { <END> if (authFramework == null) { authFramework = new AuthorizationFramework(threadConfig.get().getPluginDirectory()); } return authFramework; }</code><technical_language>I if this method synchronized</technical_language>

Target:
synchronized public AuthorizationFramework getAuthorizationFramework() { if (authFramework == null) { authFramework = new AuthorizationFramework(threadConfig.get().getPluginDirectory()); } return authFramework; }
Source:
<code>public Worldpay3dsFlexCredentialsEntity build() { Worldpay3dsFlexCredentialsEntity worldpay3DsFlexCredentialsEntity = new Worldpay3dsFlexCredentialsEntity(); worldpay3DsFlexCredentialsEntity.jwtMacKey = this.jwtMacKey; worldpay3DsFlexCredentialsEntity.gatewayAccountId = this.gatewayAccountId; worldpay3DsFlexCredentialsEntity.organisationalUnitId = this.organisationalUnitId; <START> worldpay3DsFlexCredentialsEntity.issuer = this.issuer; <END> return worldpay3DsFlexCredentialsEntity; }</code><technical_language>3ds (and lines above)</technical_language>

Target:
public Worldpay3dsFlexCredentialsEntity build() { Worldpay3dsFlexCredentialsEntity worldpay3dsFlexCredentialsEntity = new Worldpay3dsFlexCredentialsEntity(); worldpay3dsFlexCredentialsEntity.jwtMacKey = this.jwtMacKey; worldpay3dsFlexCredentialsEntity.gatewayAccountId = this.gatewayAccountId; worldpay3dsFlexCredentialsEntity.organisationalUnitId = this.organisationalUnitId; worldpay3dsFlexCredentialsEntity.issuer = this.issuer; return worldpay3dsFlexCredentialsEntity; }
Source:
<code>protected void copyIfChanged(InputStream input, Path output) throws IOException { byte[] fileContent = IOUtil.toByteArray(input); <START> ByteArrayInputStream bufferedInput = new ByteArrayInputStream(fileContent); <END> if (Files.exists(output)) { try (InputStream outputContent = Files.newInputStream(output)) { if (IOUtil.contentEquals(bufferedInput, outputContent)) { return; } } bufferedInput.reset(); } Files.copy(bufferedInput, output, StandardCopyOption.REPLACE_EXISTING); }</code><technical_language>This bufferedInput closed, backed a byte[] a file, OK? for consistency in try (ByteArrayInputStream bufferedInput = new ByteArrayInputStream(fileContent)) anyway</technical_language>

Target:
protected void copyIfChanged(InputStream input, Path output) throws IOException { InputStream source = input; if (Files.exists(output)) { byte[] fileContent = IOUtil.toByteArray(input); ByteArrayInputStream bufferedInput = new ByteArrayInputStream(fileContent); try (InputStream outputContent = Files.newInputStream(output)) { if (IOUtil.contentEquals(bufferedInput, outputContent)) { return; } } bufferedInput.reset(); source = bufferedInput; } Files.copy(source, output, StandardCopyOption.REPLACE_EXISTING); }
Source:
<code>public String toString() { return "RemoveExpiredCommand{" + "key=" + key + " value=" + value + <START> " lifespan=" + lifespan + <END> '}'; }</code><technical_language>add a comma</technical_language>

Target:
public String toString() { return "RemoveExpiredCommand{" + "key=" + key + ", value=" + value + ", lifespan=" + lifespan + '}'; }
Source:
<code>public void startup() { this.sourceRunning = true; this.retryStartup.set(true); do { if(retryStartup.get()) { retryStartup.set(false); startupOngoing.set(true); initThread = new Thread(this::initialize); Threads.setDaemonThreadRunning(initThread, Thread.currentThread().getName() + ".replicationSource," + this.queueId, (t,e) -> { uncaughtException(t, e); <START> retryStartup.set(true); <END> }); } } while (startupOngoing.get()); }</code><technical_language>I hope if encounter uncaughtException here, want retry loop again. If so, add startupOngoing.set(true); explicitely? in case if is set false in initialize()</technical_language>

Target:
public void startup() { MutableBoolean retryStartup = new MutableBoolean(true); this.sourceRunning = true; do { if(retryStartup.booleanValue()) { retryStartup.setValue(false); startupOngoing.set(true); initThread = new Thread(this::initialize); Threads.setDaemonThreadRunning(initThread, Thread.currentThread().getName() + ".replicationSource," + this.queueId, (t,e) -> { sourceRunning = false; uncaughtException(t, e, null, null); retryStartup.setValue(!this.abortOnError); }); } } while (this.startupOngoing.get() && !this.abortOnError); }
Source:
<code><START> public FakeTicker advance(long time, TimeUnit timeUnit) { <END> nanos.addAndGet(timeUnit.toNanos(time)); return this; }</code><technical_language>This lets chain tickers, I this functionality</technical_language>

Target:
public void advance(long time, TimeUnit timeUnit) { nanos.addAndGet(timeUnit.toNanos(time)); }
Source:
<code>public Response checkElasticSearch() { try { <START> delegate.toolsIndexSearch(null, null, null); <END> } catch (Exception ex) { return Response.status(ERROR_STATUS_CODE).build(); } return Response.ok().build(); }</code><technical_language>This return error if index is reachable empty too</technical_language>

Target:
public Response checkElasticSearch() { Response elasticSearchResponse; try { elasticSearchResponse = delegate.toolsIndexSearch(null, null, null); String result = IOUtils.toString((InputStream)(elasticSearchResponse.getEntity()), StandardCharsets.UTF_8); JSONObject jsonObj = new JSONObject(result); JSONObject hitsHolder = jsonObj.getJSONObject("hits"); JSONArray hitsArray = hitsHolder.getJSONArray("hits"); if (hitsArray.toList().isEmpty()) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); } } catch (Exception ex) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); } return Response.ok().build(); }
Source:
<code>public static Optional<InsightCard> getInsights(final SleepStatsDAODynamoDB sleepStatsDAODynamoDB, final AccountReadDAO accountReadDAO, final Long accountId) { final DateTime queryEndDate = DateTime.now().withTimeAtStartOfDay(); final DateTime queryStartDate = queryEndDate.minusDays(NUM_DAYS); final String queryEndDateString = DateTimeUtil.dateToYmdString(queryEndDate); final String queryStartDateString = DateTimeUtil.dateToYmdString(queryStartDate); final List<AggregateSleepStats> sleepStats = sleepStatsDAODynamoDB.getBatchStats(accountId, queryStartDateString, queryEndDateString); LOGGER.debug("Account id length of sleep stats is and sleepStats is ", accountId, sleepStats.size(), sleepStats); final List<Integer> wakeTimeList = Lists.newArrayList(); for (final AggregateSleepStats stat : sleepStats) { final Integer dayOfWeek = stat.dateTime.getDayOfWeek(); <START> if (dayOfWeek == 6) { <END> continue; } else if (dayOfWeek == 7) { continue; } final Long wakeTimeStamp = stat.sleepStats.wakeTime; final DateTime wakeTimeDateTime = new DateTime(wakeTimeStamp, DateTimeZone.forOffsetMillis(stat.offsetMillis)); final int wakeTime = wakeTimeDateTime.getMinuteOfDay(); wakeTimeList.add(wakeTime); } final DateTime dob = accountReadDAO.getById(accountId).get().DOB; final Integer userAge = Years.yearsBetween(dob, DateTime.now()).toPeriod().getYears(); final Optional<InsightCard> card = processSleepAlarm(accountId, wakeTimeList, userAge); return card; }</code><technical_language>is intentional dayOfWeek == 6,7 here, dayOfWeek ==5,6 for caffeine alarm</technical_language>

Target:
public static Optional<InsightCard> getInsights(final SleepStatsDAODynamoDB sleepStatsDAODynamoDB, final AccountReadDAO accountReadDAO, final Long accountId) { final DateTime queryEndDate = DateTime.now().withTimeAtStartOfDay(); final DateTime queryStartDate = queryEndDate.minusDays(NUM_DAYS); final String queryEndDateString = DateTimeUtil.dateToYmdString(queryEndDate); final String queryStartDateString = DateTimeUtil.dateToYmdString(queryStartDate); final List<AggregateSleepStats> sleepStats = sleepStatsDAODynamoDB.getBatchStats(accountId, queryStartDateString, queryEndDateString); LOGGER.debug("insight=sleep_alarm-account_id={}-sleep_stat_len={}", accountId, sleepStats.size()); final List<Integer> wakeTimeList = Lists.newArrayList(); for (final AggregateSleepStats stat : sleepStats) { final Integer dayOfWeek = stat.dateTime.getDayOfWeek(); if (dayOfWeek == 6) { continue; } else if (dayOfWeek == 7) { continue; } final Long wakeTimeStamp = stat.sleepStats.wakeTime; final DateTime wakeTimeDateTime = new DateTime(wakeTimeStamp, DateTimeZone.forOffsetMillis(stat.offsetMillis)); final int wakeTime = wakeTimeDateTime.getMinuteOfDay(); wakeTimeList.add(wakeTime); } final DateTime dob = accountReadDAO.getById(accountId).get().DOB; final Integer userAge = Years.yearsBetween(dob, DateTime.now()).toPeriod().getYears(); final Optional<InsightCard> card = processSleepAlarm(accountId, wakeTimeList, userAge); return card; }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { String alreadyFilteredAttributeName = getAlreadyFilteredAttributeName(); boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttributeName) != null; if (hasAlreadyFilteredAttribute) { filterChain.doFilter(request, response); } else { <START> final StatusExposingServletResponse statusExposingServletResponse = new StatusExposingServletResponse( <END> (HttpServletResponse) response); requestInterceptor.handle(newServerRequestAdapter(newHttpServerRequest((HttpServletRequest) request), spanNameProvider)); try { filterChain.doFilter(request, statusExposingServletResponse); }finally { HttpResponse httpResponse = statusExposingServletResponse::getStatus; responseInterceptor.handle(newServerResponseAdapter(httpResponse)); } } }</code><technical_language>is hard changed formatting is mixed code change. please revert formatting change ping essentials shown? review done</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { String alreadyFilteredAttributeName = getAlreadyFilteredAttributeName(); boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttributeName) != null; if (hasAlreadyFilteredAttribute) { filterChain.doFilter(request, response); } else { final StatusExposingServletResponse statusExposingServletResponse = new StatusExposingServletResponse( (HttpServletResponse) response); requestInterceptor.handle(interceptRequestAdapter(newRequestAdapter(newRequest((HttpServletRequest) request), spanNameProvider))); try { filterChain.doFilter(request, statusExposingServletResponse); }finally { HttpResponse httpResponse = newResposne(statusExposingServletResponse); responseInterceptor.handle(interceptResponseAdapter(newResponseAdapter(httpResponse))); } } }
Source:
<code>public void testPerformQueryAnonymous() throws Exception { repository.setCredentials(AuthenticationType.REPOSITORY, null, false); IRepositoryQuery query = new RepositoryQuery(repository.getConnectorKind(), "query"); query.setAttribute(GerritQuery.TYPE, GerritQuery.ALL_OPEN_CHANGES); query.setAttribute(GerritQuery.QUERY_STRING, GerritQuery.ALL_OPEN_CHANGES); InMemoryTaskDataCollector resultCollector = new InMemoryTaskDataCollector(); IStatus status = connector.performQuery(repository, query, resultCollector, null, new NullProgressMonitor()); assertEquals(Status.OK_STATUS, status); assertTrue(resultCollector.getResults().size() > 0); for (TaskData result : resultCollector.getResults()) { assertTrue(result.isPartial()); assertNull(result.getRoot().getAttribute(GerritTaskSchema.getDefault().UPLOADED.getKey())); TaskAttribute key = result.getRoot().getAttribute(GerritTaskSchema.getDefault().KEY.getKey()); assertNotNull(key); String value = key.getValue(); assertNotNull(value); assertTrue(value.startsWith("I")); String objId = StringUtils.rightPad(value.substring(1), Constants.OBJECT_ID_STRING_LENGTH, 'a'); assertTrue(ObjectId.isId(objId)); TaskAttribute owner = result.getRoot().getAttribute(GerritTaskSchema.getDefault().OWNER.getKey()); assertNotNull(owner); <START> assertNotNull(owner.getValue()); <END> } }</code><technical_language>this assert empty</technical_language>

Target:
public void testPerformQueryAnonymous() throws Exception { repository.setCredentials(AuthenticationType.REPOSITORY, null, false); IRepositoryQuery query = new RepositoryQuery(repository.getConnectorKind(), "query"); query.setAttribute(GerritQuery.TYPE, GerritQuery.ALL_OPEN_CHANGES); query.setAttribute(GerritQuery.QUERY_STRING, GerritQuery.ALL_OPEN_CHANGES); InMemoryTaskDataCollector resultCollector = new InMemoryTaskDataCollector(); IStatus status = connector.performQuery(repository, query, resultCollector, null, new NullProgressMonitor()); assertEquals(Status.OK_STATUS, status); assertTrue(resultCollector.getResults().size() > 0); for (TaskData result : resultCollector.getResults()) { assertTrue(result.isPartial()); assertNull(result.getRoot().getAttribute(GerritTaskSchema.getDefault().UPLOADED.getKey())); TaskAttribute key = result.getRoot().getAttribute(GerritTaskSchema.getDefault().KEY.getKey()); assertNotNull(key); String value = key.getValue(); assertNotNull(value); assertTrue(value.startsWith("I")); String objId = StringUtils.rightPad(value.substring(1), Constants.OBJECT_ID_STRING_LENGTH, 'a'); assertTrue(ObjectId.isId(objId)); TaskAttribute owner = result.getRoot().getAttribute(GerritTaskSchema.getDefault().OWNER.getKey()); assertNotNull(owner); assertTrue(StringUtils.isNotBlank(owner.getValue())); } }
Source:
<code>protected Object doTransform(Message<?> message) { Assert.state(message.getPayload() instanceof byte[], "Payload must be a byte[]"); DatumReader<?> reader = new SpecificDatumReader<>(this.type); try { <START> return reader.read(null, this.decoderFactory.binaryDecoder((byte[]) message.getPayload(), null)); <END> } catch (IOException e) { throw new UncheckedIOException(e); } }</code><technical_language>some ClassLoader configuration in this Avro API? Fully unclear a class is loaded for instantiation... Also, need consider some whitelisting. bump typical deserialization vulnerability</technical_language>

Target:
protected Object doTransform(Message<?> message) { Assert.state(message.getPayload() instanceof byte[], "Payload must be a byte[]"); Class<? extends SpecificRecord> type = null; Object value = this.typeIdExpression.getValue(this.evaluationContext, message); if (value instanceof Class) { type = (Class<? extends SpecificRecord>) value; } else if (value instanceof String) { try { type = (Class<? extends SpecificRecord>) ClassUtils.forName((String) value, this.beanClassLoader); } catch (ClassNotFoundException | LinkageError e) { throw new IllegalStateException(e); } } if (type == null) { type = this.defaultType; } DatumReader<?> reader = new SpecificDatumReader<>(type); try { return reader.read(null, this.decoderFactory.binaryDecoder((byte[]) message.getPayload(), null)); } catch (IOException e) { throw new UncheckedIOException(e); } }