auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void destroy(String name) throws CachePersistenceException { while (true) { if (entity == null) { try { entity = entityFactory.retrieve(entityIdentifier, serviceConfiguration.getServerConfiguration()); } catch (EntityNotFoundException e) { } catch (TimeoutException e) { throw new CachePersistenceException("Could not connect to the cluster tier manager '" + entityIdentifier + "'; retrieve operation timed out", e); } catch (DestroyInProgressException e) { silentDestroy(); return; } catch (ConnectionClosedException | ConnectionShutdownException e) { reconnect(); <START> continue; <END> } } try { if (entity != null) { entityFactory.destroyClusteredStoreEntity(entityIdentifier, name); } break; } catch (EntityNotFoundException e) { LOGGER.debug("Destruction of cluster tier failed as it does not exist", name); } catch (ConnectionClosedException | ConnectionShutdownException e) { handleConnectionClosedException(); } } }</code><technical_language>continue is needed right</technical_language>

Target:
public void destroy(String name) throws CachePersistenceException { while (true) { if (entity == null) { try { entity = entityFactory.retrieve(entityIdentifier, serviceConfiguration.getServerConfiguration()); } catch (EntityNotFoundException e) { } catch (TimeoutException e) { throw new CachePersistenceException("Could not connect to the cluster tier manager '" + entityIdentifier + "'; retrieve operation timed out", e); } catch (DestroyInProgressException e) { silentDestroy(); return; } catch (ConnectionClosedException | ConnectionShutdownException e) { reconnect(); } } try { if (entity != null) { entityFactory.destroyClusteredStoreEntity(entityIdentifier, name); break; } } catch (EntityNotFoundException e) { LOGGER.debug("Destruction of cluster tier failed as it does not exist", name); } catch (ConnectionClosedException | ConnectionShutdownException e) { handleConnectionClosedException(); } } }
Source:
<code>protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } ToRemove toRemove; final World world = user.getWorld(); int radius = 0; if (args.length >= 2) { try { radius = Integer.parseInt(args[1]); } catch (NumberFormatException e) { throw new Exception(_("numberRequired"), e); } } if (args.length >= 3) { <START> world = ess.getworld(args[3]); <END> } try { toRemove = ToRemove.valueOf(args[0].toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { throw new NotEnoughArgumentsException(e); } removeEntities(user, world, toRemove, radius); }</code><technical_language>this npe args length 3 == args[0] args[2]</technical_language>

Target:
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } ToRemove toRemove; World world = user.getWorld(); int radius = 0; if (args.length >= 2) { try { radius = Integer.parseInt(args[1]); } catch (NumberFormatException e) { throw new Exception(_("numberRequired"), e); } } if (args.length >= 3) { world = ess.getWorld(args[2]); } try { toRemove = ToRemove.valueOf(args[0].toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { throw new NotEnoughArgumentsException(e); } removeEntities(user, world, toRemove, radius); }
Source:
<code>public void shouldGetDiagnosisById() { <START> int diagnosisId = 1; <END> Diagnosis diagnosis = diagnosisDAO.getDiagnosisById(diagnosisId); assertEquals("4e663d66-6b78-11e0-93c3-18a905e044dc", diagnosis.getUuid()); }</code><technical_language>get rid of variable</technical_language>

Target:
public void shouldGetDiagnosisById() { Diagnosis diagnosis = diagnosisDAO.getDiagnosisById(1); assertEquals("4e663d66-6b78-11e0-93c3-18a905e044dc", diagnosis.getUuid()); }
Source:
<code>public static <I, O, M extends IgniteModel<I, O>, L> DatasetTrainer<IgniteModel<I, O>, L> unsafeCoerce( DatasetTrainer<? extends M, L> trainer) { return new DatasetTrainer<IgniteModel<I, O>, L>() { @Override public <K, V> IgniteModel<I, O> fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { return trainer.fit(datasetBuilder, featureExtractor, lbExtractor); } @Override public <K, V> IgniteModel<I, O> update(IgniteModel<I, O> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { DatasetTrainer<IgniteModel<I, O>, L> trainer1 = (DatasetTrainer<IgniteModel<I, O>, L>)trainer; return trainer1.update(mdl, datasetBuilder, featureExtractor, lbExtractor); } @Override protected boolean checkState(IgniteModel<I, O> mdl) { <START> return true; <END> } @Override protected <K, V> IgniteModel<I, O> updateModel(IgniteModel<I, O> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { return null; } }; }</code><technical_language>a bit weird return true for model, it</technical_language>

Target:
public static <I, O, M extends IgniteModel<I, O>, L> DatasetTrainer<IgniteModel<I, O>, L> unsafeCoerce( DatasetTrainer<? extends M, L> trainer) { return new DatasetTrainer<IgniteModel<I, O>, L>() { @Override public <K, V> IgniteModel<I, O> fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { return trainer.fit(datasetBuilder, featureExtractor, lbExtractor); } @Override public <K, V> IgniteModel<I, O> update(IgniteModel<I, O> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { DatasetTrainer<IgniteModel<I, O>, L> trainer1 = (DatasetTrainer<IgniteModel<I, O>, L>)trainer; return trainer1.update(mdl, datasetBuilder, featureExtractor, lbExtractor); } @Override public boolean isUpdateable(IgniteModel<I, O> mdl) { throw new IllegalStateException(); } @Override protected <K, V> IgniteModel<I, O> updateModel(IgniteModel<I, O> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { throw new IllegalStateException(); } }; }
Source:
<code><START> public PlogClient(String host, int port, int chunkSize) { <END> openSocket(); try { address = InetAddress.getByName(host); } catch (UnknownHostException e) { log.error("Unknown address {}", host, e); throw Throwables.propagate(e); } this.port = port; this.chunkSize = chunkSize; this.lastMessageId = new AtomicInteger(1); }</code><technical_language>some default for chunkSize helpful</technical_language>

Target:
public PlogClient(String host, int port, int chunkSize) { Preconditions.checkNotNull(host, "host cannot be null!"); Preconditions.checkArgument(port > 1024 && port < 65536, "Must provide a valid port number!"); Preconditions.checkArgument(chunkSize < 65483, "Maximum Plog UDP data length is 65483 bytes!"); openSocket(); try { address = InetAddress.getByName(host); } catch (UnknownHostException e) { log.error("Unknown address {}", host, e); throw Throwables.propagate(e); } this.port = port; this.chunkSize = chunkSize; this.lastMessageId = new AtomicInteger(1); }
Source:
<code>void onImportDatasetFromCSV() { final String action = "Preparing data import"; dependencyManager_.withDataImport( action, new Command() { @Override public void execute() { view_.bringToFront(); DataImportDialog dataImportDialog = new DataImportDialog( "Data Import", new OperationWithInput<DataImportOptions>() { @Override public void execute(final DataImportOptions options) { final DataImportScript dataImportScript = new DataImportScript(); String code = dataImportScript.getImportScript(options); <START> eventBus_.fireEvent(new SendToConsoleEvent(code, true)); <END> } }); dataImportDialog.showModal(); } }); }</code><technical_language>want add true argument set focus console (this is debatable is fine)</technical_language>

Target:
void onImportDatasetFromCSV() { final String action = "Preparing data import"; dependencyManager_.withDataImportCSV( action, new Command() { @Override public void execute() { view_.bringToFront(); DataImportDialog dataImportDialog = new DataImportDialog( "Data Import", new OperationWithInput<DataImportOptions>() { @Override public void execute(final DataImportOptions options) { final DataImportScript dataImportScript = new DataImportScript(); String code = dataImportScript.getImportScript(options); eventBus_.fireEvent(new SendToConsoleEvent(code, true, true)); } }); dataImportDialog.showModal(); } }); }
Source:
<code>public void registerUpdateLifecycleTest() throws Exception { applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.UP); <START> Thread.sleep(1000); END> applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.UNKNOWN); Thread.sleep(1000); applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.DOWN); Thread.sleep(10 * 1000); Assert.assertEquals(Arrays.asList("UP", "UNKNOWN", "DOWN"), mockLocalEurekaServer.registrationStatuses); Assert.assertEquals(3, mockLocalEurekaServer.registerCount.get()); }</code><technical_language>sleeps replaced active pooling? This speed test a lot. I applied this strategy in replication tests, execute pretty fast</technical_language>

Target:
public void registerUpdateLifecycleTest() throws Exception { applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.UP); Thread.sleep(400); applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.UNKNOWN); Thread.sleep(400); applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.DOWN); Thread.sleep(2400); Assert.assertEquals(Arrays.asList("UP", "UNKNOWN", "DOWN"), mockLocalEurekaServer.registrationStatuses); Assert.assertEquals(3, mockLocalEurekaServer.registerCount.get()); }
Source:
<code>public AlgorithmParameterSpec getEncryptionParameterSpec(final byte[] iv, final long position) { Validate.notNull(iv, "Initialization vector must not be null"); Validate.isTrue(iv.length == getIVLengthInBytes(), "Initialization vector has the wrong byte count [%d] " + "expected [%d] bytes", iv.length, getIVLengthInBytes()); final int blockSize = getBlockSizeInBytes(); final long startingBlock = position / blockSize; <START> final byte[] counter = ByteBuffer.allocate(16).putLong(startingBlock).array(); <END> final BigInteger ivBigInt = new BigInteger(iv); byte[] updatedIV = Arrays.copyOf(ivBigInt.add(BigInteger.valueOf(startingBlock)).toByteArray(), 16); return new IvParameterSpec(updatedIV); }</code><technical_language>counter remains unused in this function</technical_language>

Target:
public AlgorithmParameterSpec getEncryptionParameterSpec(final byte[] iv, final long position) { Validate.notNull(iv, "Initialization vector must not be null"); Validate.isTrue(iv.length == getIVLengthInBytes(), "Initialization vector has the wrong byte count [%d] " + "expected [%d] bytes", iv.length, getIVLengthInBytes()); final int blockSize = getBlockSizeInBytes(); final long startingBlock = position / blockSize; final BigInteger ivBigInt = new BigInteger(iv); byte[] updatedIV = Arrays.copyOf(ivBigInt.add(BigInteger.valueOf(startingBlock)).toByteArray(), 16); return new IvParameterSpec(updatedIV); }
Source:
<code>public Response createAPIRevision(String apiId, APIRevisionDTO apIRevisionDTO, MessageContext messageContext) { try { APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider(); APIRevision apiRevision = new APIRevision(); apiRevision.setApiUUID(apiId); apiRevision.setDescription(apIRevisionDTO.getDescription()); String revisionId = apiProvider.addAPIRevision(apiRevision); APIRevision createdApiRevision = apiProvider.getAPIRevision(revisionId); APIRevisionDTO createdApiRevisionDTO = APIMappingUtil.fromAPIRevisiontoDTO(createdApiRevision); URI createdApiUri = new URI(RestApiConstants.RESOURCE_PATH_APIS + "/" + createdApiRevisionDTO.getApiInfo().getId() + "/" + RestApiConstants.RESOURCE_PATH_REVISIONS + "/" + createdApiRevisionDTO.getId()); return Response.created(createdApiUri).entity(createdApiRevisionDTO).build(); <START> } catch (Exception e) { <END> String errorMessage = "Error while adding new API Revision : " + apIRevisionDTO.getApiInfo().getProvider() + "-" + apIRevisionDTO.getApiInfo().getName() + "-" + apIRevisionDTO.getApiInfo().getVersion() + " - " + e.getMessage(); RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }</code><technical_language>caching Exception</technical_language>

Target:
public Response createAPIRevision(String apiId, APIRevisionDTO apIRevisionDTO, MessageContext messageContext) { try { APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider(); APIRevision apiRevision = new APIRevision(); apiRevision.setApiUUID(apiId); apiRevision.setDescription(apIRevisionDTO.getDescription()); String revisionId = apiProvider.addAPIRevision(apiRevision); APIRevision createdApiRevision = apiProvider.getAPIRevision(revisionId); APIRevisionDTO createdApiRevisionDTO = APIMappingUtil.fromAPIRevisiontoDTO(createdApiRevision); URI createdApiUri = new URI(RestApiConstants.RESOURCE_PATH_APIS + "/" + createdApiRevisionDTO.getApiInfo().getId() + "/" + RestApiConstants.RESOURCE_PATH_REVISIONS + "/" + createdApiRevisionDTO.getId()); return Response.created(createdApiUri).entity(createdApiRevisionDTO).build(); } catch (APIManagementException e) { String errorMessage = "Error while adding new API Revision : " + apIRevisionDTO.getApiInfo().getProvider() + "-" + apIRevisionDTO.getApiInfo().getName() + "-" + apIRevisionDTO.getApiInfo().getVersion(); RestApiUtil.handleInternalServerError(errorMessage, e, log); } catch (URISyntaxException e) { String errorMessage = "Error while retrieving created revision API location : " + apIRevisionDTO.getApiInfo().getProvider() + "-" + apIRevisionDTO.getApiInfo().getName() + "-" + apIRevisionDTO.getApiInfo().getVersion(); RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }
Source:
<code>public void doesntAddInvitedByToNodeSubscriptionsListIfNotUserOrOwnerOrModerator() throws Exception { List<NodeMembership> members = new ArrayList<NodeMembership>(); members.add(new NodeMembershipImpl(node, jid, Subscriptions.invited, Affiliations.publisher, invitedBy)); Mockito.when(channelManager.getNodeMemberships(Mockito.anyString())).thenReturn(new ResultSetImpl<NodeMembership>(members)); subscriptionsGet.process(element, jid, nodeRequest, null); Assert.assertEquals(1, queue.size()); IQ response = (IQ) queue.poll(); Assert.assertEquals(IQ.Type.result, response.getType()); Assert.assertEquals(userRequest.getTo(), response.getFrom()); Assert.assertEquals(userRequest.getFrom(), response.getTo()); Assert.assertEquals(userRequest.getID(), response.getID()); <START> Assert.assertEquals(0, response.getChildElement().element("subscriptions").elements("invited-by").size()); <END> }</code><technical_language>this changed? invited-by element (always attribute). I this reverted</technical_language>

Target:
public void doesntAddInvitedByToNodeSubscriptionsListIfNotUserOrOwnerOrModerator() throws Exception { List<NodeMembership> members = new ArrayList<NodeMembership>(); members.add(new NodeMembershipImpl(node, jid, Subscriptions.subscribed, Affiliations.publisher, invitedBy)); Mockito.when(channelManager.getNodeMemberships(Mockito.anyString())).thenReturn(new ResultSetImpl<NodeMembership>(members)); subscriptionsGet.process(element, new JID("shylock@shakespeare.lit"), nodeRequest, null); Assert.assertEquals(1, queue.size()); IQ response = (IQ) queue.poll(); Assert.assertEquals(IQ.Type.result, response.getType()); Assert.assertEquals(userRequest.getTo(), response.getFrom()); Assert.assertEquals(userRequest.getFrom(), response.getTo()); Assert.assertEquals(userRequest.getID(), response.getID()); Element subscription = (Element) response.getChildElement().element("subscriptions").elements("subscription").get(0); Assert.assertNull(subscription.attributeValue("invited-by")); }
Source:
<code><START> public void userAuthDevIdUserNameResult() throws Exception { <END> DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. isUserAuthorized(deviceIds, ADMIN_USER); Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 5, "Expected 5 authorized devices for admin user"); Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 0, "Expected 0 un-authorized devices for admin user"); }</code><technical_language>throwing generic exceptions? Please add relevant exceptions, thrown</technical_language>

Target:
public void userAuthDevIdUserNameResult() throws DeviceAccessAuthorizationException { PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. isUserAuthorized(deviceIds, ADMIN_USER); Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 5, "Expected 5 authorized devices for admin user"); Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 0, "Expected 0 un-authorized devices for admin user"); }
Source:
<code>public Action getShowLostEventsAction() { if (hideLostEventsAction == null) { hideLostEventsAction = new Action(Messages.HistogramView_hideLostEvents, IAction.AS_CHECK_BOX) { @Override public void run() { HistogramScaledData.hideLostEvents = hideLostEventsAction.isChecked(); <START> long maxNbEvents = HistogramScaledData.hideLostEvents ? fFullTraceHistogram.fScaledData.fMaxValue : fFullTraceHistogram.fScaledData.fMaxCombinedValue; <END> fFullTraceHistogram.getMaxNbEventsLabel().setText(Long.toString(maxNbEvents)); fFullTraceHistogram.getMaxNbEventsLabel().getParent().layout(); fFullTraceHistogram.fCanvas.redraw(); maxNbEvents = HistogramScaledData.hideLostEvents ? fTimeRangeHistogram.fScaledData.fMaxValue : fTimeRangeHistogram.fScaledData.fMaxCombinedValue; fTimeRangeHistogram.getMaxNbEventsLabel().setText(Long.toString(maxNbEvents)); fTimeRangeHistogram.getMaxNbEventsLabel().getParent().layout(); fTimeRangeHistogram.fCanvas.redraw(); } }; hideLostEventsAction.setText(Messages.HistogramView_hideLostEvents); hideLostEventsAction.setToolTipText(Messages.HistogramView_hideLostEvents); hideLostEventsAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SHOW_LOST_EVENTS)); } return hideLostEventsAction; }</code><technical_language>Done. I introduced setMaxNbEvents</technical_language>

Target:
public Action getShowLostEventsAction() { if (hideLostEventsAction == null) { hideLostEventsAction = new Action(Messages.HistogramView_hideLostEvents, IAction.AS_CHECK_BOX) { @Override public void run() { HistogramScaledData.hideLostEvents = hideLostEventsAction.isChecked(); long maxNbEvents = HistogramScaledData.hideLostEvents ? fFullTraceHistogram.fScaledData.fMaxValue : fFullTraceHistogram.fScaledData.fMaxCombinedValue; fFullTraceHistogram.setMaxNbEvents(maxNbEvents); maxNbEvents = HistogramScaledData.hideLostEvents ? fTimeRangeHistogram.fScaledData.fMaxValue : fTimeRangeHistogram.fScaledData.fMaxCombinedValue; fTimeRangeHistogram.setMaxNbEvents(maxNbEvents); } }; hideLostEventsAction.setText(Messages.HistogramView_hideLostEvents); hideLostEventsAction.setToolTipText(Messages.HistogramView_hideLostEvents); hideLostEventsAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SHOW_LOST_EVENTS)); } return hideLostEventsAction; }
Source:
<code><START> public HashMap<String, Integer> getLayouts() { <END> return layouts; }</code><technical_language>Expose Map if</technical_language>

Target:
public Map<String, Integer> getLayouts() { return layouts; }
Source:
<code>public BatchServerInventoryView( final ZkPathsConfig zkPaths, final CuratorFramework curator, final ObjectMapper jsonMapper, final Predicate<Pair<DruidServerMetadata, DataSegment>> defaultFilter ) { super( log, zkPaths.getAnnouncementsPath(), zkPaths.getLiveSegmentsPath(), curator, jsonMapper, new TypeReference<Set<DataSegment>>() { } ); Preconditions.checkNotNull(defaultFilter); <START> this.defaultFilter = defaultFilter; <END> }</code><technical_language>nit: do this.defaultFilter = Preconditions.checkNotNull(defaultFilter)</technical_language>

Target:
public BatchServerInventoryView( final ZkPathsConfig zkPaths, final CuratorFramework curator, final ObjectMapper jsonMapper, final Predicate<Pair<DruidServerMetadata, DataSegment>> defaultFilter ) { super( log, zkPaths.getAnnouncementsPath(), zkPaths.getLiveSegmentsPath(), curator, jsonMapper, new TypeReference<Set<DataSegment>>() { } ); this.defaultFilter = Preconditions.checkNotNull(defaultFilter); }
Source:
<code>public void updateAdapter(List<Provider> providerList) { this.providerList = providerList; <START> mProviderManagementRecyclerView.getAdapter().notifyDataSetChanged(); <END> ProviderManagementRecyclerViewAdapter adapter = new ProviderManagementRecyclerViewAdapter(getContext(), providerList); mProviderManagementRecyclerView.setAdapter(adapter); adapter.notifyDataSetChanged(); }</code><technical_language>This null pointer. Consider Objects.requireNonNull wrapper</technical_language>

Target:
public void updateAdapter(List<Provider> providerList) { this.providerList = providerList; providersAdapter.setItems(providerList); providersAdapter.notifyDataSetChanged(); }
Source:
<code>public void setup() { try { adminClient.realm("test").remove(); } catch (Exception ignore) { } RealmRepresentation testRealm = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class); adminClient.realms().create(testRealm); UserRepresentation user = UserBuilder.create() .username("login-test") .email("login@test.com") .enabled(true) .requiredAction(UserModel.RequiredAction.UPDATE_PASSWORD.toString()) .requiredAction(UserModel.RequiredAction.UPDATE_PROFILE.toString()) .build(); <START> userId = ApiUtil.createUserAndResetPasswordWithAdminClient(adminClient.realm("test"), user, "password"); END> UserResource userResource = adminClient.realm(testRealm.getRealm()).users().get(userId); UserRepresentation userRepresentation = userResource.toRepresentation(); if (userRepresentation.getRequiredActions().size() < 2) { userRepresentation.setRequiredActions(user.getRequiredActions()); userResource.update(userRepresentation); } getCleanup().addUserId(userId); oauth.clientId("test-app"); }</code><technical_language>is related, AuthenticationSessionFailoverClusterTest is currently failing in master for default Wildfly distribution. Details in <LINK_0></technical_language>

Target:
public void setup() { try { adminClient.realm("test").remove(); } catch (Exception ignore) { } RealmRepresentation testRealm = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class); adminClient.realms().create(testRealm); UserRepresentation user = UserBuilder.create() .username("login-test") .email("login@test.com") .enabled(true) .requiredAction(UserModel.RequiredAction.UPDATE_PASSWORD.toString()) .requiredAction(UserModel.RequiredAction.UPDATE_PROFILE.toString()) .password("password") .build(); userId = ApiUtil.createUserWithAdminClient(adminClient.realm("test"), user); getCleanup().addUserId(userId); oauth.clientId("test-app"); }
Source:
<code>public SymbolTableBuilder(String fullyQualifiedModuleName) { <START> this.fullyQualifiedModuleName = new ArrayList<>(Arrays.asList(fullyQualifiedModuleName.split("\\."))); <END> }</code><technical_language>new ArrayList<>(</technical_language>

Target:
public SymbolTableBuilder(String fullyQualifiedModuleName) { this.fullyQualifiedModuleName = Arrays.asList(fullyQualifiedModuleName.split("\\.")); }
Source:
<code>private void onNewDR() { final StorageDRModel model = (StorageDRModel) getWindow(); if (!model.validate()) { return; } StorageDomain storageDomain = getEntity(); final StorageSyncSchedule syncSchedule = new StorageSyncSchedule(); syncSchedule.setFrequency(model.getFrequency().getSelectedItem()); syncSchedule.setHour(model.getHour().getEntity()); syncSchedule.setMins(model.getMins().getEntity()); StorageSyncScheduleParameters parameter = new StorageSyncScheduleParameters(syncSchedule, storageDomain.getId(), <START> model.getGeoRepSession().getSelectedItem().getId()); <END> model.startProgress(); Frontend.getInstance().runAction(VdcActionType.ScheduleGlusterStorageSync, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { StorageDRListModel localModel = (StorageDRListModel) result.getState(); model.stopProgress(); localModel.postSaveAction(result.getReturnValue()); } }, this); }</code><technical_language>This null if is gep rep session for volume</technical_language>

Target:
private void onNewDR() { final StorageDRModel model = (StorageDRModel) getWindow(); if (!model.validate()) { return; } StorageDomain storageDomain = getEntity(); final StorageSyncSchedule syncSchedule = new StorageSyncSchedule(); syncSchedule.setFrequency(model.getFrequency().getSelectedItem()); syncSchedule.setHour(model.getHour().getEntity()); syncSchedule.setMins(model.getMins().getEntity()); Guid georepId = model.getGeoRepSession().getSelectedItem() != null ? model.getGeoRepSession().getSelectedItem().getId() : null; StorageSyncScheduleParameters parameter = new StorageSyncScheduleParameters(syncSchedule, storageDomain.getId(), georepId); model.startProgress(); Frontend.getInstance().runAction(VdcActionType.ScheduleGlusterStorageSync, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { StorageDRListModel localModel = (StorageDRListModel) result.getState(); model.stopProgress(); localModel.postSaveAction(result.getReturnValue()); } }, this); }
Source:
<code>public void visitVariableIdentifier(VariableIdentifierTree varIdentifier) { <START> if (inStaticContext && !isWithinNonStaticFunctionExpression(varIdentifier) && "$this".equals(varIdentifier.variableExpression().text())) { <END> context().newIssue(this, varIdentifier.variableExpression(), MESSAGE); } super.visitVariableIdentifier(varIdentifier); }</code><technical_language>Nitpicking: I suppose this new condition is slightly more costly next one. I put new condition last</technical_language>

Target:
public void visitVariableIdentifier(VariableIdentifierTree varIdentifier) { if (inStaticContext && "$this".equals(varIdentifier.variableExpression().text()) && !isWithinNonStaticFunctionExpression(varIdentifier)) { context().newIssue(this, varIdentifier.variableExpression(), MESSAGE); } super.visitVariableIdentifier(varIdentifier); }
Source:
<code>private WebDriver createWebDriver() { System.out.print("Initializing Selenium: "); String browser = TestProperties.BROWSER; if ("firefox".equals(browser)) { System.out.println("Using Firefox."); String firefoxPath = TestProperties.FIREFOX_PATH; if (!firefoxPath.isEmpty()) { System.out.println("Custom path: " + firefoxPath); System.setProperty("webdriver.firefox.bin", firefoxPath); } FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.panel.shown", false); profile.setPreference("browser.helperApps.neverAsk.openFile", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download.dir", System.getProperty("java.io.tmpdir")); if (TestProperties.IS_HEADLESS_FIREFOX) { System.out.println("Running Firefox is headless mode with Xvfb on display port " + TestProperties.XVFB_PORT + " (Xvfb must already be listening on that port)"); FirefoxBinary firefoxBinary = new FirefoxBinary(new File(firefoxPath)); firefoxBinary.setEnvironmentProperty("DISPLAY", TestProperties.XVFB_PORT); return new FirefoxDriver(firefoxBinary, profile); } <START> return new FirefoxDriver(profile); <END> } System.out.println("Using " + browser + " is not supported!"); return null; }</code><technical_language>here, if changes needed</technical_language>

Target:
private WebDriver createWebDriver() { System.out.print("Initializing Selenium: "); String browser = TestProperties.BROWSER; if ("firefox".equals(browser)) { System.out.println("Using Firefox."); String firefoxPath = TestProperties.FIREFOX_PATH; if (!firefoxPath.isEmpty()) { System.out.println("Custom path: " + firefoxPath); System.setProperty("webdriver.firefox.bin", firefoxPath); } FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.panel.shown", false); profile.setPreference("browser.helperApps.neverAsk.openFile", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download.dir", System.getProperty("java.io.tmpdir")); return new FirefoxDriver(profile); } System.out.println("Using " + browser + " is not supported!"); return null; }
Source:
<code>public InterruptibleCharSequence(CharSequence inner) { <START> super(); <END> this.inner = inner; }</code><technical_language>Call super() is implicit required</technical_language>

Target:
public InterruptibleCharSequence(CharSequence inner) { this.inner = inner; }
Source:
<code>public static String buildJsonArray(List<String> queries) { final OutputStream os = new ByteArrayOutputStream(); final ObjectMapper mapper = new ObjectMapper(); <START> String json = ""; <END> try { mapper.writeValue(os, queries); final byte[] data = ((ByteArrayOutputStream) os).toByteArray(); json = new String(data, "UTF-8"); } catch (IOException e) { throw new RuntimeException(e); } return json; }</code><technical_language>final assignment</technical_language>

Target:
public final static String buildJsonArray(List<String> queries) { final OutputStream os = new ByteArrayOutputStream(); final ObjectMapper mapper = new ObjectMapper(); try { mapper.writeValue(os, queries); final byte[] data = ((ByteArrayOutputStream) os).toByteArray(); final String json = new String(data, "UTF-8"); return json; } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public void writeTo(OutputStream out) throws IOException { ByteBuffer slab; for (int i = 0; i < slabs.size() - 1; i++) { slab = slabs.get(i); if (slab.hasArray()) { out.write(slab.array(), slab.arrayOffset(), slab.position()); } else { byte[] copy = new byte[slab.limit()]; slab.flip(); slab.get(copy); out.write(copy); } } slab = currentSlab; if (slab.hasArray()) { out.write(slab.array(), slab.arrayOffset(), currentSlabIndex); } else { byte[] copy = new byte[currentSlabIndex]; slab.flip(); slab.get(copy); <START> out.write(copy); <END> } }</code><technical_language>factor out write(slab, OutputStream)</technical_language>

Target:
public void writeTo(OutputStream out) throws IOException { for (int i = 0; i < slabs.size() - 1; i++) { writeToOutput(out, slabs.get(i), slabs.get(i).position()); } writeToOutput(out, currentSlab, currentSlabIndex); }
Source:
<code><START> long monthsUntil(final AbstractDate end) { <END> InternationalFixedDate date = InternationalFixedDate.from(end); long monthStart = this.getCalculatedProlepticMonth() * 256L + this.getCalculatedDayOfMonth(); long monthEnd = date.getCalculatedProlepticMonth() * 256L + date.getCalculatedDayOfMonth(); return (monthEnd - monthStart) / 256L; }</code><technical_language>I get feeling this is somehow, I run enough of numbers find where. In particular, blanket translate leap-day/year-day do for day-of-month here, more complicated that. Discordian, again</technical_language>

Target:
long monthsUntil(final AbstractDate end) { InternationalFixedDate date = InternationalFixedDate.from(end); long monthStart = this.getProlepticMonth() * 32L + this.getInternalDayOfMonth(); long monthEnd = date.getProlepticMonth() * 32L + date.getInternalDayOfMonth(); return (monthEnd - monthStart) / 32L; }
Source:
<code>public void testWithEnvironmentEdge() { <START> EnvironmentEdge edgeForHour11 = new EnvironmentEdge() { <END> @Override public long currentTime() { return 1597895561000L; } @Override public TimeZone currentTimeZone() { return TimeZone.getTimeZone("GMT+08:00"); } }; EnvironmentEdgeManager.injectEdge(edgeForHour11); assertEquals(11, CurrentHourProvider.getCurrentHour()); EnvironmentEdge edgeForHour15 = new EnvironmentEdge() { @Override public long currentTime() { return 1597907081000L; } @Override public TimeZone currentTimeZone() { return TimeZone.getTimeZone("GMT+08:00"); } }; EnvironmentEdgeManager.injectEdge(edgeForHour15); assertEquals(15, CurrentHourProvider.getCurrentHour()); }</code><technical_language>I do this in a oppsite way, is, based current time zone, adjust currentTime, return hour. In general, try add additional logic normal code if want write a UT</technical_language>

Target:
public void testWithEnvironmentEdge() { long deltaFor11 = TimeZone.getDefault().getRawOffset() - 28800000; long timeFor11 = 1597895561000L - deltaFor11; EnvironmentEdgeManager.injectEdge(() -> timeFor11); assertEquals(11, CurrentHourProvider.getCurrentHour()); long deltaFor15 = TimeZone.getDefault().getRawOffset() - 28800000; long timeFor15 = 1597907081000L - deltaFor15; EnvironmentEdgeManager.injectEdge(() -> timeFor15); assertEquals(15, CurrentHourProvider.getCurrentHour()); }
Source:
<code>public void execute(Runnable runnable) { <START> System.out.println("executing"); <END> delegate.execute(new InstrumentedRunnable(runnable)); }</code><technical_language>Pretty submitted.inc()</technical_language>

Target:
public void execute(Runnable runnable) { submitted.mark(); delegate.execute(new InstrumentedRunnable(runnable)); }
Source:
<code>protected void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException { inErrorOnBehalfOf = false; Authentication authentication = getAuthentication(req, res); if (authentication != null) { SecurityContextHolder.getContext().setAuthentication(authentication); restAuthenticationService.invalidateAuthenticationCookie(res); } if (inErrorOnBehalfOf) { return; <START> } <END> chain.doFilter(req, res); }</code><technical_language>This isErrorOnBehalfOf flag is odd & necessary. able refactor this code longer it....ideally return immediately call response.sendError() (to avoid else add response). So, this method refactored simply check for header here, call getOnBehalfOfAuthentication. If method throws error, catch call sendError(). Otherwise, proceed normal</technical_language>

Target:
protected void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException { Authentication authentication = null; try { authentication = getAuthentication(req, res); } catch (AuthorizeException e) { res.sendError(HttpServletResponse.SC_UNAUTHORIZED, e.getMessage()); log.error(e.getMessage(), e); return; } catch (IllegalArgumentException | SQLException e) { res.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); log.error(e.getMessage(), e); return; } catch (AccessDeniedException e) { res.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage()); log.error(e.getMessage(), e); return; } if (authentication != null) { SecurityContextHolder.getContext().setAuthentication(authentication); restAuthenticationService.invalidateAuthenticationCookie(res); } chain.doFilter(req, res); }
Source:
<code>public void setArchiveStatusOfInstructor(String googleId, String courseId, boolean archiveStatus) throws InvalidParametersException, EntityDoesNotExistException{ InstructorAttributes instructor = instructorsDb.getInstructorForGoogleId(courseId, googleId); <START> instructor.isArchived = Boolean.valueOf(archiveStatus); <END> instructorsDb.updateInstructorByGoogleId(instructor); }</code><technical_language>This work too. instructor.isArchived = archiveStatus; Java do "auto-boxing"</technical_language>

Target:
public void setArchiveStatusOfInstructor(String googleId, String courseId, boolean archiveStatus) throws InvalidParametersException, EntityDoesNotExistException{ InstructorAttributes instructor = instructorsDb.getInstructorForGoogleId(courseId, googleId); instructor.isArchived = archiveStatus; instructorsDb.updateInstructorByGoogleId(instructor); }
Source:
<code>public void send(@CheckForNull final TransportEndpoint endpoint, @CheckForNull final Message message, @Nullable final SettableFuture<Void> promise) { checkArgument(endpoint != null); checkArgument(message != null); <START> Futures.addCallback(getOrConnect(endpoint.socketAddress()), new FutureCallback<TransportChannel>() { <END> @Override public void onSuccess(TransportChannel input) { input.send(message, promise); } @Override public void onFailure(Throwable cause) { LOGGER.error("Failed to get transportChannel by socketAddress: {}, cause: {}", endpoint.socketAddress(), cause); if (promise != null) { promise.setException(cause); } } }); }</code><technical_language>register callback call. check future is completed if yes, call get send; register callback</technical_language>

Target:
public void send(@CheckForNull final TransportEndpoint endpoint, @CheckForNull final Message message, @Nullable final SettableFuture<Void> promise) { checkArgument(endpoint != null); checkArgument(message != null); ListenableFuture<TransportChannel> future = getOrConnect(endpoint.socketAddress()); if (!future.isDone()) { Futures.addCallback(future, new FutureCallback<TransportChannel>() { @Override public void onSuccess(TransportChannel input) { input.send(message, promise); } @Override public void onFailure(Throwable cause) { setFailedGetOrConnect(promise, cause, endpoint.socketAddress()); } }); } else { TransportChannel transportChannel; try { transportChannel = future.get(); } catch (CancellationException | ExecutionException cause) { Throwable cause1 = cause instanceof ExecutionException ? cause.getCause() : cause; setFailedGetOrConnect(promise, cause1, endpoint.socketAddress()); return; } catch (InterruptedException cause) { throw Throwables.propagate(cause); } transportChannel.send(message, promise); } }
Source:
<code>public void returnsNextValue() { <START> final List<String> VALID_LIST = Arrays.asList( <END> "Accept: text/plain", "Accept-Charset: utf-8", "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "Cache-Control: no-cache", "From: user@example.com"); MatcherAssert.assertThat( new VerboseIterable<String>(VALID_LIST, "Empty Error Message") .iterator().next(), equalTo("Accept: text/plain")); }</code><technical_language>@m4solutions I suggest valid</technical_language>

Target:
public final void returnsNextValue() { final String accept = "Accept: text/plain"; MatcherAssert.assertThat( new VerboseIterable<String>( Arrays.asList( accept, "Accept-Charset: utf-8", "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "Cache-Control: no-cache", "From: user@example.com" ), "Empty Error Message" ).iterator().next(), Matchers.equalTo(accept) ); }
Source:
<code>private void updateSLinks(ITmfEvent event) { String sId = event.getContent().getFieldValue(String.class, ITraceEventConstants.ID); if (sId == null) { Object resolve = fIdAspect.resolve(event); if (resolve == null) { resolve = Integer.valueOf(0); } sId = String.valueOf(resolve); } Long sLink = fLinkStartTime.remove(sId); int tid = (int) getThreadId(event); ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } <START> int linkQuark = ssb.getQuarkAbsoluteAndAdd(EDGES, sId); <END> long ts = event.getTimestamp().toNanos(); if (sLink != null) { ssb.modifyAttribute(sLink, sId, linkQuark); int dstTidQuark = ssb.getQuarkRelativeAndAdd(linkQuark, "DST_TID"); ssb.modifyAttribute(sLink, tid, dstTidQuark); int dstQuark = ssb.getQuarkRelativeAndAdd(linkQuark, "DST"); ssb.modifyAttribute(sLink, event.getTrace().getHostId(), dstQuark); ssb.removeAttribute(ts, linkQuark); } else { int srcTidQuark = ssb.getQuarkRelativeAndAdd(linkQuark, "SRC_TID"); ssb.modifyAttribute(ts, tid, srcTidQuark); int srcQuark = ssb.getQuarkRelativeAndAdd(linkQuark, "SRC"); ssb.modifyAttribute(ts, event.getTrace().getHostId(), srcQuark); fLinkStartTime.put(sId, ts); } }</code><technical_language>propose attribute pool instead of sId, typically 2 edges for a ID, _could_ overlap (at want prevent kind of logic). edges. state system scales vertically a tall one, reach MAX_INT in time</technical_language>

Target:
private void updateSLinks(ITmfEvent event) { String sId = event.getContent().getFieldValue(String.class, ITraceEventConstants.ID); if (sId == null) { Object resolve = fIdAspect.resolve(event); if (resolve == null) { resolve = Integer.valueOf(0); } sId = String.valueOf(resolve); } HostThread src = fSrcHost.remove(sId); int tid = (int) getThreadId(event); ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } long ts = event.getTimestamp().toNanos(); long startTime = fScopeEndTimes.getOrDefault(sId, ts); ts ++; HostThread currHostThread = new HostThread(event.getTrace().getHostId(), tid); if (src != null && !src.equals(currHostThread)) { TmfAttributePool pool = getPool(ssb); int linkQuark = pool.getAvailable(); HostThread dst = currHostThread; ssb.modifyAttribute(startTime, (Object) new EdgeStateValue(fIdCache.computeIfAbsent(sId, FUNCTION), src, dst), linkQuark); ssb.modifyAttribute(ts, (Object) null, linkQuark); pool.recycle(linkQuark, ts); } fSrcHost.put(sId, currHostThread); }
Source:
<code>private String getTemplateContent(String templatePath) { Path commitTemplatePath = Paths.get(templatePath); if (Files.exists(commitTemplatePath)) { byte[] fileBytes; try { <START> fileBytes = Files.readAllBytes(commitTemplatePath); <END> String rawTemplate = new String(fileBytes).trim(); return shouldShowCommentsInCommitTemplate() ? rawTemplate : cleanTemplate(rawTemplate); } catch (IOException e) { } } return null; }</code><technical_language>IO.readFully read file content RawParseUtils decode bytes a String, e.g. Repository.readCommitMsgFile()</technical_language>

Target:
private String getTemplateContent(String templatePath) { File commitTemplatePath = new File(templatePath); if (commitTemplatePath.exists()) { try { return RawParseUtils.decode(IO.readFully(commitTemplatePath)); } catch (IOException e) { return e.getMessage(); } } return null; }
Source:
<code><START> public void sendSkullChange(Location location, CompoundTag nbt) throws IllegalArgumentException { <END> Validate.notNull(location, "location cannot be null"); Validate.notNull(nbt, "nbt cannot be null"); afterBlockChanges.add(new UpdateBlockEntityMessage((int) location.getX(), (int) location.getY(), (int) location.getZ(), GlowBlockEntity.SKULL.getValue(), nbt)); }</code><technical_language>Ideally this method support sending applicable tile entity changes (one of GlowBlockEntity), making of form sendTEChange(GlowBlockEntity, Location, CompoundTag) sendTEChange(TileEntity) if want wild. this pull request adds necessary update message support, I full reason include this change. do think</technical_language>

Target:
public void sendSkullChange(Location location, CompoundTag nbt) { sendBlockEntityChange(location, nbt, GlowBlockEntity.SKULL); }
Source:
<code>public FutureResult<WarehouseS3Credentials> addS3Credentials(final Warehouse warehouse, final WarehouseS3Credentials s3Credentials) { notNull(warehouse, "warehouse"); notEmpty(warehouse.getId(), "warehouse.id"); notNull(s3Credentials, "s3Credentials"); <START> final WarehouseS3Credentials s3CredentialsWithLinks = s3Credentials.withLinks(warehouse.getId()); <END> final WarehouseTask task = createWarehouseTask(s3CredentialsWithLinks, HttpMethod.POST); return new PollResult<>(this, createS3PollHandler(s3CredentialsWithLinks, task, "add")); }</code><technical_language>i understand this pattern ad I find confusing. do pass target URI createWarehouseTask() method</technical_language>

Target:
public FutureResult<WarehouseS3Credentials> addS3Credentials(final Warehouse warehouse, final WarehouseS3Credentials s3Credentials) { notNull(warehouse, "warehouse"); notEmpty(warehouse.getId(), "warehouse.id"); notNull(s3Credentials, "s3Credentials"); final WarehouseTask task = createWarehouseTask(WarehouseS3CredentialsList.URI, s3Credentials, HttpMethod.POST, warehouse.getId()); final String newCredentialsUri = WarehouseS3Credentials.TEMPLATE.expand(warehouse.getId(), s3Credentials.getRegion(), s3Credentials.getAccessKey()).toString(); return new PollResult<>(this, createS3PollHandler(newCredentialsUri, task, "add")); }
Source:
<code>protected Resource getAirdResourceWithAnalysisOn(final EObject object) { for (final Resource anResource : session.getAllSessionResources()) { for (final DAnalysis analysis : getAnalyses(anResource)) { Option<EObject> optionalMainModel = new DAnalysisQuery(analysis).getMainModel(); ArrayList<EObject> releventModels = <START> Lists.<EObject> newArrayList(); <END> if (optionalMainModel.some()) { releventModels.add(optionalMainModel.get()); for (EObject model : analysis.getModels()) { if (!AdapterFactoryEditingDomain.isControlled(model) && !(new EObjectQuery(optionalMainModel.get()).isContainedIn(model))) { releventModels.add(model); } } } if (Iterables.contains(releventModels, object)) { return anResource; } } } return null; }</code><technical_language>Lists.newArrayList(), Lists is avoid write <EObject> I Sets.newLinkedHashSet()</technical_language>

Target:
protected Resource getAirdResourceWithAnalysisOn(final EObject object) { for (final Resource anResource : session.getAllSessionResources()) { for (final DAnalysis analysis : getAnalyses(anResource)) { Set<EObject> releventModels = new DAnalysisQuery(analysis).getMainModels(); if (Iterables.contains(releventModels, object)) { return anResource; } } } return null; }
Source:
<code>private static void readLightingInfo(Cube cube, NBTTagCompound nbt, ICubicWorldServer world) { NBTTagCompound lightingInfo = nbt.getCompoundTag("LightingInfo"); int[] lastHeightMap = lightingInfo.getIntArray("LastHeightMap"); int[] currentHeightMap = cube.getColumn().getHeightMap(); <START> byte edgeNeedSkyLightUpdate = 63; END> if (lightingInfo.hasKey("EdgeNeedSkyLightUpdate")) edgeNeedSkyLightUpdate = lightingInfo.getByte("EdgeNeedSkyLightUpdate"); for (int i = 0; i < cube.edgeNeedSkyLightUpdate.length; i++) { cube.edgeNeedSkyLightUpdate[i] = (edgeNeedSkyLightUpdate >>> i & 1) == 1; } int minBlockY = Coords.cubeToMinBlock(cube.getY()); int maxBlockY = Coords.cubeToMaxBlock(cube.getY()); LightingManager lightManager = world.getLightingManager(); for (int i = 0; i < currentHeightMap.length; i++) { int currentY = currentHeightMap[i]; int lastY = lastHeightMap[i]; int minUpdateY = Math.min(currentY, lastY); int maxUpdateY = Math.max(currentY, lastY); boolean needLightUpdate = minUpdateY != maxUpdateY && !(maxUpdateY < minBlockY) && !(minUpdateY > maxBlockY); if (needLightUpdate) { if (minUpdateY < minBlockY) { minUpdateY = minBlockY; } if (maxUpdateY > maxBlockY) { maxUpdateY = maxBlockY; } assert minUpdateY <= maxUpdateY : "minUpdateY > maxUpdateY: " + minUpdateY + ">" + maxUpdateY; int localX = i & 0xF; int localZ = i >> 4; lightManager.markCubeBlockColumnForUpdate(cube, localToBlock(cube.getX(), localX), localToBlock(cube.getZ(), localZ)); } } }</code><technical_language>(1 << 6) - 1 0x3F</technical_language>

Target:
private static void readLightingInfo(Cube cube, NBTTagCompound nbt, ICubicWorldServer world) { NBTTagCompound lightingInfo = nbt.getCompoundTag("LightingInfo"); int[] lastHeightMap = lightingInfo.getIntArray("LastHeightMap"); int[] currentHeightMap = cube.getColumn().getHeightMap(); byte edgeNeedSkyLightUpdate = 0x3F; if (lightingInfo.hasKey("EdgeNeedSkyLightUpdate")) edgeNeedSkyLightUpdate = lightingInfo.getByte("EdgeNeedSkyLightUpdate"); for (int i = 0; i < cube.edgeNeedSkyLightUpdate.length; i++) { cube.edgeNeedSkyLightUpdate[i] = (edgeNeedSkyLightUpdate >>> i & 1) == 1; } int minBlockY = Coords.cubeToMinBlock(cube.getY()); int maxBlockY = Coords.cubeToMaxBlock(cube.getY()); LightingManager lightManager = world.getLightingManager(); for (int i = 0; i < currentHeightMap.length; i++) { int currentY = currentHeightMap[i]; int lastY = lastHeightMap[i]; int minUpdateY = Math.min(currentY, lastY); int maxUpdateY = Math.max(currentY, lastY); boolean needLightUpdate = minUpdateY != maxUpdateY && !(maxUpdateY < minBlockY) && !(minUpdateY > maxBlockY); if (needLightUpdate) { if (minUpdateY < minBlockY) { minUpdateY = minBlockY; } if (maxUpdateY > maxBlockY) { maxUpdateY = maxBlockY; } assert minUpdateY <= maxUpdateY : "minUpdateY > maxUpdateY: " + minUpdateY + ">" + maxUpdateY; int localX = i & 0xF; int localZ = i >> 4; lightManager.markCubeBlockColumnForUpdate(cube, localToBlock(cube.getX(), localX), localToBlock(cube.getZ(), localZ)); } } }