auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void editMaxRequests() throws Exception { int value = 42; ModelNodeResult originalValue = operations.readAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, MAX_REQUESTS, <START> ReadAttributeOption.INCLUDE_DEFAULTS); <END> originalValue.assertSuccess(); try { new ConfigChecker.Builder(client, REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, MAX_REQUESTS, String.valueOf(value)) .verifyFormSaved() .verifyAttribute(MAX_REQUESTS, value); } finally { operations.writeAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, MAX_REQUESTS, originalValue.value()) .assertSuccess(); } }</code><technical_language>NOT_INCLUDE_DEFAULTS</technical_language>

Target:
public void editMaxRequests() throws Exception { int value = 42; ModelNodeResult originalValue = operations.readAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, MAX_REQUESTS, ReadAttributeOption.NOT_INCLUDE_DEFAULTS); originalValue.assertSuccess(); try { new ConfigChecker.Builder(client, REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, MAX_REQUESTS, String.valueOf(value)) .verifyFormSaved() .verifyAttribute(MAX_REQUESTS, value); } finally { operations.writeAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, MAX_REQUESTS, originalValue.value()) .assertSuccess(); } }
Source:
<code>protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } <START> if (getVm() != null && !(isVmNotInPreviewSnapshot() && isVmNotLocked())) { <END> return false; } return true; }</code><technical_language>change order of checks? eliminate db queries (isVmNotInPreviewSnapshot()/isVmNotLocked()) - vm is fetched in getVM()</technical_language>

Target:
protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } if (getVm() != null && !(isVmNotLocked() && isVmNotInPreviewSnapshot())) { return false; } return true; }
Source:
<code><START> public final List<BrandingTheme> getBrandingThemes() { <END> if (themes == null) { if (brandingRootPath.exists() && brandingRootPath.isDirectory() && brandingRootPath.canRead()) { themes = new ArrayList<BrandingTheme>(); List<File> directories = Arrays.asList( brandingRootPath.listFiles(new DirectoryFilter())); for (File directory : directories) { BrandingTheme theme = new BrandingTheme( directory.getAbsolutePath(), brandingRootPath); if (theme.isAvailable()) { themes.add(theme); } } Collections.sort(themes, new BrandingComparator()); } } return themes; }</code><technical_language>is this method final? Is expected for users create subclasses of BrandingManager? If not, I bother "final" keyword all</technical_language>

Target:
public List<BrandingTheme> getBrandingThemes() { if (themes == null && brandingRootPath.exists() && brandingRootPath.isDirectory() && brandingRootPath.canRead()) { themes = new ArrayList<BrandingTheme>(); List<File> directories = Arrays.asList( brandingRootPath.listFiles(new FileFilter() { @Override public boolean accept(final File file) { return file.isDirectory(); } })); for (File directory : directories) { BrandingTheme theme = new BrandingTheme( directory.getAbsolutePath(), brandingRootPath); if (theme.isAvailable()) { themes.add(theme); } } Collections.sort(themes); Collections.reverse(themes); } return themes; }
Source:
<code>public static void main(String[] args) throws Exception { Connection connection = connection() .url("https://engine/ovirt-engine/api") .user("admin@internal") .password("redhat123") .trustStoreFile("truststore.jks") .build(); StorageDomainsService storageDomainsService = connection.systemService().storageDomainsService(); StorageDomain sd = storageDomainsService.list().search("name=mysd").send().storageDomains().get(0); StorageDomainService storageDomainService = storageDomainsService.storageDomainService(sd.id()); StorageDomainVmsService storageDomainVmsService = storageDomainService.vmsService(); List<Vm> unregisteredVms = storageDomainVmsService.list().unregistered(true).send().vm(); Vm vm = null; for (Vm x : unregisteredVms) { if ("myvm".equals(x.name())) { vm = x; break; } } StorageDomainVmService storageDomainVmService = storageDomainVmsService.vmService(vm.id()); storageDomainVmService.register() .vm( vm() .name("exported_myvm") ) .cluster( cluster() .name("mycluster") ) .vnicProfileMappings( vnicProfileMapping() .sourceNetworkName("mynetwork") .sourceNetworkProfileName("mynetwork") .targetVnicProfile( vnicProfile() .name("mynetwork") ) ) <START> .reassignBadMacs(Boolean.TRUE) <END> .send(); connection.close(); }</code><technical_language>able 'true'. work</technical_language>

Target:
public static void main(String[] args) throws Exception { Connection connection = connection() .url("https://engine/ovirt-engine/api") .user("admin@internal") .password("redhat123") .trustStoreFile("truststore.jks") .build(); StorageDomainsService storageDomainsService = connection.systemService().storageDomainsService(); StorageDomain sd = storageDomainsService.list().search("name=mysd").send().storageDomains().get(0); StorageDomainService storageDomainService = storageDomainsService.storageDomainService(sd.id()); StorageDomainVmsService storageDomainVmsService = storageDomainService.vmsService(); List<Vm> unregisteredVms = storageDomainVmsService.list().unregistered(true).send().vm(); Vm vm = null; for (Vm x : unregisteredVms) { if ("myvm".equals(x.name())) { vm = x; break; } } StorageDomainVmService storageDomainVmService = storageDomainVmsService.vmService(vm.id()); storageDomainVmService.register() .vm( vm() .name("exported_myvm") ) .cluster( cluster() .name("mycluster") ) .vnicProfileMappings( vnicProfileMapping() .sourceNetworkName("mynetwork") .sourceNetworkProfileName("mynetwork") .targetVnicProfile( vnicProfile() .name("mynetwork") ) ) .reassignBadMacs(true) .send(); connection.close(); }
Source:
<code>public void adjust(Mechanism mechanism) { CoreUtilities.autoPropertyMechanism(this, mechanism); if (!mechanism.fulfilled()) { <START> mechanism.reportInvalid(); <END> } }</code><technical_language>remove bit^</technical_language>

Target:
public void adjust(Mechanism mechanism) { CoreUtilities.autoPropertyMechanism(this, mechanism); }
Source:
<code>public void dump(PrintWriter pw) { try { pw.println("Root: " + root); pw.println("Original rel:"); if (originalRoot != null) { originalRoot.explain( new RelWriterImpl(pw, SqlExplainLevel.ALL_ATTRIBUTES, false)); } if (CalciteSystemProperty.DUMP_SETS.value()) { pw.println(); pw.println("Sets:"); dumpSets(pw); } if (CalciteSystemProperty.DUMP_GRAPHVIZ.value()) { pw.println(); pw.println("Graphviz:"); dumpGraphviz(pw); } } catch (Exception ex) { <START> throw new AssertionError("Dumps the internal state ", ex); <END> } }</code><technical_language>If change this way, CannotPlanException</technical_language>

Target:
public void dump(PrintWriter pw) { pw.println("Root: " + root); pw.println("Original rel:"); if (originalRoot != null) { originalRoot.explain( new RelWriterImpl(pw, SqlExplainLevel.ALL_ATTRIBUTES, false)); } try { if (CalciteSystemProperty.DUMP_SETS.value()) { pw.println(); pw.println("Sets:"); dumpSets(pw); } if (CalciteSystemProperty.DUMP_GRAPHVIZ.value()) { pw.println(); pw.println("Graphviz:"); dumpGraphviz(pw); } } catch (Exception | AssertionError e) { pw.println("Error when dumping plan state: \n" + e); } }
Source:
<code>private void commit(boolean pushUpstream) { if (!isCommitWithoutFilesAllowed()) { MessageDialog.openError(getSite().getShell(), UIText.StagingView_committingNotPossible, UIText.StagingView_noStagedFiles); return; } if (!commitMessageComponent.checkCommitInfo()) return; if (!UIUtils.saveAllEditors(currentRepository, UIText.StagingView_cancelCommitAfterSaving)) return; String commitMessage = commitMessageComponent.getCommitMessage(); CommitOperation commitOperation = null; try { commitOperation = new CommitOperation(currentRepository, commitMessageComponent.getAuthor(), commitMessageComponent.getCommitter(), commitMessage); } catch (CoreException e) { Activator.handleError(UIText.StagingView_commitFailed, e, true); return; } if (amendPreviousCommitAction.isChecked()) commitOperation.setAmending(true); commitOperation.setComputeChangeId(addChangeIdAction.isChecked()); final CommitJob commitJob = new CommitJob(currentRepository, commitOperation) .setOpenCommitEditor(openNewCommitsAction.isChecked()) .setPushUpstream(pushUpstream); enableAllWidgets(false); commitJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { asyncExec(new Runnable() { public void run() { enableAllWidgets(true); <START> if (commitJob.isCommitSucceeded()) { <END> commitMessageText.setText(EMPTY_STRING); } } }); } }); schedule(commitJob, true); CommitMessageHistory.saveCommitHistory(commitMessage); clearCommitMessageToggles(); }</code><technical_language>access IStatus returned job</technical_language>

Target:
private void commit(boolean pushUpstream) { if (!isCommitWithoutFilesAllowed()) { MessageDialog.openError(getSite().getShell(), UIText.StagingView_committingNotPossible, UIText.StagingView_noStagedFiles); return; } if (!commitMessageComponent.checkCommitInfo()) return; if (!UIUtils.saveAllEditors(currentRepository, UIText.StagingView_cancelCommitAfterSaving)) return; String commitMessage = commitMessageComponent.getCommitMessage(); CommitOperation commitOperation = null; try { commitOperation = new CommitOperation(currentRepository, commitMessageComponent.getAuthor(), commitMessageComponent.getCommitter(), commitMessage); } catch (CoreException e) { Activator.handleError(UIText.StagingView_commitFailed, e, true); return; } if (amendPreviousCommitAction.isChecked()) commitOperation.setAmending(true); commitOperation.setComputeChangeId(addChangeIdAction.isChecked()); final CommitJob commitJob = new CommitJob(currentRepository, commitOperation) .setOpenCommitEditor(openNewCommitsAction.isChecked()) .setPushUpstream(pushUpstream); enableAllWidgets(false); commitJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { asyncExec(new Runnable() { public void run() { enableAllWidgets(true); if (commitJob.getResult().isOK()) { commitMessageText.setText(EMPTY_STRING); } } }); } }); schedule(commitJob, true); CommitMessageHistory.saveCommitHistory(commitMessage); clearCommitMessageToggles(); }
Source:
<code>public void onAuthEmailSent(AccountStore.OnAuthEmailSent event) { if (!mInProgress) { return; } endProgress(); if (event.isError()) { AppLog.e(AppLog.T.API, "OnAuthEmailSent has error: " + event.error.type + " - " + event.error.message); if (isAdded()) { ToastUtils.showToast(getActivity(), R.string.magic_link_unavailable_error_message, ToastUtils.Duration.LONG); } <START> } else { <END> if (mLoginListener != null) { mLoginListener.showMagicLinkSentScreen(mEmail); } } }</code><technical_language>Nitpick: do if else :)</technical_language>

Target:
public void onAuthEmailSent(AccountStore.OnAuthEmailSent event) { if (!mInProgress) { return; } endProgress(); if (event.isError()) { AppLog.e(AppLog.T.API, "OnAuthEmailSent has error: " + event.error.type + " - " + event.error.message); if (isAdded()) { ToastUtils.showToast(getActivity(), R.string.magic_link_unavailable_error_message, ToastUtils .Duration.LONG); } return; } if (mLoginListener != null) { mLoginListener.showMagicLinkSentScreen(mEmail); } }
Source:
<code><START> protected CassandraServersConfigs() { <END> }</code><technical_language>private constructor please, this "class" instantiated, in package</technical_language>

Target:
private CassandraServersConfigs() { }
Source:
<code>private Attributes getAttributes(ConfigSection cfg, String revision) { return AttributesBuilder.attributes() .tableOfContents(cfg.getBoolean(KEY_INCLUDE_TOC, true)) <START> .sourceHighlighter("prettify") .attribute("newline", "\\n") .attribute("asterisk", "&#42;") .attribute("plus", "&#43;") .attribute("caret", "&#94;") .attribute("startsb", "&#91;") .attribute("endsb", "&#93;") .attribute("tilde", "&#126;") <END> .attribute("last-update-label!") .attribute("revnumber", revision) .get(); }</code><technical_language>extract this a property file making easier extend?</technical_language>

Target:
private Attributes getAttributes(ConfigSection cfg, String revision) { AttributesBuilder ab = AttributesBuilder.attributes() .tableOfContents(cfg.getBoolean(KEY_INCLUDE_TOC, true)) .sourceHighlighter("prettify"); for (String name : attributes.stringPropertyNames()) { ab.attribute(name, attributes.getProperty(name)); } ab.attribute("last-update-label!"); ab.attribute("revnumber", revision); return ab.get(); }
Source:
<code>public RoutingTableSnapshot(@JsonProperty("tableName") String tableName, @JsonProperty("routingTableEntries") List<Map<String, List<String>>> routingTableEntries) { <START> this.tableName = tableName; <END> this.routingTableEntries = routingTableEntries; }</code><technical_language>requireNonNull</technical_language>

Target:
public RoutingTableSnapshot( @JsonProperty("tableName") String tableName, @JsonProperty("routingTableEntries") List<Map<String, List<String>>> routingTableEntries) { this.tableName = requireNonNull(tableName, "table name is null"); this.routingTableEntries = requireNonNull(routingTableEntries, "routing table entries is null"); }
Source:
<code>public void setup() throws IOException, GeneralSecurityException { Map<String, String> config = new HashMap<>(); <START> config.put("ENGINE_PKI_TRUST_STORE_TYPE", "JKS"); <END> URL systemResource = ClassLoader.getSystemResource("key.p12"); Path tmpkey = Files.createTempFile("benchmarktmp", "", asFileAttribute(fromString("rw-------"))); Files.copy(systemResource.openStream(), tmpkey, StandardCopyOption.REPLACE_EXISTING); config.put("ENGINE_PKI_TRUST_STORE", tmpkey.toString()); config.put("ENGINE_PKI_TRUST_STORE_PASSWORD", "NoSoup4U"); config.put("ENGINE_PKI_ENGINE_STORE_TYPE", "PKCS12"); config.put("ENGINE_PKI_ENGINE_STORE", tmpkey.toString()); config.put("ENGINE_PKI_ENGINE_STORE_PASSWORD", "NoSoup4U"); config.put("ENGINE_PKI_ENGINE_STORE_ALIAS", "1"); EngineLocalConfig.getInstance(config); encryptedPassword = EngineEncryptionUtils.encrypt(password); if (!Objects.equals(password, EngineEncryptionUtils.decrypt(encryptedPassword))) { throw new IllegalStateException("This benchmark is illegal because " + "the encrypt/decrypt yields a string which is different than the source"); } }</code><technical_language>This line ^ repeated. This 'JKS' a 'PKCS12'. is correct one</technical_language>

Target:
public void setup() throws IOException, GeneralSecurityException { Map<String, String> config = new HashMap<>(); URL systemResource = ClassLoader.getSystemResource("key.p12"); tmpKey = Files.createTempFile("benchmarktmp", "", asFileAttribute(fromString("rw-------"))); Files.copy(systemResource.openStream(), tmpKey, StandardCopyOption.REPLACE_EXISTING); config.put("ENGINE_PKI_TRUST_STORE", tmpKey.toString()); config.put("ENGINE_PKI_TRUST_STORE_TYPE", "JKS"); config.put("ENGINE_PKI_TRUST_STORE_PASSWORD", "NoSoup4U"); config.put("ENGINE_PKI_ENGINE_STORE", tmpKey.toString()); config.put("ENGINE_PKI_ENGINE_STORE_TYPE", "PKCS12"); config.put("ENGINE_PKI_ENGINE_STORE_PASSWORD", "NoSoup4U"); config.put("ENGINE_PKI_ENGINE_STORE_ALIAS", "1"); EngineLocalConfig.getInstance(config); encryptedPassword = EngineEncryptionUtils.encrypt(password); if (!Objects.equals(password, EngineEncryptionUtils.decrypt(encryptedPassword))) { throw new IllegalStateException("This benchmark is illegal because " + "the encrypt/decrypt yields a string which is different than the source"); } }
Source:
<code>private Image getIncomingChangesImage() { <START> return ReviewsImages.INCOMING_CHANGES.createImage(); <END> }</code><technical_language>CommonImages.getImage prevent memory leak</technical_language>

Target:
private Image getIncomingChangesImage() { return CommonImages.getImage(ReviewsImages.INCOMING_CHANGES); }
Source:
<code>private void emitPersistedFieldAccessors(final JavaWriter writer) throws IOException { for (final VariableElement field : metadata.getFields()) { final String fieldName = field.getSimpleName().toString(); final String fieldTypeCanonicalName = field.asType().toString(); if (Constants.JAVA_TO_REALM_TYPES.containsKey(fieldTypeCanonicalName)) { emitPrimitiveType(writer, field, fieldName, fieldTypeCanonicalName); } else if (Utils.isMutableRealmInteger(field)) { emitMutableRealmInteger(writer, field, fieldName, fieldTypeCanonicalName); } else if (Utils.isRealmModel(field)) { emitRealmModel(writer, field, fieldName, fieldTypeCanonicalName); } else if (Utils.isRealmList(field)) { <START> final TypeMirror elementTypeMirror = Utils.getRealmListElementTypeMirror(field); <END> emitRealmList(writer, field, fieldName, fieldTypeCanonicalName, elementTypeMirror); } else { throw new UnsupportedOperationException(String.format(Locale.US, "Field \"%s\" of type \"%s\" is not supported.", fieldName, fieldTypeCanonicalName)); } writer.emitEmptyLine(); } }</code><technical_language>this method fit TypeMirrors class</technical_language>

Target:
private void emitPersistedFieldAccessors(final JavaWriter writer) throws IOException { for (final VariableElement field : metadata.getFields()) { final String fieldName = field.getSimpleName().toString(); final String fieldTypeCanonicalName = field.asType().toString(); if (Constants.JAVA_TO_REALM_TYPES.containsKey(fieldTypeCanonicalName)) { emitPrimitiveType(writer, field, fieldName, fieldTypeCanonicalName); } else if (Utils.isMutableRealmInteger(field)) { emitMutableRealmInteger(writer, field, fieldName, fieldTypeCanonicalName); } else if (Utils.isRealmModel(field)) { emitRealmModel(writer, field, fieldName, fieldTypeCanonicalName); } else if (Utils.isRealmList(field)) { final TypeMirror elementTypeMirror = TypeMirrors.getRealmListElementTypeMirror(field); emitRealmList(writer, field, fieldName, fieldTypeCanonicalName, elementTypeMirror); } else { throw new UnsupportedOperationException(String.format(Locale.US, "Field \"%s\" of type \"%s\" is not supported.", fieldName, fieldTypeCanonicalName)); } writer.emitEmptyLine(); } }
Source:
<code><START> public Integer getMinimumCodeReviewValue(MemoryImprint memoryImprint, boolean onlyBuilt) { <END> Integer codeReview = Integer.MAX_VALUE; for (Entry entry : memoryImprint.getEntries()) { Run build = entry.getBuild(); if (build == null) { continue; } Result result = build.getResult(); if (onlyBuilt && result == Result.NOT_BUILT) { continue; } GerritTrigger trigger = GerritTrigger.getTrigger(entry.getProject()); if (shouldSkip(trigger.getSkipVote(), result)) { continue; } Integer codeReviewObj = getCodeReviewValue(result, trigger); if (codeReviewObj != null) { codeReview = Math.min(codeReview, codeReviewObj); } } return codeReview; }</code><technical_language>if possible</technical_language>

Target:
public Integer getMinimumCodeReviewValue(MemoryImprint memoryImprint, boolean onlyBuilt) { Integer codeReview = Integer.MAX_VALUE; for (Entry entry : memoryImprint.getEntries()) { Run build = entry.getBuild(); if (build == null) { continue; } Result result = build.getResult(); if (onlyBuilt && result == Result.NOT_BUILT) { continue; } GerritTrigger trigger = GerritTrigger.getTrigger(entry.getProject()); if (shouldSkip(trigger.getSkipVote(), result)) { continue; } Integer codeReviewObj = getCodeReviewValue(result, trigger); if (codeReviewObj != null) { codeReview = Math.min(codeReview, codeReviewObj); } } if (codeReview == Integer.MAX_VALUE) { return null; } return codeReview; }
Source:
<code>private void validateChange(SampleType sampleType, SampleType beforeChange) throws IOException { List<ValidationError> errors = new ArrayList<>(); if (ValidationUtils.isSetAndChanged(SampleType::getName, sampleType, beforeChange)) { if (sampleTypeDao.getByName(sampleType.getName()) != null) { errors.add(new ValidationError("name", "There is already a sample type with this name")); } long usage = sampleTypeDao.getUsage(beforeChange); if (usage > 0L) { errors <START> .add(new ValidationError("name", "Cannot change name of sample type because it is already in use by " + usage + " sample(s)")); <END> } } if (!errors.isEmpty()) { throw new ValidationException(errors); } }</code><technical_language>DefaultStainCategoryService calculates add 's' not, this too</technical_language>

Target:
private void validateChange(SampleType sampleType, SampleType beforeChange) throws IOException { List<ValidationError> errors = new ArrayList<>(); if (ValidationUtils.isSetAndChanged(SampleType::getName, sampleType, beforeChange)) { if (sampleTypeDao.getByName(sampleType.getName()) != null) { errors.add(new ValidationError("name", "There is already a sample type with this name")); } long usage = sampleTypeDao.getUsage(beforeChange); if (usage > 0L) { errors.add(new ValidationError("name", "Cannot change name of sample type because it is already in use by " + usage + " sample" + (usage > 1L ? "s" : ""))); } } if (!errors.isEmpty()) { throw new ValidationException(errors); } }
Source:
<code>public void onApplicationEvent(ContextClosedEvent event) { CuratorFrameworkState state = client.getState(); if (state.equals(STARTED)) { try { byte[] streamStatusData; try { streamStatusData = client.getData().forPath(Paths.build(Paths.STREAM_DEPLOYMENTS, streamName, Paths.STATUS)); } catch (KeeperException.NoNodeException e) { streamStatusData = null; } DeploymentUnitStatus status = streamStatusData != null ? new DeploymentUnitStatus(ZooKeeperUtils.bytesToMap(streamStatusData)) : new DeploymentUnitStatus(DeploymentUnitStatus.State.undeployed); if (DeploymentUnitStatus.State.undeployed.equals(status.getState()) || DeploymentUnitStatus.State.undeploying.equals(status.getState())) { if (client.checkExists().forPath(getDataPath()) != null) { try { client.delete().deletingChildrenIfNeeded().forPath(getDataPath()); } catch (KeeperException.NoNodeException e) { if (KeeperException.Code.NONODE.equals(e.code())) { } else { log.error(e); <START> e.printStackTrace(); <END> } } } } else { System.out.println("We cannot clean, because: " + status); } } catch (Exception e) { log.error(e); e.printStackTrace(); } } else { log.warn("Could not check the stream state and perform cleanup, client state was " + state); } for (Partition partition : partitions) { if (log.isDebugEnabled()) { log.debug("Deleting offsets for " + partition.toString()); } offsetManager.deleteOffset(partition); try { offsetManager.flush(); } catch (IOException e) { log.error("Error while trying to flush offsets: " + e); } } }</code><technical_language>log error print a stacktrace? this stack trace twice</technical_language>

Target:
public void onApplicationEvent(ContextClosedEvent event) { CuratorFrameworkState state = client.getState(); if (state.equals(STARTED)) { try { byte[] streamStatusData; try { streamStatusData = client.getData().forPath(Paths.build(Paths.STREAM_DEPLOYMENTS, streamName, Paths.STATUS)); } catch (KeeperException.NoNodeException e) { streamStatusData = null; } DeploymentUnitStatus status = streamStatusData != null ? new DeploymentUnitStatus(ZooKeeperUtils.bytesToMap(streamStatusData)) : new DeploymentUnitStatus(DeploymentUnitStatus.State.undeployed); if (DeploymentUnitStatus.State.undeployed.equals(status.getState()) || DeploymentUnitStatus.State.undeploying.equals(status.getState())) { if (client.checkExists().forPath(getDataPath()) != null) { try { client.delete().deletingChildrenIfNeeded().forPath(getDataPath()); } catch (KeeperException.NoNodeException e) { if (KeeperException.Code.NONODE.equals(e.code())) { } else { log.error("Irrecoverable error while trying to clean partitions table:", e); } } } } } catch (Exception e) { log.error(e); } } else { log.warn("Could not check the stream state and perform cleanup, client state was " + state); } for (Partition partition : partitions) { if (log.isDebugEnabled()) { log.debug("Deleting offsets for " + partition.toString()); } offsetManager.deleteOffset(partition); try { offsetManager.flush(); } catch (IOException e) { log.error("Error while trying to flush offsets: " + e); } } }
Source:
<code>public SipGatewaySession(SipGateway gateway, CallContext callContext) { super(gateway, callContext); this.sipProvider = gateway.getSipProvider(); this.jitsiMeetTools = sipProvider.getOperationSet( OperationSetJitsiMeetTools.class); <START> jitsiMeetTools.addRequestListener(this); <END> roomPassHeaderName = sipProvider.getAccountID() .getAccountPropertyString( JITSI_MEET_ROOM_PASS_HEADER_PROPERTY, JITSI_MEET_ROOM_PASS_HEADER_DEFAULT); domainBaseHeaderName = sipProvider.getAccountID() .getAccountPropertyString( JITSI_MEET_DOMAIN_BASE_HEADER_PROPERTY, JITSI_MEET_DOMAIN_BASE_HEADER_DEFAULT); }</code><technical_language>Hum setting this listener</technical_language>

Target:
public SipGatewaySession(SipGateway gateway, CallContext callContext) { super(gateway, callContext); this.sipProvider = gateway.getSipProvider(); this.jitsiMeetTools = sipProvider.getOperationSet( OperationSetJitsiMeetTools.class); roomPassHeaderName = sipProvider.getAccountID() .getAccountPropertyString( JITSI_MEET_ROOM_PASS_HEADER_PROPERTY, JITSI_MEET_ROOM_PASS_HEADER_DEFAULT); domainBaseHeaderName = sipProvider.getAccountID() .getAccountPropertyString( JITSI_MEET_DOMAIN_BASE_HEADER_PROPERTY, JITSI_MEET_DOMAIN_BASE_HEADER_DEFAULT); }
Source:
<code><START> public TranscriptionResponse viewTranscription(String callID, String legId, String recordingId, String transcriptionId) throws UnauthorizedException, GeneralException, NotFoundException { <END> if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, TRANSCRIPTIONPATH); return messageBirdService.requestByID(url, transcriptionId, TranscriptionResponse.class); }</code><technical_language>add null check for transcription id</technical_language>

Target:
public TranscriptionResponse viewTranscription(String callID, String legId, String recordingId, String transcriptionId) throws UnauthorizedException, GeneralException, NotFoundException { if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } if(transcriptionId == null) { throw new IllegalArgumentException("Transcription ID must be specified."); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, TRANSCRIPTIONPATH); return messageBirdService.requestByID(url, transcriptionId, TranscriptionResponse.class); }
Source:
<code>private boolean canDeleteSegment(PBDSegment<M> segment) throws IOException { if (segment.getNumEntries() == 0) { return true; } for (ReadCursor cursor : m_readCursors.values()) { PBDSegmentReader<M> segmentReader = segment.getReader(cursor.m_cursorId); if (segmentReader == null && (cursor.m_segment == null || cursor.m_segment.segmentIndex() <= segment.segmentIndex()) ) { return false; } if (segmentReader != null) { <START> if (!segmentReader.allReadAndDiscarded()) { <END> return false; } } } return true; }</code><technical_language>Minor: statements merged 1 if</technical_language>

Target:
private boolean canDeleteSegment(PBDSegment<M> segment) throws IOException { if (segment.getNumEntries() == 0) { return true; } for (ReadCursor cursor : m_readCursors.values()) { PBDSegmentReader<M> segmentReader = segment.getReader(cursor.m_cursorId); if (segmentReader == null && (cursor.m_segment == null || cursor.m_segment.segmentIndex() <= segment.segmentIndex()) ) { return false; } if (segmentReader != null && !segmentReader.allReadAndDiscarded()) { return false; } } return true; }
Source:
<code><START> public Long getMaxSize() { <END> return this.maxSize; }</code><technical_language>Long instead of long</technical_language>

Target:
public long getMaxSize() { return this.maxSize; }
Source:
<code><START> protected void fillMacAddressIfMissing(VmNic iface) { <END> final MacPoolManagerStrategy pool = getMacPoolForVmNic(iface); if (StringUtils.isEmpty(iface.getMacAddress()) && (pool.getAvailableMacsCount() >= 1)) { iface.setMacAddress(pool.allocateNewMac()); } }</code><technical_language>I this is called ImportVmCommand I inlined (or moved ImportVmCommand) getMacPool is defined there.</technical_language>

Target:
protected void fillMacAddressIfMissing(VmNic iface) { final MacPoolManagerStrategy pool = getMacPool(); if (StringUtils.isEmpty(iface.getMacAddress()) && (pool.getAvailableMacsCount() >= 1)) { iface.setMacAddress(pool.allocateNewMac()); } }
Source:
<code>public void doFailureOccured(CommandContext ctx) throws Exception { if (keyStoreName != null) { if(useLetsEncrypt && caAccount == null) { ModelNode req = ElytronUtil.removeCertificateAuthorityAccount(ctx, certAuthorityAccountName); <START> SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER); <END> req = ElytronUtil.removeKeyStore(ctx, accountKeyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER); } ModelNode req = ElytronUtil.removeKeyStore(ctx, keyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER); } }</code><technical_language>call execute noReload argument false, server stays in reload state</technical_language>

Target:
public void doFailureOccured(CommandContext ctx) throws Exception { if (keyStoreName != null) { if(useLetsEncrypt && caAccount == null) { ModelNode req = ElytronUtil.removeCertificateAuthorityAccount(certAuthorityAccountName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER, false); req = ElytronUtil.removeKeyStore(ctx, accountKeyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER, false); } ModelNode req = ElytronUtil.removeKeyStore(ctx, keyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER, false); } }
Source:
<code>public String call() throws OrmException { StringBuilder errorMessage = null; Project.NameKey parentNameKey; <START> if (parentName != null && parentName.isEmpty()) { <END> parentNameKey = wildProject; } else { parentNameKey = new Project.NameKey(parentName); } if (projectCache.get(parentNameKey) == null) { errorMessage = new StringBuilder(); errorMessage.append("error: Project '" + parentName + "' not found\n"); errorMessage.append("All:"); } if (errorMessage == null) { final PerformSetParent perfSetParent = performSetParent.create(parentName, childProjects); errorMessage = perfSetParent.setParent(); } String message = ""; if (errorMessage != null) { message = errorMessage.toString(); } return message; }</code><technical_language>PerformSetParentImpl#setParent() this method delegates is able handle parentName null empty. duplicate this check again</technical_language>

Target:
public VoidResult call() throws OrmException, NoSuchProjectException, OperationNotExecutedException { final Project.NameKey parentNameKey = new Project.NameKey(parentName); final PerformSetParent perfSetParent = performSetParent.create(parentNameKey, childProjects); perfSetParent.setParent(); return VoidResult.INSTANCE; }
Source:
<code>public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) throws IOException { File formFile = downloadFile(accountingXmlDocumentBackupLink); if (formFile != null) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(formFile.getName()); int fileSize = (int) formFile.length(); String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream fileContents = new FileInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, fileContents, attachmentType); <START> formFile.delete(); <END> return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); } throw new IOException ("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); }</code><technical_language>If need this temporary file create attachment, I suggest performing deletion in a "finally" block in case exception occurs above</technical_language>

Target:
public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) throws IOException { byte[] formFile = downloadByteArray(accountingXmlDocumentBackupLink); if (formFile.length > 0) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(uploadFileName); int fileSize = (int) formFile.length; String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream inputStream = new ByteArrayInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, inputStream, attachmentType); return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); } throw new IOException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); }
Source:
<code>public float getRegionalDifficulty() { <START> final float moonPhase = world.getMoonPhase(); <END> final long worldTime = world.getFullTime(); final Difficulty worldDifficulty = world.getDifficulty(); float totalTimeFactor; if (worldTime > (21 * TickUtil.TICKS_PER_HOUR)) { totalTimeFactor = 0.25f; } else if (worldTime < TickUtil.TICKS_PER_HOUR) { totalTimeFactor = 0; } else { totalTimeFactor = (float) (worldTime - TickUtil.TICKS_PER_HOUR) / 5760000; } float chunkFactor; if (inhabitedTime > (50 * TickUtil.TICKS_PER_HOUR)) { chunkFactor = 1; } else { chunkFactor = (float) inhabitedTime / 3600000; } if (worldDifficulty != Difficulty.HARD) { chunkFactor *= (3f / 4f); } if (moonPhase / 4 > totalTimeFactor) { chunkFactor += totalTimeFactor; } else { chunkFactor += moonPhase / 4; } if (worldDifficulty == Difficulty.EASY) { chunkFactor /= 2; } float regionalDifficulty = 0.75f + totalTimeFactor + chunkFactor; if (worldDifficulty == Difficulty.NORMAL) { regionalDifficulty *= 2; } if (worldDifficulty == Difficulty.HARD) { regionalDifficulty *= 3; } return regionalDifficulty; }</code><technical_language>floats doubles</technical_language>

Target:
public double getRegionalDifficulty() { final double moonPhase = world.getMoonPhase(); final long worldTime = world.getFullTime(); final Difficulty worldDifficulty = world.getDifficulty(); double totalTimeFactor; if (worldTime > (21 * TickUtil.TICKS_PER_HOUR)) { totalTimeFactor = 0.25; } else if (worldTime < TickUtil.TICKS_PER_HOUR) { totalTimeFactor = 0; } else { totalTimeFactor = (worldTime - TickUtil.TICKS_PER_HOUR) / 5760000d; } double chunkFactor; if (inhabitedTime > (50 * TickUtil.TICKS_PER_HOUR)) { chunkFactor = 1; } else { chunkFactor = inhabitedTime / 3600000d; } if (worldDifficulty != Difficulty.HARD) { chunkFactor *= 3d / 4d; } if (moonPhase / 4 > totalTimeFactor) { chunkFactor += totalTimeFactor; } else { chunkFactor += moonPhase / 4; } if (worldDifficulty == Difficulty.EASY) { chunkFactor /= 2; } double regionalDifficulty = 0.75 + totalTimeFactor + chunkFactor; if (worldDifficulty == Difficulty.NORMAL) { regionalDifficulty *= 2; } if (worldDifficulty == Difficulty.HARD) { regionalDifficulty *= 3; } return regionalDifficulty; }
Source:
<code>protected void contributePinActionToToolBar() { if (fPinAction == null) { fPinAction = new PinTmfViewAction(); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); toolBarManager.add(new <START> Separator(IWorkbenchActionConstants.MB_ADDITIONS)); <END> toolBarManager.add(fPinAction); } fPinAction.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { Object value = event.getNewValue(); if (!(value instanceof Boolean)) { throw new IllegalStateException(); } setPinned((Boolean) value); } } }); }</code><technical_language>'additions' groups, this another align action. changed. I if TmfView common actions in some group, 'additions' group separator added after, for subclass actions in group</technical_language>

Target:
protected void contributePinActionToToolBar() { if (fPinAction == null) { fPinAction = new PinTmfViewAction(); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); toolBarManager.add(fPinAction); } fPinAction.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { Object value = event.getNewValue(); if (!(value instanceof Boolean)) { throw new IllegalStateException(); } if (TmfView.this instanceof ITmfPinnable) { ITmfPinnable view = (ITmfPinnable) TmfView.this; view.setPinned((Boolean) value); } } } }); }
Source:
<code><START> public Object compute(final Map<String, Object> combinedAggregators) <END> { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return sketch.toString(); }</code><technical_language>Please change return type String for type safety</technical_language>

Target:
public String compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return sketch.toString(); }
Source:
<code>public SliceBlocksReadStreams(final SliceBlocks sliceBlocks, final CompressorCache compressorCache) { ValidationUtils.nonNull(sliceBlocks.getCoreBlock(), "sliceBlocks must have been initialized"); <START> ValidationUtils.nonNull(sliceBlocks.getNumberOfExternalBlocks() > 0, "sliceBlocks must have been initialized"); <END> if (sliceBlocks.getCoreBlock() == null || sliceBlocks.getNumberOfExternalBlocks() == 0) { throw new CRAMException("slice blocks must be initialized before being used with a reader"); } coreBlockInputStream = new DefaultBitInputStream( new ByteArrayInputStream( sliceBlocks.getCoreBlock().getUncompressedContent(compressorCache))); final List<Integer> externalContentIDs = sliceBlocks.getExternalContentIDs(); for (final Integer contentID : externalContentIDs) { final Block block = sliceBlocks.getExternalBlock(contentID); externalInputStreams.put(contentID, new ByteArrayInputStream(block.getUncompressedContent(compressorCache))); } }</code><technical_language>a null check suggestion ValidationUtils.validateArg(sliceBlocks.getNumberOfExternalBlocks() > 0, "sliceBlocks initialized");</technical_language>

Target:
public SliceBlocksReadStreams(final SliceBlocks sliceBlocks, final CompressorCache compressorCache) { ValidationUtils.nonNull(sliceBlocks.getCoreBlock(), "sliceBlocks must have been initialized"); ValidationUtils.validateArg(sliceBlocks.getNumberOfExternalBlocks() > 0, "sliceBlocks must have been initialized"); if (sliceBlocks.getCoreBlock() == null || sliceBlocks.getNumberOfExternalBlocks() == 0) { throw new CRAMException("slice blocks must be initialized before being used with a reader"); } coreBlockInputStream = new DefaultBitInputStream( new ByteArrayInputStream( sliceBlocks.getCoreBlock().getUncompressedContent(compressorCache))); final List<Integer> externalContentIDs = sliceBlocks.getExternalContentIDs(); for (final Integer contentID : externalContentIDs) { final Block block = sliceBlocks.getExternalBlock(contentID); externalInputStreams.put(contentID, new ByteArrayInputStream(block.getUncompressedContent(compressorCache))); } }
Source:
<code>public DelegatingSystemTablesProvider(List<SystemTablesProvider> delegates) { requireNonNull(delegates, "delegates is null"); <START> Preconditions.checkArgument(delegates.size() >= 1, "empty delegates"); <END> this.delegates = ImmutableList.copyOf(delegates); }</code><technical_language>static import - is delegates error</technical_language>

Target:
public DelegatingSystemTablesProvider(List<SystemTablesProvider> delegates) { requireNonNull(delegates, "delegates is null"); checkArgument(delegates.size() >= 1, "empty delegates"); this.delegates = ImmutableList.copyOf(delegates); }
Source:
<code>public void sendUpdateInternal(Receiver receiver, Direction direction, Tuple updateElement) { Mailbox mailbox = receiver.getMailbox(); MessagePostEffect effect = mailbox.postMessage(direction, updateElement); <START> Logger logger = getNetwork().getEngine().getLogger(); <END> if (effect == MessagePostEffect.BECAME_ACTIVE) { boolean result = activeMailboxes.add(mailbox); if (!result) { logger.error("[INTERNAL ERROR] Mailbox " + mailbox + " was already active and it became active again!"); } } else if (effect == MessagePostEffect.BECAME_INACTIVE) { boolean result = activeMailboxes.remove(mailbox); if (!result) { logger.error( "[INTERNAL ERROR] Mailbox " + mailbox + " was already inactive and it became inactive again!"); } } }</code><technical_language>If promote this a field, do need call accessors message sending</technical_language>

Target:
public void sendUpdateInternal(Receiver receiver, Direction direction, Tuple updateElement) { Mailbox mailbox = receiver.getMailbox(); MessagePostEffect effect = mailbox.postMessage(direction, updateElement); if (effect == MessagePostEffect.BECAME_ACTIVE) { boolean result = activeMailboxes.add(mailbox); if (!result) { logger.error("[INTERNAL ERROR] Mailbox " + mailbox + " was already active and it became active again!"); } } else if (effect == MessagePostEffect.BECAME_INACTIVE) { boolean result = activeMailboxes.remove(mailbox); if (!result) { logger.error( "[INTERNAL ERROR] Mailbox " + mailbox + " was already inactive and it became inactive again!"); } } }
Source:
<code>private synchronized void setBhRestToken(String bhRestToken) { this.bhRestToken = bhRestToken; <START> if(restCredentials.credentialCheck()) { <END> updateDateTimeBhRestTokenWillExpire(); } }</code><technical_language>I if this is work properly - logic is for bhRestToken is set immediately OAuth login process. If existing one, do long user it? This some play testing ensure token expiring logic messed providing existing token a separate login process</technical_language>

Target:
private synchronized void setBhRestToken(String bhRestToken) { this.bhRestToken = bhRestToken; if (!this.isSessionProvided) { updateDateTimeBhRestTokenWillExpire(); } }
Source:
<code>public void verifyTableProperty(String propertyName, int propertyValue) { waitForElementByElement(tables.get(tables.size()-1)); <START> Assertion.assertEquals(tables.get(tables.size()-1).getAttribute(propertyName), Integer.toString(propertyValue)); <END> PageObjectLogging.log("verifyTableProperty", "table has correct " + propertyName + " property", true); }</code><technical_language>long line</technical_language>

Target:
private void verifyTableProperty(String propertyName, int propertyValue) { waitForElementByElement(table); Assertion.assertEquals(table.getAttribute(propertyName), Integer.toString(propertyValue)); PageObjectLogging.log( "verifyTableProperty", "table has correct " + propertyName + " property", true ); }
Source:
<code>public void updatePlayerPosition(PlayerCubeMap cubeMap, EntityPlayerMP player, CubePos managedPos) { if (!CubicChunksConfig.allowVanillaClients) { return; } CubePos offset = playerOffsets.getOrDefault(player, CubePos.ZERO); int idx = managedPos.getX() + offset.getX(); int idy = managedPos.getY() + offset.getY(); int idz = managedPos.getZ() + offset.getZ(); boolean shouldSliceTransition = idy < 2 || idy >= 14; boolean isHorizontalSlices = CubicChunksConfig.vanillaClients.horizontalSlices; if (!shouldSliceTransition && isHorizontalSlices && (!CubicChunksConfig.vanillaClients.horizontalSlicesBedrockOnly || ((IBedrockPlayer) player).isBedrock())) { int horizontalSliceSize = CubicChunksConfig.vanillaClients.horizontalSliceSize; int maxHorizontalOffset = Math.max(Math.abs(idx), Math.abs(idz)); shouldSliceTransition = maxHorizontalOffset >= Coords.blockToCube(horizontalSliceSize); } if (shouldSliceTransition) { int newXOffset = isHorizontalSlices ? -managedPos.getX() : 0; int newYOffset = 8 - managedPos.getY(); <START> int newZOffset = isHorizontalSlices ? -managedPos.getZ() : 0; <END> CubePos newOffset = new CubePos(newXOffset, newYOffset, newZOffset); playerOffsets.put(player, newOffset); switchPlayerOffset(cubeMap, player, offset, newOffset); } }</code><technical_language>nice a more clever algorithm avoids putting player close x/z position current one, force a re-render. done separately. this needs testing 1.14.x+ clients ViaVersion, 1.14.x+ is ignoring chunk packets "out of view range" for client. ViaVersion tells client server a big (>64 chunks) view radius, enough for this purpose</technical_language>

Target:
public void updatePlayerPosition(PlayerCubeMap cubeMap, EntityPlayerMP player, CubePos managedPos) { if (!CubicChunksConfig.allowVanillaClients) { return; } CubePos offset = playerOffsets.get(player); boolean isFirst = offset == null; if (isFirst) { playerOffsets.put(player, offset = CubePos.ZERO); } int posX = managedPos.getX() + offset.getX(); int posY = managedPos.getY() + offset.getY(); int posZ = managedPos.getZ() + offset.getZ(); boolean shouldSliceTransition = posY < 2 || posY >= 14; boolean isHorizontalSlices = CubicChunksConfig.vanillaClients.horizontalSlices && (!CubicChunksConfig.vanillaClients.horizontalSlicesBedrockOnly || bedrockPlayers.contains(player.getUniqueID())); if (isHorizontalSlices) { int horizontalSliceSize = CubicChunksConfig.vanillaClients.horizontalSliceSize; int maxHorizontalOffset = Math.max(Math.abs(posX), Math.abs(posZ)); shouldSliceTransition |= maxHorizontalOffset >= Coords.blockToCube(horizontalSliceSize); } if (shouldSliceTransition) { int newXOffset = isHorizontalSlices ? -managedPos.getX() : 0; int newYOffset = 8 - managedPos.getY(); int newZOffset = isHorizontalSlices ? -managedPos.getZ() : 0; CubePos newOffset = new CubePos(newXOffset, newYOffset, newZOffset); playerOffsets.put(player, newOffset); if (isFirst) { playerOffsetsC2S.put(player, newOffset); } else { switchPlayerOffset(cubeMap, player, offset, newOffset); } } }