auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static Part findPartById(Part searchRoot, long partId) { Stack<Part> partStack = new Stack<>(); partStack.add(searchRoot); while (!partStack.empty()) { Part part = partStack.pop(); if (part instanceof LocalBodyPart) { LocalBodyPart localBodyPart = (LocalBodyPart) part; if (localBodyPart.getId() == partId) { return localBodyPart; } } if (part instanceof LocalMessage) { LocalMessage localMessage = (LocalMessage) part; if (localMessage.getMessagePartId() == partId) { return localMessage; } } if (part instanceof LocalMimeMessage) { LocalMimeMessage localMessage = (LocalMimeMessage) part; if (localMessage.getId() == partId) { return localMessage; } } Body body = part.getBody(); if (body instanceof Multipart) { Multipart innerMultipart = (Multipart) body; for (BodyPart innerPart : innerMultipart.getBodyParts()) { partStack.add(innerPart); } } if (body instanceof MimeMessage) { partStack.add((MimeMessage) body); } } return null; }

Target:
static Part findPartById(Part searchRoot, long partId) { if (searchRoot instanceof LocalMessage) { LocalMessage localMessage = (LocalMessage) searchRoot; if (localMessage.getMessagePartId() == partId) { return localMessage; } } Stack<Part> partStack = new Stack<>(); partStack.add(searchRoot); while (!partStack.empty()) { Part part = partStack.pop(); if (part instanceof LocalPart) { LocalPart localBodyPart = (LocalPart) part; if (localBodyPart.getId() == partId) { return part; } } Body body = part.getBody(); if (body instanceof Multipart) { Multipart innerMultipart = (Multipart) body; for (BodyPart innerPart : innerMultipart.getBodyParts()) { partStack.add(innerPart); } } if (body instanceof Part) { partStack.add((Part) body); } } return null; }
Source:
public void testDs3S3ObjectResponseAddsPagingMember() throws ParseException { final ImmutableList<Ds3Element> elementsList = ImmutableList.of( new Ds3Element("objects", "S3Object", null, false) ); final Ds3Type ds3Type = new Ds3Type("testDs3Type", elementsList); final Struct testStruct = StructConverter.toStruct(ds3Type, ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of()); assertThat(testStruct.getStructMembers().size(), is(2)); boolean foundPaging = false; for (final StructMember sm : testStruct.getStructMembers()) { if (sm.getName().equals("paging") && sm.getType().getTypeName().equals("ds3_paging") && !sm.getType().isPrimitive()) { foundPaging = true; } } assertTrue(foundPaging); }

Target:
public void testDs3S3ObjectResponseAddsPagingMember() throws ParseException { final ImmutableList<Ds3Element> elementsList = ImmutableList.of( new Ds3Element("objects", "S3Object", null, false) ); final Ds3Type ds3Type = new Ds3Type("testDs3Type", elementsList); final Struct testStruct = StructConverter.toStruct(ds3Type, ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of()); assertThat(testStruct.getStructMembers().size(), is(2)); assertTrue(testStruct.getStructMembers().stream() .filter(sm -> sm.getName().equals("paging")) .filter(sm -> sm.getType().getTypeName().equals("ds3_paging")) .anyMatch(sm -> !sm.getType().isPrimitive())); }
Source:
public int[] compute(final LienzoLayer layer, final CanvasExportSettings settings) { final int[] result = new int[2]; if (settings.hasSize()) { result[0] = settings.getWide(); result[1] = settings.getHigh(); } else { final Bounds bounds = LienzoLayerUtils.computeBounds(layer); result[0] = (int) (bounds.getX() + bounds.getWidth()); result[1] = (int) (bounds.getY() + bounds.getHeight()); } return new int[]{result[0] + PADDING, result[1] + PADDING}; }

Target:
public int[] compute(final LienzoLayer layer, final CanvasExportSettings settings) { final int[] result = new int[4]; final Bounds bounds = LienzoLayerUtils.computeBounds(layer); result[0] = (int) bounds.getX(); result[1] = (int) bounds.getY(); if (settings.hasSize()) { result[2] = settings.getWide(); result[3] = settings.getHigh(); } else { result[2] = Math.round((float) (bounds.getX() + bounds.getWidth())); result[3] = Math.round((float) (bounds.getY() + bounds.getHeight())); } return new int[]{result[0], result[1], result[2] + PADDING, result[3] + PADDING}; }
Source:
public static synchronized void setCompressionFactory(final CompressorFactory compFactory) { Preconditions.checkNotNull(compFactory, "Compressor Factory cannot be null"); if (null != compressorFactory) { compressorFactory.close(); } compressorFactory = compFactory; }

Target:
public static void setCompressionFactory(final CompressorFactory compFactory) { Objects.requireNonNull(compFactory, "Compressor Factory cannot be null"); if (null != compressorFactory.get()) { compressorFactory.get().close(); } compressorFactory.set(compFactory); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArcGISScene scene = new ArcGISScene(); scene.setBasemap(Basemap.createImagery()); mSceneView = findViewById(R.id.sceneView); mSceneView.setScene(scene); Surface surface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource("R.string.elevation_image_service"); surface.getElevationSources().add(elevationSource); scene.setBaseSurface(surface); Camera camera = new Camera(64.416919, -14.483728, 100, 318, 105, 0); mSceneView.setViewpointCamera(camera); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArcGISScene scene = new ArcGISScene(); scene.setBasemap(Basemap.createImagery()); mSceneView = findViewById(R.id.sceneView); mSceneView.setScene(scene); Surface surface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(getString(R.string.elevation_image_service)); surface.getElevationSources().add(elevationSource); scene.setBaseSurface(surface); Camera camera = new Camera(64.416919, -14.483728, 100, 318, 105, 0); mSceneView.setViewpointCamera(camera); }
Source:
public int countChargesAwaitingCaptureRetry(Duration notAttemptedWithin) { String query = "SELECT count(c) FROM ChargeEntity c WHERE (c.status=:captureApprovedStatus OR c.status=:captureApprovedRetryStatus)"+ "AND EXISTS (" + " SELECT ce FROM ChargeEventEntity ce WHERE " + " ce.chargeEntity = c AND " + " ce.status = :eventStatus AND " + " ce.updated >= :cutoffDate " + ") "; Number count = (Number) entityManager.get() .createQuery(query) .setParameter("captureApprovedStatus", CAPTURE_APPROVED.getValue()) .setParameter("captureApprovedRetryStatus", CAPTURE_APPROVED_RETRY.getValue()) .setParameter("eventStatus", CAPTURE_APPROVED_RETRY) .setParameter("cutoffDate", ZonedDateTime.now().minus(notAttemptedWithin)) .getSingleResult(); return count.intValue(); }

Target:
public int countChargesAwaitingCaptureRetry(Duration notAttemptedWithin) { String query = "SELECT count(c) FROM ChargeEntity c WHERE c.status=:captureApprovedRetryStatus "+ "AND EXISTS (" + " SELECT ce FROM ChargeEventEntity ce WHERE " + " ce.chargeEntity = c AND " + " ce.status = :eventStatus AND " + " ce.updated >= :cutoffDate " + ") "; Number count = (Number) entityManager.get() .createQuery(query) .setParameter("captureApprovedRetryStatus", CAPTURE_APPROVED_RETRY.getValue()) .setParameter("eventStatus", CAPTURE_APPROVED_RETRY) .setParameter("cutoffDate", ZonedDateTime.now().minus(notAttemptedWithin)) .getSingleResult(); return count.intValue(); }
Source:
protected final void releaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase) { boolean isOptimistic = !isPessimisticLocking && !isTotalOrder; if (committedInOnePhase && isOptimistic) return; final GlobalTransaction gtx = localTransaction.getGlobalTransaction(); txTable.removeLocalTransaction(localTransaction); if (isClustered()) { removeTransactionInfoRemotely(localTransaction, gtx); } }

Target:
protected final void releaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase) { final GlobalTransaction gtx = localTransaction.getGlobalTransaction(); txTable.removeLocalTransaction(localTransaction); log.tracef("Committed in onePhase? %s isOptimistic? %s", committedInOnePhase, isOptimisticCache()); if (committedInOnePhase && isOptimisticCache()) return; if (isClustered()) { removeTransactionInfoRemotely(localTransaction, gtx); } }
Source:
static String copyZipLocation(String sourceZipLocation, String targetZipName) throws IOException { TestPlugin plugin = TestPlugin.getDefault(); if (plugin == null) { throw new IllegalStateException("TestPlugin default reference is null"); } URL fullPathString = plugin.getBundle().getResource(WS_DATA_PREFIX + "/" + sourceZipLocation + ".zip"); URI fileURI = null; try { fileURI = FileLocator.resolve(fullPathString).toURI(); } catch (URISyntaxException e) { throw new IllegalArgumentException(); } File origin = new File(fileURI); if (!origin.exists()) { throw new IllegalArgumentException(); } File destination = new File(FileSystemHelper.getRandomLocation(FileSystemHelper.getTempDir()).toOSString() + File.separator + targetZipName + ".zip"); FileTool.copy(origin, destination); return destination.getAbsolutePath(); }

Target:
static String copyZipLocation(String sourceZipLocation, String targetZipName) throws IOException { TestPlugin plugin = TestPlugin.getDefault(); File origin = FileTool.getFileInPlugin(plugin, new Path(WS_DATA_PREFIX + "/" + sourceZipLocation + ".zip")); File destination = new File(FileSystemHelper.getRandomLocation(FileSystemHelper.getTempDir()).toOSString() + File.separator + targetZipName + ".zip"); FileTool.copy(origin, destination); return destination.getAbsolutePath(); }
Source:
public Map<String, String> load(final CollectionResource resource) { return sessionUtils.withReadOnlyTransaction(() -> { final Map<String, String> tags = new HashMap<>(); addTag(tags, MetaTagKey.resourceLabel, Optional.ofNullable(resource.getInterfaceLabel()).orElse(null)); if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_NODE)) { String nodeCriteria = getNodeCriteriaFromResource(resource); mapNode(tags, nodeCriteria); } else if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_IF)) { String nodeCriteria = getNodeCriteriaFromResource(resource); if (!Strings.isNullOrEmpty(nodeCriteria)) { mapNode(tags, nodeCriteria); } addTag(tags, MetaTagKey.ifDescr, resource.getInterfaceLabel()); } else if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_LATENCY)) { mapResponseTimeResource(resource, tags); } else { String nodeCriteria = getNodeCriteriaFromResource(resource); if (!Strings.isNullOrEmpty(nodeCriteria)) { mapNode(tags, nodeCriteria); } } return tags; }); }

Target:
public Map<String, String> load(final CollectionResource resource) { return sessionUtils.withReadOnlyTransaction(() -> { final Map<String, String> tags = new HashMap<>(); List<Scope> scopes = new ArrayList<>(); String nodeCriteria = getNodeCriteriaFromResource(resource); Optional<OnmsNode> nodeOptional = getNode(nodeCriteria); if(nodeOptional.isPresent()) { OnmsNode node = nodeOptional.get(); scopes.add(this.entityScopeProvider.getScopeForNode(node.getId())); if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_IF)) { try { int ifIndex = Integer.parseInt(resource.getInstance()); scopes.add(this.entityScopeProvider.getScopeForInterfaceByIfIndex(node.getId(), ifIndex)); } catch(NumberFormatException nfe) { } } } Scope scope = new FallbackScope(scopes); Map<String, String> configuredMetaTags = this.config.getConfiguredMetaTags(); for(Map.Entry<String, String> entry: configuredMetaTags.entrySet()) { final String value = Interpolator.interpolate(entry.getValue(), scope); if (Strings.isNullOrEmpty(value)) { continue; } tags.put(entry.getKey(), value); } nodeOptional.ifPresent(onmsNode -> mapCategories(tags, onmsNode)); return tags; }); }
Source:
public String getDefaultCatalogName() { return defaultCatalogName; }

Target:
protected String getDefaultCatalogName() { return defaultCatalogName; }
Source:
public void doesNotFire() { RuleApplication ruleApplication = applyRule(); if (ruleApplication.result.isPresent()) { fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), inTransaction(session -> PlanPrinter.textLogicalPlan(plan, ruleApplication.types, metadata, costCalculator, session, 2)))); } }

Target:
public void doesNotFire() { RuleApplication ruleApplication = applyRule(); if (ruleApplication.wasRuleApplied()) { fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), inTransaction(session -> PlanPrinter.textLogicalPlan(plan, ruleApplication.types, metadata, costCalculator, session, 2)))); } }
Source:
public void run(final FlowTrigger trigger, Map data) { VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString()); final boolean deleteDataDisk = VmGlobalConfig.DELETE_DATA_VOLUME_ON_VM_DESTROY.value(Boolean.class); if (spec.getVmInventory().getAllVolumes().size() > 1) { detachDataVolumes(spec); } final VmInstanceDeletionPolicy deletionPolicy = (VmInstanceDeletionPolicy) data.get(Params.DeletionPolicy); if (deletionPolicy == VmInstanceDeletionPolicy.DBOnly) { trigger.next(); } List<VolumeDeletionStruct> ctx = CollectionUtils.transformToList(spec.getVmInventory().getAllVolumes(), new Function<VolumeDeletionStruct, VolumeInventory>() { @Override public VolumeDeletionStruct call(VolumeInventory arg) { if (VolumeType.Data.toString().equals(arg.getType()) && !deleteDataDisk) { return null; } VolumeDeletionStruct s = new VolumeDeletionStruct(); s.setInventory(arg); if (VolumeType.Root.toString().equals(arg.getType())) { s.setDeletionPolicy(deletionPolicy.toString()); } return s; } }); final String issuer = VolumeVO.class.getSimpleName(); casf.asyncCascade(CascadeConstant.DELETION_FORCE_DELETE_CODE, issuer, ctx, new Completion(trigger) { @Override public void success() { trigger.next(); } @Override public void fail(ErrorCode errorCode) { trigger.fail(errorCode); } }); }

Target:
public void run(final FlowTrigger trigger, Map data) { VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString()); final boolean deleteDataDisk = VmGlobalConfig.DELETE_DATA_VOLUME_ON_VM_DESTROY.value(Boolean.class); if (spec.getVmInventory().getAllVolumes().size() > 1) { detachDataVolumes(spec); } final VmInstanceDeletionPolicy deletionPolicy = (VmInstanceDeletionPolicy) data.get(Params.DeletionPolicy); if (deletionPolicy == VmInstanceDeletionPolicy.DBOnly) { trigger.next(); return; } List<VolumeDeletionStruct> ctx = CollectionUtils.transformToList(spec.getVmInventory().getAllVolumes(), new Function<VolumeDeletionStruct, VolumeInventory>() { @Override public VolumeDeletionStruct call(VolumeInventory arg) { if (VolumeType.Data.toString().equals(arg.getType()) && !deleteDataDisk) { return null; } VolumeDeletionStruct s = new VolumeDeletionStruct(); s.setInventory(arg); if (VolumeType.Root.toString().equals(arg.getType())) { s.setDeletionPolicy(deletionPolicy.toString()); } return s; } }); final String issuer = VolumeVO.class.getSimpleName(); casf.asyncCascade(CascadeConstant.DELETION_FORCE_DELETE_CODE, issuer, ctx, new Completion(trigger) { @Override public void success() { trigger.next(); } @Override public void fail(ErrorCode errorCode) { trigger.fail(errorCode); } }); }
Source:
public void setUp() throws Exception { setFixture(ModelelementsFactory.eINSTANCE.createElementGroup()); model = SysMLTestResources.createSysMLModel(houseKeeper.createResourceSet()); if(model == null) { fail("The model is not created."); } if(model.getAppliedProfiles().isEmpty()) { fail(" the Sysml profil has not be applied."); } defaultComment= model.createOwnedComment(); default_elementgroup = (ElementGroup)StereotypeApplicationHelper.getInstance(null).applyStereotype(defaultComment, ModelelementsPackage.eINSTANCE.getElementGroup()); defaultComment.setBody(criterion); class1 = model.createOwnedClass("Class1", false); class2 = model.createOwnedClass("Class2", false); defaultComment.getAnnotatedElements().add(class1); defaultComment.getAnnotatedElements().add(class2); }

Target:
public void setUp() { setFixture(ModelelementsFactory.eINSTANCE.createElementGroup()); model = SysMLTestResources.createSysMLModel(houseKeeper.createResourceSet()); if(model.getAppliedProfiles().isEmpty()) { fail(" the Sysml profil has not be applied."); } defaultComment= model.createOwnedComment(); default_elementgroup = (ElementGroup)StereotypeApplicationHelper.getInstance(null).applyStereotype(defaultComment, ModelelementsPackage.eINSTANCE.getElementGroup()); defaultComment.setBody(criterion); class1 = model.createOwnedClass("Class1", false); class2 = model.createOwnedClass("Class2", false); defaultComment.getAnnotatedElements().add(class1); defaultComment.getAnnotatedElements().add(class2); }
Source:
void execute(RevWalk rw, List<Command> todo) throws IOException { if (apply(todo) && nextId != null) { commit(rw); } }

Target:
void execute(RevWalk rw, List<Command> todo) throws IOException { if (apply(todo) && nextId != null) { commit(rw, todo); } }
Source:
public void testGetSuggestedDiskAliasNotNullAliasDisk() { disk.setDiskAlias("someAlias"); assertEquals("existing disk alias was wrongfully overwritten", disk.getDiskAlias(), ImagesHandler.getSuggestedDiskAlias(disk, prefix, 1)); }

Target:
public void testGetSuggestedDiskAliasNotNullAliasDisk() { disk.setDiskAlias("someAlias"); assertEquals("a new alias was generated instead of returning the pre-difined one", disk.getDiskAlias(), ImagesHandler.getSuggestedDiskAlias(disk, prefix, 1)); }
Source:
private IProject getSingleProject() { IProject result= null; for (IPackageFragment fPackageFragment : fPackageFragments) { if (result == null) { result= fPackageFragment.getJavaProject().getProject(); } else if (!result.equals(fPackageFragment.getJavaProject().getProject())) { return null; } } return result; }

Target:
private IProject getSingleProject() { IProject result= null; for (IPackageFragment pack : fPackageFragments) { if (result == null) { result= pack.getJavaProject().getProject(); } else if (!result.equals(pack.getJavaProject().getProject())) { return null; } } return result; }
Source:
public CompletableFuture<List<SnapshotDescription>> listSnapshots() { throw new UnsupportedOperationException("updateConfiguration"); }

Target:
public CompletableFuture<List<SnapshotDescription>> listSnapshots() { throw new UnsupportedOperationException("listSnapshots"); }
Source:
public void testLayoutUnregister() throws Exception { LayoutDefinition l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); deployContrib("org.nuxeo.ecm.platform.forms.layout.core.tests", "layouts-core-test-override-contrib.xml"); applyInlineDeployments(); postSetUp(); l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(0, l.getRows().length); removeInlineDeployments(); postSetUp(); l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); }

Target:
public void testLayoutUnregister() throws Exception { LayoutDefinition l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); pushInlineDeployments("org.nuxeo.ecm.platform.forms.layout.core.tests:layouts-core-test-override-contrib.xml"); l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(0, l.getRows().length); removeInlineDeployments(); l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); }
Source:
public Intent getSendIntentWithSubject(Context context) { if (context != null && mSendIntent != null && mSendIntent.getStringExtra(Intent.EXTRA_SUBJECT) != null) { if (getClient() == null || getClient().getCredentials().getUsername() == null) { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString(R.string.subject_shared_with_you, mFileName) ); } else { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString( R.string.subject_user_shared_with_you, getClient().getCredentials().getUsername(), mFileName ) ); } } return mSendIntent; }

Target:
public Intent getSendIntentWithSubject(Context context) { if (context != null && mSendIntent != null && mSendIntent.getStringExtra(Intent.EXTRA_SUBJECT) != null) { if (getClient() == null || getClient().getCredentials() == null || getClient().getCredentials().getUsername() == null) { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString(R.string.subject_shared_with_you, mFileName) ); } else { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString( R.string.subject_user_shared_with_you, getClient().getCredentials().getUsername(), mFileName ) ); } } return mSendIntent; }
Source:
void pause() throws StoreException, IOException { hardDeleteLock.lock(); try { if (paused.compareAndSet(false, true)) { logger.info("HardDelete thread has been paused "); index.persistIndex(); } } finally { hardDeleteLock.unlock(); } }

Target:
void pause() throws StoreException, IOException { hardDeleteLock.lock(); try { if (paused.compareAndSet(false, true)) { logger.info("HardDelete thread has been paused "); index.persistIndex(); persistFileLock.lock(); try { pruneHardDeleteRecoveryRange(); persistCleanupToken(); } finally { persistFileLock.unlock(); } } } finally { hardDeleteLock.unlock(); } }
Source:
private void createDllFromWsdl() throws MojoExecutionException { getLog().info("Execute WSDl to cs command"); wsdlCommand(); getLog().info("Execute cs to dll command"); cscCommand(); if (generateNugetPackage) { if (!windowsModus) { throw new MojoExecutionException( "At this point, mono and nuget does not work so well together." + "Please execute the plugin with nuget"); } nugetLib = nugetFolder + "lib"; getLog().info("Create Nuget folder structure"); createNugetStructure(); getLog().info("Copy the dlls to the nuget structure"); copyFilesToNuget(); getLog().info("Generate " + namespace + " .nuspec"); generateNugetPackedFile(); getLog().info("Pack .nuspec to a nuget package"); nugetPackCommand(); } }

Target:
private void createDllFromWsdl() throws MojoExecutionException { getLog().info("Execute WSDl to cs command"); wsdlCommand(); getLog().info("Execute cs to dll command"); cscCommand(); if (generateNugetPackage) { if (isLinux()) { throw new MojoExecutionException( "At this point, mono and nuget does not work so well together." + "Please execute the plugin with nuget under Windows"); } nugetLib = nugetFolder + "lib"; getLog().info("Create Nuget folder structure"); createNugetStructure(); getLog().info("Copy the dlls to the nuget structure"); copyFilesToNuget(); getLog().info("Generate " + namespace + " .nuspec"); generateNugetPackedFile(); getLog().info("Pack .nuspec to a nuget package"); nugetPackCommand(); } }
Source:
protected static EntityResolver defaultResolver() { Hints hints = GeoTools.getDefaultHints(); if( hints != null && hints.containsKey(Hints.ENTITY_RESOLVER)){ Object hint = hints.get(Hints.ENTITY_RESOLVER); if( hint instanceof EntityResolver){ return (EntityResolver) hint; } if( hint instanceof String ){ try { Class<?> type = Class.forName((String)hint); Object value = type.newInstance(); if( value instanceof EntityResolver){ return (EntityResolver) value; } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.log(Level.FINER, "Unable to instanciate ENTITY_RESOLVER: "+ e.getMessage(), e); } } } return PreventLocalEntityResolver.INSTANCE; }

Target:
protected static EntityResolver defaultResolver() { Hints hints = GeoTools.getDefaultHints(); if( hints != null && hints.containsKey(Hints.ENTITY_RESOLVER)){ Object hint = hints.get(Hints.ENTITY_RESOLVER); if( hint instanceof EntityResolver){ return (EntityResolver) hint; } if( hint instanceof String ){ try { Class<?> type = Class.forName((String)hint); Object value = type.newInstance(); if( value instanceof EntityResolver){ return (EntityResolver) value; } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.log(Level.FINER, "Unable to instantiate ENTITY_RESOLVER: "+ e.getMessage(), e); } } } return PreventLocalEntityResolver.INSTANCE; }
Source:
public boolean handleServerHandshake(C00Handshake packet, NetworkManager manager) { if (!shouldAllowPlayerLogins()) { TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText()); manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } if (packet.getRequestedState() == EnumConnectionState.LOGIN && (!NetworkRegistry.INSTANCE.isVanillaAccepted(Side.CLIENT) && !packet.hasFMLMarker())) { manager.setConnectionState(EnumConnectionState.LOGIN); TextComponentString text = new TextComponentString("This server has mods that require FML/Forge to be installed on the client. Contact your server admin for more details."); Collection<String> modNames = NetworkRegistry.INSTANCE.getModNamesThatDoNotAcceptVanilla(Side.CLIENT); FMLLog.log.info("Disconnecting Player: This server has mods that require FML/Forge to be installed on the client:\n{}", modNames); manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } manager.channel().attr(NetworkRegistry.FML_MARKER).set(packet.hasFMLMarker()); return true; }

Target:
public boolean handleServerHandshake(C00Handshake packet, NetworkManager manager) { if (!shouldAllowPlayerLogins()) { TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText()); manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } if (packet.getRequestedState() == EnumConnectionState.LOGIN && (!NetworkRegistry.INSTANCE.isVanillaAccepted(Side.CLIENT) && !packet.hasFMLMarker())) { manager.setConnectionState(EnumConnectionState.LOGIN); TextComponentString text = new TextComponentString("This server has mods that require FML/Forge to be installed on the client. Contact your server admin for more details."); Collection<String> modNames = NetworkRegistry.INSTANCE.getRequiredMods(Side.CLIENT); FMLLog.log.info("Disconnecting Player: This server has mods that require FML/Forge to be installed on the client: {}", modNames); manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } manager.channel().attr(NetworkRegistry.FML_MARKER).set(packet.hasFMLMarker()); return true; }
Source:
public URI writeSchema(Schema schema) { Path previous = newestFile(); Map<Integer, Schema> schemas = getSchemas(); for (Schema oldSchema: schemas.values()) { if (!SchemaValidationUtil.canRead(oldSchema, schema)) { throw new IncompatibleSchemaException("Schema cannot read data " + "written using existing schema. Schema: " + schema.toString(true) + "\nPrevious schema: " + oldSchema.toString(true)); } } Path schemaPath = null; if (previous == null) { schemaPath = new Path(schemaDirectory, "1.avsc"); } else { String previousName = previous.getName() .substring(0, previous.getName().indexOf('.')); int i = Integer.parseInt(previousName) + 1; schemaPath = new Path(schemaDirectory, Integer.toString(i) + ".avsc"); } FSDataOutputStream outputStream = null; boolean threw = true; try { outputStream = rootFileSystem.create(schemaPath, false); outputStream.write(schema.toString(true) .getBytes(Charsets.UTF_8)); outputStream.flush(); threw = false; } catch (IOException e) { throw new DatasetIOException( "Unable to save schema file: " + schemaPath, e); } finally { try { Closeables.close(outputStream, threw); } catch (IOException e) { throw new DatasetIOException("Cannot close", e); } } return schemaPath.toUri(); }

Target:
public URI writeSchema(Schema schema) { Path previousPath = newestFile(); if (previousPath != null) { Schema previousSchema = loadSchema(previousPath); if (schema.equals(previousSchema)) { return rootFileSystem.makeQualified(previousPath).toUri(); } } Map<Integer, Schema> schemas = getSchemas(); for (Schema oldSchema: schemas.values()) { if (!SchemaValidationUtil.canRead(oldSchema, schema)) { throw new IncompatibleSchemaException("Schema cannot read data " + "written using existing schema. Schema: " + schema.toString(true) + "\nPrevious schema: " + oldSchema.toString(true)); } } Path schemaPath = null; if (previousPath == null) { schemaPath = new Path(schemaDirectory, "1.avsc"); } else { String previousName = previousPath.getName() .substring(0, previousPath.getName().indexOf('.')); int i = Integer.parseInt(previousName) + 1; schemaPath = new Path(schemaDirectory, Integer.toString(i) + ".avsc"); } FSDataOutputStream outputStream = null; boolean threw = true; try { outputStream = rootFileSystem.create(schemaPath, false); outputStream.write(schema.toString(true) .getBytes(Charsets.UTF_8)); outputStream.flush(); threw = false; } catch (IOException e) { throw new DatasetIOException( "Unable to save schema file: " + schemaPath, e); } finally { try { Closeables.close(outputStream, threw); } catch (IOException e) { throw new DatasetIOException("Cannot close", e); } } return rootFileSystem.makeQualified(schemaPath).toUri(); }
Source:
public Heap(final int estimatedSize, final int limit) { super(limit, estimatedSize); }

Target:
public Heap(final int estimatedSize, final int limit) { super(estimatedSize, limit); }
Source:
public Set<T> toSet() { if (this.data.hasher != HashTable.equalityHasher()) { throw new RuntimeException("Cannot call ImmutableSet::toSet on a ImmutableSet without equality hashing."); } Set<T> set = new HashSet<>(); this.forEach(set::add); return set; }

Target:
public Set<T> toSet() { if (this.data.hasher != HashTable.equalityHasher()) { throw new UnsupportedOperationException("Cannot call ImmutableSet::toSet on a ImmutableSet without equality hashing."); } Set<T> set = new HashSet<>(); this.forEach(set::add); return set; }
Source:
protected void unsetUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { usbSerialDiscovery.stopBackgroundScanning(); usbSerialDiscovery.unregisterDiscoveryListener(this); this.usbSerialDiscovery = null; }

Target:
protected synchronized void unsetUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { usbSerialDiscovery.stopBackgroundScanning(); usbSerialDiscovery.unregisterDiscoveryListener(this); this.usbSerialDiscovery = null; this.previouslyDiscovered.clear(); }
Source:
public synchronized void flush() throws IOException { if (buf.position() > 0) { buf.flip(); String contents = buf.toString(); String filtered = contentFilter.filter(contents); out.write(filtered.getBytes(charset)); buf.clear(); if (buf.capacity() > DEFAULT_DECODER_CAPACITY) { buf = CharBuffer.allocate(DEFAULT_DECODER_CAPACITY); } } out.flush(); }

Target:
public synchronized void flush() throws IOException { ensureOpen(); if (decodedBuf.position() > 0) { decodedBuf.flip(); String contents = decodedBuf.toString(); String filtered = contentFilter.filter(contents); out.write(filtered.getBytes(charset)); decodedBuf.clear(); } out.flush(); }
Source:
public static ClassLoader getCustomClassloader(Collection<String> entries) { List<URL> urls = new ArrayList<>(); File file; if (entries != null) { for (String classPathEntry : entries) { file = new File(classPathEntry); if (!file.exists()) { LOG.warn("classPathEntry " + classPathEntry + " not exists!" ); continue; } try { urls.add(file.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(getString( "RuntimeError.9", classPathEntry)); } } } ClassLoader parent = Thread.currentThread().getContextClassLoader(); return new URLClassLoader(urls.toArray(new URL[urls .size()]), parent); }

Target:
public static ClassLoader getCustomClassloader(Collection<String> entries) { List<URL> urls = new ArrayList<>(); File file; if (entries != null) { for (String classPathEntry : entries) { file = new File(classPathEntry); if (!file.exists()) { LOG.warn(getString("Warning.31", classPathEntry)); continue; } try { urls.add(file.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(getString( "RuntimeError.9", classPathEntry)); } } } ClassLoader parent = Thread.currentThread().getContextClassLoader(); return new URLClassLoader(urls.toArray(new URL[urls .size()]), parent); }
Source:
public static UsbPolicy getUsbPolicy(Usb usb, VDSGroup vdsGroup) { UsbPolicy usbPolicy = null; if (usb != null && usb.isSetEnabled()) { usbPolicy = UsbPolicy.DISABLED; if (usb.isEnabled()) { UsbType usbType = null; if (usb.getType() != null) { usbType = UsbType.fromValue(usb.getType()); } if (usbType != null) { if (usbType.equals(UsbType.LEGACY)) { usbPolicy = UsbPolicy.ENABLED_LEGACY; } else if (usbType.equals(UsbType.NATIVE)) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } } if (usbPolicy.equals(UsbPolicy.DISABLED)) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) >= 0) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } else { usbPolicy = UsbPolicy.ENABLED_LEGACY; } } } } return usbPolicy; }

Target:
public static UsbPolicy getUsbPolicy(Usb usb, VDSGroup vdsGroup) { UsbPolicy usbPolicy = null; if (usb == null || !usb.isSetEnabled() || !usb.isEnabled()) { usbPolicy = UsbPolicy.DISABLED; } else{ UsbType usbType = usb.getType() != null ? UsbType.fromValue(usb.getType()) : null; if (usbType == null) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) >= 0) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } else { usbPolicy = UsbPolicy.ENABLED_LEGACY; } } else { if (usbType.equals(UsbType.LEGACY)) { usbPolicy = UsbPolicy.ENABLED_LEGACY; } else if (usbType.equals(UsbType.NATIVE)) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } } } return usbPolicy; }
Source:
private Map<String, Object> getDescription(String host, int port, String path) throws IOException { Map<String, Object> properties = new HashMap<>(2, 1); try { URL url = new URL("http", host, port, path); logger.debug("URL: {}", url.toString()); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream())); String s; StringBuilder builder = new StringBuilder(); while ((s = bufferedReader.readLine()) != null) { builder.append(s); } Pattern ScalarWebAPImatch = Pattern.compile("<av:X_ScalarWebAPI_BaseURL>(.*)</av:X_ScalarWebAPI_BaseURL>"); Pattern baseURLmatch = Pattern.compile("http://(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):(\\d+)([^<]*)"); Matcher tagmatch = ScalarWebAPImatch.matcher(builder.toString()); if (tagmatch.find()) { Matcher matcher = baseURLmatch.matcher(tagmatch.group()); matcher.find(); int scalar_port = Integer.parseInt(matcher.group(2)); String scalar_path = matcher.group(3); properties.put(SonyAudioBindingConstants.SCALAR_PORT_PARAMETER, scalar_port); properties.put(SonyAudioBindingConstants.SCALAR_PATH_PARAMETER, scalar_path); } return properties; } catch (IOException e) { throw e; } }

Target:
private Map<String, Object> getDescription(String host, int port, String path) throws IOException { Map<String, Object> properties = new HashMap<>(2, 1); URL url = new URL("http", host, port, path); logger.debug("URL: {}", url.toString()); try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()))) { String s; StringBuilder builder = new StringBuilder(); while ((s = bufferedReader.readLine()) != null) { builder.append(s); } Pattern ScalarWebAPImatch = Pattern.compile("<av:X_ScalarWebAPI_BaseURL>(.*)</av:X_ScalarWebAPI_BaseURL>"); Pattern baseURLmatch = Pattern.compile("http://(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):(\\d+)([^<]*)"); Matcher tagmatch = ScalarWebAPImatch.matcher(builder.toString()); if (tagmatch.find()) { Matcher matcher = baseURLmatch.matcher(tagmatch.group()); matcher.find(); int scalar_port = Integer.parseInt(matcher.group(2)); String scalar_path = matcher.group(3); properties.put(SonyAudioBindingConstants.SCALAR_PORT_PARAMETER, scalar_port); properties.put(SonyAudioBindingConstants.SCALAR_PATH_PARAMETER, scalar_path); } return properties; } }
Source:
public void setHealthD(double health) { Living thisEntity = this; setHealth((float) health); if (thisEntity instanceof EntityPlayer && health == 0) { ((EntityPlayer) thisEntity).onDeath(DamageSource.generic); } }

Target:
public void setHealthD(double health) { Living thisEntity = (Living) this; setHealth((float) health); if (thisEntity instanceof EntityPlayer && health == 0) { ((EntityPlayer) thisEntity).onDeath(DamageSource.generic); } }
Source:
private void createNewTraceNameGroup(Composite parent) { Font font = parent.getFont(); Composite folderGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; folderGroup.setLayout(layout); folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; String name = fTrace.getName(); Label newTraceLabel = new Label(folderGroup, SWT.NONE); newTraceLabel.setFont(font); newTraceLabel.setText(Messages.CopyTraceDialog_TraceNewName); fNewTraceName = new Text(folderGroup, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; fNewTraceName.setLayoutData(data); fNewTraceName.setFont(font); fNewTraceName.setFocus(); fNewTraceName.setText(name); fNewTraceName.setSelection(0, name.length()); fNewTraceName.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { validateNewTraceName(); } }); }

Target:
private void createNewTraceNameGroup(Composite parent) { Font font = parent.getFont(); Composite folderGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; folderGroup.setLayout(layout); folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); String name = fTrace.getName(); Label newTraceLabel = new Label(folderGroup, SWT.NONE); newTraceLabel.setFont(font); newTraceLabel.setText(Messages.CopyTraceDialog_TraceNewName); fNewTraceName = new Text(folderGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; fNewTraceName.setLayoutData(data); fNewTraceName.setFont(font); fNewTraceName.setFocus(); fNewTraceName.setText(name); fNewTraceName.setSelection(0, name.length()); fNewTraceName.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { validateNewTraceName(); } }); }
Source:
public ByteBuffer allocate(int size, final long timeToBlockInMs) throws TimeoutException, InterruptedException { if (size > capacity) { throw new IllegalArgumentException("Requested size cannot exceed pool capacity."); } final long startTimeInMs = System.currentTimeMillis(); long timeout = timeToBlockInMs; synchronized (lock) { while (size > availableMemory) { timeout = timeToBlockInMs - (System.currentTimeMillis() - startTimeInMs); if (timeout <= 0) { throw new TimeoutException("Memory not Enough. Request timeout."); } lock.wait(timeout); } availableMemory -= size; if (availableMemory > 0) { lock.notifyAll(); } } return ByteBuffer.allocate(size); }

Target:
public ByteBuffer allocate(int size, final long timeToBlockInMs) throws TimeoutException, InterruptedException { if (size > capacity) { throw new IllegalArgumentException("Requested size cannot exceed pool capacity."); } else if (timeToBlockInMs < 0) { throw new IllegalArgumentException("timeToBlockInMs cannot be negative."); } final long startTimeInMs = System.currentTimeMillis(); synchronized (lock) { while (size > availableMemory) { long timeout = timeToBlockInMs - (System.currentTimeMillis() - startTimeInMs); if (timeout <= 0) { throw new TimeoutException("Timed out waiting for allocation."); } lock.wait(timeout); } availableMemory -= size; if (availableMemory > 0) { lock.notify(); } } return ByteBuffer.allocate(size); }
Source:
protected void initText(){ dayOfWeek = (TextView) findViewById(R.id.gregdayofweek); dayTxt = (EditText)findViewById(R.id.daytxtfield); yearTxt = (EditText)findViewById(R.id.yeartxtfield); MonthAdapter monthAdapter = new MonthAdapter(getContext(), monthList); monthTxt = (AutoCompleteTextView) findViewById(R.id.monthtxtfield); monthTxt.setAdapter(monthAdapter); dayTxt.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) @Override public void onTextChanged(CharSequence s, int start, int before, int count) @Override public void afterTextChanged(Editable s) { String contents = s.toString(); if(contents.length() > 1) { int num = Integer.parseInt(contents); int monthMax = selectedDate.getActualMaximum(Calendar.DAY_OF_MONTH); if (num <= monthMax && num >= 1) { selectedDate.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.toString())); } } } }); monthTxt.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) @Override public void onTextChanged(CharSequence s, int start, int before, int count) @Override public void afterTextChanged(Editable s) { String content = s.toString(); if(monthList.contains(content)){ monthArrayPointer = monthList.indexOf(content); selectedDate.set(Calendar.MONTH, monthArrayPointer); } } }); yearTxt.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) @Override public void onTextChanged(CharSequence s, int start, int before, int count) @Override public void afterTextChanged(Editable s) { String contents = s.toString(); if(contents.length() >= 4 ){ if(Integer.parseInt(contents) <= maxYear){ selectedDate.set(Calendar.YEAR, Integer.parseInt(contents)); } } } }); }

Target:
protected void initText(){ dayOfWeek = (TextView) findViewById(R.id.greg_day_of_week); dayText = (EditText)findViewById(R.id.day_txt_field); yearText = (EditText)findViewById(R.id.year_txt_field); dayText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dayText.clearFocus(); dayText.requestFocus(); } }); yearText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { yearText.clearFocus(); yearText.requestFocus(); } }); setupMonthComponents(); }
Source:
public Integer getStorageVersion() { return GlobalSession.BOOKMARKS_ENGINE_VERSION; }

Target:
public Integer getStorageVersion() { return VersionConstants.BOOKMARKS_ENGINE_VERSION; }
Source:
public void testMaybeCompleteValidationAfterPositionChange() { Node broker1 = new Node(1, "localhost", 9092); state.assignFromUser(Collections.singleton(tp0)); int currentEpoch = 10; long initialOffset = 10L; int initialOffsetEpoch = 5; long updateOffset = 20L; int updateOffsetEpoch = 8; SubscriptionState.FetchPosition initialPosition = new SubscriptionState.FetchPosition(initialOffset, Optional.of(initialOffsetEpoch), new Metadata.LeaderAndEpoch(Optional.of(broker1), Optional.of(currentEpoch))); state.seekUnvalidated(tp0, initialPosition); assertTrue(state.awaitingValidation(tp0)); SubscriptionState.FetchPosition updatePosition = new SubscriptionState.FetchPosition(updateOffset, Optional.of(updateOffsetEpoch), new Metadata.LeaderAndEpoch(Optional.of(broker1), Optional.of(currentEpoch))); state.seekUnvalidated(tp0, updatePosition); Optional<LogTruncation> divergentOffsetMetadataOpt = state.maybeCompleteValidation(tp0, initialPosition, new EpochEndOffset(initialOffsetEpoch, initialOffset + 5)); assertEquals(Optional.empty(), divergentOffsetMetadataOpt); assertTrue(state.awaitingValidation(tp0)); assertEquals(updatePosition, state.position(tp0)); }

Target:
public void testMaybeCompleteValidationAfterPositionChange() { Node broker1 = new Node(1, "localhost", 9092); state.assignFromUser(Collections.singleton(tp0)); int currentEpoch = 10; long initialOffset = 10L; int initialOffsetEpoch = 5; long updateOffset = 20L; int updateOffsetEpoch = 8; SubscriptionState.FetchPosition initialPosition = new SubscriptionState.FetchPosition(initialOffset, Optional.of(initialOffsetEpoch), new Metadata.LeaderAndEpoch(Optional.of(broker1), Optional.of(currentEpoch))); state.seekUnvalidated(tp0, initialPosition); assertTrue(state.awaitingValidation(tp0)); SubscriptionState.FetchPosition updatePosition = new SubscriptionState.FetchPosition(updateOffset, Optional.of(updateOffsetEpoch), new Metadata.LeaderAndEpoch(Optional.of(broker1), Optional.of(currentEpoch))); state.seekUnvalidated(tp0, updatePosition); Optional<LogTruncation> truncationOpt = state.maybeCompleteValidation(tp0, initialPosition, new EpochEndOffset(initialOffsetEpoch, initialOffset + 5)); assertEquals(Optional.empty(), truncationOpt); assertTrue(state.awaitingValidation(tp0)); assertEquals(updatePosition, state.position(tp0)); }
Source:
void denyRoleInTree(String roleName, String resourceId, String action, boolean updateCache) throws UserStoreException { write.lock(); try { SearchResult sr = getNode(root, PermissionTreeUtil.toComponenets(resourceId)); if (sr.getUnprocessedPaths() != null) { List<String> paths = sr.getUnprocessedPaths(); TreeNode tn = sr.getLastNode().create(paths); tn.denyRole(roleName, PermissionTreeUtil.actionToPermission(action)); } else { sr.getLastNode().denyRole(roleName, PermissionTreeUtil.actionToPermission(action)); } if (updateCache) { invalidateCache(root); } } catch (Exception e) { throw new UserStoreException(e.getMessage(),e); } finally { write.unlock(); } }

Target:
void denyRoleInTree(String roleName, String resourceId, String action, boolean updateCache) throws UserStoreException { write.lock(); try { SearchResult sr = getNode(root, PermissionTreeUtil.toComponenets(resourceId)); if (sr.getUnprocessedPaths() != null) { List<String> paths = sr.getUnprocessedPaths(); TreeNode tn = sr.getLastNode().create(paths); tn.denyRole(roleName, PermissionTreeUtil.actionToPermission(action)); } else { sr.getLastNode().denyRole(roleName, PermissionTreeUtil.actionToPermission(action)); } if (updateCache) { invalidateCache(root); } } catch (IllegalArgumentException e) { throw new UserStoreException("Error while denying role: " + roleName + "in permission tree for resource id: " + resourceId + "for action: " + action, e); } finally { write.unlock(); } }
Source:
private void printVersion() { final Properties props = new Properties(); final InputStream input = Arguments.class.getClassLoader().getResourceAsStream(PROPERTY_FILE); try { props.load(input); System.out.println("Version: " + props.get("version")); } catch (final IOException e) { System.out.println("Failed to load property file due to: " + e.getMessage()); } }

Target:
private void printVersion() { final Properties props = new Properties(); final InputStream input = Arguments.class.getClassLoader().getResourceAsStream(PROPERTY_FILE); try { props.load(input); System.out.println("Version: " + props.get("version")); } catch (final IOException e) { System.err.println("Failed to load property file due to: " + e.getMessage()); } }
Source:
public SpatialKnownIndex selectAndCreate( Map<CoordinateReferenceSystem,SpatialKnownIndex> indexMap, long indexId, CoordinateReferenceSystem crs ) { return indexMap.computeIfAbsent( crs, k -> new SpatialKnownIndex( directoryStructure(), crs, indexId, pageCache, fs, monitor, recoveryCleanupWorkCollector ) ); }

Target:
public SpatialKnownIndex selectAndCreate( Map<CoordinateReferenceSystem,SpatialKnownIndex> indexMap, long indexId, CoordinateReferenceSystem crs ) { return indexMap.computeIfAbsent( crs, crsKey -> new SpatialKnownIndex( directoryStructure(), crsKey, indexId, pageCache, fs, monitor, recoveryCleanupWorkCollector ) ); }
Source:
public void setHaltOnException(boolean haltOnException) { this.haltOnException = haltOnException; }

Target:
public MetadataBuilder setHaltOnException(boolean haltOnException) { this.haltOnException = haltOnException; return this; }
Source:
public long estimatedInMemorySize() { return INSTANCE_SIZE + SizeOf.SIZE_OF_INT + SizeOf.SIZE_OF_INT + 2 * SizeOf.SIZE_OF_DOUBLE * Math.min(size, samples.length); }

Target:
public long estimatedInMemorySize() { return INSTANCE_SIZE + SizeOf.sizeOf(samples) + SizeOf.sizeOf(weights); }
Source:
@Override public synchronized boolean cancel() throws IgniteCheckedException { return onDone(null, null, true); }

Target:
@Override public synchronized boolean cancel() throws IgniteCheckedException { return onCancelled(); }
Source:
public void saveTask () { new ShellMenu("File", "Save").select(); new ShellMenu("File", "Properties").select(); new PushButton("OK").click(); }

Target:
public void saveTask () { new ShellMenu("File", "Save").select(); }