auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Set<String> loadBatchOfStoredGeocodes(final Geopoint coords, final CacheType cacheType, final int listId) { if (cacheType == null) { throw new IllegalArgumentException("cacheType must not be null"); } final StringBuilder selection = new StringBuilder(); selection.append(" detailed = 1 "); String[] selectionArgs = null; if (cacheType != CacheType.ALL) { selection.append(" and type = ?"); selectionArgs = new String[] { String.valueOf(cacheType.id) }; } <START> selection.append(" and geocode in (SELECT geocode FROM " + dbTableCachesLists + " WHERE list_id "); <END> selection.append(listId != PseudoList.ALL_LIST.id ? "=" + Math.max(listId, 1) : ">= " + StoredList.STANDARD_LIST_ID); selection.append(")"); try { if (coords != null) { return queryToColl(dbTableCaches, new String[]{"geocode", "(abs(latitude-" + String.format((Locale) null, "%.6f", coords.getLatitude()) + ") + abs(longitude-" + String.format((Locale) null, "%.6f", coords.getLongitude()) + ")) as dif"}, selection.toString(), selectionArgs, "dif", null, new HashSet<String>(), GET_STRING_0); } return queryToColl(dbTableCaches, new String[] { "geocode" }, selection.toString(), selectionArgs, "geocode", null, new HashSet<String>(), GET_STRING_0); } catch (final Exception e) { Log.e("DataStore.loadBatchOfStoredGeocodes", e); return Collections.emptySet(); } }</code><technical_language>wondering of static code analysis tools complains (doing string concatenation of stringbuilder append calls is optimal for performance)</technical_language>

Target:
private static Set<String> loadBatchOfStoredGeocodes(final Geopoint coords, final CacheType cacheType, final int listId) { if (cacheType == null) { throw new IllegalArgumentException("cacheType must not be null"); } final StringBuilder selection = new StringBuilder(); selection.append(" detailed = 1 "); String[] selectionArgs = null; if (cacheType != CacheType.ALL) { selection.append(" and type = ?"); selectionArgs = new String[] { String.valueOf(cacheType.id) }; } selection.append(" and geocode in (SELECT geocode FROM "); selection.append(dbTableCachesLists); selection.append(" WHERE list_id "); selection.append(listId != PseudoList.ALL_LIST.id ? "=" + Math.max(listId, 1) : ">= " + StoredList.STANDARD_LIST_ID); selection.append(")"); try { if (coords != null) { return queryToColl(dbTableCaches, new String[]{"geocode", "(abs(latitude-" + String.format((Locale) null, "%.6f", coords.getLatitude()) + ") + abs(longitude-" + String.format((Locale) null, "%.6f", coords.getLongitude()) + ")) as dif"}, selection.toString(), selectionArgs, "dif", null, new HashSet<String>(), GET_STRING_0); } return queryToColl(dbTableCaches, new String[] { "geocode" }, selection.toString(), selectionArgs, "geocode", null, new HashSet<String>(), GET_STRING_0); } catch (final Exception e) { Log.e("DataStore.loadBatchOfStoredGeocodes", e); return Collections.emptySet(); } }
Source:
<code>static void createModelsRunner(String buildingModelId, String floorModelId, String hvacModelId, String wardModelId, Consumer<List<String>> createModelsTestRunner) { String modelBuilding = TestAssetsHelper.getBuildingModelPayload(buildingModelId, hvacModelId, floorModelId); String modelHvac = TestAssetsHelper.getHvacModelPayload(hvacModelId, floorModelId); String modelWard = TestAssetsHelper.getWardModelPayload(wardModelId); <START> List<String> modelsList = new ArrayList<>(); <END> modelsList.add(modelBuilding); modelsList.add(modelHvac); modelsList.add(modelWard); createModelsTestRunner.accept(modelsList); }</code><technical_language>do List<String> modelsList = new ArrayList<>(Arrays.asList(modelBuilding, modelHvac, modelWard))</technical_language>

Target:
static void createModelsRunner(String buildingModelId, String floorModelId, String hvacModelId, String wardModelId, Consumer<List<String>> createModelsTestRunner) { String modelBuilding = TestAssetsHelper.getBuildingModelPayload(buildingModelId, hvacModelId, floorModelId); String modelHvac = TestAssetsHelper.getHvacModelPayload(hvacModelId, floorModelId); String modelWard = TestAssetsHelper.getWardModelPayload(wardModelId); List<String> modelsList = new ArrayList<>(Arrays.asList(modelBuilding, modelHvac, modelWard)); createModelsTestRunner.accept(modelsList); }
Source:
<code>public Class<? extends Writable> getSerializedClass() { <START> LOG.debug("********" + Thread.currentThread().getStackTrace()[1].getMethodName()); <END> return ExecRowWritable.class; }</code><technical_language>LOG.isDebugEnabled() -- parameter is computed debug logging is disabled</technical_language>

Target:
public Class<? extends Writable> getSerializedClass() { if (LOG.isDebugEnabled()) LOG.debug("********" + Thread.currentThread().getStackTrace()[1].getMethodName()); return ExecRowWritable.class; }
Source:
<code>private static boolean waitAuthServerReady() throws InterruptedException { int retryTimes = 50; Request request = new Request.Builder() .post(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), "")) <START> .url(Constants.AUTH_URL) <END> .build(); while (retryTimes != 0) { Response response = null; try { response = client.newCall(request).execute(); if (response.code() == 400) { return true; } RealmLog.error("Error response from auth server: %s", response.toString()); } catch (IOException e) { Thread.sleep(100); } finally { if (response != null) { response.close(); } } retryTimes--; } return false; }</code><technical_language>change this? is strange i CI log ROS docker started/stopped correctly: + docker logs ros info: Integration test server listening on: 127.0.0.1:8888 info: Starting sync server in /tmp/ros117014-6-g5ntk9 info: info: stdout: 2017-01-14T07:37:58.674Z - [32minfo[39m: Logging file /tmp/realm-sync.log level 'all'. info: Sync server stopped info: child process exited code 0 info: Sync server stopped CI failed of waitAuthServerReady return false</technical_language>

Target:
private static boolean waitAuthServerReady() throws InterruptedException { int retryTimes = 20; Request request = new Request.Builder() .url(Constants.AUTH_SERVER_URL) .build(); while (retryTimes != 0) { Response response = null; try { response = client.newCall(request).execute(); if (response.isSuccessful()) { return true; } RealmLog.error("Error response from auth server: %s", response.toString()); } catch (IOException e) { RealmLog.error(e); Thread.sleep(500); } finally { if (response != null) { response.close(); } } retryTimes--; } return false; }
Source:
<code>public void testConnectorRestartCalled() { Properties props = new Properties(); props.setProperty("daemonThreadIntervalInSeconds", "1"); TestKafkaConnector connector = new TestKafkaConnector(false, props); DatastreamTask datastreamTask = new DatastreamTaskImpl(); connector.onAssignmentChange(Collections.singletonList(datastreamTask)); connector.start(null); PollUtils.poll(() -> connector.getCreateTaskCalled() >= 3, Duration.ofSeconds(1).toMillis(), Duration.ofSeconds(10).toMillis()); Assert.assertTrue(connector.getCreateTaskCalled() >= 3); Gauge<Long> metric = DynamicMetricsManager.getInstance() .getMetric("test" + "." + TestKafkaConnector.class.getSimpleName() + "." + "numTaskRestarts"); Assert.assertNotNull(metric); Assert.assertEquals(metric.getValue(), Long.valueOf(1)); <START> MetricsTestUtils.verifyMetrics(connector, DynamicMetricsManager.getInstance()); <END> connector.stop(); }</code><technical_language>default, this verification include metrics do start class name of metricsAware object in question, i.e. consider metric test.TestKafkaConnector.numTaskRestarts start TestKafkaConnector. include metric, need pass in a predicate explicitly includes metrics, e.g. s -> s.startsWith("test")</technical_language>

Target:
public void testConnectorRestartCalled() { Properties props = new Properties(); props.setProperty("daemonThreadIntervalInSeconds", "1"); TestKafkaConnector connector = new TestKafkaConnector(false, props); DatastreamTask datastreamTask = new DatastreamTaskImpl(); connector.onAssignmentChange(Collections.singletonList(datastreamTask)); connector.start(null); PollUtils.poll(() -> connector.getCreateTaskCalled() >= 3, Duration.ofSeconds(1).toMillis(), Duration.ofSeconds(10).toMillis()); Assert.assertTrue(connector.getCreateTaskCalled() >= 3); Gauge<Long> metric = DynamicMetricsManager.getInstance() .getMetric("test" + "." + TestKafkaConnector.class.getSimpleName() + "." + "numTaskRestarts"); Assert.assertNotNull(metric); Assert.assertEquals(metric.getValue(), Long.valueOf(1)); MetricsTestUtils.verifyMetrics(connector, DynamicMetricsManager.getInstance(), s -> s.startsWith("test")); connector.stop(); }
Source:
<code>public TaskResult cleanup(TaskRequest request) { final Path projectPath = workspace.getProjectPath(); final CommandContext commandContext = buildCommandContext(projectPath); final long attemptId = request.getAttemptId(); final long taskId = request.getTaskId(); Config state = TaskState.of(request).params(); if (state.has("commandStatus")) { logger.debug(String.format("Starting cleanup: attemptId=%d, taskId=%d", attemptId, taskId)); try { exec.cleanup(commandContext, state); } catch (IOException ex) { throw Throwables.propagate(ex); } } <START> return TaskResult.empty(request); <END> }</code><technical_language>is this line executed</technical_language>

Target:
public void cleanup(TaskRequest request) { final Path projectPath = workspace.getProjectPath(); final CommandContext commandContext = buildCommandContext(projectPath); final long attemptId = request.getAttemptId(); final long taskId = request.getTaskId(); Config state = TaskState.of(request).params(); if (state.has("commandStatus")) { logger.debug(String.format("Starting cleanup: attemptId=%d, taskId=%d", attemptId, taskId)); try { exec.cleanup(commandContext, state); } catch (Throwable e) { throw Throwables.propagate(e); } } }
Source:
<code>public ExecutableFlow getExecutableFlow(int execId) <START> throws ExecutorManagerException { <END> if (runningFlows.containsKey(execId)) { return runningFlows.get(execId).getSecond(); } else if (queuedFlowMap.containsKey(execId)) { return queuedFlowMap.get(execId).getSecond(); } else { return executorLoader.fetchExecutableFlow(execId); } }</code><technical_language>formatting is</technical_language>

Target:
public ExecutableFlow getExecutableFlow(int execId) throws ExecutorManagerException { if (runningFlows.containsKey(execId)) { return runningFlows.get(execId).getSecond(); } else if (queuedFlows.hasExecution(execId)) { return queuedFlows.getFlow(execId); } else { return executorLoader.fetchExecutableFlow(execId); } }
Source:
<code>public void setStartFinishTime(long time0, long time1) { synchronized (fListenerNotifierLock) { <START> if (fListenerNotifier != null && fListenerNotifier.hasTimeRangeUpdated()) { <END> return; } } fTime0 = time0; if (fTime0 < fTime0Bound) { fTime0 = fTime0Bound; } if (fTime0 > fTime1Bound) { fTime0 = fTime1Bound; } fTime1 = time1; if (fTime1 < fTime0Bound) { fTime1 = fTime0Bound; } if (fTime1 > fTime1Bound) { fTime1 = fTime1Bound; } if (fTime1 - fTime0 < fMinTimeInterval) { fTime1 = Math.min(fTime1Bound, fTime0 + fMinTimeInterval); } fTimeRangeFixed = true; adjustHorizontalScrollBar(); fTimeGraphCtrl.redraw(); fTimeScaleCtrl.redraw(); }</code><technical_language>reference change checks. extract a local variable first. do null-check + call. part need locking, if mark method synchronized, mentioned above, need a synchronized block all</technical_language>

Target:
public void setStartFinishTime(long time0, long time1) { if (fListenerNotifier != null && fListenerNotifier.hasTimeRangeUpdated()) { return; } fTime0 = time0; if (fTime0 < fTime0Bound) { fTime0 = fTime0Bound; } if (fTime0 > fTime1Bound) { fTime0 = fTime1Bound; } fTime1 = time1; if (fTime1 < fTime0Bound) { fTime1 = fTime0Bound; } if (fTime1 > fTime1Bound) { fTime1 = fTime1Bound; } if (fTime1 - fTime0 < fMinTimeInterval) { fTime1 = Math.min(fTime1Bound, fTime0 + fMinTimeInterval); } fTimeRangeFixed = true; adjustHorizontalScrollBar(); fTimeGraphCtrl.redraw(); fTimeScaleCtrl.redraw(); }
Source:
<code>private Plugin loadPlugin(File jarFile) throws IOException, ClassNotFoundException { Manifest jarManifest = new JarFile(jarFile).getManifest(); ClassLoader parentLoader = PluginLoader.class.getClassLoader(); ClassLoader jarClassLoader = <START> URLClassLoader.newInstance(getPluginURLs(jarFile), parentLoader); <END> Attributes attrs = jarManifest.getMainAttributes(); String pluginName = attrs.getValue("Gerrit-Plugin"); String moduleName = attrs.getValue("Gerrit-SshModule"); Class<?> moduleClass = Class.forName(moduleName, false, jarClassLoader); return new Plugin(pluginName, moduleClass); }</code><technical_language>reflection this? new URLClassLoader work</technical_language>

Target:
private Plugin loadPlugin(File jarFile) throws IOException, ClassNotFoundException { Manifest jarManifest = new JarFile(jarFile).getManifest(); ClassLoader parentLoader = PluginLoader.class.getClassLoader(); ClassLoader jarClassLoader = new URLClassLoader(getPluginURLs(jarFile), parentLoader); Attributes attrs = jarManifest.getMainAttributes(); String pluginName = attrs.getValue("Gerrit-Plugin"); String moduleName = attrs.getValue("Gerrit-SshModule"); Class<?> moduleClass = Class.forName(moduleName, false, jarClassLoader); return new Plugin(pluginName, moduleClass); }
Source:
<code>private RelCollation extendCollation(RelCollation collation, List<Integer> keys) { List<RelFieldCollation> fieldsForNewCollation = new ArrayList<>(keys.size()); fieldsForNewCollation.addAll(collation.getFieldCollations()); <START> Set<Integer> keySet = new HashSet<>(keys); <END> for (RelFieldCollation rf : collation.getFieldCollations()) { keySet.remove(rf.getFieldIndex()); } for (Integer i : keySet) { fieldsForNewCollation.add(new RelFieldCollation(i)); } return RelCollations.of(fieldsForNewCollation); }</code><technical_language>Do need keys order</technical_language>

Target:
private RelCollation extendCollation(RelCollation collation, List<Integer> keys) { List<RelFieldCollation> fieldsForNewCollation = new ArrayList<>(keys.size()); fieldsForNewCollation.addAll(collation.getFieldCollations()); ImmutableBitSet keysBitset = ImmutableBitSet.of(keys); ImmutableBitSet colKeysBitset = ImmutableBitSet.of(collation.getKeys()); ImmutableBitSet exceptBitset = keysBitset.except(colKeysBitset); for (Integer i : exceptBitset.toList()) { fieldsForNewCollation.add(new RelFieldCollation(i)); } return RelCollations.of(fieldsForNewCollation); }
Source:
<code>public GrpcBackedQueryUpdateMessage(QueryUpdate queryUpdate, Serializer serializer) { this.queryUpdate = queryUpdate; this.serializedPayload = queryUpdate.hasPayload() ? new LazyDeserializingObject<>(new GrpcSerializedObject(queryUpdate.getPayload()), serializer) : null; <START> Supplier<Object> details = serializedPayload == null <END> ? () -> null : serializedPayload::getObject; this.exception = queryUpdate.hasErrorMessage() ? ErrorCode.getFromCode(queryUpdate.getErrorCode()) .convert(queryUpdate.getErrorMessage(), details) : null; this.metaDataSupplier = new GrpcMetaData(queryUpdate.getMetaDataMap(), serializer); }</code><technical_language>Nit: details sounds a vague if ask me. suggestion Supplier<Object> exceptionDetails = serializedPayload == null</technical_language>

Target:
public GrpcBackedQueryUpdateMessage(QueryUpdate queryUpdate, Serializer serializer) { this.queryUpdate = queryUpdate; this.serializedPayload = queryUpdate.hasPayload() ? new LazyDeserializingObject<>(new GrpcSerializedObject(queryUpdate.getPayload()), serializer) : null; Supplier<Object> exceptionDetails = serializedPayload == null ? () -> null : serializedPayload::getObject; this.exception = queryUpdate.hasErrorMessage() ? ErrorCode.getFromCode(queryUpdate.getErrorCode()) .convert(queryUpdate.getErrorMessage(), exceptionDetails) : null; this.metaDataSupplier = new GrpcMetaData(queryUpdate.getMetaDataMap(), serializer); }
Source:
<code>protected String defineClassNameField(String modelFieldClassName, Map<String, String> superTypesMap) { if (SIMPLE_CLASSES_MAP.containsKey(modelFieldClassName)) { return SIMPLE_CLASSES_MAP.get(modelFieldClassName).getCanonicalName(); } <START> if (ScenarioSimulationSharedUtils.isEnum(superTypesMap.get(modelFieldClassName))) { return getFQCNByFactName(modelFieldClassName); } return modelFieldClassName; <END> }</code><technical_language>this? Is this hack enum object a field type enum itself</technical_language>

Target:
protected String defineClassNameField(String modelFieldClassName, Map<String, String> superTypesMap) { if (SIMPLE_CLASSES_MAP.containsKey(modelFieldClassName)) { return SIMPLE_CLASSES_MAP.get(modelFieldClassName).getCanonicalName(); } if (ScenarioSimulationSharedUtils.isEnumCanonicalName(superTypesMap.get(modelFieldClassName))) { return getFQCNByFactName(modelFieldClassName); } return modelFieldClassName; }
Source:
<code>public Mono<Void> runAsync() { <START> return dataLakeFileAsyncClient.append(createRandomByteBufferFlux(options.getSize()), 0, options.getSize()); <END> }</code><technical_language>@alzimmermsft: Do if randomByteBufferFlux reused in InputStream above? call runAsync() require creating a new randomByteBufferFlux</technical_language>

Target:
public Mono<Void> runAsync() { return dataLakeFileAsyncClient.append(byteBufferFlux, 0, options.getSize()); }
Source:
<code>private PretendSlave createPretendSlave(String slaveName) throws Exception { PretendSlave slave = new PretendSlave(slaveName, this.createTmpDir().getPath(), "", createComputerLauncher(null), new NoopFakeLaunher()); hudson.addNode(slave); <START> return slave; <END> }</code><technical_language>is a method for this in HudsonTestCase I know</technical_language>

Target:
private PretendSlave createPretendSlave(String slaveName) throws Exception { PretendSlave slave = new PretendSlave(slaveName, this.createTmpDir().getPath(), "", createComputerLauncher(null), new NoopFakeLauncher()); hudson.addNode(slave); return slave; }
Source:
<code>public UpdatePasswordResponse resetPassword(@RequestBody final ResetPasswordRequest request) throws UserRetrievalException { UpdatePasswordResponse response = new UpdatePasswordResponse(); UserDTO currUser = userManager.getByName(request.getUserName()); if (currUser == null) { <START> throw new UserRetrievalException("The user with id " + Util.getCurrentUser().getId() <END> + " could not be found or the logged in user does not have permission to modify their data."); } Strength strength = userManager.getPasswordStrength(currUser, request.getNewPassword()); if (strength.getScore() < UserManager.MIN_PASSWORD_STRENGTH) { LOGGER.info("Strength results: [warning: {}] [suggestions: {}] [score: {}] [worst case crack time: {}]", strength.getFeedback().getWarning(), strength.getFeedback().getSuggestions().toString(), strength.getScore(), strength.getCrackTimesDisplay().getOfflineFastHashing1e10PerSecond()); response.setStrength(strength); response.setPasswordUpdated(false); return response; } if(userManager.authorizePasswordReset(request.getToken())){ userManager.updateUserPassword(currUser.getSubjectName(), request.getNewPassword()); userManager.deletePreviousTokens(request.getToken()); response.setPasswordUpdated(true); } else { response.setPasswordUpdated(false); } return response; }</code><technical_language>Util.getCurrentUser() work if a logged in user, right? a user able request a password reset if logged in. Well, could, required be, correct</technical_language>

Target:
public UpdatePasswordResponse resetPassword(@RequestBody final ResetPasswordRequest request) throws UserRetrievalException { UpdatePasswordResponse response = new UpdatePasswordResponse(); UserDTO currUser = userManager.getByNameUnsecured(request.getUserName()); if (currUser == null) { throw new UserRetrievalException("The user with username " + request.getUserName() + " cannot be found."); } Strength strength = userManager.getPasswordStrength(currUser, request.getNewPassword()); if (strength.getScore() < UserManager.MIN_PASSWORD_STRENGTH) { LOGGER.info("Strength results: [warning: {}] [suggestions: {}] [score: {}] [worst case crack time: {}]", strength.getFeedback().getWarning(), strength.getFeedback().getSuggestions().toString(), strength.getScore(), strength.getCrackTimesDisplay().getOfflineFastHashing1e10PerSecond()); response.setStrength(strength); response.setPasswordUpdated(false); return response; } if (userManager.authorizePasswordReset(request.getToken())) { userManager.updateUserPasswordUnsecured(currUser.getSubjectName(), request.getNewPassword()); userManager.deletePreviousTokens(request.getToken()); response.setPasswordUpdated(true); } else { response.setPasswordUpdated(false); } return response; }
Source:
<code>private List<String> getLongestSharedDimOrder(List<IndexableAdapter> indexes) { int maxSize = 0; Iterable<String> orderingCandidate = null; for (IndexableAdapter index : indexes) { int iterSize = Iterators.size(index.getDimensionNames().iterator()); if (iterSize > maxSize) { maxSize = iterSize; orderingCandidate = index.getDimensionNames(); } } if (orderingCandidate == null) { return null; } for (IndexableAdapter index : indexes) { Iterator<String> candidateIter = orderingCandidate.iterator(); for (String matchDim : index.getDimensionNames()) { boolean matched = false; <START> while (candidateIter.hasNext()) { <END> String nextDim = candidateIter.next(); if (matchDim.equals(nextDim)) { matched = true; break; } } if (!matched) { return null; } } } return ImmutableList.copyOf(orderingCandidate); }</code><technical_language>sense create a Set representation of orderingCandidate this while loop avoided</technical_language>

Target:
private static List<String> getLongestSharedDimOrder(List<IndexableAdapter> indexes) { int maxSize = 0; Iterable<String> orderingCandidate = null; for (IndexableAdapter index : indexes) { int iterSize = index.getDimensionNames().size(); if (iterSize > maxSize) { maxSize = iterSize; orderingCandidate = index.getDimensionNames(); } } if (orderingCandidate == null) { return null; } for (IndexableAdapter index : indexes) { Iterator<String> candidateIter = orderingCandidate.iterator(); for (String matchDim : index.getDimensionNames()) { boolean matched = false; while (candidateIter.hasNext()) { String nextDim = candidateIter.next(); if (matchDim.equals(nextDim)) { matched = true; break; } } if (!matched) { return null; } } } return ImmutableList.copyOf(orderingCandidate); }
Source:
<code>public void expandToInclude( Envelope other ) <START> { <END> if ( !isValid() ) { min = other.min.clone(); max = other.max.clone(); } else { for ( int i = 0; i < min.length; i++ ) { if ( other.min[i] < min[i] ) { min[i] = other.min[i]; } if ( other.max[i] > max[i] ) { max[i] = other.max[i]; } } } }</code><technical_language>I this hit ArrayIndexOutOfBoundsException if other.dimension != this.dimension. In other methods, this is checked beforehand. reason for here</technical_language>

Target:
public void expandToInclude( Envelope other ) { if ( getDimension() != other.getDimension() ) { throw new IllegalArgumentException( "Cannot join Envelopes with different dimensions: " + this.getDimension() + " != " + other.getDimension() ); } else { for ( int i = 0; i < min.length; i++ ) { if ( other.min[i] < min[i] ) { min[i] = other.min[i]; } if ( other.max[i] > max[i] ) { max[i] = other.max[i]; } } } }
Source:
<code>public void testJson_MetadataBlock() { try { MetadataBlock mtb = new MetadataBlock(); mtb.setId(1L); mtb.setName("metadata_block_name"); mtb.setDisplayName("Metadata Block Name"); BriefJsonPrinter sut = new BriefJsonPrinter(); JsonObject res = sut.json(mtb).build(); assertEquals("Metadata Block Name", res.getString("displayName")); assertEquals("metadata_block_name", res.getString("name")); assertEquals(1, res.getInt("id")); assertEquals(3, res.keySet().size()); <START> } catch (MissingResourceException e) { <END> return; } }</code><technical_language>explain need for this</technical_language>

Target:
public void testJson_MetadataBlock() { MetadataBlock mtb = new MetadataBlock(); mtb.setId(1L); mtb.setName("metadata_block_name"); mtb.setDisplayName("Metadata Block Name"); BriefJsonPrinter sut = new BriefJsonPrinter(); JsonObject res = sut.json(mtb).build(); assertEquals("Metadata Block Name", res.getString("displayName")); assertEquals("metadata_block_name", res.getString("name")); assertEquals(1, res.getInt("id")); assertEquals(3, res.keySet().size()); }
Source:
<code>private static void validatePropertySectionPropertyJavadocTokens(String fileName, String sectionName, AbstractJavadocCheck check, List<Node> columns) { assertEquals("javadoc tokens to check", columns.get(1).getTextContent(), fileName + " section '" + sectionName + "' should have the basic token javadoc description"); String acceptableTokenText = columns.get(2).getTextContent().trim(); final int removePrefixIdx = "subset of javadoc tokens".length(); acceptableTokenText = acceptableTokenText.substring(removePrefixIdx); assertFalse(isInvalidTokenPunctuation(acceptableTokenText), ", & . should be placed at beginning of the next corresponding lines " <START> + "in " + fileName + " acceptable javadoc token section: " + sectionName); <END> assertEquals(CheckUtil.getJavadocTokenText(check.getAcceptableJavadocTokens(), check.getRequiredJavadocTokens()).replaceAll("\\s+", ""), acceptableTokenText.replaceAll("\\s+", ""), fileName + " section '" + sectionName + "' should have all the acceptable javadoc tokens"); final String defaultTokenText = columns.get(3).getTextContent().trim(); assertFalse(isInvalidTokenPunctuation(defaultTokenText), ", & . should be placed at beginning of the next corresponding lines " + "in " + fileName + " default javadoc token section: " + sectionName); assertEquals(CheckUtil.getJavadocTokenText(check.getDefaultJavadocTokens(), check.getRequiredJavadocTokens()).replaceAll("\\s+", ""), defaultTokenText.replaceAll("\\s+", ""), fileName + " section '" + sectionName + "' should have all the default javadoc tokens"); }</code><technical_language>x2</technical_language>

Target:
private static void validatePropertySectionPropertyJavadocTokens(String fileName, String sectionName, AbstractJavadocCheck check, List<Node> columns) { assertEquals("javadoc tokens to check", columns.get(1).getTextContent(), fileName + " section '" + sectionName + "' should have the basic token javadoc description"); final String acceptableTokenText = columns.get(2).getTextContent().trim(); assertEquals("subset of javadoc tokens " + CheckUtil.getJavadocTokenText(check.getAcceptableJavadocTokens(), check.getRequiredJavadocTokens()), acceptableTokenText .replaceAll("\\s+", " ") .replaceAll("\\s,", ",") .replaceAll("\\s\\.", "."), fileName + " section '" + sectionName + "' should have all the acceptable javadoc tokens"); assertFalse(isInvalidTokenPunctuation(acceptableTokenText), fileName + "'s acceptable javadoc token section: " + sectionName + "should have ',' & '.' at beginning of the next corresponding lines."); final String defaultTokenText = columns.get(3).getTextContent().trim(); assertEquals(CheckUtil.getJavadocTokenText(check.getDefaultJavadocTokens(), check.getRequiredJavadocTokens()), defaultTokenText .replaceAll("\\s+", " ") .replaceAll("\\s,", ",") .replaceAll("\\s\\.", "."), fileName + " section '" + sectionName + "' should have all the default javadoc tokens"); assertFalse(isInvalidTokenPunctuation(defaultTokenText), fileName + "'s default javadoc token section: " + sectionName + "should have ',' & '.' at beginning of the next corresponding lines."); }
Source:
<code>public XmlXYEntry(ITmfStateSystem stateSystem, String path, Element entryElement) { fStateSystem = stateSystem; fPath = path; <START> switch (entryElement.getAttribute(TmfXmlStrings.TYPE)) { <END> case TmfXmlUiStrings.DISPLAY_TYPE_DELTA: fType = DisplayType.DELTA; break; case TmfXmlUiStrings.DISPLAY_TYPE_ABSOLUTE: default: fType = DisplayType.ABSOLUTE; break; } }</code><technical_language>this work attribute is displayType</technical_language>

Target:
public XmlXYEntry(ITmfStateSystem stateSystem, String path, Element entryElement) { fStateSystem = stateSystem; fPath = path; switch (entryElement.getAttribute(TmfXmlUiStrings.DISPLAY_TYPE)) { case TmfXmlUiStrings.DISPLAY_TYPE_DELTA: fType = DisplayType.DELTA; break; case TmfXmlUiStrings.DISPLAY_TYPE_ABSOLUTE: default: fType = DisplayType.ABSOLUTE; break; } }
Source:
<code>private static String delft2grobidLabel(String label) { if (label.equals("O")) { label = TaggingLabels.OTHER_LABEL; } else if (label.startsWith(GenericTaggerUtils.START_ENTITY_LABEL_PREFIX_ALTERNATIVE)) { label = label.replace(GenericTaggerUtils.START_ENTITY_LABEL_PREFIX_ALTERNATIVE, GenericTaggerUtils.START_ENTITY_LABEL_PREFIX); } else if (label.startsWith(GenericTaggerUtils.START_ENTITY_LABEL_PREFIX)) { <START> label = label.replace(GenericTaggerUtils.START_ENTITY_LABEL_PREFIX, ""); <END> } return label; }</code><technical_language>I original IOB strings this GenericTaggerUtils stuff is unreadable. is confusing annotation scheme is used, mixes a Grobid prefix START_ENTITY_LABEL_PREFIX for testing a IOB prefix is start of entity _inside_</technical_language>

Target:
private static String delft2grobidLabel(String label) { if (label.equals(TaggingLabels.IOB_OTHER_LABEL)) { label = TaggingLabels.OTHER_LABEL; } else if (label.startsWith(TaggingLabels.IOB_START_ENTITY_LABEL_PREFIX)) { label = label.replace(TaggingLabels.IOB_START_ENTITY_LABEL_PREFIX, TaggingLabels.GROBID_START_ENTITY_LABEL_PREFIX); } else if (label.startsWith(TaggingLabels.IOB_INSIDE_LABEL_PREFIX)) { label = label.replace(TaggingLabels.IOB_INSIDE_LABEL_PREFIX, TaggingLabels.GROBID_INSIDE_ENTITY_LABEL_PREFIX); } return label; }
Source:
<code>public GitScm commitAuthorInChangelog() { <START> CommitAuthorInChangelog behaviour = addBehaviour(CommitAuthorInChangelog.class); <END> return this; }</code><technical_language>need store this in a variable then</technical_language>

Target:
public GitScm commitAuthorInChangelog() { addBehaviour(CommitAuthorInChangelog.class); return this; }
Source:
<code><START> public void registerLifespanCompletionCallback(Consumer<Lifespan> callback) <END> { checkState(lifespanCompletionCallback == null); this.lifespanCompletionCallback = callback; }</code><technical_language>nit: I reorder methods. registerLifespanCompletionCallback -> setNoMorePagesForLifespan -> isFinishedForLifespan. (here in other classes) setNoMorePagesForLifespan -> isFinishedForLifespan other, is easier read if together. registerLifespanCompletionCallback this two, enqueue. sense move registerLifespanCompletionCallback enqueue</technical_language>

Target:
public void registerLifespanCompletionCallback(Consumer<Lifespan> callback) { checkState(lifespanCompletionCallback == null, "lifespanCompletionCallback is already set"); this.lifespanCompletionCallback = requireNonNull(callback, "callback is null"); }
Source:
<code>public Session get(SessionId id) throws NoSuchSessionException { Require.nonNull("Session ID", id); URI uri = null; Capabilities caps = null; try { <START> ResultSet sessions = readSessionStatement(id).executeQuery(); <END> while(sessions.next()) { String sessionIdAndURI = sessions.getString(sessionIdCol); String rawUri = sessionIdAndURI.split(separator)[1]; String rawCapabilities = sessions.getString(sessionCapsCol); caps = rawCapabilities == null ? new ImmutableCapabilities() : JSON.toType(rawCapabilities, Capabilities.class); try { uri = new URI(rawUri); } catch (URISyntaxException e) { throw new NoSuchSessionException(String.format("Unable to convert session id (%s) to uri: %s", id, rawUri), e); } } sessions.close(); if (uri == null) { throw new NoSuchSessionException("Unable to find URI for session " + id); } return new Session(id, uri, caps); } catch (SQLException e) { throw new JdbcException(e.getMessage()); } }</code><technical_language>try-with-resources ResultSet closed properly</technical_language>

Target:
public Session get(SessionId id) throws NoSuchSessionException { Require.nonNull("Session ID", id); URI uri = null; Capabilities caps = null; String rawUri = null; try (ResultSet sessions = readSessionStatement(id).executeQuery()){ if (!sessions.next()) { throw new NoSuchSessionException("Unable to find..."); } rawUri = sessions.getString(SESSION_URI_COL); String rawCapabilities = sessions.getString(SESSION_CAPS_COL); caps = rawCapabilities == null ? new ImmutableCapabilities() : JSON.toType(rawCapabilities, Capabilities.class); try { uri = new URI(rawUri); } catch (URISyntaxException e) { throw new NoSuchSessionException(String.format("Unable to convert session id (%s) to uri: %s", id, rawUri), e); } return new Session(id, uri, caps); } catch (SQLException e) { throw new JdbcException(e); } }
Source:
<code>private void AttachCd() { Guid storagePoolId = getVm().getstorage_pool_id(); <START> boolean isIsoFound = (VmRunHandler.getInstance().findActiveISODomain(storagePoolId) != null); <END> if (isIsoFound) { if (StringUtils.isEmpty(getVm().getCdPath())) { getVm().setCdPath(getVm().getiso_path()); GuestToolsVersionTreatment(); refreshBootSequenceParameter(getParameters()); if (getVm().getboot_sequence() == BootSequence.CD) { getVm().setCdPath(getVm().getiso_path()); } getVm().setCdPath(ImagesHandler.cdPathWindowsToLinux(getVm().getCdPath(), getVm().getstorage_pool_id())); } } else if (!StringUtils.isEmpty(getVm().getiso_path())) { getVm().setCdPath(""); setSucceeded(false); throw new VdcBLLException(VdcBllErrors.NO_ACTIVE_ISO_DOMAIN_IN_DATA_CENTER); } }</code><technical_language>want do this? This is done specifically VmRunHandler instance mocked in unit tests</technical_language>

Target:
private void AttachCd() { Guid storagePoolId = getVm().getstorage_pool_id(); boolean isIsoFound = (getVmRunHandler().findActiveISODomain(storagePoolId) != null); if (isIsoFound) { if (StringUtils.isEmpty(getVm().getCdPath())) { getVm().setCdPath(getVm().getiso_path()); GuestToolsVersionTreatment(); refreshBootSequenceParameter(getParameters()); if (getVm().getboot_sequence() == BootSequence.CD) { getVm().setCdPath(getVm().getiso_path()); } getVm().setCdPath(ImagesHandler.cdPathWindowsToLinux(getVm().getCdPath(), getVm().getstorage_pool_id())); } } else if (!StringUtils.isEmpty(getVm().getiso_path())) { getVm().setCdPath(""); setSucceeded(false); throw new VdcBLLException(VdcBllErrors.NO_ACTIVE_ISO_DOMAIN_IN_DATA_CENTER); } }
Source:
<code>public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception { WanCheckConsistencyOperation operation = new WanCheckConsistencyOperation(schemeName, publisherName, mapName); InternalCompletableFuture<Object> future = mcs.callOnThis(operation); JsonObject result = new JsonObject(); Object operationResult; try { operationResult = future.get(); if (operationResult == null) { result.add("result", SUCCESS); } else { result.add("result", operationResult.toString()); } <START> } catch (ExecutionException e) { <END> result.add("result", e.getMessage()); result.add("stackTrace", ExceptionUtil.toString(e)); } out.add("result", result); }</code><technical_language>Is a good idea include this logic ManagementCenterService.resolveFuture, return a JsonObject result? I in other requests, ChangeWanStateRequest ClearWanQueuesRequest</technical_language>

Target:
public void writeResponse(ManagementCenterService mcs, JsonObject out) { out.add("result", mcs.syncCallOnThis( new WanCheckConsistencyOperation(schemeName, publisherName, mapName))); }
Source:
<code>public void handleRequest(final Request request, final HttpRequestContext context) { LOGGER.info("ProxyEndpoint handles request {}", request); Exchange exchange = new Exchange(request, Origin.REMOTE) { @Override public void sendAccept() { } @Override public void sendReject() { } @Override public void sendResponse(Response response) { try { request.setResponse(response); responseProduced(request, response); context.handleRequestForwarding(response); LOGGER.info("HTTP returned {}", response); } catch (Exception e) { <START> LOGGER.warn("Exception while responding to Http request {}", e); <END> } } }; exchange.setRequest(request); Response response = null; if (request.getType() != Type.RST && request.getType() != Type.ACK && request.getOptions().hasProxyUri()) { response = cacheResource.getResponse(request); LOGGER.info("Cache returned {}", response); statsResource.updateStatistics(request, response != null); } if (response != null) { exchange.sendResponse(response); return; } else { if (request.getOptions().hasProxyUri()) { try { manageProxyUriRequest(request); LOGGER.info("after manageProxyUriRequest: {}", request); } catch (URISyntaxException e) { LOGGER.warn(String.format("Proxy-uri malformed: %s", request.getOptions().getProxyUri())); exchange.sendResponse(new Response(ResponseCode.BAD_OPTION)); } } proxyCoapResolver.forwardRequest(exchange); } }</code><technical_language>remove placeholder e.getMessage()</technical_language>

Target:
public void handleRequest(final Request request, final HttpRequestContext context) { LOGGER.info("ProxyEndpoint handles request {}", request); Exchange exchange = new Exchange(request, Origin.REMOTE) { @Override public void sendAccept() { } @Override public void sendReject() { } @Override public void sendResponse(Response response) { request.setResponse(response); responseProduced(request, response); context.handleRequestForwarding(response); LOGGER.info("HTTP returned {}", response); } }; exchange.setRequest(request); Response response = null; if (request.getType() != Type.RST && request.getType() != Type.ACK && request.getOptions().hasProxyUri()) { response = cacheResource.getResponse(request); LOGGER.info("Cache returned {}", response); statsResource.updateStatistics(request, response != null); } if (response != null) { exchange.sendResponse(response); return; } else { if (request.getOptions().hasProxyUri()) { try { manageProxyUriRequest(request); LOGGER.info("after manageProxyUriRequest: {}", request); } catch (URISyntaxException e) { LOGGER.warn(String.format("Proxy-uri malformed: %s", request.getOptions().getProxyUri())); exchange.sendResponse(new Response(ResponseCode.BAD_OPTION)); } } proxyCoapResolver.forwardRequest(exchange); } }
Source:
<code>private SagaConfiguration(Class<S> sagaType) { String resourceInjectorName = sagaType.getSimpleName() + "ResourceInjector"; String managerName = sagaType.getSimpleName() + "Manager"; String processorName = sagaType.getSimpleName() + "Processor"; String repositoryName = sagaType.getSimpleName() + "Repository"; <START> resourceInjector = new Component<>(() -> config, resourceInjectorName, c -> new NoResourceInjector()); <END> sagaStore = new Component<>(() -> config, "sagaStore", c -> c.getComponent(SagaStore.class, InMemorySagaStore::new)); sagaRepository = new Component<>(() -> config, repositoryName, c -> new AnnotatedSagaRepository<>(sagaType, sagaStore.get(), resourceInjector.get())); sagaManager = new Component<>(() -> config, managerName, c -> new AnnotatedSagaManager<>(sagaType, sagaRepository.get())); processor = new Component<>(() -> config, processorName, c -> new SubscribingEventProcessor(managerName, sagaManager.get(), c.eventBus())); }</code><technical_language>I default resourceInjector global configuration. allow a single config for places resourceInjector is used, while configure a separate Saga</technical_language>

Target:
private SagaConfiguration(Class<S> sagaType) { String managerName = sagaType.getSimpleName() + "Manager"; String processorName = sagaType.getSimpleName() + "Processor"; String repositoryName = sagaType.getSimpleName() + "Repository"; sagaStore = new Component<>(() -> config, "sagaStore", c -> c.getComponent(SagaStore.class, InMemorySagaStore::new)); sagaRepository = new Component<>(() -> config, repositoryName, c -> new AnnotatedSagaRepository<>(sagaType, sagaStore.get(), c.resourceInjector())); sagaManager = new Component<>(() -> config, managerName, c -> new AnnotatedSagaManager<>(sagaType, sagaRepository.get())); processor = new Component<>(() -> config, processorName, c -> new SubscribingEventProcessor(managerName, sagaManager.get(), c.eventBus())); }
Source:
<code>protected void configure() { bindPresenterWidget(HeaderPresenter.class, HeaderPresenter.MyView.class, HeaderView.class); <START> <END> bind(new TypeLiteral<UiHandlersStrategy<HeaderUiHandlers>>() { }).to(new TypeLiteral<SetterUiHandlersStrategy<HeaderUiHandlers>>() { }); bind(HeaderUiHandlers.class).to(HeaderPresenter.class); }</code><technical_language>spaces empty line</technical_language>

Target:
protected void configure() { bindPresenterWidget(HeaderPresenter.class, HeaderPresenter.MyView.class, HeaderView.class); }
Source:
<code>public String toString() { <START> return com.google.common.base.Objects.toStringHelper(this) <END> .add("parent", super.toString()) .add("application", getApplication()) .toString(); }</code><technical_language>above. this is deprecated longer used</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .toString(); }
Source:
<code>private File createLocalParserJar(ParserInfo parserInfo) throws IOException { ensureDirExists(localParserJarPath); File parserJar = null; do { parserJar = new File(localParserJarPath, parserInfo.getName().trim() + UUID.randomUUID()); <START> } while (!parserJar.createNewFile()); <END> parserJar.deleteOnExit(); return parserJar; }</code><technical_language>nit: loop is required, uuid practically produce unique ids</technical_language>

Target:
private File createLocalParserJar(ParserInfo parserInfo) throws IOException { ensureDirExists(localParserJarPath); File parserJar = File.createTempFile(parserInfo.getName().trim(), "", new File(localParserJarPath)); parserJar.deleteOnExit(); return parserJar; }
Source:
<code>public void onClick(View v){ if(v == targetEdit){ Intent myIntent = new Intent(); myIntent.setClass(this, FileBrowserActivity.class); myIntent.putExtra(FileBrowserActivity.EXTRA_FILE_EXTENSIONS, ".db"); startActivityForResult(myIntent, ACTIVITY_FB_TARGET); } if(v == sourceEdit){ Intent myIntent = new Intent(); myIntent.setClass(this, FileBrowserActivity.class); myIntent.putExtra(FileBrowserActivity.EXTRA_FILE_EXTENSIONS, ".db"); startActivityForResult(myIntent, ACTIVITY_FB_SOURCE); } if(v == mergeButton){ AMGUIUtility.doProgressTask(this, R.string.merging_title, R.string.merging_summary, new AMGUIUtility.ProgressTask(){ public void doHeavyTask() throws Exception { String targetPath = targetEdit.getText().toString(); String sourcePath = sourceEdit.getText().toString(); databaseUtil.mergeDatabases(targetPath, sourcePath); } public void doUITask(){ Toast.makeText(DatabaseMerger.this, getString(R.string.merge_success_message), Toast.LENGTH_LONG) .show(); finish(); } <START> }); <END> } if(v == cancelButton){ finish(); } }</code><technical_language>I want set result OK in result intent parent want refresh</technical_language>

Target:
public void onClick(View v){ if(v == targetEdit){ Intent myIntent = new Intent(); myIntent.setClass(this, FileBrowserActivity.class); myIntent.putExtra(FileBrowserActivity.EXTRA_FILE_EXTENSIONS, ".db"); startActivityForResult(myIntent, ACTIVITY_FB_TARGET); } if(v == sourceEdit){ Intent myIntent = new Intent(); myIntent.setClass(this, FileBrowserActivity.class); myIntent.putExtra(FileBrowserActivity.EXTRA_FILE_EXTENSIONS, ".db"); startActivityForResult(myIntent, ACTIVITY_FB_SOURCE); } if(v == mergeButton){ AMGUIUtility.doProgressTask(this, R.string.merging_title, R.string.merging_summary, new AMGUIUtility.ProgressTask(){ public void doHeavyTask() throws Exception { String targetPath = targetEdit.getText().toString(); String sourcePath = sourceEdit.getText().toString(); databaseUtil.mergeDatabases(targetPath, sourcePath); } public void doUITask(){ Toast.makeText(DatabaseMerger.this, getString(R.string.merge_success_message), Toast.LENGTH_LONG) .show(); Intent resultIntent = new Intent(); setResult(Activity.RESULT_OK, resultIntent); finish(); } }); } if(v == cancelButton){ finish(); } }
Source:
<code>public Charset charsetForName(String charsetName) { <START> <END> if (charsets.containsKey(charsetName)) { return charsets.get(charsetName); } Iterator<Charset> it = charsets.values().iterator(); while (it.hasNext()) { Charset cs = it.next(); for (String alias : cs.aliases()) { if (alias.equals(charsetName)) { return cs; } } } return null; }</code><technical_language>case? comparisons case-insensitive</technical_language>

Target:
public Charset charsetForName(String charsetName) { String name = charsetName.toLowerCase(); if (charsets.containsKey(name)) { return charsets.get(name); } Iterator<Charset> it = charsets.values().iterator(); while (it.hasNext()) { Charset cs = it.next(); for (String alias : cs.aliases()) { if (alias.toLowerCase().equals(name)) { return cs; } } } return null; }
Source:
<code>public void activate() { <START> m_isActive = true; <END> setupExecutor(); }</code><technical_language>Shouldnt this executor lock</technical_language>

Target:
public void activate() { setupExecutor(); }
Source:
<code>private void checkMultiCoverage(ImageMosaicReader reader, String coverageName, double longitude, double latitude, String timestamp, double expected) throws Exception { ParameterValue<Boolean> useJai = AbstractGridFormat.USE_JAI_IMAGEREAD.createValue(); useJai.setValue(false); @SuppressWarnings("rawtypes") ParameterValue<List> time = ImageMosaicFormat.TIME.createValue(); time.setValue(Arrays.asList(new Date[] { parseTimeStamp(timestamp) })); GeneralParameterValue[] params = new GeneralParameterValue[] { useJai, time }; GridCoverage2D coverage = reader.read(coverageName, params); <START> System.out.println(coverage.getProperties()); <END> assertNotNull(coverage); assertEquals(expected, coverage.evaluate(new Point2D.Double(longitude, latitude), (double[]) null)[0], 0); }</code><technical_language>I forget this some debug tests :)</technical_language>

Target:
private void checkMultiCoverage(ImageMosaicReader reader, String coverageName, double longitude, double latitude, String timestamp, double expected) throws Exception { ParameterValue<Boolean> useJai = AbstractGridFormat.USE_JAI_IMAGEREAD.createValue(); useJai.setValue(false); @SuppressWarnings("rawtypes") ParameterValue<List> time = ImageMosaicFormat.TIME.createValue(); time.setValue(Arrays.asList(new Date[] { parseTimeStamp(timestamp) })); GeneralParameterValue[] params = new GeneralParameterValue[] { useJai, time }; GridCoverage2D coverage = reader.read(coverageName, params); assertNotNull(coverage); assertEquals(expected, coverage.evaluate(new Point2D.Double(longitude, latitude), (double[]) null)[0], 0); }
Source:
<code>protected List<Pojo> doInBackground(Void... voids) { boolean smartHistory = !prefs.getString("history-mode", "recency").equals("recency"); boolean excludeFavorites = prefs.getBoolean("exclude-favorites", false); int max_records = DEFAULT_MAX_RESULTS; try { <START> max_records = Integer.parseInt(prefs.getString("number-of-history-items", DEFAULT_MAX_RESULTS+"")); <END> } catch(Exception e) { } ArrayList<Pojo> favoritesPojo = new ArrayList<Pojo>(0); if(excludeFavorites){ favoritesPojo = KissApplication.getDataHandler(activity).getFavorites(activity.tryToRetrieve); } return KissApplication.getDataHandler(activity).getHistory(activity, max_records, smartHistory, favoritesPojo); }</code><technical_language>getInteger instead? is failing</technical_language>

Target:
protected List<Pojo> doInBackground(Void... voids) { boolean smartHistory = !prefs.getString("history-mode", "recency").equals("recency"); boolean excludeFavorites = prefs.getBoolean("exclude-favorites", false); int max_records = Integer.parseInt(prefs.getString("number-of-display-elements", String.valueOf(DEFAULT_MAX_RESULTS))); ArrayList<Pojo> favoritesPojo = new ArrayList<Pojo>(0); if(excludeFavorites){ favoritesPojo = KissApplication.getDataHandler(activity).getFavorites(activity.tryToRetrieve); } return KissApplication.getDataHandler(activity).getHistory(activity, max_records, smartHistory, favoritesPojo); }