auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRegistration() throws Exception { deployContrib(BUNDLE_TEST_NAME, "notification-contrib.xml"); applyInlineDeployments(); List<Notification> notifications = getService().getNotificationsForEvents("testEvent"); assertEquals(1, notifications.size()); Notification notif = notifications.get(0); assertEquals("email", notif.getChannel()); assertEquals(false, notif.getAutoSubscribed()); assertEquals("section", notif.getAvailableIn()); assertEquals("Test Notification Label", notif.getLabel()); assertEquals("Test Notification Subject", notif.getSubject()); assertEquals("Test Notification Subject Template", notif.getSubjectTemplate()); assertEquals("test-template", notif.getTemplate()); assertEquals("NotificationContext['exp1']", notif.getTemplateExpr()); Map<String, Serializable> infos = new HashMap<>(); infos.put("exp1", "myDynamicTemplate"); String template = mailHelper.evaluateMvelExpresssion(notif.getTemplateExpr(), infos); assertEquals("myDynamicTemplate", template); notifications = getService().getNotificationsForSubscriptions("section"); assertEquals(1, notifications.size()); URL newModifTemplate = NotificationService.getTemplateURL("test-template"); assertTrue(newModifTemplate.getFile().endsWith("templates/test-template.ftl")); }

Target:
public void testRegistration() throws Exception { pushInlineDeployments(BUNDLE_TEST_NAME + ":notification-contrib.xml"); List<Notification> notifications = getService().getNotificationsForEvents("testEvent"); assertEquals(1, notifications.size()); Notification notif = notifications.get(0); assertEquals("email", notif.getChannel()); assertFalse(notif.getAutoSubscribed()); assertEquals("section", notif.getAvailableIn()); assertEquals("Test Notification Label", notif.getLabel()); assertEquals("Test Notification Subject", notif.getSubject()); assertEquals("Test Notification Subject Template", notif.getSubjectTemplate()); assertEquals("test-template", notif.getTemplate()); assertEquals("NotificationContext['exp1']", notif.getTemplateExpr()); Map<String, Serializable> infos = new HashMap<>(); infos.put("exp1", "myDynamicTemplate"); String template = mailHelper.evaluateMvelExpresssion(notif.getTemplateExpr(), infos); assertEquals("myDynamicTemplate", template); notifications = getService().getNotificationsForSubscriptions("section"); assertEquals(1, notifications.size()); URL newModifTemplate = NotificationService.getTemplateURL("test-template"); assertTrue(newModifTemplate.getFile().endsWith("templates/test-template.ftl")); }
Source:
public OwnCloudClient removeClientFor(OwnCloudAccount account) { OwnCloudClient clientRemoved = mSimpleFactoryManager.removeClientFor(account); OwnCloudClient clientRemoved2 = mSingleSessionManager.removeClientFor(account); if (clientRemoved2 != null) { return clientRemoved2; } else { return clientRemoved; } }

Target:
public OwnCloudClient removeClientFor(OwnCloudAccount account) { OwnCloudClient clientRemovedFromFactoryManager = mSimpleFactoryManager.removeClientFor(account); OwnCloudClient clientRemovedFromSingleSessionManager = mSingleSessionManager.removeClientFor(account); if (clientRemovedFromSingleSessionManager != null) { return clientRemovedFromSingleSessionManager; } else { return clientRemovedFromFactoryManager; } }
Source:
protected IFolder getFolder(IResource resource) { if (resource instanceof IFolder) { return (IFolder) resource; } return Adapters.getAdapter(resource, IFolder.class, true); }

Target:
protected IFolder getFolder(IResource resource) { return Adapters.getAdapter(resource, IFolder.class, true); }
Source:
protected T getCluster(Marker marker) { return mMarkerCache.get(marker); }

Target:
protected Cluster<T> getCluster(Marker marker) { return mMarkerToCluster.get(marker); }
Source:
public Callable<File> updateSynch(final String id, final InputStream content) { if (id.endsWith("/")) { throw new IllegalArgumentException( "Identifiers for use with this indexer may not end in '/'!"); } return new Callable<File>() { @Override public File call() throws IOException { String fullPath = id.substring(id.indexOf(" final String idPath = substringAfterLast(fullPath, "/"); fullPath = StringUtils.substringBeforeLast(fullPath, "/"); final Path dir = Paths.get(getPath(), fullPath); if (Files.notExists(dir, LinkOption.NOFOLLOW_LINKS)) { Files.createDirectories(Paths.get(getPath(), fullPath)); } final String fileName = idPath + ".jcr.xml"; final Path p = Paths.get(dir.toString(), fileName); LOGGER.debug("Updating to file: {}", fullPath, p.toAbsolutePath().toString()); Files.copy(content, p, new CopyOption[]{}); return p.toFile(); } }; }

Target:
public Callable<File> updateSynch(final String id, final InputStream content) { if (id.endsWith("/")) { throw new IllegalArgumentException( "Identifiers for use with this indexer may not end in '/'!"); } return new Callable<File>() { @Override public File call() throws IOException { String fullPath = id.substring(id.indexOf(" fullPath = StringUtils.substringBefore(fullPath, "/").replace(":", "/") + "/" + StringUtils.substringAfter(fullPath, "/"); final String idPath = URLEncoder.encode(substringAfterLast(fullPath, "/"), "UTF-8"); final String[] pathTokens = StringUtils.substringBeforeLast(fullPath, "/").split("/"); final StringBuilder pathBuilder = new StringBuilder(); for (final String token : pathTokens) { if (StringUtils.isNotBlank(token)) { pathBuilder.append(URLEncoder.encode(token, "UTF-8") + "/"); } } fullPath = pathBuilder.substring(0, pathBuilder.length() - 1).toString(); final Path dir = Paths.get(getPath(), fullPath); if (Files.notExists(dir, LinkOption.NOFOLLOW_LINKS)) { Files.createDirectories(Paths.get(getPath(), fullPath)); } final String fileName = idPath + ".jcr.xml"; final Path p = Paths.get(dir.toString(), fileName); LOGGER.debug("Updating to file: {}", fullPath, p.toAbsolutePath().toString()); Files.copy(content, p, new CopyOption[]{}); return p.toFile(); } }; }
Source:
protected boolean processImageInIrs() { Guid taskId = this.createAsyncTask(getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getReturnValue().getAsyncTaskIdList().add(taskId); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getImageGroupId(), getParameters().getDiskInfo().getSize(), getParameters().getDiskInfo().getVolumeType(), getParameters().getDiskInfo() .getVolumeFormat(), getDestinationImageId(), "", getStoragePool() .getcompatibility_version().toString())); if (vdsReturnValue.getSucceeded()) { getParameters().setTaskIds(new ArrayList<Guid>()); getParameters().getTaskIds().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); getReturnValue().getInternalVdsmTaskIdList().add(getParameters().getTaskIds().get(0)); return true; } return false; }

Target:
protected boolean processImageInIrs() { Guid taskId = this.createAsyncTask(getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getReturnValue().getAsyncTaskIdList().add(taskId); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getImageGroupId(), getParameters().getDiskInfo().getSize(), getParameters().getDiskInfo().getVolumeType(), getParameters().getDiskInfo() .getVolumeFormat(), getDestinationImageId(), "", getStoragePool() .getcompatibility_version().toString())); if (vdsReturnValue.getSucceeded()) { getParameters().setVdsmTaskIds(new ArrayList<Guid>()); getParameters().getVdsmTaskIds().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); getReturnValue().getInternalVdsmTaskIdList().add(getParameters().getVdsmTaskIds().get(0)); return true; } return false; }
Source:
public ContentResource wrap(final ContentResource content) { if (!isFiltered(content)) { return content; } Reference contentRef = entityManager.newReference(content.getReference()); Reference siteRef = entityManager.newReference(contentRef.getContext()); Entity entity = siteRef.getEntity(); String addHtml = content.getProperties().getProperty(ResourceProperties.PROP_ADD_HTML); String skinRepo = getSkinRepo(); String siteSkin = getSiteSkin(entity); String forcePopups = getForcePopupsOnMixedContent(); final boolean detectHtml = addHtml == null || addHtml.equals("auto"); String title = getTitle(content); StringBuilder header = new StringBuilder(); if ("standards".equals(addHtml) || addHtml.equals("auto")) { header.append(doctype); } header.append(MessageFormat.format(headerTemplate, skinRepo, siteSkin, title, forcePopups)); final String footer = footerTemplate; return new WrappedContentResource(content, header.toString(), footer, detectHtml); }

Target:
public ContentResource wrap(final ContentResource content) { if (!isFiltered(content)) { return content; } Reference contentRef = entityManager.newReference(content.getReference()); Reference siteRef = entityManager.newReference(contentRef.getContext()); Entity entity = siteRef.getEntity(); String addHtml = content.getProperties().getProperty(ResourceProperties.PROP_ADD_HTML); String skinRepo = getSkinRepo(); String siteSkin = getSiteSkin(entity); String forcePopups = getForcePopupsOnMixedContent(); final boolean detectHtml = addHtml == null || addHtml.equals("auto"); String title = getTitle(content); StringBuilder header = new StringBuilder(); if ("standards".equals(addHtml) || "auto".equals(addHtml)) { header.append(doctype); } header.append(MessageFormat.format(headerTemplate, skinRepo, siteSkin, title, forcePopups)); final String footer = footerTemplate; return new WrappedContentResource(content, header.toString(), footer, detectHtml); }
Source:
public void configure(Context context) { host = context.getString("host"); port = context.getInteger("port", DEFAULT_PORT); sslEnabled = context.getBoolean("sslEnabled", DEFAULT_SSL); version = context.getString("version", DEFAULT_VERSION); writerPoolSize = context.getInteger("writerPoolSize", DEFAULT_WRITER_POOL_SIZE); streamName = context.getString("streamName"); authClientClassPath = context.getString("authClientClass", DEFAULT_AUTH_CLIENT); authClientPropertiesPath = context.getString("authClientProperties", ""); Preconditions.checkState(host != null, "No hostname specified"); Preconditions.checkState(streamName != null, "No stream name specified"); }

Target:
public void configure(Context context) { host = context.getString("host"); port = context.getInteger("port", DEFAULT_PORT); sslEnabled = context.getBoolean("sslEnabled", DEFAULT_SSL); version = context.getString("version", DEFAULT_VERSION); writerPoolSize = context.getInteger("writerPoolSize", DEFAULT_WRITER_POOL_SIZE); streamName = context.getString("streamName"); authClientClassName = context.getString("authClientClass", DEFAULT_AUTH_CLIENT); authClientPropertiesPath = context.getString("authClientProperties", ""); Preconditions.checkState(host != null, "No hostname specified"); Preconditions.checkState(streamName != null, "No stream name specified"); }
Source:
public LookupSnapshotTaker( final @Json ObjectMapper jsonMapper, String persistDirectory ) { this.objectMapper = jsonMapper; this.persistDirectory = persistDirectory == null ? Files.createTempDir() : new File(persistDirectory); if (!this.persistDirectory.exists()) { this.persistDirectory.mkdirs(); } if (!this.persistDirectory.isDirectory()) { throw new ISE("Can only persist to directories, [%s] wasn't a directory", persistDirectory); } this.persistFile = new File(persistDirectory, "lookupSnapshot.data"); }

Target:
public LookupSnapshotTaker( final @Json ObjectMapper jsonMapper, String persistDirectory ) { this.objectMapper = jsonMapper; Preconditions.checkArgument(!Strings.isNullOrEmpty(persistDirectory), "can not work without specifying persistDirectory"); this.persistDirectory = new File(persistDirectory); if (!this.persistDirectory.exists()) { Preconditions.checkArgument(this.persistDirectory.mkdirs(), "Oups was not able to create persist directory"); } if (!this.persistDirectory.isDirectory()) { throw new ISE("Can only persist to directories, [%s] wasn't a directory", persistDirectory); } this.persistFile = new File(persistDirectory, PERSIST_FILE_NAME); }
Source:
public Date getExpiresOn() { return mExpiresOn != null ? new Date(mExpiresOn.getTime()) : null; }

Target:
public Date getExpiresOn() { return Utility.getImmutableDateObject(mExpiresOn); }
Source:
private void createAdvancedSection(final Composite composite) { if (commitId != null) return; ExpandableComposite advanced = new ExpandableComposite(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT); advanced.setText(UIText.CreateTagDialog_advanced); advanced.setToolTipText(UIText.CreateTagDialog_advancedToolTip); advanced.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .create()); Composite advancedComposite = new Composite(advanced, SWT.WRAP); advancedComposite.setLayout(GridLayoutFactory.swtDefaults().create()); advancedComposite.setLayoutData(GridDataFactory.fillDefaults().grab( true, true).create()); Label advancedLabel = new Label(advancedComposite, SWT.WRAP); advancedLabel.setText(UIText.CreateTagDialog_advancedMessage); advancedLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); commitCombo = new CommitCombo(advancedComposite, SWT.NORMAL); commitCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(300, SWT.DEFAULT).create()); advanced.setClient(advancedComposite); advanced.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { if (((Boolean) e.data).booleanValue() && commitCombo.getItemCount() == 0) { for (RevCommit revCommit : getRevCommits()) commitCombo.add(revCommit); } composite.layout(true); } }); }

Target:
private void createAdvancedSection(final Composite composite) { if (commitId != null) return; ExpandableComposite advanced = new ExpandableComposite(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT); advanced.setText(UIText.CreateTagDialog_advanced); advanced.setToolTipText(UIText.CreateTagDialog_advancedToolTip); advanced.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .create()); Composite advancedComposite = new Composite(advanced, SWT.WRAP); advancedComposite.setLayout(GridLayoutFactory.swtDefaults().create()); advancedComposite.setLayoutData(GridDataFactory.fillDefaults().grab( true, true).create()); Label advancedLabel = new Label(advancedComposite, SWT.WRAP); advancedLabel.setText(UIText.CreateTagDialog_advancedMessage); advancedLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); commitCombo = new CommitCombo(advancedComposite, SWT.NORMAL); commitCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(300, SWT.DEFAULT).create()); advanced.setClient(advancedComposite); advanced.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { if (((Boolean) e.data).booleanValue() && commitCombo.getItemCount() == 0) { final RevWalk[] commits = new RevWalk[1]; try { PlatformUI.getWorkbench().getProgressService() .busyCursorWhile(new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { commits[0] = getRevCommits(); } }); } catch (InvocationTargetException e1) { } catch (InterruptedException e1) { } for (RevCommit revCommit : commits[0]) commitCombo.add(revCommit); } composite.layout(true); } }); }
Source:
public boolean isRegionOnline(RegionInfo ri) { RetryCounter rc = null; while (!master.isStopped()) { RegionState rs = regionStates.getRegionState(ri); if (rs.isOpened()) { if (master.getServerManager().isServerOnline(rs.getServerName())) { return true; } } Optional<Procedure<MasterProcedureEnv>> optProc = master.getMasterProcedureExecutor().getProcedures(). stream().filter(p -> p instanceof ServerCrashProcedure).findAny(); LOG.warn("{} is NOT online; state={}; ServerCrashProcedures={}. Master startup cannot " + "progress, in holding-pattern until region onlined.", ri.getRegionNameAsString(), rs, optProc.isPresent()); if (rc == null) { rc = new RetryCounterFactory(1000).create(); } Threads.sleep(rc.getBackoffTimeAndIncrementAttempts()); } return false; }

Target:
public boolean isRegionOnline(RegionInfo ri) { RetryCounter rc = null; while (!master.isStopped()) { RegionState rs = regionStates.getRegionState(ri); if (rs.isOpened()) { if (master.getServerManager().isServerOnline(rs.getServerName())) { return true; } } Optional<Procedure<MasterProcedureEnv>> optProc = master.getMasterProcedureExecutor().getProcedures(). stream().filter(p -> p instanceof ServerCrashProcedure).findAny(); LOG.warn("{} is NOT online; state={}; ServerCrashProcedures={}. Master startup cannot " + "progress, in holding-pattern until region onlined.", ri.getRegionNameAsString(), rs, optProc.isPresent()); if (rc == null) { rc = new RetryCounterFactory(Integer.MAX_VALUE, 1000, 60_000).create(); } Threads.sleep(rc.getBackoffTimeAndIncrementAttempts()); } return false; }
Source:
public static StreamAddressSpace getStreamAddressSpace(StreamAddressSpaceMsg msg) { Roaring64NavigableMap roaring64NavigableMap = new Roaring64NavigableMap(); try(DataInputStream dis = new DataInputStream(msg.getAddressMap().newInput())) { roaring64NavigableMap.deserialize(dis); } catch (Exception ex) { log.error("getStreamAddressSpace: error=[{}, {}] " + "while deserializing roaring64NavigableMap", ex, ex.getCause()); } return new StreamAddressSpace(msg.getTrimMark(), roaring64NavigableMap); }

Target:
public static StreamAddressSpace getStreamAddressSpace(StreamAddressSpaceMsg msg) { Roaring64NavigableMap roaring64NavigableMap = new Roaring64NavigableMap(); try (DataInputStream dis = new DataInputStream(msg.getAddressMap().newInput())) { roaring64NavigableMap.deserialize(dis); } catch (IOException ex) { throw new SerializerException("Unexpected error while deserializing roaring64NavigableMap", ex); } return new StreamAddressSpace(msg.getTrimMark(), roaring64NavigableMap); }
Source:
protected boolean isBetweenOperator(ExpressionDTO prev, ExpressionDTO temp) { String prevOperator = prev.getOperator(); String tempOperator = temp.getOperator(); try { if (prevOperator.equals(BLCOperator.GREATER_THAN.name()) && tempOperator.equals(BLCOperator.LESS_THAN.name())) { return Long.parseLong(temp.getValue()) > Long.parseLong(prev.getValue()); } else if (prevOperator.equals(BLCOperator.LESS_THAN.name()) && tempOperator.equals(BLCOperator.GREATER_THAN.name())) { return Long.parseLong(prev.getValue()) > Long.parseLong(temp.getValue()); } return false; } catch (NumberFormatException e) { return false; } }

Target:
protected boolean isBetweenOperator(ExpressionDTO prev, ExpressionDTO temp) { String prevOperator = prev.getOperator(); String prevVal = prev.getValue(); String tempOperator = temp.getOperator(); String tempVal = temp.getValue(); try { if (prevOperator.equals(BLCOperator.GREATER_THAN.name()) && tempOperator.equals(BLCOperator.LESS_THAN.name())) { return Long.parseLong(tempVal) > Long.parseLong(prevVal); } else if (prevOperator.equals(BLCOperator.LESS_THAN.name()) && tempOperator.equals(BLCOperator.GREATER_THAN.name())) { return Long.parseLong(prevVal) > Long.parseLong(tempVal); } return false; } catch (NumberFormatException e) { LOG.warn(String.format("Used string values in expression %s %s && %s %s", prevOperator, prevVal, tempOperator, tempVal)); return false; } }
Source:
public void badMultiService() { assert_().about(javaSources()) .that(Arrays.asList( JavaFileObjects.forResource("test/SomeService.java"), JavaFileObjects.forResource("test/BadMultiServiceProvider.java"), JavaFileObjects.forResource("test/AnotherService.java"))) .processedWith(new AutoServiceProcessor()) .failsToCompile() .withErrorContaining(MISSING_SERVICES_ERROR); }

Target:
public void badMultiService() { assertThat(JavaFileObjects.forResource("test/NoServices.java")) .processedWith(new AutoServiceProcessor()) .failsToCompile() .withErrorContaining(MISSING_SERVICES_ERROR); }
Source:
private void lazyInit() { if (!initialized) { synchronized (this) { if (!initialized) { try { String ravenFactory = Lookup.lookup("ravenFactory"); if (ravenFactory != null) { setRavenFactory(ravenFactory); } String release = Lookup.lookup("release"); if (release != null) { setRelease(release); } String environment = Lookup.lookup("environment"); if (environment != null) { setEnvironment(environment); } String serverName = Lookup.lookup("serverName"); if (serverName != null) { setServerName(serverName); } String tags = Lookup.lookup("tags"); if (tags != null) { setTags(tags); } String extraTags = Lookup.lookup("extraTags"); if (extraTags != null) { setExtraTags(extraTags); } } finally { initialized = true; } } } } }

Target:
private void lazyInit() { if (raven == null) { initRaven(); } if (!initialized) { synchronized (this) { if (!initialized) { try { String ravenFactory = Lookup.lookup("ravenFactory"); if (ravenFactory != null) { setRavenFactory(ravenFactory); } String release = Lookup.lookup("release"); if (release != null) { setRelease(release); } String environment = Lookup.lookup("environment"); if (environment != null) { setEnvironment(environment); } String serverName = Lookup.lookup("serverName"); if (serverName != null) { setServerName(serverName); } String tags = Lookup.lookup("tags"); if (tags != null) { setTags(tags); } String extraTags = Lookup.lookup("extraTags"); if (extraTags != null) { setExtraTags(extraTags); } } finally { initialized = true; } } } } }
Source:
public boolean isAppPageview( String uriPath, String uriQuery, String contentType, String userAgent, String rawXAnalyticsHeader ) { final String appContentType = "application/json"; final String appUserAgent = "WikipediaApp"; final String appPageURIQuery = "sections=0"; final String iosAppPageURIQuery = "sections=all"; final String iosUserAgent = "iPhone"; Webrequest wr = Webrequest.getInstance(); if (!wr.getXAnalyticsValue(rawXAnalyticsHeader,"pageview").isEmpty()) return true; if (!wr.getXAnalyticsValue(rawXAnalyticsHeader,"preview").isEmpty()) return false; return ( Utilities.stringContains(uriPath, uriPathAPI) && ( Utilities.stringContains(uriQuery, appPageURIQuery) || (Utilities.stringContains(uriQuery, iosAppPageURIQuery) && Utilities.stringContains(userAgent, iosUserAgent)) ) && Utilities.stringContains(contentType, appContentType) && Utilities.stringContains(userAgent, appUserAgent) ); }

Target:
public boolean isAppPageview( String uriPath, String uriQuery, String contentType, String userAgent, String rawXAnalyticsHeader ) { final String appContentType = "application/json"; final String appUserAgent = "WikipediaApp"; final String appPageURIQuery = "sections=0"; final String iosAppPageURIQuery = "sections=all"; final String iosUserAgent = "iPhone"; Webrequest wr = Webrequest.getInstance(); if (wr.getXAnalyticsValue(rawXAnalyticsHeader,"preview").trim().equalsIgnoreCase("1")) return false; if (wr.getXAnalyticsValue(rawXAnalyticsHeader,"pageview").trim().equalsIgnoreCase("1")) return true; return ( Utilities.stringContains(uriPath, uriPathAPI) && ( Utilities.stringContains(uriQuery, appPageURIQuery) || (Utilities.stringContains(uriQuery, iosAppPageURIQuery) && Utilities.stringContains(userAgent, iosUserAgent)) ) && Utilities.stringContains(contentType, appContentType) && Utilities.stringContains(userAgent, appUserAgent) ); }
Source:
private void reset(final User player, final CommandSource sender) throws MaxMoneyException { BigDecimal startingBalance = ess.getSettings().getStartingBalance(); player.setMoney(startingBalance, UserBalanceUpdateEvent.Cause.COMMAND_ECO); player.sendMessage(tl("resetBalSelf", startingBalance.toString())); if(sender != null) { sender.sendMessage(tl("resetBalOther", player.getDisplayName(), startingBalance.toString())); } }

Target:
private void reset(final User player, final CommandSource sender) throws MaxMoneyException { BigDecimal startingBalance = ess.getSettings().getStartingBalance(); player.setMoney(startingBalance, UserBalanceUpdateEvent.Cause.COMMAND_ECO); player.sendMessage(tl("resetBalSelf", NumberUtil.displayCurrency(startingBalance, ess))); if(sender != null) { sender.sendMessage(tl("resetBalOther", player.getDisplayName(), NumberUtil.displayCurrency(startingBalance, ess))); } }
Source:
public OpenSslClientContext(File certChainFile, TrustManagerFactory trustManagerFactory) throws SSLException { this(certChainFile, trustManagerFactory, null, null, null, null, null, IdentityCipherSuiteFilter.INSTANCE, null, 0, 0, KeyStore.getDefaultType()); }

Target:
public OpenSslClientContext(File certChainFile, TrustManagerFactory trustManagerFactory) throws SSLException { this(certChainFile, trustManagerFactory, null, null, null, null, null, IdentityCipherSuiteFilter.INSTANCE, null, 0, 0); }
Source:
public void testNoInput() { List<Object> booleanList = new ArrayList<>(); assertCount(ImmutableList.of(), 0, 0); }

Target:
public void testNoInput() { assertCount(ImmutableList.of(), 0, 0); }
Source:
private List<Key> formsOfSurvey(DatastoreService ds, Long qId) { final Query optq = new Query("Survey").setFilter(new Query.FilterPredicate("surveyGroupId", FilterOperator.EQUAL, qId)); final PreparedQuery pqopt = ds.prepare(optq); List<Key> result = new ArrayList<>(); for (Entity qa : pqopt.asIterable(FetchOptions.Builder.withChunkSize(500))) { result.add(qa.getKey()); } return result; }

Target:
private List<Key> formsOfSurvey(DatastoreService ds, Long qId) { final Query optq = new Query("Survey") .setFilter(new Query.FilterPredicate("surveyGroupId", FilterOperator.EQUAL, qId)) .setKeysOnly(); final PreparedQuery pqopt = ds.prepare(optq); List<Key> result = new ArrayList<>(); for (Entity qa : pqopt.asIterable(FetchOptions.Builder.withChunkSize(500))) { result.add(qa.getKey()); } return result; }
Source:
private static void executeRunForRunnerClass(Class<?> runnerClass, String runMethodName, String[] runMethodArgs) { Method runMethod; try { runMethod = runnerClass.getDeclaredMethod(runMethodName, String[].class); } catch (NoSuchMethodException e) { throw new SamzaException(String.format("Isolation was enabled, but unable to find %s method", runMethodName), e); } runMethod.setAccessible(true); try { runMethod.invoke(null, new Object[]{runMethodArgs}); } catch (IllegalAccessException | InvocationTargetException e) { throw new SamzaException("Exception while executing runClusterBasedJobCoordinator method", e); } }

Target:
private static void executeRunForRunnerClass(Class<?> runnerClass, String runMethodName, String[] runMethodArgs) { Method runMethod; try { runMethod = runnerClass.getDeclaredMethod(runMethodName, String[].class); } catch (NoSuchMethodException e) { throw new SamzaException(String.format("Isolation was enabled, but unable to find %s method", runMethodName), e); } runMethod.setAccessible(true); try { runMethod.invoke(null, new Object[]{runMethodArgs}); } catch (IllegalAccessException | InvocationTargetException e) { throw new SamzaException(String.format("Exception while executing %s method", runMethodName), e); } }
Source:
public Set<Workflow> getWorkflowTypes() throws DtgovUiException { checkAuthorization(); Configuration dtgov_ui_conf = config.getConfiguration(); SrampAtomApiClient client = _srampClientAccessor.getClient(); Set<Workflow> workflows = new HashSet<Workflow>(); try { QueryResultSet results = client.buildQuery(SRAMP_WORKFLOW_QUERY) .parameter((String) dtgov_ui_conf.getProperty(WORKFLOW_ARTIFACT_GROUP_KEY)) .parameter((String) dtgov_ui_conf.getProperty(WORKFLOW_ARTIFACT_NAME_KEY)) .parameter((String) dtgov_ui_conf.getProperty(WORKFLOW_ARTIFACT_VERSION_KEY)).query(); if (results != null && results.iterator() != null) { Iterator<ArtifactSummary> results_iterator = results.iterator(); while (results_iterator.hasNext()) { ArtifactSummary artifact = results_iterator.next(); String name = artifact.getName().substring(0, artifact.getName().lastIndexOf(".")); Workflow workflow = new Workflow(); workflow.setUuid(artifact.getUuid()); workflow.setName(name); workflows.add(workflow); } } } catch (SrampClientException e) { throw new DtgovUiException(e.getMessage()); } catch (SrampAtomException e) { throw new DtgovUiException(e.getMessage()); } return workflows; }

Target:
public List<Workflow> getWorkflowTypes() throws DtgovUiException { checkAuthorization(); Configuration dtgov_ui_conf = config.getConfiguration(); SrampAtomApiClient client = _srampClientAccessor.getClient(); List<Workflow> workflows = new ArrayList<Workflow>(); try { QueryResultSet results = client.buildQuery(SRAMP_WORKFLOW_QUERY) .parameter((String) dtgov_ui_conf.getProperty(WORKFLOW_ARTIFACT_GROUP_KEY)) .parameter((String) dtgov_ui_conf.getProperty(WORKFLOW_ARTIFACT_NAME_KEY)) .parameter((String) dtgov_ui_conf.getProperty(WORKFLOW_ARTIFACT_VERSION_KEY)).query(); if (results != null && results.iterator() != null) { Iterator<ArtifactSummary> results_iterator = results.iterator(); while (results_iterator.hasNext()) { ArtifactSummary artifact = results_iterator.next(); String name = artifact.getName().substring(0, artifact.getName().lastIndexOf(".")); Workflow workflow = new Workflow(); workflow.setUuid(artifact.getUuid()); workflow.setName(name); workflows.add(workflow); } } } catch (SrampClientException e) { throw new DtgovUiException(e.getMessage()); } catch (SrampAtomException e) { throw new DtgovUiException(e.getMessage()); } return workflows; }
Source:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof CalledFunction) { CalledFunction calledFunction = (CalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); if (calledFunction.getSymbol() instanceof ITmfStateValue) { ITmfStateValue symbol = ((ITmfStateValue) calledFunction.getSymbol()); switch (symbol.getType()) { case LONG: Long longAddress = symbol.unboxLong(); symbolText = provider.getSymbolText(longAddress); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } return symbolText; case STRING: return symbol.unboxStr(); case INTEGER: Integer intAddress = symbol.unboxInt(); symbolText = provider.getSymbolText(intAddress); if (symbolText == null) { return "0x" + Integer.toHexString(intAddress); } return symbolText; case DOUBLE: case NULL: case CUSTOM: default: break; } } } } return null; }

Target:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); if (calledFunction.getSymbol() instanceof ITmfStateValue) { ITmfStateValue symbol = ((ITmfStateValue) calledFunction.getSymbol()); switch (symbol.getType()) { case LONG: Long longAddress = symbol.unboxLong(); symbolText = provider.getSymbolText(longAddress); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } return symbolText; case STRING: return symbol.unboxStr(); case INTEGER: Integer intAddress = symbol.unboxInt(); symbolText = provider.getSymbolText(intAddress); if (symbolText == null) { return "0x" + Integer.toHexString(intAddress); } return symbolText; case DOUBLE: case NULL: case CUSTOM: default: break; } } } } return null; }
Source:
protected Object innerCall() throws Exception { final TransactionContext context = endpoint.getTransactionContext(parameters.txnId); final TransactionalQueue queue = context.getQueue(parameters.name); return queue.addAll(parameters.items); }

Target:
protected Object innerCall() throws Exception { final TransactionContext context = endpoint.getTransactionContext(parameters.txnId); final TransactionalQueue queue = context.getQueue(parameters.name); return queue.addAll(parameters.items, parameters.timeout, TimeUnit.MILLISECONDS); }
Source:
public void rconLogoutCallback(CallbackInfo ci) { if (this.loggedIn) { ((SpongeScheduler) Sponge.getServer().getScheduler()).callSync(() -> { final CauseStackManager causeStackManager = Sponge.getCauseStackManager(); causeStackManager.pushCause(this); causeStackManager.pushCause(this.source); final RconConnectionEvent.Disconnect event = SpongeEventFactory.createRconConnectionEventDisconnect( causeStackManager.getCurrentCause(), (RconSource) this.source); SpongeImpl.postEvent(event); causeStackManager.popCauses(2); return event; }); } }

Target:
public void rconLogoutCallback(CallbackInfo ci) { if (this.loggedIn) { ServerInternal.SCHEDULER.callSync(() -> { final CauseStackManager causeStackManager = Sponge.getCauseStackManager(); causeStackManager.pushCause(this); causeStackManager.pushCause(this.source); final RconConnectionEvent.Disconnect event = SpongeEventFactory.createRconConnectionEventDisconnect( causeStackManager.getCurrentCause(), (RconSource) this.source); SpongeImpl.postEvent(event); causeStackManager.popCauses(2); return event; }); } }
Source:
public int hashCode() { int hashCode = name.hashCode(); hashCode += Boolean.valueOf(exclusiveGroup).hashCode(); for (final PermissionRule r : rules) { hashCode += r.hashCode(); } return hashCode; }

Target:
public int hashCode() { return name.hashCode(); }
Source:
public ClientType getClientType() { return null; }

Target:
public ClientType getClientType() { return ClientType.UNKNOWN; }
Source:
public static <E extends RealmModel> void addChangeListener(E object, RealmChangeListener<E> listener) { if (listener == null) { throw new IllegalArgumentException("Listener should not be null"); } if (object instanceof RealmObjectProxy) { RealmObjectProxy proxy = (RealmObjectProxy) object; BaseRealm realm = proxy.realmGet$proxyState().getRealm$realm(); realm.checkIfValid(); if (realm.handler == null) { throw new IllegalStateException("You can't register a listener from a non-Looper thread "); } List<RealmChangeListener> listeners = proxy.realmGet$proxyState().getListeners$realm(); if (!listeners.contains(listener)) { listeners.add(listener); } if (isLoaded(object)) { realm.handlerController.addToRealmObjects((RealmObjectProxy)object); } } else { throw new IllegalArgumentException("Cannot add listener from this unmanaged RealmObject (created outside of Realm)"); } }

Target:
public static <E extends RealmModel> void addChangeListener(E object, RealmChangeListener<E> listener) { if (listener == null) { throw new IllegalArgumentException("Listener should not be null"); } if (object instanceof RealmObjectProxy) { RealmObjectProxy proxy = (RealmObjectProxy) object; BaseRealm realm = proxy.realmGet$proxyState().getRealm$realm(); realm.checkIfValid(); if (realm.handler == null) { throw new IllegalStateException("You can't register a listener from a non-Looper thread "); } List<RealmChangeListener> listeners = proxy.realmGet$proxyState().getListeners$realm(); if (!listeners.contains(listener)) { listeners.add(listener); } if (isLoaded(proxy)) { realm.handlerController.addToRealmObjects(proxy); } } else { throw new IllegalArgumentException("Cannot add listener from this unmanaged RealmObject (created outside of Realm)"); } }
Source:
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { String analysisId = fViewInfo.getViewAnalysisId(); return new AbstractSegmentStoreScatterChartTreeViewer(Objects.requireNonNull(parent), String.valueOf(analysisId)); }

Target:
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { String analysisId = fViewInfo.getViewAnalysisId(); return new AbstractSegmentStoreScatterChartTreeViewer(Objects.requireNonNull(parent), String.valueOf(analysisId)) { @Override protected @NonNull String getAnalysisId() { String viewAnalysisId = fViewInfo.getViewAnalysisId(); return viewAnalysisId == null ? super.getAnalysisId() : viewAnalysisId; } }; }
Source:
public static Optional<InsightCard> processSleepAlarm(final Long accountId, final List<Integer> wakeTimeList, final Integer userAge) { if (wakeTimeList.isEmpty()) { LOGGER.debug("Got nothing in wakeTimeList"); return Optional.absent(); } else if (wakeTimeList.size() <= 2) { LOGGER.debug("Size of wakeTimeList is less than 2 for accountId {}", accountId); return Optional.absent(); } final DescriptiveStatistics stats = new DescriptiveStatistics(); for (final int wakeTime : wakeTimeList) { stats.addValue(wakeTime); } final Boolean passSafeGuards = checkSafeGuards(stats); if (!passSafeGuards) { return Optional.absent(); } final Double wakeAvgDouble = stats.getMean(); final int wakeAvg = (int) Math.round(wakeAvgDouble); final int recSleepDurationMins = getRecommendedSleepDurationMinutes(userAge); final int recommendedSleepMinutesTime = wakeAvg - recSleepDurationMins; final String wakeTime = InsightUtils.timeConvert(wakeAvg); final String preSleepTime = InsightUtils.timeConvert((recommendedSleepMinutesTime - PRE_SLEEP_TIME)); final String sleepTime = InsightUtils.timeConvert(recommendedSleepMinutesTime); final Text text = SleepAlarmMsgEN.getSleepAlarmMessage(wakeTime, recSleepDurationMins, preSleepTime, sleepTime); return Optional.of(new InsightCard(accountId, text.title, text.message, InsightCard.Category.SLEEP_TIME, InsightCard.TimePeriod.MONTHLY, DateTime.now(DateTimeZone.UTC), InsightCard.InsightType.DEFAULT)); }

Target:
public static Optional<InsightCard> processSleepAlarm(final Long accountId, final List<Integer> wakeTimeList, final Integer userAge) { if (wakeTimeList.isEmpty()) { LOGGER.info("account_id={}-insight=sleep_alarm-action=wake_time_list_empty", accountId); return processSleepAlarmFallBack(accountId); } else if (wakeTimeList.size() <= 2) { LOGGER.info("account_id={}-insight=sleep_alarm-action=wake_time_list_too_small", accountId); return processSleepAlarmFallBack(accountId); } final DescriptiveStatistics stats = new DescriptiveStatistics(); for (final int wakeTime : wakeTimeList) { stats.addValue(wakeTime); } final Boolean passSafeGuards = checkSafeGuards(stats); if (!passSafeGuards) { LOGGER.info("insight=sleep_alarm-account_id={}-action=fail_safe_guard"); return processSleepAlarmFallBack(accountId); } final Double wakeAvgDouble = stats.getMean(); final int wakeAvg = (int) Math.round(wakeAvgDouble); final int recSleepDurationMins = getRecommendedSleepDurationMinutes(userAge); final int recommendedSleepMinutesTime = wakeAvg - recSleepDurationMins; final String wakeTime = InsightUtils.timeConvert(wakeAvg); final String preSleepTime = InsightUtils.timeConvert((recommendedSleepMinutesTime - PRE_SLEEP_TIME)); final String sleepTime = InsightUtils.timeConvert(recommendedSleepMinutesTime); final Text text = SleepAlarmMsgEN.getSleepAlarmMessage(wakeTime, recSleepDurationMins, preSleepTime, sleepTime); return Optional.of(new InsightCard(accountId, text.title, text.message, InsightCard.Category.SLEEP_TIME, InsightCard.TimePeriod.MONTHLY, DateTime.now(DateTimeZone.UTC), InsightCard.InsightType.DEFAULT)); }
Source:
RequestBuilder createKeepAliveRequest() { RequestBuilder builder = createRequest(); builder.setHeader(ENGINE_REFRESH_HEADER, "refresh-only"); return builder; }

Target:
RequestBuilder createKeepAliveRequest() { return createRequest(); }
Source:
private Optional<Widget> toWidget(Object item) { if (item == null) { return handleNull(); } if (item instanceof EasyForm) { return of(((EasyForm) item).getView()); } Widget widget = MIMEContainerFactory.getTableDisplay(item); if (widget != null) { return of(widget); } if (item instanceof Widget) { return of((Widget) item); } if (item instanceof MIMEContainer) { return of(createHTML(((MIMEContainer) item).getData().toString())); } return of(createHTMLPre(item.toString())); }

Target:
private Optional<Widget> toWidget(Object item) { if (item == null) { return handleNull(); } if (item instanceof WidgetItem) { return of(((WidgetItem) item).asWidget()); } Widget widget = MIMEContainerFactory.getTableDisplay(item); if (widget != null) { return of(widget); } if (item instanceof MIMEContainer) { return of(createHTML(((MIMEContainer) item).getData().toString())); } return of(createHTMLPre(item.toString())); }
Source:
private boolean isWritable(ModelNode attrDescr) { return !attrDescr.has(Util.ACCESS_TYPE) || !(Util.READ_ONLY.equals(attrDescr.get(Util.ACCESS_TYPE).asString()) || Util.METRIC.equals(attrDescr.get(Util.ACCESS_TYPE).asString())); }

Target:
private boolean isWritable(ModelNode attrDescr) { return !isReadOnly(attrDescr); }
Source:
private void internalDoFetch(RefSpec spec, String uri, boolean doCheckout, boolean doCreateTag, boolean doCreateBranch, boolean doActivateAdditionalRefs, String textForTag, String textForBranch, IProgressMonitor monitor) { int totalWork = 1; if (doCheckout) totalWork++; if (doCreateTag || doCreateBranch) totalWork++; monitor.beginTask( UIText.FetchGerritChangePage_GetChangeTaskName, totalWork); try { RevCommit commit = fetchChange(uri, spec, monitor); if (doCreateTag) { createTag(spec, textForTag, commit, monitor); } if (doCreateBranch) { createBranch(textForBranch, commit, monitor); } if (doCheckout || doCreateTag) { checkout(commit, monitor); } if (doActivateAdditionalRefs) { activateAdditionalRefs(); } storeLastUsedUri(uri); } catch (Exception e) { Activator .handleError(e.getCause().getMessage(), e.getCause(), true); } finally { monitor.done(); } }

Target:
private void internalDoFetch(RefSpec spec, String uri, boolean doCheckout, boolean doCreateTag, boolean doCreateBranch, boolean doActivateAdditionalRefs, String textForTag, String textForBranch, IProgressMonitor monitor) { int totalWork = 1; if (doCheckout) totalWork++; if (doCreateTag || doCreateBranch) totalWork++; monitor.beginTask( UIText.FetchGerritChangePage_GetChangeTaskName, totalWork); try { RevCommit commit = fetchChange(uri, spec, monitor); if (doCreateTag) createTag(spec, textForTag, commit, monitor); if (doCreateBranch) createBranch(textForBranch, commit, monitor); if (doCheckout || doCreateTag) checkout(commit, monitor); if (doActivateAdditionalRefs) activateAdditionalRefs(); storeLastUsedUri(uri); } catch (Exception e) { Activator .handleError(e.getCause().getMessage(), e.getCause(), true); } finally { monitor.done(); } }
Source:
public static int getMajorVersion(String stringToParse){ String fullVersion = getVersion(stringToParse); if(fullVersion != null) { int firstDot = fullVersion.indexOf('.'); if(firstDot >= 0) { return Integer.valueOf(fullVersion.substring(0, firstDot)); } } return 0; }

Target:
public static int getMajorVersion(String stringToParse){ String fullVersion = getVersion(stringToParse); if(fullVersion != null) { int firstDot = fullVersion.indexOf('.'); if(firstDot >= 0) { return Integer.valueOf(fullVersion.substring(0, firstDot)); } } return -1; }
Source:
private void asyncProcessUploadedEnrichmentTags() { new Thread(new Runnable() { public void run() { uploadEnrichmentTagProcessor.processUploadedEnrichmentTags(); runTagPostUploadProcessingJob(); }; }).start(); }

Target:
private void asyncProcessUploadedEnrichmentTags() { new Thread(new Runnable() { public void run() { uploadEnrichmentTagProcessor.processUploadedEnrichmentTags(); }; }).start(); }
Source:
public void testGetDefaultPool() throws Exception { final MacPool defaultPool = dao.getDefaultPool(); assertThat(defaultPool, notNullValue()); assertThat(defaultPool.getId(), is(FixturesTool.DEFAULT_MAC_POOL_ID)); }

Target:
public void testGetDefaultPool() throws Exception { final MacPool defaultPool = dao.getDefaultPool(); assertThat(defaultPool, notNullValue()); assertThat(defaultPool.getId(), is(FixturesTool.DEFAULT_MAC_POOL_ID)); assertThat(defaultPool.isDefaultPool(), is(true)); }
Source:
private void updateVmDeviceWithDataReturnedFromHost(VDSReturnValue vdsReturnValue) { if (vdsReturnValue.getSucceeded() && getParameters().getAction() == PlugAction.PLUG) { VmInfoReturn vmInfoReturn = (VmInfoReturn) vdsReturnValue.getReturnValue(); if (vmInfoReturn.getVmInfo() != null) { Map<String, Object> vmInfo = (Map<String, Object>) vmInfoReturn.getVmInfo(); for (Object o : (Object[]) vmInfo.get(VdsProperties.Devices)) { Map<String, Object> vdsmDevice = (Map<String, Object>) o; if (vmDevice.getId() .getDeviceId() .toString() .equals((String) vdsmDevice.get(VdsProperties.DeviceId))) { vmDevice.setAddress(vdsmDevice.get(VdsProperties.Address).toString()); vmDevice.setAlias(StringUtils.defaultString((String) vdsmDevice.get(VdsProperties.Alias))); } } } } }

Target:
private void updateVmDeviceWithDataReturnedFromHost(VDSReturnValue vdsReturnValue) { if (vdsReturnValue.getSucceeded() && getParameters().getAction() == PlugAction.PLUG) { VmInfoReturn vmInfoReturn = (VmInfoReturn) vdsReturnValue.getReturnValue(); if (vmInfoReturn.getVmInfo() != null) { Map<String, Object> vmInfo = (Map<String, Object>) vmInfoReturn.getVmInfo(); for (Object o : (Object[]) vmInfo.get(VdsProperties.Devices)) { Map<String, Object> vdsmDevice = (Map<String, Object>) o; if (vmDevice.getId().getDeviceId().toString().equals(vdsmDevice.get(VdsProperties.DeviceId))) { vmDevice.setAddress(vdsmDevice.get(VdsProperties.Address).toString()); vmDevice.setAlias(StringUtils.defaultString((String) vdsmDevice.get(VdsProperties.Alias))); } } } } }
Source:
public boolean equalsToClassName(String name) { return memberName == null && className != null && className.equals(name); }

Target:
private boolean equalsToClassName(String name) { return memberName == null && className != null && className.equals(name); }
Source:
public RequestMatcher value(String parameter, String... expectedValues) { List<Matcher<? super String>> matcherList = Arrays.stream(expectedValues) .map(Matchers::equalTo) .collect(Collectors.toList()); return this.value(parameter, matcherList); }

Target:
public RequestMatcher value(String parameter, String... expectedValues) { List<Matcher<? super String>> matcherList = Arrays.stream(expectedValues) .map(Matchers::equalTo) .collect(Collectors.toList()); return value(parameter, matcherList); }
Source:
protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws NotEnoughArgumentsException, ChargeException, MaxMoneyException { switch (cmd) { case GIVE: if (isPercent) player.percentHandler(amount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO, 0); else player.giveMoney(amount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO); break; case TAKE: take(amount, player, sender); break; case RESET: case SET: set(amount, player, sender); break; } }

Target:
protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws NotEnoughArgumentsException, ChargeException, MaxMoneyException { if (isPercent && cmd != EcoCommands.RESET) { amount = player.getMoney().multiply(amount).scaleByPowerOfTen(-2); } switch (cmd) { case GIVE: player.giveMoney(amount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO); break; case TAKE: take(amount, player, sender); break; case RESET: case SET: set(amount, player, sender); break; } }