auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void createIndexWhileClear() throws Exception { IntStream.range(0, 100).forEach(i -> cities.put(i, new City(i))); AsyncInvocation createIndex = server1.invokeAsync("create index", () -> { Cache cache = ClusterStartupRule.getCache(); QueryService queryService = cache.getQueryService(); Index cityZip = queryService.createIndex("cityZip", "c.zip", "/cities c"); assertThat(cityZip).isNotNull(); }); cities.clear(); createIndex.await(); invokeInEveryMember(() -> { verifyIndexesAfterClear(); }, server1, server2); QueryService queryService = clientCache.getQueryService(); Query query = queryService.newQuery("select * from /cities c where c.zip < " + (City.ZIP_START + 10)); assertThat(((SelectResults) query.execute()).size()).isEqualTo(0); IntStream.range(0, 10).forEach(i -> cities.put(i, new City(i))); assertThat(((SelectResults) query.execute()).size()).isEqualTo(10); }

Target:
public void createIndexWhileClear() throws Exception { IntStream.range(0, 1000).forEach(i -> cities.put(i, new City(i))); AsyncInvocation createIndex = server1.invokeAsync("create index", () -> { Cache cache = ClusterStartupRule.getCache(); QueryService queryService = cache.getQueryService(); Index cityZip = queryService.createIndex("cityZip", "c.zip", "/cities c"); assertThat(cityZip).isNotNull(); }); for (int i = 0; i < 3; i++) { cities.clear(); } createIndex.await(); invokeInEveryMember(() -> { verifyIndexesAfterClear("cities", "cityId", "cityName"); }, server1, server2); QueryService queryService = clientCache.getQueryService(); Query query = queryService.newQuery("select * from /cities c where c.zip < " + (City.ZIP_START + 10)); assertThat(((SelectResults) query.execute()).size()).isEqualTo(0); IntStream.range(0, 10).forEach(i -> cities.put(i, new City(i))); assertThat(((SelectResults) query.execute()).size()).isEqualTo(10); }
Source:
public String toString() { String node = formIndex == null || formIndex.getReference() == null ? "" : formIndex.getReference().toString(); int idx = node.lastIndexOf('['); if (idx > 0) { node = node.substring(0, idx); } if (oldValue.equals(newValue)) { oldValue = ""; newValue = ""; } String event; if (hasLocation() && isTrackingChangesEnabled) { event = String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : "", latitude, longitude, accuracy, oldValue, newValue); } else if (hasLocation()) { event = String.format("%s,%s,%s,%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : "", latitude, longitude, accuracy); } else if (isTrackingChangesEnabled) { event = String.format("%s,%s,%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : "", oldValue, newValue); } else { event = String.format("%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : ""); } return event; }

Target:
public String toString() { String node = formIndex == null || formIndex.getReference() == null ? "" : formIndex.getReference().toString(); if (auditEventType == AuditEvent.AuditEventType.QUESTION || auditEventType == AuditEvent.AuditEventType.GROUP) { int idx = node.lastIndexOf('['); if (idx > 0) { node = node.substring(0, idx); } } String event; if (hasLocation() && isTrackingChangesEnabled) { event = String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : "", latitude, longitude, accuracy, oldValue, newValue); } else if (hasLocation()) { event = String.format("%s,%s,%s,%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : "", latitude, longitude, accuracy); } else if (isTrackingChangesEnabled) { event = String.format("%s,%s,%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : "", oldValue, newValue); } else { event = String.format("%s,%s,%s,%s", auditEventType.getValue(), node, start, end != 0 ? end : ""); } return event; }
Source:
public void before() { BridgeUtils.setRequestContext(new RequestContext.Builder() .withCallerStudyId(TestConstants.TEST_STUDY).build()); study = new DynamoStudy(); study.setIdentifier(TestConstants.TEST_STUDY_IDENTIFIER); extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); extId.setSubstudyId(SUBSTUDY_ID); externalIdService = new ExternalIdService(); externalIdService.setExternalIdDao(externalIdDao); externalIdService.setSubstudyService(substudyService); }

Target:
public void before() { BridgeUtils.setRequestContext(new RequestContext.Builder() .withCallerStudyId(TestConstants.TEST_STUDY).build()); study = Study.create(); study.setIdentifier(TestConstants.TEST_STUDY_IDENTIFIER); extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); extId.setSubstudyId(SUBSTUDY_ID); externalIdService = new ExternalIdService(); externalIdService.setExternalIdDao(externalIdDao); externalIdService.setSubstudyService(substudyService); }
Source:
protected void migrateSessionPropertyToSecured(CoreSession session, MigrationContext migrationContext) { List<String> comments = getUnsecuredCommentIds(session); CommentManager commentManager = Framework.getService(CommentManager.class); processBatched(migrationContext, BATCH_SIZE, comments, comment -> migrateCommentsFromPropertyToSecured(session, commentManager, new IdRef(comment)), "Migrating comments from Property to Secured"); int totalOfComments = comments.size(); int nbeOfUnMigratedComments = getUnsecuredCommentIds(session).size(); if (nbeOfUnMigratedComments == 0) { session.query(GET_COMMENTS_FOLDERS_QUERY).forEach((folder -> session.removeDocument(folder.getRef()))); IdRef[] documentsToRemove = session.queryProjection(GET_COMMENTS_FOLDERS_QUERY, 0, 0) .stream() .map(m -> new IdRef((String) m.get(ECM_UUID))) .toArray(IdRef[]::new); session.removeDocuments(documentsToRemove); reportProgress("Done Migration from Property to Secured", totalOfComments, totalOfComments); } else { log.warn( "Some comments have not been migrated, see logs for more information. The folder containing these comments will be renamed to {}", UNMIGRATED_COMMENTS_FOLDER_NAME); session.query(GET_COMMENTS_FOLDERS_QUERY).forEach(docModel -> { session.move(docModel.getRef(), null, UNMIGRATED_COMMENTS_FOLDER_NAME); docModel.putContextData(DISABLE_NOTIFICATION_SERVICE, TRUE); session.saveDocument(docModel); }); session.save(); reportProgress("Done Migration from Property to Secured", totalOfComments - nbeOfUnMigratedComments, totalOfComments); } }

Target:
protected void migrateSessionPropertyToSecured(CoreSession session, MigrationContext migrationContext) { List<String> comments = getUnsecuredCommentIds(session); CommentManager commentManager = Framework.getService(CommentManager.class); processBatched(migrationContext, BATCH_SIZE, comments, comment -> migrateCommentsFromPropertyToSecured(session, commentManager, new IdRef(comment)), "Migrating comments from Property to Secured"); int totalOfComments = comments.size(); int nbeOfUnMigratedComments = getUnsecuredCommentIds(session).size(); if (nbeOfUnMigratedComments == 0) { session.query(GET_COMMENTS_FOLDERS_QUERY).forEach((folder -> session.removeDocument(folder.getRef()))); IdRef[] documentsToRemove = session.queryProjection(GET_COMMENTS_FOLDERS_QUERY, 0, 0) .stream() .map(m -> new IdRef((String) m.get(ECM_UUID))) .toArray(IdRef[]::new); session.removeDocuments(documentsToRemove); reportProgress("Done Migrating from Property to Secured", totalOfComments, totalOfComments); } else { log.warn( "Some comments have not been migrated, see logs for more information. The folder containing these comments will be renamed to {}", UNMIGRATED_COMMENTS_FOLDER_NAME); session.query(GET_COMMENTS_FOLDERS_QUERY).forEach(docModel -> { session.move(docModel.getRef(), null, UNMIGRATED_COMMENTS_FOLDER_NAME); docModel.putContextData(DISABLE_NOTIFICATION_SERVICE, TRUE); session.saveDocument(docModel); }); session.save(); reportProgress("Done Migrating from Property to Secured", totalOfComments - nbeOfUnMigratedComments, totalOfComments); } }
Source:
public List<AntiCsrfToken> getTokens(String reqBody, String targetUrl) { List<AntiCsrfToken> tokens = new ArrayList<>(); Set<String> values; synchronized (valueToToken) { values = Collections.unmodifiableSet(new HashSet<String>(valueToToken.keySet())); } for (String value : values) { if (reqBody.indexOf(value) >= 0) { AntiCsrfToken token = valueToToken.get(value).clone(); token.setTargetURL(targetUrl); tokens.add(token); } } return tokens; }

Target:
private List<AntiCsrfToken> getTokens(String reqBody, String targetUrl) { List<AntiCsrfToken> tokens = new ArrayList<>(); Set<String> values; synchronized (valueToToken) { values = Collections.unmodifiableSet(new HashSet<String>(valueToToken.keySet())); } for (String value : values) { if (reqBody.indexOf(value) >= 0) { AntiCsrfToken token = valueToToken.get(value).clone(); token.setTargetURL(targetUrl); tokens.add(token); } } return tokens; }
Source:
private void copyTransientAttributes(Metacard updateMetacard, Metacard existingMetacard) { for (String transientAttributeKey : RegistryObjectMetacardType.TRANSIENT_ATTRIBUTES) { Attribute transientAttribute = updateMetacard.getAttribute(transientAttributeKey); if (transientAttribute == null) { transientAttribute = existingMetacard.getAttribute(transientAttributeKey); if (transientAttribute != null) { updateMetacard.setAttribute(transientAttribute); } } } }

Target:
private void copyTransientAttributes(Metacard updateMetacard, Metacard existingMetacard) { RegistryObjectMetacardType.TRANSIENT_ATTRIBUTES .stream() .filter( key -> updateMetacard.getAttribute(key) == null && existingMetacard.getAttribute(key) != null) .forEach(key -> updateMetacard.setAttribute(existingMetacard.getAttribute(key))); }
Source:
public void evaluate() throws Throwable { if (ServerJob.getCurrentSession() != null) { doEvaluateWrappingExceptions(); } else { ServerJob job = m_factory.runNow("JUnit Server Job Runner", new ITransactionRunnable() { @Override public IStatus run(IProgressMonitor monitor) throws ProcessingException { doEvaluateWrappingExceptions(); return Status.OK_STATUS; } }); if (job.getResult() != null && !job.getResult().isOK()) { fail(job.getResult().getMessage()); } } }

Target:
public void evaluate() throws Throwable { if (ServerJob.getCurrentSession() != null) { doEvaluateWrappingExceptions(); } else { ServerJob job = m_factory.create("JUnit Server Job Runner", new ITransactionRunnable() { @Override public IStatus run(IProgressMonitor monitor) throws ProcessingException { doEvaluateWrappingExceptions(); return Status.OK_STATUS; } }); job.setSystem(true); job.runNow(new NullProgressMonitor()); if (job.getResult() != null && !job.getResult().isOK()) { fail(job.getResult().getMessage()); } } }
Source:
protected void assertInvalidFunction(String projection, StandardErrorCode errorCode, String messagePattern) { try { evaluateInvalid(projection); fail("Expected to throw a PrestoException with message matching " + messagePattern); } catch (PrestoException e) { assertEquals(e.getErrorCode(), errorCode.toErrorCode()); assertTrue(e.getMessage().equals(messagePattern) || e.getMessage().matches(messagePattern)); } }

Target:
protected void assertInvalidFunction(String projection, StandardErrorCode errorCode, String messagePattern) { functionAssertions.assertInvalidFunction(projection, errorCode, messagePattern); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } QueueItem other = (QueueItem) obj; if (geocode == null) { if (other.geocode != null) { return false; } } else if (!geocode.equals(other.geocode)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } QueueItem other = (QueueItem) obj; if ((geocode == null) && (other.geocode == null)) { return true; } if (geocode == null) { return false; } if (!geocode.equals(other.geocode)) { return false; } return true; }
Source:
public void getPermissionsObjectWithoutChildrenTest() throws Exception { when(aclFactory.getPrincipalRoles(memberPid)).thenReturn(objPrincRoles); when(aclFactory.isMarkedForDeletion(memberPid)).thenReturn(false); when(aclFactory.getEmbargoUntil(memberPid)).thenReturn(testDate); when(aclFactory.getPatronAccess(memberPid)).thenReturn(PatronAccess.authenticated); when(repoObjLoader.getRepositoryObject(memberPid)).thenReturn(member); result = aclRetrievalService.getPermissions(agent, memberPid); String resultJson = generateJson(result); assertTrue(resultJson.contains("pid\":\"" + memberUuid)); assertTrue(resultJson.contains("markForDeletion\":false")); assertTrue(resultJson.contains("embargoed\":" + testDate.getTime())); assertTrue(resultJson.contains("patronAccess\":\"authenticated")); assertFalse(resultJson.contains("memberPermissions")); }

Target:
public void getPermissionsObjectWithoutChildrenTest() throws Exception { when(repoObjLoader.getRepositoryObject(memberPid)).thenReturn(member); result = aclRetrievalService.getPermissions(agent, memberPid); assertEquals(memberUuid, result.get("pid")); assertEquals(false, result.get("markForDeletion")); assertEquals(testDate, result.get("embargo")); assertEquals(PatronAccess.authenticated, result.get("patronAccess")); assertFalse(result.containsKey("memberPermissions")); }
Source:
private AnnotatedConstructor buildAnnotatedConstructorForMapper(Mapper mapper) { List<AnnotationMapperReference> mapperReferencesForConstructor = new ArrayList<AnnotationMapperReference>(); for ( MapperReference mapperReference : mapper.getReferencedMappers() ) { mapperReferencesForConstructor.add( (AnnotationMapperReference) mapperReference ); } List<Annotation> mapperReferenceAnnotations = getMapperReferenceAnnotations(); removeReferenceAnnotations( mapperReferencesForConstructor, mapperReferenceAnnotations ); return new AnnotatedConstructor( mapper.getName(), mapperReferencesForConstructor, mapperReferenceAnnotations, additionalPublicEmptyConstructor() ); }

Target:
private AnnotatedConstructor buildAnnotatedConstructorForMapper(Mapper mapper) { List<AnnotationMapperReference> mapperReferencesForConstructor = new ArrayList<AnnotationMapperReference>( mapper.getReferencedMappers().size() ); for ( MapperReference mapperReference : mapper.getReferencedMappers() ) { mapperReferencesForConstructor.add( (AnnotationMapperReference) mapperReference ); } List<Annotation> mapperReferenceAnnotations = getMapperReferenceAnnotations(); removeDuplicateAnnotations( mapperReferencesForConstructor, mapperReferenceAnnotations ); return new AnnotatedConstructor( mapper.getName(), mapperReferencesForConstructor, mapperReferenceAnnotations, additionalPublicEmptyConstructor() ); }
Source:
public FieldMetadata getField(String path) { if (path == null || path.isEmpty()) { throw new IllegalArgumentException("Field name can not be null nor empty."); } FieldMetadata foundField; if (path.indexOf('/') < 0) { if (path.indexOf('[') >= 0) { path = path.substring(path.indexOf("[") + 1, path.indexOf("]")); } foundField = fieldMetadata.get(path); if (foundField == null) { for (TypeMetadata superType : superTypes) { foundField = ((ComplexTypeMetadata) superType).getField(path); if (foundField != null) { break; } } } } else { foundField = _getField(this, path); } if (foundField == null) { throw new IllegalArgumentException("Type '" + getName() + "' does not own field '" + path + "'."); } return foundField; }

Target:
public FieldMetadata getField(String path) { if (path == null || path.isEmpty()) { throw new IllegalArgumentException("Field name can not be null nor empty."); } FieldMetadata foundField; if (path.indexOf('/') < 0) { if (path.indexOf('[') >= 0) { path = StringUtils.substringsBetween(path, "[", "]")[0]; } foundField = fieldMetadata.get(path); if (foundField == null) { for (TypeMetadata superType : superTypes) { foundField = ((ComplexTypeMetadata) superType).getField(path); if (foundField != null) { break; } } } } else { foundField = _getField(this, path); } if (foundField == null) { throw new IllegalArgumentException("Type '" + getName() + "' does not own field '" + path + "'."); } return foundField; }
Source:
private void taskComplete( RemoteTaskRunnerWorkItem taskRunnerWorkItem, ZkWorker zkWorker, TaskStatus taskStatus ) { Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkNotNull(taskStatus, "taskStatus"); if (zkWorker != null) { log.info( "Worker[%s] completed task[%s] with status[%s]", zkWorker.getWorker().getHost(), taskStatus.getId(), taskStatus.getStatusCode() ); zkWorker.setLastCompletedTaskTime(new DateTime()); } else { log.info("Workerless task[%s] completed with status[%s]", taskStatus.getId(), taskStatus.getStatusCode()); } completeTasks.put(taskStatus.getId(), taskRunnerWorkItem); runningTasks.remove(taskStatus.getId()); TaskRunnerUtils.notifyStatusChanged(listeners, taskStatus.getId(), taskStatus); taskRunnerWorkItem.setResult(taskStatus); }

Target:
private void taskComplete( RemoteTaskRunnerWorkItem taskRunnerWorkItem, ZkWorker zkWorker, TaskStatus taskStatus ) { Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkNotNull(taskStatus, "taskStatus"); if (zkWorker != null) { log.info( "Worker[%s] completed task[%s] with status[%s]", zkWorker.getWorker().getHost(), taskStatus.getId(), taskStatus.getStatusCode() ); zkWorker.setLastCompletedTaskTime(new DateTime()); } else { log.info("Workerless task[%s] completed with status[%s]", taskStatus.getId(), taskStatus.getStatusCode()); } completeTasks.put(taskStatus.getId(), taskRunnerWorkItem); runningTasks.remove(taskStatus.getId()); taskRunnerWorkItem.setResult(taskStatus); TaskRunnerUtils.notifyStatusChanged(listeners, taskStatus.getId(), taskStatus); }
Source:
public boolean accepts(final RuleExtension rule, final GraphConnectionContext context) { if (context.getTarget().isPresent()) { final Node<? extends View<?>, ? extends Edge> target = context.getTarget().get(); final View<?> content = target.getContent(); if (Objects.isNull(content)) { return false; } final Object definition = content.getDefinition(); return definition.getClass().getName().equals(rule.getId()); } return false; }

Target:
public boolean accepts(final RuleExtension rule, final GraphConnectionContext context) { if (context.getTarget().isPresent()) { final Node<? extends View<?>, ? extends Edge> target = context.getTarget().get(); final View<?> content = target.getContent(); if (Objects.isNull(content)) { return false; } final Object definition = content.getDefinition(); return Objects.equals(definition.getClass().getName(), rule.getId()); } return false; }
Source:
public boolean accept(Issue issue) { if (issueShouldNotBeReported(issue, excludedLinesByRule())) { return false; } return true; }

Target:
public boolean accept(Issue issue) { return !issueShouldNotBeReported(issue, excludedLinesByRule()); }
Source:
public static boolean isSystemBlacklisted(String databaseName, String tableName) { return "mysql".equals(databaseName) && ("ha_health_check".equals(tableName) || "rds_heartbeat2".equals(tableName)); }

Target:
public static boolean isSystemBlacklisted(String databaseName, String tableName) { return "mysql".equals(databaseName) && ("ha_health_check".equals(tableName) || StringUtils.startsWith(tableName, "rds_heartbeat")); }
Source:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int onlineCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : onlineCpus; int offlineCpus = vcpus - onlineCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { int index = 0; for (VmNumaNode vmNode : vmNumaNodes) { index += vmNode.getCpuIds().size(); } if (onlineCpus != index) { offlineCpus = vcpus - index; } if (offlineCpus > 0) { Comparator<VmNumaNode> compareBySize = Comparator.comparingInt((VmNumaNode o) -> o.getCpuIds().size()); Collections.sort(vmNumaNodes, compareBySize); int numaCount = vmNumaNodes.size(); int start = index-1; for (VmNumaNode vmNode : vmNumaNodes) { index = start = start+1; if (numaCount <= 0) { break; } while (index < vcpus) { vmNode.getCpuIds().add(index); index += numaCount; } } } return vmNumaNodes; } if (offlineCpus > 0) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }

Target:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int onlineCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : onlineCpus; int offlineCpus = vcpus - onlineCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { int totalCpusPerNode = 0; for (VmNumaNode vmNode : vmNumaNodes) { totalCpusPerNode += vmNode.getCpuIds().size(); } if (onlineCpus != totalCpusPerNode) { offlineCpus = vcpus - totalCpusPerNode; } if (offlineCpus > 0) { Comparator<VmNumaNode> compareBySize = Comparator.comparingInt(o -> o.getCpuIds().size()); Collections.sort(vmNumaNodes, compareBySize); int numaCount = vmNumaNodes.size(); int start = totalCpusPerNode-1; for (VmNumaNode vmNode : vmNumaNodes) { int index = start = start+1; if (numaCount <= 0) { break; } while (index < vcpus) { vmNode.getCpuIds().add(index); index += numaCount; } } } return vmNumaNodes; } if (offlineCpus > 0) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }
Source:
public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: copyProjects(); try { StorageOperations.deleteDir(EXTERNAL_STORAGE_ROOT_DIRECTORY); } catch (IOException e) { Log.e(TAG, e.getMessage()); } doNotShowDialogAgain(); break; case DialogInterface.BUTTON_NEUTRAL: copyProjects(); doNotShowDialogAgain(); break; } }

Target:
public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: CopyProjectsTask moveProjectsTask = new CopyProjectsTask(activity, true); moveProjectsTask.execute(); doNotShowDialogAgain(); break; case DialogInterface.BUTTON_NEUTRAL: CopyProjectsTask copyProjectsTask = new CopyProjectsTask(activity, false); copyProjectsTask.execute(); doNotShowDialogAgain(); break; } }
Source:
public SecurityComponents createSecurityComponents() { BeanBuilder builder = new BeanBuilder(getClass().getClassLoader()); Binding binding = new Binding(); binding.setVariable("realm", this); InputStream i = getClass().getResourceAsStream("ActiveDirectory.groovy"); try { builder.parse(i, binding); } finally { IOUtils.closeQuietly(i); } WebApplicationContext context = builder.createApplicationContext(); findBean(AbstractActiveDirectoryAuthenticationProvider.class, context); final UserDetailsService uds = findBean(UserDetailsService.class, context); TokenBasedRememberMeServices2 rms = new TokenBasedRememberMeServices2() { public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) { try { return super.autoLogin(request, response); } catch (Exception e) { cancelCookie(request, response, "Failed to handle remember-me cookie: "+Functions.printThrowable(e)); return null; } } }; rms.setUserDetailsService(uds); { final Hudson instance = Hudson.getInstance(); if(instance!=null) rms.setKey(instance.getSecretKey()); else rms.setKey(null); } rms.setParameter("remember_me"); return new SecurityComponents( findBean(AuthenticationManager.class, context), uds, rms); }

Target:
public SecurityComponents createSecurityComponents() { BeanBuilder builder = new BeanBuilder(getClass().getClassLoader()); Binding binding = new Binding(); binding.setVariable("realm", this); InputStream i = getClass().getResourceAsStream("ActiveDirectory.groovy"); try { builder.parse(i, binding); } finally { IOUtils.closeQuietly(i); } WebApplicationContext context = builder.createApplicationContext(); findBean(AbstractActiveDirectoryAuthenticationProvider.class, context); final UserDetailsService uds = findBean(UserDetailsService.class, context); TokenBasedRememberMeServices2 rms = new TokenBasedRememberMeServices2() { public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) { try { return super.autoLogin(request, response); } catch (Exception e) { cancelCookie(request, response, "Failed to handle remember-me cookie: "+Functions.printThrowable(e)); return null; } } }; rms.setUserDetailsService(uds); rms.setKey(Hudson.getInstance().getSecretKey()); rms.setParameter("remember_me"); return new SecurityComponents( findBean(AuthenticationManager.class, context), uds, rms); }
Source:
public ByteStreamSplitValuesReaderForFloat() { super(ByteStreamSplitValuesReaderForFloat.FLOAT_SIZE_IN_BYTES); valueByteBuffer = new byte[FLOAT_SIZE_IN_BYTES]; }

Target:
public ByteStreamSplitValuesReaderForFloat() { super(Float.BYTES); valueByteBuffer = new byte[Float.BYTES]; }
Source:
private List<SingularityTaskId> getMatchingTaskIds(SingularityRequest request, SingularityDeployKey deployKey) { List<SingularityTaskId> activeTaskIdsFroRequest = leaderCache.getActiveTaskIdsForRequest(deployKey.getRequestId()); if (request.isLongRunning()) { Set<SingularityTaskId> killedTaskIds = leaderCache.getKilledTasks().stream() .map(SingularityKilledTaskIdRecord::getTaskId) .collect(Collectors.toSet()); List<SingularityTaskId> matchingTaskIds = new ArrayList<>(); for (SingularityTaskId taskId : activeTaskIdsFroRequest) { if (!taskId.getDeployId().equals(deployKey.getDeployId())) { continue; } if (leaderCache.getCleanupTaskIds().contains(taskId)) { continue; } if (killedTaskIds.contains(taskId)) { continue; } matchingTaskIds.add(taskId); } return matchingTaskIds; } else { return new ArrayList<>(activeTaskIdsFroRequest); } }

Target:
private List<SingularityTaskId> getMatchingTaskIds(SingularityRequest request, SingularityDeployKey deployKey) { List<SingularityTaskId> activeTaskIdsForRequest = leaderCache.getActiveTaskIdsForRequest(deployKey.getRequestId()); if (request.isLongRunning()) { Set<SingularityTaskId> killedTaskIds = leaderCache.getKilledTasks().stream() .map(SingularityKilledTaskIdRecord::getTaskId) .collect(Collectors.toSet()); List<SingularityTaskId> matchingTaskIds = new ArrayList<>(); for (SingularityTaskId taskId : activeTaskIdsForRequest) { if (!taskId.getDeployId().equals(deployKey.getDeployId())) { continue; } if (leaderCache.getCleanupTaskIds().contains(taskId)) { continue; } if (killedTaskIds.contains(taskId)) { continue; } matchingTaskIds.add(taskId); } return matchingTaskIds; } else { return new ArrayList<>(activeTaskIdsForRequest); } }
Source:
public FileNavigationState() { selectedParent = new SimpleObjectProperty<>(); selectedFile = new SimpleObjectProperty<>(); favoriteFolders = FXCollections.observableList(new ArrayList<FileAdapter>()); favoriteFolders.add(new LocalFile("/home/msonntag/work/software/sampleRDFSet/metadata")); favoriteFolders.add(new LocalFile("/home/msonntag/work/software/sampleRDFSet/metadata/schemas")); navigationPath = FXCollections.observableList(new ArrayList<FileAdapter>()); }

Target:
public FileNavigationState() { selectedParent = new SimpleObjectProperty<>(); selectedFile = new SimpleObjectProperty<>(); favoriteFolders = FXCollections.observableList(new ArrayList<FileAdapter>()); navigationPath = FXCollections.observableList(new ArrayList<FileAdapter>()); }
Source:
public final void setValue(byte[] value) { if (value == null) throw new NullPointerException(); this.value = value; }

Target:
public void setValue(byte[] value) { if (value == null) throw new NullPointerException(); this.value = value; }
Source:
public void testValidMessageFlow() throws UnsupportedEncodingException, XMLStreamException { InputStream xmlStream = this.getClass().getClassLoader().getResourceAsStream("org/activiti/engine/test/validation/validMessageProcess.bpmn20.xml"); XMLInputFactory xif = XMLInputFactory.newInstance(); InputStreamReader in = new InputStreamReader(xmlStream, "UTF-8"); XMLStreamReader xtr = xif.createXMLStreamReader(in); BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr); Assert.assertNotNull(bpmnModel); Assert.assertNotNull(bpmnModel); List<ValidationError> allErrors = processValidator.validate(bpmnModel); Assert.assertEquals(0, allErrors.size()); }

Target:
public void testValidMessageFlow() throws Exception { BpmnModel bpmnModel = readModel( "org/activiti/engine/test/validation/validMessageProcess.bpmn20.xml"); Assert.assertNotNull(bpmnModel); assertThat(bpmnModel).isNotNull(); List<ValidationError> allErrors = processValidator.validate(bpmnModel); assertThat(allErrors).isEmpty(); }
Source:
public SnapshotImpl updateSnapshot(SnapshotImpl update) throws SnapshotException { requireNonNull(update, "Required non-null snapshot"); requireNonNull(update.getId(), "Required non-null snapshot id"); try { return doUpdate(update); } catch (RuntimeException x) { throw new SnapshotException(x.getLocalizedMessage(), x); } }

Target:
public SnapshotImpl updateSnapshot(SnapshotImpl update) throws NotFoundException, ConflictException, SnapshotException { requireNonNull(update, "Required non-null snapshot"); requireNonNull(update.getId(), "Required non-null snapshot id"); try { return doUpdate(update); } catch (DuplicateKeyException dkEx) { throw new ConflictException(format("Snapshot of machine '%s' in environment '%s' already exists", update.getMachineName(), update.getEnvName())); } catch (RuntimeException x) { throw new SnapshotException(x.getLocalizedMessage(), x); } }
Source:
public Response downloadCustomProcessorFile (@PathParam("fileName") String fileName) { try { final InputStream inputStream = catalogService.getFileFromJarStorage(fileName); if (inputStream != null) { StreamingOutput streamOutput = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException, WebApplicationException { try { ByteStreams.copy(inputStream, os); } finally { os.close(); } } }; return Response.ok(streamOutput).build(); } } catch (Exception ex) { LOG.debug(ex.getMessage(), ex); return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND, fileName); }

Target:
public Response downloadCustomProcessorFile (@PathParam("fileName") String fileName) { try { final InputStream inputStream = catalogService.getFileFromJarStorage(fileName); if (inputStream != null) { StreamingOutput streamOutput = WSUtils.wrapWithStreamingOutput(inputStream); return Response.ok(streamOutput).build(); } } catch (Exception ex) { LOG.debug(ex.getMessage(), ex); return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND, fileName); }
Source:
public boolean addResourceWithWeight(String clusterName, IdealState idealState, ResourceConfig resourceConfig) { if (idealState == null) { throw new HelixException("IdealState is null!"); } if (resourceConfig == null) { throw new HelixException("ResourceConfig is null!"); } if (!validateWeightForResourceConfig(_configAccessor.getClusterConfig(clusterName), resourceConfig)) { return false; } _configAccessor .setResourceConfig(clusterName, resourceConfig.getResourceName(), resourceConfig); setResourceIdealState(clusterName, idealState.getResourceName(), idealState); rebalance(clusterName, idealState.getResourceName(), Integer.parseInt(idealState.getReplicas()), idealState.getResourceName(), idealState.getInstanceGroupTag()); return true; }

Target:
public boolean addResourceWithWeight(String clusterName, IdealState idealState, ResourceConfig resourceConfig) { if (clusterName == null || clusterName.isEmpty()) { throw new HelixException("Cluster name is null or empty!"); } if (idealState == null || !idealState.isValid()) { throw new HelixException("IdealState is null or invalid!"); } if (resourceConfig == null || !resourceConfig.isValid()) { throw new HelixException("ResourceConfig is null or invalid!"); } if (!idealState.getResourceName().equals(resourceConfig.getResourceName())) { throw new HelixException("Resource names in IdealState and ResourceConfig are different!"); } if (!validateWeightForResourceConfig(_configAccessor.getClusterConfig(clusterName), resourceConfig, idealState)) { throw new HelixException(String .format("Could not add resource %s with weight! Failed to validate the ResourceConfig!", idealState.getResourceName())); } _configAccessor .setResourceConfig(clusterName, resourceConfig.getResourceName(), resourceConfig); setResourceIdealState(clusterName, idealState.getResourceName(), idealState); rebalance(clusterName, idealState.getResourceName(), Integer.parseInt(idealState.getReplicas()), idealState.getResourceName(), idealState.getInstanceGroupTag()); return true; }
Source:
protected String createPayload(Volume.Request.UpdatePayload payload) { dataCenterId = payload.dataCenterId(); volumeId = payload.id(); if (payload.name() != null) requestBuilder.put("name", payload.name()); if (payload.size() != null) requestBuilder.put("size", payload.size()); if (payload.bus() != null) requestBuilder.put("bus", payload.bus()); return (new Gson()).toJson(requestBuilder); }

Target:
protected String createPayload(Volume.Request.UpdatePayload payload) { checkNotNull(payload.dataCenterId(), "dataCenterId"); checkNotNull(payload.id(), "volumeId"); dataCenterId = payload.dataCenterId(); volumeId = payload.id(); if (payload.name() != null) requestBuilder.put("name", payload.name()); if (payload.size() != null) requestBuilder.put("size", payload.size()); if (payload.bus() != null) requestBuilder.put("bus", payload.bus()); return jsonBinder.toJson(requestBuilder); }
Source:
public static void init() { AssemblerUtils.init() ; AssemblerUtils.registerDataset(TextVocab.textDataset, new TextDatasetAssembler()) ; Assembler.general.implementWith(TextVocab.entityMap, new EntityDefinitionAssembler()) ; Assembler.general.implementWith(TextVocab.textIndexLucene, new TextIndexLuceneAssembler()) ; Assembler.general.implementWith(TextVocab.standardAnalyzer, new StandardAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.simpleAnalyzer, new SimpleAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.keywordAnalyzer, new KeywordAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.lowerCaseKeywordAnalyzer, new LowerCaseKeywordAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.localizedAnalyzer, new LocalizedAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.configurableAnalyzer, new ConfigurableAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.textIndexES, new TextIndexESAssembler()) ; }

Target:
public static void init() { AssemblerUtils.init() ; AssemblerUtils.registerDataset(TextVocab.textDataset, new TextDatasetAssembler()) ; Assembler.general.implementWith(TextVocab.entityMap, new EntityDefinitionAssembler()) ; Assembler.general.implementWith(TextVocab.textIndexLucene, new TextIndexLuceneAssembler()) ; Assembler.general.implementWith(TextVocab.textIndexES, new TextIndexESAssembler()) ; Assembler.general.implementWith(TextVocab.standardAnalyzer, new StandardAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.simpleAnalyzer, new SimpleAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.keywordAnalyzer, new KeywordAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.lowerCaseKeywordAnalyzer, new LowerCaseKeywordAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.localizedAnalyzer, new LocalizedAnalyzerAssembler()) ; Assembler.general.implementWith(TextVocab.configurableAnalyzer, new ConfigurableAnalyzerAssembler()) ; }
Source:
protected void executeCommand() { lockImage(); CinderDisk cinderDisk = getDisk(); cinderDisk.setDiskAlias(getParameters().getDiskAlias()); String volumeId = getNewVolumeCinderDisk(cinderDisk); cinderDisk.setId(Guid.createGuidFromString(volumeId)); cinderDisk.setImageId(Guid.createGuidFromString(volumeId)); cinderDisk.setActive(true); cinderDisk.setParentId(Guid.Empty); cinderDisk.setVmSnapshotId(getParameters().getVmSnapshotId()); cinderDisk.setImageStatus(ImageStatus.LOCKED); cinderDisk.setVolumeType(VolumeType.Sparse); addCinderDiskTemplateToDB(cinderDisk); getReturnValue().setActionReturnValue(cinderDisk.getId()); getParameters().setDestinationImageId(Guid.createGuidFromString(volumeId)); getParameters().setContainerId(Guid.createGuidFromString(volumeId)); persistCommand(getParameters().getParentCommand(), true); setSucceeded(true); }

Target:
protected void executeCommand() { lockImage(); CinderDisk cinderDisk = getDisk(); cinderDisk.setDiskAlias(getParameters().getDiskAlias()); String volumeId = getNewVolumeCinderDisk(cinderDisk); cinderDisk.setId(Guid.createGuidFromString(volumeId)); cinderDisk.setImageId(Guid.createGuidFromString(volumeId)); cinderDisk.setImageStatus(ImageStatus.LOCKED); cinderDisk.setVolumeType(VolumeType.Sparse); if (!cinderDisk.getActive()) { cinderDisk.setActive(true); cinderDisk.setParentId(Guid.Empty); cinderDisk.setVmSnapshotId(getParameters().getVmSnapshotId()); } addCinderDiskTemplateToDB(cinderDisk); getReturnValue().setActionReturnValue(cinderDisk.getId()); getParameters().setDestinationImageId(Guid.createGuidFromString(volumeId)); getParameters().setContainerId(Guid.createGuidFromString(volumeId)); persistCommand(getParameters().getParentCommand(), true); setSucceeded(true); }
Source:
public DbTaskRunner(DbRule rule, boolean isSender, RequestPacket requestPacket, String requested, Timestamp startTime) throws WaarpDatabaseException { super(null); this.session = null; this.rule = rule; if (startTime != null) { transfer = new Transfer(requested, rule.getIdRule(), requestPacket.getMode(), isSender, requestPacket.getFilename(), requestPacket.getFileInformation(), requestPacket.getBlocksize(), startTime); } else { transfer = new Transfer(requested, rule.getIdRule(), requestPacket.getMode(), isSender, requestPacket.getFilename(), requestPacket.getFileInformation(), requestPacket.getBlocksize()); } transfer.setRank(requestPacket.getRank()); transfer.setId(requestPacket.getSpecialId()); originalSize = requestPacket.getOriginalSize(); setOriginalSizeTransferMap(originalSize); transfer.setRequester(Configuration.configuration.getHostId(dbSession, requested)); this.rule = new DbRule(getRuleId()); if (requestPacket.getMode() != rule.getMode()) { if (RequestPacket.isMD5Mode(requestPacket.getMode())) { transfer.setTransferMode(RequestPacket.getModeMD5(rule.getMode())); } else { transfer.setTransferMode(rule.getMode()); } } checkThroughMode(); insert(); requestPacket.setSpecialId(transfer.getId()); }

Target:
public DbTaskRunner(DbRule rule, boolean isSender, RequestPacket requestPacket, String requested, Timestamp startTime) throws WaarpDatabaseException { super(); this.session = null; this.rule = rule; if (startTime != null) { transfer = new Transfer(requested, rule.getIdRule(), requestPacket.getMode(), isSender, requestPacket.getFilename(), requestPacket.getFileInformation(), requestPacket.getBlocksize(), startTime); } else { transfer = new Transfer(requested, rule.getIdRule(), requestPacket.getMode(), isSender, requestPacket.getFilename(), requestPacket.getFileInformation(), requestPacket.getBlocksize()); } transfer.setRank(requestPacket.getRank()); transfer.setId(requestPacket.getSpecialId()); originalSize = requestPacket.getOriginalSize(); setOriginalSizeTransferMap(originalSize); transfer.setRequester(Configuration.configuration.getHostId(dbSession, requested)); this.rule = new DbRule(getRuleId()); if (requestPacket.getMode() != rule.getMode()) { if (RequestPacket.isMD5Mode(requestPacket.getMode())) { transfer.setTransferMode(RequestPacket.getModeMD5(rule.getMode())); } else { transfer.setTransferMode(rule.getMode()); } } checkThroughMode(); insert(); requestPacket.setSpecialId(transfer.getId()); }
Source:
private boolean isFatalException(Errors error) { return error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED || error == Errors.INVALID_PRODUCER_EPOCH || error == Errors.UNSUPPORTED_FOR_MESSAGE_FORMAT || error == Errors.FENCED_INSTANCE_ID; }

Target:
private boolean isFatalException(Errors error) { return error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED || error == Errors.INVALID_PRODUCER_EPOCH || error == Errors.UNSUPPORTED_FOR_MESSAGE_FORMAT; }
Source:
public MesosNimbus() { this._mesosStormScheduler = new StormSchedulerImpl(); }

Target:
public MesosNimbus() { this._stormScheduler = new StormSchedulerImpl(); }
Source:
public void TestGameStarLogo_002_gameStarLogoNotPresentOnSmallResolution() { String url = urlBuilder.getUrlForPath(wikiName, ""); GlobalNavigationPageObject globalNavigation = new GlobalNavigationPageObject(driver); globalNavigation.getUrl(url); globalNavigation.resizeWindow(smallResolution); Assertion.assertFalse(globalNavigation.GameStarLinkDisplay(), "GameStar Logo shouldn't be visible"); }

Target:
public void TestGameStarLogo_002_gameStarLogoNotPresentOnSmallResolution() { HomePageObject homePage = new HomePageObject(driver); VenusGlobalNavPageObject globalNav = new VenusGlobalNavPageObject(driver); homePage.openWikiPage(urlBuilder.getUrlForWiki(deWikiName)); homePage.resizeWindow(HIDE_LOGO_RESOLUTION); Assertion.assertFalse(globalNav.isGameStarLogoDisplayed(), "GameStar Logo shouldn't be visible"); }
Source:
protected final List<?> createValues() { if (withNulls == Nulls.ALL) { return NULL_VALUES; } if (withNulls == Nulls.PARTIAL) { return IntStream.range(0, ROWS).mapToObj(i -> i % 2 == 0 ? createValue() : null).collect(toList()); } return IntStream.range(0, ROWS).mapToObj(i -> createValue()).collect(toList()); }

Target:
protected final List<?> createValues() { switch (withNulls) { case ALL: return NULL_VALUES; case PARTIAL: return IntStream.range(0, ROWS).mapToObj(i -> i % 2 == 0 ? createValue() : null).collect(toList()); default: return IntStream.range(0, ROWS).mapToObj(i -> createValue()).collect(toList()); } }
Source:
private void trackModerationFromNotification(final CommentStatus newStatus) { switch (newStatus) { case APPROVED: AnalyticsTracker.track(Stat.NOTIFICATION_APPROVED); break; case UNAPPROVED: AnalyticsTracker.track(Stat.NOTIFICATION_APPROVED); break; case SPAM: AnalyticsTracker.track(Stat.NOTIFICATION_FLAGGED_AS_SPAM); break; case TRASH: AnalyticsTracker.track(Stat.NOTIFICATION_TRASHED); break; } }

Target:
private void trackModerationFromNotification(final CommentStatus newStatus) { switch (newStatus) { case APPROVED: AnalyticsTracker.track(Stat.NOTIFICATION_APPROVED); break; case UNAPPROVED: AnalyticsTracker.track(Stat.NOTIFICATION_UNAPPROVED); break; case SPAM: AnalyticsTracker.track(Stat.NOTIFICATION_FLAGGED_AS_SPAM); break; case TRASH: AnalyticsTracker.track(Stat.NOTIFICATION_TRASHED); break; } }
Source:
public void initialize(ContainerContext context) { try { ServletContext servletContext = context.getServletContext(); String mode = (String)servletContext.getAttribute(JETTY_CDI_ATTRIBUTE); if (mode == null) { mode = DECORATING_LISTENER_MODE; } switch (mode) { case CDI_SPI_DECORATOR_MODE: JettyLogger.LOG.jettyCdiSpiIsSupported(); break; case CDI_DECORATING_LISTENER_MODE: super.initialize(context); servletContext.setAttribute(CDI_DECORATING_LISTENER_ATTRIBUTE, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyDecorationIsSupported(); break; case DECORATING_LISTENER_MODE: super.initialize(context); String attribute = (String) servletContext.getAttribute(DECORATING_LISTENER_ATTRIBUTE); servletContext.setAttribute(attribute, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyDecorationIsSupported(); break; default: throw new IllegalStateException("unknown mode: " + mode); } } catch (Exception e) { JettyLogger.LOG.unableToCreateJettyWeldInjector(e); } }

Target:
public void initialize(ContainerContext context) { try { ServletContext servletContext = context.getServletContext(); String mode = (String)servletContext.getAttribute(JETTY_CDI_ATTRIBUTE); if (mode == null) { mode = DECORATING_LISTENER_MODE; } switch (mode) { case CDI_SPI_DECORATOR_MODE: JettyLogger.LOG.jettyCdiSpiIsSupported(); break; case CDI_DECORATING_LISTENER_MODE: super.initialize(context); servletContext.setAttribute(CDI_DECORATING_LISTENER_ATTRIBUTE, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyCdiDecorationIsSupported(); break; case DECORATING_LISTENER_MODE: super.initialize(context); String attribute = (String) servletContext.getAttribute(DECORATING_LISTENER_ATTRIBUTE); servletContext.setAttribute(attribute, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyDecorationIsSupported(); break; default: throw JettyLogger.LOG.unknownIntegrationMode(mode); } } catch (Exception e) { JettyLogger.LOG.unableToCreateJettyWeldInjector(e); } }
Source:
public void contextInitialized(ServletContextEvent servletContextEvent) { LOG.debug("Calling Custom contextInitialized"); String secret = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_SECRET, null); String algorithm = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM, null); String paddingMode = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_PADDING, null); String ivHash = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_IV, null); ServletContext context = servletContextEvent.getServletContext(); if (secret != null) { context.setInitParameter(StateUtils.INIT_SECRET, secret); } if (algorithm != null) { context.setInitParameter(StateUtils.INIT_ALGORITHM, algorithm); } if (paddingMode != null) { context.setInitParameter(StateUtils.INIT_ALGORITHM_PARAM, paddingMode); } if (ivHash != null) { context.setInitParameter(StateUtils.INIT_ALGORITHM_IV, ivHash); } super.contextInitialized(servletContextEvent); }

Target:
public void contextInitialized(ServletContextEvent servletContextEvent) { LOG.trace("Calling Custom contextInitialized"); String secret = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_SECRET, null); String algorithm = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM, null); String paddingMode = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_PADDING, null); String ivHash = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_IV, null); ServletContext context = servletContextEvent.getServletContext(); if (secret != null && algorithm != null && paddingMode != null && ivHash != null) { context.setInitParameter(StateUtils.INIT_SECRET, secret); context.setInitParameter(StateUtils.INIT_ALGORITHM, algorithm); context.setInitParameter(StateUtils.INIT_ALGORITHM_PARAM, paddingMode); context.setInitParameter(StateUtils.INIT_ALGORITHM_IV, ivHash); } super.contextInitialized(servletContextEvent); }
Source:
private void addValueToPrefs(String value, String prefsName) { if (value.length() > 0) { IDialogSettings settings = org.eclipse.egit.ui.Activator .getDefault().getDialogSettings(); String[] existingValues = settings.getArray(prefsName); if (existingValues == null) { existingValues = new String[] { value }; settings.put(prefsName, existingValues); } else { List<String> values = new ArrayList<String>( existingValues.length + 1); for (String existingValue : existingValues) { if (!values.contains(existingValue)) values.add(existingValue); } if (!values.contains(value)) values.add(value); while (values.size() > 10) values.remove(0); settings.put(prefsName, values .toArray(new String[values.size()])); } } }

Target:
private void addValueToPrefs(String value, String prefsName) { if (value.length() > 0) { IDialogSettings settings = org.eclipse.egit.ui.Activator .getDefault().getDialogSettings(); String[] existingValues = settings.getArray(prefsName); if (existingValues == null) { existingValues = new String[] { value }; settings.put(prefsName, existingValues); } else { List<String> values = new ArrayList<String>( existingValues.length + 1); for (String existingValue : existingValues) values.add(existingValue); if (values.indexOf(value) == 0) return; values.remove(value); values.add(0, value); while (values.size() > 10) values.remove(values.size() - 1); settings.put(prefsName, values .toArray(new String[values.size()])); } } }