auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public synchronized PartitioningSpillResult partitionAndSpill(Page page, IntPredicate spillPartitionMask) <START> { <END> requireNonNull(page, "page is null"); requireNonNull(spillPartitionMask, "spillPartitionMask is null"); checkArgument(page.getChannelCount() == types.size(), "Wrong page channel count, expected %s but got %s", types.size(), page.getChannelCount()); checkState(!readingStarted); IntArrayList unspilledPositions = partitionPage(page, spillPartitionMask); ListenableFuture<?> future = flush(); return new PartitioningSpillResult(future, unspilledPositions); }</code><technical_language>check in this method spill is finished (flush(partition).isDone() == true). throw exception otherwise. Waiting for spill complete long contract I propose is in line SingleStreamSpiller</technical_language>

Target:
public synchronized PartitioningSpillResult partitionAndSpill(Page page, IntPredicate spillPartitionMask) { requireNonNull(page, "page is null"); requireNonNull(spillPartitionMask, "spillPartitionMask is null"); checkArgument(page.getChannelCount() == types.size(), "Wrong page channel count, expected %s but got %s", types.size(), page.getChannelCount()); checkState(!readingStarted, "reading already started"); IntArrayList unspilledPositions = partitionPage(page, spillPartitionMask); ListenableFuture<?> future = flushFullBuilders(); return new PartitioningSpillResult(future, page.mask(unspilledPositions.toIntArray())); }
Source:
<code>public ConnectionFactory connectionFactory() { <START> return new CachingConnectionFactory("localhost"); <END> }</code><technical_language>brokerRunning.getConnectionFactory() instead? I if useful expose CachingConnectionFactory BrokerRunning avoid a bean altogether</technical_language>

Target:
public ConnectionFactory connectionFactory() { return new CachingConnectionFactory(brokerRunning.getConnectionFactory()); }
Source:
<code>private void deleteStoreDirectories() { <START> Preconditions.checkNotNull(configs.get(JobConfig.JOB_LOGGED_STORE_BASE_DIR()), <END> configs.get(JobConfig.JOB_NON_LOGGED_STORE_BASE_DIR())); deleteDirectory(configs.get(JobConfig.JOB_NON_LOGGED_STORE_BASE_DIR())); deleteDirectory(configs.get(JobConfig.JOB_LOGGED_STORE_BASE_DIR())); }</code><technical_language>is this doing? checkNotNull a vararg param</technical_language>

Target:
private void deleteStoreDirectories() { Preconditions.checkNotNull(configs.get(JobConfig.JOB_LOGGED_STORE_BASE_DIR())); Preconditions.checkNotNull(configs.get(JobConfig.JOB_NON_LOGGED_STORE_BASE_DIR())); deleteDirectory(configs.get(JobConfig.JOB_NON_LOGGED_STORE_BASE_DIR())); deleteDirectory(configs.get(JobConfig.JOB_LOGGED_STORE_BASE_DIR())); }
Source:
<code>void shouldReturnCorrectStringRepresentationForAnIdWhichIsNullBasedOnTheActualClassname() { ByIdResultSelector byIdResultSelector = new ByIdResultSelector(null); assertThat(byIdResultSelector.toString()).isEqualTo( <START> String.format("%s with ID null", ResultAction.class.getName())); <END> }</code><technical_language>s.o</technical_language>

Target:
void shouldReturnCorrectStringRepresentationForAnIdWhichIsNullBasedOnTheActualClassname() { ByIdResultSelector byIdResultSelector = new ByIdResultSelector(null); assertThat(byIdResultSelector.toString()).contains("null"); }
Source:
<code>public static WritePropertyFileResponseType writePropertyFile(WritePropertyFileRequestType part1) throws PropertyAccessException { WritePropertyFileResponseType oOutput = new WritePropertyFileResponseType(); if (part1 != null && StringUtils.isNotEmpty(part1.getPropertyFile()) && part1.getProperties() != null && CollectionUtils.isNotEmpty(part1.getProperties().getProperty())) { String sPropertyFile = part1.getPropertyFile(); java.util.Properties oPropsToStore = new java.util.Properties(); for (PropertyType oInputProp : part1.getProperties().getProperty()) { <START> if (oInputProp.getPropertyName() == null || oInputProp.getPropertyName().length() <= 0) { <END> throw new PropertyAccessException( "Found a property without a name. All properties must have a name."); } if (oInputProp.getPropertyValue() == null) { throw new PropertyAccessException( "The property value cannot be null. Property: " + oInputProp.getPropertyName()); } String sPropName = oInputProp.getPropertyName(); String sPropValue = oInputProp.getPropertyValue(); oPropsToStore.setProperty(sPropName, sPropValue); } PropertyFileManager.writePropertyFile(sPropertyFile, oPropsToStore); } else { String sErrorMessage = "Failed to write property file. There must be both a valid " + "file name without the '.properties' extension and at least " + "one property to write."; throw new PropertyAccessException(sErrorMessage); } oOutput.setSuccess(true); return oOutput; }</code><technical_language>a stringUtils.isEmpty check here</technical_language>

Target:
public static WritePropertyFileResponseType writePropertyFile(WritePropertyFileRequestType part1) throws PropertyAccessException { WritePropertyFileResponseType oOutput = new WritePropertyFileResponseType(); if (part1 != null && StringUtils.isNotEmpty(part1.getPropertyFile()) && part1.getProperties() != null && CollectionUtils.isNotEmpty(part1.getProperties().getProperty())) { String sPropertyFile = part1.getPropertyFile(); java.util.Properties oPropsToStore = new java.util.Properties(); for (PropertyType oInputProp : part1.getProperties().getProperty()) { if (StringUtils.isEmpty(oInputProp.getPropertyName())) { throw new PropertyAccessException( "Found a property without a name. All properties must have a name."); } if (oInputProp.getPropertyValue() == null) { throw new PropertyAccessException( "The property value cannot be null. Property: " + oInputProp.getPropertyName()); } String sPropName = oInputProp.getPropertyName(); String sPropValue = oInputProp.getPropertyValue(); oPropsToStore.setProperty(sPropName, sPropValue); } PropertyFileManager.writePropertyFile(sPropertyFile, oPropsToStore); } else { String sErrorMessage = "Failed to write property file. There must be both a valid " + "file name without the '.properties' extension and at least " + "one property to write."; throw new PropertyAccessException(sErrorMessage); } oOutput.setSuccess(true); return oOutput; }
Source:
<code>public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException { LgoOrderbook orderBook = super.getLgoOrderBook(currencyPair); <START> return convertOrderBook(orderBook, currencyPair); <END> }</code><technical_language>LgoAdapters.adaptOrderBook(orderBook, currencyPair)</technical_language>

Target:
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException { try { LgoOrderbook orderBook = super.getLgoOrderBook(currencyPair); return LgoAdapters.adaptOrderBook(orderBook, currencyPair); } catch (LgoException e) { throw LgoErrorAdapter.adapt(e); } }
Source:
<code>public static void activateIfWanted() { if (isPreventSystemExit()) { SecurityManager currentSecMgr = System.getSecurityManager(); <START> if (currentSecMgr != null) { <END> SystemExitSecurityManager systemExitSecurityManager = new SystemExitSecurityManager( currentSecMgr); tryUpdateSecurityManager(systemExitSecurityManager); } } }</code><technical_language>I security manager null in plain java also, system exit added. (in slf4j) is a check for android system property: java.vendor.url turning lowercase checking contains android..</technical_language>

Target:
public static void activateIfWanted() { if (isPreventSystemExit() && !isAndroid()) { SecurityManager currentSecMgr = System.getSecurityManager(); tryUpdateSecurityManager(new SystemExitSecurityManager(currentSecMgr)); } }
Source:
<code>void testUserFormExistingUserInvalidPasswordLength() { UserForm userForm = new UserForm(); userForm.setUsername(VALID_USERNAME); userForm.setPassword(INVALID_PASSWORD); Set<ConstraintViolation<UserForm>> violations = validator.validate(userForm, UserForm.ExistingUser.class); assertThat(violations.isEmpty()).as("Violations are empty!").isFalse(); <START> assertThat(violations.size()).isEqualTo(1); <END> assertThat(violations).extracting("message").containsAnyOf("Password has to be more than 8 characters!"); }</code><technical_language>assertThat(violations.isEmpty()).as("Violations empty!").isFalse(); assertThat(violations.size()).isEqualTo(1); => assertThat(violations).hasSize(1);</technical_language>

Target:
void testUserFormExistingUserInvalidPasswordLength() { UserForm userForm = new UserForm(); userForm.setUsername(VALID_USERNAME); userForm.setPassword(INVALID_PASSWORD); Set<ConstraintViolation<UserForm>> violations = validator.validate(userForm, UserForm.ExistingUser.class); assertThat(violations).as("Violations are empty!").hasSize(1); assertThat(violations).extracting("message").containsAnyOf("Password has to be more than 8 characters!"); }
Source:
<code>public void action(AuthenticationFlowContext context) { if (DisplayUtils.isConsole(context)) { <START> ConsoleOTPFormAuthenticator.SINGLETON.action(context); <END> return; } validateOTP(context); }</code><technical_language>obtain this session? this approach pluggable</technical_language>

Target:
public void action(AuthenticationFlowContext context) { validateOTP(context); }
Source:
<code>public static void serverShutdown(int portOffset, AutomationContext automationContext) throws XPathExpressionException, RemoteException, InterruptedException { <START> long time = System.currentTimeMillis() + DEFAULT_START_STOP_WAIT_MS; <END> log.info("Shutting down server.."); boolean logOutSuccess = false; if (ClientConnectionUtil.isPortOpen(Integer.parseInt(ExtensionConstants. SERVER_DEFAULT_HTTPS_PORT))) { int httpsPort = Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset; String url = automationContext.getContextUrls().getBackEndUrl(); String backendURL = url.replaceAll("(:\\d+)", ":" + httpsPort); ServerAdminClient serverAdminServiceClient = new ServerAdminClient(backendURL, automationContext.getContextTenant().getTenantAdmin().getUserName(), automationContext.getContextTenant().getTenantAdmin().getPassword()); serverAdminServiceClient.shutdown(); while (System.currentTimeMillis() < time && !logOutSuccess) { logOutSuccess = isServerDown(automationContext, portOffset); } log.info("Server stopped successfully..."); } }</code><technical_language>meaning full variable name</technical_language>

Target:
public static void serverShutdown(int portOffset, AutomationContext automationContext) throws CarbonToolsIntegrationTestException { long time = System.currentTimeMillis() + DEFAULT_START_STOP_WAIT_MS; log.info("Shutting down server.."); try { boolean logOutSuccess = false; if (ClientConnectionUtil.isPortOpen( Integer.parseInt(ExtensionConstants.SERVER_DEFAULT_HTTPS_PORT))) { int httpsPort = Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset; String url = automationContext.getContextUrls().getBackEndUrl(); String backendURL = url.replaceAll("(:\\d+)", ":" + httpsPort); ServerAdminClient serverAdminServiceClient; serverAdminServiceClient = new ServerAdminClient(backendURL, automationContext.getContextTenant().getTenantAdmin().getUserName(), automationContext.getContextTenant().getTenantAdmin().getPassword()); serverAdminServiceClient.shutdown(); while (System.currentTimeMillis() < time && !logOutSuccess) { logOutSuccess = isServerDown(portOffset); } log.info("Server stopped successfully..."); } } catch (XPathExpressionException ex) { log.error("Error when reading automation.xml ", ex); throw new CarbonToolsIntegrationTestException("Error when reading automation.xml ", ex); } catch (RemoteException ex) { log.error("Error while shutdown the server ", ex); throw new CarbonToolsIntegrationTestException("Error while shutdown the server ", ex); } }
Source:
<code>private Pod decoratePod(Pod pod) { <START> Volume[] volumes = kubernetesComponentConf.getSecretNamesToMountPaths() <END> .keySet() .stream() .map(secretName -> new VolumeBuilder() .withName(secretVolumeName(secretName)) .withNewSecret() .withSecretName(secretName) .endSecret() .build() ).toArray(Volume[]::new); return new PodBuilder(pod) .editOrNewSpec() .addToVolumes(volumes) .endSpec() .build(); }</code><technical_language>suggestion final Volume[] volumes = kubernetesComponentConf.getSecretNamesToMountPaths()</technical_language>

Target:
private Pod decoratePod(Pod pod) { final Volume[] volumes = kubernetesComponentConf.getSecretNamesToMountPaths().keySet().stream() .map(secretName -> new VolumeBuilder() .withName(secretVolumeName(secretName)) .withNewSecret() .withSecretName(secretName) .endSecret() .build() ) .toArray(Volume[]::new); return new PodBuilder(pod) .editOrNewSpec() .addToVolumes(volumes) .endSpec() .build(); }
Source:
<code>public void attachWindowConfig(BaseWindowedBolt bolt) { <START> if (windowType == WindowType.COUNT) { <END> bolt.withWindow(BaseWindowedBolt.Count.of(windowSize), BaseWindowedBolt.Count.of(slideInterval)); } else { bolt.withWindow(windowDuration, slidingIntervalDuration); } }</code><technical_language>switch - case - default instead of if - else if - else if - else</technical_language>

Target:
public void attachWindowConfig(BaseWindowedBolt bolt) { switch(windowType) { case COUNT: bolt.withWindow(BaseWindowedBolt.Count.of(windowSize), BaseWindowedBolt.Count.of(slideInterval)); break; case TIME: bolt.withWindow(windowDuration, slidingIntervalDuration); break; default: throw new RuntimeException("Unknown windowType " + String.valueOf(windowType)); } }
Source:
<code>public String toString() { <START> return String.format(ID.toString()+"=>"+entry.toString()); <END> }</code><technical_language>code format</technical_language>

Target:
public String toString() { return String.format("%s=>%s", recordId, entry); }
Source:
<code><START> public boolean isDeleteByTermEnforced() { <END> if ( deleteByTermEnforced ) { return true; } if ( indexMetadataIsComplete ) { Set<Class<?>> entitiesInvolved = getEntitiesInIndexManager(); if ( entitiesInvolved.size() == 1 ) { return true; } for ( EntityIndexBinding entityIndexBinding : searchIntegrator.getIndexBindings().values() ) { if ( entityIndexBinding.getDocumentBuilder().getMappedSubclasses().containsAll( entitiesInvolved ) ) { return true; } } Set<String> idFieldNames = new HashSet<String>( entitiesInvolved.size() ); for ( Class<?> entity : entitiesInvolved ) { idFieldNames.add( indexManager.getIndexBinding( entity ).getDocumentBuilder().getIdKeywordName() ); } return entitiesInvolved.size() == idFieldNames.size(); } else { return false; } }</code><technical_language>add a description Workspace#isDeleteByTermEnforced()? Specifically, curious interaction of areSingleTermDeletesSafe isDeleteByTermEnforced</technical_language>

Target:
public boolean isDeleteByTermEnforced() { if ( deleteByTermEnforced ) { return true; } if ( indexMetadataIsComplete ) { Set<Class<?>> entitiesInvolved = getEntitiesInIndexManager(); if ( entitiesInvolved.size() == 1 ) { return true; } IdUniquenessResolver idUniquenessResolver = this.serviceManager.requestService( IdUniquenessResolver.class ); try { for ( Class<?> firstEntity : entitiesInvolved ) { boolean firstEntityIsUsingJPAId = indexManager.getIndexBinding( firstEntity ) .getDocumentBuilder() .getTypeMetadata() .isJpaIdUsedAsDocumentId(); boolean followingEntities = false; for ( Class<?> secondEntity : entitiesInvolved ) { if ( firstEntity == secondEntity ) { followingEntities = true; } else if ( followingEntities ) { boolean secondEntityIsUsingJPAId = indexManager.getIndexBinding( secondEntity ) .getDocumentBuilder() .getTypeMetadata() .isJpaIdUsedAsDocumentId(); boolean uniqueIdEqualityMeansEntityEquality = firstEntityIsUsingJPAId && secondEntityIsUsingJPAId && idUniquenessResolver.areIdsUniqueForClasses( firstEntity, secondEntity ); if ( !uniqueIdEqualityMeansEntityEquality ) { return false; } } } } } finally { this.serviceManager.releaseService( IdUniquenessResolver.class ); } return true; } else { return false; } }
Source:
<code>public <T> T get(String claimName, Class<T> requiredType) { Object value = get(claimName); if (value == null) { return null; } if (requiredType == Date.class && value instanceof Long) { <START> value = new Date((Long)value); <END> } if (!requiredType.isInstance(value)) { throw new RequiredTypeException("Expected value to be of type: " + requiredType + ", but was " + value.getClass()); } return requiredType.cast(value); }</code><technical_language>I this work if claim name requested is a standard JWT date field, is required in seconds (not millis) epoch. In other words, if I do: java claims.get("iat", Date.class); work. In fact, other get\* methods return a date delegate this method behavior is guaranteed</technical_language>

Target:
public <T> T get(String claimName, Class<T> requiredType) { Object value = get(claimName); if (value == null) { return null; } if (Claims.EXPIRATION.equals(claimName) || Claims.ISSUED_AT.equals(claimName) || Claims.NOT_BEFORE.equals(claimName) ) { value = getDate(claimName); } if (requiredType == Date.class && value instanceof Long) { value = new Date((Long)value); } if (!requiredType.isInstance(value)) { throw new RequiredTypeException("Expected value to be of type: " + requiredType + ", but was " + value.getClass()); } return requiredType.cast(value); }
Source:
<code>public Collection<IProjectAdapter> getProjectsFor(final IOpenShiftConnection conn) { Set<IProjectAdapter> adapters = getCacheFor(conn); if(adapters == null) { Collection<IProject> projects = conn.<IProject>getResources(ResourceKind.PROJECT); <START> adapters = createEntry(conn); <END> synchronized (adapters) { for (IProject p : projects) { addNewProjectAdapter(adapters, conn, p); } } adapters.forEach(a->notifyAdd(a)); } return new ArrayList<>(adapters); }</code><technical_language>(see below): if 2 threads get in concurrently, query cache create entries? checking if entry exists creating entry atomic, thread safe I</technical_language>

Target:
public Collection<IProjectAdapter> getProjectsFor(final IOpenShiftConnection conn) { Set<IProjectAdapter> adapters = null; boolean initialize = false; synchronized (cache) { if(initialize = !hasCacheFor(conn)) { adapters = createEntry(conn); } } if(initialize) { Collection<IProject> projects = conn.<IProject>getResources(ResourceKind.PROJECT); synchronized (adapters) { for (IProject p : projects) { addNewProjectAdapter(adapters, conn, p); } } adapters.forEach(a->notifyAdd(a)); } return new ArrayList<>(getCacheFor(conn)); }
Source:
<code>public MSSQLQuarterDiffFunction() { <START> super("(select sign(i1) * floor(abs(i1)) from (values (datediff(mm, ?1, ?2)/3)) as temp(i1))"); <END> }</code><technical_language>a cast int enough</technical_language>

Target:
public MSSQLQuarterDiffFunction() { super("round(datediff(mm, ?1, ?2)/3,0,1)"); }
Source:
<code>private SymbolReference<ResolvedReferenceTypeDeclaration> tryToSolveTypeUncached(String name) { String[] nameElements = name.split("\\."); for (int i = nameElements.length; i > 0; i--) { <START> StringBuilder filePath = new StringBuilder(srcDir.getAbsolutePath()); <END> for (int j = 0; j < i; j++) { filePath.append("/") .append(nameElements[j]); } filePath.append(".java"); StringBuilder typeName = new StringBuilder(); for (int j = i - 1; j < nameElements.length; j++) { if (j != i - 1) { typeName.append("."); } typeName.append(nameElements[j]); } File srcFile = new File(filePath.toString()); { Optional<CompilationUnit> compilationUnit = parse(srcFile); if (compilationUnit.isPresent()) { Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> astTypeDeclaration = Navigator.findType(compilationUnit.get(), typeName.toString()); if (astTypeDeclaration.isPresent()) { return SymbolReference.solved(JavaParserFacade.get(this).getTypeDeclaration(astTypeDeclaration.get())); } } } { List<CompilationUnit> compilationUnits = parseDirectory(srcFile.getParentFile()); for (CompilationUnit compilationUnit : compilationUnits) { Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> astTypeDeclaration = Navigator.findType(compilationUnit, typeName.toString()); if (astTypeDeclaration.isPresent()) { return SymbolReference.solved(JavaParserFacade.get(this).getTypeDeclaration(astTypeDeclaration.get())); } } } } return SymbolReference.unsolved(ResolvedReferenceTypeDeclaration.class); }</code><technical_language>Better..</technical_language>

Target:
private SymbolReference<ResolvedReferenceTypeDeclaration> tryToSolveTypeUncached(String name) { String[] nameElements = name.split("\\."); for (int i = nameElements.length; i > 0; i--) { StringBuilder filePath = new StringBuilder(srcDir.toAbsolutePath().toString()); for (int j = 0; j < i; j++) { filePath.append("/") .append(nameElements[j]); } filePath.append(".java"); StringBuilder typeName = new StringBuilder(); for (int j = i - 1; j < nameElements.length; j++) { if (j != i - 1) { typeName.append("."); } typeName.append(nameElements[j]); } Path srcFile = Paths.get(filePath.toString()); { Optional<CompilationUnit> compilationUnit = parse(srcFile); if (compilationUnit.isPresent()) { Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> astTypeDeclaration = Navigator.findType(compilationUnit.get(), typeName.toString()); if (astTypeDeclaration.isPresent()) { return SymbolReference.solved(JavaParserFacade.get(this).getTypeDeclaration(astTypeDeclaration.get())); } } } { List<CompilationUnit> compilationUnits = parseDirectory(srcFile.getParent()); for (CompilationUnit compilationUnit : compilationUnits) { Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> astTypeDeclaration = Navigator.findType(compilationUnit, typeName.toString()); if (astTypeDeclaration.isPresent()) { return SymbolReference.solved(JavaParserFacade.get(this).getTypeDeclaration(astTypeDeclaration.get())); } } } } return SymbolReference.unsolved(ResolvedReferenceTypeDeclaration.class); }
Source:
<code>private Map<CDOID, CDOObject> updateCDOViewObjectsCache(List<CDORevision> loadedRevisions) { Map<CDOID, CDOObject> cdoIDs = new HashMap<CDOID, CDOObject>(); for (CDORevision cdoRevision : loadedRevisions) { CDOID cdoID = cdoRevision.getID(); <START> if (cdoID != null && !cdoRevision.isResourceNode()) <END> { InternalCDOObject object = getObject(cdoID, true); cdoIDs.put(cdoID, object); } } return cdoIDs; }</code><technical_language>check if !cdoRevision.isResourceNode() is needed CDOResource EObject CDOObject</technical_language>

Target:
private Map<CDOID, CDOObject> updateCDOViewObjectsCache(List<CDORevision> loadedRevisions) { Map<CDOID, CDOObject> cdoIDs = new HashMap<CDOID, CDOObject>(); CDOLockStateLoadingPolicy lockStateLoadingPolicy = options().getCDOLockStateLoadingPolicy(); for (CDORevision cdoRevision : loadedRevisions) { CDOID cdoID = cdoRevision.getID(); if (cdoID != null && lockStateLoadingPolicy.loadLockState(cdoID)) { boolean isResourceNode = cdoRevision.isResourceNode(); InternalCDOObject object = getObject(cdoID, !isResourceNode); if (object != null) { cdoIDs.put(cdoID, object); } } } return cdoIDs; }
Source:
<code>public static Method findGetter(String propertyName, Class beanClass) { Method result = findMethod(beanClass, "get" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1)); if (result != null) { <START> return result; <END> } result = findMethod(beanClass, "is" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1)); if (result != null) { return result; } return null; }</code><technical_language>change this. need return null if method is accessible</technical_language>

Target:
public static Method findGetter(String propertyName, Class beanClass) { Method result = findMethod(beanClass, "get" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1)); if (result != null) { result.setAccessible(true); return result; } result = findMethod(beanClass, "is" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1)); if (result != null) { result.setAccessible(true); return result; } return null; }
Source:
<code>public void testOperators() throws Exception { final String str = "package org.drools.test;\n" + "import " + Person.class.getCanonicalName() + ";\n" + "rule R1 when \n" + " Person(20 < age, 30 > age)\n" + " Person(30 <= age, 40 >= age)\n" + "then\n" + "end"; final KieSession ksession = getKieSession(str); if (testRunType == RUN_TYPE.FLOW_DSL || testRunType == RUN_TYPE.PATTERN_DSL) { String exprId1 = new DRLIdGenerator().getExprId(Person.class, "org.drools.modelcompiler.util.EvaluationUtil." + <START> "greaterThanNumbers(_this.getAge(), 20)"); <END> assertThat(getConstraintString(ksession, 0, 0), containsString(exprId1)); String exprId2 = new DRLIdGenerator().getExprId(Person.class, "org.drools.modelcompiler.util.EvaluationUtil." + "lessThanNumbers(_this.getAge(), 30)"); assertThat(getConstraintString(ksession, 0, 1), containsString(exprId2)); String exprId3 = new DRLIdGenerator().getExprId(Person.class, "org.drools.modelcompiler.util.EvaluationUtil." + "greaterOrEqualNumbers(_this.getAge(), 30)"); assertThat(getConstraintString(ksession, 1, 0), containsString(exprId3)); String exprId4 = new DRLIdGenerator().getExprId(Person.class, "org.drools.modelcompiler.util.EvaluationUtil." + "lessOrEqualNumbers(_this.getAge(), 40)"); assertThat(getConstraintString(ksession, 1, 1), containsString(exprId4)); } final Person p1 = new Person("John", 21); final Person p2 = new Person("Paul", 40); ksession.insert(p1); ksession.insert(p2); assertEquals(1, ksession.fireAllRules()); }</code><technical_language>instead of definition of rule test behaviour. insert kind of people matches in result. do think</technical_language>

Target:
public void testOperators() throws Exception { final String str = "package org.drools.test;\n" + "import " + Person.class.getCanonicalName() + ";\n" + "rule R1 when \n" + " Person(20 < age, 30 > age)\n" + " Person(30 <= age, 40 >= age)\n" + "then\n" + "end\n" + "rule R2 when \n" + " Person(age > 20, age < 30)\n" + " Person(age >= 30, age <= 40)\n" + "then\n" + "end"; final KieSession ksession = getKieSession(str); assertEquals(4, ReteDumper.collectNodes(ksession).stream().filter(AlphaNode.class::isInstance).count()); final Person p1 = new Person("John", 21); final Person p2 = new Person("Paul", 40); ksession.insert(p1); ksession.insert(p2); assertEquals(2, ksession.fireAllRules()); }
Source:
<code>private boolean validateExternalVnicProfileMapping() { <START> final Set<EngineMessage> externalVnicProfileMappingValidationResult = externalVnicProfileMappingValidator.validateExternalVnicProfileMapping( getParameters().getExternalVnicProfileMappings(), getParameters().getClusterId()); <END> if (externalVnicProfileMappingValidationResult.isEmpty()) { return true; } else { return failValidation(new ArrayList<>(externalVnicProfileMappingValidationResult)); } }</code><technical_language>long expression. Please consider removing 'final' modifier (which is totally unneeded) and/or extracting variables for objects parameters and/or renaming variable simple validationResult. method long forget, kind of 'validation result' is</technical_language>

Target:
private boolean validateExternalVnicProfileMapping() { Collection<ExternalVnicProfileMapping> externalVnicProfileMappings = getParameters().getExternalVnicProfileMappings(); Guid clusterId = getParameters().getClusterId(); ValidationResult validationResult = externalVnicProfileMappingValidator .validateExternalVnicProfileMapping(externalVnicProfileMappings, clusterId); return validate(validationResult); }
Source:
<code>private void reactAndPost(EventEnvelope event) { EventReactorMethod method = thisClass.reactorOf(event.messageClass(), event.originClass()); DispatchOutcomeHandler .from(method.invoke(this, event)) .onEvents(eventBus::post) .onError(error -> { <START> HandlerFailedUnexpectedly systemEvent = HandlerFailedUnexpectedly <END> .newBuilder() .setEntity(eventAnchor) .setHandledSignal(event.messageId()) .setError(error) .vBuild(); system.postEvent(systemEvent, event.asMessageOrigin()); }) .handle(); }</code><technical_language>Please extract method for handling error</technical_language>

Target:
private void reactAndPost(EventEnvelope event) { EventReactorMethod method = thisClass.reactorOf(event.messageClass(), event.originClass()); DispatchOutcomeHandler .from(method.invoke(this, event)) .onEvents(eventBus::post) .onError(error -> postFailure(error, event)) .handle(); }
Source:
<code>private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); Map<String, ExtensionProxy> proxies = moduleService.getContext().get(ModuleService.EXTENSIONS_MAP); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")).replace( "@ENGINE_ETC@", <START> System.getProperty("org.ovirt.engine.exttool.core.engineEtc") <END> ), "properties" ); } for(File f : files) { proxies.put(extensionsManager.load(f), null); } for(Map.Entry<String, ExtensionProxy> entry : proxies.entrySet()) { extensionsManager.initialize(entry.getKey()); entry.setValue(extensionsManager.getExtensionByName(entry.getKey())); } }</code><technical_language>if put program name static, align? important which, please consistent</technical_language>

Target:
private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); Map<String, ExtensionProxy> proxies = moduleService.getContext().get(ModuleService.EXTENSIONS_MAP); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")).replace("@ENGINE_ETC@", ENGINE_ETC), "properties" ); } for(File f : files) { proxies.put(extensionsManager.load(f), null); } for(Map.Entry<String, ExtensionProxy> entry : proxies.entrySet()) { extensionsManager.initialize(entry.getKey()); entry.setValue(extensionsManager.getExtensionByName(entry.getKey())); } }
Source:
<code>public void add( Collection<? extends IndexEntryUpdate<?>> updates ) throws IndexEntryConflictException, IOException { Map<CoordinateReferenceSystem,Collection<IndexEntryUpdate<?>>> batchMap = new HashMap<>(); for ( Map.Entry<CoordinateReferenceSystem,SpatialKnownIndex> index : indexMap.entrySet() ) { batchMap.put( index.getKey(), new ArrayList<>() ); <START> } <END> for ( IndexEntryUpdate<?> update : updates ) { selectUpdates( batchMap, update.values() ).add( update ); } for ( CoordinateReferenceSystem crs : batchMap.keySet() ) { indexFactory.selectAndCreate( indexMap, indexId, crs ).getPopulator( descriptor, samplingConfig ).add( batchMap.get( crs ) ); } }</code><technical_language>selectUpdates computeIfAbsent need pre populate this map lists here</technical_language>

Target:
public void add( Collection<? extends IndexEntryUpdate<?>> updates ) throws IndexEntryConflictException, IOException { Map<CoordinateReferenceSystem,Collection<IndexEntryUpdate<?>>> batchMap = new HashMap<>(); for ( IndexEntryUpdate<?> update : updates ) { selectUpdates( batchMap, update.values() ).add( update ); } for ( CoordinateReferenceSystem crs : batchMap.keySet() ) { SpatialKnownIndex index = indexFactory.selectAndCreate( indexMap, indexId, crs ); index.startPopulation( descriptor, samplingConfig ); index.add( batchMap.get( crs ) ); } }
Source:
<code>public Mono<Integer> forceCloseAllHandles(boolean recursive) { return fluxContext(context -> forceCloseAllHandlesWithTimeout(recursive, null, context)) <START> .reduce(0, Integer::sum); <END> }</code><technical_language>nit; alternatively count() operator <LINK_0></technical_language>

Target:
public Mono<Integer> forceCloseAllHandles(boolean recursive) { try { return withContext(context -> forceCloseAllHandlesWithTimeout(recursive, null, context) .reduce(0, Integer::sum)); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public Collection<Product> getProducts() { <START> return products.values(); <END> }</code><technical_language>Fields, this immutable</technical_language>

Target:
public Map<String, Product> getProducts() { return products; }
Source:
<code>protected void executeCommand() { UserProfile profile = getParameters().getUserProfile(); profile.setId(Guid.newGuid()); profile.setUserId(getUserId()); if (!profile.getSshPublicKey().isEmpty() && ( profile.getSshPublicKeyId() == null || <START> profile.getSshPublicKeyId().equals(Guid.Empty))) { <END> profile.setSshPublicKeyId(Guid.newGuid()); } userProfileDao.save(profile); setSucceeded(true); }</code><technical_language>simplify Guid.isNullOrEmpty(profile.getSshPublicKeyId())</technical_language>

Target:
protected void executeCommand() { UserProfile profile = getParameters().getUserProfile(); profile.setId(Guid.newGuid()); profile.setUserId(getUserId()); if (!profile.getSshPublicKey().isEmpty() && Guid.isNullOrEmpty(profile.getSshPublicKeyId())) { profile.setSshPublicKeyId(Guid.newGuid()); } userProfileDao.save(profile); setSucceeded(true); }
Source:
<code>public SetSpecialDaysResponse getSetSpecialDaysResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final SetSpecialDaysAsyncRequest request) throws OsgpException { final MeterResponseData meterResponseData = this.configurationService.dequeueSetSpecialDaysResponse(request <START> .getCorrelationUid()); <END> final SetSpecialDaysResponse response = new SetSpecialDaysResponse(); if (meterResponseData != null) { response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() instanceof String) { response.setDescription((String) meterResponseData.getMessageData()); } } else { response.setResult(OsgpResultType.NOT_FOUND); } return response; }</code><technical_language>In SmartMeteringMonitoringEndpoint I response data retrieved a call meterResponseDataService. Calling configurationService obtain response data inconsistent sight. If is reason for this difference, I cleaner if obtaining actual response is treated alike in endpoints</technical_language>

Target:
public SetSpecialDaysResponse getSetSpecialDaysResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final SetSpecialDaysAsyncRequest request) { final SetSpecialDaysResponse response = new SetSpecialDaysResponse(); try { final MeterResponseData meterResponseData = this.configurationService.dequeueSetSpecialDaysResponse(request .getCorrelationUid()); response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() instanceof String) { response.setDescription((String) meterResponseData.getMessageData()); } } catch (final FunctionalException e) { if (e.getExceptionType() == FunctionalExceptionType.UNKNOWN_CORRELATION_UID) { response.setResult(OsgpResultType.NOT_FOUND); } else { response.setResult(OsgpResultType.NOT_OK); } } return response; }
Source:
<code>private void highlightDTD( int startOffset) { int closingBracketStartOffset; <START> closingBracketStartOffset = getTagClosingBracketStartOffset(startOffset); <END> highlighting.add(new HighlightingData(startOffset, startOffset + 9, "j")); highlighting.add(new HighlightingData(closingBracketStartOffset, closingBracketStartOffset + 1, "j")); }</code><technical_language>@vilchik-elena simpler get startOffset of next event re-parse code of current event</technical_language>

Target:
private void highlightDTD( int startOffset) { int closingBracketStartOffset; closingBracketStartOffset = getTagClosingBracketStartOffset(startOffset); addHighlighting(startOffset, startOffset + 9, "j"); addHighlighting(closingBracketStartOffset, closingBracketStartOffset + 1, "j"); }
Source:
<code>private void endTurn(GameBean game) throws GameException { boolean shouldUpdateNextMove = true; if (game.getStage().equals(GameStage.PREPARATION)) { Integer previousPreparationCycle = game.getPreparationCycle(); preparationStageUtil.updateGameStageToMain(game); preparationStageUtil.updateCurrentCycleInitialBuildingNumber(game); preparationStageUtil.updatePreparationCycle(game); Integer newPreparationCycle = game.getPreparationCycle(); boolean preparationFinished = newPreparationCycle == null && !game.getCurrentMove().equals(1); shouldUpdateNextMove = (preparationFinished || previousPreparationCycle.equals(newPreparationCycle)); <START> } else { <END> game.setDiceThrown(false); game.setDiceFirstValue(null); game.setDiceSecondValue(null); } if (shouldUpdateNextMove) { playUtil.updateNextMove(game); } }</code><technical_language>ways refactor fully now. switch-case instead of if-else? i a bit more readable</technical_language>

Target:
private void endTurn(GameBean game) throws GameException { switch (game.getStage()) { case PREPARATION: Integer previousPreparationCycle = game.getPreparationCycle(); preparationStageUtil.updateGameStageToMain(game); preparationStageUtil.updateCurrentCycleInitialBuildingNumber(game); preparationStageUtil.updatePreparationCycle(game); if (game.getPreparationCycle() == null || previousPreparationCycle.equals(game.getPreparationCycle())) { preparationStageUtil.updateNextMove(game); } break; case MAIN: mainStageUtil.resetDices(game); mainStageUtil.updateNextMove(game); break; } }
Source:
<code>public void select(final int... indices) { log.debug(MessageFormat.format("Set selection {0} to indices {1}]", this, StringUtils.join(indices, ", "))); waitForEnabled(); if (indices.length > 1) assertMultiSelect("multiple selections"); for (int i = 0; i < indices.length; i++) { assertIsLegalIndex(indices[i]); } asyncExec(new VoidResult() { public void run() { <START> widget.setSelection(indices); <END> } }); notifySelect(indices.length); }</code><technical_language>select events a time, a selection event iteration. Call setSelection(int) time select(int) subsequently</technical_language>

Target:
public void select(final int... indices) { log.debug(MessageFormat.format("Set selection {0} to indices {1}]", this, StringUtils.join(indices, ", "))); waitForEnabled(); if (indices.length > 1) assertMultiSelect("multiple selections"); for (int i = 0; i < indices.length; i++) { assertIsLegalIndex(indices[i]); } asyncExec(new VoidResult() { public void run() { for (int i = 0; i < indices.length; i++) { if (i == 0) { widget.setSelection(indices[0]); notifySelect(true); } else { widget.select(indices[i]); notifySelect(false); } } } }); }
Source:
<code>public String createApplication( @NotNull(message = "No application entered to create.") @Valid final Application app ) throws GenieException { log.debug("Called with application: {}", app); final Optional<String> appId = app.getId(); <START> if (appId.isPresent() && this.applicationRepository.existsByUniqueId(appId.get())) { <END> throw new GenieConflictException("An application with id " + appId.get() + " already exists"); } final ApplicationEntity applicationEntity = new ApplicationEntity(); applicationEntity.setUniqueId(app.getId().orElse(UUID.randomUUID().toString())); this.updateEntityWithDtoContents(applicationEntity, app); this.applicationRepository.save(applicationEntity); return applicationEntity.getUniqueId(); }</code><technical_language>Do need check exists? save, get a DuplicateKeyException, propogate GenieConflictException</technical_language>

Target:
public String createApplication( @NotNull(message = "No application entered to create.") @Valid final Application app ) throws GenieException { log.debug("Called with application: {}", app); final ApplicationEntity applicationEntity = new ApplicationEntity(); applicationEntity.setUniqueId(app.getId().orElse(UUID.randomUUID().toString())); this.updateEntityWithDtoContents(applicationEntity, app); try { this.applicationRepository.save(applicationEntity); } catch (final DataIntegrityViolationException e) { throw new GenieConflictException( "An application with id " + applicationEntity.getUniqueId() + " already exists", e ); } return applicationEntity.getUniqueId(); }
Source:
<code>public void monthNameFormat(String pattern) { <START> monthNameFormat = new SimpleDateFormat(pattern, locale); <END> monthNameFormat.setTimeZone(timeZone); for (MonthDescriptor month : months) { month.setLabel(monthNameFormat.format(month.getDate())); } validateAndUpdate(); }</code><technical_language>this copied init...can extract a private method instead</technical_language>

Target:
private void monthNameFormat(String pattern) { monthNameFormat = new SimpleDateFormat(pattern, locale); monthNameFormat.setTimeZone(timeZone); for (MonthDescriptor month : months) { month.setLabel(monthNameFormat.format(month.getDate())); } }
Source:
<code>public void updateLocalPatientsList() { <START> new PatientDAO().getAllPatients().observeOn(AndroidSchedulers.mainThread()).subscribe(patientList -> { <END> final int NO_STRING_ID = R.string.last_vitals_none_label; boolean isFiltering = StringUtils.notNull(mQuery) && !mQuery.isEmpty(); if (isFiltering) { patientList = FilterUtil.getPatientsFilteredByQuery(patientList, mQuery); if (patientList.isEmpty()) { syncedPatientsView.updateListVisibility(false, R.string.search_patient_no_result_for_query, mQuery); } else { syncedPatientsView.updateListVisibility(true, NO_STRING_ID, null); } } else { if (patientList.isEmpty()) { syncedPatientsView.updateListVisibility(false, R.string.search_patient_no_results, null); } else { syncedPatientsView.updateListVisibility(true, NO_STRING_ID, null); } } syncedPatientsView.updateAdapter(patientList); }); }</code><technical_language>here. addSubscriptio()</technical_language>

Target:
public void updateLocalPatientsList() { addSubscription(new PatientDAO().getAllPatients().observeOn(AndroidSchedulers.mainThread()).subscribe(patientList -> { final int NO_STRING_ID = R.string.last_vitals_none_label; boolean isFiltering = StringUtils.notNull(mQuery) && !mQuery.isEmpty(); if (isFiltering) { patientList = FilterUtil.getPatientsFilteredByQuery(patientList, mQuery); if (patientList.isEmpty()) { syncedPatientsView.updateListVisibility(false, R.string.search_patient_no_result_for_query, mQuery); } else { syncedPatientsView.updateListVisibility(true, NO_STRING_ID, null); } } else { if (patientList.isEmpty()) { syncedPatientsView.updateListVisibility(false, R.string.search_patient_no_results, null); } else { syncedPatientsView.updateListVisibility(true, NO_STRING_ID, null); } } syncedPatientsView.updateAdapter(patientList); })); }
Source:
<code>public StepContext getObject() throws Exception { org.springframework.batch.core.scope.context.StepContext stepContext = StepSynchronizationManager.getContext(); String stepName = stepContext.getStepName(); String jobName = stepContext.getStepExecution().getJobExecution().getJobInstance().getJobName(); <START> Properties properties = batchPropertyContext.getStepLevelProperties(jobName + "." + stepName + "." + stepName); <END> return new StepContext(stepContext.getStepExecution(), properties); }</code><technical_language>extra stepName here</technical_language>

Target:
public StepContext getObject() throws Exception { org.springframework.batch.core.scope.context.StepContext stepContext = StepSynchronizationManager.getContext(); String stepName = stepContext.getStepName(); String jobName = stepContext.getStepExecution().getJobExecution().getJobInstance().getJobName(); Properties properties = batchPropertyContext.getStepLevelProperties(jobName + "." + stepName); return new StepContext(stepContext.getStepExecution(), properties); }
Source:
<code>public TableEto getTable(String id) { <START> LoggerFactory.getLogger(TablemanagementRestServiceImpl.class).trace("impl test"); <END> long idAsLong; if (id == null) { throw new BadRequestException("missing id"); } try { idAsLong = Long.parseLong(id); } catch (NumberFormatException e) { throw new BadRequestException("id is not a number"); } catch (NotFoundException e) { throw new BadRequestException("table not found"); } return this.tableManagement.findTable(idAsLong); }</code><technical_language>Please follow official log pattern (also automated in Eclipse code template): <LINK_0> However, IMHO "impl test" supposed committed all..</technical_language>

Target:
public TableEto getTable(String id) { long idAsLong; if (id == null) { throw new BadRequestException("missing id"); } try { idAsLong = Long.parseLong(id); } catch (NumberFormatException e) { throw new BadRequestException("id is not a number"); } catch (NotFoundException e) { throw new BadRequestException("table not found"); } return this.tableManagement.findTable(idAsLong); }
Source:
<code><START> protected synchronized boolean checkRequiredSettings() { <END> requiredProperties = getRequiredPropertyValues(); if ( requiredProperties.get( RequiredProp.PROVIDER.getName() ).equals( this.getClass().getCanonicalName() ) && requiredProperties.get( RequiredProp.PROVIDER_URL.getName() ) != null && requiredProperties.get( RequiredProp.DIALECT.getName() ) != null ) { return true; } return false; }</code><technical_language>is this _synchronized_</technical_language>

Target:
private synchronized Map<String,String> checkRequiredSettings() { requiredProperties = getRequiredPropertyValues(); Map<String, String> unSetRequiredProperties = new HashMap<String, String>(); if ( requiredProperties.get( RequiredProp.PROVIDER_URL.getName() ) == null || requiredProperties.get( RequiredProp.PROVIDER_URL.getName() ).equals( "" ) ) { unSetRequiredProperties.put( RequiredProp.PROVIDER_URL.getName(), null ); } return unSetRequiredProperties; }
Source:
<code>public void sendPassword(String companyId, String emailAddress, Locale locale, boolean fromAngular) throws PortalException, SystemException { emailAddress = emailAddress.trim().toLowerCase(); if (!Validator.isEmailAddress(emailAddress)) { throw new UserEmailAddressException(); } User user = UserUtil.findByC_EA(companyId, emailAddress); String token = RandomStringUtils.randomAlphanumeric( Config.getIntProperty( "RECOVER_PASSWORD_TOKEN_LENGTH", 30 ) ); user.setIcqId(token+":"+new Date().getTime()); UserUtil.update(user); Company company = CompanyUtil.findByPrimaryKey(companyId); String url = null; String urlPrefix = (company.getPortalURL().contains("://") ? "" : "https://") + company.getPortalURL(); if ( !fromAngular ) { url = urlPrefix + "/c/portal_public/login?my_account_cmd=ereset&my_user_id=" + user.getUserId() + "&token=" + token + "&switchLocale=" + locale.getLanguage() + "_" + locale.getCountry(); }else{ <START> url = urlPrefix + "/" + java.text.MessageFormat.format("html/ng?resetPassword=true&userId={0}&token={1}", user.getUserId(), token); <END> } String body = LanguageUtil.format(locale, "reset-password-email-body", url, false); try { Mailer m = new Mailer(); m.setToEmail(emailAddress); m.setToName(user.getFullName()); m.setSubject(LanguageUtil.get(locale, "reset-password-email-subject")); m.setHTMLBody(body.toString()); m.setFromName(company.getName()); m.setFromEmail(company.getEmailAddress()); m.sendMessage(); } catch (Exception ioe) { throw new SystemException(ioe); } }</code><technical_language>I prefer strategy build Url UrlStrategy instead of passing a parameter, more OOP</technical_language>

Target:
public void sendPassword(String companyId, String emailAddress, Locale locale, boolean fromAngular) throws PortalException, SystemException { emailAddress = emailAddress.trim().toLowerCase(); if (!Validator.isEmailAddress(emailAddress)) { throw new UserEmailAddressException(); } User user = UserUtil.findByC_EA(companyId, emailAddress); String token = ResetPasswordTokenUtil.createToken(); user.setIcqId(token+":"+new Date().getTime()); UserUtil.update(user); Company company = CompanyUtil.findByPrimaryKey(companyId); String url = UrlUtil.getAbsoluteResetPasswordURL(company, user, token, locale, fromAngular); String body = LanguageUtil.format(locale, "reset-password-email-body", url, false); String subject = LanguageUtil.get(locale, "reset-password-email-subject"); try { EmailUtils.sendMail(user, company, subject, body); } catch (Exception ioe) { throw new SystemException(ioe); } }
Source:
<code>public Authenticated authenticate(Credentials credentials) throws ContextAuthenticationException { <START> TestUsernameCredentials creds = (TestUsernameCredentials) credentials; <END> User user = getContextDAO().getUserByUsername(creds.getUsername()); return new BasicAuthenticated(user, "test-scheme"); }</code><technical_language>I do a need for this casting. I thought do credentials.getClientName() line 24 a result, do need skipAuthenticationInBaseSetup changes in BaseContextSensitiveTest.java</technical_language>

Target:
public Authenticated authenticate(Credentials credentials) throws ContextAuthenticationException { User user = getContextDAO().getUserByUsername(credentials.getClientName()); return new BasicAuthenticated(user, "test-scheme"); }