auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onPostExecute(Boolean resultBoolean) { super.onPostExecute(resultBoolean); if (resultBoolean && channelMetaDataUpdateListener != null) { channelMetaDataUpdateListener.onUpdateSuccess(updateNameResponse, context); <START> } else if (!resultBoolean && exception != null && channelMetaDataUpdateListener != null) { <END> channelMetaDataUpdateListener.onFailure(updateNameResponse, exception, context); } }</code><technical_language>if exception doesnt occur, updateNameResponse is null, . give error callback failed response. remove check for exception != null</technical_language>

Target:
protected void onPostExecute(Boolean resultBoolean) { super.onPostExecute(resultBoolean); if (resultBoolean && channelMetaDataUpdateListener != null) { channelMetaDataUpdateListener.onUpdateSuccess(updateMetaDataResponse, context); } else if (!resultBoolean && channelMetaDataUpdateListener != null) { channelMetaDataUpdateListener.onFailure(updateMetaDataResponse, exception, context); } }
Source:
<code>public static Set<String> evaluateProvidersWithPermissions(LocationManager manager, Context context) { HashSet<String> set = new HashSet<>(); List<String> providers = manager.getProviders(true); for (String provider : providers) { if ((provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission( context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { set.add(LocationManager.GPS_PROVIDER); } if ((provider.equalsIgnoreCase(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission( context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { set.add(LocationManager.NETWORK_PROVIDER); } <START> } <END> return set; }</code><technical_language>I a confusing adding provider set; closer inspection I why. write if ((provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission( context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) || (provider.equalsIgnoreCase(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission( context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { set.add(provider); } removes need for set.add calls; if is more intuitive..</technical_language>

Target:
public static Set<String> evaluateProvidersWithPermissions(LocationManager manager, Context context) { HashSet<String> set = new HashSet<>(); List<String> providers = manager.getProviders(true); for (String provider : providers) { if (provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission( context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { set.add(LocationManager.GPS_PROVIDER); } if (provider.equalsIgnoreCase(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission( context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { set.add(LocationManager.NETWORK_PROVIDER); } } return set; }
Source:
<code>public boolean add(T t) { boolean result = consumers.add(t); if (result) { <START> changedIteratorFieldUpdater.set(this, consumers.resettableIterator()); <END> } return result; }</code><technical_language>lazeSet is enough for single-writer/single-threaded semantic</technical_language>

Target:
public boolean add(T t) { boolean result = consumers.add(t); if (result) { iterator.update(consumers.resettableIterator()); } return result; }
Source:
<code>private byte[] decryptPayload(ExtendedJSONObject payload, KeyBundle keybundle) throws CryptoException, UnsupportedEncodingException { byte[] ciphertext = Utils.decodeBase64((String) payload .get(Constants.JSON_KEY_CIPHERTEXT)); byte[] iv = Utils.decodeBase64((String) payload.get(Constants.JSON_KEY_IV)); <START> byte[] hmac = Utils.hex2Byte((String) payload.get(Constants.JSON_KEY_HMAC)); <END> CryptoInfo decrypted = CryptoInfo.decrypt(ciphertext, iv, hmac, keybundle); return decrypted.getMessage(); }</code><technical_language>Split <tt>payload.get</tt>s local variables. Neater, need split line</technical_language>

Target:
private byte[] decryptPayload(ExtendedJSONObject payload, KeyBundle keybundle) throws CryptoException, UnsupportedEncodingException { String sCiphertext = (String) payload.get(Constants.JSON_KEY_CIPHERTEXT); String sIv = (String) payload.get(Constants.JSON_KEY_IV); String sHmac = (String) payload.get(Constants.JSON_KEY_HMAC); byte[] ciphertext = Utils.decodeBase64(sCiphertext); byte[] iv = Utils.decodeBase64(sIv); byte[] hmac = Utils.hex2Byte(sHmac); CryptoInfo decrypted = CryptoInfo.decrypt(ciphertext, iv, hmac, keybundle); return decrypted.getMessage(); }
Source:
<code>private void setVendorFaxNumberValue(VendorAddress vendorAddress, String vendorFaxNumber) { try { Class type = ObjectUtils.easyGetPropertyType(vendorAddress, VendorPropertyConstants.VENDOR_FAX_NUMBER); ObjectUtils.setObjectProperty(vendorAddress, VendorPropertyConstants.VENDOR_FAX_NUMBER, type, vendorFaxNumber); } catch (FormatException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { vendorAddress.setVendorFaxNumber(null); LOG.error("setVendorFaxNumberValue: Vendor Fax Number cannot be set due to exception: " + e); <START> e.printStackTrace(); <END> } }</code><technical_language>Log4j print stack trace, exception's printStackTrace() method</technical_language>

Target:
private void setVendorFaxNumberValue(VendorAddress vendorAddress, String vendorFaxNumber) { try { Class type = ObjectUtils.easyGetPropertyType(vendorAddress, VendorPropertyConstants.VENDOR_FAX_NUMBER); ObjectUtils.setObjectProperty(vendorAddress, VendorPropertyConstants.VENDOR_FAX_NUMBER, type, vendorFaxNumber); } catch (FormatException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { vendorAddress.setVendorFaxNumber(null); LOG.error("setVendorFaxNumberValue: Vendor Fax Number cannot be set due to exception: " + e.getMessage(), e); } }
Source:
<code>public ServiceStatus getStatus(Coordinate coordinate) throws CloudnameException { String statusPath = ZkCoordinatePath.getStatusPath(coordinate); <START> ZkCoordinateData zkCoordinateData = ZkCoordinateData.loadCoordianteData(statusPath, getZk(), null); <END> return zkCoordinateData.snapshot().getServiceStatus(); }</code><technical_language>Coordiante is a typo</technical_language>

Target:
public ServiceStatus getStatus(Coordinate coordinate) throws CloudnameException { String statusPath = ZkCoordinatePath.getStatusPath(coordinate); ZkCoordinateData zkCoordinateData = ZkCoordinateData.loadCoordinateData(statusPath, getZk(), null); return zkCoordinateData.snapshot().getServiceStatus(); }
Source:
<code>protected void executeQueryCommand() { List<AuthenticationProfile> profiles = AuthenticationProfileRepository.getInstance().getProfiles(); List<ProfileEntry> names = new ArrayList<>(profiles.size()); for (AuthenticationProfile profile : profiles) { names.add(new ProfileEntry(profile.getName(), AuthzUtils.getName(profile.getAuthz()))); } Collections.sort(names, new Comparator<ProfileEntry>() { @Override public int compare(ProfileEntry lhs, ProfileEntry rhs) { <START> return lhs.getProfile().compareTo(rhs.getProfile()) == 0 ? <END> lhs.getProfile().compareTo(rhs.getProfile()) : lhs.getAuthz().compareTo(rhs.getAuthz()); } }); getQueryReturnValue().setReturnValue(names); }</code><technical_language>this != ? :-)</technical_language>

Target:
protected void executeQueryCommand() { List<AuthenticationProfile> profiles = AuthenticationProfileRepository.getInstance().getProfiles(); List<ProfileEntry> names = new ArrayList<>(profiles.size()); for (AuthenticationProfile profile : profiles) { names.add(new ProfileEntry(profile.getName(), AuthzUtils.getName(profile.getAuthz()))); } Collections.sort(names, new Comparator<ProfileEntry>() { @Override public int compare(ProfileEntry lhs, ProfileEntry rhs) { return lhs.getProfile().compareTo(rhs.getProfile()) != 0 ? lhs.getProfile().compareTo(rhs.getProfile()) : lhs.getAuthz().compareTo(rhs.getAuthz()); } }); getQueryReturnValue().setReturnValue(names); }
Source:
<code>private void initAssets() { <START> BlockFamilyRegistryImpl familyFactoryRegistry = new BlockFamilyRegistryImpl(); <END> rootContext.put(BlockFamilyRegistry.class, familyFactoryRegistry); assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, false, "prefabs"); assetTypeManager.registerCoreAssetType(BlockShape.class, (AssetFactory<BlockShape, BlockShapeData>) BlockShapeImpl::new, "shapes"); assetTypeManager.registerCoreAssetType(BlockSounds.class, (AssetFactory<BlockSounds, BlockSoundsData>) BlockSounds::new, "blockSounds"); assetTypeManager.registerCoreAssetType(BlockTile.class, (AssetFactory<BlockTile, TileData>) BlockTile::new, "blockTiles"); assetTypeManager.registerCoreAssetType(BlockFamilyDefinition.class, (AssetFactory<BlockFamilyDefinition, BlockFamilyDefinitionData>) BlockFamilyDefinition::new, "blocks"); assetTypeManager.registerCoreFormat(BlockFamilyDefinition.class, new BlockFamilyDefinitionFormat(assetTypeManager.getAssetManager(), familyFactoryRegistry)); assetTypeManager.registerCoreAssetType(UISkin.class, (AssetFactory<UISkin, UISkinData>) UISkin::new, "skins"); assetTypeManager.registerCoreAssetType(BehaviorTree.class, (AssetFactory<BehaviorTree, BehaviorTreeData>) BehaviorTree::new, false, "behaviors"); assetTypeManager.registerCoreAssetType(UIElement.class, (AssetFactory<UIElement, UIData>) UIElement::new, "ui"); for (EngineSubsystem subsystem : allSubsystems) { subsystem.registerCoreAssetTypes(assetTypeManager); } }</code><technical_language>Is important this is Impl</technical_language>

Target:
private void initAssets() { BlockFamilyRegistry familyFactoryRegistry = new BlockFamilyRegistry(); rootContext.put(BlockFamilyRegistry.class, familyFactoryRegistry); assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, false, "prefabs"); assetTypeManager.registerCoreAssetType(BlockShape.class, (AssetFactory<BlockShape, BlockShapeData>) BlockShapeImpl::new, "shapes"); assetTypeManager.registerCoreAssetType(BlockSounds.class, (AssetFactory<BlockSounds, BlockSoundsData>) BlockSounds::new, "blockSounds"); assetTypeManager.registerCoreAssetType(BlockTile.class, (AssetFactory<BlockTile, TileData>) BlockTile::new, "blockTiles"); assetTypeManager.registerCoreAssetType(BlockFamilyDefinition.class, (AssetFactory<BlockFamilyDefinition, BlockFamilyDefinitionData>) BlockFamilyDefinition::new, "blocks"); assetTypeManager.registerCoreFormat(BlockFamilyDefinition.class, new BlockFamilyDefinitionFormat(assetTypeManager.getAssetManager(), familyFactoryRegistry)); assetTypeManager.registerCoreAssetType(UISkin.class, (AssetFactory<UISkin, UISkinData>) UISkin::new, "skins"); assetTypeManager.registerCoreAssetType(BehaviorTree.class, (AssetFactory<BehaviorTree, BehaviorTreeData>) BehaviorTree::new, false, "behaviors"); assetTypeManager.registerCoreAssetType(UIElement.class, (AssetFactory<UIElement, UIData>) UIElement::new, "ui"); for (EngineSubsystem subsystem : allSubsystems) { subsystem.registerCoreAssetTypes(assetTypeManager); } }
Source:
<code>protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); <START> if (this.patrolTarget != null) { <END> this.targetPosition().map(Value::asImmutable).ifPresent(vanillaValues::add); } vanillaValues.add(this.leader().asImmutable()); vanillaValues.add(this.patrolling().asImmutable()); return vanillaValues; }</code><technical_language>need add Optional<Value<Something>> Entity interfaces Values exist DataProvider system call instead</technical_language>

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.leader().asImmutable()); values.add(this.patrolling().asImmutable()); this.targetPosition().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
<code>private static boolean equalsTwoArray(byte[][] byte1, byte[][] byte2) { <START> if (byte1.length != byte2.length) { <END> return false; } for (int i = 0; i < byte1.length; i++) { if (byte1[i].length != byte2[i].length) { return false; } for (int j = 0; j < byte1[i].length; j++) { if (byte1[i][j] != byte2[i][j]) { return false; } } } return true; }</code><technical_language>Do need check Null of input parameters</technical_language>

Target:
private static boolean equalsTwoArray(byte[][] byte1, byte[][] byte2) { if (byte1 == null && byte2 == null) { return true; } if ((byte1 == null && byte2 != null) || (byte1 != null && byte2 == null)) { return false; } if (byte1.length != byte2.length) { return false; } for (int i = 0; i < byte1.length; i++) { if (byte1[i].length != byte2[i].length) { return false; } for (int j = 0; j < byte1[i].length; j++) { if (byte1[i][j] != byte2[i][j]) { return false; } } } return true; }
Source:
<code>private void initPlateauSlider() { GeneratorPrefs generatorPrefs = preferencesService.getPreferences().getGeneratorPrefs(); double plateauDensityProperty = generatorPrefs.getPlateauDensityProperty(); boolean plateauRandomProperty = generatorPrefs.getPlateauRandomProperty(); plateauSlider.setLabelFormatter(getLabelConverter()); plateauRandom.setSelected(plateauRandomProperty); <START> plateauRandom.selectedProperty().addListener(((observable, oldValue, newValue) -> { generatorPrefs.setPlateauRandomProperty(newValue); plateauBox.setVisible(!newValue); })); <END> plateauBox.setVisible(!plateauRandomProperty); plateauSlider.setValue(plateauDensityProperty); plateauSlider.valueProperty().addListener(((observable, oldValue, newValue) -> { generatorPrefs.setPlateauDensityProperty(newValue.intValue()); preferencesService.storeInBackground(); })); }</code><technical_language>Bindings :D</technical_language>

Target:
private void initPlateauSlider() { GeneratorPrefs generatorPrefs = preferencesService.getPreferences().getGeneratorPrefs(); double plateauDensityProperty = generatorPrefs.getPlateauDensityProperty(); boolean plateauRandomProperty = generatorPrefs.getPlateauRandomProperty(); plateauSlider.setLabelFormatter(getLabelConverter()); plateauRandom.setSelected(plateauRandomProperty); plateauSlider.setValue(plateauDensityProperty); plateauSliderBox.visibleProperty().bind(plateauRandom.selectedProperty().not()); generatorPrefs.plateauDensityPropertyProperty().bind(plateauSlider.valueProperty()); generatorPrefs.plateauRandomPropertyProperty().bind(plateauRandom.selectedProperty()); plateauSliderBox.disableProperty().bind(Bindings.isNotEmpty(previousMapName.textProperty())); plateauRandomBox.disableProperty().bind(Bindings.isNotEmpty(previousMapName.textProperty())); }
Source:
<code><START> public void serialize(OutputStream output) throws IOException { <END> writeInteger(library.size(), output); for(SongMetadata metadata : library) { writeString(String.valueOf(metadata.getId()), output); writeString(metadata.getTitle(), output); writeString(metadata.getArtist(), output); writeString(metadata.getAlbum(), output); writeString(metadata.getUsername(), output); } }</code><technical_language>This break if a property is set</technical_language>

Target:
public void serialize(OutputStream output) throws IOException { writeInteger(library.size(), output); for(SongMetadata metadata : library) { writeLong(metadata.getId(), output); writeString(metadata.getTitle(), output); writeString(metadata.getArtist(), output); writeString(metadata.getAlbum(), output); writeString(metadata.getUsername(), output); } }
Source:
<code>public void testCommandOverride() throws SQLException { <START> PostgreSQLContainer postgres = (PostgreSQLContainer) new PostgreSQLContainer().withCommand("postgres -c max_connections=42"); <END> postgres.start(); try { ResultSet resultSet = performQuery(postgres,"SELECT current_setting('max_connections')"); String result = resultSet.getString(1); assertEquals("max_connections should be overriden", "42", result); } finally { postgres.stop(); } }</code><technical_language>need for cast here, right</technical_language>

Target:
public void testCommandOverride() throws SQLException { try (PostgreSQLContainer postgres = new PostgreSQLContainer<>().withCommand("postgres -c max_connections=42")) { postgres.start(); ResultSet resultSet = performQuery(postgres, "SELECT current_setting('max_connections')"); String result = resultSet.getString(1); assertEquals("max_connections should be overriden", "42", result); } }
Source:
<code>protected boolean checkDisksNotInBackupStorage() { for (Disk disk : getVm().getDiskMap().values()) { StorageDomainStatic destDomain = storageDomainStaticDao.get(disk.getId()); <START> if (destDomain.isBackup() == true) { <END> return false; } } return true; }</code><technical_language>need for == true</technical_language>

Target:
protected boolean checkDisksNotInBackupStorage() { for (Disk disk : getVm().getDiskMap().values()) { StorageDomainStatic destDomain = storageDomainStaticDao.get(disk.getId()); if (destDomain.isBackup()) { return false; } } return true; }
Source:
<code>public void strobe(int millis, String... lightIdentifiers) { if (!hueFacade.bridgeAvailable()) { throw new EventNotExecutedException("Hue bridge is not available"); } try { hueFacade.strobe(millis, getLightIdentifiers(lightIdentifiers)); } catch (BridgeUnavailableException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>Bad idea. this happen, check bridge is available</technical_language>

Target:
public void strobe(int millis, String... lightIdentifiers) { try { hueFacade.strobe(millis, getLightIdentifiers(lightIdentifiers)); } catch (BridgeUnavailableException e) { throw new EventNotExecutedException(e); } }
Source:
<code>public Response add(Disk disk) { if (QueryHelper.hasMatrixParam(getUriInfo(), UNREGISTERED_CONSTRAINT_PARAMETER)) { GetUnregisteredDiskQueryParameters getDiskParams = new GetUnregisteredDiskQueryParameters( <START> Guid.createGuidFromString(disk.getId()), storageDomainId); <END> VdcQueryReturnValue populateReturn = runQuery(VdcQueryType.GetUnregisteredDisk, getDiskParams); if (populateReturn.getSucceeded()) { DiskImage unregisteredDisk = (DiskImage) populateReturn.getReturnValue(); RegisterDiskParameters registerDiskParams = new RegisterDiskParameters(unregisteredDisk); return performCreate(VdcActionType.RegisterDisk, registerDiskParams, ID_RESOLVER); } else { return handleError(new Exception(populateReturn.getExceptionString()), false); } } else { validateDiskForCreation(disk); AddDiskParameters params = new AddDiskParameters(); params.setDiskInfo(getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class).map( disk, null)); params.setStorageDomainId(this.storageDomainId); return performCreate(VdcActionType.AddDisk, params, ID_RESOLVER); } }</code><technical_language>please asGuid() instead of Guid.createGuidFromString(), - format bad-request-400 if id is convertible in UUID</technical_language>

Target:
public Response add(Disk disk) { if (QueryHelper.hasMatrixParam(getUriInfo(), UNREGISTERED_CONSTRAINT_PARAMETER)) { GetUnregisteredDiskQueryParameters getDiskParams = new GetUnregisteredDiskQueryParameters( asGuid(disk.getId()), storageDomainId, getStoragePoolIdForDomain(storageDomainId)); DiskImage unregisteredDisk = getEntity(DiskImage.class, VdcQueryType.GetUnregisteredDisk, getDiskParams, disk.getId()); RegisterDiskParameters registerDiskParams = new RegisterDiskParameters(unregisteredDisk); return performCreate(VdcActionType.RegisterDisk, registerDiskParams, ID_RESOLVER); } else { validateDiskForCreation(disk); AddDiskParameters params = new AddDiskParameters(); params.setDiskInfo(getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class).map( disk, null)); params.setStorageDomainId(this.storageDomainId); return performCreate(VdcActionType.AddDisk, params, ID_RESOLVER); } }
Source:
<code>public void testUnionDeterminism() throws Exception { assertPlanDeterminismCore("(select a, b, c from ttree_with_key) " + "union (select a, b, c from ttree_with_key order by a, b, c limit 1);", false, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key) " + "union (select a, b, c from ttree_with_key order by a, b, c limit 1) " + "order by a, b, c;", true, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key order by a, b, c limit 1) " + "union (select a, b, c from ttree_with_key);", false, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key order by a, b, c limit 1) " + "union (select a, b, c from ttree_with_key) " + "union (select a, b, c from ttree_with_key);", false, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key order by a, b, c) " + "union (select a, b, c from ttree_with_key order by a, b, c limit 1);", true, true, DeterminismMode.FASTER); <START> assertPlanDeterminismCore("select a from tonecolumn order by abs(a)", <END> false, true, DeterminismMode.FASTER); }</code><technical_language>This non-union test out of place -- turn a union</technical_language>

Target:
public void testUnionDeterminism() throws Exception { assertPlanDeterminismCore("(select a, b, c from ttree_with_key) " + "union (select a, b, c from ttree_with_key order by a, b, c limit 1);", false, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key) " + "union (select a, b, c from ttree_with_key order by a, b, c limit 1) " + "order by a, b, c;", true, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key order by a, b, c limit 1) " + "union (select a, b, c from ttree_with_key);", false, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key order by a, b, c limit 1) " + "union (select a, b, c from ttree_with_key) " + "union (select a, b, c from ttree_with_key);", false, true, DeterminismMode.FASTER); assertPlanDeterminismCore("(select a, b, c from ttree_with_key order by a, b, c) " + "union (select a, b, c from ttree_with_key order by a, b, c limit 1);", true, true, DeterminismMode.FASTER); }
Source:
<code>private String GetLocalStoragesFormattedString() { StringBuilder localStorages = new StringBuilder(""); <START> for (StorageDomain a : Linq.<StorageDomain> cast(getSelectedItems())) <END> { if (a.getStorageType() == StorageType.LOCALFS) { localStorages.append(a.getStorageName()).append(", "); } } return localStorages.substring(0, localStorages.length() - 2); }</code><technical_language>empty string is redundent</technical_language>

Target:
private String GetLocalStoragesFormattedString() { StringBuilder localStorages = new StringBuilder(); for (StorageDomain a : Linq.<StorageDomain> cast(getSelectedItems())) { if (a.getStorageType() == StorageType.LOCALFS) { localStorages.append(a.getStorageName()).append(", "); } } return localStorages.substring(0, localStorages.length() - 2); }
Source:
<code>public void shouldRightReturnNotNull() { <START> assertThat(right(null)).isNotNull(); <END> }</code><technical_language>this if I imported method Either? @danieldietrich, that, is this meant a shortcut for importing API</technical_language>

Target:
public void shouldRightReturnNotNull() { assertThat(Right(null)).isNotNull(); }
Source:
<code>public void testInvalidCallDuringInitialization() throws Exception { dispatcher = createAndStartDispatcher(heartbeatServices, haServices, new ExpectedJobIdJobManagerRunnerFactory(TEST_JOB_ID, createdJobManagerRunnerLatch)); jobMasterLeaderElectionService.isLeader(UUID.randomUUID()); DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class); <START> final BlockingJobVertex blockingJobVertex = new BlockingJobVertex("testVertex"); blockingJobVertex.setInvokableClass(NoOpInvokable.class); JobGraph blockingJobGraph = new JobGraph(TEST_JOB_ID, "blockingTestJob", blockingJobVertex); <END> dispatcherGateway.submitJob(blockingJobGraph, TIMEOUT).get(); CompletableFuture<JobStatus> jobStatusFuture = dispatcherGateway.requestJobStatus(blockingJobGraph.getJobID(), TIMEOUT); Assert.assertEquals(JobStatus.INITIALIZING, jobStatusFuture.get()); boolean exceptionSeen = false; try { dispatcherGateway.triggerSavepoint(blockingJobGraph.getJobID(), "file:/ } catch (ExecutionException t) { Assert.assertTrue(t.getCause() instanceof UnavailableDispatcherOperationException); exceptionSeen = true; } Assert.assertTrue(exceptionSeen); blockingJobVertex.unblock(); }</code><technical_language>Duplicated code. suggest create a method reused</technical_language>

Target:
public void testInvalidCallDuringInitialization() throws Exception { dispatcher = createAndStartDispatcher(heartbeatServices, haServices, new ExpectedJobIdJobManagerRunnerFactory(TEST_JOB_ID, createdJobManagerRunnerLatch)); jobMasterLeaderElectionService.isLeader(UUID.randomUUID()); DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class); Tuple2<JobGraph, BlockingJobVertex> blockingJobGraph = getBlockingJobGraphAndVertex(); JobID jid = blockingJobGraph.f0.getJobID(); dispatcherGateway.submitJob(blockingJobGraph.f0, TIMEOUT).get(); assertThat(dispatcherGateway.requestJobStatus(jid, TIMEOUT).get(), is(JobStatus.INITIALIZING)); try { dispatcherGateway.triggerSavepoint(jid, "file:/ fail("Previous statement should have failed"); } catch (ExecutionException t) { assertTrue(t.getCause() instanceof UnavailableDispatcherOperationException); } blockingJobGraph.f1.unblock(); CommonTestUtils.waitUntilCondition(() -> dispatcherGateway.requestJobStatus(jobGraph.getJobID(), TIMEOUT).get() == JobStatus.RUNNING, Deadline.fromNow(Duration.of(10, ChronoUnit.SECONDS)), 5L); }
Source:
<code>private void initializeProbabilityVector(MatrixLib p) { double[] pi = new double[p.numCols()]; this.logP = new double[p.numCols()]; double sum = 0.0; for (int i = 0; i < p.numCols(); i++) { double ele = p.elementAt(0, i); if (ele < 0) { throw new IllegalArgumentException("Probability " + ele + " for element " + i + " is negative."); } sum += p.elementAt(0, i); } <START> if (sum < 1e-9) { <END> throw new IllegalArgumentException("Probabilities sum to approx zero"); } for (int i = 0; i < p.numCols(); i++) { pi[i] = p.elementAt(0, i) / sum; this.logP[i] = Math.log(pi[i]); } this.p = pi; this.k = this.p.length; this.pCDF = new double[k]; pCDF[0] = this.p[0]; for (int i = 1; i < k; i++) { this.pCDF[i] = pCDF[i - 1] + this.p[i]; } }</code><technical_language>this threshold a global static constant. defined in Util</technical_language>

Target:
private void initializeProbabilityVector(MatrixLib p) { double[] pi = new double[p.numCols()]; this.logP = new double[p.numCols()]; double sum = 0.0; for (int i = 0; i < p.numCols(); i++) { double ele = p.elementAt(0, i); if (ele < 0) { throw new IllegalArgumentException("Probability " + ele + " for element " + i + " is negative."); } sum += p.elementAt(0, i); } if (Util.closeToZero(sum)) { throw new IllegalArgumentException("Probabilities sum to approx zero"); } for (int i = 0; i < p.numCols(); i++) { pi[i] = p.elementAt(0, i) / sum; this.logP[i] = Math.log(pi[i]); } this.p = pi; this.k = this.p.length; this.pCDF = new double[k]; pCDF[0] = this.p[0]; for (int i = 1; i < k; i++) { this.pCDF[i] = pCDF[i - 1] + this.p[i]; } }
Source:
<code>private void init(Object target, Method method) { final Map<Class<? extends Throwable>, Method> types = new HashMap<Class<? extends Throwable>, Method>(); final Method failingMethod = method; Retryable retryable = method.getAnnotation(Retryable.class); <START> this.recoverMethodName = retryable != null ? retryable.recoverName() : ""; <END> ReflectionUtils.doWithMethods(failingMethod.getDeclaringClass(), new MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Recover recover = AnnotationUtils.findAnnotation(method, Recover.class); if (recover != null && method.getReturnType().isAssignableFrom(failingMethod.getReturnType())) { Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length > 0 && Throwable.class.isAssignableFrom(parameterTypes[0])) { @SuppressWarnings("unchecked") Class<? extends Throwable> type = (Class<? extends Throwable>) parameterTypes[0]; types.put(type, method); RecoverAnnotationRecoveryHandler.this.methods.put(method, new SimpleMetadata(parameterTypes.length, type)); } else { RecoverAnnotationRecoveryHandler.this.classifier.setDefaultValue(method); RecoverAnnotationRecoveryHandler.this.methods.put(method, new SimpleMetadata(parameterTypes.length, null)); } } } }); this.classifier.setTypeMap(types); optionallyFilterMethodsBy(failingMethod.getReturnType()); }</code><technical_language>I null default is OK, start a StringUtils.isEmpty() mentioned</technical_language>

Target:
private void init(Object target, Method method) { final Map<Class<? extends Throwable>, Method> types = new HashMap<Class<? extends Throwable>, Method>(); final Method failingMethod = method; Retryable retryable = method.getAnnotation(Retryable.class); if (retryable != null) { this.recoverMethodName = retryable.recover(); } ReflectionUtils.doWithMethods(failingMethod.getDeclaringClass(), new MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Recover recover = AnnotationUtils.findAnnotation(method, Recover.class); if (recover != null && method.getReturnType().isAssignableFrom(failingMethod.getReturnType())) { Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length > 0 && Throwable.class.isAssignableFrom(parameterTypes[0])) { @SuppressWarnings("unchecked") Class<? extends Throwable> type = (Class<? extends Throwable>) parameterTypes[0]; types.put(type, method); RecoverAnnotationRecoveryHandler.this.methods.put(method, new SimpleMetadata(parameterTypes.length, type)); } else { RecoverAnnotationRecoveryHandler.this.classifier.setDefaultValue(method); RecoverAnnotationRecoveryHandler.this.methods.put(method, new SimpleMetadata(parameterTypes.length, null)); } } } }); this.classifier.setTypeMap(types); optionallyFilterMethodsBy(failingMethod.getReturnType()); }
Source:
<code>private String getListingOfDex(@Nonnull File dex) throws IOException { assert dex.isFile(); StringBuilder sb = new StringBuilder(); for (ClassDef def : new DexBuffer(dex).classDefs()) { String <START> typeName = <END> def.getTypeName(); sb.append(typeName); sb.append(":"); sb.append(TextUtils.LINE_SEPARATOR); } return sb.toString(); }</code><technical_language>nit: useful LV</technical_language>

Target:
private String getListingOfDex(@Nonnull File dex) throws IOException { assert dex.isFile(); StringBuilder sb = new StringBuilder(); for (ClassDef def : new DexBuffer(dex).classDefs()) { sb.append(def.getTypeName()); sb.append(":"); sb.append(TextUtils.LINE_SEPARATOR); } return sb.toString(); }
Source:
<code>private boolean handleLibvirtSecrets(CommandContext cmdContext, VDS vds, Guid poolId) { List<LibvirtSecret> libvirtSecrets = DbFacade.getInstance().getLibvirtSecretDao().getAllByStoragePoolIdFilteredByActiveStorageDomains(poolId); <START> if (!libvirtSecrets.isEmpty() && !registerLibvirtSecretsImpl(vds, libvirtSecrets, false)) { <END> setNonOperational(cmdContext, vds.getId(), NonOperationalReason.LIBVIRT_SECRETS_REGISTRATION_FAILURE); return false; } return true; }</code><technical_language>If remove log line 223, please add this</technical_language>

Target:
private boolean handleLibvirtSecrets(CommandContext cmdContext, VDS vds, Guid poolId) { List<LibvirtSecret> libvirtSecrets = DbFacade.getInstance().getLibvirtSecretDao().getAllByStoragePoolIdFilteredByActiveStorageDomains(poolId); if (!libvirtSecrets.isEmpty() && !registerLibvirtSecretsImpl(vds, libvirtSecrets, false)) { log.error("Failed to register libvirt secret on vds {}.", vds.getName()); setNonOperational(cmdContext, vds.getId(), NonOperationalReason.LIBVIRT_SECRETS_REGISTRATION_FAILURE); return false; } return true; }
Source:
<code>public void nullableStringFromNull() { <START> assertThat(InternalQueries.nullableString(null)).isEqualTo(null); <END> }</code><technical_language>isNull()</technical_language>

Target:
public void nullableStringFromNull() { assertThat(InternalQueries.nullableString(null)).isNull(); }
Source:
<code>public void testGenerateNewMetaGlobalSomePersisted() throws Exception { final MockGlobalSessionCallback callback = new MockGlobalSessionCallback(); final GlobalSession session = new MockPrefsGlobalSession(SyncConfiguration.DEFAULT_USER_API, TEST_CLUSTER_URL, TEST_USERNAME, TEST_PASSWORD, null, new KeyBundle(TEST_USERNAME, TEST_SYNC_KEY), callback, null, null, null); session.config.enabledEngineNames = new HashSet<String>(); session.config.enabledEngineNames.add("bookmarks"); session.config.enabledEngineNames.add("clients"); session.config.enabledEngineNames.add("addons"); session.config.enabledEngineNames.add("prefs"); MetaGlobal mg = session.generateNewMetaGlobal(); assertEquals(new Long(GlobalSession.STORAGE_VERSION), mg.getStorageVersion()); List<String> namesList = new ArrayList<String>(mg.getEnabledEngineNames()); <START> Collections.sort(namesList); <END> String[] names = namesList.toArray(new String[namesList.size()]); String[] expected = new String[] { "addons", "bookmarks", "clients", "prefs" }; assertArrayEquals(expected, names); assertEquals(GlobalSession.BOOKMARKS_ENGINE_VERSION, mg.getEngines().getObject("bookmarks").getIntegerSafely("version").intValue()); assertEquals(GlobalSession.CLIENTS_ENGINE_VERSION, mg.getEngines().getObject("clients").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("addons").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("prefs").getIntegerSafely("version").intValue()); }</code><technical_language>get some blank lines, pretty please? :D</technical_language>

Target:
public void testGenerateNewMetaGlobalSomePersisted() throws Exception { final MockGlobalSessionCallback callback = new MockGlobalSessionCallback(); final GlobalSession session = new MockPrefsGlobalSession(SyncConfiguration.DEFAULT_USER_API, TEST_CLUSTER_URL, TEST_USERNAME, TEST_PASSWORD, null, new KeyBundle(TEST_USERNAME, TEST_SYNC_KEY), callback, null, null, null); session.config.enabledEngineNames = new HashSet<String>(); session.config.enabledEngineNames.add("bookmarks"); session.config.enabledEngineNames.add("clients"); session.config.enabledEngineNames.add("addons"); session.config.enabledEngineNames.add("prefs"); MetaGlobal mg = session.generateNewMetaGlobal(); assertEquals(new Long(GlobalSession.STORAGE_VERSION), mg.getStorageVersion()); assertEquals(VersionConstants.BOOKMARKS_ENGINE_VERSION, mg.getEngines().getObject("bookmarks").getIntegerSafely("version").intValue()); assertEquals(VersionConstants.CLIENTS_ENGINE_VERSION, mg.getEngines().getObject("clients").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("addons").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("prefs").getIntegerSafely("version").intValue()); List<String> namesList = new ArrayList<String>(mg.getEnabledEngineNames()); Collections.sort(namesList); String[] names = namesList.toArray(new String[namesList.size()]); String[] expected = new String[] { "addons", "bookmarks", "clients", "prefs" }; assertArrayEquals(expected, names); }
Source:
<code>public Builder setTimes(final int minTimeParam, final int maxTimeParam) { if (times) { throw new IllegalStateException("Times quantifier is already set!"); } if (minTimeParam > maxTimeParam) { throw new IllegalStateException("min time should be less than or equal to max time!"); } if (minTimeParam < 0 || maxTimeParam < 0) { <START> throw new IllegalStateException("Min time and Max time should be positive!"); <END> } times = true; minTimes = minTimeParam; maxTimes = maxTimeParam; return this; }</code><technical_language>I IllegalArgument exception, IllegalStateException</technical_language>

Target:
public Builder setTimes(final int minTimeParam, final int maxTimeParam) { if (times) { throw new IllegalStateException("Times quantifier is already set!"); } if (minTimeParam > maxTimeParam) { throw new IllegalArgumentException("min time should be less than or equal to max time!"); } if (minTimeParam < 0 || maxTimeParam < 0) { throw new IllegalArgumentException("Min time and Max time should be positive!"); } times = true; minTimes = minTimeParam; maxTimes = maxTimeParam; return this; }
Source:
<code>protected void replaceJavaOptIfExists(String prefix, String value) { <START> for (int i = 0; i < javaOpts.size(); i++) { <END> if (javaOpts.get(i).startsWith(prefix)) { javaOpts.remove(i); } } javaOpts.add(prefix + value); }</code><technical_language>removeJavaOptIfExists method</technical_language>

Target:
protected void replaceJavaOptIfExists(String prefix, String value) { removeJavaOptIfExists(prefix); javaOpts.add(prefix + value); }
Source:
<code>public void tearDown() { ParseObject.unregisterSubclass(ParseInstallation.class); ParseCorePlugins.getInstance().reset(); <START> ParsePlugins.reset(); <END> }</code><technical_language>Set default Locale</technical_language>

Target:
public void tearDown() { ParseObject.unregisterSubclass(ParseInstallation.class); ParseCorePlugins.getInstance().reset(); ParsePlugins.reset(); Locale.setDefault(defaultLocale); }
Source:
<code>public void testFSCacheUpdateWithHostName() { final URI newRepo = URI.create("git://repo-name"); provider.addHostName("ssh", "localhost:8080/git"); final FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); JGitFileSystemsCache fileSystemsCache = provider.getFsManager().getFsCache(); final FileSystem fileSystem = fileSystemsCache.get("repo-name"); assertThat(fileSystem).isNotNull(); assertThat(checkProtocolPresent(fileSystem.toString(), "ssh")).isEqualTo(true); assertThat(checkProtocolPresent(fileSystem.toString(), "http")).isEqualTo(false); provider.addHostName("http", "localhost:8080/git"); final FileSystem fileSystem1 = fileSystemsCache.get("repo-name"); assertThat(fileSystem1).isNotNull(); assertThat(checkProtocolPresent(fileSystem1.toString(), "http")).isEqualTo(false); assertThat(fileSystemsCache.getFileSystems().size()).isEqualTo(1); provider.updateCacheWithHostNames(); final FileSystem fileSystem2 = fileSystemsCache.get("repo-name"); assertThat(fileSystem2).isNotNull(); <START> assertThat(checkProtocolPresent(fileSystem2.toString(), "http")).isEqualTo(true); <END> assertThat(fileSystemsCache.getFileSystems().size()).isEqualTo(1); }</code><technical_language>assertTrue() instead of assertThat().isEqualTo(true)</technical_language>

Target:
public void testFSCacheUpdateWithHostName() { final URI newRepo = URI.create("git://repo-name"); provider.addHostName("ssh", "localhost:8080/git"); provider.newFileSystem(newRepo, EMPTY_ENV); JGitFileSystemsCache fileSystemsCache = provider.getFsManager().getFsCache(); final FileSystem fileSystem = fileSystemsCache.get("repo-name"); assertThat(fileSystem).isNotNull(); assertTrue(checkProtocolPresent(fileSystem.toString(), "ssh")); assertFalse(checkProtocolPresent(fileSystem.toString(), "http")); provider.addHostName("http", "localhost:8080/git"); final FileSystem fileSystem1 = fileSystemsCache.get("repo-name"); assertThat(fileSystem1).isNotNull(); assertFalse(checkProtocolPresent(fileSystem1.toString(), "http")); assertThat(fileSystemsCache.getFileSystems().size()).isOne(); provider.updateCacheWithHostNames(); final FileSystem fileSystem2 = fileSystemsCache.get("repo-name"); assertThat(fileSystem2).isNotNull(); assertTrue(checkProtocolPresent(fileSystem2.toString(), "http")); assertThat(fileSystemsCache.getFileSystems().size()).isOne(); }
Source:
<code>public <T extends GlowEntity> T spawn(Location location, T entity, SpawnReason reason) throws IllegalArgumentException { checkNotNull(entity).setRawLocation(location, false); checkNotNull(reason); checkNotNull(location); try { EntitySpawnEvent spawnEvent = null; if (entity instanceof LivingEntity) { spawnEvent = EventFactory.getInstance() .callEvent(new CreatureSpawnEvent((LivingEntity) entity, reason)); } else if (!(entity instanceof Item)) { spawnEvent = EventFactory.getInstance().callEvent(new EntitySpawnEvent(entity)); } if (spawnEvent != null && spawnEvent.isCancelled()) { entity.remove(); } else { List<Message> spawnMessage = entity.createSpawnMessage(); final GlowEntity finalEntity = entity; getRawPlayers().stream().filter(player -> player.canSeeEntity(finalEntity)) .forEach(player -> player.getSession().sendAll(spawnMessage .toArray(new Message[spawnMessage.size()]))); } <START> } catch (NoSuchMethodError | IllegalAccessError e) { <END> GlowServer.logger.log(Level.WARNING, "Invalid entity spawn: ", e); } catch (Throwable t) { GlowServer.logger.log(Level.SEVERE, "Unable to spawn entity: ", t); } return entity; }</code><technical_language>thrown</technical_language>

Target:
public <T extends GlowEntity> T spawn(Location location, T entity, SpawnReason reason) throws IllegalArgumentException { checkNotNull(entity).setRawLocation(location, false); checkNotNull(reason); checkNotNull(location); try { EntitySpawnEvent spawnEvent = null; if (entity instanceof LivingEntity) { spawnEvent = EventFactory.getInstance() .callEvent(new CreatureSpawnEvent((LivingEntity) entity, reason)); } else if (!(entity instanceof Item)) { spawnEvent = EventFactory.getInstance().callEvent(new EntitySpawnEvent(entity)); } if (spawnEvent != null && spawnEvent.isCancelled()) { entity.remove(); } else { List<Message> spawnMessage = entity.createSpawnMessage(); getRawPlayers().stream().filter(player -> player.canSeeEntity(entity)) .forEach(player -> player.getSession().sendAll(spawnMessage .toArray(new Message[spawnMessage.size()]))); } } catch (Throwable t) { GlowServer.logger.log(Level.SEVERE, "Unable to spawn entity: ", t); } return entity; }
Source:
<code>private Collection<ArtifactInfo> asArtifactInfo(Set<SearchResult> results) { Collection<ArtifactInfo> artifactInfos = new LinkedHashSet<>(); for (SearchResult result : results) { artifactInfos.add(new ArtifactInfo(result.getRepositoryId(), <START> ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getGroupId(), <END> ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getArtifactId(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getVersion(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getClassifier(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getExtension())); } return artifactInfos; }</code><technical_language>define a casted variable here, instead this casting</technical_language>

Target:
private Collection<ArtifactInfo> asArtifactInfo(Set<SearchResult> results) { Collection<ArtifactInfo> artifactInfos = new LinkedHashSet<>(); for (SearchResult result : results) { MavenArtifactCoordinates mavenArtifactCoordinates = (MavenArtifactCoordinates) result.getArtifactCoordinates(); artifactInfos.add(new ArtifactInfo(result.getRepositoryId(), mavenArtifactCoordinates.getGroupId(), mavenArtifactCoordinates.getArtifactId(), mavenArtifactCoordinates.getVersion(), mavenArtifactCoordinates.getClassifier(), mavenArtifactCoordinates.getExtension())); } return artifactInfos; }
Source:
<code>public static String onClientChat(EntityPlayerSP sender, String message){ ClientChatEvent event = new ClientChatEvent(sender, message); MinecraftForge.EVENT_BUS.post(event); String newmsg = event.getMessage(); if(event.isCanceled()){ newmsg = null; <START> }else if(newmsg.isEmpty()){ <END> newmsg = null; } return newmsg; }</code><technical_language>need check for null newmsg.isEmpty() call</technical_language>

Target:
public static String onClientChat(EntityPlayerSP sender, String message){ ClientChatEvent event = new ClientChatEvent(sender, message); MinecraftForge.EVENT_BUS.post(event); String newmsg = event.getMessage(); if(event.isCanceled() || Strings.isNullOrEmpty(newmsg)){ newmsg = null; } return newmsg; }
Source:
<code>public void logsMultipleTimesIfAllowedToMultipleTimes() { makeOperationsTakeSpecifiedDuration(LONG_DURATION); for (int i = 0; i < 100; i++) { <START> allowLogging(); <END> profilingTimelockService.lockImmutableTimestamp(); disallowLogging(); profilingTimelockService.lockImmutableTimestamp(); profilingTimelockService.lockImmutableTimestamp(); } verifyLoggerInvokedSpecificNumberOfTimes(100); }</code><technical_language>I this is accumulateLogsWithCall flushLogsWithCall a *lot* clearer</technical_language>

Target:
public void logsMultipleTimesIfAllowedToMultipleTimes() { for (int i = 0; i < 100; i++) { accumulateLogsWithCall(LONG_DURATION, profilingTimelockService::lockImmutableTimestamp); accumulateLogsWithCall(LONG_DURATION, profilingTimelockService::lockImmutableTimestamp); flushLogsWithCall(LONG_DURATION, profilingTimelockService::lockImmutableTimestamp); } verifyLoggerInvokedSpecificNumberOfTimes(100); }
Source:
<code>int serverInitiateHandshake() { this.state = ConnectionState.AWAITING_HANDSHAKE; serverHandler = new NetHandlerPlayServer(scm.getServerInstance(), manager, player) { @Override public void update() { if (NetworkDispatcher.this.state == ConnectionState.FINALIZING) { completeServerSideConnection(ConnectionType.MODDED); } super.update(); } }; this.netHandler = serverHandler; player.playerNetServerHandler = null; this.manager.setConnectionState(EnumConnectionState.PLAY); NBTTagCompound playerNBT = scm.getPlayerNBT(player); if (playerNBT!=null) { int dimension = playerNBT.getInteger("Dimension"); World playerWorld = scm.getServerInstance().worldServerForDimension(dimension); <START> if (playerWorld != null) <END> { return dimension; } } return 0; }</code><technical_language>Dimension manager place ask, this force loads dimension is bad</technical_language>

Target:
int serverInitiateHandshake() { this.state = ConnectionState.AWAITING_HANDSHAKE; serverHandler = new NetHandlerPlayServer(scm.getServerInstance(), manager, player) { @Override public void update() { if (NetworkDispatcher.this.state == ConnectionState.FINALIZING) { completeServerSideConnection(ConnectionType.MODDED); } super.update(); } }; this.netHandler = serverHandler; player.playerNetServerHandler = null; this.manager.setConnectionState(EnumConnectionState.PLAY); NBTTagCompound playerNBT = scm.getPlayerNBT(player); if (playerNBT!=null) { int dimension = playerNBT.getInteger("Dimension"); if (DimensionManager.isDimensionRegistered(dimension)) { return dimension; } } return 0; }
Source:
<code>private void ensureUpdatingProfileExists(String googleId, StudentProfile profileToUpdate) throws EntityDoesNotExistException { <START> if (profileToUpdate == null || JDOHelper.isDeleted(profileToUpdate)) { <END> throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_STUDENT_PROFILE + googleId + ThreadHelper.getCurrentThreadStack()); } }</code><technical_language>Hmm, instead of/other checking here, check this profile entity is retrieved right</technical_language>

Target:
private void ensureUpdatingProfileExists(String googleId, StudentProfile profileToUpdate) throws EntityDoesNotExistException { if (profileToUpdate == null) { throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_STUDENT_PROFILE + googleId + ThreadHelper.getCurrentThreadStack()); } }
Source:
<code><START> protected void delete(Context context, Integer id) { <END> ClaimedTask task = null; try { task = claimedTaskService.find(context, id); XmlWorkflowItem workflowItem = task.getWorkflowItem(); workflowService.deleteClaimedTask(context, workflowItem, task); workflowRequirementsService.removeClaimedUser(context, workflowItem, task.getOwner(), task.getStepID()); context.addEvent(new Event(Event.MODIFY, Constants.ITEM, workflowItem.getItem().getID(), null, itemService.getIdentifiers(context, workflowItem.getItem()))); } catch (SQLException | IOException | WorkflowConfigurationException | AuthorizeException e) { throw new RuntimeException(e.getMessage(), e); } }</code><technical_language>Is this supposed return task pool (no longer claimed)</technical_language>

Target:
protected void delete(Context context, Integer id) { ClaimedTask task = null; try { task = claimedTaskService.find(context, id); if (task == null) { throw new ResourceNotFoundException("ClaimedTask ID " + id + " not found"); } XmlWorkflowItem workflowItem = task.getWorkflowItem(); workflowService.deleteClaimedTask(context, workflowItem, task); workflowRequirementsService.removeClaimedUser(context, workflowItem, task.getOwner(), task.getStepID()); } catch (AuthorizeException e) { throw new RESTAuthorizationException(e); } catch (SQLException | IOException | WorkflowConfigurationException e) { throw new RuntimeException(e.getMessage(), e); } }