auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void checkForSegmentHandoffs() { try { Iterator<Map.Entry<SegmentDescriptor, Pair<Executor, Runnable>>> itr = handOffCallbacks.entrySet() .iterator(); while (itr.hasNext()) { Map.Entry<SegmentDescriptor, Pair<Executor, Runnable>> entry = itr.next(); SegmentDescriptor descriptor = entry.getKey(); try { if (coordinatorClient.isSpecificIntervalDroppedByRule(dataSource, descriptor.getInterval())) { log.info( "Segment already dropped by drop rules for dataSource[%s] Segment[%s], ignore it!", dataSource, descriptor ); entry.getValue().lhs.execute(entry.getValue().rhs); itr.remove(); continue; } List<ImmutableSegmentLoadInfo> loadedSegments = coordinatorClient.fetchServerView( dataSource, descriptor.getInterval(), true ); if (isHandOffComplete(loadedSegments, entry.getKey())) { log.info("Segment Handoff complete for dataSource[%s] Segment[%s]", dataSource, descriptor); entry.getValue().lhs.execute(entry.getValue().rhs); itr.remove(); } } catch (Exception e) { log.error( e, "Exception while checking handoff for dataSource[%s] Segment[%s], Will try again after [%d]secs", dataSource, descriptor, pollDurationMillis ); } } if (!handOffCallbacks.isEmpty()) { log.info("Still waiting for Handoff for Segments : [%s]", handOffCallbacks.keySet()); } } catch (Throwable t) { log.error( t, "Exception while checking handoff for dataSource[%s], Will try again after [%d]secs", dataSource, pollDurationMillis ); } }

Target:
void checkForSegmentHandoffs() { try { Iterator<Map.Entry<SegmentDescriptor, Pair<Executor, Runnable>>> itr = handOffCallbacks.entrySet() .iterator(); while (itr.hasNext()) { Map.Entry<SegmentDescriptor, Pair<Executor, Runnable>> entry = itr.next(); SegmentDescriptor descriptor = entry.getKey(); try { if (coordinatorClient.isHandOffComplete(dataSource, descriptor)) { log.info("Segment Handoff complete for dataSource[%s] Segment[%s]", dataSource, descriptor); entry.getValue().lhs.execute(entry.getValue().rhs); itr.remove(); } } catch (Exception e) { log.error( e, "Exception while checking handoff for dataSource[%s] Segment[%s], Will try again after [%d]secs", dataSource, descriptor, pollDurationMillis ); } } if (!handOffCallbacks.isEmpty()) { log.info("Still waiting for Handoff for Segments : [%s]", handOffCallbacks.keySet()); } } catch (Throwable t) { log.error( t, "Exception while checking handoff for dataSource[%s], Will try again after [%d]secs", dataSource, pollDurationMillis ); } }
Source:
JSONObject toJSONObject() { JSONObject json = new JSONObject(); try { json.put(IAM_ID, this.messageId); JSONObject variants = new JSONObject(); for (String key : this.variants.keySet()) { HashMap<String, String> variant = this.variants.get(key); JSONObject converted = new JSONObject(); for (String variantKey : variant.keySet()) converted.put(variantKey, variant.get(variantKey)); variants.put(key, converted); } json.put(IAM_VARIANTS, variants); json.put(DISPLAY_DURATION, this.displayDuration); json.put(DISPLAY_LIMIT, this.displayLimit); json.put(DISPLAY_DELAY, this.displayDelay); if (redisplayEnabled) json.put(IAM_RE_DISPLAY, new JSONObject() {{ put(DISPLAY_LIMIT, displayLimit); put(DISPLAY_DELAY, displayDelay); }}); JSONArray orConditions = new JSONArray(); for (ArrayList<OSTrigger> andArray : this.triggers) { JSONArray andConditions = new JSONArray(); for (OSTrigger trigger : andArray) andConditions.put(trigger.toJSONObject()); orConditions.put(andConditions); } json.put(IAM_TRIGGERS, orConditions); } catch (JSONException exception) { exception.printStackTrace(); } return json; }

Target:
JSONObject toJSONObject() { JSONObject json = new JSONObject(); try { json.put(IAM_ID, this.messageId); JSONObject variants = new JSONObject(); for (String key : this.variants.keySet()) { HashMap<String, String> variant = this.variants.get(key); JSONObject converted = new JSONObject(); for (String variantKey : variant.keySet()) converted.put(variantKey, variant.get(variantKey)); variants.put(key, converted); } json.put(IAM_VARIANTS, variants); json.put(DISPLAY_DURATION, this.displayDuration); if (displayStats.isRedisplayEnabled()) json.put(IAM_RE_DISPLAY, displayStats.toJSONObject()); JSONArray orConditions = new JSONArray(); for (ArrayList<OSTrigger> andArray : this.triggers) { JSONArray andConditions = new JSONArray(); for (OSTrigger trigger : andArray) andConditions.put(trigger.toJSONObject()); orConditions.put(andConditions); } json.put(IAM_TRIGGERS, orConditions); } catch (JSONException exception) { exception.printStackTrace(); } return json; }
Source:
public CachedConnection reserveAny() { if (unreserved.size() > 0) { CachedConnection cachedConnection = unreserved.pop(); cachedConnection.reserve(); reserved.put(cachedConnection.transport, cachedConnection); if (log.isTraceEnabled()) { log.trace("Using existing connection to {}", cachedConnection.transport.cacheKey); } return cachedConnection; } return null; }

Target:
public CachedConnection reserveAny() { CachedConnection cachedConnection = unreserved.poll(); if (cachedConnection != null) { cachedConnection.reserve(); reserved.put(cachedConnection.transport, cachedConnection); if (log.isTraceEnabled()) { log.trace("Using existing connection to {}", cachedConnection.transport.cacheKey); } } return cachedConnection; }
Source:
private void assertCoverage(final Line line, final int insnStatus, final int missedBranches, final int coveredBranches) { final ILine coverage = line.getCoverage(); final String location = String.format("(%s:%d)", source.getCoverage().getName(), line.getNr()); String msg = String.format("Instructions in %s: %s", location, line.getText()); final int actualStatus = coverage.getInstructionCounter().getStatus(); assertEquals(msg, STATUS_NAME[insnStatus], STATUS_NAME[actualStatus]); msg = String.format("Branches in %s: %s", location, line.getText()); assertEquals(msg, CounterImpl.getInstance(missedBranches, coveredBranches), coverage.getBranchCounter()); }

Target:
private void assertCoverage(final Line line, final int insnStatus, final int missedBranches, final int coveredBranches) { final ILine coverage = line.getCoverage(); String msg = String.format("Instructions (%s)", line); final int actualStatus = coverage.getInstructionCounter().getStatus(); assertEquals(msg, STATUS_NAME[insnStatus], STATUS_NAME[actualStatus]); msg = String.format("Branches (%s)", line); assertEquals(msg, CounterImpl.getInstance(missedBranches, coveredBranches), coverage.getBranchCounter()); }
Source:
public void testAndThenRemoveOnFailure() throws TransactionFailureException { ds1.failCommitTxOnce = InduceFailure.ThrowException; TransactionContext context = newTransactionContext(); context.start(); Assert.assertTrue(context.addTransactionAware(ds1)); ds1.addChange(A); try { context.finish(); Assert.fail("persist failed - exception should be thrown"); } catch (TransactionFailureException e) { Assert.assertEquals("persist failure", e.getCause().getMessage()); } Assert.assertTrue(context.removeTransactionAware(ds1)); Assert.assertTrue(ds1.started); Assert.assertTrue(ds1.checked); Assert.assertTrue(ds1.committed); Assert.assertFalse(ds1.postCommitted); Assert.assertTrue(ds1.rolledBack); Assert.assertEquals(txClient.state, DummyTxClient.CommitState.Aborted); }

Target:
public void testAndThenRemoveOnFailure() throws TransactionFailureException { ds1.failCommitTxOnce = InduceFailure.ThrowException; TransactionContext context = newTransactionContext(); context.start(); Assert.assertTrue(context.addTransactionAware(ds1)); ds1.addChange(A); try { context.finish(); Assert.fail("Persist should have failed - exception should be thrown"); } catch (TransactionFailureException e) { Assert.assertEquals("persist failure", e.getCause().getMessage()); } Assert.assertTrue(context.removeTransactionAware(ds1)); Assert.assertTrue(ds1.started); Assert.assertTrue(ds1.checked); Assert.assertTrue(ds1.committed); Assert.assertFalse(ds1.postCommitted); Assert.assertTrue(ds1.rolledBack); Assert.assertEquals(txClient.state, DummyTxClient.CommitState.Aborted); }
Source:
public static boolean requiresNewCustomParser(final Struct struct, final Set<String> existingTypes, final ImmutableSet<String> enumNames) { for (final StructMember member : struct.getStructMembers()) { if (!member.getType().isPrimitive()) { if (member.getType().getTypeRoot().equals("ds3_str")) continue; if (existingTypes.contains(member.getType().getTypeRoot())) continue; if (enumNames.contains(member.getType().getTypeRoot())) continue; return true; } } return false; }

Target:
public static boolean requiresNewCustomParser(final Struct struct, final Set<String> existingTypes, final ImmutableSet<String> enumNames) { for (final StructMember member : struct.getStructMembers()) { if (!member.getType().isPrimitive()) { if (member.getType().getTypeName().equals("ds3_str")) continue; if (existingTypes.contains(member.getType().getTypeName())) continue; if (enumNames.contains(member.getType().getTypeName())) continue; return true; } } return false; }
Source:
public DefaultMutableThemeStyle(TextColor foreground, TextColor background, SGR... sgrs) { this(foreground, background, sgrs.length > 0 ? EnumSet.copyOf(Arrays.asList(sgrs)) : EnumSet.allOf(SGR.class)); }

Target:
public DefaultMutableThemeStyle(TextColor foreground, TextColor background, SGR... sgrs) { this(foreground, background, sgrs.length > 0 ? EnumSet.copyOf(Arrays.asList(sgrs)) : EnumSet.noneOf(SGR.class)); }
Source:
private String extractTag(Element element) { WakeLock annotation = element.getAnnotation(WakeLock.class); String tag = annotation.tag(); if (WakeLock.DEFAULT_TAG.equals(tag)) { tag = element.getEnclosingElement().getSimpleName().toString(); tag += "." + element.getSimpleName().toString(); } return tag; }

Target:
private String extractTag(Element element) { WakeLock annotation = element.getAnnotation(WakeLock.class); String tag = annotation.tag(); if (WakeLock.DEFAULT_TAG.equals(tag)) { tag = element.getEnclosingElement().getSimpleName().toString() + "." + element.getSimpleName().toString(); } return tag; }
Source:
public void execution() throws Exception { final Project project = execute(ProjectGet.of()); assertThat(project.getKey()).isEqualTo(getSphereClientConfig().getProjectKey()); assertThat(project.getName()).overridingErrorMessage("name").isNotEmpty(); assertThat(project.getCountries()).overridingErrorMessage("countries").isNotEmpty(); assertThat(project.getLanguages()).overridingErrorMessage("languages").isNotEmpty(); assertThat(project.getCreatedAt()).overridingErrorMessage("createdAt").isNotNull(); }

Target:
public void execution() throws Exception { final Project project = execute(ProjectGet.of()); assertThat(project.getKey()).isEqualTo(getSphereClientConfig().getProjectKey()); assertThat(project.getName()).overridingErrorMessage("name").isNotEmpty(); assertThat(project.getCountries()).overridingErrorMessage("countries").isNotEmpty(); assertThat(project.getLanguages()).overridingErrorMessage("languages").isNotEmpty(); assertThat(project.getCreatedAt()).overridingErrorMessage("createdAt").isNotNull(); assertThat(project.getTrialUntil()).overridingErrorMessage("trialUntil").isNotNull(); }
Source:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); String role = mRoleListAdapter.getSelectedRole(); if (role != null) { outState.putString(ROLE_TAG, role); } }

Target:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); String role = mRoleListAdapter.getSelectedRole(); outState.putString(ROLE_TAG, role); }
Source:
public Builder(RetryOptions options) { enableRetries = options.retriesEnabled; initialBackoffMillis = options.initialBackoffMillis; backoffMultiplier = options.backoffMultiplier; maxElaspedBackoffMillis = options.maxElaspedBackoffMillis; streamingBufferSize = options.streamingBufferSize; streamingBatchSize = options.streamingBatchSize; readPartialRowTimeoutMillis = options.readPartialRowTimeoutMillis; maxScanTimeoutRetries = options.maxScanTimeoutRetries; statusToRetryOn = new HashSet<>(options.statusToRetryOn); allowRetriesWithoutTimestamp = options.allowRetriesWithoutTimestamp; }

Target:
public Builder(RetryOptions options) { this.enableRetries = options.retriesEnabled; this.initialBackoffMillis = options.initialBackoffMillis; this.backoffMultiplier = options.backoffMultiplier; this.maxElaspedBackoffMillis = options.maxElaspedBackoffMillis; this.streamingBufferSize = options.streamingBufferSize; this.streamingBatchSize = options.streamingBatchSize; this.readPartialRowTimeoutMillis = options.readPartialRowTimeoutMillis; this.maxScanTimeoutRetries = options.maxScanTimeoutRetries; this.statusToRetryOn = new HashSet<>(options.statusToRetryOn); this.allowRetriesWithoutTimestamp = options.allowRetriesWithoutTimestamp; }
Source:
public PlanetConfigs(HullConfigManager hullConfigs, GameColors cols, ItemManager itemManager) { allConfigs = new HashMap<>(); easy = new ArrayList<>(); medium = new ArrayList<>(); hard = new ArrayList<>(); Set<ResourceUrn> planetJsonConfigs = Assets.getAssetHelper().list(Json.class, "[a-zA-Z0-9]*:planetsConfig"); for (ResourceUrn planetConfigJson : planetJsonConfigs) { String moduleName = planetConfigJson.getModuleName().toString(); Json json = Assets.getJson(planetConfigJson.toString()); JsonValue rootNode = json.getJsonValue(); for (JsonValue node : rootNode) { PlanetConfig planetConfig = PlanetConfig.load(node, hullConfigs, cols, itemManager, moduleName); allConfigs.put(node.name, planetConfig); for (String difficulty : planetConfig.difficultyLevels) { switch (difficulty) { case "easy": easy.add(planetConfig); case "medium": medium.add(planetConfig); case "hard": hard.add(planetConfig); } } } json.dispose(); } }

Target:
public PlanetConfigs(HullConfigManager hullConfigs, GameColors cols, ItemManager itemManager) { allConfigs = new HashMap<>(); easy = new ArrayList<>(); medium = new ArrayList<>(); hard = new ArrayList<>(); Set<ResourceUrn> planetJsonConfigs = Assets.getAssetHelper().list(Json.class, "[a-zA-Z0-9]*:planetsConfig"); for (ResourceUrn planetConfigJson : planetJsonConfigs) { String moduleName = planetConfigJson.getModuleName().toString(); Json json = Assets.getJson(planetConfigJson.toString()); JSONObject rootNode = json.getJsonValue(); Validator.validate(rootNode, "engine:schemaPlanetsConfig"); for (String s : rootNode.keySet()) { JSONObject node = rootNode.getJSONObject(s); PlanetConfig planetConfig = PlanetConfig.load(s, node, hullConfigs, cols, itemManager, moduleName); allConfigs.put(s, planetConfig); for (String difficulty : planetConfig.difficultyLevels) { switch (difficulty) { case "easy": easy.add(planetConfig); break; case "medium": medium.add(planetConfig); break; case "hard": hard.add(planetConfig); break; } } } json.dispose(); } }
Source:
public List<GraphQLDirective> getDirectives() { return Collections.unmodifiableList(directives); }

Target:
public List<GraphQLDirective> getDirectives() { return new ArrayList<>(directives); }
Source:
public TaskStatusResponse getTaskStatus(String taskId) { return new TaskStatusResponse( taskId, new TaskStatusPlus( taskId, taskId, "testTask", DateTimes.EPOCH, DateTimes.EPOCH, tasks.get(taskId), RunnerTaskState.RUNNING, -1L, TaskLocation.unknown(), "testDataSource", null ) ); }

Target:
public TaskStatusResponse getTaskStatus(String taskId) { return new TaskStatusResponse( taskId, new TaskStatusPlus( taskId, "groupId", "testTask", DateTimes.EPOCH, DateTimes.EPOCH, tasks.get(taskId), RunnerTaskState.RUNNING, -1L, TaskLocation.unknown(), "testDataSource", null ) ); }
Source:
JwtCredentials(Builder builder) { this.privateKey = Preconditions.checkNotNull(builder.getPrivateKey()); this.privateKeyId = Preconditions.checkNotNull(builder.getPrivateKeyId()); this.claims = Preconditions.checkNotNull(builder.getClaims()); Preconditions.checkState(claims.isComplete(), JWT_INCOMPLETE_ERROR_MESSAGE); this.lifeSpanSeconds = Preconditions.checkNotNull(builder.getLifeSpanSeconds()); this.clock = Preconditions.checkNotNull(builder.getClock()); }

Target:
private JwtCredentials(Builder builder) { this.privateKey = Preconditions.checkNotNull(builder.getPrivateKey()); this.privateKeyId = Preconditions.checkNotNull(builder.getPrivateKeyId()); this.jwtClaims = Preconditions.checkNotNull(builder.getJwtClaims()); Preconditions.checkState(jwtClaims.isComplete(), JWT_INCOMPLETE_ERROR_MESSAGE); this.lifeSpanSeconds = Preconditions.checkNotNull(builder.getLifeSpanSeconds()); this.clock = Preconditions.checkNotNull(builder.getClock()); }
Source:
private SubProcessPropertyWriter convertMultipleInstanceSubprocessNode(Node<View<MultipleInstanceSubprocess>, ?> n) { SubProcess process = bpmn2.createSubProcess(); process.setId(n.getUUID()); MultipleInstanceSubProcessPropertyWriter p = propertyWriterFactory.ofMultipleInstanceSubProcess(process); MultipleInstanceSubprocess definition = n.getContent().getDefinition(); BPMNGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); ProcessData processData = definition.getProcessData(); p.setProcessVariables(processData.getProcessVariables()); MultipleInstanceSubprocessTaskExecutionSet executionSet = definition.getExecutionSet(); p.setIsSequential(executionSet.getMultipleInstanceExecutionMode().isSequential()); p.setCollectionInput(executionSet.getMultipleInstanceCollectionInput().getValue()); p.setInput(executionSet.getMultipleInstanceDataInput().getValue()); p.setCollectionOutput(executionSet.getMultipleInstanceCollectionOutput().getValue()); p.setOutput(executionSet.getMultipleInstanceDataOutput().getValue()); p.setCompletionCondition(executionSet.getMultipleInstanceCompletionCondition().getValue()); p.setOnEntryAction(executionSet.getOnEntryAction()); p.setOnExitAction(executionSet.getOnExitAction()); p.setAsync(executionSet.getIsAsync().getValue()); p.setSlaDueDate(executionSet.getSlaDueDate()); p.setSimulationSet(definition.getSimulationSet()); p.setAbsoluteBounds(n); return p; }

Target:
protected SubProcessPropertyWriter convertMultipleInstanceSubprocessNode(Node<View<MultipleInstanceSubprocess>, ?> n) { SubProcess process = bpmn2.createSubProcess(); process.setId(n.getUUID()); MultipleInstanceSubProcessPropertyWriter p = propertyWriterFactory.ofMultipleInstanceSubProcess(process); MultipleInstanceSubprocess definition = n.getContent().getDefinition(); BPMNGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); ProcessData processData = definition.getProcessData(); p.setProcessVariables(processData.getProcessVariables()); MultipleInstanceSubprocessTaskExecutionSet executionSet = definition.getExecutionSet(); p.setIsSequential(executionSet.getMultipleInstanceExecutionMode().isSequential()); p.setCollectionInput(executionSet.getMultipleInstanceCollectionInput().getValue()); p.setInput(executionSet.getMultipleInstanceDataInput().getValue()); p.setCollectionOutput(executionSet.getMultipleInstanceCollectionOutput().getValue()); p.setOutput(executionSet.getMultipleInstanceDataOutput().getValue()); p.setCompletionCondition(executionSet.getMultipleInstanceCompletionCondition().getValue()); p.setOnEntryAction(executionSet.getOnEntryAction()); p.setOnExitAction(executionSet.getOnExitAction()); p.setAsync(executionSet.getIsAsync().getValue()); p.setSlaDueDate(executionSet.getSlaDueDate()); p.setSimulationSet(definition.getSimulationSet()); p.setAbsoluteBounds(n); return p; }
Source:
public Set<Assignment> getAssignmentsForPerson(String username, boolean includeInherited) { Set<Assignment> rslt = new HashSet<Assignment>(); IAuthorizationPrincipal authP = this.authorizationService.newPrincipal( username, EntityEnum.PERSON.getClazz()); IPermission[] directPermissions = permissionStore.select(null, authP.getPrincipalString(), null, null, null); for (IPermission permission : directPermissions) { if (authP.hasPermission(permission.getOwner(), permission.getActivity(), permission.getTarget())) { Assignment a = createAssignment(permission, authP, false); if (a != null) { rslt.add(a); } } } if (includeInherited) { IGroupMember member = GroupService.getGroupMember(authP.getKey(), authP.getType()); for (Iterator<IEntityGroup> iter = member.getAncestorGroups().iterator(); iter.hasNext();) { IEntityGroup parent = iter.next(); IAuthorizationPrincipal parentPrincipal = this.authorizationService.newPrincipal(parent); IPermission[] parentPermissions = permissionStore.select(null, parentPrincipal.getPrincipalString(), null, null, null); for (IPermission permission : parentPermissions) { if (authP.hasPermission(permission.getOwner(), permission.getActivity(), permission.getTarget())) { Assignment a = createAssignment(permission, authP, true); if (a != null) { rslt.add(a); } } } } } return rslt; }

Target:
public Set<Assignment> getAssignmentsForPerson(String username, boolean includeInherited) { Set<Assignment> rslt = new HashSet<Assignment>(); IAuthorizationPrincipal authP = this.authorizationService.newPrincipal( username, EntityEnum.PERSON.getClazz()); IPermission[] directPermissions = permissionStore.select(null, authP.getPrincipalString(), null, null, null); for (IPermission permission : directPermissions) { if (authP.hasPermission(permission.getOwner(), permission.getActivity(), permission.getTarget())) { Assignment a = createAssignment(permission, authP, false); if (a != null) { rslt.add(a); } } } if (includeInherited) { IGroupMember member = GroupService.getGroupMember(authP.getKey(), authP.getType()); for (IEntityGroup parent : member.getAncestorGroups()) { IAuthorizationPrincipal parentPrincipal = this.authorizationService.newPrincipal(parent); IPermission[] parentPermissions = permissionStore.select(null, parentPrincipal.getPrincipalString(), null, null, null); for (IPermission permission : parentPermissions) { if (authP.hasPermission(permission.getOwner(), permission.getActivity(), permission.getTarget())) { Assignment a = createAssignment(permission, authP, true); if (a != null) { rslt.add(a); } } } } } return rslt; }
Source:
public int read(WritableByteChannel channel) throws IOException { int bytesWritten = -1; if (!channelOpen.get()) { throw new ClosedChannelException(); } else { try { bufferReadLock.lock(); if (buffer.hasRemaining()) { bytesWritten = channel.write(buffer); } } finally { bufferReadLock.unlock(); } } return bytesWritten; }

Target:
public int read(WritableByteChannel channel) throws IOException { int bytesWritten = -1; if (!channelOpen.get()) { throw new ClosedChannelException(); } else { bufferReadLock.lock(); try { if (buffer.hasRemaining()) { bytesWritten = channel.write(buffer); } } finally { bufferReadLock.unlock(); } } return bytesWritten; }
Source:
public void logout_sameSyncUserMultipleSessions() { SyncUser user = UserFactory.createUniqueUser(Constants.AUTH_URL); SyncConfiguration syncConfiguration1 = configFactory .createSyncConfigurationBuilder(user, Constants.SYNC_SERVER_URL) .build(); Realm realm1 = Realm.getInstance(syncConfiguration1); SyncConfiguration syncConfiguration2 = configFactory .createSyncConfigurationBuilder(user, Constants.SYNC_SERVER_URL_2) .build(); Realm realm2 = Realm.getInstance(syncConfiguration2); SyncSession session1 = SyncManager.getSession(syncConfiguration1); SyncSession session2 = SyncManager.getSession(syncConfiguration2); SystemClock.sleep(TimeUnit.SECONDS.toMillis(2)); assertNotEquals(session1, session2); assertEquals(SyncSession.State.ACTIVE, session1.getState()); assertEquals(SyncSession.State.ACTIVE, session2.getState()); assertEquals(session1.getUser(), session2.getUser()); try { user.logout(); fail("Should not be able to logout with two open Realm instances"); } catch (IllegalStateException e) { Assert.assertThat(e.getMessage(), CoreMatchers.containsString("A Realm controlled by this user is still open. Close all Realms before logging out")); } realm1.close(); try { user.logout(); fail("Should not be able to logout with one open Realm instance"); } catch (IllegalStateException e) { Assert.assertThat(e.getMessage(), CoreMatchers.containsString("A Realm controlled by this user is still open. Close all Realms before logging out")); } realm2.close(); user.logout(); }

Target:
public void logout_sameSyncUserMultipleSessions() { String uniqueName = UUID.randomUUID().toString(); SyncCredentials credentials = SyncCredentials.usernamePassword(uniqueName, "password", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); SyncConfiguration syncConfiguration1 = configFactory .createSyncConfigurationBuilder(user, Constants.SYNC_SERVER_URL) .build(); Realm realm1 = Realm.getInstance(syncConfiguration1); SyncConfiguration syncConfiguration2 = configFactory .createSyncConfigurationBuilder(user, Constants.SYNC_SERVER_URL_2) .build(); Realm realm2 = Realm.getInstance(syncConfiguration2); SyncSession session1 = SyncManager.getSession(syncConfiguration1); SyncSession session2 = SyncManager.getSession(syncConfiguration2); while(session1.getState() != SyncSession.State.ACTIVE || session2.getState() != SyncSession.State.ACTIVE) { SystemClock.sleep(200); } assertEquals(SyncSession.State.ACTIVE, session1.getState()); assertEquals(SyncSession.State.ACTIVE, session2.getState()); assertNotEquals(session1, session2); assertEquals(session1.getUser(), session2.getUser()); user.logout(); assertEquals(SyncSession.State.INACTIVE, session1.getState()); assertEquals(SyncSession.State.INACTIVE, session2.getState()); credentials = SyncCredentials.usernamePassword(uniqueName, "password", false); SyncUser.login(credentials, Constants.AUTH_URL); assertEquals(SyncSession.State.WAITING_FOR_ACCESS_TOKEN, session1.getState()); assertEquals(SyncSession.State.WAITING_FOR_ACCESS_TOKEN, session2.getState()); realm1.close(); realm2.close(); }
Source:
private void removeDetachedServers(List<VDS> existingServers, Set<GlusterServerInfo> fetchedServers) { for (VDS server : existingServers) { if (isRemovableStatus(server.getstatus()) && serverDetached(server, fetchedServers)) { RemoveVdsStatisticsFromDb(server); RemoveVdsDynamicFromDb(server); RemoveVdsStaticFromDb(server); ResourceManager.getInstance().RemoveVds(server.getId()); log.debugFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getvds_name()); logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); } } }

Target:
private void removeDetachedServers(List<VDS> existingServers, Set<GlusterServerInfo> fetchedServers) { for (VDS server : existingServers) { if (isRemovableStatus(server.getstatus()) && serverDetached(server, fetchedServers)) { RemoveVdsStatisticsFromDb(server); RemoveVdsDynamicFromDb(server); RemoveVdsStaticFromDb(server); runVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(server.getId())); log.debugFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getvds_name()); logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); } } }
Source:
public void run() { final Timer.Context timerCtx = rollupLocatorExecuteTimer.time(); try { getGranularity().finer(); } catch (Exception ex) { log.error("No finer granularity available than " + getGranularity()); return; } if (log.isTraceEnabled()) log.trace("Getting locators for @ {}", new Object[]{parentSlotKey, parentRange.toString(), scheduleCtx.getCurrentTimeMillis()}); long waitStart = System.currentTimeMillis(); int rollCount = 0; final RollupExecutionContext executionContext = createRollupExecutionContext(); final RollupBatchWriter rollupBatchWriter = createRollupBatchWriter(executionContext); Set<Locator> locators = getLocators(executionContext); boolean isSlotBeingRerolled = scheduleCtx.isReroll(parentSlotKey); for (Locator locator : locators) { if (IS_REROLL_ONLY_DELAYED_METRICS && isSlotBeingRerolled) { UpdateStamp updateStamp = scheduleCtx.getShardStateManager().getUpdateStamp(parentSlotKey); if (locator.getLastUpdatedTimestamp() > updateStamp.getLastRollupTimestamp()) { rollCount = processLocator(rollCount, executionContext, rollupBatchWriter, locator, true); } } else { rollCount = processLocator(rollCount, executionContext, rollupBatchWriter, locator, isSlotBeingRerolled); Instrumentation.markLocatorRolled(); } } log.debug("For slotKey {}, number of locator's that were rolled up are {}", parentSlotKey, rollCount); drainExecutionContext(waitStart, rollCount, executionContext, rollupBatchWriter); timerCtx.stop(); }

Target:
public void run() { final Timer.Context timerCtx = rollupLocatorExecuteTimer.time(); try { getGranularity().finer(); } catch (Exception ex) { log.error("No finer granularity available than " + getGranularity()); return; } if (log.isTraceEnabled()) log.trace("Getting locators for @ {}", new Object[]{parentSlotKey, parentRange.toString(), scheduleCtx.getCurrentTimeMillis()}); long waitStart = System.currentTimeMillis(); int rollCount = 0; final RollupExecutionContext executionContext = createRollupExecutionContext(); final RollupBatchWriter rollupBatchWriter = createRollupBatchWriter(executionContext); Set<Locator> locators = getLocators(executionContext); boolean isSlotBeingRerolled = scheduleCtx.isReroll(parentSlotKey); for (Locator locator : locators) { if (IS_REROLL_ONLY_DELAYED_METRICS && isSlotBeingRerolled) { UpdateStamp updateStamp = scheduleCtx.getShardStateManager().getUpdateStamp(parentSlotKey); if (locator.getLastUpdatedTimestamp() > updateStamp.getLastRollupTimestamp()) { rollCount = processLocator(rollCount, executionContext, rollupBatchWriter, locator, true); } } else { rollCount = processLocator(rollCount, executionContext, rollupBatchWriter, locator, isSlotBeingRerolled); } } log.debug("For slotKey [isReroll={}], number of locator's that were rolled up are out of {}", new Object[]{parentSlotKey, isSlotBeingRerolled, rollCount, locators.size()}); drainExecutionContext(waitStart, rollCount, executionContext, rollupBatchWriter); timerCtx.stop(); }
Source:
public List<QuotaBalanceVO> findQuotaBalance(final Long accountId, final Long domainId, final Date startDate, final Date endDate) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); List<QuotaBalanceVO> quotaUsageRecords = null; try (TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB)) { SearchCriteria<QuotaBalanceVO> sc = createSearchCriteria(); if (accountId != null) { sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); } if (domainId != null) { sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); } if ((startDate != null) && (endDate != null) && startDate.before(endDate)) { sc.addAnd("updatedOn", SearchCriteria.Op.BETWEEN, startDate, endDate); } else { return new ArrayList<QuotaBalanceVO>(); } quotaUsageRecords = listBy(sc); if (quotaUsageRecords.size() == 0) { quotaUsageRecords.addAll(lastQuotaBalanceVO(accountId, domainId, startDate)); } } catch (Exception e) { throw new CloudRuntimeException("Unable to find quota balance"); } finally { TransactionLegacy.open(opendb).close(); } return quotaUsageRecords; }

Target:
public List<QuotaBalanceVO> findQuotaBalance(final Long accountId, final Long domainId, final Date startDate, final Date endDate) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaBalanceVO>>() { @Override public List<QuotaBalanceVO> doInTransaction(final TransactionStatus status) { List<QuotaBalanceVO> quotaUsageRecords = null; QueryBuilder<QuotaBalanceVO> qb = QueryBuilder.create(QuotaBalanceVO.class); if (accountId != null) { qb.and(qb.entity().getAccountId(), SearchCriteria.Op.EQ, accountId); } if (domainId != null) { qb.and(qb.entity().getDomainId(), SearchCriteria.Op.EQ, domainId); } if ((startDate != null) && (endDate != null) && startDate.before(endDate)) { qb.and(qb.entity().getUpdatedOn(), SearchCriteria.Op.BETWEEN, startDate, endDate); } else { return Collections.<QuotaBalanceVO> emptyList(); } quotaUsageRecords = listBy(qb.create()); if (quotaUsageRecords.size() == 0) { quotaUsageRecords.addAll(lastQuotaBalanceVO(accountId, domainId, startDate)); } return quotaUsageRecords; } }); }
Source:
public boolean equals(Object other) { if (other instanceof BeatRange) { BeatRange other2 = (BeatRange) other; if (this.start == other2.start && this.length == other2.length) { return true; } } return false; }

Target:
public boolean equals(Object other) { if (other instanceof BeatRange) { if (this.start == ((BeatRange) other).start && this.length == ((BeatRange) other).length) { return true; } } return false; }
Source:
public static @Nullable ITmfStateSystem getStateSystem(ITmfTrace trace, String moduleId) { TmfStateSystemAnalysisModule module = trace.getAnalysisModuleOfClass(TmfStateSystemAnalysisModule.class, moduleId); if (module != null) { module.schedule(); module.waitForInitialization(); return module.getStateSystem(); } return null; }

Target:
public static @Nullable ITmfStateSystem getStateSystem(ITmfTrace trace, String moduleId) { TmfStateSystemAnalysisModule module = trace.getAnalysisModuleOfClass(TmfStateSystemAnalysisModule.class, moduleId); if (module != null) { IStatus status = module.schedule(); if (status.isOK()) { module.waitForInitialization(); return module.getStateSystem(); } } return null; }
Source:
private boolean isOfType(String contentType, String expectedContentType, String expectedWithDelim) { return contentType != null && (contentType.length() > expectedContentType.length() ? contentType.startsWith(expectedWithDelim) : contentType.equals(expectedContentType)); }

Target:
private boolean isOfType(String contentType, String expectedContentType, String expectedWithDelim) { return contentType != null && (contentType.equals(expectedContentType) || contentType.startsWith(expectedWithDelim)); }
Source:
private void tryMirror(){ if ((urlIndex+1) < urls.size()){ urlIndex++; LoadWebViewUrl(urls.get(urlIndex)); } else { urlIndex = 0; LoadWebViewUrl(urls.get(urlIndex)); } }

Target:
private void tryMirror(){ if (urls.size() == 0) return; if ((urlIndex+1) < urls.size()){ urlIndex++; LoadWebViewUrl(urls.get(urlIndex)); } else { urlIndex = 0; LoadWebViewUrl(urls.get(urlIndex)); } }
Source:
public void search() { eventsList = service.search(selectedService, selectedException, fromDate, toDate); msgEventResult = CollectionUtils.isNotEmpty(eventsList) ? "Event record(s) found." : "No event record found."; }

Target:
public void search() { selectedEvent = null; eventsList = service.search(selectedService, selectedException, fromDate, toDate); msgEventResult = MessageFormat.format("{0} event record found.", getEvents().size()); }
Source:
public boolean providePlayerCube(boolean canGenerate) { int cubeX = getX(cubeAddress); int cubeY = getY(cubeAddress); int cubeZ = getZ(cubeAddress); playerCubeMap.getWorld().getProfiler().startSection("getCube"); if(cube != null){ this.cube.getTickets().remove(this); } if (canGenerate) { this.cube = this.cubeCache.getCube(cubeX, cubeY, cubeZ, IProviderExtras.Requirement.LIGHT); } else { this.cube = this.cubeCache.getCube(cubeX, cubeY, cubeZ, IProviderExtras.Requirement.LOAD); } if(this.cube != null){ this.cube.getTickets().add(this); } playerCubeMap.getWorld().getProfiler().endSection(); return this.cube != null; }

Target:
public boolean providePlayerCube(boolean canGenerate) { int cubeX = getX(cubeAddress); int cubeY = getY(cubeAddress); int cubeZ = getZ(cubeAddress); playerCubeMap.getWorld().getProfiler().startSection("getCube"); if (canGenerate) { this.cube = this.cubeCache.getCube(cubeX, cubeY, cubeZ, IProviderExtras.Requirement.LIGHT); } else { this.cube = this.cubeCache.getCube(cubeX, cubeY, cubeZ, IProviderExtras.Requirement.LOAD); } if(this.cube != null){ this.cube.getTickets().add(this); } playerCubeMap.getWorld().getProfiler().endSection(); return this.cube != null; }
Source:
public boolean isAudio() { return ((mMimeType != null && mMimeType.startsWith("audio/")) || getMimeTypeFromName().startsWith("audio/")); }

Target:
public boolean isAudio() { return isOfType("audio/"); }
Source:
public void noNavigatorNoFactoryInstalled() throws Exception { assertThat(ExtensionList.lookup(SCMNavigatorDescriptor.class), contains(instanceOf(SingleSCMNavigator.DescriptorImpl.class))); assertEquals(0, ExtensionList.lookup(MultiBranchProjectFactoryDescriptor.class).size()); assertThat(newItemTypes(), containsInAnyOrder()); }

Target:
public void noNavigatorNoFactoryInstalled() throws Exception { assumeThat(ExtensionList.lookup(SCMNavigatorDescriptor.class), hasSize(1)); assumeThat(ExtensionList.lookup(SCMNavigatorDescriptor.class).get(0).getClass(), is(SingleSCMNavigator.DescriptorImpl.class)); assumeThat(ExtensionList.lookup(MultiBranchProjectFactoryDescriptor.class), is(empty())); assertThat(newItemTypes(), containsInAnyOrder()); }
Source:
public String getOptionValue(final String optionName) { return (String)this.cmd.getOptionValue(optionName); }

Target:
public String getOptionValue(final String optionName) { final Object val = this.cmd.getOptionValue(optionName); if (val == null) { return null; } return val.toString(); }
Source:
private Function<Throwable, Throwable> getThrowableFunction(CoreEvent event) { return throwable -> { CoreEvent exceptionEvent = event; Throwable retryPolicyExhaustionCause = getMessagingExceptionCause(throwable); retryPolicyExhaustionCause = suppressIfPresent(retryPolicyExhaustionCause, ConnectionException.class, false); if (throwable instanceof MessagingException) { exceptionEvent = ((MessagingException) throwable).getEvent(); } return new MessagingException(exceptionEvent, new RetryPolicyExhaustedException(createStaticMessage(UNTIL_SUCCESSFUL_MSG_PREFIX, retryPolicyExhaustionCause .getMessage()), retryPolicyExhaustionCause, owner), owner); }; }

Target:
private Function<Throwable, Throwable> getThrowableFunction(CoreEvent event) { return throwable -> { CoreEvent exceptionEvent = event; Throwable retryPolicyExhaustionCause = suppressIfPresent(throwable, MuleException.class); RetryPolicyExhaustedException retryPolicyExhaustedException = new RetryPolicyExhaustedException(createStaticMessage(UNTIL_SUCCESSFUL_MSG), retryPolicyExhaustionCause, owner); retryPolicyExhaustedException.addInfo(MuleExceptionInfo.INFO_CAUSED_BY_KEY, retryPolicyExhaustionCause); if (throwable instanceof MessagingException) { exceptionEvent = ((MessagingException) throwable).getEvent(); } return new MessagingException(exceptionEvent, retryPolicyExhaustedException, owner); }; }
Source:
public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable { persistenceManager.clearAllStores(SHARED); return null; }

Target:
public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable { throw new UnsupportedOperationException("Clear command not supported inside a transaction"); }
Source:
protected boolean readElement(IConfigurationElement element, boolean add) { String tagName = element.getName(); if (tagName.equals(TAG_PROFILE) || tagName.equals(TAG_PACKAGE)) { String uri = element.getAttribute(ATT_URI); if (uri == null) { logMissingAttribute(element, ATT_URI); } else if (add) { String location = element.getAttribute(ATT_LOCATION); if (location != null) { URI profileLocation = URI.createURI(location); if (profileLocation.isRelative()) { profileLocation = URI.createPlatformPluginURI( element.getDeclaringExtension() .getContributor().getName() + '/' + location, false); } if (ePackageNsURIToPackageLocationMap != null){ ePackageNsURIToPackageLocationMap.put(uri, profileLocation); } if (tagName.equals(TAG_PROFILE)) { ePackageNsURIToProfileLocationMap.put(uri, profileLocation); } } return true; } else { if (ePackageNsURIToPackageLocationMap != null) { ePackageNsURIToPackageLocationMap.remove(uri); } if (tagName.equals(TAG_PROFILE)) { ePackageNsURIToProfileLocationMap.remove(uri); } return true; } } return false; }

Target:
protected boolean readElement(IConfigurationElement element, boolean add) { String tagName = element.getName(); if (tagName.equals(TAG_PROFILE) || tagName.equals(TAG_PACKAGE)) { Map<String, URI> uriToLocationMap = tagName.equals(TAG_PROFILE) ? ePackageNsURIToProfileLocationMap : ePackageNsURIToPackageLocationMap; String uri = element.getAttribute(ATT_URI); if (uri == null) { logMissingAttribute(element, ATT_URI); } else if (add) { if (uriToLocationMap != null) { String location = element.getAttribute(ATT_LOCATION); if (location != null) { URI profileLocation = URI.createURI(location); if (profileLocation.isRelative()) { profileLocation = URI.createPlatformPluginURI( element.getDeclaringExtension() .getContributor().getName() + '/' + location, false); } uriToLocationMap.put(uri, profileLocation); } } return true; } else { uriToLocationMap.remove(uri); return true; } } return false; }
Source:
private String acquireVF() { try { hostDeviceManager.acquireHostDevicesLock(getVdsId()); String vfToUse = findFreeVf(); networkDeviceHelper.setVmIdOnVfs(getVdsId(), getVmId(), Collections.singleton(vfToUse)); return vfToUse; } finally { hostDeviceManager.releaseHostDevicesLock(getVdsId()); } }

Target:
private String acquireVF() { try { hostDeviceManager.acquireHostDevicesLock(getVdsId()); return findFreeVf(); } finally { hostDeviceManager.releaseHostDevicesLock(getVdsId()); } }
Source:
public ConstraintWeightDescriptor(ConstraintConfigurationDescriptor<Solution_> constraintConfigurationDescriptor, MemberAccessor memberAccessor) { this.constraintConfigurationDescriptor = constraintConfigurationDescriptor; ConstraintWeight constraintWeightAnnotation = memberAccessor.getAnnotation(ConstraintWeight.class); String constraintPackage = constraintPackage = constraintWeightAnnotation.constraintPackage(); if (constraintPackage.isEmpty()) { ConstraintConfiguration packAnnotation = memberAccessor.getDeclaringClass().getAnnotation(ConstraintConfiguration.class); if (packAnnotation == null) { throw new IllegalStateException("Impossible state: " + ConstraintConfigurationDescriptor.class.getSimpleName() + " only reflects over members with a " + ConstraintConfiguration.class.getSimpleName() + " annotation."); } constraintPackage = packAnnotation.constraintPackage(); if (constraintPackage.isEmpty()) { constraintPackage = memberAccessor.getDeclaringClass().getPackage().getName(); } } this.constraintPackage = constraintPackage; this.constraintName = constraintWeightAnnotation.value(); this.memberAccessor = memberAccessor; }

Target:
public ConstraintWeightDescriptor(ConstraintConfigurationDescriptor<Solution_> constraintConfigurationDescriptor, MemberAccessor memberAccessor) { this.constraintConfigurationDescriptor = constraintConfigurationDescriptor; ConstraintWeight constraintWeightAnnotation = memberAccessor.getAnnotation(ConstraintWeight.class); String constraintPackage = constraintWeightAnnotation.constraintPackage(); if (constraintPackage.isEmpty()) { ConstraintConfiguration constraintConfigurationAnnotation = memberAccessor.getDeclaringClass() .getAnnotation(ConstraintConfiguration.class); if (constraintConfigurationAnnotation == null) { throw new IllegalStateException("Impossible state: " + ConstraintConfigurationDescriptor.class.getSimpleName() + " only reflects over members with a " + ConstraintConfiguration.class.getSimpleName() + " annotation."); } constraintPackage = constraintConfigurationAnnotation.constraintPackage(); if (constraintPackage.isEmpty()) { constraintPackage = memberAccessor.getDeclaringClass().getPackage().getName(); } } this.constraintPackage = constraintPackage; this.constraintName = constraintWeightAnnotation.value(); this.memberAccessor = memberAccessor; }
Source:
public static ResourceSet loadResourceWithProxies(URI resourceURI, final ResourceSet resourceSet) { try { if (addResourceToSet(resourceSet, resourceURI)) { return resourceSet; } } catch (final IOException ex) { Activator.getDefault().getReportService().report( new StatusReport(new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex))); } return null; }

Target:
public static ResourceSet loadResourceWithProxies(URI resourceURI, final ResourceSet resourceSet) { try { if (addResourceToSet(resourceSet, resourceURI, null)) { return resourceSet; } } catch (final IOException ex) { Activator.getDefault().getReportService().report( new StatusReport(new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex))); } return null; }
Source:
protected boolean isDuplicateEntry(String token, Usage usageRecord) { try { ClientResponse response = client.getEntry(token, usageRecord.getUuid()); if (response.getStatus() == 200) { return true; } } catch (Exception e) { LOG.warn(String.format("Could not verify duplicate entry for UUID: %s, attempt to re-push the record...", usageRecord.getUuid())); return false; } return false; }

Target:
protected boolean isDuplicateEntry(String token, Usage usageRecord) { try { ClientResponse response = client.getEntry(token, usageRecord.getUuid()); if (response.getStatus() == 200) { return true; } } catch (Exception e) { LOG.warn(String.format("Could not verify duplicate entry for UUID: %s, attempt to re-push the record...", usageRecord.getUuid())); } return false; }
Source:
protected static VariantContext liftSimpleVariant(final VariantContext source, final Interval target){ if (target == null) return null; if (source.getReference().length() != target.length()) { return null; } final List<Allele> alleles = new ArrayList<>(); for (final Allele oldAllele : source.getAlleles()) { if (target.isPositiveStrand() || oldAllele.isSymbolic()) { alleles.add(oldAllele); } else { final Allele fixedAllele = Allele.create(SequenceUtil.reverseComplement(oldAllele.getBaseString()), oldAllele.isReference()); alleles.add(fixedAllele); } } final VariantContextBuilder builder = new VariantContextBuilder( source.getSource(), target.getContig(), target.getStart(), target.getEnd(), alleles); builder.id(source.getID()); return builder.make(); }

Target:
protected static VariantContext liftSimpleVariant(final VariantContext source, final Interval target) { if (target == null) { return null; } if (source.getReference().length() != target.length()) { return null; } final List<Allele> alleles = new ArrayList<>(); for (final Allele oldAllele : source.getAlleles()) { if (target.isPositiveStrand() || oldAllele.isSymbolic()) { alleles.add(oldAllele); } else { final Allele fixedAllele = Allele.create(SequenceUtil.reverseComplement(oldAllele.getBaseString()), oldAllele.isReference()); alleles.add(fixedAllele); } } final VariantContextBuilder builder = new VariantContextBuilder( source.getSource(), target.getContig(), target.getStart(), target.getEnd(), alleles); builder.id(source.getID()); return builder.make(); }
Source:
public FacultyMemberProfile commitValue() { FacultyMemberProfile facultyMemberEditor = getAttachedFacultyMemberProfile(); facultyMemberEditor.setFirstName(_firstName.getText()); facultyMemberEditor.setLastName(_lastName.getText()); facultyMemberEditor.setRank((Rank) _rank.getSelectedObject()); facultyMemberEditor.setResearchArea(_resArea.getText()); facultyMemberEditor.setPicture(_img); facultyMemberEditor.setJoinDate(_joinDate.getDate()); if(_sabbatical.getSelectedIndex()==1) facultyMemberEditor.setSabbatical(true); else { facultyMemberEditor.setSabbatical(false); } facultyMemberEditor.setSlug(_firstName.getText()+" "+_lastName.getText()); facultyMemberEditor.setDeleted(false); _facultyMemberDao.saveFacultyMemberProfile(facultyMemberEditor); return facultyMemberEditor; }

Target:
public FacultyMemberProfile commitValue() { FacultyMemberProfile facultyMemberEditor = _facultyMemberDao.getAttachedFacultyMemberProfile(_facultyMemberProfile); facultyMemberEditor.setFirstName(_firstName.getText()); facultyMemberEditor.setLastName(_lastName.getText()); facultyMemberEditor.setRank((Rank) _rank.getSelectedObject()); facultyMemberEditor.setResearchArea(_resArea.getText()); facultyMemberEditor.setPicture(_img); facultyMemberEditor.setJoinDate(_joinDate.getDate()); if(_sabbatical.getSelectedIndex()==1) facultyMemberEditor.setSabbatical(_sabbatical.getSelectedIndex()==1); else { facultyMemberEditor.setSabbatical(_sabbatical.getSelectedIndex()==2); } facultyMemberEditor.setSlug(getLastName(_lastName.getText()).toLowerCase()+_firstName.getText()); facultyMemberEditor.setDeleted(false); _facultyMemberDao.saveFacultyMemberProfile(facultyMemberEditor); close(); return facultyMemberEditor; }