auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if (properties == null) { <START> logger.warn("no configuration found"); <END> } else { String read = (String) properties.get(KEY_READ_CALENDARS); if (read != null) { for (String value : read.split(",")) { this.readCalendars.add(value.trim()); } } } }</code><technical_language>afaik updated() is called in class implements ManagedService service.pid account. this warn statements offen in logs removed though</technical_language>

Target:
public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if (properties != null) { logger.debug("reading configuration data..."); String read = (String) properties.get(KEY_READ_CALENDARS); if (read != null) { for (String value : read.split(",")) { this.readCalendars.add(value.trim()); } } this.reloadCurrentLoadedEvents(); } }
Source:
<code>static <T> java.util.List<T> asJava(LinearSeq<T> seq) { <START> return new SeqAsJavaList<>(seq); <END> }</code><technical_language>Lets pass ListIterator constructor method reference do subclass it: java return new SeqAsJavaList<T>(seq, (delegate, index) -> new LinearSeqListIterator<>((LinearSeq<T>) delegate, index));</technical_language>

Target:
static <T> java.util.List<T> asJava(LinearSeq<T> seq) { return new SeqAsJavaList<>(seq, LinearSeqListIterator::new); }
Source:
<code>public List<ColumnMetadata> getColumnsMetadata() { <START> return new ArrayList<>(columnsMetadata); <END> }</code><technical_language>this is unused</technical_language>

Target:
public List<ColumnMetadata> getColumnsMetadata() { return ImmutableList.copyOf(columnsMetadata); }
Source:
<code>private static void mergeParentPatronAcls(PID parentPid, Resource destResc, Property everyoneRole, Property authRole) { Model parentUnitModel = unitPatronAccessCache.get(parentPid); if (parentUnitModel != null) { Resource parentUnitResc = parentUnitModel.getResource(parentPid.getRepositoryPath()); if (!destResc.hasProperty(CdrAcl.embargoUntil) && parentUnitResc.hasProperty(CdrAcl.embargoUntil)) { <START> String embargoDate = formatEmbargoDate(parentUnitResc.getProperty( <END> CdrAcl.embargoUntil).getLiteral().getString()); Literal embargoLiteral = parentUnitModel.createTypedLiteral(embargoDate, XSDDatatype.XSDdateTime); destResc.addLiteral(CdrAcl.embargoUntil, embargoLiteral); } if (everyoneRole == null) { StmtIterator it = parentUnitModel.listStatements(parentUnitResc, null, PUBLIC_PRINC); if (it.hasNext()) { Statement roleStmt = it.next(); destResc.addLiteral(roleStmt.getPredicate(), PUBLIC_PRINC); it.close(); } } if (authRole == null) { StmtIterator it = parentUnitModel.listStatements(parentUnitResc, null, AUTHENTICATED_PRINC); if (it.hasNext()) { Statement roleStmt = it.next(); destResc.addLiteral(roleStmt.getPredicate(), AUTHENTICATED_PRINC); it.close(); } } } }</code><technical_language>this is carrying embargo a parent object throught formatting method, I skip of steps do destResc.addLiteral(CdrAcl.embargoUntil, parentUnitResc.getProperty(CdrAcl.embargoUntil).getObject()). If work, skip formatEmbargoDate call</technical_language>

Target:
private static void mergeParentPatronAcls(PID parentPid, Resource destResc, Property everyoneRole, Property authRole) { Model parentUnitModel = unitPatronAccessCache.get(parentPid); if (parentUnitModel != null) { Resource parentUnitResc = parentUnitModel.getResource(parentPid.getRepositoryPath()); if (!destResc.hasProperty(CdrAcl.embargoUntil) && parentUnitResc.hasProperty(CdrAcl.embargoUntil)) { String embargoDate = parentUnitResc.getProperty( CdrAcl.embargoUntil).getLiteral().getString(); Literal embargoLiteral = parentUnitModel.createTypedLiteral(embargoDate, XSDDatatype.XSDdateTime); destResc.addLiteral(CdrAcl.embargoUntil, embargoLiteral); } if (everyoneRole == null) { StmtIterator it = parentUnitModel.listStatements(parentUnitResc, null, PUBLIC_PRINC); if (it.hasNext()) { Statement roleStmt = it.next(); destResc.addLiteral(roleStmt.getPredicate(), PUBLIC_PRINC); it.close(); } } if (authRole == null) { StmtIterator it = parentUnitModel.listStatements(parentUnitResc, null, AUTHENTICATED_PRINC); if (it.hasNext()) { Statement roleStmt = it.next(); destResc.addLiteral(roleStmt.getPredicate(), AUTHENTICATED_PRINC); it.close(); } } } }
Source:
<code>public List<Object[]> executeStatement(String hql) { return executeStatementWithCommandShellEmulation(hql); <START> } <END></code><technical_language>command shell specific transformation happen in transformScript call. returned sql imports/!run commands etc. exploded ready executed regular hive parser. This easy add more of beeline commands leaking of emulator</technical_language>

Target:
public List<Object[]> executeStatement(String hql) { List<HiveQueryLanguageStatement> hsqlStatements = statementFactory.newInstanceForStatement(hql); return executeStatementsWithCommandShellEmulation(hsqlStatements); }
Source:
<code>public void deleteNamespacedJob(final String queue, final String job, boolean forceDelete) { WorkflowConfig jobQueueConfig = TaskUtil.getWorkflowConfig(_accessor, queue); if (forceDelete) { LOG.info("Forcefully removing job: from queue: {}", job, queue); if (!TaskUtil.removeJob(_accessor, _propertyStore, job)) { LOG.info("Failed to delete job: from queue: {}", job, queue); throw new HelixException("Failed to delete job: " + job + " from queue: " + queue); } return; } if (jobQueueConfig == null) { throw new IllegalArgumentException( String.format("JobQueue %s's config is not found!", queue)); } <START> if (!jobQueueConfig.isJobQueue()) { <END> throw new IllegalArgumentException(String.format("%s is not a queue!", queue)); } boolean isRecurringWorkflow = (jobQueueConfig.getScheduleConfig() != null && jobQueueConfig.getScheduleConfig().isRecurring()); String denamespacedJob = TaskUtil.getDenamespacedJobName(queue, job); if (isRecurringWorkflow) { WorkflowContext wCtx = TaskUtil.getWorkflowContext(_propertyStore, queue); String lastScheduledQueue = null; if (wCtx != null) { lastScheduledQueue = wCtx.getLastScheduledSingleWorkflow(); } if (lastScheduledQueue != null) { WorkflowConfig lastWorkflowCfg = TaskUtil.getWorkflowConfig(_accessor, lastScheduledQueue); if (lastWorkflowCfg != null) { deleteJobFromQueue(lastScheduledQueue, denamespacedJob); } } } deleteJobFromQueue(queue, denamespacedJob); }</code><technical_language>I is do this check beginning of function</technical_language>

Target:
public void deleteNamespacedJob(final String queue, final String job, boolean forceDelete) { WorkflowConfig jobQueueConfig = TaskUtil.getWorkflowConfig(_accessor, queue); boolean isRecurringWorkflow; if (forceDelete) { LOG.info("Forcefully removing job: from queue: {}", job, queue); if (!TaskUtil.removeJob(_accessor, _propertyStore, job)) { LOG.info("Failed to delete job: from queue: {}", job, queue); throw new HelixException("Failed to delete job: " + job + " from queue: " + queue); } if (jobQueueConfig != null) { isRecurringWorkflow = jobQueueConfig.getScheduleConfig() != null && jobQueueConfig.getScheduleConfig().isRecurring(); if (isRecurringWorkflow) { deleteJobFromLastScheduledQueue(queue, TaskUtil.getDenamespacedJobName(queue, job)); } } return; } if (jobQueueConfig == null) { throw new IllegalArgumentException( String.format("JobQueue %s's config is not found!", queue)); } if (!jobQueueConfig.isJobQueue()) { throw new IllegalArgumentException(String.format("%s is not a queue!", queue)); } isRecurringWorkflow = jobQueueConfig.getScheduleConfig() != null && jobQueueConfig.getScheduleConfig().isRecurring(); String denamespacedJob = TaskUtil.getDenamespacedJobName(queue, job); if (isRecurringWorkflow) { deleteJobFromLastScheduledQueue(queue, denamespacedJob); } deleteJobFromQueue(queue, denamespacedJob); }
Source:
<code><START> public double getAttributeAsDouble(final String key, final double defaultValue) { <END> final Object x = getAttribute(key); if ( x == null ) return defaultValue; if ( x instanceof Double ) return (Double)x; if ( x instanceof Integer ) return (Integer)x; if ( !( x instanceof String ) ) throw new IllegalArgumentException( "Cannot get attribute(key=\"" + key + ") as a double because it's not a Double, a Integer or a String. Class = " + x.getClass()); try { return Double.parseDouble((String)x); } catch (final NumberFormatException err) { throw new IllegalArgumentException( "Cannot convert attribute(key=\"" + key + ") = "+ x + " as a double.", err); } }</code><technical_language>I confused in VariantContext.java getAttributeAs* methods in Genotype.java similar methods deprecated implemented differently. this is for a PR, some consensus a new PR emerge</technical_language>

Target:
public double getAttributeAsDouble(final String key, final double defaultValue) { Object x = getAttribute(key); if ( x == null ) return defaultValue; if ( x instanceof Double ) return (Double)x; if ( x instanceof Integer ) return (Integer)x; return Double.valueOf((String)x); }
Source:
<code><START> private void registerValidationListener() { <END> issueStore = getEditorInjector().getInstance(IValidationIssueStore.class); issueStore.connect(getDiagram().eResource()); validationListener = getEditorInjector().getInstance(LiveValidationListener.class); validationListener.setResource(getDiagram().eResource()); validationListener.setValidationIssueProcessor(issueStore); getEditingDomain().addResourceSetListener(validationListener); validationListener.scheduleValidation(); }</code><technical_language>helpful protected, clients override</technical_language>

Target:
protected void registerValidationListener() { issueStore = getEditorInjector().getInstance(IValidationIssueStore.class); issueStore.connect(getDiagram().eResource()); validationListener = getEditorInjector().getInstance(LiveValidationListener.class); validationListener.setResource(getDiagram().eResource()); validationListener.setValidationIssueProcessor(issueStore); getEditingDomain().addResourceSetListener(validationListener); validationListener.scheduleValidation(); }
Source:
<code>public BlockSortedField updateSortedField(long blockId, LRUSortedField oldValue) { long clockValue = 0; <START> if (oldValue != null) { <END> clockValue = mLRUClock.incrementAndGet(); } if (LOG.isDebugEnabled()) { LOG.debug("LRU update for Block: {}. Clock: {}", blockId, clockValue); } return new LRUSortedField(clockValue); }</code><technical_language>oldValue, sense set clock 0 (most recent)</technical_language>

Target:
public BlockSortedField updateSortedField(long blockId, LRUSortedField oldValue) { long clockValue = mLRUClock.incrementAndGet(); if (LOG.isDebugEnabled()) { LOG.debug("LRU update for Block: {}. Clock: {}", blockId, clockValue); } return new LRUSortedField(clockValue); }
Source:
<code>public byte[] getCacheKey() <START> { <END> return new CacheKeyBuilder( cacheTypeId ).appendString(name).appendString(fieldName).appendInt(k).build(); }</code><technical_language>Please add @Nullable params nullable</technical_language>

Target:
public byte[] getCacheKey() { return new CacheKeyBuilder( cacheTypeId ).appendString(fieldName).appendInt(k).appendBoolean(compress).build(); }
Source:
<code>public void delete(RuleKey ruleKey) { try (DbSession dbSession = dbClient.openSession(false)) { RuleDefinitionDto rule = dbClient.ruleDao().selectOrFailDefinitionByKey(dbSession, ruleKey); if (!rule.isCustomRule()) { <START> throw new IllegalArgumentException("Only custom rules can be deleted"); <END> } if (rule.isCustomRule()) { ruleActivator.deactivateOfAllOrganizations(dbSession, rule); } rule.setStatus(RuleStatus.REMOVED); rule.setUpdatedAt(system2.now()); dbClient.ruleDao().update(dbSession, rule); dbSession.commit(); ruleIndexer.indexRuleDefinition(ruleKey); } }</code><technical_language>replace checkArgument</technical_language>

Target:
public void delete(RuleKey ruleKey) { try (DbSession dbSession = dbClient.openSession(false)) { RuleDefinitionDto rule = dbClient.ruleDao().selectOrFailDefinitionByKey(dbSession, ruleKey); checkArgument(rule.isCustomRule(), "Rule '%s' cannot be deleted because it is not a custom rule", rule.getKey().toString()); if (rule.isCustomRule()) { ruleActivator.deactivateOfAllOrganizations(dbSession, rule); } rule.setStatus(RuleStatus.REMOVED); rule.setUpdatedAt(system2.now()); dbClient.ruleDao().update(dbSession, rule); dbSession.commit(); ruleIndexer.indexRuleDefinition(ruleKey); } }
Source:
<code>protected void createLayout(Context context) { adapter = new SelectOneListAdapter(items, selectedValue, this, numColumns, this.getFormEntryPrompt(), this.getReferenceManager(), this.getAnswerFontSize(), this.getAudioHelper(), getPlayColor(getFormEntryPrompt(), themeUtils), this.getContext(), autoAdvance); if (items != null) { RecyclerView recyclerView = setUpRecyclerView(); recyclerView.setAdapter(adapter); answerLayout.addView(recyclerView); adjustRecyclerViewSize(adapter, recyclerView); Resources resources = context.getResources(); int marginStandard = dpFromPx(context, resources.getDimensionPixelSize(R.dimen.margin_standard)); int margin = marginStandard - FIELD_HORIZONTAL_MARGIN_MODIFIER; <START> addAnswerView(answerLayout, margin); <END> } }</code><technical_language>want of select widgets need select options spread edge edge. This change reverted</technical_language>

Target:
protected void createLayout(Context context) { adapter = new SelectOneListAdapter(items, selectedValue, this, numColumns, this.getFormEntryPrompt(), this.getReferenceManager(), this.getAnswerFontSize(), this.getAudioHelper(), getPlayColor(getFormEntryPrompt(), themeUtils), this.getContext(), autoAdvance); if (items != null) { RecyclerView recyclerView = setUpRecyclerView(); recyclerView.setAdapter(adapter); answerLayout.addView(recyclerView); adjustRecyclerViewSize(adapter, recyclerView); addAnswerView(answerLayout); } }
Source:
<code>protected Type _deserialize(String value, DeserializationContext context) { <START> Type type = types.get(value.toLowerCase(ENGLISH)); if (type == null) { throw new IllegalArgumentException(String.valueOf("Unknown type " + value)); } <END> return type; }</code><technical_language>requireNonNull if want throw NPE checkArgument if IAE is required</technical_language>

Target:
protected Type _deserialize(String value, DeserializationContext context) { Type type = types.get(value.toLowerCase(ENGLISH)); return requireNonNull(type, "Unknown type " + value); }
Source:
<code><START> public void shouldShowCorrectTitle_whenFormIsLoaded() { <END> when(formSaveViewModel.getFormName()).thenReturn("blah"); dialogFragment.show(fragmentManager, "TAG"); AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog(); String title = formSaveViewModel.getFormName() == null ? activity.getString(R.string.no_form_loaded) : formSaveViewModel.getFormName(); TextView dialogTitle = dialog.findViewById(R.id.alertTitle); assertThat(dialogTitle.getText().toString(), equalTo(title)); }</code><technical_language>Yeah I tests divided this a lot</technical_language>

Target:
public void shouldShowCorrectTitle_whenFormIsLoaded() { when(formSaveViewModel.getFormName()).thenReturn("blah"); dialogFragment.show(fragmentManager, "TAG"); AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog(); TextView dialogTitle = dialog.findViewById(R.id.alertTitle); assertThat(dialogTitle.getText().toString(), equalTo("blah")); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } StoragePool other = (StoragePool) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.objectsEqual(LVER, other.LVER) && ObjectUtils.objectsEqual(description, other.description) && ObjectUtils.objectsEqual(comment, other.comment) && ObjectUtils.objectsEqual(getcompatibility_version(), other.getcompatibility_version()) && masterDomainVersion == other.masterDomainVersion && ObjectUtils.objectsEqual(name, other.name) && recovery_mode == other.recovery_mode && ObjectUtils.objectsEqual(spmVdsId, other.spmVdsId) <START> && status == other.status <END> && ObjectUtils.objectsEqual(storagePoolFormatType, other.storagePoolFormatType) && quotaEnforcementType == other.quotaEnforcementType); }</code><technical_language>consider isLocal property too</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } StoragePool other = (StoragePool) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.objectsEqual(LVER, other.LVER) && ObjectUtils.objectsEqual(description, other.description) && ObjectUtils.objectsEqual(comment, other.comment) && ObjectUtils.objectsEqual(getcompatibility_version(), other.getcompatibility_version()) && masterDomainVersion == other.masterDomainVersion && ObjectUtils.objectsEqual(name, other.name) && recovery_mode == other.recovery_mode && ObjectUtils.objectsEqual(spmVdsId, other.spmVdsId) && status == other.status && isLocal == other.isLocal && ObjectUtils.objectsEqual(storagePoolFormatType, other.storagePoolFormatType) && quotaEnforcementType == other.quotaEnforcementType); }
Source:
<code>public void testBlockUseHostCpuWithPPCArch() { <START> final int osId = 2; <END> mockConfig(); AddVmCommand<AddVmParameters> cmd = setupCanAddPpcTest(); cmd.setEffectiveCompatibilityVersion(Version.v4_0); doReturn(Collections.<DiskImageBase> emptyList()).when(cmd).getImagesToCheckDestinationStorageDomains(); Cluster cluster = createPpcCluster(); when(clusterDao.get(any(Guid.class))).thenReturn(cluster); doReturn(clusterDao).when(dbFacade).getClusterDao(); doReturn(true).when(cmd).areParametersLegal(Collections.<String> emptyList()); doReturn(true).when(cmd).validateAddVmCommand(); doReturn(true).when(cmd).isVmNameValidLength(any(VM.class)); when(osRepository.getArchitectureFromOS(any(Integer.class))).thenReturn(ArchitectureType.ppc64); cmd.getParameters().getVm().setClusterArch(ArchitectureType.ppc64); cmd.getParameters().getVm().setUseHostCpuFlags(true); cmd.getParameters().getVm().setMigrationSupport(MigrationSupport.PINNED_TO_HOST); cmd.getParameters().getVm().setClusterId(cluster.getId()); cmd.getParameters().getVm().setVmOs(osId); ValidateTestUtils.runAndAssertValidateFailure (cmd, EngineMessage.USE_HOST_CPU_REQUESTED_ON_UNSUPPORTED_ARCH); }</code><technical_language>Is this equivalent org.ovirt.engine.core.common.businessentities.OsType#Other</technical_language>

Target:
public void testBlockUseHostCpuWithPPCArch() { mockConfig(); AddVmCommand<AddVmParameters> cmd = setupCanAddPpcTest(); cmd.setEffectiveCompatibilityVersion(Version.v4_0); doReturn(Collections.<DiskImageBase> emptyList()).when(cmd).getImagesToCheckDestinationStorageDomains(); Cluster cluster = createPpcCluster(); when(clusterDao.get(any(Guid.class))).thenReturn(cluster); doReturn(clusterDao).when(dbFacade).getClusterDao(); doReturn(true).when(cmd).areParametersLegal(Collections.<String> emptyList()); doReturn(true).when(cmd).validateAddVmCommand(); doReturn(true).when(cmd).isVmNameValidLength(any(VM.class)); when(osRepository.getArchitectureFromOS(any(Integer.class))).thenReturn(ArchitectureType.ppc64); cmd.getParameters().getVm().setClusterArch(ArchitectureType.ppc64); cmd.getParameters().getVm().setUseHostCpuFlags(true); cmd.getParameters().getVm().setMigrationSupport(MigrationSupport.PINNED_TO_HOST); cmd.getParameters().getVm().setClusterId(cluster.getId()); cmd.getParameters().getVm().setVmOs(OsType.Other.ordinal()); ValidateTestUtils.runAndAssertValidateFailure (cmd, EngineMessage.USE_HOST_CPU_REQUESTED_ON_UNSUPPORTED_ARCH); }
Source:
<code>private static String getLookAndFeelClassName() { String userClass = SYSTEM_PREFERENCES.get(USER_LOOK_AND_FEEL_CLASSNAME, null); <START> if (userClass == null) { <END> return SYSTEM_PREFERENCES.getBoolean(LOOK_AND_FEEL_PREFERENCE, false) ? MetalLookAndFeel.class.getName() : null; } else { return userClass; } }</code><technical_language>@kelemen, this L&F-choosing logic present in [AnathemaPreferences](<LINK_0> Is a it, extracting logic a separate class? (I noticed duplication before. Hindsight... :))</technical_language>

Target:
private static String getLookAndFeelClassName() { return AnathemaPreferences.getDefaultPreferences().getUserLookAndFeel(); }
Source:
<code>public Map<Integer, String> getHostGroupsFromZK() throws KeeperException, InterruptedException, JSONException { Map<Integer, String> hostGroups = Maps.newHashMap(); <START> List<String> children = m_zk.getChildren(CoreZK.hosts, false); <END> for (String child : children) { byte[] payload = m_zk.getData( ZKUtil.joinZKPath(CoreZK.hosts, child), false, new Stat()); final HostInfo info = HostInfo.fromBytes(payload); hostGroups.put(parseHostId(child), info.m_group); } return hostGroups; }</code><technical_language>Need fix indentation</technical_language>

Target:
public Map<Integer, String> getHostGroupsFromZK() throws KeeperException, InterruptedException, JSONException { Map<Integer, String> hostGroups = Maps.newHashMap(); List<String> children = m_zk.getChildren(CoreZK.hosts, false); Queue<ZKUtil.ByteArrayCallback> callbacks = new ArrayDeque<ZKUtil.ByteArrayCallback>(); for (int i = 0; i < children.size() - 1; i++) { ZKUtil.ByteArrayCallback cb = new ZKUtil.ByteArrayCallback(); m_zk.getData(ZKUtil.joinZKPath(CoreZK.hosts, children.get(i)), false, cb, null); callbacks.offer(cb); } ZKUtil.ByteArrayCallback lastCallback = new ZKUtil.ByteArrayCallback(); String lastChild = children.get(children.size() - 1); m_zk.getData(ZKUtil.joinZKPath(CoreZK.hosts, lastChild), false, lastCallback, null); byte[] lastPayload = lastCallback.getData(); final HostInfo lastOne = HostInfo.fromBytes(lastPayload); hostGroups.put(parseHostId(lastChild), lastOne.m_group); for (int i = 0; i < children.size() - 1; i++) { byte[] payload = callbacks.poll().getData(); final HostInfo info = HostInfo.fromBytes(payload); hostGroups.put(parseHostId(children.get(i)), info.m_group); } return hostGroups; }
Source:
<code><START> public AbstractDeclarable(@Nullable Map<String, Object> arguments) { <END> if (arguments != null) { this.arguments = arguments; } else { this.arguments = new HashMap<String, Object>(); } }</code><technical_language>Gary, this a breaking change in point release? a default ctor before, require explicit argument..</technical_language>

Target:
public AbstractDeclarable(@Nullable Map<String, Object> arguments) { if (arguments != null) { this.arguments = new HashMap<>(arguments); } else { this.arguments = new HashMap<String, Object>(); } }
Source:
<code>public static void appendChecksum(ChannelBuffer buffer, int length) { <START> buffer.writeByte(0x2a); END> int checksum = Checksum.xor(buffer.toByteBuffer(0, length)) & 0xFF; String checksumString = String.format("%02X", checksum); buffer.writeBytes(checksumString.getBytes(StandardCharsets.US_ASCII)); buffer.writeByte(0x0D); buffer.writeByte(0x0A); }</code><technical_language>replace codes actual symbols. '*' for asterisk. for end line symbols</technical_language>

Target:
public static void appendChecksum(ChannelBuffer buffer, int length) { buffer.writeByte('*'); int checksum = Checksum.xor(buffer.toByteBuffer(0, length)) & 0xFF; String checksumString = String.format("%02X", checksum); buffer.writeBytes(checksumString.getBytes(StandardCharsets.US_ASCII)); buffer.writeByte('\r'); buffer.writeByte('\n'); }
Source:
<code>public void setup() { super.setup(); String key = "test." + provider + ".zone"; if (System.getProperties().containsKey(key)) { zones.add(System.getProperty(key)); } <START> else { <END> zones = api.getConfiguredZones(); } for (String zone : zones) { ServerApi serverApi = api.getServerApiForZone(zone); for (Resource server : serverApi.list().concat()) { if (server.getName().equals(hostName)) serverApi.delete(server.getId()); } } }</code><technical_language>[minor] formatting: } else { line</technical_language>

Target:
public void setup() { super.setup(); String testZone = System.getProperty("test." + provider + ".zone"); if (testZone != null) { zones = ImmutableSet.of(testZone); } else { zones = api.getConfiguredZones(); } for (String zone : zones) { ServerApi serverApi = api.getServerApiForZone(zone); for (Resource server : serverApi.list().concat()) { if (server.getName().equals(hostName)) serverApi.delete(server.getId()); } } }
Source:
<code>public String changeDateToLastMonth() { datePickerInput.click(); waitForElementVisibleByElement(calendarElement); previousMonthArrow.click(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MONTH, -1); Date date = calendar.getTime(); SimpleDateFormat sdfMonth = new SimpleDateFormat("MMMM", Locale.ENGLISH); String previousMonth = sdfMonth.format(date); waitForTextToBePresentInElementByElement(monthInCalendar, previousMonth); JavascriptExecutor js = (JavascriptExecutor) driver; WebElement firstDay = (WebElement) js.executeScript( "return $(arguments[0]).find('.ui-state-default:not(.ui-priority-secondary):nth(0)')[0]", calendarElement ); firstDay.click(); <START> SimpleDateFormat sdfYear = new SimpleDateFormat("YYYY"); <END> String year = sdfYear.format(date); String expectedDate = previousMonth + " 1, " + year; return expectedDate; }</code><technical_language>move date formating seperate function. Example: java public String formatedDate(Date date, String format) { SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); }</technical_language>

Target:
public String changeDateToLastMonth() { datePickerInput.click(); waitForElementVisibleByElement(calendarElement); previousMonthArrow.click(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MONTH, -1); Date date = calendar.getTime(); String previousMonth = getFormatedDate(date, "MMMM"); waitForTextToBePresentInElementByElement(monthInCalendar, previousMonth); JavascriptExecutor js = (JavascriptExecutor) driver; WebElement firstDay = (WebElement) js.executeScript( "return $(arguments[0]).find('.ui-state-default:not(.ui-priority-secondary):nth(0)')[0]", calendarElement ); firstDay.click(); String year = getFormatedDate(date, "YYYY"); String expectedDate = previousMonth + " 1, " + year; return expectedDate; }
Source:
<code>public String read(final String file) throws IOException { final List<String> contents = this.storage.xml().xpath( String.format( "%s/files/file[filename='%s']/raw_content/text()", this.xpath(), file ) ); <START> String content = ""; <END> if (contents.size() == 1) { content = contents.get(0); } return content; }</code><technical_language>I correct. If I provide a wrong name of file - I get empty string back. a non-intuitive behavior. throw IllegalArgumentException instead</technical_language>

Target:
public String read(final String file) throws IOException { final List<XML> files = this.storage.xml().nodes( String.format( "%s/files/file[filename='%s']", this.xpath(), file ) ); if (files.isEmpty()) { throw new IOException( String.format("Couldn't find file with the name %s.", file) ); } final List<String> contents = files.get(0) .xpath("raw_content/text()"); String content = ""; if (!contents.isEmpty()) { content = contents.get(0); } return content; }
Source:
<code>public void configureCredentialFactory(final ChainingRestHttpRequestCredentialFactory factory) { final X509CertificateExtractor extractor = x509CertificateExtractor.getIfAvailable(); <START> final boolean headerAuth = casProperties.getRest().isHeaderAuth(); <END> final boolean bodyAuth = casProperties.getRest().isBodyAuth(); LOGGER.debug("is certificate extractor available? = {}, headerAuth = {}, bodyAuth = {}", extractor, headerAuth, bodyAuth); if (extractor != null && headerAuth) { factory.registerCredentialFactory(x509RestRequestHeader()); } if (bodyAuth) { factory.registerCredentialFactory(x509RestMultipartBody()); } }</code><technical_language>Nitpicking tough I suspect spotbugs consider this issue: casProperties.getRest() extracted out a single var perhaps</technical_language>

Target:
public void configureCredentialFactory(final ChainingRestHttpRequestCredentialFactory factory) { final RestProperties restProperties = casProperties.getRest(); final X509CertificateExtractor extractor = x509CertificateExtractor.getIfAvailable(); final boolean headerAuth = restProperties.isHeaderAuth(); final boolean bodyAuth = restProperties.isBodyAuth(); LOGGER.debug("is certificate extractor available? = {}, headerAuth = {}, bodyAuth = {}", extractor, headerAuth, bodyAuth); if (extractor != null && headerAuth) { factory.registerCredentialFactory(x509RestRequestHeader()); } if (bodyAuth) { factory.registerCredentialFactory(x509RestMultipartBody()); } }
Source:
<code>public void close() throws ConnectException { List<Exception> exceptions = new ArrayList<>(); for (String encodedPartition : tempFiles.keySet()) try { if (writers.containsKey(encodedPartition)) { closeTempFile(encodedPartition); appendToWAL(encodedPartition); commitFile(encodedPartition); } } catch (IOException e) { log.error("Error rotating when closing TopicPartitionWriter.", tempFiles.get(encodedPartition)); <START> ByteArrayOutputStream baos = new ByteArrayOutputStream(); <END> PrintStream ps = new PrintStream(baos); e.printStackTrace(ps); ps.close(); log.error(baos.toString()); log.error(e.getMessage()); log.error(e.toString()); exceptions.add(e); } writers.clear(); try { wal.close(); } catch (ConnectException e) { log.error("Error closing {}.", wal.getLogFile()); log.debug(e.getMessage()); exceptions.add(e); } startOffsets.clear(); offsets.clear(); if (exceptions.size() != 0) { StringBuilder sb = new StringBuilder(); for (Exception exception: exceptions) { sb.append(exception.getMessage()); sb.append("\n"); } throw new ConnectException("Error closing writer: " + sb.toString()); } }</code><technical_language>Is this necessary? this form? log.error("Error rotating closing TopicPartitionWriter.", + tempFiles.get(encodedPartition), e); i.e. add exception end of original log message, dump message + stacktrace log</technical_language>

Target:
public void close() throws ConnectException { List<Exception> exceptions = new ArrayList<>(); for (String encodedPartition : tempFiles.keySet()) { try { if (writers.containsKey(encodedPartition)) { closeTempFile(encodedPartition); appendToWAL(encodedPartition); commitFile(encodedPartition); } } catch (IOException e) { log.error("Error rotating when closing TopicPartitionWriter.", tempFiles.get(encodedPartition), e); exceptions.add(e); } } writers.clear(); try { wal.close(); } catch (ConnectException e) { log.error("Error closing {}.", wal.getLogFile(), e); exceptions.add(e); } startOffsets.clear(); offsets.clear(); if (exceptions.size() != 0) { StringBuilder sb = new StringBuilder(); for (Exception exception: exceptions) { sb.append(exception.getMessage()); sb.append("\n"); } throw new ConnectException("Error closing writer: " + sb.toString()); } }
Source:
<code>public CeType extractNhinCodedElement(Attribute attrib, String codeId) { LOG.debug("Entering AttributeHelper.extractNhinCodedElement..."); CeType ce = new CeType(); ce.setCode(""); ce.setCodeSystem(""); ce.setCodeSystemName(""); ce.setDisplayName(""); List<XMLObject> attrVals = attrib.getAttributeValues(); if (!attrVals.isEmpty()) { if (LOG.isTraceEnabled()) { LOG.trace("AttributeValue is: " + attrVals.get(0).getClass()); } NodeList nodelist = null; if (attrVals.get(0) instanceof XSAnyImpl) { XSAnyImpl elem = (XSAnyImpl) attrVals.get(0); nodelist = elem.getDOM().getChildNodes(); } else { LOG.error("The value for the " + codeId + " attribute is a: " + attrVals.get(0).getClass() <START> + " expected an XSAnyImpl"); <END> } if (nodelist != null && nodelist.getLength() > 0) { int numNodes = nodelist.getLength(); for (int idx = 0; idx < numNodes; idx++) { compareAttrMap(nodelist, ce, codeId, idx); } } else { LOG.error("The AttributeValue for " + codeId + " should have a Child Node"); } } else { LOG.error("Attributes for " + codeId + " are invalid: " + attrVals); } LOG.debug("Exiting AttributeHelper.extractNhinCodedElement..."); return ce; }</code><technical_language>parameterized-logging</technical_language>

Target:
public CeType extractNhinCodedElement(Attribute attrib, String codeId) { LOG.debug("Entering AttributeHelper.extractNhinCodedElement..."); CeType ce = new CeType(); ce.setCode(""); ce.setCodeSystem(""); ce.setCodeSystemName(""); ce.setDisplayName(""); List<XMLObject> attrVals = attrib.getAttributeValues(); if (!attrVals.isEmpty()) { LOG.trace("AttributeValue is: " + attrVals.get(0).getClass()); NodeList nodelist = null; if (attrVals.get(0) instanceof XSAnyImpl) { XSAnyImpl elem = (XSAnyImpl) attrVals.get(0); nodelist = elem.getDOM().getChildNodes(); } else { LOG.error("The value for the attribute is a: expected an XSAnyImpl", codeId, attrVals.get(0).getClass()); } if (nodelist != null && nodelist.getLength() > 0) { int numNodes = nodelist.getLength(); for (int idx = 0; idx < numNodes; idx++) { compareAttrMap(nodelist, ce, codeId, idx); } } else { LOG.error("The AttributeValue for should have a Child Node", codeId); } } else { LOG.error("Attributes for are invalid: ", codeId, attrVals); } LOG.debug("Exiting AttributeHelper.extractNhinCodedElement..."); return ce; }
Source:
<code>private List<SearchHit> sendElasticQuery(ElasticsearchQueryBuilder queryBuilder) { List<SearchHit> result = new ArrayList<>(); <START> SearchResponse response = queryBuilder.buildScrollSearchRequest().execute().actionGet(); <END> if (response.getHits().getTotalHits() > maxHits) { throw new PrestoException(ELASTIC_SEARCH_EXCEEDS_MAX_HIT_ERROR, "Query get: " + response.getHits().getTotalHits() + " hits, exceeds Elasticsearch max hits configuration: " + maxHits); } while (true) { for (SearchHit hit : response.getHits().getHits()) { result.add(hit); } response = queryBuilder.prepareSearchScroll(response.getScrollId()).execute().actionGet(); if (response.getHits().getHits().length == 0) { break; } } return result; }</code><technical_language>a Future.get a timeout here</technical_language>

Target:
private List<SearchHit> sendElasticQuery(ElasticsearchQueryBuilder queryBuilder) { ImmutableList.Builder<SearchHit> result = ImmutableList.builder(); SearchResponse response = queryBuilder.buildScrollSearchRequest().execute().actionGet(timeout.toMillis()); if (response.getHits().getTotalHits() > maxHits) { throw new PrestoException(ELASTIC_SEARCH_MAX_HITS_EXCEEDED, "The number of hits for the query: " + response.getHits().getTotalHits() + " exceeds the configured max hits: " + maxHits); } while (true) { for (SearchHit hit : response.getHits().getHits()) { result.add(hit); } response = queryBuilder.prepareSearchScroll(response.getScrollId()) .execute() .actionGet(timeout.toMillis()); if (response.getHits().getHits().length == 0) { break; } } return result.build(); }
Source:
<code>protected void doChmod(RemoteFileTemplate<FTPFile> remoteFileTemplate, final String path, final int chmod) { remoteFileTemplate.executeWithClient((ClientCallbackWithoutResult<FTPClient>) client -> { <START> String chModCommand = "chmod " + chmod + " " + path; <END> try { client.sendSiteCommand(chModCommand); } catch (IOException e) { throw new UncheckedIOException("Failed to execute '" + chModCommand + "'", e); } }); }</code><technical_language>do this radical architectural change? I is a point perform chmod command *octal*</technical_language>

Target:
protected void doChmod(RemoteFileTemplate<FTPFile> remoteFileTemplate, final String path, final int chmod) { remoteFileTemplate.executeWithClient((ClientCallbackWithoutResult<FTPClient>) client -> { String chModCommand = "chmod " + Integer.toOctalString(chmod) + " " + path; try { client.sendSiteCommand(chModCommand); } catch (IOException e) { throw new UncheckedIOException("Failed to execute '" + chModCommand + "'", e); } }); }
Source:
<code>protected ApacheDockerHttpClientImpl( URI dockerHost, SSLConfig sslConfig, ConnectionPoolConfig connectionPoolConf ) { Registry<ConnectionSocketFactory> socketFactoryRegistry = createConnectionSocketFactoryRegistry(sslConfig, dockerHost); switch (dockerHost.getScheme()) { case "unix": case "npipe": host = new HttpHost(dockerHost.getScheme(), "localhost", 2375); break; case "tcp": host = new HttpHost( socketFactoryRegistry.lookup("https") != null ? "https" : "http", dockerHost.getHost(), dockerHost.getPort() ); break; default: host = HttpHost.create(dockerHost); } <START> PoolingHttpClientConnectionManager connectionPoolMgr = new PoolingHttpClientConnectionManager( <END> socketFactoryRegistry, new ManagedHttpClientConnectionFactory( null, null, null, null, message -> { Header transferEncodingHeader = message.getFirstHeader(HttpHeaders.TRANSFER_ENCODING); if (transferEncodingHeader != null) { if ("identity".equalsIgnoreCase(transferEncodingHeader.getValue())) { return ContentLengthStrategy.UNDEFINED; } } return DefaultContentLengthStrategy.INSTANCE.determineLength(message); }, null ) ); if (connectionPoolConf != null) { if (connectionPoolConf.getMaxTotal() != null) { connectionPoolMgr.setMaxTotal(connectionPoolConf.getMaxTotal()); } if (connectionPoolConf.getDefaultMaxPerRoute() != null) { connectionPoolMgr.setDefaultMaxPerRoute(connectionPoolConf.getDefaultMaxPerRoute()); } } httpClient = HttpClients.custom() .setRequestExecutor(new HijackingHttpRequestExecutor(null)) .setConnectionManager(connectionPoolMgr) .build(); }</code><technical_language>please variable naming consistent rest of library</technical_language>

Target:
protected ApacheDockerHttpClientImpl( URI dockerHost, SSLConfig sslConfig, ConnectionPoolConfig connectionPoolConf ) { Registry<ConnectionSocketFactory> socketFactoryRegistry = createConnectionSocketFactoryRegistry(sslConfig, dockerHost); switch (dockerHost.getScheme()) { case "unix": case "npipe": host = new HttpHost(dockerHost.getScheme(), "localhost", 2375); break; case "tcp": host = new HttpHost( socketFactoryRegistry.lookup("https") != null ? "https" : "http", dockerHost.getHost(), dockerHost.getPort() ); break; default: host = HttpHost.create(dockerHost); } PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager( socketFactoryRegistry, new ManagedHttpClientConnectionFactory( null, null, null, null, message -> { Header transferEncodingHeader = message.getFirstHeader(HttpHeaders.TRANSFER_ENCODING); if (transferEncodingHeader != null) { if ("identity".equalsIgnoreCase(transferEncodingHeader.getValue())) { return ContentLengthStrategy.UNDEFINED; } } return DefaultContentLengthStrategy.INSTANCE.determineLength(message); }, null ) ); if (connectionPoolConf != null) { Integer maxConnections = connectionPoolConf.getMaxConnections(); if (maxConnections != null) { connectionManager.setMaxTotal(maxConnections); connectionManager.setDefaultMaxPerRoute(maxConnections); } } httpClient = HttpClients.custom() .setRequestExecutor(new HijackingHttpRequestExecutor(null)) .setConnectionManager(connectionManager) .build(); }
Source:
<code>private void closeSessionWithoutWakeup(long sessionId) { NIOServerCnxn cnxn = sessionMap.remove(sessionId); if (cnxn != null) { <START> cnxn.close(); <END> } }</code><technical_language>remove try-catch block cnxn.close()? exceptions thrown cnxn.close(), right</technical_language>

Target:
private void closeSessionWithoutWakeup(long sessionId) { NIOServerCnxn cnxn = (NIOServerCnxn) sessionMap.remove(sessionId); if (cnxn != null) { try { cnxn.close(); } catch (Exception e) { LOG.warn("exception during session close", e); } } }
Source:
<code>private Flux<String> listChunks() { Flux<String> chunks = client.listBlobs(new ListBlobsOptions().setPrefix(shardPath)) .map(BlobItem::getName); if (userCursor == null) { return chunks; } else { AtomicBoolean pass = new AtomicBoolean(); return chunks.filter(chunkPath -> { <START> if (pass.get()) { return true; } else { if (userCursor.getChunkPath().equals(chunkPath)) { pass.set(true); return true; } else { return false; } } }); <END> } }</code><technical_language>if I understand this incorrectly. structure of paths similar "$blobchangefeed/log/00/2019/02/22/1810/", "$blobchangefeed/log/01/2019/02/22/1810/" This is checking if hit a chunk a matching cursor a customer passed 2019/02. this logic simplified, a small overhead in perf, check chunkPath.startsWith(userCursor.getChunkPath()) logic needed checked</technical_language>

Target:
private Flux<String> listChunks() { Flux<String> chunks = client.listBlobs(new ListBlobsOptions().setPrefix(shardPath)) .map(BlobItem::getName); if (userCursor == null) { return chunks; } else { return Flux.defer(() -> { AtomicBoolean pass = new AtomicBoolean(); return chunks.filter(chunkPath -> { if (pass.get()) { return true; } else { if (userCursor.getChunkPath().equals(chunkPath)) { pass.set(true); return true; } else { return false; } } }); }); } }
Source:
<code>public List<?> predict(int tenantId, String userName, long modelId, List<String[]> data) throws MLModelHandlerException { if (!isValidModelId(tenantId, userName, modelId)) { String msg = String.format("Failed to build the model. Invalid model id: %s for tenant: %s and user: %s", modelId, tenantId, userName); throw new MLModelHandlerException(msg); } MLModel builtModel = retrieveModel(modelId); if (builtModel.getFeatures().size() != data.get(0).length) { String msg = String.format("Prediction failed from model [id] %s since the number of features of model" + " [%s] doesn't match the number of features in the input data [%s]", modelId, builtModel.getFeatures().size(), data.get(0).length); throw new MLModelHandlerException(msg); } for (Feature feature: builtModel.getFeatures()) { if (feature.getType().equals(FeatureType.NUMERICAL)) { int actualIndex = builtModel.getNewToOldIndicesList().indexOf(feature.getIndex()); for (String[] dataPoint: data) { if(!isNumeric(dataPoint[actualIndex])) { <START> String msg = String.format("Invalid value: %s for the feature: %s", <END> dataPoint[actualIndex], feature.getName()); throw new MLModelHandlerException(msg); } } } } Predictor predictor = new Predictor(modelId, builtModel, data); List<?> predictions = predictor.predict(); log.info(String.format("Prediction from model [id] %s was successful.", modelId)); return predictions; }</code><technical_language>add feature index in log</technical_language>

Target:
public List<?> predict(int tenantId, String userName, long modelId, List<String[]> data) throws MLModelHandlerException { if (!isValidModelId(tenantId, userName, modelId)) { String msg = String.format("Failed to build the model. Invalid model id: %s for tenant: %s and user: %s", modelId, tenantId, userName); throw new MLModelHandlerException(msg); } MLModel builtModel = retrieveModel(modelId); if (builtModel.getFeatures().size() != data.get(0).length) { String msg = String.format("Prediction failed from model [id] %s since the number of features of model" + " [%s] doesn't match the number of features in the input data [%s]", modelId, builtModel.getFeatures().size(), data.get(0).length); throw new MLModelHandlerException(msg); } for (Feature feature: builtModel.getFeatures()) { if (feature.getType().equals(FeatureType.NUMERICAL)) { int actualIndex = builtModel.getNewToOldIndicesList().indexOf(feature.getIndex()); for (String[] dataPoint: data) { if(!NumberUtils.isNumber(dataPoint[actualIndex])) { String msg = String.format("Invalid value: %s for the feature: %s at feature index: %s", dataPoint[actualIndex], feature.getName(), actualIndex); throw new MLModelHandlerException(msg); } } } } Predictor predictor = new Predictor(modelId, builtModel, data); List<?> predictions = predictor.predict(); log.info(String.format("Prediction from model [id] %s was successful.", modelId)); return predictions; }
Source:
<code>public void isSameAllergen_shouldReturnTrueForSameNonCodedAllergen() { <START> Concept concept = Context.getConceptService().getConceptByUuid(otherNonCodedConceptUuid); <END> Assert.assertTrue(new Allergen(null, concept, "OTHER VALUE").isSameAllergen(new Allergen(null, concept, "OTHER VALUE"))); }</code><technical_language>for otherNonCodedConceptUuid</technical_language>

Target:
public void isSameAllergen_shouldReturnTrueForSameNonCodedAllergen() { Concept concept = Context.getConceptService().getConceptByUuid(Allergen.getOtherNonCodedConceptUuid()); Assert.assertTrue(new Allergen(null, concept, "OTHER VALUE").isSameAllergen(new Allergen(null, concept, "OTHER VALUE"))); }
Source:
<code>public void testAutoDeclareFalse() throws Exception { RabbitTemplate template = context.getBean(RabbitTemplate.class); template.convertAndSend("testContainerWithAutoDeleteQueues", "anon2", "foo"); assertNotNull(queue.poll(10, TimeUnit.SECONDS)); SimpleMessageListenerContainer listenerContainer = context.getBean("container4", SimpleMessageListenerContainer.class); listenerContainer.stop(); RabbitAdmin admin = spy(TestUtils.getPropertyValue(listenerContainer, "rabbitAdmin", RabbitAdmin.class)); new DirectFieldAccessor(listenerContainer).setPropertyValue("rabbitAdmin", admin); listenerContainer = spy(listenerContainer); when(listenerContainer.createBlockingQueueConsumer()).thenReturn(mock(BlockingQueueConsumer.class)); listenerContainer.start(); verify(admin, never()).initialize(); <START> listenerContainer.stop(); <END> }</code><technical_language>Actually; another problem - mock BQC spinning a CPU nextMessage() a noop - <LINK_0> clear spinning a single CPU hang build, though</technical_language>

Target:
public void testAutoDeclareFalse() throws Exception { RabbitTemplate template = context.getBean(RabbitTemplate.class); template.convertAndSend("testContainerWithAutoDeleteQueues", "anon2", "foo"); assertNotNull(queue.poll(10, TimeUnit.SECONDS)); SimpleMessageListenerContainer listenerContainer = context.getBean("container4", SimpleMessageListenerContainer.class); listenerContainer.stop(); RabbitAdmin admin = spy(TestUtils.getPropertyValue(listenerContainer, "rabbitAdmin", RabbitAdmin.class)); new DirectFieldAccessor(listenerContainer).setPropertyValue("rabbitAdmin", admin); listenerContainer = spy(listenerContainer); BlockingQueueConsumer consumer = mock(BlockingQueueConsumer.class); doThrow(RuntimeException.class).when(consumer).start(); when(listenerContainer.createBlockingQueueConsumer()).thenReturn(consumer); listenerContainer.start(); listenerContainer.stop(); verify(admin, never()).initialize(); }
Source:
<code>private void handleMCBrand(PluginMessage pluginMessage, PluginMessageEvent event) throws Exception { if ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 ) { try { ByteBuf brand = Unpooled.wrappedBuffer( pluginMessage.getData() ); String serverBrand = DefinedPacket.readString( brand ); brand.release(); <START> brand = ByteBufAllocator.DEFAULT.heapBuffer(); <END> DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand ); pluginMessage.setData( brand.array().clone() ); brand.release(); } catch ( Exception ignored ) { return; } } else { String serverBrand = new String( pluginMessage.getData(), "UTF-8" ); pluginMessage.setData((bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand).getBytes("UTF-8")); } con.unsafe().sendPacket( pluginMessage ); throw CancelSendSignal.INSTANCE; }</code><technical_language>connection's allocator</technical_language>

Target:
private void handleMCBrand(PluginMessage pluginMessage, PluginMessageEvent event) throws Exception { if ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 ) { try { ByteBuf brand = Unpooled.wrappedBuffer( pluginMessage.getData() ); String serverBrand = DefinedPacket.readString( brand ); brand.release(); brand = ByteBufAllocator.DEFAULT.heapBuffer(); DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand ); pluginMessage.setData( brand.array().clone() ); brand.release(); } catch ( Exception ignored ) { return; } } else { String serverBrand = new String( pluginMessage.getData(), Charsets.UTF_8 ); pluginMessage.setData((bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand).getBytes(Charsets.UTF_8)); } con.unsafe().sendPacket( pluginMessage ); throw CancelSendSignal.INSTANCE; }