auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ExecutorServiceProvider(int corePoolSize, int maxPoolSize, int queueCapacity) { this( corePoolSize, maxPoolSize, queueCapacity, (r, executor1) -> LOG.warn("Executor rejected to handle the payload {}", r)); }

Target:
public ExecutorServiceProvider(int corePoolSize, int maxPoolSize, int queueCapacity) { this( corePoolSize, maxPoolSize, queueCapacity, (r, e) -> LOG.warn("Executor rejected to handle the payload {}", r)); }
Source:
public void shouldReturnNoChanges() throws Exception { resetRepositoryToCreateInitialTag(); changeFilesInProject(); launchSynchronization(SynchronizeWithAction_localRepoName, HEAD, SynchronizeWithAction_localRepoName, MASTER, false); setGitChangeSetPresenentationModel(); SWTBotTree syncViewTree = bot.viewByTitle("Synchronize").bot().tree(); assertEquals(0, syncViewTree.getAllItems().length); }

Target:
public void shouldReturnNoChanges() throws Exception { resetRepositoryToCreateInitialTag(); changeFilesInProject(); launchSynchronization(SynchronizeWithAction_localRepoName, HEAD, SynchronizeWithAction_localRepoName, MASTER, false); setGitChangeSetPresentationModel(); SWTBotTree syncViewTree = bot.viewByTitle("Synchronize").bot().tree(); assertEquals(0, syncViewTree.getAllItems().length); }
Source:
public static boolean collationsContainKeysOrderless( List<RelCollation> collations, List<Integer> keys) { final List<Integer> distinctKeys = Util.distinctList(keys); for (RelCollation collation : collations) { if (containsOrderless(collation, distinctKeys)) { return true; } } return false; }

Target:
public static boolean collationsContainKeysOrderless( List<RelCollation> collations, List<Integer> keys) { for (RelCollation collation : collations) { if (containsOrderless(collation, keys)) { return true; } } return false; }
Source:
protected byte[] randomData(String prefix) { return Bytes.toBytes(prefix + RandomStringUtils.randomAlphanumeric(8)); }

Target:
public byte[] randomData(String prefix) { return Bytes.toBytes(prefix + RandomStringUtils.randomAlphanumeric(8)); }
Source:
public void findByLocationNearWithShape() { final City mumbai = new City("1001", "Mumbai", new Point(19.0990358,72.9612976)); final City pune = new City("1002", "Pune", new Point(18.5247663,73.792756)); final City bangalore = new City("1003", "Bangalore", new Point(12.9542944,77.4905127)); final Point solapur = new Point(17.661548,75.8835121); final Circle circle100 = new Circle(solapur, new Distance(100, Metrics.KILOMETERS)); final Circle circle250 = new Circle(solapur, new Distance(250, Metrics.KILOMETERS)); final Circle circle350 = new Circle(solapur, new Distance(350, Metrics.KILOMETERS)); this.cityMap.put(mumbai.getId(), mumbai); this.cityMap.put(pune.getId(), pune); this.cityMap.put(bangalore.getId(), bangalore); List<City> matches = this.cityRepository.findByLocationWithin(circle100); int len = matches.size(); assertThat("Nothing should returned", len, equalTo(0)); matches = this.cityRepository.findByLocationWithin(circle250); len = matches.size(); assertThat("Pune should return", len, equalTo(1)); assertThat("Pune should return", matches.get(0), hasProperty("name", equalTo("Pune"))); matches = this.cityRepository.findByLocationWithin(circle350); len = matches.size(); assertThat("Pune and Mumbai should return", len, equalTo(2)); assertThat("Pune and Mumbai should return", matches, containsInAnyOrder(hasProperty("name", equalTo("Pune")), hasProperty("name", equalTo("Mumbai")))); this.cityMap.remove(mumbai.getId()); this.cityMap.remove(pune.getId()); this.cityMap.remove(bangalore.getId()); }

Target:
public void findByLocationNearWithShape() { final City mumbai = new City("1001", "Mumbai", new Point(19.0990358,72.9612976)); final City pune = new City("1002", "Pune", new Point(18.5247663,73.792756)); final City bangalore = new City("1003", "Bangalore", new Point(12.9542944,77.4905127)); final Point solapur = new Point(17.661548,75.8835121); final Circle circle100 = new Circle(solapur, new Distance(100, Metrics.KILOMETERS)); final Circle circle250 = new Circle(solapur, new Distance(250, Metrics.KILOMETERS)); final Circle circle350 = new Circle(solapur, new Distance(350, Metrics.KILOMETERS)); this.cityMap.put(mumbai.getId(), mumbai); this.cityMap.put(pune.getId(), pune); this.cityMap.put(bangalore.getId(), bangalore); List<City> matches = this.cityRepository.findByLocationWithin(circle100); int len = matches.size(); assertThat("Nothing should returned", len, equalTo(0)); matches = this.cityRepository.findByLocationWithin(circle250); len = matches.size(); assertThat("Pune should return", len, equalTo(1)); assertThat("Pune should return", matches.get(0), equalTo(pune)); matches = this.cityRepository.findByLocationWithin(circle350); len = matches.size(); assertThat("Pune and Mumbai should return", len, equalTo(2)); assertThat("Pune and Mumbai should return", matches, containsInAnyOrder(pune, mumbai)); this.cityMap.remove(mumbai.getId()); this.cityMap.remove(pune.getId()); this.cityMap.remove(bangalore.getId()); }
Source:
public static String map2String(Map<String, String> map){ Set<Entry<String, String>> entrySet = map.entrySet(); StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : entrySet) { if (sb.length() > 0) { sb.append(DELIMITER); } sb.append(entry.getKey()); sb.append(SEP); sb.append(entry.getValue()); } return sb.toString(); }

Target:
public static String map2String(Map<String, String> map){ StringBuilder sb = new StringBuilder(); Set<Entry<String, String>> entrySet = map.entrySet(); if (map != null) { for (Entry<String, String> entry : entrySet) { if (sb.length() > 0) { sb.append(DELIMITER); } sb.append(entry.getKey()); sb.append(SEP); sb.append(entry.getValue()); } } return sb.toString(); }
Source:
public boolean isExtensionEnabled() { if (enablement != null) { try { return enablement.getExpression().evaluate(new EvaluationContext(null, new Object())) .equals(EvaluationResult.TRUE); } catch (CoreException e) { } } return true; }

Target:
public boolean isExtensionEnabled() { return enablement != null ? enablement.evaluate() : true; }
Source:
private String createProcessorId(Config config) { ApplicationConfig appConfig = new ApplicationConfig(config); if (appConfig.getProcessorId() != null) { return appConfig.getProcessorId(); } else if (appConfig.getAppProcessorIdGeneratorClass() != null) { ProcessorIdGenerator idGenerator = ClassLoaderHelper.fromClassName(appConfig.getAppProcessorIdGeneratorClass(), ProcessorIdGenerator.class); return idGenerator.generateProcessorId(config); } else { throw new ConfigException(String .format("Expected either %s or %s to be configured", ApplicationConfig.PROCESSOR_ID, ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS)); } }

Target:
private String createProcessorId(Config config) { ApplicationConfig appConfig = new ApplicationConfig(config); if (appConfig.getProcessorId() != null) { return appConfig.getProcessorId(); } ProcessorIdGenerator idGenerator = ClassLoaderHelper.fromClassName(appConfig.getAppProcessorIdGeneratorClass(), ProcessorIdGenerator.class); return idGenerator.generateProcessorId(config); }
Source:
void testFilter() { for (String region : ec2Api.getConfiguredRegions()) { Set<SecurityGroup> allResults = client.describeSecurityGroupsInRegion(region); assertNotNull(allResults); if (allResults.size() >= 1) { final SecurityGroup group = getLast(allResults); ImmutableSet<SecurityGroup> expected = FluentIterable.from(allResults) .filter(new Predicate<SecurityGroup>() { @Override public boolean apply(SecurityGroup in) { return group.getName().equals(in.getName()); } }).toSet(); ImmutableSet<SecurityGroup> result = ImmutableSet.copyOf(client.describeSecurityGroupsInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("group-name", group.getName()).build())); assertTrue(expected.containsAll(result)); } } }

Target:
void testFilter() { for (String region : ec2Api.getConfiguredRegions()) { Set<SecurityGroup> allResults = client.describeSecurityGroupsInRegion(region); assertNotNull(allResults); if (!allResults.isEmpty()) { final SecurityGroup group = getLast(allResults); ImmutableSet<SecurityGroup> expected = FluentIterable.from(allResults) .filter(new Predicate<SecurityGroup>() { @Override public boolean apply(SecurityGroup in) { return group.getName().equals(in.getName()); } }).toSet(); ImmutableSet<SecurityGroup> result = ImmutableSet.copyOf(client.describeSecurityGroupsInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("group-name", group.getName()).build())); assertTrue(expected.containsAll(result), "group(s) for name not found"); } } }
Source:
public LifeAreaInformation getAreaInformation() { LifeAreaInformation info = new LifeAreaInformation(lifeArea); Object dot[] = areaNotation.getAll(); int x = 0, y = 0; for (int i = 0; i < dot.length; i++) { x = ((Dot) dot[i]).getX(); y = ((Dot) dot[i]).getY(); if (info.getArea()[x][y] == 1) info.getArea()[x][y] = 0; } return info; }

Target:
public LifeAreaInformation getAreaInformation() { LifeAreaInformation info = new LifeAreaInformation(lifeArea); Object dot[] = areaNotation.getAll(); int x = 0, y = 0; for (int i = 0; i < dot.length; i++) { x = ((Dot) dot[i]).getX(); y = ((Dot) dot[i]).getY(); if (info.getArea()[x][y] == 1) { info.getArea()[x][y] = 0; } } return info; }
Source:
private void setSearchEnabled(boolean value) { if (searchEnabled != value) { searchEnabled = value; onPropertyChanged(new PropertyChangedEventArgs("EnableSearchBar")); } }

Target:
private void setSearchEnabled(boolean value) { if (searchEnabled != value) { searchEnabled = value; onPropertyChanged(new PropertyChangedEventArgs("SearchEnabled")); } }
Source:
public List<Map<String, String>> taskConfigs(int maxTasks) { final List<Map<String, String>> configs = new ArrayList<>(3); for (int i = 0; i < 3; i++) { config.put("forestName","java-unittest-"+(i+1)); configs.add(config); } return configs; }

Target:
public List<Map<String, String>> taskConfigs(int maxTasks) { logger.info("*********** MarklogicSourceConnector.taskConfigs ************"); final List<Map<String, String>> configs = new ArrayList<>(3); for (int i = 0; i < 3; i++) { config.put("forestName","java-unittest-"+(i+1)); configs.add(config); } return configs; }
Source:
public static String generateScenarioRegexp(String scenarioId) { return "(^.*" + USER_SCENARIO_ID + scenarioId + US_STEP_ID + ".*$)|(^.*" + scenarioId + ".*(-sum|-Success rate|-Number of fails).*$)"; }

Target:
public static String generateScenarioRegexp(String scenarioId) { return String.format(SCENARIO_REGEXP_TEMPLATE, scenarioId, scenarioId); }
Source:
public void testCannotIncreaseBy2AsNoSessionKey() throws Exception { exception.expect(ConfigurationException.class); exception.expectMessage("sessionKey must be filled"); session.put("a", "4"); pipe.setIncrement(2); pipe.configure(); doPipe(pipe, "doesnt matter", session); assertEquals(session.get("a"), "6"); }

Target:
public void testCannotIncreaseBy2AsNoSessionKey() throws Exception { exception.expect(ConfigurationException.class); exception.expectMessage("sessionKey must be filled"); session.put("a", "4"); pipe.setIncrement(2); pipe.configure(); doPipe(pipe, "doesnt matter", session); fail("this is expected to fail"); }
Source:
private void getMonitorLock() throws KeeperException, InterruptedException { final String zRoot = ZooUtil.getRoot(instance); final String monitorPath = zRoot + Constants.ZMONITOR; final String monitorLockPath = zRoot + Constants.ZMONITOR_LOCK; ZooReaderWriter zoo = ZooReaderWriter.getInstance(); if (zoo.exists(monitorPath)) { byte[] data = zoo.getData(monitorPath, null); if (0 != data.length) { zoo.recursiveDelete(monitorPath, NodeMissingPolicy.SKIP); zoo.putPersistentData(monitorPath, new byte[0], NodeExistsPolicy.FAIL); zoo.putPersistentData(monitorLockPath, new byte[0], NodeExistsPolicy.FAIL); } else if (!zoo.exists(monitorLockPath)) { zoo.putPersistentData(monitorLockPath, new byte[0], NodeExistsPolicy.FAIL); } } else { zoo.putPersistentData(zRoot + Constants.ZMONITOR, new byte[0], NodeExistsPolicy.FAIL); if (!zoo.exists(monitorLockPath)) { zoo.putPersistentData(monitorLockPath, new byte[0], NodeExistsPolicy.FAIL); } } log.info("Attempting to acquire Monitor Lock"); while (true) { MoniterLockWatcher monitorLockWatcher = new MoniterLockWatcher(); monitorLock = new ZooLock(monitorLockPath); monitorLock.lockAsync(monitorLockWatcher, new byte[0]); monitorLockWatcher.waitForChange(); if (monitorLockWatcher.acquiredLock) { break; } if (!monitorLockWatcher.failedToAcquireLock) { throw new IllegalStateException("monitor lock in unknown state"); } monitorLock.tryToCancelAsyncLockOrUnlock(); UtilWaitThread.sleep(getContext().getConfiguration().getTimeInMillis(Property.MONITOR_LOCK_CHECK_INTERVAL)); } log.info("Acquired Monitor Lock " + monitorLock.getLockPath()); }

Target:
private void getMonitorLock() throws KeeperException, InterruptedException { final String zRoot = ZooUtil.getRoot(instance); final String monitorPath = zRoot + Constants.ZMONITOR; final String monitorLockPath = zRoot + Constants.ZMONITOR_LOCK; ZooReaderWriter zoo = ZooReaderWriter.getInstance(); if (zoo.exists(monitorPath)) { byte[] data = zoo.getData(monitorPath, null); if (0 != data.length) { zoo.recursiveDelete(monitorPath, NodeMissingPolicy.SKIP); zoo.putPersistentData(monitorPath, new byte[0], NodeExistsPolicy.FAIL); zoo.putPersistentData(monitorLockPath, new byte[0], NodeExistsPolicy.FAIL); } else if (!zoo.exists(monitorLockPath)) { zoo.putPersistentData(monitorLockPath, new byte[0], NodeExistsPolicy.FAIL); } } else { zoo.putPersistentData(zRoot + Constants.ZMONITOR, new byte[0], NodeExistsPolicy.FAIL); if (!zoo.exists(monitorLockPath)) { zoo.putPersistentData(monitorLockPath, new byte[0], NodeExistsPolicy.FAIL); } } log.info("Attempting to acquire Monitor Lock"); while (true) { MoniterLockWatcher monitorLockWatcher = new MoniterLockWatcher(); monitorLock = new ZooLock(monitorLockPath); monitorLock.lockAsync(monitorLockWatcher, new byte[0]); monitorLockWatcher.waitForChange(); if (monitorLockWatcher.acquiredLock) { break; } if (!monitorLockWatcher.failedToAcquireLock) { throw new IllegalStateException("monitor lock in unknown state"); } monitorLock.tryToCancelAsyncLockOrUnlock(); UtilWaitThread.sleep(getContext().getConfiguration().getTimeInMillis(Property.MONITOR_LOCK_CHECK_INTERVAL)); } log.info("Acquired Monitor Lock {}", monitorLock.getLockPath()); }
Source:
public void testEquation2DOp() { final IterableInterval<DoubleType> image = ops.create().img(dimensions, new DoubleType()); final UnaryFunctionOp<long[], Double> op = new AbstractUnaryFunctionOp<long[], Double>() { @Override public Double calculate(final long[] coords) { final double result = Math.pow(start[0] + coords[0] * spacing[0], 2) + Math.pow(start[1] + coords[1] * spacing[1], 2); return result; } }; ops.image().equation(image, op); assertEquals(6801.346801346799, ops.stats().sum(image).getRealDouble(), 0.00001); }

Target:
public void testEquation2DOp() { final IterableInterval<DoubleType> image = ops.create().img(dimensions, new DoubleType()); final UnaryFunctionOp<long[], Double> op = new AbstractUnaryFunctionOp<long[], Double>() { @Override public Double calculate(final long[] coords) { final double result = Math.pow(start[0] + coords[0] * spacing[0], 2) + Math.pow(start[1] + coords[1] * spacing[1], 2); return result; } }; ops.run(DefaultCoordinatesEquation.class, image, op); assertEquals(6801.346801346799, ops.stats().sum(image).getRealDouble(), 0.00001); }
Source:
public UserInfo findUserByCredentials(@Nullable WebContext ctx, String user, String password) { if (Strings.isEmpty(password)) { return null; } UserInfo result = findUserByName(ctx, user); if (result == null) { auditLog.negative("AuditLog.lockedOrNonexitentUserTriedLogin").forUser(null, user).log(); return null; } U account = result.getUserObject(getUserClass()); if (account.getUserAccountData().isExternalLoginRequired() && !isWithinInterval(account.getUserAccountData() .getLogin() .getLastExternalLogin(), account.getTenant() .getValue() .getTenantData() .getExternalLoginIntervalDays())) { completeAuditLogForUser(auditLog.negative("AuditLog.externalLoginRequired"), account); throw Exceptions.createHandled().withNLSKey("UserAccount.externalLoginMustBePerformed").handle(); } LoginData loginData = account.getUserAccountData().getLogin(); if (acceptApiTokens && loginData.checkApiToken(password)) { completeAuditLogForUser(auditLog.neutral("AuditLog.apiTokenLogin"), account); return result; } LoginData.PasswordVerificationResult pwResult = loginData.checkPassword(user, password); if (pwResult != LoginData.PasswordVerificationResult.INVALID) { completeAuditLogForUser(auditLog.neutral("AuditLog.passwordLogin"), account); if (pwResult == LoginData.PasswordVerificationResult.VALID_NEEDS_RE_HASH) { return updatePasswordHashing(result, password); } return result; } auditLog.negative("AuditLog.loginRejected") .forTenant(String.valueOf(account.getTenant().getId()), account.getTenant().getValue().getTenantData().getName()) .log(); return null; }

Target:
public UserInfo findUserByCredentials(@Nullable WebContext ctx, String user, String password) { if (Strings.isEmpty(password)) { return null; } UserInfo result = findUserByName(ctx, user); if (result == null) { auditLog.negative("AuditLog.lockedOrNonexitentUserTriedLogin").forUser(null, user).log(); return null; } U account = result.getUserObject(getUserClass()); if (account.getUserAccountData().isExternalLoginRequired() && !isWithinInterval(account.getUserAccountData() .getLogin() .getLastExternalLogin(), account.getTenant() .getValue() .getTenantData() .getExternalLoginIntervalDays())) { completeAuditLogForUser(auditLog.negative("AuditLog.externalLoginRequired"), account); throw Exceptions.createHandled().withNLSKey("UserAccount.externalLoginMustBePerformed").handle(); } LoginData loginData = account.getUserAccountData().getLogin(); if (acceptApiTokens && checkApiToken(loginData, password)) { completeAuditLogForUser(auditLog.neutral("AuditLog.apiTokenLogin"), account); return result; } LoginData.PasswordVerificationResult pwResult = loginData.checkPassword(user, password); if (pwResult != LoginData.PasswordVerificationResult.INVALID) { completeAuditLogForUser(auditLog.neutral("AuditLog.passwordLogin"), account); if (pwResult == LoginData.PasswordVerificationResult.VALID_NEEDS_RE_HASH) { return updatePasswordHashing(result, password); } return result; } auditLog.negative("AuditLog.loginRejected") .forTenant(String.valueOf(account.getTenant().getId()), account.getTenant().getValue().getTenantData().getName()) .log(); return null; }
Source:
private ResultAndError<PullTaskResult> getRequestResultOrRetry(AndroidTransactionParserFactory factory) { while (asyncRestoreHelper.retryWaitPeriodInProgress()) { try { Thread.sleep(500); } catch (InterruptedException e) { } if (isCancelled()) { return new ResultAndError<>(PullTaskResult.UNKNOWN_FAILURE); } } PullTaskResult responseError = PullTaskResult.UNKNOWN_FAILURE; asyncRestoreHelper.retryAtTime = -1; try { ResultAndError<PullTaskResult> result = makeRequestAndHandleResponse(factory); if (PullTaskResult.RETRY_NEEDED.equals(result.data)) { asyncRestoreHelper.startReportingServerProgress(); return getRequestResultOrRetry(factory); } else { return result; } } catch (SocketTimeoutException e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Timed out listening to receive data during sync"); responseError = PullTaskResult.CONNECTION_TIMEOUT; } catch (UnknownHostException e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Couldn't sync due to bad network"); responseError = PullTaskResult.UNREACHABLE_HOST; } catch (IOException e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Couldn't sync due to IO Error|" + e.getMessage()); } catch (UnknownSyncError e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Couldn't sync due to Unknown Error|" + e.getMessage()); } wipeLoginIfItOccurred(); this.publishProgress(PROGRESS_DONE); return new ResultAndError<>(responseError); }

Target:
private ResultAndError<PullTaskResult> getRequestResultOrRetry(AndroidTransactionParserFactory factory) { while (asyncRestoreHelper.retryWaitPeriodInProgress()) { try { Thread.sleep(500); } catch (InterruptedException e) { } if (isCancelled()) { return new ResultAndError<>(PullTaskResult.UNKNOWN_FAILURE); } } PullTaskResult responseError = PullTaskResult.UNKNOWN_FAILURE; asyncRestoreHelper.retryAtTime = -1; try { ResultAndError<PullTaskResult> result = makeRequestAndHandleResponse(factory); if (PullTaskResult.RETRY_NEEDED.equals(result.data)) { asyncRestoreHelper.startReportingServerProgress(); return getRequestResultOrRetry(factory); } else { return result; } } catch (SocketTimeoutException e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Timed out listening to receive data during sync"); responseError = PullTaskResult.CONNECTION_TIMEOUT; } catch (UnknownHostException e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Couldn't sync due to bad network"); responseError = PullTaskResult.UNREACHABLE_HOST; } catch (AuthenticationInterceptor.PlainTextPasswordException e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_ERROR_CONFIG_STRUCTURE, "Encountered PlainTextPasswordException during sync: Sending password over HTTP"); responseError = PullTaskResult.AUTH_OVER_HTTP; } catch (IOException e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Couldn't sync due to IO Error|" + e.getMessage()); } catch (UnknownSyncError e) { e.printStackTrace(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Couldn't sync due to Unknown Error|" + e.getMessage()); } wipeLoginIfItOccurred(); this.publishProgress(PROGRESS_DONE); return new ResultAndError<>(responseError); }
Source:
private void stopGlusterServices(Guid vdsId) { ResourceManager resourceManager = ResourceManager.getInstance(); GlusterBrickDao glusterBrickDao = DbFacade.getInstance().getGlusterBrickDao(); boolean succeeded = resourceManager.runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vdsId, Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManager.runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vdsId)).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vdsId); for (GlusterBrickEntity brick : bricks) { brick.setStatus(GlusterStatus.DOWN); } glusterBrickDao.updateBrickStatuses(bricks); } } if (!succeeded) { log.error("Failed to stop gluster services while moving the host '{}' to maintenance", getHostName(vdsId)); } }

Target:
private void stopGlusterServices(Guid vdsId) { ResourceManager resourceManager = ResourceManager.getInstance(); GlusterBrickDao glusterBrickDao = DbFacade.getInstance().getGlusterBrickDao(); boolean succeeded = resourceManager.runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vdsId, Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManager.runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vdsId)).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vdsId); bricks.stream().forEach(brick -> brick.setStatus(GlusterStatus.DOWN)); glusterBrickDao.updateBrickStatuses(bricks); } } if (!succeeded) { log.error("Failed to stop gluster services while moving the host '{}' to maintenance", getHostName(vdsId)); } }
Source:
public List<SlotExecutionVertexAssignment> allocateSlotsFor( List<ExecutionVertexSchedulingRequirements> executionVertexSchedulingRequirements) { List<ExecutionVertexID> executionVertexIds = executionVertexSchedulingRequirements .stream() .map(ExecutionVertexSchedulingRequirements::getExecutionVertexId) .collect(Collectors.toList()); SharedSlotProfileRetriever sharedSlotProfileRetriever = sharedSlotProfileRetrieverFactory .createFromBulk(new HashSet<>(executionVertexIds)); Map<ExecutionSlotSharingGroup, List<ExecutionVertexID>> executionsByGroup = executionVertexIds .stream() .collect(Collectors.groupingBy(slotSharingStrategy::getExecutionSlotSharingGroup)); Map<ExecutionVertexID, SlotExecutionVertexAssignment> assignments = executionsByGroup .entrySet() .stream() .flatMap(entry -> allocateLogicalSlotsFromSharedSlot(sharedSlotProfileRetriever, entry.getKey(), entry.getValue())) .collect(Collectors.toMap(SlotExecutionVertexAssignment::getExecutionVertexId, a -> a)); bulkChecker.schedulePendingRequestBulkTimeoutCheck(createBulk(executionsByGroup), allocationTimeout); return executionVertexIds.stream().map(assignments::get).collect(Collectors.toList()); }

Target:
public List<SlotExecutionVertexAssignment> allocateSlotsFor( List<ExecutionVertexSchedulingRequirements> executionVertexSchedulingRequirements) { List<ExecutionVertexID> executionVertexIds = executionVertexSchedulingRequirements .stream() .map(ExecutionVertexSchedulingRequirements::getExecutionVertexId) .collect(Collectors.toList()); SharedSlotProfileRetriever sharedSlotProfileRetriever = sharedSlotProfileRetrieverFactory .createFromBulk(new HashSet<>(executionVertexIds)); Map<ExecutionSlotSharingGroup, List<ExecutionVertexID>> executionsByGroup = executionVertexIds .stream() .collect(Collectors.groupingBy(slotSharingStrategy::getExecutionSlotSharingGroup)); Map<ExecutionVertexID, SlotExecutionVertexAssignment> assignments = allocateLogicalSlotsFromSharedSlots(sharedSlotProfileRetriever, executionsByGroup); bulkChecker.schedulePendingRequestBulkTimeoutCheck(createBulk(executionsByGroup), allocationTimeout); return executionVertexIds.stream().map(assignments::get).collect(Collectors.toList()); }
Source:
protected void initializeService() { lastCheckedAt = new Date(); lastSerializedAt = new Date(); }

Target:
protected void initializeService() { lastCheckedAt = new Date(); }
Source:
public @Nullable String toString() { Number startValue = fBegin.getValue(); Number endValue = fEnd.getValue(); if (startValue != null && endValue != null) { return "[" + String.valueOf(fBegin) + " - " + String.valueOf(fEnd) + "]"; } return null; }

Target:
public @Nullable String toString() { Long startValue = fBegin.getValue(); Long endValue = fEnd.getValue(); if (startValue != null && endValue != null) { return "[" + String.valueOf(fBegin) + " - " + String.valueOf(fEnd) + "]"; } return null; }
Source:
protected void verify(GlusterVolume model, GlusterVolume transform) { assertNotNull(transform); assertNotNull(transform.getId()); assertEquals(model.getId(), transform.getId()); assertNotNull(transform.getName()); assertEquals(model.getName(), transform.getName()); assertNotNull(transform.getVolumeType()); assertEquals(model.getVolumeType(), transform.getVolumeType()); assertNotNull(transform.getTransportTypes()); assertArrayEquals(model.getTransportTypes().getTransportTypes().toArray(), transform.getTransportTypes().getTransportTypes().toArray()); assertNotNull(transform.getReplicaCount()); assertEquals(model.getReplicaCount(), transform.getReplicaCount()); assertNotNull(transform.getStripeCount()); assertEquals(model.getStripeCount(), transform.getStripeCount()); verifyBricks(model, transform); }

Target:
protected void verify(GlusterVolume model, GlusterVolume transform) { assertNotNull(transform); assertNotNull(transform.getId()); assertEquals(model.getId(), transform.getId()); assertNotNull(transform.getName()); assertEquals(model.getName(), transform.getName()); assertNotNull(transform.getVolumeType()); assertEquals(model.getVolumeType(), transform.getVolumeType()); assertNotNull(transform.getTransportTypes()); assertArrayEquals(model.getTransportTypes().getTransportTypes().toArray(), transform.getTransportTypes().getTransportTypes().toArray()); assertNotNull(transform.getReplicaCount()); assertEquals(model.getReplicaCount(), transform.getReplicaCount()); assertNotNull(transform.getStripeCount()); assertEquals(model.getStripeCount(), transform.getStripeCount()); verifyOptions(model, transform); }
Source:
private Map<String, String> createAuthorizationHeaders() { switch (Intercom.getAuthKeyType()) { case TOKEN: headers.put("Authorization", "Basic " + generateAuthString(Intercom.getToken(),"")); break; } return headers; }

Target:
private Map<String, String> createAuthorizationHeaders() { headers.put("Authorization", "Basic " + generateAuthString(Intercom.getToken(),"")); return headers; }
Source:
public void stopServer() { if (server instanceof GrizzlyServer) { ((GrizzlyServer) server).setCleanIdleConnections(); } server.stop(); }

Target:
public void stopServer() { if (server instanceof GrizzlyServer) { ((GrizzlyServer) server).setCleanIdleConnections(true); } server.stop(); }
Source:
public <E extends BoxItemFilter> void setBoxItemFilter(E filter) { mArgs.putSerializable(ARG_BOX_ITEM_FILTER, filter); }

Target:
public <E extends Serializable & BoxItemFilter> void setBoxItemFilter(E filter) { mArgs.putSerializable(ARG_BOX_ITEM_FILTER, filter); }
Source:
public Response get(@Context final HttpServletRequest request, @Context final HttpServletResponse response, @Context UriInfo uriInfo, @PathParam("folder") final String folderName, @PathParam("path") final String pathParams) { final InitDataObject initDataObject = this.webResource.init (pathParams, false, request, false, null); final DotJSONCacheStrategy cacheStrategy = getCacheStrategy(HTTPMethod.GET); final Optional<DotJSON> dotJSONOptional = cacheStrategy.get(request, initDataObject.getUser()); if(dotJSONOptional.isPresent()) { return Response.ok(dotJSONOptional.get()).build(); } try { final FileAsset getFileAsset = getVTLFile(HTTPMethod.GET, request, folderName, initDataObject.getUser()); final Map<String, Object> contextParams = CollectionsUtils.map( "urlParams", initDataObject.getParamsMap(), "queryParams", uriInfo.getQueryParameters()); return evalVTLFile(request, response, getFileAsset, contextParams, initDataObject.getUser(), cacheStrategy); } catch(DotContentletStateException e) { final String errorMessage = "Unable to find velocity file '" + HTTPMethod.GET.fileName + FILE_EXTENSION + "' under path '" + VTL_PATH + StringPool.SLASH + folderName + StringPool.SLASH + "'"; Logger.error(this, errorMessage, e); return ResponseUtil.mapExceptionResponse(new DotDataException(errorMessage)); } catch(Exception e) { Logger.error(this,"Exception on VTL endpoint. GET method: " + e.getMessage(), e); return ResponseUtil.mapExceptionResponse(e); } }

Target:
public Response get(@Context final HttpServletRequest request, @Context final HttpServletResponse response, @Context UriInfo uriInfo, @PathParam("folder") final String folderName, @PathParam("path") final String pathParams) { final InitDataObject initDataObject = this.webResource.init (pathParams, false, request, false, null); final DotJSONCache cache = getCacheStrategy(HTTPMethod.GET); final Optional<DotJSON> dotJSONOptional = cache.get(request, initDataObject.getUser()); if(dotJSONOptional.isPresent()) { return Response.ok(dotJSONOptional.get()).build(); } try { final FileAsset getFileAsset = getVTLFile(HTTPMethod.GET, request, folderName, initDataObject.getUser()); final Map<String, Object> contextParams = CollectionsUtils.map( "urlParams", initDataObject.getParamsMap(), "queryParams", uriInfo.getQueryParameters()); return evalVTLFile(request, response, getFileAsset, contextParams, initDataObject.getUser(), cache); } catch(DotContentletStateException e) { final String errorMessage = "Unable to find velocity file '" + HTTPMethod.GET.fileName() + FILE_EXTENSION + "' under path '" + VTL_PATH + StringPool.SLASH + folderName + StringPool.SLASH + "'"; Logger.error(this, errorMessage, e); return ResponseUtil.mapExceptionResponse(new DotDataException(errorMessage)); } catch(Exception e) { Logger.error(this,"Exception on VTL endpoint. GET method: " + e.getMessage(), e); return ResponseUtil.mapExceptionResponse(e); } }
Source:
private void postDescription(@NonNull String editToken) { newDescription = null; final String description = StringUtil.emptyIfNull(editView.getDescription()); descriptionEditCall = new DescriptionEditClient().request(wikiData, pageTitle, description, editToken, new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { if (getActivity() == null) { return; } newDescription = description; DeviceUtil.hideSoftKeyboard(getActivity()); editView.setSaveState(false); startActivityForResult(DescriptionEditSuccessActivity.newIntent(getContext()), Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT_SUCCESS); } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, String info) { editView.setSaveState(false); editView.setError(info); } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editFailed(caught); } }); }

Target:
private void postDescription(@NonNull String editToken) { newDescription = null; final String description = editView.getDescription(); descriptionEditCall = new DescriptionEditClient().request(wikiData, pageTitle, description, editToken, new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { Prefs.setLastDescriptionEditTime(new Date().getTime()); WikipediaApp.getInstance().listenForNotifications(); if (getActivity() != null) { newDescription = description; DeviceUtil.hideSoftKeyboard(getActivity()); editView.setSaveState(false); startActivityForResult(DescriptionEditSuccessActivity.newIntent(getContext()), Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT_SUCCESS); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, String info) { editView.setSaveState(false); editView.setError(info); } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editFailed(caught); } }); }
Source:
public void build(Set<Bean<?>> beans) { if (isBuilt()) { throw new IllegalStateException("BeanIdentifier index is already built!"); } if (beans.isEmpty()) { index = new BeanIdentifier[0]; reverseIndex = Collections.emptyMap(); return; } List<BeanIdentifier> tempIndex = new ArrayList<BeanIdentifier>(beans.size()); for (Bean<?> bean : beans) { if (bean instanceof CommonBean<?>) { tempIndex.add(((CommonBean<?>) bean).getIdentifier()); } else if (bean instanceof PassivationCapable) { tempIndex.add(new StringBeanIdentifier(((PassivationCapable) bean).getId())); } } Collections.sort(tempIndex, new Comparator<BeanIdentifier>() { @Override public int compare(BeanIdentifier o1, BeanIdentifier o2) { return o1.asString().compareTo(o2.asString()); } }); index = tempIndex.toArray(new BeanIdentifier[tempIndex.size()]); ImmutableMap.Builder<BeanIdentifier, Integer> builder = ImmutableMap.builder(); for (int i = 0; i < index.length; i++) { builder.put(index[i], i); } reverseIndex = builder.build(); indexHash = Arrays.hashCode(index); BootstrapLogger.LOG.beanIdentifierIndexBuilt(getDebugInfo()); }

Target:
public void build(Set<Bean<?>> beans) { if (isBuilt()) { throw new IllegalStateException("BeanIdentifier index is already built!"); } if (beans.isEmpty()) { index = new BeanIdentifier[0]; reverseIndex = Collections.emptyMap(); return; } List<BeanIdentifier> tempIndex = new ArrayList<BeanIdentifier>(beans.size()); for (Bean<?> bean : beans) { if (bean instanceof CommonBean<?>) { tempIndex.add(((CommonBean<?>) bean).getIdentifier()); } else if (bean instanceof PassivationCapable) { tempIndex.add(new StringBeanIdentifier(((PassivationCapable) bean).getId())); } } Collections.sort(tempIndex, new Comparator<BeanIdentifier>() { @Override public int compare(BeanIdentifier o1, BeanIdentifier o2) { return o1.asString().compareTo(o2.asString()); } }); index = tempIndex.toArray(new BeanIdentifier[tempIndex.size()]); ImmutableMap.Builder<BeanIdentifier, Integer> builder = ImmutableMap.builder(); for (int i = 0; i < index.length; i++) { builder.put(index[i], i); } reverseIndex = builder.build(); indexHash = Arrays.hashCode(index); if(BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.beanIdentifierIndexBuilt(getDebugInfo()); } }
Source:
public AnnotationAuditingConfigurationSupport(AnnotationMetadata metadata, Class<? extends Annotation> annotation) { attributes = new AnnotationAttributes(metadata.getAnnotationAttributes(annotation.getName())); }

Target:
public AnnotationAuditingConfigurationSupport(AnnotationMetadata metadata, Class<? extends Annotation> annotation) { Assert.notNull(metadata, "metadata must not be null!"); Assert.notNull(annotation, "annotation must not be null!"); attributes = new AnnotationAttributes(metadata.getAnnotationAttributes(annotation.getName())); }
Source:
private void replayTuplesIfRequired() { for (WorkItem item : waitingTuples) { item.taskHandle = executor.submit(new Processor(item)); item.processState = State.SUBMITTED; item.processStartTime = 0; item.outTuple = null; } }

Target:
private void replayTuplesIfRequired() { for (WorkItem item : waitingTuples) { item.processState = State.SUBMITTED; item.processStartTime = 0; item.outTuple = null; item.taskHandle = executor.submit(new Processor(item)); } }
Source:
public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(leftResultSetNumber); out.writeInt(leftNumCols); out.writeInt(rightNumCols); writeNullableString(restrictionMethodName, out); writeNullableString(userSuppliedOptimizerOverrides, out); out.writeBoolean(oneRowRightSide); out.writeBoolean(notExistsRightSide); out.writeBoolean(rightFromSSQ); out.writeBoolean(wasRightOuterJoin); out.writeBoolean(isOuterJoin); writeNullableString(emptyRowFunMethodName, out); out.writeBoolean(serializeLeftResultSet); if(serializeLeftResultSet) out.writeObject(leftResultSet); out.writeBoolean(serializeRightResultSet); if(serializeRightResultSet) out.writeObject(rightResultSet); if(!serializeRightResultSet||!serializeLeftResultSet){ out.writeObject(mergedRow); out.writeObject(leftRow); out.writeObject(rightRow); out.writeObject(mergedRowTemplate); } boolean sparkExpressionPresent = (sparkExpressionTreeAsString != null && sparkExpressionTreeAsString.length() != 0); out.writeBoolean(sparkExpressionPresent); if (sparkExpressionPresent) { if (sparkJoinPredicate == null) sparkJoinPredicate = (SparkExpressionNode) SerializationUtils. deserialize(Base64.decodeBase64(sparkExpressionTreeAsString)); out.writeObject(sparkJoinPredicate); } }

Target:
public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(leftResultSetNumber); out.writeInt(leftNumCols); out.writeInt(rightNumCols); writeNullableString(restrictionMethodName, out); writeNullableString(userSuppliedOptimizerOverrides, out); out.writeBoolean(oneRowRightSide); out.writeBoolean(notExistsRightSide); out.writeBoolean(rightFromSSQ); out.writeBoolean(wasRightOuterJoin); out.writeBoolean(isOuterJoin); writeNullableString(emptyRowFunMethodName, out); out.writeBoolean(serializeLeftResultSet); if(serializeLeftResultSet) out.writeObject(leftResultSet); out.writeBoolean(serializeRightResultSet); if(serializeRightResultSet) out.writeObject(rightResultSet); if(!serializeRightResultSet||!serializeLeftResultSet){ out.writeObject(mergedRow); out.writeObject(leftRow); out.writeObject(rightRow); out.writeObject(mergedRowTemplate); } boolean sparkExpressionPresent = (sparkExpressionTreeAsString != null && sparkExpressionTreeAsString.length() != 0); out.writeBoolean(sparkExpressionPresent); if (sparkExpressionPresent) out.writeUTF(sparkExpressionTreeAsString); }
Source:
public static ProvisioningConnectorConfig build(OMElement provisioningConnectorConfigOM) throws IdentityApplicationManagementException{ ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig(); Iterator<?> iter = provisioningConnectorConfigOM.getChildElements(); while (iter.hasNext()) { OMElement element = (OMElement) (iter.next()); String elementName = element.getLocalName(); if ("ProvisioningProperties".equals(elementName)) { Iterator<?> propertiesIter = element.getChildElements(); List<Property> propertiesArrList = new ArrayList<Property>(); if (propertiesIter != null) { while (propertiesIter.hasNext()) { OMElement propertiesElement = (OMElement) (propertiesIter.next()); propertiesArrList.add(Property.build(propertiesElement)); } } if (CollectionUtils.isNotEmpty(propertiesArrList)) { Property[] propertiesArr = propertiesArrList.toArray(new Property[0]); provisioningConnectorConfig.setProvisioningProperties(propertiesArr); } } else if ("IsEnabled".equals(elementName)) { provisioningConnectorConfig.setEnabled(Boolean.parseBoolean(element.getText())); } else if ("IsBlocking".equals(elementName)) { provisioningConnectorConfig.setBlocking(Boolean.parseBoolean(element.getText())); } } if(StringUtils.isBlank(provisioningConnectorConfig.getName())){ throw new IdentityApplicationManagementException("No configured name found for " + "ProvisioningConnectorConfig"); } return provisioningConnectorConfig; }

Target:
public static ProvisioningConnectorConfig build(OMElement provisioningConnectorConfigOM) throws IdentityApplicationManagementException{ ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig(); Iterator<?> iter = provisioningConnectorConfigOM.getChildElements(); while (iter.hasNext()) { OMElement element = (OMElement) (iter.next()); String elementName = element.getLocalName(); if ("ProvisioningProperties".equals(elementName)) { Iterator<?> propertiesIter = element.getChildElements(); List<Property> propertiesArrList = new ArrayList<Property>(); if (propertiesIter != null) { while (propertiesIter.hasNext()) { OMElement propertiesElement = (OMElement) (propertiesIter.next()); propertiesArrList.add(Property.build(propertiesElement)); } } if (CollectionUtils.isNotEmpty(propertiesArrList)) { Property[] propertiesArr = propertiesArrList.toArray(new Property[0]); provisioningConnectorConfig.setProvisioningProperties(propertiesArr); } } else if ("Name".equals(elementName)) { provisioningConnectorConfig.setName(element.getText()); } else if ("IsEnabled".equals(elementName)) { provisioningConnectorConfig.setEnabled(Boolean.parseBoolean(element.getText())); } else if ("IsBlocking".equals(elementName)) { provisioningConnectorConfig.setBlocking(Boolean.parseBoolean(element.getText())); } } if(StringUtils.isBlank(provisioningConnectorConfig.getName())){ throw new IdentityApplicationManagementException("No configured name found for " + "ProvisioningConnectorConfig"); } return provisioningConnectorConfig; }
Source:
public void testTaskResultByTag() throws Exception { HttpResponse response = sendRequest("jobs/" + jobId + "/tasks/tag/LOOP-T2-1/result"); JSONArray jsonArray = toJsonArray(response); System.out.println(jsonArray.toJSONString()); ArrayList<String> taskNames = new ArrayList<>(); for (int i = 0; i < jsonArray.size(); i++) { JSONObject id = (JSONObject) ((JSONObject) jsonArray.get(i)).get("id"); String name = (String) id.get("readableName"); taskNames.add(name); } assertTrue(taskNames.contains("T1#1")); assertTrue(taskNames.contains("Print1#1")); assertTrue(taskNames.contains("Print2#1")); assertTrue(taskNames.contains("T2#1")); assertEquals(4, jsonArray.size()); }

Target:
public void testTaskResultByTag() throws Exception { HttpResponse response = sendRequest("jobs/" + jobId + "/tasks/tag/LOOP-T2-1/result"); JSONArray jsonArray = toJsonArray(response); System.out.println(jsonArray.toJSONString()); ArrayList<String> taskNames = new ArrayList<>(4); for (int i = 0; i < jsonArray.size(); i++) { JSONObject id = (JSONObject) ((JSONObject) jsonArray.get(i)).get("id"); String name = (String) id.get("readableName"); taskNames.add(name); } assertTrue(taskNames.contains("T1#1")); assertTrue(taskNames.contains("Print1#1")); assertTrue(taskNames.contains("Print2#1")); assertTrue(taskNames.contains("T2#1")); assertEquals(4, jsonArray.size()); }
Source:
public PowerUpSpawner(PlayingField pf) { this.pf = pf; pf.registerGameListener(this); this.intervalTicks = INTERVAL * pf.getFPS(); this.tickCounter = 0; this.minX = 0; this.maxX = pf.getWidth(); this.log = Log.getLogger(); }

Target:
public PowerUpSpawner(PlayingField pf) { this.pf = pf; this.intervalTicks = INTERVAL * pf.getFPS(); this.tickCounter = 0; this.minX = 0; this.maxX = pf.getWidth(); this.log = Log.getLogger(); pf.registerGameListener(this); }
Source:
public void testBadStartTime(){ new Stamp(1<<62, 5); }

Target:
public void testBadStartTime() { new Stamp(1L << 62, 5); }
Source:
public static void main(String[] args) { SingleCommand<Main> cmd = SingleCommand.singleCommand(Main.class); cmd.parse(args); if (server) { JavaTCPServer.run(file, port); } else if (client) { try { JavaTCPClient.run(file, host, port, debug); } catch (Exception e) { System.out.println("Could not launch client"); } } }

Target:
public static void main(String[] args) { SingleCommand<Main> cmd = SingleCommand.singleCommand(Main.class); cmd.parse(args); if (server) { JavaTCPServer.run(file, port); } else if (client) { try { JavaTCPClient.run(file, host, port, debug); } catch (Exception e) { e.printStackTrace(); } } }
Source:
private void updateRepo() throws TeamException { try { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tag.getTagId()); tagRef.setRefLogMessage("tag: " + refName, false); tagRef.setForceUpdate(shouldMoveTag); Result updateResult = tagRef.update(); if (updateResult != Result.NEW && updateResult != Result.FORCED) throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tagName)); } catch (IOException e) { throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tagName), e); } }

Target:
private void updateRepo() throws TeamException { String refName = Constants.R_TAGS + tag.getTag(); try { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tag.getTagId()); tagRef.setForceUpdate(shouldMoveTag); Result updateResult = tagRef.update(); if (updateResult != Result.NEW && updateResult != Result.FORCED) throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag(), updateResult)); } catch (IOException e) { throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag()), e); } }
Source:
public void deleteOneEntryUsingCachePolicy() { try { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); Object[] keys = indexEventHolder.getAllPrimaryKeyValues().toArray(); long minTimestamp = Long.MAX_VALUE; Object keyOfMinTimestamp = null; for (Object key: keys) { Object[] data = indexEventHolder.getEvent(key).getOutputData(); long timestamp = (long) data[data.length - 1]; if (timestamp < minTimestamp) { minTimestamp = timestamp; keyOfMinTimestamp = key; } } indexEventHolder.deleteEvent(keyOfMinTimestamp); } catch (ClassCastException ignored) { } }

Target:
public void deleteOneEntryUsingCachePolicy() { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); long minTimestamp = Long.MAX_VALUE; Object keyOfMinTimestamp = null; for (Object key: keys) { Object[] data = indexEventHolder.getEvent(key).getOutputData(); long timestamp = (long) data[cachePolicyAttributePosition]; if (timestamp < minTimestamp) { minTimestamp = timestamp; keyOfMinTimestamp = key; } } indexEventHolder.deleteEvent(keyOfMinTimestamp); }