auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void retrieveApplicationsAndTheirNumbers() { ApplicationsDao dao = manager.getApplicationsDao(); List<Application> apps = dao.getApplications(new Sid("ACae6e420f425248d6a26948c17a9e2acf"), true); Assert.assertEquals(5, apps.size()); Assert.assertNotNull(searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers()); <START> Assert.assertEquals("Three (3) numbers should be bound to this application", searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers().size(), 3); <END> Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000004"),apps).getNumbers()); Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000005"),apps).getNumbers()); }</code><technical_language>i expectedValue is argument. If "3" is in proper place, is requirement putting custom message for this assertion, default explanatory</technical_language>

Target:
public void retrieveApplicationsAndTheirNumbers() { ApplicationsDao dao = manager.getApplicationsDao(); List<Application> apps = dao.getApplicationsWithNumbers(new Sid("ACae6e420f425248d6a26948c17a9e2acf")); Assert.assertEquals(5, apps.size()); Assert.assertNotNull(searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers()); Assert.assertEquals("Three (3) numbers should be bound to this application", 3, searchApplicationBySid(new Sid("AP73926e7113fa4d95981aa96b76eca854"),apps).getNumbers().size()); Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000004"),apps).getNumbers()); Assert.assertNull(searchApplicationBySid(new Sid("AP00000000000000000000000000000005"),apps).getNumbers()); }
Source:
<code>public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); <START> final Resource[] resources = new Resource[] { new ClassPathResource("schemas/common.xsd"), <END> new ClassPathResource("schemas/adhocmanagement.xsd"), new ClassPathResource("schemas/configurationmanagement.xsd"), new ClassPathResource("schemas/deviceinstallation.xsd"), new ClassPathResource("schemas/devicemanagement.xsd"), new ClassPathResource("schemas/firmwaremanagement.xsd") }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }</code><technical_language>Move Strings more a constant</technical_language>

Target:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource(COMMON_XSD_PATH), new ClassPathResource(ADHOC_MANAGEMENT_XSD_PATH), new ClassPathResource(CONFIGURATION_MANAGEMENT_XSD_PATH), new ClassPathResource(DEVICE_INSTALLATION_XSD_PATH), new ClassPathResource(DEVICE_MANAGEMENT_XSD_PATH), new ClassPathResource(FIRMWARE_MANAGEMENT_XSD_PATH) }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }
Source:
<code><START> public CohortDefinition getPatientsInState() { <END> InStateCohortDefinition cd = new InStateCohortDefinition(); cd.addParameter(new Parameter("states", "reporting.parameter.states", ProgramWorkflowState.class, List.class, null)); cd.addParameter(new Parameter("onOrAfter", "reporting.parameter.startDate", Date.class)); cd.addParameter(new Parameter("onOrBefore", "reporting.parameter.endDate", Date.class)); cd.addParameter(new Parameter("onDate", "reporting.parameter.date", Date.class)); return cd; }</code><technical_language>labels necessarily reflect "onOrAfter", "onOrBefore", "onDate"</technical_language>

Target:
public CohortDefinition getPatientsInState() { InStateCohortDefinition cd = new InStateCohortDefinition(); cd.addParameter(new Parameter("states", "reporting.parameter.states", ProgramWorkflowState.class, List.class, null)); cd.addParameter(new Parameter("onOrAfter", "reporting.parameter.onOrAfter", Date.class)); cd.addParameter(new Parameter("onOrBefore", "reporting.parameter.onOrBefore", Date.class)); cd.addParameter(new Parameter("onDate", "reporting.parameter.date", Date.class)); return cd; }
Source:
<code>public ValueMatcher makeMatcher(ColumnSelectorFactory columnSelectorFactory) { final DimensionSelector dimensionSelector = columnSelectorFactory.makeDimensionSelector(dimension); if (dimensionSelector == null) { <START> return new BooleanValueMatcher(value == null || "".equals(value)); <END> } else { final int valueId = dimensionSelector.lookupId(value); return new ValueMatcher() { @Override public boolean matches() { final IndexedInts row = dimensionSelector.getRow(); final int size = row.size(); for (int i = 0; i < size; ++i) { if (row.get(i) == valueId) { return true; } } return false; } }; } }</code><technical_language>Another instance of predicate discussed previously</technical_language>

Target:
public ValueMatcher makeMatcher(ColumnSelectorFactory columnSelectorFactory) { final DimensionSelector dimensionSelector = columnSelectorFactory.makeDimensionSelector(dimension); if (dimensionSelector == null) { return new BooleanValueMatcher(Strings.isNullOrEmpty(value)); } else { final int valueId = dimensionSelector.lookupId(value); return new ValueMatcher() { @Override public boolean matches() { final IndexedInts row = dimensionSelector.getRow(); final int size = row.size(); for (int i = 0; i < size; ++i) { if (row.get(i) == valueId) { return true; } } return false; } }; } }
Source:
<code>protected void setUp() throws Exception { source = "void foo() {\r\n\r\n for(int i = 0; i < 10; i++){\r\n\r\n }\r\n\r\n for(int j = 0; j < 10; j++){\r\n\r\n }\r\n\r\n}"; <START> expectedSource = "void foo() {\r\n\r\n\tfor (int i = 0; i < 10; i++)\r\n\t\t;\r\n\r\n\r\n for(int j = 0; j < 10; j++){\r\n\r\n }\r\n\r\n}"; END> forReplaced = false; super.setUp(); }</code><technical_language>whitespace change</technical_language>

Target:
protected void setUp() throws Exception { source = "void foo() {\n" + "\n" + " for(int i = 0; i < 10; i++){\n" + "\n" + " }\n" + "\n" + " for(int j = 0; j < 10; j++){\n" + "\n" + " }\n" + "\n" + "}"; expectedSource = "void foo() {\n" + "\n" + " for (int i = 0; i < 10; i++)\n" + " ;\n" + "\n" + "\n" + " for(int j = 0; j < 10; j++){\n" + "\n" + " }\n" + "\n" + "}"; forReplaced = false; super.setUp(); }
Source:
<code>private void audit(Context ctx, Object result, String cmd, Multimap<String, ?> params) { <START> final long created = ctx == null ? TimeUtil.nowMs() : ctx.created; <END> final SshSession session = ctx == null ? null : ctx.getSession(); final String sid = session == null ? null : IdGenerator.format(session.getSessionId()); final CurrentUser user = session == null ? null : session.getCurrentUser(); auditService.dispatch(new SshAuditEvent(sid, user, cmd, created, params, result)); }</code><technical_language>code is more compat straightforward more obscure. recurrent of form: x = y == z ? a:b ... method hard read :-( Previous form possibly longer more "self-describing" function names. sacrify readbility for a more compact code</technical_language>

Target:
private void audit(Context ctx, Object result, String cmd, Multimap<String, ?> params) { final SshSession session = ctx == null ? null : ctx.getSession(); auditService.dispatch(new SshAuditEvent(extractSessionId(session), extractCurrentUser(session), cmd, extractCreated(ctx), params, result)); }
Source:
<code>public Iterable<ConstraintViolation<?>> validateCustomAttributes(RemoteDataSetDef dataSetDef, Object... params) { <START> Set<ConstraintViolation<RemoteDataSetDef>> _violations = validator.validate(dataSetDef, <END> RemoteDataSetDefValidation.class, SQLDataSetDefValidation.class, SQLDataSetDefDbSQLValidation.class); return toIterable(_violations); }</code><technical_language>suggestion Set<ConstraintViolation<RemoteDataSetDef>> violations = validator.validate(dataSetDef,</technical_language>

Target:
public Iterable<ConstraintViolation<?>> validateCustomAttributes(RemoteDataSetDef dataSetDef, Object... params) { Set<ConstraintViolation<RemoteDataSetDef>> violations = validator.validate(dataSetDef, RemoteDataSetDefValidation.class, SQLDataSetDefValidation.class, SQLDataSetDefDbSQLValidation.class); return toIterable(violations); }
Source:
<code>private void setHostHeader(String hostHeader) { <START> if (Boolean.TRUE.equals(getInherit())) { <END> return; } if (!hostHeader.trim().isEmpty()) { Map<String, String> headers = Optional.ofNullable(getHeaders()).orElseGet(LinkedHashMap::new); headers.put(HttpHeaders.HOST, hostHeader); setHeaders(headers); } }</code><technical_language>this</technical_language>

Target:
private void setHostHeader(String hostHeader) { if (!hostHeader.trim().isEmpty()) { Map<String, String> headers = Optional.ofNullable(getHeaders()).orElseGet(LinkedHashMap::new); headers.put(HttpHeaders.HOST, hostHeader); setHeaders(headers); } }
Source:
<code>protected void endWithFailure() { <START> vmPoolMonitor.startingVmCompleted(getVmId(), "endWithFailure"); <END> if (shouldEndSnapshotCreation()) { ActionReturnValue actionReturnValue = backend.endAction(ActionType.CreateSnapshotForVm, getParameters().getImagesParameters().get(0), cloneContext().withoutExecutionContext() .withoutLock()); setSucceeded(actionReturnValue.getSucceeded()); } else { super.endWithFailure(); } }</code><technical_language>if (getVm().getVmPoolId() != null)</technical_language>

Target:
protected void endWithFailure() { if (shouldEndSnapshotCreation()) { ActionReturnValue actionReturnValue = backend.endAction(ActionType.CreateSnapshotForVm, getParameters().getImagesParameters().get(0), cloneContext().withoutExecutionContext() .withoutLock()); setSucceeded(actionReturnValue.getSucceeded()); } else { super.endWithFailure(); } if (getVm().getVmPoolId() != null) { vmPoolMonitor.startingVmCompleted(getVmId(), "endWithFailure"); } }
Source:
<code>protected void init(final Repository repository, final String gitDir) { try { final String outputEncoding = repository != null ? repository .getConfig().getString("i18n", null, "logOutputEncoding") : null; <START> if (ins == null) { <END> ins = new FileInputStream(FileDescriptor.in); } if (outs == null) outs = new FileOutputStream(FileDescriptor.out); BufferedWriter bufw; if (outputEncoding != null) bufw = new BufferedWriter(new OutputStreamWriter(outs, outputEncoding)); else bufw = new BufferedWriter(new OutputStreamWriter(outs)); out = new PrintWriter(bufw); outw = new ThrowingPrintWriter(bufw); if (err == null) { err = System.err; } } catch (IOException e) { throw die(CLIText.get().cannotCreateOutputStream); } if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
protected void init(final Repository repository, final String gitDir) { try { final String outputEncoding = repository != null ? repository .getConfig().getString("i18n", null, "logOutputEncoding") : null; if (ins == null) ins = new FileInputStream(FileDescriptor.in); if (outs == null) outs = new FileOutputStream(FileDescriptor.out); BufferedWriter bufw; if (outputEncoding != null) bufw = new BufferedWriter(new OutputStreamWriter(outs, outputEncoding)); else bufw = new BufferedWriter(new OutputStreamWriter(outs)); out = new PrintWriter(bufw); outw = new ThrowingPrintWriter(bufw); if (err == null) err = System.err; } catch (IOException e) { throw die(CLIText.get().cannotCreateOutputStream); } if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }
Source:
<code>private List<String> getAssignedVariablesNames(StatementTree currentStatement) { ExpressionTree variable = null; if (currentStatement.is(Kind.EXPRESSION_STATEMENT)) { ExpressionTree expression = ((ExpressionStatementTree) currentStatement).expression(); if (expression instanceof AssignmentExpressionTree) { variable = ((AssignmentExpressionTree) expression).variable(); } else if (expression.is(Kind.ASSIGNMENT_BY_REFERENCE)) { variable = ((AssignmentByReferenceTree) expression).variable(); } } <START> List<String> names = new LinkedList<>(); <END> if (variable != null) { if (variable.is(Kind.VARIABLE_IDENTIFIER)) { names.add(((VariableIdentifierTree) variable).variableExpression().text()); } else if (variable.is(Kind.LIST_EXPRESSION)) { names.addAll(getVariablesFromList((ListExpressionTree) variable)); } } return names; }</code><technical_language>@vilchik-elena LinkedList is default choice for a list</technical_language>

Target:
private List<String> getAssignedVariablesNames(StatementTree currentStatement) { ExpressionTree variable = null; if (currentStatement.is(Kind.EXPRESSION_STATEMENT)) { ExpressionTree expression = ((ExpressionStatementTree) currentStatement).expression(); if (expression instanceof AssignmentExpressionTree) { variable = ((AssignmentExpressionTree) expression).variable(); } else if (expression.is(Kind.ASSIGNMENT_BY_REFERENCE)) { variable = ((AssignmentByReferenceTree) expression).variable(); } } List<String> names = new ArrayList<>(); if (variable != null) { if (variable.is(Kind.VARIABLE_IDENTIFIER)) { names.add(((VariableIdentifierTree) variable).variableExpression().text()); } else if (variable.is(Kind.LIST_EXPRESSION)) { names.addAll(getVariablesFromList((ListExpressionTree) variable)); } } return names; }
Source:
<code>public String enqueueSetDeviceLifecycleStatusRequest(final String organisationIdentification, final String deviceIdentification, final DeviceLifecycleStatus deviceLifecycleStatus) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.domainHelperService.findActiveDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.SET_DEVICE_LIFECYCLE_STATUS); <START> LOGGER.debug("enqueueSetDeviceLifecycleStatusRequest called with organisation and device {}", <END> organisationIdentification, deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus newDeviceLifecycleStatus = com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus .valueOf(deviceLifecycleStatus.name()); final CommonRequestMessage message = new CommonRequestMessage( CommonRequestMessageType.SET_DEVICE_LIFECYCLE_STATUS, correlationUid, organisationIdentification, deviceIdentification, newDeviceLifecycleStatus, null); this.commonRequestMessageSender.send(message); return correlationUid; }</code><technical_language>log deviceIdentification deviceLifecycleStatus</technical_language>

Target:
public String enqueueSetDeviceLifecycleStatusRequest(final String organisationIdentification, final String deviceIdentification, final DeviceLifecycleStatus deviceLifecycleStatus) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.domainHelperService.findActiveDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.SET_DEVICE_LIFECYCLE_STATUS); LOGGER.debug( "enqueueSetDeviceLifecycleStatusRequest called with organisation {}, deviceLifecycleStatus and deviceIdentifcation {}", organisationIdentification, deviceLifecycleStatus.name(), deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus newDeviceLifecycleStatus = com.alliander.osgp.domain.core.valueobjects.DeviceLifecycleStatus .valueOf(deviceLifecycleStatus.name()); final CommonRequestMessage message = new CommonRequestMessage( CommonRequestMessageType.SET_DEVICE_LIFECYCLE_STATUS, correlationUid, organisationIdentification, deviceIdentification, newDeviceLifecycleStatus, null); this.commonRequestMessageSender.send(message); return correlationUid; }
Source:
<code>public static String readLine(Reader in, int sizeHint) throws IOException { StringBuilder buf = sizeHint > 0 ? new StringBuilder(sizeHint) : new StringBuilder(); int i; <START> while ((i = in.read()) != -1) { <END> char c = (char) i; buf.append(c); if (c == '\n') { break; } } return buf.toString(); }</code><technical_language>Ugh. If underlying stream a BufferedReader, this efficient. a BufferedReader able mark(), read a char[], scan for \n, copy StringBuilder range scanned, reset skip BufferedReader advance it. is overkill BufferedReader. depends frequency calling it. I suspect single character read is fine long a BufferedReader</technical_language>

Target:
public static String readLine(Reader in, int sizeHint) throws IOException { if (in.markSupported()) { if (sizeHint <= 0) { sizeHint = 1024; } StringBuilder sb = new StringBuilder(sizeHint); char[] buf = new char[sizeHint]; while (true) { in.mark(sizeHint); int n = in.read(buf); for (int i = 0; i < n; i++) { if (buf[i] == '\n') { in.reset(); skipFully(in, ++i); sb.append(buf, 0, i); return sb.toString(); } } if (n > 0) { sb.append(buf, 0, n); } if (n < buf.length) { in.reset(); skipFully(in, n); return sb.toString(); } } } else { StringBuilder buf = sizeHint > 0 ? new StringBuilder(sizeHint) : new StringBuilder(); int i; while ((i = in.read()) != -1) { char c = (char) i; buf.append(c); if (c == '\n') { break; } } return buf.toString(); } }
Source:
<code>public OrcishMine(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}"); this.subtype.add(SubType.AURA); TargetPermanent auraTarget = new TargetLandPermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.DestroyPermanent)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.ORE.createInstance(3)), "with three ore counters on it")); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), TargetController.YOU, false)); <START> this.addAbility(new BecomesTappedAttachedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), "enchanted land", false)); <END> this.addAbility(new OrcishMineAbility()); }</code><technical_language>triggered ability, I is annoying do. wondering if a combined triggered ability class for this sort of thing</technical_language>

Target:
public OrcishMine(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}"); this.subtype.add(SubType.AURA); TargetPermanent auraTarget = new TargetLandPermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.DestroyPermanent)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.ORE.createInstance(3)), "with three ore counters on it")); this.addAbility(new OrTriggeredAbility(Zone.BATTLEFIELD, new RemoveCounterSourceEffect(CounterType.ORE.createInstance()), new BeginningOfUpkeepTriggeredAbility(null, TargetController.YOU, false), new BecomesTappedAttachedTriggeredAbility(null, "enchanted land"))); this.addAbility(new OrcishMineAbility()); }
Source:
<code>public MapSqlParameterMapper<GlusterHookEntity> getBatchMapper() { <START> throw new RuntimeException("Unsupported operation"); <END> }</code><technical_language>please NotImplementedException()</technical_language>

Target:
public MapSqlParameterMapper<GlusterHookEntity> getBatchMapper() { throw new NotImplementedException("Unsupported operation"); }
Source:
<code>public static String computeHash(InputStream stream, long length) throws IOException { int chunkSizeForFile = (int) Math.min(HASH_CHUNK_SIZE, length); byte[] chunkBytes = new byte[(int) Math.min(2 * HASH_CHUNK_SIZE, length)]; DataInputStream in = new DataInputStream(stream); in.readFully(chunkBytes, 0, chunkSizeForFile); long position = chunkSizeForFile; long tailChunkPosition = length - chunkSizeForFile; <START> while (position < tailChunkPosition && (position += in.skip(tailChunkPosition - position)) >= 0); <END> in.readFully(chunkBytes, chunkSizeForFile, chunkBytes.length - chunkSizeForFile); long head = computeHashForChunk(ByteBuffer.wrap(chunkBytes, 0, chunkSizeForFile)); long tail = computeHashForChunk(ByteBuffer.wrap(chunkBytes, chunkBytes.length - chunkSizeForFile, chunkSizeForFile)); in.close(); return String.format("%016x", length + head + tail); }</code><technical_language>this line work? a loop do</technical_language>

Target:
public static String computeHash(InputStream stream, long length) throws IOException { int chunkSizeForFile = (int) Math.min(HASH_CHUNK_SIZE, length); byte[] chunkBytes = new byte[(int) Math.min(2 * HASH_CHUNK_SIZE, length)]; long head; long tail; try (DataInputStream in = new DataInputStream(stream)) { in.readFully(chunkBytes, 0, chunkSizeForFile); long position = chunkSizeForFile; long tailChunkPosition = length - chunkSizeForFile; while (position < tailChunkPosition && (position += in.skip(tailChunkPosition - position)) >= 0); in.readFully(chunkBytes, chunkSizeForFile, chunkBytes.length - chunkSizeForFile); head = computeHashForChunk(ByteBuffer.wrap(chunkBytes, 0, chunkSizeForFile)); tail = computeHashForChunk(ByteBuffer.wrap(chunkBytes, chunkBytes.length - chunkSizeForFile, chunkSizeForFile)); } return String.format("%016x", length + head + tail); }
Source:
<code>public void noNavigatorSomeFactoryInstalled() throws Exception { assertThat(ExtensionList.lookup(SCMNavigatorDescriptor.class), contains(instanceOf(SingleSCMNavigator.DescriptorImpl.class))); assertThat(ExtensionList.lookup(MultiBranchProjectFactoryDescriptor.class), <START> contains(instanceOf(OrganizationFolderTest.MockFactoryDescriptor.class))); <END> assertThat(newItemTypes(), containsInAnyOrder()); }</code><technical_language>For example in this case I suggestion contains(ExtensionList.lookupSingleton(NoNavigatorSomeFactoryInstalledDescriptor.class)));</technical_language>

Target:
public void noNavigatorSomeFactoryInstalled() throws Exception { assumeThat(ExtensionList.lookup(SCMNavigatorDescriptor.class), hasSize(1)); assumeThat(ExtensionList.lookup(SCMNavigatorDescriptor.class).get(0).getClass(), is(SingleSCMNavigator.DescriptorImpl.class)); assumeThat(ExtensionList.lookup(MultiBranchProjectFactoryDescriptor.class), hasSize(1)); assertThat(newItemTypes(), containsInAnyOrder()); }
Source:
<code>protected Completion createCompletion() { Completion completion = new TimeStressorCompletion(duration); <START> if (numOperations > 0) { <END> long countPerNode = numOperations / getExecutingSlaves().size(); long modCountPerNode = numOperations % getExecutingSlaves().size(); if (getExecutingSlaveIndex() + 1 <= modCountPerNode) { countPerNode++; } completion = new CountStressorCompletion(countPerNode); } return completion; }</code><technical_language>Please put creation of TimeStressorCompletion else branch (you omit variable return new instance right away)</technical_language>

Target:
protected Completion createCompletion() { if (numOperations > 0) { long countPerNode = numOperations / getExecutingSlaves().size(); long modCountPerNode = numOperations % getExecutingSlaves().size(); if (getExecutingSlaveIndex() + 1 <= modCountPerNode) { countPerNode++; } return new CountStressorCompletion(countPerNode); } else { return new TimeStressorCompletion(duration); } }
Source:
<code>public void putAll(Map<Term, Term> map) { Preconditions.checkArgument(!setEntries, "Cannot put in new key-value pair once the entries are set."); <START> for (Map.Entry<Term, Term> e : map.entrySet()) { <END> entries.put(e.getKey(), e.getValue()); } }</code><technical_language>entires.putAll(map)</technical_language>

Target:
public void putAll(Map<Term, Term> map) { entries.putAll(map); }
Source:
<code>protected List<Properties> createSweeperJobProps(String topic, Path inputDir, Path outputDir, FileSystem fs, CamusSweeperMetrics metrics) throws IOException { LOG.info("creating hourly sweeper job props: topic=" + topic + ", inputDir=" + inputDir + ", outputDir=" + outputDir); List<Properties> jobPropsList = new ArrayList<Properties>(); if (!fs.exists(inputDir)) { LOG.warn("inputdir " + inputDir + " does not exist. Skipping topic " + topic); return jobPropsList; } <START> for (FileStatus f : fs.globStatus(new Path(inputDir, "* *"))) { <END> DateTime folderHour = getFolderHour(f.getPath(), inputDir); if (shouldProcessHour(folderHour)) { Properties jobProps = createJobProps(topic, f.getPath(), folderHour, outputDir, fs, metrics); if (jobProps != null) { jobPropsList.add(jobProps); } } } return jobPropsList; }</code><technical_language>Ditto. string defined a constant variable</technical_language>

Target:
protected List<Properties> createSweeperJobProps(String topic, Path inputDir, Path outputDir, FileSystem fs, CamusSweeperMetrics metrics) throws IOException { LOG.info("creating hourly sweeper job props: topic=" + topic + ", inputDir=" + inputDir + ", outputDir=" + outputDir); List<Properties> jobPropsList = new ArrayList<Properties>(); if (!fs.exists(inputDir)) { LOG.warn("inputdir " + inputDir + " does not exist. Skipping topic " + topic); return jobPropsList; } for (FileStatus f : fs.globStatus(new Path(inputDir, HOURLY_FOLDER_STRUCTURE))) { DateTime folderHour = getFolderHour(f.getPath(), inputDir); if (shouldProcessHour(folderHour)) { Properties jobProps = createJobProps(topic, f.getPath(), folderHour, outputDir, fs, metrics); if (jobProps != null) { jobPropsList.add(jobProps); } } } return jobPropsList; }
Source:
<code>private IgniteCache<Integer, BinaryObject> populateCache(Ignite ignite) { CacheConfiguration<Integer, BinaryObject> cacheConfiguration = new CacheConfiguration<>(); cacheConfiguration.setName("TEST_" + UUID.randomUUID()); IgniteCache<Integer, BinaryObject> cache = ignite.createCache(cacheConfiguration).withKeepBinary(); BinaryObjectBuilder builder = ignite.binary().builder("testType"); for (int i = 0; i < NUMBER_OF_SAMPLES; i++) { BinaryObject value = builder.setField("label", (i < HALF)? 0.0 : 1.0) <START> .setField("feat1", new Random().nextDouble()) <END> .build(); cache.put(i, value); } return cache; }</code><technical_language>I suggest put (i / HALF) (i.e. for i < 0, for i >= 1) "feat1" instead of random value, check assertTrue(kmdl.predict(VectorUtils.num2Vec(0.0)) == 0.0); fail</technical_language>

Target:
private IgniteCache<Integer, BinaryObject> populateCache(Ignite ignite) { CacheConfiguration<Integer, BinaryObject> cacheConfiguration = new CacheConfiguration<>(); cacheConfiguration.setName("TEST_" + UUID.randomUUID()); IgniteCache<Integer, BinaryObject> cache = ignite.createCache(cacheConfiguration).withKeepBinary(); BinaryObjectBuilder builder = ignite.binary().builder("testType"); for (int i = 0; i < NUMBER_OF_SAMPLES; i++) { if (i < HALF) cache.put(i, builder.setField("feature1", 0.0).setField("label", 0.0).build()); else cache.put(i, builder.setField("feature1", 10.0).setField("label", 1.0).build()); } return cache; }
Source:
<code><START> public List<ClusterNode> mapKeyToPrimaryAndBackupsList(K key) { <END> A.notNull(key, "key"); return cctx.affinity().nodesByPartition(partition(key), topologyVersion()); }</code><technical_language>Please, write in line: @Override public reason copy-paste implementation mapKeyToPrimaryAndBackupsList</technical_language>

Target:
@Override public List<ClusterNode> mapKeyToPrimaryAndBackupsList(K key) { A.notNull(key, "key"); return cctx.affinity().nodesByPartition(partition(key), topologyVersion()); }
Source:
<code>public void shouldResolveHistoricTaskAuthorization_HistoricProcessInstance() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setUserId("myUserId"); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); String processInstanceId = processInstance.getProcessInstanceId(); authorization.setResourceId(processInstanceId); authorizationService.saveAuthorization(authorization); Date removalTime = addDays(START_DATE, 5); assertThat(authorization.getRootProcessInstanceId(), is(processInstance.getRootProcessInstanceId())); assertThat(authorization.getRemovalTime(), is(removalTime)); <START> clearAuthorization(); <END> }</code><technical_language>@After method clears authorizations if assert statement fails</technical_language>

Target:
public void shouldResolveHistoricTaskAuthorization_HistoricProcessInstance() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setUserId("myUserId"); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); String processInstanceId = processInstance.getProcessInstanceId(); authorization.setResourceId(processInstanceId); authorizationService.saveAuthorization(authorization); Date removalTime = addDays(START_DATE, 5); assertThat(authorization.getRootProcessInstanceId(), is(processInstance.getRootProcessInstanceId())); assertThat(authorization.getRemovalTime(), is(removalTime)); }
Source:
<code>public void shutdownApp(EmbeddedAppHandleImpl app, ShutdownMode shutdownMode) { if (shutdownMode != ShutdownMode.KILL) { <START> app.controller.shutdown(); <END> } else { throw new UnsupportedOperationException("Kill not supported"); } }</code><technical_language>is equivalent kill. is waiting for undeploy etc</technical_language>

Target:
public void shutdownApp(EmbeddedAppHandleImpl app, ShutdownMode shutdownMode) throws LauncherException { if (shutdownMode != ShutdownMode.KILL) { app.controller.shutdown(); } else { throw new UnsupportedOperationException("Kill not supported"); } }
Source:
<code><START> public void notify(Member member, String message) { <END> Member intramurals = (Member) new MemberDao().getMemberByUsername("Intramurals"); save(new Message(message, "", intramurals, member).setSent(true)); }</code><technical_language>is this method meant for? is "Intramurals" username</technical_language>

Target:
public boolean notify(Member member, String message) { if (message.length() > 100) return false; Member intramurals = (Member) new MemberDao().getMemberByUsername("Intramurals"); merge(new Message(message, "", intramurals, member).setSent(true)); return true; }
Source:
<code>public void write(Object datum) throws IOException { if (!opened) { throw new IOException(MESSAGES.getMessage("error.writerNotOpened")); } result.totalCount++; if (datum == null) { return; } IndexedRecord record = getFactory(datum).convertToAvro(datum); if (dataSchema == null) { dataSchema = record.getSchema(); Field jsonField = dataSchema.getField("json"); if (jsonField == null) { throw new IOException(MESSAGES.getMessage("error.schemaNotContainJson")); } jsonPos = jsonField.pos(); } String json = (String) record.get(jsonPos); try { validateRequestBody(json); } catch (DataRejectException e) { throw createRejectException("error.invalidRecordCreate", json, (String) e.getRejectInfo().get("message")); <START> } <END> JiraResponse response = getConnection().post(resource, json); handleResponse(response, json, record); }</code><technical_language>This is in JiraUpdateWriter. I suggest put Reject Exception creation validateRequestBody() method. Here, leave a call validateRequestBody(json);</technical_language>

Target:
public void write(Object datum) throws IOException { if (!opened) { throw new IOException(MESSAGES.getMessage("error.writerNotOpened")); } result.totalCount++; if (datum == null) { return; } IndexedRecord record = getFactory(datum).convertToAvro(datum); if (dataSchema == null) { dataSchema = record.getSchema(); Field jsonField = dataSchema.getField("json"); if (jsonField == null) { throw new IOException(MESSAGES.getMessage("error.schemaNotContainJson")); } jsonPos = jsonField.pos(); } String json = (String) record.get(jsonPos); validateRequestBody(json); JiraResponse response = getConnection().post(resource, json); handleResponse(response, json, record); }
Source:
<code>public void testFailsIfInjectingScopedDirectlyWhenItIsntBound() { try { Guice.createInjector(new AbstractModule() { @Override protected void configure() { binder().requireExplicitBindings(); bind(Foo.class).to(ScopedFooImpl.class); bind(WantsScopedFooImpl.class); } }); fail(); } catch(CreationException expected) { <START> assertContains(expected.getMessage(), "\n1) " + jitFailed(ScopedFooImpl.class)); <END> assertTrue(expected.getMessage(), !expected.getMessage().contains("\n2) ")); } }</code><technical_language>Ha. change assertEquals(1, expected.getErrorMessages().size()) ? ... I do in place</technical_language>

Target:
public void testFailsIfInjectingScopedDirectlyWhenItIsntBound() { try { Guice.createInjector(new AbstractModule() { @Override protected void configure() { binder().requireExplicitBindings(); bind(Foo.class).to(ScopedFooImpl.class); bind(WantsScopedFooImpl.class); } }); fail(); } catch(CreationException expected) { assertContains(expected.getMessage(), jitFailed(ScopedFooImpl.class)); assertEquals(1, expected.getErrorMessages().size()); } }
Source:
<code>protected void executeCommand() { StorageDomainDR storageDomainDR = storageDomainDRDao.get(getParameters().getStorageDomainId(), getParameters().getGeoRepSessionId()); if (storageDomainDR == null) { storageDomainDR = new StorageDomainDR(); storageDomainDR.setStorageDomainId(getParameters().getStorageDomainId()); storageDomainDR.setGeoRepSessionId(getParameters().getGeoRepSessionId()); } else { if (storageDomainDR.getJobId() != null) { schedulerUtil.deleteJob(storageDomainDR.getJobId()); } } if (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE) { String jobId = <START> schedulerUtil.scheduleACronJob(Injector.get(GlusterStorageDomainDRSyncJob.class), <END> "syncData", new Class[] { String.class, String.class }, new Object[] { getParameters().getStorageDomainId().toString(), getParameters().getGeoRepSessionId().toString() }, getParameters().getSchedule().getCronExpression()); storageDomainDR.setScheduleCronExpression(getParameters().getSchedule().getCronExpression()); storageDomainDR.setJobId(jobId); storageDomainDRDao.saveOrUpdate(storageDomainDR); } else { storageDomainDRDao.remove(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()); } setSucceeded(true); }</code><technical_language>inject this a dependency of class ? (same DBSchedulerUtilQuartzImpl)</technical_language>

Target:
protected void executeCommand() { StorageDomainDR storageDomainDR = storageDomainDRDao.get(getParameters().getStorageDomainId(), getParameters().getGeoRepSessionId()); if (storageDomainDR == null) { storageDomainDR = new StorageDomainDR(); storageDomainDR.setStorageDomainId(getParameters().getStorageDomainId()); storageDomainDR.setGeoRepSessionId(getParameters().getGeoRepSessionId()); } else { if (storageDomainDR.getJobId() != null) { schedulerUtil.deleteJob(storageDomainDR.getJobId()); } } if (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE) { String jobId = schedulerUtil.scheduleACronJob(GlusterStorageDomainDRSyncJob.class, "syncData", new Class[] { String.class, String.class }, new Object[] { getParameters().getStorageDomainId().toString(), getParameters().getGeoRepSessionId().toString() }, getParameters().getSchedule().getCronExpression()); storageDomainDR.setScheduleCronExpression(getParameters().getSchedule().getCronExpression()); storageDomainDR.setJobId(jobId); storageDomainDRDao.saveOrUpdate(storageDomainDR); } else { storageDomainDRDao.remove(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()); } setSucceeded(true); }
Source:
<code>public static final byte[] readFully(final File path, final int max) throws FileNotFoundException, IOException { final FileInputStream in = new FileInputStream(path); try { long sz = Math.max(path.length(), 1); if (sz > max) throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); byte[] buf = new byte[(int) sz]; int valid = 0; for (;;) { if (buf.length == valid) { if (buf.length == max) { int next = in.read(); if (next < 0) break; throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); } <START> byte[] nb = new byte[buf.length * 2]; <END> System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } int n = in.read(buf, valid, buf.length - valid); if (n < 0) break; valid += n; } if (valid < buf.length) { byte[] nb = new byte[valid]; System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } return buf; } finally { try { in.close(); } catch (IOException ignored) { } } }</code><technical_language>This capped max, so: byte[] nb = new byte[Math.min(buf.length * 2, max)];</technical_language>

Target:
public static final byte[] readFully(final File path, final int max) throws FileNotFoundException, IOException { final FileInputStream in = new FileInputStream(path); try { long sz = Math.max(path.length(), 1); if (sz > max) throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); byte[] buf = new byte[(int) sz]; int valid = 0; for (;;) { if (buf.length == valid) { if (buf.length == max) { int next = in.read(); if (next < 0) break; throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); } byte[] nb = new byte[Math.min(buf.length * 2, max)]; System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } int n = in.read(buf, valid, buf.length - valid); if (n < 0) break; valid += n; } if (valid < buf.length) { byte[] nb = new byte[valid]; System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } return buf; } finally { try { in.close(); } catch (IOException ignored) { } } }
Source:
<code>public ArrayList<Order> findOrderInList(String symbol, ArrayList<Order> list) { <START> ArrayList<Order> order = new ArrayList<Order>(); <END> for (Order o: list) { if (o.getStockSymbol().equals(symbol)) { order.add(o); } } return order; }</code><technical_language>Variable name unclear, singular "order" refer a list of orders</technical_language>

Target:
public ArrayList<Order> findOrderInList(String symbol, ArrayList<Order> list) { ArrayList<Order> orderList = new ArrayList<Order>(); for (Order o: list) { if (o.getStockSymbol().equals(symbol)) { orderList.add(o); } } return orderList; }
Source:
<code>public char getLegacyChar() { <START> return '�'; <END> }</code><technical_language>commit this change</technical_language>

Target:
public char getLegacyChar() { return '§'; }
Source:
<code>public ZestStatement deepCopy() { ZestAssignFromElement zestAssignFromElement = new ZestAssignFromElement(this.getVariableName()); zestAssignFromElement.filterElementName = this.filterElementName; zestAssignFromElement.elementNameFilter = this.elementNameFilter; <START> zestAssignFromElement.filterAttributeValue = this.filterAttributeValue; <END> zestAssignFromElement.attributeNameFilter = this.attributeNameFilter; zestAssignFromElement.attributeValueFilter = this.attributeValueFilter; zestAssignFromElement.attributeValueFilterFlags = this.attributeValueFilterFlags; zestAssignFromElement.reverseFilteredElements = this.reverseFilteredElements; zestAssignFromElement.elementIndex = this.elementIndex; zestAssignFromElement.returnElement = this.returnElement; zestAssignFromElement.returnAttribute = this.returnAttribute; zestAssignFromElement.returnedAttributeName = this.returnedAttributeName; return zestAssignFromElement; }</code><technical_language>"copy" attributeValueFilterPattern, immutable</technical_language>

Target:
public ZestStatement deepCopy() { ZestAssignFromElement zestAssignFromElement = new ZestAssignFromElement(this.getVariableName()); zestAssignFromElement.filterElementName = this.filterElementName; zestAssignFromElement.elementNameFilter = this.elementNameFilter; zestAssignFromElement.filterAttributeValue = this.filterAttributeValue; zestAssignFromElement.attributeNameFilter = this.attributeNameFilter; zestAssignFromElement.attributeValueFilter = this.attributeValueFilter; zestAssignFromElement.attributeValueFilterFlags = this.attributeValueFilterFlags; zestAssignFromElement.attributeValueFilterPattern = this.attributeValueFilterPattern; zestAssignFromElement.reverseFilteredElements = this.reverseFilteredElements; zestAssignFromElement.elementIndex = this.elementIndex; zestAssignFromElement.returnElement = this.returnElement; zestAssignFromElement.returnAttribute = this.returnAttribute; zestAssignFromElement.returnedAttributeName = this.returnedAttributeName; return zestAssignFromElement; }
Source:
<code><START> public Map<String, String> getEmailToNameTableFromRoster() { <END> Map<String, String> commentGiverEmailNameTable = new HashMap<>(); List<InstructorAttributes> instructorList = getInstructors(); for (InstructorAttributes instructor : instructorList) { commentGiverEmailNameTable.put(instructor.email, instructor.name); } List<StudentAttributes> studentList = getStudents(); for (StudentAttributes student : studentList) { commentGiverEmailNameTable.put(student.email, student.name); } return commentGiverEmailNameTable; }</code><technical_language>A more proper abstraction expose Map interface. public String getNameByEmail() { // .... }</technical_language>

Target:
public Map<String, String> getEmailToNameTableFromRoster() { Map<String, String> emailToNameTable = new HashMap<>(); List<InstructorAttributes> instructorList = getInstructors(); for (InstructorAttributes instructor : instructorList) { emailToNameTable.put(instructor.email, instructor.name); } List<StudentAttributes> studentList = getStudents(); for (StudentAttributes student : studentList) { emailToNameTable.put(student.email, student.name); } return emailToNameTable; }
Source:
<code>public synchronized void modified(Map<String, Object> config) { String defaultInterfaceConfig = (String) config.get(PRIMARY_ADDRESS); <START> if (defaultInterfaceConfig == null || defaultInterfaceConfig.equals("")) { <END> primaryAddress = NetUtil.getLocalIpv4HostAddress(); } else { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); String[] addrString = primaryAddressConf.split("/"); if (addrString.length > 1) { String ip = getIPv4inSubnet(primaryAddressConf); if (ip == null) { LOGGER.warn("Error in IP configuration, will continue to use first interface"); NetUtil.getLocalIpv4HostAddress(); } else { primaryAddress = ip; } } else { primaryAddress = addrString[0]; } } }</code><technical_language>isEmpty()</technical_language>

Target:
public synchronized void modified(Map<String, Object> config) { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); if (primaryAddressConf == null || primaryAddressConf.isEmpty() || !isValidIPConfig(primaryAddressConf)) { primaryAddress = getFirstLocalIPv4Address(); } else { primaryAddress = primaryAddressConf; } }
Source:
<code>private void updateLanguageEntriesSupported(List<PageTitle> languageEntries) { boolean haveChineseEntry = false; for (ListIterator<PageTitle> it = languageEntries.listIterator(); it.hasNext();) { PageTitle link = it.next(); String languageCode = link.getWikiSite().languageCode(); <START> if (link.isMainPage()) { link = new PageTitle(MainPageNameData.valueFor(languageCode), app.getWikiSite()); } <END> if (GOTHIC_LANGUAGE_CODE.equals(languageCode)) { it.remove(); } else if ("be-x-old".equals(languageCode)) { it.remove(); it.add(new PageTitle(link.getText(), WikiSite.forLanguageCode("be-tarask"))); } else if (AppLanguageLookUpTable.CHINESE_LANGUAGE_CODE.equals(languageCode)) { haveChineseEntry = true; it.remove(); for (String dialect : Arrays.asList(AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE, AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE)) { it.add(new PageTitle((title.isMainPage()) ? MainPageNameData.valueFor(dialect) : link.getText(), WikiSite.forLanguageCode(dialect))); } } } if (!haveChineseEntry) { addChineseEntriesIfNeeded(title, languageEntries); } }</code><technical_language>this part do anything? assigning a new PageTitle a local variable, this replace actual list item new title, this assignment is lost. anyway, this necessary, either</technical_language>

Target:
private void updateLanguageEntriesSupported(List<PageTitle> languageEntries) { boolean haveChineseEntry = false; for (ListIterator<PageTitle> it = languageEntries.listIterator(); it.hasNext();) { PageTitle link = it.next(); String languageCode = link.getWikiSite().languageCode(); if (GOTHIC_LANGUAGE_CODE.equals(languageCode)) { it.remove(); } else if ("be-x-old".equals(languageCode)) { it.remove(); it.add(new PageTitle(link.getText(), WikiSite.forLanguageCode("be-tarask"))); } else if (AppLanguageLookUpTable.CHINESE_LANGUAGE_CODE.equals(languageCode)) { haveChineseEntry = true; it.remove(); for (String dialect : Arrays.asList(AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE, AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE)) { it.add(new PageTitle((title.isMainPage()) ? MainPageNameData.valueFor(dialect) : link.getText(), WikiSite.forLanguageCode(dialect))); } } } if (!haveChineseEntry) { addChineseEntriesIfNeeded(title, languageEntries); } }
Source:
<code>protected List<Person> getOptions(CharSequence constraint) { PatientController patientController = getMuzimaApplicationContext().getPatientController(); PersonController personController = getMuzimaApplicationContext().getPersonController(); List<Person> personList = new ArrayList<>(); try { List<Patient> patientList; if (searchRemote) { <START> patientList = patientController.searchPatientOnServer(constraint.toString()); <END> } else { personList = personController.searchPersonLocally(constraint.toString()); patientList = patientController.searchPatientLocally(constraint.toString(), null); } for (Patient patient : patientList) { if (personController.getPersonByUuid(patient.getUuid()) == null) personList.add(patient); } } catch (PersonController.PersonLoadException | PatientController.PatientLoadException e) { Log.e(getClass().getSimpleName(), "Unable to search persons!", e); } return personList; }</code><technical_language>need add ability search person server</technical_language>

Target:
protected List<Person> getOptions(CharSequence constraint) { PatientController patientController = getMuzimaApplicationContext().getPatientController(); PersonController personController = getMuzimaApplicationContext().getPersonController(); List<Person> personList = new ArrayList<>(); try { List<Patient> patientList = new ArrayList<>(); if (searchRemote) { Credentials credentials = new Credentials(getContext()); Constants.SERVER_CONNECTIVITY_STATUS serverStatus = NetworkUtils.getServerStatus(getMuzimaApplicationContext(), credentials.getServerUrl()); if(serverStatus == Constants.SERVER_CONNECTIVITY_STATUS.SERVER_ONLINE) patientList = patientController.searchPatientOnServer(constraint.toString()); else connectivityFailed = true; } else { personList = personController.searchPersonLocally(constraint.toString()); patientList = patientController.searchPatientLocally(constraint.toString(), null); } for (Patient patient : patientList) { if (personController.getPersonByUuid(patient.getUuid()) == null) personList.add(patient); } } catch (PersonController.PersonLoadException | PatientController.PatientLoadException e) { Log.e(getClass().getSimpleName(), "Unable to search persons!", e); } return personList; }