auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LockInfo(ZNRecord znRecord) { this(); if (znRecord != null) { String ownerId = znRecord.getSimpleField(LockInfoAttribute.OWNER.name()); String message = znRecord.getSimpleField(LockInfoAttribute.MESSAGE.name()); long timeout = znRecord .getLongField(LockInfoAttribute.TIMEOUT.name(), LockConstants.DEFAULT_TIMEOUT_LONG); int priority = znRecord .getIntField(LockInfoAttribute.PRIORITY.name(), LockConstants.DEFAULT_PRIORITY_INT); long waitingTimeout = znRecord.getLongField(LockInfoAttribute.WAITING_TIMEOUT.name(), LockConstants.DEFAULT_WAITING_TIMEOUT_LONG); long cleanupTimeout = znRecord.getLongField(LockInfoAttribute.CLEANUP_TIMEOUT.name(), LockConstants.DEFAULT_CLEANUP_TIMEOUT_LONG); String requestorId = znRecord.getSimpleField(LockInfoAttribute.REQUESTOR_ID.name()); int requestorPriority = znRecord.getIntField(LockInfoAttribute.REQUESTOR_PRIORITY.name(), LockConstants.DEFAULT_REQUESTOR_PRIORITY_INT); long requestorWaitingTimeout = znRecord .getLongField(LockInfoAttribute.REQUESTOR_WAITING_TIMEOUT.name(), LockConstants.DEFAULT_REQUESTOR_WAITING_TIMEOUT_LONG); long requestorRequestingTimestamp = znRecord .getLongField(LockInfoAttribute.REQUESTOR_REQUESTING_TIMESTAMP.name(), LockConstants.DEFAULT_REQUESTOR_REQUESTING_TIMESTAMP_LONG); setLockInfoFields(ownerId, message, timeout, priority, waitingTimeout, cleanupTimeout, requestorId, requestorPriority, requestorWaitingTimeout, requestorRequestingTimestamp); } }

Target:
public LockInfo(ZNRecord znRecord) { if (znRecord == null) { znRecord = new ZNRecord(ZNODE_ID); } String ownerId = znRecord.getSimpleField(LockInfoAttribute.OWNER.name()) == null ? LockConstants.DEFAULT_USER_ID : znRecord.getSimpleField(LockInfoAttribute.OWNER.name()); String message = znRecord.getSimpleField(LockInfoAttribute.MESSAGE.name()) == null ? LockConstants.DEFAULT_MESSAGE_TEXT : znRecord.getSimpleField(LockInfoAttribute.MESSAGE.name()); long timeout = znRecord.getLongField(LockInfoAttribute.TIMEOUT.name(), LockConstants.DEFAULT_TIMEOUT_LONG); int priority = znRecord.getIntField(LockInfoAttribute.PRIORITY.name(), LockConstants.DEFAULT_PRIORITY_INT); long waitingTimeout = znRecord.getLongField(LockInfoAttribute.WAITING_TIMEOUT.name(), LockConstants.DEFAULT_WAITING_TIMEOUT_LONG); long cleanupTimeout = znRecord.getLongField(LockInfoAttribute.CLEANUP_TIMEOUT.name(), LockConstants.DEFAULT_CLEANUP_TIMEOUT_LONG); String requestorId = znRecord.getSimpleField(LockInfoAttribute.REQUESTOR_ID.name()); int requestorPriority = znRecord.getIntField(LockInfoAttribute.REQUESTOR_PRIORITY.name(), LockConstants.DEFAULT_PRIORITY_INT); long requestorWaitingTimeout = znRecord .getLongField(LockInfoAttribute.REQUESTOR_WAITING_TIMEOUT.name(), LockConstants.DEFAULT_WAITING_TIMEOUT_LONG); long requestingTimestamp = znRecord .getLongField(LockInfoAttribute.REQUESTING_TIMESTAMP.name(), LockConstants.DEFAULT_REQUESTING_TIMESTAMP_LONG); setLockInfoFields(ownerId, message, timeout, priority, waitingTimeout, cleanupTimeout, requestorId, requestorPriority, requestorWaitingTimeout, requestingTimestamp); }
Source:
private AuthorizationFramework() { String path = RuntimeEnvironment.getInstance() .getPluginDirectory(); plugins = new ArrayList<>(); this.directory = path == null ? null : new File(path); reload(); }

Target:
private AuthorizationFramework() { String path = RuntimeEnvironment.getInstance() .getPluginDirectory(); plugins = new ArrayList<>(); setPluginDirectory(path); reload(); }
Source:
private boolean looksLikeChannel(int tp) { if (tokenStream.get(tp).getKind() == TokenKind.IDENTIFIER) { String prefix = tokenStream.get(tp).data; if (prefix.equals("queue") || prefix.equals("tap") || prefix.equals("topic")) { if (tokenStream.get(tp + 1).getKind() == TokenKind.COLON) { return true; } } } return false; }

Target:
private boolean looksLikeChannel(int tp) { if (tokenStream.get(tp).getKind() == TokenKind.IDENTIFIER) { String prefix = tokenStream.get(tp).data; if (isLegalChannelPrefix(prefix)) { if (tokenStream.get(tp + 1).getKind() == TokenKind.COLON) { return true; } } } return false; }
Source:
public ImmutableValue<Entity> vehicle() { return new ImmutableSpongeValue<Entity>(Keys.VEHICLE, vehicle); }

Target:
public ImmutableValue<Entity> vehicle() { return new ImmutableSpongeEntityValue(Keys.VEHICLE, vehicle.get()); }
Source:
OperationSelector(Object[] operations) { this.random = new Random(); this.operations = operations; }

Target:
OperationSelector(Object[] operations) { this.operations = operations; }
Source:
public DetectFuture addListener(DetectFutureListener<DetectFuture> listener) { try { DetectResults detectResults = future.get(); setServiceDetected(detectResults.isServiceDetected()); } catch (InterruptedException e) { setServiceDetected(false); setException(e); } catch (ExecutionException e) { setServiceDetected(false); setException(e); } listener.operationComplete(this); return this; }

Target:
public DetectFuture addListener(DetectFutureListener<DetectFuture> listener) { try { DetectResults detectResults = future.get(); setServiceDetected(detectResults.isServiceDetected()); } catch (InterruptedException | ExecutionException e) { setServiceDetected(false); setException(e); } listener.operationComplete(this); return this; }
Source:
@Test void sortedAgg() { tester(false, new JdbcTest.HrSchema()) .query( "select deptno, " + "max(salary) as max_salary, count(name) as num_employee " + "from emps group by deptno") .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> { planner.removeRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE); planner.addRule(EnumerableRules.ENUMERABLE_SORTED_AGGREGATE_RULE); }) .explainContains( "EnumerableSortedAggregate(group=[{1}], max_salary=[MAX($3)], num_employee=[COUNT($2)])\n" + " EnumerableSort(sort0=[$1], dir0=[ASC])\n" + " EnumerableTableScan(table=[[s, emps]])") .returnsUnordered( "deptno=10; max_salary=11500.0; num_employee=3", "deptno=20; max_salary=8000.0; num_employee=1"); }

Target:
@Test void sortedAgg() { tester(false, new JdbcTest.HrSchema()) .query( "select deptno, " + "max(salary) as max_salary, count(name) as num_employee " + "from emps group by deptno") .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> { planner.removeRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE); planner.addRule(EnumerableRules.ENUMERABLE_SORTED_AGGREGATE_RULE); }) .explainContains( "EnumerableSortedAggregate(group=[{1}], max_salary=[MAX($3)], num_employee=[COUNT($2)])\n" + " EnumerableSort(sort0=[$1], dir0=[ASC])\n" + " EnumerableTableScan(table=[[s, emps]])") .returnsOrdered( "deptno=10; max_salary=11500.0; num_employee=3", "deptno=20; max_salary=8000.0; num_employee=1"); }
Source:
private void validateWildcardPath(String path) { if (!path.matches("^([^*]*\\*){1}[^*]*$") || !path.endsWith("*")) { throw new IllegalStateException("Please provide correct path. Ex demoResources/*"); } }

Target:
private void validateWildcardPath(String path) { if (!containsSingleWildcardSymbol(path) || !path.endsWith("*")) { throw new IllegalStateException("Wildcard can only appear at end of classpath: " + path); } }
Source:
public static void checkAccessPermission(Field field) { checkAccessPermission(field.getDeclaringClass(), field.getModifiers(), field.isAccessible() ); }

Target:
static void checkAccessPermission(Field field) { try { checkAccessPermission(field.getDeclaringClass(), field.getModifiers(), field.isAccessible()); } catch (AccessControlException e) { throw createCacheAccessControlExceptionOf(field, e); } }
Source:
private void sendToRedis(RowMap msg) throws Exception { String messageStr = msg.toJSON(outputConfig); switch (redisType) { case "lpush": jedis.lpush(this.channel, messageStr); break; case "xadd": Map<String, String> message = new HashMap<>(); String jsonKey = this.context.getConfig().redisStreamJsonKey; if (jsonKey == null) { throw new IllegalArgumentException("Stream requires key name for serialized JSON value"); } else { message.put(jsonKey, messageStr); } jedis.xadd(this.channel, new StreamEntryID(), message); break; case "pubsub": default: jedis.publish(this.channel, messageStr); break; } if (logger.isDebugEnabled()) { switch (redisType) { case "lpush": logger.debug("-> queue:" + channel + ", msg:" + msg); break; case "xadd": logger.debug("-> stream:" + channel + ", msg:" + msg); break; case "pubsub": default: logger.debug("-> channel:" + channel + ", msg:" + msg); break; } } this.succeededMessageCount.inc(); this.succeededMessageMeter.mark(); }

Target:
private void sendToRedis(RowMap msg) throws Exception { String messageStr = msg.toJSON(outputConfig); switch (redisType) { case "lpush": jedis.lpush(this.channel, messageStr); break; case "xadd": Map<String, String> message = new HashMap<>(); String jsonKey = this.context.getConfig().redisStreamJsonKey; if (jsonKey == null) { throw new IllegalArgumentException("Stream requires key name for serialized JSON value"); } else { message.put(jsonKey, messageStr); } jedis.xadd(this.channel, StreamEntryID.NEW_ENTRY, message); break; case "pubsub": default: jedis.publish(this.channel, messageStr); break; } if (logger.isDebugEnabled()) { switch (redisType) { case "lpush": logger.debug("-> queue:" + channel + ", msg:" + msg); break; case "xadd": logger.debug("-> stream:" + channel + ", msg:" + msg); break; case "pubsub": default: logger.debug("-> channel:" + channel + ", msg:" + msg); break; } } this.succeededMessageCount.inc(); this.succeededMessageMeter.mark(); }
Source:
public static long parseDate(String dateString) { String pattern = ""; if (dateString.length() == 10) { char separator = dateString.charAt(4); pattern = "yyyy" + separator + "MM" + separator + "dd"; } else if (dateString.length() == 8) { char separator = dateString.charAt(2); pattern = "MM" + separator + "dd" + separator + "yy"; } try { Date date = new SimpleDateFormat(pattern).parse(dateString); return date.getTime(); } catch (ParseException e) { return 0L; } }

Target:
public static long parseDate(String dateString) { String pattern = ""; if (dateString.length() == 10) { char separator = dateString.charAt(4); pattern = "yyyy" + separator + "MM" + separator + "dd"; } else if (dateString.length() == 8) { char separator = dateString.charAt(2); pattern = "MM" + separator + "dd" + separator + "yy"; } LocalDate localDate = LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(dateString)); return localDate.toEpochDay(); }
Source:
public static void refreshProjects(Repository repository, IProgressMonitor monitor) throws CoreException { final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() .getProjects(); final File parentFile = repository.getWorkDir(); for (IProject p : projects) { final File file = p.getLocation().toFile(); if (file.getAbsolutePath().startsWith(parentFile.getAbsolutePath())) { p.refreshLocal(IResource.DEPTH_INFINITE, monitor); } } }

Target:
public static void refreshProjects(Repository repository, IProgressMonitor monitor) throws CoreException { final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() .getProjects(); try { monitor.beginTask(CoreText.ProjectUtil_refreshingProjects, projects.length); final File parentFile = repository.getWorkDir(); for (IProject p : projects) { if (monitor.isCanceled()) break; final File file = p.getLocation().toFile(); if (file.getAbsolutePath().startsWith( parentFile.getAbsolutePath())) { p.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1)); monitor.worked(1); } } } finally { monitor.done(); } }
Source:
public void setAmount(int amount) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof MethodAmountPolicy)) { throw new Throwable("Source Policy is not of type method amount policy cannot add amount"); } sourceImmutablePolicy = new MethodAmountPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), sourceImmutablePolicy.getFences(), amount); }

Target:
public void setAmount(int amount) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof MethodAmountPolicy)) { throw new Throwable("Source Policy is not of type method amount policy and thus cannot add amount"); } sourceImmutablePolicy = new MethodAmountPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), sourceImmutablePolicy.getFences(), amount); }
Source:
public ScanQuery toScanQuery( final DataSource dataSource, final PlannerContext plannerContext ) { if (grouping != null) { return null; } if (getRowOrder().isEmpty()) { throw new ISE("WTF?! Attempting to convert to Scan query without any columns?"); } final Filtration filtration = Filtration.create(filter).optimize(sourceRowSignature); return new ScanQuery( dataSource, filtration.getQuerySegmentSpec(), selectProjection != null ? VirtualColumns.create(selectProjection.getVirtualColumns()) : VirtualColumns.EMPTY, ScanQuery.RESULT_FORMAT_COMPACTED_LIST, 0, limitSpec == null || limitSpec.getLimit() == Integer.MAX_VALUE ? 0 : limitSpec.getLimit(), filtration.getDimFilter(), Ordering.natural().sortedCopy(ImmutableSet.copyOf(getRowOrder())), false, plannerContext.getQueryContext() ); }

Target:
public ScanQuery toScanQuery( final DataSource dataSource, final PlannerContext plannerContext ) { if (grouping != null) { return null; } if (limitSpec != null && limitSpec.getColumns().size() > 0) { return null; } if (getRowOrder().isEmpty()) { throw new ISE("WTF?! Attempting to convert to Scan query without any columns?"); } final Filtration filtration = Filtration.create(filter).optimize(sourceRowSignature); final long scanLimit = limitSpec == null || limitSpec.getLimit() == Integer.MAX_VALUE ? 0L : (long) limitSpec.getLimit(); return new ScanQuery( dataSource, filtration.getQuerySegmentSpec(), selectProjection != null ? VirtualColumns.create(selectProjection.getVirtualColumns()) : VirtualColumns.EMPTY, ScanQuery.RESULT_FORMAT_COMPACTED_LIST, 0, scanLimit, filtration.getDimFilter(), Ordering.natural().sortedCopy(ImmutableSet.copyOf(getRowOrder())), false, plannerContext.getQueryContext() ); }
Source:
private void giveFlagToPlayer(EntityRef flag, EntityRef player) { BlockComponent blockComponent = flag.getComponent(BlockComponent.class); LASTeamComponent flagTeamComponent = flag.getComponent(LASTeamComponent.class); inventoryManager.giveItem(player, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily(LASUtils.getFlagURI(flagTeamComponent.team)))); player.addComponent(new HasFlagComponent(flagTeamComponent.team)); worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); flag.destroy(); }

Target:
private void giveFlagToPlayer(EntityRef flag, EntityRef player) { BlockComponent blockComponent = flag.getComponent(BlockComponent.class); LASTeamComponent flagTeamComponent = flag.getComponent(LASTeamComponent.class); BlockItemFactory blockFactory = new BlockItemFactory(entityManager); inventoryManager.giveItem(player, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily(LASUtils.getFlagURI(flagTeamComponent.team)))); worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); flag.destroy(); }
Source:
public Response intercept(Chain chain) throws IOException { DetachedSpan attemptSpan = chain.request().tag(AttemptSpan.class).attemptSpan(); DetachedSpan dispatcherSpan = chain.request().tag(SettableDispatcherSpan.class).dispatcherSpan(); if (dispatcherSpan == null) { return chain.proceed(chain.request()); } dispatcherSpan.complete(); try { return chain.proceed(chain.request()); } finally { attemptSpan.complete(); chain.request().tag(SettableWaitForBodySpan.class).waitForBodySpan().complete(); } }

Target:
public Response intercept(Chain chain) throws IOException { DetachedSpan attemptSpan = chain.request().tag(Tags.AttemptSpan.class).attemptSpan(); DetachedSpan dispatcherSpan = chain.request().tag(Tags.SettableDispatcherSpan.class).dispatcherSpan(); if (attemptSpan == null || dispatcherSpan == null) { log.warn("Missing attemptSpan / dispatcherSpan, which will result in missing spans. Likely a " + "conjure-java-runtime bug"); return chain.proceed(chain.request()); } dispatcherSpan.complete(); try { return chain.proceed(chain.request()); } finally { attemptSpan.complete(); chain.request().tag(Tags.SettableWaitForBodySpan.class).waitForBodySpan().complete(); } }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { String email = intent.getStringExtra("email"); ClientUser user = YieldsApplication.getUser(); if (user == null || user.getEmail() != email) { YieldsApplication.setUser(new ClientUser(email)); } ServiceRequest connectReq = new UserConnectRequest(YieldsApplication.getUser()); sendRequest(connectReq); } Log.d("Y:" + this.getClass().getName(), "Starting yield service"); return START_STICKY; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { String email = intent.getStringExtra("email"); if (email == null) { throw new IllegalArgumentException("Intent didn't start the service with an email"); } ClientUser user = YieldsApplication.getUser(); if (user == null || user.getEmail() != email) { YieldsApplication.setUser(new ClientUser(email)); } ServiceRequest connectReq = new UserConnectRequest(YieldsApplication.getUser()); sendRequest(connectReq); } Log.d("Y:" + this.getClass().getName(), "Starting yield service"); return START_STICKY; }
Source:
public static String buildPasswordResetUrl(final String username, final PasswordManagementService passwordManagementService, final CasConfigurationProperties casProperties, final WebApplicationService service) { val token = passwordManagementService.createToken(username); if (StringUtils.isNotBlank(token)) { final StringBuilder restetUrl = new StringBuilder(casProperties.getServer().getPrefix()) .append('/').append(CasWebflowConfigurer.FLOW_ID_LOGIN).append('?') .append(PARAMETER_NAME_TOKEN).append('=').append(token); if (casProperties.getAuthn().getPm().getReset().isAddServiceToPasswordResetUrl() && service != null) { final String encodeServiceUrl = UriUtils.encode(service.getOriginalUrl(), "UTF-8"); restetUrl.append('&').append(PARAMETER_NAME_SERVICE).append('=').append(encodeServiceUrl); } return restetUrl.toString(); } LOGGER.error("Could not create password reset url since no reset token could be generated"); return null; }

Target:
public static String buildPasswordResetUrl(final String username, final PasswordManagementService passwordManagementService, final CasConfigurationProperties casProperties, final WebApplicationService service) { val token = passwordManagementService.createToken(username); if (StringUtils.isNotBlank(token)) { StringBuilder restetUrl = new StringBuilder(casProperties.getServer().getPrefix()) .append('/').append(CasWebflowConfigurer.FLOW_ID_LOGIN).append('?') .append(PARAMETER_NAME_TOKEN).append('=').append(token); if (service != null) { val encodeServiceUrl = UriUtils.encode(service.getOriginalUrl(), StandardCharsets.UTF_8); restetUrl.append('&').append(CasProtocolConstants.PARAMETER_SERVICE).append('=').append(encodeServiceUrl); } return restetUrl.toString(); } LOGGER.error("Could not create password reset url since no reset token could be generated"); return null; }
Source:
protected String getUserNameForCertificates(final X509Certificate[] certs) throws LoginException { if (certs == null) { throw new LoginException("Client certificates not found. Cannot authenticate."); } String dn = getDistinguishedName(certs); String name = usersByDn.get(dn); if (name == null && regexpByUser != null) { name = getUserByRegexp(dn); } return name; }

Target:
protected String getUserNameForCertificates(final X509Certificate[] certs) throws LoginException { if (certs == null) { throw new LoginException("Client certificates not found. Cannot authenticate."); } String dn = getDistinguishedName(certs); return usersByDn.containsKey(dn) ? usersByDn.get(dn) : getUserByRegexp(dn); }
Source:
protected TestResultSummary run() throws Exception { final long buildTime = build.getTimestamp().getTimeInMillis(); final long timeOnMaster = System.currentTimeMillis(); String location = step.location; if (location == null) { location = "**/target/surefire-reports/TEST-*.xml"; } LOGGER.info("Looking for JUnit tests results in " + location + " in workspace " + workspace); TestResult result = workspace.act(new ParseResultCallable(location, buildTime, timeOnMaster, step.keepLongStdio)); result.tally(); if (result.isEmpty()) { throw new AbortException(Messages.JUnitResultArchiver_ResultIsEmpty()); } synchronized (build) { TestResultAction action = build.getAction(TestResultAction.class); if (action == null) { action = new TestResultAction(build, result, listener); build.addAction(action); } else { result.freeze(action); action.mergeResult(result, listener); build.save(); } if (action.getResult().getFailCount() > 0) { build.setResult(Result.UNSTABLE); } } return new TestResultSummary(result); }

Target:
protected TestResultSummary run() throws Exception { final long buildTime = build.getTimestamp().getTimeInMillis(); final long timeOnMaster = System.currentTimeMillis(); String location = step.testResults; if (location == null) { location = "**/target/surefire-reports/TEST-*.xml"; } LOGGER.info("Looking for JUnit tests results in " + location + " in workspace " + workspace); TestResult result = workspace.act(new ParseResultCallable(location, buildTime, timeOnMaster, step.keepLongStdio)); result.tally(); if (result.isEmpty()) { throw new AbortException(Messages.JUnitResultArchiver_ResultIsEmpty()); } synchronized (build) { TestResultAction action = build.getAction(TestResultAction.class); if (action == null) { action = new TestResultAction(build, result, listener); build.addAction(action); } else { result.freeze(action); action.mergeResult(result, listener); build.save(); } } return new TestResultSummary(result); }
Source:
static public void fixNMandUQ(final SAMRecord record, final ReferenceSequenceFileWalker refSeqWalker, final boolean isBisulfiteSequence){ final byte[] referenceBases = refSeqWalker.get(refSeqWalker.getSequenceDictionary().getSequenceIndex(record.getReferenceName())).getBases(); record.setAttribute(SAMTag.NM.name(), SequenceUtil.calculateSamNmTag(record, referenceBases, 0, isBisulfiteSequence)); if (record.getBaseQualities() != SAMRecord.NULL_QUALS) { record.setAttribute(SAMTag.UQ.name(), SequenceUtil.sumQualitiesOfMismatches(record, referenceBases, 0, isBisulfiteSequence)); } }

Target:
public static void fixNMandUQ(final SAMRecord record, final ReferenceSequenceFileWalker refSeqWalker, final boolean isBisulfiteSequence) { final byte[] referenceBases = refSeqWalker.get(refSeqWalker.getSequenceDictionary().getSequenceIndex(record.getReferenceName())).getBases(); record.setAttribute(SAMTag.NM.name(), SequenceUtil.calculateSamNmTag(record, referenceBases, 0, isBisulfiteSequence)); if (record.getBaseQualities() != SAMRecord.NULL_QUALS) { record.setAttribute(SAMTag.UQ.name(), SequenceUtil.sumQualitiesOfMismatches(record, referenceBases, 0, isBisulfiteSequence)); } }
Source:
public void onBushGrowth(DelayedActionTriggeredEvent event, EntityRef bush, BushDefinitionComponent bushComponent) { EntityRef newBush = null; if (bushComponent.currentStage < bushComponent.stages.length - 1) { newBush = doBushGrowth(bushComponent, 1); } resetDelay(newBush == null ? bush : newBush, bushComponent.stages[bushComponent.currentStage].minTime, bushComponent.stages[bushComponent.currentStage].maxTime); }

Target:
public void onBushGrowth(DelayedActionTriggeredEvent event, EntityRef bush, BushDefinitionComponent bushComponent) { EntityRef newBush = null; if (!isInLastStage(bushComponent)) { newBush = doBushGrowth(bushComponent, 1); } resetDelay(newBush == null ? bush : newBush, bushComponent.stages[bushComponent.currentStage].minTime, bushComponent.stages[bushComponent.currentStage].maxTime); }
Source:
NotFoundException(Exception innerException) { this(RMResources.NotFound, innerException, new HashMap<>(), null); }

Target:
NotFoundException(Exception innerException) { this(RMResources.NotFound, innerException, (Map<String, String>) null, null); }
Source:
private String stringValueOf(int value) { return value != 0 ? String.valueOf(value) : EMPTY_VALUE; }

Target:
private String stringValueOf(int value) { return value != 0 ? String.valueOf(NumberFormat.getInstance(Locale.getDefault()).format(value)) : EMPTY_VALUE; }
Source:
public synchronized void detonateBomb(Bomb bomb){ bomb.setDetonated(); for (Point p : grid.getAffectedExplosionSquares(bomb)){ for (Entity entity : grid.get(p)){ if (entity instanceof Player){ if(!((Player) entity).isInvulnerable() && !((Player) entity).isImmuneToBombs()){ killPlayer((Player) entity); } } else if (entity instanceof Bomb && !((Bomb)entity).isDetonated()){ detonateBomb((Bomb)entity); } else if (entity instanceof Enemy){ aiScheduler.removeEnemy((Enemy) entity); grid.remove(entity); } else if (entity.isDestructible()){ grid.remove(entity); } } } }

Target:
public synchronized void detonateBomb(Bomb bomb){ bomb.setDetonated(); for (Point p : grid.getAffectedExplosionSquares(bomb)){ for (Entity entity : grid.get(p)){ if (entity instanceof Unit){ if(!((Unit) entity).isImmuneToBombs()){ killUnit((Unit) entity); } } else if (entity instanceof Bomb && !((Bomb)entity).isDetonated()){ detonateBomb((Bomb)entity); } else if (entity.isDestructible()){ grid.remove(entity); } } } }
Source:
private MethodExecutionResult invokeStaticMethod(String methodName, List<String> paths, Object... args) throws Throwable { Method method; int i = methodName.lastIndexOf('.'); if (i >=0) { String className = methodName.substring(0, i); String staticMethodName = methodName.substring(i+1); Class<?> clazz = searchPathsForClass(paths, className); if (clazz != null) { method = findMatchingMethod(new String[]{staticMethodName}, clazz.getMethods(), args.length); return this.invokeMethod(null, method, args); } } return null; }

Target:
private MethodExecutionResult invokeStaticMethod(String methodName, List<String> paths, Object... args) throws Throwable { Method method; int i = methodName.lastIndexOf('.'); if (i >=0) { String className = methodName.substring(0, i); String staticMethodName = methodName.substring(i+1); Class<?> clazz = searchPathsForClass(paths, className); if (clazz != null) { method = findMatchingMethod(new String[]{staticMethodName}, clazz.getMethods(), args.length); if (method != null) { return this.invokeMethod(null, method, args); } else { return MethodExecutionResult.noMethod(staticMethodName + "(static)", clazz, args.length); } } } return null; }
Source:
public void cacheStarted(ComponentRegistry cr, String cacheName) { Configuration configuration = cr.getComponent(Configuration.class); boolean indexingEnabled = configuration.indexing().enabled(); if ( ! indexingEnabled ) { if ( verifyChainContainsQueryInterceptor(cr) ) { throw new IllegalStateException( "It was NOT expected to find the Query interceptor registered in the InterceptorChain as indexing was disabled, but it was found" ); } return; } if ( ! verifyChainContainsQueryInterceptor(cr) ) { throw new IllegalStateException( "It was expected to find the Query interceptor registered in the InterceptorChain but it wasn't found" ); } Cache<?, ?> cache = cr.getComponent(Cache.class); CommandInitializer initializer = cr.getComponent(CommandInitializer.class); EmbeddedCacheManager cacheManager = cr.getGlobalComponentRegistry().getComponent(EmbeddedCacheManager.class); initializer.setCache(cacheManager); QueryBox queryBox = new QueryBox(); queryBox.setCache(cache.getAdvancedCache()); cr.registerComponent(queryBox, QueryBox.class); registerQueryMBeans(cache.getAdvancedCache(), cr, cacheName); }

Target:
public void cacheStarted(ComponentRegistry cr, String cacheName) { Configuration configuration = cr.getComponent(Configuration.class); boolean indexingEnabled = configuration.indexing().enabled(); if ( ! indexingEnabled ) { if ( verifyChainContainsQueryInterceptor(cr) ) { throw new IllegalStateException( "It was NOT expected to find the Query interceptor registered in the InterceptorChain as indexing was disabled, but it was found" ); } return; } if ( ! verifyChainContainsQueryInterceptor(cr) ) { throw new IllegalStateException( "It was expected to find the Query interceptor registered in the InterceptorChain but it wasn't found" ); } Cache<?, ?> cache = cr.getComponent(Cache.class); CommandInitializer initializer = cr.getComponent(CommandInitializer.class); EmbeddedCacheManager cacheManager = cr.getGlobalComponentRegistry().getComponent(EmbeddedCacheManager.class); initializer.setCacheManager(cacheManager); QueryBox queryBox = new QueryBox(); queryBox.setCache(cache.getAdvancedCache()); cr.registerComponent(queryBox, QueryBox.class); registerQueryMBeans(cache.getAdvancedCache(), cr, cacheName); }
Source:
void close() { try { m_reader.close(); } catch (IOException e) { } }

Target:
public void close() { try { m_reader.close(); } catch (IOException e) { } }
Source:
private RevTag[] getRevTags() { Collection<Ref> revTags = repo.getTags().values(); List<RevTag> tags = new ArrayList<RevTag>(); RevWalk walk = new RevWalk(repo); for (Ref ref : revTags) { try { tags.add(walk.parseTag(repo.resolve(ref.getName()))); } catch (IncorrectObjectTypeException e) { } catch (IOException e) { Activator.logError( UIText.TagAction_unableToResolveHeadObjectId, e); setErrorMessage(UIText.TagAction_unableToResolveHeadObjectId); } } return tags.toArray(new RevTag[tags.size()]); }

Target:
private List<RevTag> getRevTags() { Collection<Ref> revTags = repo.getTags().values(); List<RevTag> tags = new ArrayList<RevTag>(); RevWalk walk = new RevWalk(repo); for (Ref ref : revTags) { try { tags.add(walk.parseTag(repo.resolve(ref.getName()))); } catch (IncorrectObjectTypeException e) { } catch (IOException e) { Activator.logError( UIText.TagAction_unableToResolveHeadObjectId, e); setErrorMessage(UIText.TagAction_unableToResolveHeadObjectId); } } return tags; }
Source:
public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length())); if (shortScheme.equalsIgnoreCase("https://")) { currentPos += "https://".length(); } else if (shortScheme.equalsIgnoreCase("http://")) { currentPos += "http://".length(); } else if (longScheme.equalsIgnoreCase("rtsp://")) { currentPos += "rtsp://".length(); } else { return startPos; } currentPos = matchUserInfoIfAvailable(text, currentPos); int matchedAuthorityEnd = Math.max(tryMatchDomainName(text, currentPos), Math.max(tryMatchIpv4Address(text, currentPos, true), tryMatchIpv6Address(text, currentPos))); if (matchedAuthorityEnd == currentPos) { return startPos; } currentPos = matchedAuthorityEnd; if (currentPos < text.length() && text.charAt(currentPos) == '/') { currentPos = matchUnreservedPCTEncodedSubDelimClassesGreedy(text, currentPos + 1, "/:@"); } if (currentPos < text.length() && text.charAt(currentPos) == '?') { currentPos = matchUnreservedPCTEncodedSubDelimClassesGreedy(text, currentPos + 1, ":@/?"); } if (currentPos < text.length() && text.charAt(currentPos) == '#') { currentPos = matchUnreservedPCTEncodedSubDelimClassesGreedy(text, currentPos + 1, ":@/?"); } String httpUri = text.substring(startPos, currentPos); outputBuffer.append("<a href=\"") .append(httpUri) .append("\">") .append(httpUri) .append("</a>"); return currentPos; }

Target:
public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length())); if (shortScheme.equalsIgnoreCase("https://")) { currentPos += "https://".length(); } else if (shortScheme.equalsIgnoreCase("http://")) { currentPos += "http://".length(); } else if (longScheme.equalsIgnoreCase("rtsp://")) { currentPos += "rtsp://".length(); } else { return startPos; } int matchedAuthorityEnd = tryMatchAuthority(text, currentPos); if (matchedAuthorityEnd == currentPos) { return startPos; } currentPos = matchedAuthorityEnd; if (currentPos < text.length() && text.charAt(currentPos) == '/') { currentPos = matchUnreservedPCTEncodedSubDelimClassesGreedy(text, currentPos + 1, "/:@"); } if (currentPos < text.length() && text.charAt(currentPos) == '?') { currentPos = matchUnreservedPCTEncodedSubDelimClassesGreedy(text, currentPos + 1, ":@/?"); } if (currentPos < text.length() && text.charAt(currentPos) == '#') { currentPos = matchUnreservedPCTEncodedSubDelimClassesGreedy(text, currentPos + 1, ":@/?"); } String httpUri = text.substring(startPos, currentPos); outputBuffer.append("<a href=\"") .append(httpUri) .append("\">") .append(httpUri) .append("</a>"); return currentPos; }
Source:
public <T> boolean putMapping(Class<T> clazz) { if (clazz.isAnnotationPresent(Mapping.class)) { String mappingPath = clazz.getAnnotation(Mapping.class).mappingPath(); if (hasText(mappingPath)) { String mappings = readFileFromClasspath(mappingPath); if (hasText(mappings)) { return putMapping(clazz, mappings); } } else { logger.info("mappingPath in @Mapping has to be defined. Building mappings using @Field"); } } try { final MappingBuilder mappingBuilder = new MappingBuilder(elasticsearchConverter); return putMapping(clazz, mappingBuilder.buildMapping(clazz)); } catch (Exception e) { throw new ElasticsearchException("Failed to build mapping for " + clazz.getSimpleName(), e); } }

Target:
public <T> boolean putMapping(Class<T> clazz) { if (clazz.isAnnotationPresent(Mapping.class)) { String mappingPath = clazz.getAnnotation(Mapping.class).mappingPath(); if (hasText(mappingPath)) { String mappings = readFileFromClasspath(mappingPath); if (hasText(mappings)) { return putMapping(clazz, mappings); } } else { logger.info("mappingPath in @Mapping has to be defined. Building mappings using @Field"); } } try { MappingBuilder mappingBuilder = new MappingBuilder(elasticsearchConverter); return putMapping(clazz, mappingBuilder.buildMapping(clazz)); } catch (Exception e) { throw new ElasticsearchException("Failed to build mapping for " + clazz.getSimpleName(), e); } }
Source:
public UUID enqueue(E e) { final Long id = guidGenerator.nextLong(); this.put(id, e); return new UUID(0, id); }

Target:
public CorfuRecordId enqueue(E e) { final Long id = guidGenerator.nextLong(); corfuTable.put(id, e); return new CorfuRecordId(0, id); }
Source:
private void parse(RevCommit commit) throws ConfigInvalidException { PatchSet.Id psId = parsePatchSetId(commit); Account.Id accountId = parseIdent(commit); List<PatchSetApproval> psas = approvals.get(psId); Map<String, PatchSetApproval> curr = Maps.newHashMapWithExpectedSize(psas.size()); for (PatchSetApproval psa : psas) { if (psa.getAccountId().equals(accountId)) { curr.put(psa.getLabel(), psa); } } for (String line : commit.getFooterLines(FOOTER_LABEL)) { PatchSetApproval psa = parseApproval(psId, accountId, commit, line); PatchSetApproval old = curr.get(psa.getLabel()); if (old == null || old.getGranted().compareTo(psa.getGranted()) < 0) { curr.put(psa.getLabel(), psa); psas.add(psa); } } for (ReviewerState state : ReviewerState.values()) { for (String line : commit.getFooterLines(state.getFooterKey())) { parseReviewer(state, line); } } }

Target:
private void parse(RevCommit commit) throws ConfigInvalidException { PatchSet.Id psId = parsePatchSetId(commit); Account.Id accountId = parseIdent(commit); List<PatchSetApproval> psas = approvals.get(psId); Map<String, PatchSetApproval> curr = Maps.newHashMapWithExpectedSize(psas.size()); for (PatchSetApproval psa : psas) { if (psa.getAccountId().equals(accountId)) { curr.put(psa.getLabel(), psa); } } for (String line : commit.getFooterLines(FOOTER_LABEL)) { PatchSetApproval psa = parseApproval(psId, accountId, commit, line); if (!curr.containsKey(psa.getLabel())) { curr.put(psa.getLabel(), psa); psas.add(psa); } } for (ReviewerState state : ReviewerState.values()) { for (String line : commit.getFooterLines(state.getFooterKey())) { parseReviewer(state, line); } } }
Source:
private static void cleanupOutdatedEsData(EsCommand esCommand) { EsFileSystem esFileSystem = esCommand.getFileSystem(); esFileSystem.getOutdatedDataDirectories().forEach(outdatedDir -> { if (outdatedDir.exists()) { LOG.info("Deleting outdated search index data directory {}", outdatedDir.getAbsolutePath()); try { FileUtils.deleteDirectory(outdatedDir); } catch (IOException e) { LOG.info("Failed to delete outdated search index data directory " + outdatedDir.getAbsolutePath(), e); } } else { LOG.trace("No outdated search index data directory found at {}", outdatedDir.getAbsolutePath()); } }); }

Target:
private static void cleanupOutdatedEsData(EsCommand esCommand) { EsFileSystem esFileSystem = esCommand.getFileSystem(); esFileSystem.getOutdatedDataDirectories().forEach(outdatedDir -> { if (outdatedDir.exists()) { LOG.info("Deleting outdated search index data directory {}", outdatedDir.getAbsolutePath()); try { FileUtils.deleteDirectory(outdatedDir); } catch (IOException e) { LOG.info("Failed to delete outdated search index data directory " + outdatedDir.getAbsolutePath(), e); } } }); }
Source:
private static Geometry readGeometry(BasicSliceInput input, GeometryType type) { switch (type) { case POINT: return readPoint(input); case MULTI_POINT: return readMultiPoint(input); case LINE_STRING: return readPolyline(input, false); case MULTI_LINE_STRING: return readPolyline(input, true); case POLYGON: return readPolygon(input, false); case MULTI_POLYGON: return readPolygon(input, true); case GEOMETRY_COLLECTION: return readGeometryCollection(input); case ENVELOPE: verify(input.available() > 0); double xMin = input.readDouble(); double yMin = input.readDouble(); double xMax = input.readDouble(); double yMax = input.readDouble(); Coordinate[] coordinates = new Coordinate[5]; coordinates[0] = new Coordinate(xMin, yMin); coordinates[1] = new Coordinate(xMin, yMax); coordinates[2] = new Coordinate(xMax, yMax); coordinates[3] = new Coordinate(xMax, yMin); coordinates[4] = coordinates[0]; return GEOMETRY_FACTORY.createPolygon(coordinates); default: throw new UnsupportedOperationException("Unexpected type: " + type); } }

Target:
private static Geometry readGeometry(BasicSliceInput input, GeometryType type) { switch (type) { case POINT: return readPoint(input); case MULTI_POINT: return readMultiPoint(input); case LINE_STRING: return readPolyline(input, false); case MULTI_LINE_STRING: return readPolyline(input, true); case POLYGON: return readPolygon(input, false); case MULTI_POLYGON: return readPolygon(input, true); case GEOMETRY_COLLECTION: return readGeometryCollection(input); case ENVELOPE: return readEnvelope(input); default: throw new UnsupportedOperationException("Unexpected type: " + type); } }
Source:
public java.sql.Array prepareSQLArrayOfNumbers(List<? extends PerunBean> perunBeans, PreparedStatement preparedStatement) throws SQLException, InternalErrorRuntimeException { Connection connection = preparedStatement.getConnection().unwrap(Connection.class); if(Compatibility.isOracle()) { int[] arrayOfBeansIds = perunBeans.stream().mapToInt(PerunBean::getId).toArray(); try { Method createOracleArrayMethod = connection.getClass().getMethod(nameOfOracleArrayMethod, String.class, Object.class); createOracleArrayMethod.setAccessible(true); return (java.sql.Array) createOracleArrayMethod.invoke(connection, AttributesManager.ORACLE_ARRAY_OF_NUMBERS, arrayOfBeansIds); } catch (Exception ex) { throw new InternalErrorRuntimeException("Can't access to method " + nameOfOracleArrayMethod, ex); } } else { Integer[] arrayOfBeansIds = perunBeans.stream().map(PerunBean::getId).collect(Collectors.toList()).stream().toArray(Integer[]::new); return connection.createArrayOf(JDBCType.INTEGER.name(), arrayOfBeansIds); } }

Target:
public java.sql.Array prepareSQLArrayOfNumbers(List<? extends PerunBean> perunBeans, PreparedStatement preparedStatement) throws SQLException, InternalErrorRuntimeException { Connection connection = preparedStatement.getConnection().unwrap(Connection.class); if(Compatibility.isOracle()) { int[] arrayOfBeansIds = perunBeans.stream().mapToInt(PerunBean::getId).toArray(); try { Method createOracleArrayMethod = connection.getClass().getMethod(NAME_OF_ORACLE_ARRAY_METHOD, String.class, Object.class); createOracleArrayMethod.setAccessible(true); return (java.sql.Array) createOracleArrayMethod.invoke(connection, AttributesManager.ORACLE_ARRAY_OF_NUMBERS, arrayOfBeansIds); } catch (Exception ex) { throw new InternalErrorRuntimeException("Can't access to method " + NAME_OF_ORACLE_ARRAY_METHOD, ex); } } else { Integer[] arrayOfBeansIds = perunBeans.stream().map(PerunBean::getId).toArray(Integer[]::new); return connection.createArrayOf(JDBCType.INTEGER.name(), arrayOfBeansIds); } }
Source:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); Map<String, String> traceEnv = this.getEnvironment(); String tracerName = traceEnv.get("tracer_name"); String tracerMajor = traceEnv.get("tracer_major"); String tracerMinor = traceEnv.get("tracer_minor"); if ("\"perf\"".equals(tracerName)) { fOriginTracer = OriginTracer.PERF; } else if ("\"lttng-modules\"".equals(tracerName) && tracerMajor != null && tracerMinor != null) { if (Integer.valueOf(tracerMajor) >= 2) { if (Integer.valueOf(tracerMinor) >= 7) { fOriginTracer = OriginTracer.LTTNG27; } else if (Integer.valueOf(tracerMinor) >= 6) { fOriginTracer = OriginTracer.LTTNG26; } } } else { fOriginTracer = OriginTracer.LTTNG; } }

Target:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); fOriginTracer = getTracerFromEnv(this.getEnvironment()); }
Source:
public void onWindowClosing(WindowActionEvent event) { if (!closeImmediately) { if (!isEditorsClean()) { event.setMessage("ask user"); } else if (Boolean.parseBoolean(preferencesManager.getValue(PREF_IDE_GENERAL_TAB_CLOSING))) { event.setMessage("ask user"); } } }

Target:
public void onWindowClosing(WindowActionEvent event) { if (!closeImmediately) { if (!isEditorsClean()) { event.setMessage(localizationConstant.changesMayBeLost()); } else if (Boolean.parseBoolean(preferencesManager.getValue(PREF_IDE_GENERAL_TAB_CLOSING))) { event.setMessage(localizationConstant.closeTabConfirmation()); } } }
Source:
private void updateAudioSourceFunction() { boolean enabled = UsbManager.containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_AUDIO_SOURCE); if (enabled != mAudioSourceEnabled) { int card = -1; int device = -1; if (enabled) { Scanner scanner = null; try { scanner = new Scanner(new File(AUDIO_SOURCE_PCM_PATH)); mAudioSourceCard = scanner.nextInt(); mAudioSourceDevice = scanner.nextInt(); } catch (FileNotFoundException e) { Slog.e(TAG, "could not open audio source PCM file", e); enabled = false; } finally { if (scanner != null) { scanner.close(); } } } mAudioSourceEnabled = enabled; } mUsbAlsaManager.setAccessoryAudioState( mAudioSourceEnabled && mConfigured, mAudioSourceCard, mAudioSourceDevice); }

Target:
private void updateAudioSourceFunction() { boolean enabled = UsbManager.containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_AUDIO_SOURCE); if (enabled != mAudioSourceEnabled) { if (enabled) { Scanner scanner = null; try { scanner = new Scanner(new File(AUDIO_SOURCE_PCM_PATH)); mAudioSourceCard = scanner.nextInt(); mAudioSourceDevice = scanner.nextInt(); } catch (FileNotFoundException e) { Slog.e(TAG, "could not open audio source PCM file", e); enabled = false; } finally { if (scanner != null) { scanner.close(); } } } mAudioSourceEnabled = enabled; } mUsbAlsaManager.setAccessoryAudioState( mAudioSourceEnabled && mConfigured, mAudioSourceCard, mAudioSourceDevice); }
Source:
public String toString() { return "DiscoveryConfig{" + "discoveryStrategyConfigs=" + discoveryStrategyConfigs + ", discoveryServiceProvider=" + discoveryServiceProvider + ", nodeFilter=" + nodeFilter + '\'' + ", nodeFilterClass='" + nodeFilterClass + '\'' + '}'; }

Target:
public String toString() { return "DiscoveryConfig{" + "discoveryStrategyConfigs=" + discoveryStrategyConfigs + ", discoveryServiceProvider=" + discoveryServiceProvider + ", nodeFilter=" + nodeFilter + ", nodeFilterClass='" + nodeFilterClass + '\'' + '}'; }
Source:
public String docs() { return "void {key, value} Stores a value in the global storage register." + " An arbitrary value is stored with the given key, and can be retreived using import." + " If the value is already stored, it is overwritten. See {{function|import}}." + " The reference to the value is stored, not a copy of the value, so in the case of" + " arrays, manipulating the contents of the array will manipulate the stored value." + " export() is threadsafe."; }

Target:
public String docs() { return "void {key, value} Stores a value in the global storage register." + " An arbitrary value is stored with the given key, and can be retreived using import." + " If the value is already stored, it is overwritten. See {{function|import}}." + " The reference to the value is stored, not a copy of the value, so in the case of" + " arrays, manipulating the contents of the array will manipulate the stored value. An array may" + " be used as a key. It is converted into a string with the array values separated by dots." + " export() is threadsafe."; }
Source:
public void execute(FunctionContext<Object[]> context) { Object[] arguments = context.getArguments(); RestoreRedundancyRequest request = (RestoreRedundancyRequest) arguments[0]; boolean isStatusCommand = (boolean) arguments[1]; RestoreRedundancyOperation redundancyOperation = context.getCache().getResourceManager().createRestoreRedundancyOperation(); Set<String> includeRegionsSet = null; if (request.getIncludeRegions() != null) { includeRegionsSet = new HashSet<>(request.getIncludeRegions()); } Set<String> excludeRegionsSet = null; if (request.getExcludeRegions() != null) { excludeRegionsSet = new HashSet<>(request.getExcludeRegions()); } redundancyOperation.includeRegions(includeRegionsSet); redundancyOperation.excludeRegions(excludeRegionsSet); RestoreRedundancyResultsImpl results; try { if (isStatusCommand) { results = (RestoreRedundancyResultsImpl) redundancyOperation.redundancyStatus(); } else { redundancyOperation.shouldReassignPrimaries(request.getReassignPrimaries()); results = (RestoreRedundancyResultsImpl) redundancyOperation.start().join(); } if (results.getRegionOperationStatus().equals(ERROR)) { Exception e = new Exception(results.getRegionOperationMessage()); throw e; } results.setSuccess(true); results.setStatusMessage("Success"); } catch (Exception e) { results = new SerializableRestoreRedundancyResultsImpl(); results.setSuccess(false); results.setStatusMessage(e.getMessage()); } context.getResultSender().lastResult(results); }

Target:
public void execute(FunctionContext<Object[]> context) { Object[] arguments = context.getArguments(); RestoreRedundancyRequest request = (RestoreRedundancyRequest) arguments[0]; boolean isStatusCommand = (boolean) arguments[1]; RestoreRedundancyOperation redundancyOperation = context.getCache().getResourceManager().createRestoreRedundancyOperation(); Set<String> includeRegionsSet = null; if (request.getIncludeRegions() != null) { includeRegionsSet = new HashSet<>(request.getIncludeRegions()); } Set<String> excludeRegionsSet = null; if (request.getExcludeRegions() != null) { excludeRegionsSet = new HashSet<>(request.getExcludeRegions()); } redundancyOperation.includeRegions(includeRegionsSet); redundancyOperation.excludeRegions(excludeRegionsSet); RestoreRedundancyResultsImpl results; try { if (isStatusCommand) { results = (RestoreRedundancyResultsImpl) redundancyOperation.redundancyStatus(); } else { redundancyOperation.shouldReassignPrimaries(request.getReassignPrimaries()); results = (RestoreRedundancyResultsImpl) redundancyOperation.start().join(); } results.setSuccess(true); results.setStatusMessage("Success"); } catch (Exception e) { results = new SerializableRestoreRedundancyResultsImpl(); results.setSuccess(false); results.setStatusMessage(e.getMessage()); } context.getResultSender().lastResult(results); }