auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Node buildKdbTreeNode(int maxItemsPerNode, int level, Rectangle extent, List<Rectangle> items, LeafIdAllocator leafIdAllocator) { checkArgument(maxItemsPerNode > 0, "maxItemsPerNode must be > 0"); checkArgument(level >= 0, "level must be >= 0"); checkArgument(level <= MAX_LEVELS, "level must be <= 10,000"); requireNonNull(extent, "extent is null"); requireNonNull(items, "items is null"); if (items.size() <= 1 || items.size() <= maxItemsPerNode || level == MAX_LEVELS) { return newLeaf(extent, leafIdAllocator.next()); } boolean splitVertically = extent.getWidth() >= extent.getHeight(); Optional<SplitResult<Node>> splitResult = trySplit(splitVertically ? BY_X : BY_Y, maxItemsPerNode, level, extent, items, leafIdAllocator); if (!splitResult.isPresent()) { splitResult = trySplit(splitVertically ? BY_Y : BY_X, maxItemsPerNode, level, extent, items, leafIdAllocator); } if (!splitResult.isPresent()) { return newLeaf(extent, leafIdAllocator.next()); } return newInternal(extent, splitResult.get().getLeft(), splitResult.get().getRight()); }

Target:
private static Node buildKdbTreeNode(int maxItemsPerNode, int level, Rectangle extent, List<Rectangle> items, LeafIdAllocator leafIdAllocator) { checkArgument(maxItemsPerNode > 0, "maxItemsPerNode must be > 0"); checkArgument(level >= 0, "level must be >= 0"); checkArgument(level <= MAX_LEVELS, "level must be <= 10,000"); requireNonNull(extent, "extent is null"); requireNonNull(items, "items is null"); if (items.size() <= maxItemsPerNode || level == MAX_LEVELS) { return newLeaf(extent, leafIdAllocator.next()); } boolean splitVertically = extent.getWidth() >= extent.getHeight(); Optional<SplitResult<Node>> splitResult = trySplit(splitVertically ? BY_X : BY_Y, maxItemsPerNode, level, extent, items, leafIdAllocator); if (!splitResult.isPresent()) { splitResult = trySplit(splitVertically ? BY_Y : BY_X, maxItemsPerNode, level, extent, items, leafIdAllocator); } if (!splitResult.isPresent()) { return newLeaf(extent, leafIdAllocator.next()); } return newInternal(extent, splitResult.get().getLeft(), splitResult.get().getRight()); }
Source:
public boolean mayProceed(String studyOid) throws Exception { boolean accessPermission = false; StudyBean study = getStudy(studyOid); StudyBean pStudy = getParentStudy(studyOid); StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource); StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(pStudy.getId(), "participantPortal"); String participateStatus = pStatus.getValue().toString(); if( participateStatus.equals("enabled") && study.getStatus().isAvailable()){ accessPermission = true; } return accessPermission; }

Target:
public boolean mayProceed(String studyOid) throws Exception { boolean accessPermission = false; StudyBean study = getStudy(studyOid); StudyBean pStudy = getParentStudy(studyOid); StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource); StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(pStudy.getId(), "participantPortal"); String participateStatus = pStatus.getValue().toString(); if( participateStatus.equals(ModuleProcessor.ModuleStatus.ENABLED.getValue()) && study.getStatus().isAvailable()){ accessPermission = true; } return accessPermission; }
Source:
public Iterator<Host> newQueryPlan(String loggedKeyspace, Statement statement) { final Iterator<Host> childQueryPlan = childPolicy.newQueryPlan(loggedKeyspace, statement); return new AbstractIterator<Host>() { private Queue<Host> skipped; @Override protected Host computeNext() { while (childQueryPlan.hasNext()) { Host host = childQueryPlan.next(); if (errorTracker.isHostValid(host)) { return host; } if (skipped == null) skipped = new ArrayDeque<Host>(); skipped.offer(host); } if (skipped != null && !skipped.isEmpty()) return skipped.poll(); return endOfData(); } }; }

Target:
public Iterator<Host> newQueryPlan(String loggedKeyspace, Statement statement) { final Iterator<Host> childQueryPlan = childPolicy.newQueryPlan(loggedKeyspace, statement); return new AbstractIterator<Host>() { @Override protected Host computeNext() { while (childQueryPlan.hasNext()) { Host host = childQueryPlan.next(); if (!errorTracker.isExcluded(host)) { return host; } } return endOfData(); } }; }
Source:
public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } return pattern.matcher(value).matches() ? true : false; }

Target:
public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } return pattern.matcher(value).matches(); }
Source:
protected UsageAwareDatastoreConnection<ElasticSearchDataContext> createDatastoreConnection() { Client client; if (ClientType.TRANSPORT.equals(_clientType)) { final Builder settingsBuilder = ImmutableSettings.builder(); settingsBuilder.put("name", "DataCleaner"); settingsBuilder.put("cluster.name", _clusterName); if (!StringUtils.isNullOrEmpty(_username) && !StringUtils.isNullOrEmpty(_password)) { settingsBuilder.put("shield.user", _username + ":" + _password); if (_ssl) { if(_keystorePath != null && !_keystorePath.isEmpty()) { settingsBuilder.put("shield.ssl.keystore.path", _keystorePath); settingsBuilder.put("shield.ssl.keystore.password", _keystorePassword); } settingsBuilder.put("shield.transport.ssl", "true"); } } final Settings settings = settingsBuilder.build(); client = new TransportClient(settings); ((TransportClient) client).addTransportAddress(new InetSocketTransportAddress(_hostname, _port)); } else { final Builder settingsBuilder = ImmutableSettings.builder(); settingsBuilder.put("name", "DataCleaner"); settingsBuilder.put("shield.enabled", false); final Settings settings = settingsBuilder.build(); final Node node = nodeBuilder().clusterName(_clusterName).client(true).settings(settings).node(); client = node.client(); } final ElasticSearchDataContext dataContext; if (_tableDefs == null || _tableDefs.length == 0) { dataContext = new ElasticSearchDataContext(client, _indexName); } else { dataContext = new ElasticSearchDataContext(client, _indexName, _tableDefs); } return new UpdateableDatastoreConnectionImpl<ElasticSearchDataContext>(dataContext, this); }

Target:
protected UsageAwareDatastoreConnection<ElasticSearchDataContext> createDatastoreConnection() { Client client; if (ClientType.TRANSPORT.equals(_clientType)) { final Builder settingsBuilder = ImmutableSettings.builder(); settingsBuilder.put("name", "DataCleaner"); settingsBuilder.put("cluster.name", _clusterName); if (!StringUtils.isNullOrEmpty(_username) && !StringUtils.isNullOrEmpty(_password)) { settingsBuilder.put("shield.user", _username + ":" + _password); if (_ssl) { if(!Strings.isNullOrEmpty(_keystorePath)) { settingsBuilder.put("shield.ssl.keystore.path", _keystorePath); settingsBuilder.put("shield.ssl.keystore.password", _keystorePassword); } settingsBuilder.put("shield.transport.ssl", "true"); } } final Settings settings = settingsBuilder.build(); client = new TransportClient(settings); ((TransportClient) client).addTransportAddress(new InetSocketTransportAddress(_hostname, _port)); } else { final Builder settingsBuilder = ImmutableSettings.builder(); settingsBuilder.put("name", "DataCleaner"); settingsBuilder.put("shield.enabled", false); final Settings settings = settingsBuilder.build(); final Node node = nodeBuilder().clusterName(_clusterName).client(true).settings(settings).node(); client = node.client(); } final ElasticSearchDataContext dataContext; if (_tableDefs == null || _tableDefs.length == 0) { dataContext = new ElasticSearchDataContext(client, _indexName); } else { dataContext = new ElasticSearchDataContext(client, _indexName, _tableDefs); } return new UpdateableDatastoreConnectionImpl<ElasticSearchDataContext>(dataContext, this); }
Source:
private ToolBar createToolbar(final MUIElement element, Composite parent) { int orientation = getOrientation(element); int style = orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT; ToolBarManager manager = getManager((MToolBar) element); if (manager == null) { manager = new ToolBarManager(style); IContributionManagerOverrides overrides = null; MApplicationElement parentElement = element.getParent(); if (parentElement == null) { parentElement = (MApplicationElement) ((EObject) element) .eContainer(); } if (parentElement != null) { overrides = (IContributionManagerOverrides) parentElement .getTransientData().get( IContributionManagerOverrides.class.getName()); } manager.setOverrides(overrides); linkModelToManager((MToolBar) element, manager); } else { ToolBar toolBar = manager.getControl(); if (toolBar != null && !toolBar.isDisposed() && (toolBar.getStyle() & orientation) == 0) { manager.dispose(); } manager.setStyle(style); } ToolBar bar = manager.createControl(parent); bar.setData(manager); bar.setData(AbstractPartRenderer.OWNING_ME, element); bar.getShell().layout(new Control[] { bar }, SWT.DEFER); bar.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { cleanUp((MToolBar) element); } }); return bar; }

Target:
private ToolBar createToolbar(final MUIElement element, Composite parent) { int orientation = getOrientation(element); int style = orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT; ToolBarManager manager = getManager((MToolBar) element); if (manager == null) { manager = new ToolBarManager(style); IContributionManagerOverrides overrides = null; MApplicationElement parentElement = element.getParent(); if (parentElement == null) { parentElement = (MApplicationElement) ((EObject) element) .eContainer(); } if (parentElement != null) { overrides = (IContributionManagerOverrides) parentElement .getTransientData().get( IContributionManagerOverrides.class.getName()); } manager.setOverrides(overrides); linkModelToManager((MToolBar) element, manager); } else { ToolBar toolBar = manager.getControl(); if (toolBar != null && !toolBar.isDisposed() && (toolBar.getStyle() & orientation) == 0) { toolBar.dispose(); } manager.setStyle(style); } ToolBar bar = manager.createControl(parent); bar.setData(manager); bar.setData(AbstractPartRenderer.OWNING_ME, element); bar.getShell().layout(new Control[] { bar }, SWT.DEFER); bar.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { cleanUp((MToolBar) element); } }); return bar; }
Source:
private void handleNotification(MentionNotificationParameters mentionNotificationParameters, EntityReference entityReference, XWikiDocument doc, MentionNotificationParameter mentionNotificationParameter) { String extractedQuote = getQuoteFromXDOM(mentionNotificationParameters, entityReference, doc, mentionNotificationParameter); MentionEventParams params = new MentionEventParams() .setUserReference(mentionNotificationParameters.getAuthorReference()) .setDocumentReference( this.entityReferenceSerializer.serialize(entityReference.extractReference(EntityType.DOCUMENT))) .setLocation(mentionNotificationParameters.getLocation()) .setAnchor(mentionNotificationParameter.getAnchorId()) .setQuote(extractedQuote); String mentionedIdentity = mentionNotificationParameter.getReference(); DocumentReference documentUserReference = this.documentReferenceResolver.resolve(mentionedIdentity, entityReference.extractReference(EntityType.WIKI)); String identity = this.entityReferenceSerializer.serialize(documentUserReference); MentionEvent event = new MentionEvent(singleton(identity), params); this.observationManager.notify(event, "org.xwiki.contrib:mentions-notifications", MentionEvent.EVENT_TYPE); }

Target:
private void handleNotification(MentionNotificationParameters mentionNotificationParameters, EntityReference entityReference, XWikiDocument doc, MentionNotificationParameter mentionNotificationParameter) { if (canView(mentionNotificationParameter.getReference(), entityReference)) { String extractedQuote = getQuoteFromXDOM(mentionNotificationParameters, entityReference, doc, mentionNotificationParameter); MentionEventParams params = new MentionEventParams() .setUserReference(mentionNotificationParameters.getAuthorReference()) .setDocumentReference( this.entityReferenceSerializer.serialize(entityReference.extractReference(EntityType.DOCUMENT))) .setLocation(mentionNotificationParameters.getLocation()) .setAnchor(mentionNotificationParameter.getAnchorId()) .setQuote(extractedQuote); String mentionedIdentity = mentionNotificationParameter.getReference(); UserReference userReference = this.userReferenceResolver.resolve(mentionedIdentity, entityReference.extractReference(EntityType.WIKI)); String identity = this.userReferenceSerializer.serialize(userReference); MentionEvent event = new MentionEvent(singleton(identity), params); this.observationManager.notify(event, "org.xwiki.contrib:mentions-notifications", MentionEvent.EVENT_TYPE); } }
Source:
public Enumeration<URL> getResources(String name) throws IOException { List<URL> resources = Lists.newLinkedList(); for (ClassLoader classLoader : classLoaders) { resources.addAll(Collections.list(classLoader.getResources(name))); } return Collections.enumeration(resources); }

Target:
public Enumeration<URL> getResources(String name) throws IOException { Set<URL> resources = Sets.newLinkedHashSet(); for (ClassLoader classLoader : classLoaders) { resources.addAll(Collections.list(classLoader.getResources(name))); } return Collections.enumeration(resources); }
Source:
public void handleChildCommands() { if (getCallback() != null) { List<Guid> childCommands = CommandCoordinatorUtil.getChildCommandIds(getCommandId()); List<VdcActionParametersBase> parameters = new LinkedList<>(); for (Guid id : childCommands) { CommandBase<?> command = CommandCoordinatorUtil.retrieveCommand(id); if (command.getParameters().getCocoEndActionMode() == EndActionMode.UPDATE_COMMAND_STATUS_ONLY) { command.getParameters().setCocoEndActionMode(EndActionMode.RUN_END_ACTION_METHOD); command.getParameters().setCommandType(command.getActionType()); parameters.add(command.getParameters()); } } getParameters().setImagesParameters(parameters); } }

Target:
public void handleChildCommands() { if (getCallback() != null) { List<Guid> childCommands = CommandCoordinatorUtil.getChildCommandIds(getCommandId()); List<VdcActionParametersBase> parameters = new LinkedList<>(); for (Guid id : childCommands) { CommandBase<?> command = CommandCoordinatorUtil.retrieveCommand(id); if (command.getParameters().getShouldBeEndedByParent()) { command.getParameters().setShouldBeEndedByParent(false); command.getParameters().setCommandType(command.getActionType()); parameters.add(command.getParameters()); } } getParameters().setImagesParameters(parameters); } }
Source:
public void testJsonSerialisation() throws JSONException { JSONObject deviceDataJson = mapToJson(deviceData); assertEquals("android", deviceDataJson.getString("osName")); assertNotNull(deviceDataJson.getString("osVersion")); assertNotNull(deviceDataJson.getString("manufacturer")); assertNotNull(deviceDataJson.getString("model")); assertNotNull(deviceDataJson.get("cpuAbi")); assertTrue(deviceDataJson.has("jailbroken")); JSONObject versions = deviceDataJson.getJSONObject("runtimeVersions"); assertNotNull(versions.get("androidApiLevel")); }

Target:
public void testJsonSerialisation() throws JSONException { JSONObject deviceDataJson = mapToJson(deviceData); assertEquals("android", deviceDataJson.getString("osName")); assertNotNull(deviceDataJson.getString("osVersion")); assertNotNull(deviceDataJson.getString("manufacturer")); assertNotNull(deviceDataJson.getString("model")); assertNotNull(deviceDataJson.get("cpuAbi")); assertTrue(deviceDataJson.has("jailbroken")); JSONObject versions = deviceDataJson.getJSONObject("runtimeVersions"); assertTrue((Integer) versions.get("androidApiLevel") >= 14); }
Source:
public Builder withKey(byte[] columnKey) { if (null == columnKey) { throw new IllegalArgumentException("Setting null key on column: " + columnPath); } if (null != this.keyBytes) { throw new IllegalArgumentException("Key already set on column: " + columnPath); } this.keyBytes = new byte[columnKey.length]; System.arraycopy(columnKey, 0, this.keyBytes, 0, columnKey.length); return this; }

Target:
public Builder withKey(byte[] columnKey) { if (null != this.keyBytes) { throw new IllegalStateException("Key already set on column: " + columnPath); } this.keyBytes = new byte[columnKey.length]; System.arraycopy(columnKey, 0, this.keyBytes, 0, columnKey.length); return this; }
Source:
private void updateStoragePoolFormatType() { storage_pool storagePool = getStoragePool(); Guid spId = storagePool.getId(); VDSBrokerFrontend resourceManager = Backend.getInstance() .getResourceManager(); Version spVersion = storagePool.getcompatibility_version(); Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (Version.OpEquality(spVersion, oldSpVersion)) { return; } StorageType spType = storagePool.getstorage_pool_type(); if (spType != StorageType.ISCSI && spType != StorageType.FCP) { return; } StorageFormatType targetFormat = StorageFormatType.V1; Version v2FormatChangeBar = new Version("3.0"); Version v3FormatChangeBar = new Version("3.1"); if (spVersion.compareTo(v3FormatChangeBar) >= 0) { targetFormat = StorageFormatType.V3; } else if (spVersion.compareTo(v2FormatChangeBar) >= 0) { targetFormat = StorageFormatType.V2; } storagePool.setStoragePoolFormatType(targetFormat); getStoragePoolDAO().update(storagePool); updateMemberDomainsFormat(targetFormat); if (storagePool.getstatus() != StoragePoolStatus.Up) { return; } UpgradeStoragePoolVDSCommandParameters parameters = new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat); resourceManager.RunVdsCommand( VDSCommandType.UpgradeStoragePool, parameters); }

Target:
private void updateStoragePoolFormatType() { final storage_pool storagePool = getStoragePool(); final Guid spId = storagePool.getId(); final VDSBrokerFrontend resourceManager = Backend.getInstance().getResourceManager(); final Version spVersion = storagePool.getcompatibility_version(); final Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (Version.OpEquality(spVersion, oldSpVersion)) { return; } StorageType spType = storagePool.getstorage_pool_type(); if (spType != StorageType.ISCSI && spType != StorageType.FCP) { return; } StorageFormatType targetFormat = StorageFormatType.V1; if (spVersion.compareTo(Version.v3_0) == 0) { targetFormat = StorageFormatType.V2; } else if (spVersion.compareTo(Version.v3_1) == 0) { targetFormat = StorageFormatType.V3; } storagePool.setStoragePoolFormatType(targetFormat); getStoragePoolDAO().update(storagePool); updateMemberDomainsFormat(targetFormat); if (storagePool.getstatus() != StoragePoolStatus.Up) { return; } UpgradeStoragePoolVDSCommandParameters parameters = new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat); resourceManager.RunVdsCommand( VDSCommandType.UpgradeStoragePool, parameters); }
Source:
private void applyLightBufferPass() { int texId = 0; GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneOpaque.bindTexture(); lightBufferPass.setInt("texSceneOpaque", texId++, true); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneOpaque.bindDepthTexture(); lightBufferPass.setInt("texSceneOpaqueDepth", texId++, true); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneOpaque.bindNormalsTexture(); lightBufferPass.setInt("texSceneOpaqueNormals", texId++, true); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneOpaque.bindLightBufferTexture(); lightBufferPass.setInt("texSceneOpaqueLightBuffer", texId, true); sceneOpaquePingPong = dynamicFBM.getFBO(DefaultDynamicFBOs.WriteOnlyGBuffer.getResourceUrn()); sceneReflectiveRefractive = dynamicFBM.getFBO(REFRACTIVE_REFLECTIVE_URN); sceneOpaquePingPong.bind(); setRenderBufferMask(sceneOpaquePingPong, true, true, true); setViewportToSizeOf(sceneOpaquePingPong); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(sceneOpaque); dynamicFBM.swap(DefaultDynamicFBOs.WriteOnlyGBuffer.getResourceUrn(), DefaultDynamicFBOs.ReadOnlyGBuffer.getResourceUrn()); sceneOpaque.attachDepthBufferTo(sceneReflectiveRefractive); }

Target:
private void applyLightBufferPass() { int texId = 0; GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); READ_ONLY_GBUFFER.bindTexture(); lightBufferPass.setInt("texSceneOpaque", texId++, true); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); READ_ONLY_GBUFFER.bindDepthTexture(); lightBufferPass.setInt("texSceneOpaqueDepth", texId++, true); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); READ_ONLY_GBUFFER.bindNormalsTexture(); lightBufferPass.setInt("texSceneOpaqueNormals", texId++, true); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); READ_ONLY_GBUFFER.bindLightBufferTexture(); lightBufferPass.setInt("texSceneOpaqueLightBuffer", texId, true); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE); WRITE_ONLY_GBUFFER.bind(); WRITE_ONLY_GBUFFER.setRenderBufferMask(true, true, true); setViewportToSizeOf(WRITE_ONLY_GBUFFER); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(READ_ONLY_GBUFFER); displayResolutionDependentFBOs.swapReadWriteBuffers(); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); }
Source:
public ObjectReader newReader() { ObjectReader r = db.newReader(); r.setAvoidUnreachableObjects(avoidUnreachable); return r; }

Target:
public ObjectReader newReader() { return db.newReader(); }
Source:
public static final String convertArrayToBase64(double[] array) { final int capacity = 8 * array.length; final ByteBuffer bb = ByteBuffer.allocate(capacity); for (int i = 0; i < array.length; i++) { bb.putDouble(array[i]); } bb.rewind(); final ByteBuffer encodedBB = Base64.getEncoder().encode(bb); return new String(encodedBB.array()); }

Target:
public static final String convertArrayToBase64(double[] array) { final int capacity = DOUBLE_SIZE_IN_BYTES * array.length; final ByteBuffer bb = ByteBuffer.allocate(capacity); for (int i = 0; i < array.length; i++) { bb.putDouble(array[i]); } bb.rewind(); final ByteBuffer encodedBB = Base64.getEncoder().encode(bb); return new String(encodedBB.array()); }
Source:
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException, MaxMoneyException { Trade items = getTrade(sign, 1, 2, player, ess); Trade charge = getTrade(sign, 3, ess); if (ess.getSettings().isAllowBulkBuySell() && player.getBase().isSneaking()) { ItemStack heldItem = player.getItemInHand(); if (items.getItemStack().isSimilar(heldItem)) { int initialItemAmount = items.getItemStack().getAmount(); int newItemAmount = heldItem.getAmount(); ItemStack item = items.getItemStack(); item.setAmount(newItemAmount); items = new Trade(item, ess); BigDecimal chargeAmount = charge.getMoney(); BigDecimal pricePerSingleItem = chargeAmount.divide(new BigDecimal(initialItemAmount), RoundingMode.HALF_EVEN); pricePerSingleItem = pricePerSingleItem.multiply(new BigDecimal(newItemAmount)); charge = new Trade(pricePerSingleItem, ess); } } charge.isAffordableFor(player); if (!items.pay(player)) { throw new ChargeException("Inventory full"); } charge.charge(player); Trade.log("Sign", "Buy", "Interact", username, charge, username, items, sign.getBlock().getLocation(), ess); return true; }

Target:
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException, MaxMoneyException { Trade items = getTrade(sign, 1, 2, player, ess); Trade charge = getTrade(sign, 3, ess); if (ess.getSettings().isAllowBulkBuySell() && player.getBase().isSneaking()) { ItemStack heldItem = player.getItemInHand(); if (items.getItemStack().isSimilar(heldItem)) { int initialItemAmount = items.getItemStack().getAmount(); int newItemAmount = heldItem.getAmount(); ItemStack item = items.getItemStack(); item.setAmount(newItemAmount); items = new Trade(item, ess); BigDecimal chargeAmount = charge.getMoney(); BigDecimal pricePerSingleItem = chargeAmount.divide(new BigDecimal(initialItemAmount)); pricePerSingleItem = pricePerSingleItem.multiply(new BigDecimal(newItemAmount)); charge = new Trade(pricePerSingleItem, ess); } } charge.isAffordableFor(player); if (!items.pay(player)) { throw new ChargeException("Inventory full"); } charge.charge(player); Trade.log("Sign", "Buy", "Interact", username, charge, username, items, sign.getBlock().getLocation(), ess); return true; }
Source:
public void login() { LoginManager.getInstance().logInWithReadPermissions(activity, Arrays.asList("email")); }

Target:
public void login() { LoginManager.getInstance().logInWithReadPermissions(activity, Collections.singletonList("email")); }
Source:
private String doMessage(String msg) { Socket echoSocket; String resp = ""; try { echoSocket = new Socket(this.host, this.port); PrintWriter out = new PrintWriter(echoSocket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(echoSocket.getInputStream())); out.println(msg); resp = in.readLine(); echoSocket.close(); } catch (IOException e) { e.printStackTrace(); LOG.error("Error: " + e.getMessage()); } return resp; }

Target:
private String doMessage(String msg) throws Exception { Socket echoSocket; String resp = ""; try { echoSocket = new Socket(this.host, this.port); PrintWriter out = new PrintWriter(echoSocket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(echoSocket.getInputStream())); out.println(msg); resp = in.readLine(); echoSocket.close(); } catch (IOException e) { e.printStackTrace(); throw new Exception("Unable to send message to ChatScript Server. Reason:" + e.getMessage()); } return resp; }
Source:
public static String castToString(Object object) { if (object==null) return null; if (object instanceof boolean[]) return Arrays.toString((boolean[])object); if (object instanceof byte[]) return Arrays.toString((byte[])object); if (object instanceof char[]) return new String((char[])object); if (object instanceof double[]) return Arrays.toString((double[])object); if (object instanceof float[]) return Arrays.toString((float[])object); if (object instanceof int[]) return Arrays.toString((int[])object); if (object instanceof long[]) return Arrays.toString((long[])object); if (object instanceof short[]) return Arrays.toString((short[])object); if (object instanceof Object[]) return Arrays.toString((Object[])object); return object.toString(); }

Target:
public static String castToString(Object object) { if (object==null) return null; if (object.getClass().isArray()) { if (object instanceof boolean[]) return Arrays.toString((boolean[])object); if (object instanceof byte[]) return Arrays.toString((byte[])object); if (object instanceof char[]) return new String((char[])object); if (object instanceof double[]) return Arrays.toString((double[])object); if (object instanceof float[]) return Arrays.toString((float[])object); if (object instanceof int[]) return Arrays.toString((int[])object); if (object instanceof long[]) return Arrays.toString((long[])object); if (object instanceof short[]) return Arrays.toString((short[])object); return Arrays.toString((Object[])object); } return object.toString(); }
Source:
private void tryToStartWeb() { SQProcess process = processesById.get(ProcessId.WEB_SERVER); if (process == null || !isEsClientStartable()) { return; } if (appState.isOperational(ProcessId.WEB_SERVER, false)) { tryToStartProcess(process, () -> javaCommandFactory.createWebCommand(false)); } else if (appState.tryToLockWebLeader()) { tryToStartProcess(process, () -> javaCommandFactory.createWebCommand(true)); } else { LOG.info("Waiting for back-end initialization from " + appState.getLeaderHostName()); } }

Target:
private void tryToStartWeb() { SQProcess process = processesById.get(ProcessId.WEB_SERVER); if (process == null || !isEsClientStartable()) { return; } if (appState.isOperational(ProcessId.WEB_SERVER, false)) { tryToStartProcess(process, () -> javaCommandFactory.createWebCommand(false)); } else if (appState.tryToLockWebLeader()) { tryToStartProcess(process, () -> javaCommandFactory.createWebCommand(true)); } else { LOG.info("Waiting for initialization from " + appState.getLeaderHostName()); } }
Source:
public SchemaImpl postProcess(SchemaImpl schema, SchemaFactory factory) { if(schema.getId().equals("projectMember")) { FieldImpl field = getField(schema, "externalIdType"); if(field != null){ field.getOptions().addAll(EXTERNAL_ID_TYPES); } } return schema; }

Target:
public SchemaImpl postProcess(SchemaImpl schema, SchemaFactory factory) { if(schema.getId().equals("projectMember")) { FieldImpl field = getField(schema, "externalIdType"); if(field != null){ field.getOptions().addAll(AUTH_SERVICE_EXTERNAL_ID_TYPES.get()); } } return schema; }
Source:
protected synchronized <T extends RemoteJsonService> T getService(Class<T> clazz) { return getService(clazz, Version.emptyVersion); }

Target:
protected synchronized <T extends RemoteJsonService> T getService(Class<T> clazz) { return getService(clazz, new NullProgressMonitor()); }
Source:
protected <T> Response performCreate(VdcActionType task, VdcActionParametersBase taskParams, IResolver<T, Q> entityResolver, boolean block) { return performCreate(task, taskParams, entityResolver, block, null); }

Target:
protected final <T> Response performCreate(VdcActionType task, VdcActionParametersBase taskParams, IResolver<T, Q> entityResolver, boolean block) { return performCreate(task, taskParams, entityResolver, block, null); }
Source:
public ResponseEntity removeRepositoryPath(@ApiParam(value = "The path object", required = true) @RequestBody @Validated({ Default.class, ProxyConfigurationFormChecks.class}) PathForm pathForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if(bindingResult.hasErrors()) { return getFailedResponseEntity(HttpStatus.NOT_FOUND, FAILED_REPOSITORY_PATH_REMOVAL_FORM_ERROR, accept); } try { final RepositoryPath repositoryPath = repositoryPathResolver.resolve(pathForm.getStorageId(), pathForm.getRepositoryId(), pathForm.getPath()); artifactManagementService.delete(repositoryPath, pathForm.isForce()); logger.info("Deleting Path {}:{}/{}...", pathForm.getStorageId(), pathForm.getRepositoryId(), pathForm.getPath()); return getSuccessfulResponseEntity(SUCCESSFUL_REPOSITORY_PATH_REMOVAL, accept); } catch (NullPointerException | RepositoryRelativePathConstructionException e) { return getFailedResponseEntity(HttpStatus.NOT_FOUND, FAILED_REPOSITORY_PATH_REMOVAL_FORM_ERROR, accept); } catch (IOException e) { return getExceptionResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR, FAILED_REPOSITORY_PATH_REMOVAL, e, accept); } }

Target:
public ResponseEntity removeRepositoryPath(@ApiParam(value = "The path object", required = true) @RequestBody @Validated({ Default.class, ProxyConfigurationFormChecks.class}) PathForm pathForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if(bindingResult.hasErrors()) { return getFailedResponseEntity(HttpStatus.NOT_FOUND, FAILED_REPOSITORY_PATH_REMOVAL_FORM_ERROR, accept); } try { final RepositoryPath repositoryPath = repositoryPathResolver.resolve(pathForm.getStorageId(), pathForm.getRepositoryId(), pathForm.getPath()); if (!Files.exists(repositoryPath)) { return getFailedResponseEntity(HttpStatus.NOT_FOUND, FAILED_REPOSITORY_PATH_REMOVAL_PATH_NOT_FOUND, accept); } artifactManagementService.delete(repositoryPath, pathForm.isForce()); logger.info("Deleting Path {}:{}/{}...", pathForm.getStorageId(), pathForm.getRepositoryId(), pathForm.getPath()); return getSuccessfulResponseEntity(SUCCESSFUL_REPOSITORY_PATH_REMOVAL, accept); } catch (NullPointerException | RepositoryRelativePathConstructionException e) { return getFailedResponseEntity(HttpStatus.NOT_FOUND, FAILED_REPOSITORY_PATH_REMOVAL_FORM_ERROR, accept); } catch (IOException e) { return getExceptionResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR, FAILED_REPOSITORY_PATH_REMOVAL, e, accept); } }
Source:
public void unicast(Address address, String subject, byte[] payload) { final InetAddress resolvedAddress = address.address(); if (resolvedAddress == null) { LOGGER.debug("Cannot send unicast message to destination address as it cannot be resolved", address); return; } Message message = new Message(this.address, subject, payload); byte[] bytes = SERIALIZER.encode(message); ByteBuf buf = channel.alloc().buffer(4 + bytes.length); buf.writeInt(bytes.length).writeBytes(bytes); channel.writeAndFlush(new DatagramPacket(buf, new InetSocketAddress(resolvedAddress, address.port()))); }

Target:
public void unicast(Address address, String subject, byte[] payload) { final InetAddress resolvedAddress = address.address(); if (resolvedAddress == null) { LOGGER.debug("Failed sending unicast message (destination address cannot be resolved)", address); return; } Message message = new Message(this.address, subject, payload); byte[] bytes = SERIALIZER.encode(message); ByteBuf buf = channel.alloc().buffer(4 + bytes.length); buf.writeInt(bytes.length).writeBytes(bytes); channel.writeAndFlush(new DatagramPacket(buf, new InetSocketAddress(resolvedAddress, address.port()))); }
Source:
public void shouldPersistATransaction() throws Exception { GatewayAccountEntity gatewayAccount = new GatewayAccountEntity( defaultTestAccount.getPaymentProvider(), new HashMap<>(), TEST); gatewayAccount.setId(defaultTestAccount.getAccountId()); PaymentRequestEntity paymentRequestEntity = aValidPaymentRequestEntity() .withGatewayAccountEntity(gatewayAccount) .build(); paymentRequestDao.persist(paymentRequestEntity); assertThat(paymentRequestEntity.getChargeTransaction().getId(), is(IsNull.notNullValue())); }

Target:
public void shouldPersistATransaction() throws Exception { GatewayAccountEntity gatewayAccount = new GatewayAccountEntity( defaultTestAccount.getPaymentProvider(), new HashMap<>(), TEST); gatewayAccount.setId(defaultTestAccount.getAccountId()); PaymentRequestEntity paymentRequestEntity = aValidPaymentRequestEntity() .withGatewayAccountEntity(gatewayAccount) .build(); paymentRequestDao.persist(paymentRequestEntity); assertThat(paymentRequestEntity.getChargeTransaction().getId(), is(notNullValue())); }
Source:
public URL create(final Map<String, String> variables) { Assert.requireNonNull(variables, "variables"); final String url = variables.keySet() .stream() .reduce(urlRepresentation, (base, key) -> { final String value = variables.get(key); return replace(base, key, value); }); try { return new URL(url); } catch (MalformedURLException e) { throw new DolphinRuntimeException("Can not create url for '" + url + "'"); } }

Target:
public URL create(final Map<String, String> variables) { Assert.requireNonNull(variables, "variables"); final String url = variables.keySet() .stream() .reduce(urlRepresentation, (base, key) -> replace(base, key, variables.get(key))); try { return new URL(url); } catch (final MalformedURLException e) { throw new DolphinRuntimeException("Can not create url for '" + url + "'"); } }
Source:
public ColorColumn getColumnById(String id) { System.err.println(id); for (ColorColumn column : colorColumns) { if (column.getColumnId().equals(id)) { return column; } } return null; }

Target:
public ColorColumn getColumnById(String id) { for (ColorColumn column : colorColumns) { if (column.getColumnId().equals(id)) { return column; } } return null; }
Source:
public void run() { final NetworkRequest networkReq = new NetworkRequest.Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED) .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN) .build(); final ConnectivityManager cm = ConnectivityManager.from(mContext); cm.requestNetwork(networkReq, mNetworkCallback); }

Target:
public void run() { final NetworkRequest networkReq = new NetworkRequest.Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED) .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN) .addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED) .build(); final ConnectivityManager cm = ConnectivityManager.from(mContext); cm.requestNetwork(networkReq, mNetworkCallback); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NamesInSection other = (NamesInSection) obj; if (section == null) { if (other.section != null) return false; } else if (!section.equals(other.section)) return false; if (subsection == null) { if (other.subsection != null) return false; } else if (!subsection.equals(other.subsection)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NamesInSection other = (NamesInSection) obj; if (!section.equals(other.section)) return false; if (subsection == null) { if (other.subsection != null) return false; } else if (!subsection.equals(other.subsection)) return false; return true; }
Source:
public static String toOpenSshPublicKey(final String keyStr) { try { final StringBuilder strBuf = new StringBuilder(); final BufferedReader br = new BufferedReader(new StringReader(keyStr)); String line = br.readLine(); if (line != null && !line.equals("---- BEGIN SSH2 PUBLIC KEY ----")) { return keyStr; } while ((line = br.readLine()) != null) { if (line.indexOf(':') == -1) { strBuf.append(line); break; } } while ((line = br.readLine()) != null) { if (line.startsWith("---- ")) { break; } strBuf.append(line); } final PublicKey key = new Buffer(Base64.decodeBase64(Constants.encodeASCII(strBuf .toString()))).getRawPublicKey(); if (key instanceof RSAPublicKey) { strBuf.insert(0, KeyPairProvider.SSH_RSA + " "); } else if (key instanceof DSAPublicKey) { strBuf.insert(0, KeyPairProvider.SSH_DSS + " "); } else { return keyStr; } strBuf.append(' '); strBuf.append("converted-key"); return strBuf.toString(); } catch (IOException e) { return keyStr; } catch (RuntimeException re) { return keyStr; } }

Target:
public static String toOpenSshPublicKey(final String keyStr) { try { final StringBuilder strBuf = new StringBuilder(); final BufferedReader br = new BufferedReader(new StringReader(keyStr)); String line = br.readLine(); if (line == null || !line.equals("---- BEGIN SSH2 PUBLIC KEY ----")) { return keyStr; } while ((line = br.readLine()) != null) { if (line.indexOf(':') == -1) { strBuf.append(line); break; } } while ((line = br.readLine()) != null) { if (line.startsWith("---- ")) { break; } strBuf.append(line); } final PublicKey key = new Buffer(Base64.decodeBase64(Constants.encodeASCII(strBuf .toString()))).getRawPublicKey(); if (key instanceof RSAPublicKey) { strBuf.insert(0, KeyPairProvider.SSH_RSA + " "); } else if (key instanceof DSAPublicKey) { strBuf.insert(0, KeyPairProvider.SSH_DSS + " "); } else { return keyStr; } strBuf.append(' '); strBuf.append("converted-key"); return strBuf.toString(); } catch (IOException e) { return keyStr; } catch (RuntimeException re) { return keyStr; } }
Source:
private static boolean hasValidMigrationTag(RuleContext ruleContext) { return ruleContext .attributes() .get("tags", Type.STRING_LIST) .contains("__PROTO_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"); }

Target:
private static boolean hasValidMigrationTag(RuleContext ruleContext) { return ruleContext .attributes().get("tags", Type.STRING_LIST).contains(PROTO_RULES_MIGRATION_LABEL); }
Source:
public static void printHelp(PrintStream stream) { stream.println(); stream.println("Voldemort Coordinator Admin Tool"); stream.println("--------------------------------"); stream.println("get Get store client config for stores."); stream.println("put Put store client config for stroes from input string or given avro file"); stream.println("delete Delete store client config for stores"); stream.println(); stream.println("To get more information on each command, please try \'help <command-name>\'."); stream.println(); }

Target:
public static void printHelp(PrintStream stream) { stream.println(); stream.println("Voldemort Coordinator Admin Tool"); stream.println("--------------------------------"); stream.println("get Get store client config for stores."); stream.println("put Put store client config for stores from input string or given avro file"); stream.println("delete Delete store client config for stores"); stream.println(); stream.println("To get more information on each command, please try \'help <command-name>\'."); stream.println(); }
Source:
public void attachTransport(NettyServerTransport transport) { log.debug("Attaching %s observer to %s", getClass().getSimpleName(), transport == null ? "null" : transport.getClass().getSimpleName()); this.transportRef.set(transport); watcher.start(ImmutableSet.of(ticketSeedFile, keyFile, certFile), this::onFilesUpdated); }

Target:
public void attachTransport(NettyServerTransport transport) { log.debug("Attaching %s observer to %s", getClass().getSimpleName(), requireNonNull(transport).getClass().getSimpleName()); this.transportRef.set(transport); watcher.start(ImmutableSet.of(ticketSeedFile, keyFile, certFile), this::onFilesUpdated); }
Source:
protected Iterable<ITmfTrace> getTracesToBuild(ITmfTrace trace) { Element viewElement = fViewInfo.getViewElement(TmfXmlUiStrings.TIME_GRAPH_VIEW); if (viewElement == null) { return super.getTracesToBuild(trace); } Set<String> analysisIds = fViewInfo.getViewAnalysisIds(viewElement); Set<ITmfTrace> traces = new HashSet<>(); for (ITmfTrace aTrace : TmfTraceManager.getTraceSetWithExperiment(trace)) { if (analysisIds.isEmpty()) { if (aTrace.getAnalysisModulesOfClass(ITmfAnalysisModuleWithStateSystems.class).iterator().hasNext()) { traces.add(aTrace); } } else { for (String moduleId : analysisIds) { if (aTrace.getAnalysisModuleOfClass(ITmfAnalysisModuleWithStateSystems.class, moduleId) != null) { traces.add(aTrace); } } } } if (traces.isEmpty()) { return super.getTracesToBuild(trace); } return traces; }

Target:
protected Iterable<ITmfTrace> getTracesToBuild(ITmfTrace trace) { Element viewElement = fViewInfo.getViewElement(TmfXmlUiStrings.TIME_GRAPH_VIEW); if (viewElement == null) { return super.getTracesToBuild(trace); } Set<String> analysisIds = fViewInfo.getViewAnalysisIds(viewElement); Set<ITmfTrace> traces = new HashSet<>(); for (ITmfTrace aTrace : TmfTraceManager.getTraceSetWithExperiment(trace)) { if ((analysisIds.isEmpty() && aTrace.getAnalysisModulesOfClass(ITmfAnalysisModuleWithStateSystems.class).iterator().hasNext())) { traces.add(aTrace); } else { for (String moduleId : analysisIds) { if (aTrace.getAnalysisModuleOfClass(ITmfAnalysisModuleWithStateSystems.class, moduleId) != null) { traces.add(aTrace); } } } } if (traces.isEmpty()) { return super.getTracesToBuild(trace); } return traces; }
Source:
private static BiFunction<HttpClientResponse, Connection, Publisher<HttpResponse>> responseDelegate( final HttpRequest restRequest, final boolean disableBufferCopy) { return (reactorNettyResponse, reactorNettyConnection) -> Mono.defer(() -> Mono.using(() -> new ReactorNettyHttpResponse(reactorNettyResponse, reactorNettyConnection, restRequest, disableBufferCopy), Mono::just, HttpResponse::close)); }

Target:
private static BiFunction<HttpClientResponse, Connection, Publisher<HttpResponse>> responseDelegate( final HttpRequest restRequest, final boolean disableBufferCopy) { return (reactorNettyResponse, reactorNettyConnection) -> { HttpResponse response = new ReactorNettyHttpResponse(reactorNettyResponse, reactorNettyConnection, restRequest, disableBufferCopy); NettyResponseCloser.trackResponse(response); return Mono.just(response); }; }
Source:
public static EmbeddedBroker create() throws Exception { final Injector injector = GuiceInjectors.makeStartupInjector(); CliBroker broker = new CliBroker(); injector.injectMembers(broker); Injector brokerInjector = broker.makeInjector(); broker.initLifecycle(brokerInjector); return brokerInjector.getInstance(EmbeddedBroker.class); }

Target:
public static EmbeddedResource create() throws Exception { final Injector injector = GuiceInjectors.makeStartupInjector(); EmbeddedBroker broker = new EmbeddedBroker(); injector.injectMembers(broker); Injector brokerInjector = broker.makeInjector(); broker.initLifecycle(brokerInjector); return brokerInjector.getInstance(EmbeddedResource.class); }
Source:
public void testCalculateSubscriptions() throws Exception { CloudSigma2Api api = requestSendsResponse( postBuilder() .endpoint(endpoint + "subscriptioncalculator/") .payload(payloadFromResourceWithContentType("/subscriptioncalculator-request.json" , MediaType.APPLICATION_JSON)) .build() , responseBuilder() .payload(payloadFromResourceWithContentType("/subscriptioncalculator.json", MediaType.APPLICATION_JSON)) .build() ); SubscriptionCalculator subscriptionCalculator = api.calculateSubscriptions(ImmutableList.of( new CalcSubscription.Builder() .resource(SubscriptionResource.IP) .endTime(new SimpleDateFormatDateService().iso8601SecondsDateParse("2013-12-27T12:00:00+00:00")) .build() , new CalcSubscription.Builder() .resource(SubscriptionResource.VLAN) .endTime(new SimpleDateFormatDateService().iso8601SecondsDateParse("2013-12-27T12:00:00+00:00")) .build() , new CalcSubscription.Builder() .resource(SubscriptionResource.VLAN) .endTime(new SimpleDateFormatDateService().iso8601SecondsDateParse("2013-12-27T12:00:00+00:00")) .build() )); assertNotNull(subscriptionCalculator); for (CalcSubscription subscription : subscriptionCalculator.getSubscriptions()) { assertNotNull(subscription); } }

Target:
public void testCalculateSubscriptions() throws Exception { List<CalcSubscription> subscriptionsToCalculate = ImmutableList.of( new CalcSubscription.Builder() .amount(1) .resource(SubscriptionResource.IP) .endTime(new Date(1388145600000l)) .price(5.5) .startTime(new Date(1385547361440l)) .build(), new CalcSubscription.Builder() .amount(1) .resource(SubscriptionResource.VLAN) .endTime(new Date(1388145600000l)) .price(11) .startTime(new Date(1385547361440l)) .build(), new CalcSubscription.Builder() .amount(250) .resource(SubscriptionResource.CPU) .endTime(new Date(1388145600000l)) .price(3.366) .startTime(new Date(1385547361440l)) .build()); CloudSigma2Api api = requestSendsResponse( postBuilder() .endpoint(endpoint + "subscriptioncalculator/") .payload(payloadFromResourceWithContentType("/subscriptioncalculator-request.json", MediaType.APPLICATION_JSON)) .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/subscriptioncalculator.json", MediaType.APPLICATION_JSON)) .build()); SubscriptionCalculator subscriptionCalculator = api.calculateSubscriptions(subscriptionsToCalculate); assertNotNull(subscriptionCalculator); for (int i = 0; i < subscriptionsToCalculate.size(); i++) { checkCalcSubscription(subscriptionCalculator.getSubscriptions().get(i), subscriptionsToCalculate.get(i)); } }
Source:
protected boolean canDoAction() { StorageServerConnectionExtension newConnExt = getParameters().getStorageServerConnectionExtension(); return validate(getConnectionExtensionValidator().isConnectionDoesNotExistForHostAndTarget(newConnExt.getHostId(), newConnExt.getIqn())); }

Target:
protected boolean canDoAction() { StorageServerConnectionExtension newConnExt = getParameters().getStorageServerConnectionExtension(); return validate(getConnectionExtensionValidator().isConnectionDoesNotExistForHostAndTarget(newConnExt)); }
Source:
public static URL get(final String name) { File temp; try { if(!map.containsKey(name)) { temp = File.createTempFile("java-resource", ".tmp"); Path path = Paths.get(temp.getAbsolutePath()); Files.copy(Resources.class.getResourceAsStream(name), path, StandardCopyOption.REPLACE_EXISTING); URL url = temp.toURI().toURL(); map.put(name, url); return url; } else { return map.get(name); } } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
public static URL get(final String name) { File temp; try { URL url = map.get(name); if(url == null) { temp = File.createTempFile("java-resource", ".tmp"); Path path = Paths.get(temp.getAbsolutePath()); Files.copy(Resources.class.getResourceAsStream(name), path, StandardCopyOption.REPLACE_EXISTING); url = temp.toURI().toURL(); map.put(name, url); return url; } else { return url; } } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
public LiftOver(File chainFile){ this(toInputStream(chainFile), chainFile.toString()); }

Target:
public LiftOver(File chainFile){ this(Chain.loadChains(chainFile)); }