auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void ensureEmptyHypervisorIdsAreIgnored() throws Exception { Owner owner = new Owner("admin"); Map<String, ArrayList<GuestId>> hostGuestMap = new HashMap<String, ArrayList<GuestId>>(); hostGuestMap.put("", new ArrayList(Arrays.asList(new GuestId("GUEST_A"), new GuestId("GUEST_B")))); hostGuestMap.put("HYPERVISOR_A", new ArrayList(Arrays.asList(new GuestId("GUEST_C"), new GuestId("GUEST_D")))); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(consumerCurator.getHostConsumersMap(any(Owner.class), any(Set.class))). thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestConsumersMap(any(Owner.class), any(Set.class))). thenReturn(new VirtConsumerMap()); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(principal.canAccess(eq(owner), eq(SubResource.CONSUMERS), eq(Access.CREATE))). thenReturn(true); when(consumerTypeCurator.lookupByLabel( eq(ConsumerTypeEnum.HYPERVISOR.getLabel()))).thenReturn(hypervisorType); when(idCertService.generateIdentityCert(any(Consumer.class))) .thenReturn(new IdentityCertificate()); HypervisorCheckInResult result = null; try { result = hypervisorResource.hypervisorUpdate(hostGuestMap, principal, owner.getKey(), true); } catch (PersistenceException e) { <START> fail("Expected no exception"); <END> } assertTrue(result != null); assertTrue(result.getCreated().size() == 1); assertTrue(!result.getCreated().toArray(new Consumer[1])[0].getHypervisorId().equals("")); }</code><technical_language>This necessary. test method throws exception, if exception is thrown, JUnit marks test "error" (which is result [should be](<LINK_0> marked as)</technical_language>

Target:
public void ensureEmptyHypervisorIdsAreIgnored() throws Exception { Owner owner = new Owner("admin"); Map<String, List<GuestId>> hostGuestMap = new HashMap<String, List<GuestId>>(); hostGuestMap.put("", new ArrayList(Arrays.asList(new GuestId("GUEST_A"), new GuestId("GUEST_B")))); hostGuestMap.put("HYPERVISOR_A", new ArrayList(Arrays.asList(new GuestId("GUEST_C"), new GuestId("GUEST_D")))); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(consumerCurator.getHostConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(principal.canAccess(eq(owner), eq(SubResource.CONSUMERS), eq(Access.CREATE))) .thenReturn(true); when(consumerTypeCurator.lookupByLabel(eq(ConsumerTypeEnum.HYPERVISOR.getLabel()))) .thenReturn(hypervisorType); when(idCertService.generateIdentityCert(any(Consumer.class))) .thenReturn(new IdentityCertificate()); HypervisorCheckInResult result = hypervisorResource.hypervisorUpdate( hostGuestMap, principal, owner.getKey(), true); assertNotNull(result); assertEquals(1, result.getCreated().size()); List<Consumer> created = new ArrayList<Consumer>(result.getCreated()); assertEquals("hypervisor_a", created.get(0).getHypervisorId().getHypervisorId()); }
Source:
<code>private static void genComputeStats(StringBuilder rewrittenQueryBuilder, HiveConf conf, int pos, String columnName, TypeInfo typeInfo) throws SemanticException { Preconditions.checkArgument(typeInfo.getCategory() == Category.PRIMITIVE); ColumnStatsType columnStatsType = ColumnStatsType.getColumnStatsType((PrimitiveTypeInfo) typeInfo); int size = columnStatsType.getColumnStats().size() - 1; for (int i = 0; i < size; i++) { ColumnStatsField columnStatsField = columnStatsType.getColumnStats().get(i); appendStatsField(rewrittenQueryBuilder, conf, columnStatsField, columnStatsType, columnName, pos); <START> rewrittenQueryBuilder.append(", "); <END> } ColumnStatsField columnStatsField = columnStatsType.getColumnStats().get(size); appendStatsField(rewrittenQueryBuilder, conf, columnStatsField, columnStatsType, columnName, pos); }</code><technical_language>instead of duplicating loop body; a conditional for "append" better; easier write describe; thinking like: for(a : x) { if(!first) append(","); body(); }</technical_language>

Target:
private static void genComputeStats(StringBuilder rewrittenQueryBuilder, HiveConf conf, int pos, String columnName, TypeInfo typeInfo) throws SemanticException { Preconditions.checkArgument(typeInfo.getCategory() == Category.PRIMITIVE); ColumnStatsType columnStatsType = ColumnStatsType.getColumnStatsType((PrimitiveTypeInfo) typeInfo); for (int i = 0; i < columnStatsType.getColumnStats().size(); i++) { if (i > 0) { rewrittenQueryBuilder.append(", "); } ColumnStatsField columnStatsField = columnStatsType.getColumnStats().get(i); appendStatsField(rewrittenQueryBuilder, conf, columnStatsField, columnStatsType, columnName, pos); } }
Source:
<code>private WechatJobErrorHandler getWechatJobErrorHandler() { <START> for (JobErrorHandler jobErrorHandler : ServiceLoader.load(JobErrorHandler.class)) { <END> if (null != jobErrorHandler && jobErrorHandler instanceof WechatJobErrorHandler) { return (WechatJobErrorHandler) jobErrorHandler; } } return new WechatJobErrorHandler(); }</code><technical_language>jobErrorHandler -></technical_language>

Target:
private WechatJobErrorHandler getWechatJobErrorHandler() { for (JobErrorHandler each : ServiceLoader.load(JobErrorHandler.class)) { if (null != each && each instanceof WechatJobErrorHandler) { return (WechatJobErrorHandler) each; } } return new WechatJobErrorHandler(); }
Source:
<code>public void addTraceMarker(ITmfTrace trace, long startTime, @ScriptParameter(defaultValue = DEFAULT_ENDTIME) long endTime, @ScriptParameter(defaultValue = DEFAULT_LABEL) @Nullable String label, @ScriptParameter(defaultValue = DEFAULT_CATEGORY) @Nullable String category, @ScriptParameter(defaultValue = DEFAULT_COLOR) @Nullable String color) <START> throws Exception { <END> if (fSource == null) { try { initializeScriptingMarkerSource(); } catch (NullPointerException e) { throw e; } } try { TraceMarker traceMarker = createTraceMarker(trace, label, category, startTime, endTime, color); if (fSource != null) { fSource.configureMarker(traceMarker); } } catch (IllegalArgumentException e) { String markerName = label == null ? DEFAULT_LABEL : label; String exceptionMessage = e + " for marker : " + markerName + " at " + startTime; throw new IllegalArgumentException(exceptionMessage); } }</code><technical_language>Here, put specific exception types NullPointerException, IllegalArgumentException instead of generic Exception class</technical_language>

Target:
public void addTraceMarker(ITmfTrace trace, long startTime, @ScriptParameter(defaultValue = DEFAULT_ENDTIME) long endTime, @ScriptParameter(defaultValue = DEFAULT_LABEL) @Nullable String label, @ScriptParameter(defaultValue = DEFAULT_CATEGORY) @Nullable String category, @ScriptParameter(defaultValue = DEFAULT_COLOR) @Nullable String color) throws NullPointerException, IllegalArgumentException { ScriptingMarkerSource source = getMarkerSource(trace); if (source == null) { try { source = findMarkerSourceFromAdapters(trace); if (source == null) { source = createMarkerSource(trace); } } catch (NullPointerException e) { throw new NullPointerException(INVALID_TRACE); } } try { TraceMarker traceMarker = createTraceMarker(trace, label, category, startTime, endTime, color); source.configureMarker(traceMarker); } catch (IllegalArgumentException e) { String markerName = label == null ? DEFAULT_LABEL : label; String exceptionMessage = e + " for marker : " + markerName + " at " + startTime; throw new IllegalArgumentException(exceptionMessage); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <START> Realm.init(getApplicationContext()); <END> setContentView(R.layout.activity_realm_migration_example); rootLayout = ((LinearLayout) findViewById(R.id.container)); rootLayout.removeAllViews(); copyBundledRealmFile(this.getResources().openRawResource(R.raw.default0), "default0"); copyBundledRealmFile(this.getResources().openRawResource(R.raw.default1), "default1"); copyBundledRealmFile(this.getResources().openRawResource(R.raw.default2), "default2"); RealmConfiguration config0 = new RealmConfiguration.Builder() .name("default0") .schemaVersion(3) .build(); try { Realm.migrateRealm(config0, new Migration()); } catch (FileNotFoundException ignored) { } realm = Realm.getInstance(config0); showStatus("Default0"); showStatus(realm); realm.close(); RealmConfiguration config1 = new RealmConfiguration.Builder() .name("default1") .schemaVersion(3) .migration(new Migration()) .build(); realm = Realm.getInstance(config1); showStatus("Default1"); showStatus(realm); realm.close(); RealmConfiguration config2 = new RealmConfiguration.Builder() .name("default2") .schemaVersion(3) .deleteRealmIfMigrationNeeded() .build(); realm = Realm.getInstance(config2); showStatus("default2"); showStatus(realm); realm.close(); }</code><technical_language>need create Application class</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_realm_migration_example); rootLayout = ((LinearLayout) findViewById(R.id.container)); rootLayout.removeAllViews(); copyBundledRealmFile(this.getResources().openRawResource(R.raw.default0), "default0.realm"); copyBundledRealmFile(this.getResources().openRawResource(R.raw.default1), "default1.realm"); copyBundledRealmFile(this.getResources().openRawResource(R.raw.default2), "default2.realm"); RealmConfiguration config0 = new RealmConfiguration.Builder() .name("default0.realm") .schemaVersion(3) .build(); try { Realm.migrateRealm(config0, new Migration()); } catch (FileNotFoundException ignored) { } realm = Realm.getInstance(config0); showStatus("Default0"); showStatus(realm); realm.close(); RealmConfiguration config1 = new RealmConfiguration.Builder() .name("default1.realm") .schemaVersion(3) .migration(new Migration()) .build(); realm = Realm.getInstance(config1); showStatus("Default1"); showStatus(realm); realm.close(); RealmConfiguration config2 = new RealmConfiguration.Builder() .name("default2.realm") .schemaVersion(3) .deleteRealmIfMigrationNeeded() .build(); realm = Realm.getInstance(config2); showStatus("default2"); showStatus(realm); realm.close(); }
Source:
<code>public URL getDirectoryUrl() { <START> String directoryURLString = String.format("%s/%s/%s", azureFileStorageClient.getUrl(), <END> shareName, directoryPath); if (snapshot != null) { directoryURLString = String.format("%s?snapshot=%s", directoryURLString, snapshot); } try { return new URL(directoryURLString); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new RuntimeException( String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), directoryURLString), e)); } }</code><technical_language>Do split out share directory path in URL? If need this String.format</technical_language>

Target:
public URL getDirectoryUrl() { StringBuilder directoryURLString = new StringBuilder(azureFileStorageClient.getUrl()).append("/") .append(shareName).append("/").append(directoryPath); if (snapshot != null) { directoryURLString.append("?snapshot=").append(snapshot); } try { return new URL(directoryURLString.toString()); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new RuntimeException( String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), directoryURLString), e)); } }
Source:
<code>static private String handleParens(String group, String prefix, String suffix) { int numOpenParens = numOccurencesOfCharIn(group, '('); int numCloseParens = numOccurencesOfCharIn(group, ')'); if (numOpenParens >= numCloseParens || suffix.isEmpty()) { return (prefix + group + suffix); } else { int index; if (numOpenParens == 0) { <START> index = indexOfNthOccurrenceOfCharIn(group, ')', 1) - 1; <END> } else { index = indexOfNthOccurrenceOfCharIn(group, ')', numOpenParens); } return (prefix + group.substring(0, index+1) + suffix + group.substring(index+1)); } }</code><technical_language>subtracting 1 in "if" unconditionally add 1 later? add 1 in else needed. smells suspicious numOpenParens == 0 requiring special handling. ponder it</technical_language>

Target:
static private String handleParens(String group, String prefix, String suffix) { int numOpenParens = numOccurencesOfCharIn(group, '('); int numCloseParens = numOccurencesOfCharIn(group, ')'); if (numOpenParens >= numCloseParens || suffix.isEmpty()) { return (prefix + group + suffix); } else { int index; if (numOpenParens == 0) { index = indexOfNthOccurrenceOfCharIn(group, ')', 1); } else { index = indexOfNthOccurrenceOfCharIn(group, ')', numOpenParens) + 1; } return (prefix + group.substring(0, index) + suffix + group.substring(index)); } }
Source:
<code>public void instagramProfileScraperUserTest() { InstagramProfileScraper instagramScraper = new InstagramProfileScraper(); String url = "<LINK_0>"; BufferedReader br = null; try { ClientConnection connection = new ClientConnection(url); assertThat(connection.getStatusCode(), is(200)); System.out.println("saurabh well done connected"); br = instagramScraper.getHtml(connection); } catch (IOException e) { DAO.log("InstagramProfileScraperTest.instagramProfileScraperUserTest() failed to connect to network. url:" + url); } JSONArray instaProfile = new JSONArray(); instaProfile = instagramScraper.scrapeInstagram(br, url); <START> assertNotNull(instaProfile); <END> }</code><technical_language>need add more checks elements scraped profile pic URL, bio, etc. check exist</technical_language>

Target:
public void instagramProfileScraperUserTest() { InstagramProfileScraper instagramScraper = new InstagramProfileScraper(); String url = "<LINK_0>"; BufferedReader br = null; try { ClientConnection connection = new ClientConnection(url); assertThat(connection.getStatusCode(), is(200)); br = instagramScraper.getHtml(connection); } catch (IOException e) { DAO.log("InstagramProfileScraperTest.instagramProfileScraperUserTest() failed to connect to network. url:" + url); } JSONArray instaProfile = new JSONArray(); instaProfile = instagramScraper.scrapeInstagram(br, url); String hostname = "www.instagram.com"; for(int i=0; i<instaProfile.length(); i++) { JSONObject json = (JSONObject)instaProfile.get(i); JSONObject entry_data = json.getJSONObject("entry_data"); JSONObject config = json.getJSONObject("config"); try { assertNotNull(config); assertNotNull(instaProfile); assertNotNull(entry_data); assertTrue(json.has("activity_counts")); assertTrue(json.has("country_code")); assertTrue(json.has("platform")); assertTrue(json.has("language_code")); assertTrue(json.has("gatekeepers")); assertTrue(entry_data.has("ProfilePage")); assertTrue(config.has("viewer")); assertTrue(config.has("csrf_token")); assertEquals(json.getString("hostname"), hostname); } catch (Exception e) { DAO.log("InstagramProfileScraperTest.instagramProfileScraperUserTest() assert error"); } } }
Source:
<code>public CompletableFuture<Boolean> thenPut(Put put) { validatePut(put, conn.connConf.getMaxKeyValueSize()); preCheck(); return checkAndMutate(CheckAndMutate.newBuilder(row) .ifMatches(family, qualifier, op, value) .timeRange(timeRange) <START> .build(put)); <END> }</code><technical_language>I get is replaced maps a checkAndMutate instance? is matching in previous impl</technical_language>

Target:
public CompletableFuture<Boolean> thenPut(Put put) { validatePut(put, conn.connConf.getMaxKeyValueSize()); preCheck(); return RawAsyncTableImpl.this.<Boolean> newCaller(row, put.getPriority(), rpcTimeoutNs) .action((controller, loc, stub) -> RawAsyncTableImpl.mutate(controller, loc, stub, put, (rn, p) -> RequestConverter.buildMutateRequest(rn, row, family, qualifier, op, value, null, timeRange, p), (c, r) -> r.getProcessed())) .call(); }
Source:
<code>public static String asFileName(String urlString) throws MalformedURLException { URL url = new URL(urlString); <START> String joined = StringUtils.join(new String[] { url.getProtocol(), url.getHost(), url.getPath() }, '-'); <END> return StringUtils.replaceChars(joined, '/', '-'); }</code><technical_language>this adds clarity, ok</technical_language>

Target:
public static String asFileName(String urlString) throws MalformedURLException { URL url = new URL(urlString); return url.getProtocol() + "-" + url.getHost() + "-" + url.getPath().replaceAll("/", "-"); }
Source:
<code>protected ResponseBuilder createBadRequestResponse(Set<ConstraintViolation<?>> violations) { final Map<String, String> responseObj = new HashMap<>(); violations.forEach(violation -> { responseObj.put(violation.getPropertyPath().toString(), violation.getMessage()); <START> }); <END> return Response.status(Response.Status.BAD_REQUEST) .entity(responseObj); }</code><technical_language>Maybe: java final Map<String, String> responseObj = violations.stream().collect(Collectors.toMap( v -> v.getPropertyPath().toString(), ConstraintViolation::getMessage));</technical_language>

Target:
protected ResponseBuilder createBadRequestResponse(Set<ConstraintViolation<?>> violations) { final Map<String, String> responseObj = violations.stream() .collect(Collectors.toMap(v -> v.getPropertyPath().toString(), ConstraintViolation::getMessage)); return Response.status(Response.Status.BAD_REQUEST) .entity(responseObj); }
Source:
<code>public void enableDebugLogging(boolean enable) { <START> checkNotDisposed(); <END> }</code><technical_language>IabHelper modified debug logging, this method necessary. I IabHelper change Log. calls AppLog. calls code changes (since this class is provided Google change)</technical_language>

Target:
public void enableDebugLogging(boolean enable) { checkNotDisposed(); mDebugLog = enable; }
Source:
<code>public boolean equals(Object obj) { <START> if (obj == null || !(obj instanceof SerializableScan)) { <END> return false; } SerializableScan other = (SerializableScan) obj; try { return toEncodedString().equals(other.toEncodedString()); } catch (IOException e) { throw new RuntimeException("Could not check SerializableScan equality", e); } }</code><technical_language>need check null. "null instanceof SerializableScan" returns false</technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof SerializableScan)) { return false; } SerializableScan other = (SerializableScan) obj; try { return toEncodedString().equals(other.toEncodedString()); } catch (IOException e) { throw new RuntimeException("Could not check SerializableScan equality", e); } }
Source:
<code>void checkRegion(Configured configuration, PluginExceptionConditionAccumulator accumulator, LocalizationContext localizationContext) { String regionName = configuration.getConfigurationValue(REGION_SQL, localizationContext); LOG.info(">> Querying region '{}'", regionName); SQLAdmin sqlAdmin = credentials.getSQLAdmin(); String projectId = credentials.getProjectId(); try { List<Tier> tierList = sqlAdmin.tiers().list(projectId).execute().getItems(); <START> boolean isRegionValid = false; <END> for (Tier tier : tierList) { if (tier.getRegion().contains(regionName)) { return; } } addError(accumulator, REGION_SQL, localizationContext, null, REGION_NOT_FOUND_MSG, regionName, projectId); } catch (IOException e) { throw new TransientProviderException(e); } }</code><technical_language>this variable is unused</technical_language>

Target:
void checkRegion(Configured configuration, PluginExceptionConditionAccumulator accumulator, LocalizationContext localizationContext) { String regionName = configuration.getConfigurationValue(REGION_SQL, localizationContext); LOG.info(">> Querying region '{}'", regionName); SQLAdmin sqlAdmin = credentials.getSQLAdmin(); String projectId = credentials.getProjectId(); try { List<Tier> tierList = sqlAdmin.tiers().list(projectId).execute().getItems(); if (tierList != null) { for (Tier tier : tierList) { if (tier.getRegion().contains(regionName)) { return; } } } addError(accumulator, REGION_SQL, localizationContext, null, REGION_NOT_FOUND_MSG, regionName, projectId); } catch (IOException e) { throw new TransientProviderException(e); } }
Source:
<code>protected Map<String, String> getExclusiveLocks() { <START> Map<String, String> locks = new HashMap<String, String>(); <END> locks.putAll(super.getExclusiveLocks()); locks.put(getVmTemplateId().toString(), LockingGroup.TEMPLATE.name()); return locks; }</code><technical_language>super.getExclusiveLocks() - null map.putAll(null) throws NullPointerException</technical_language>

Target:
protected Map<String, String> getExclusiveLocks() { Map<String, String> locks = new HashMap<String, String>(); Map<String, String> parentLocks = super.getExclusiveLocks(); if (parentLocks != null) { locks.putAll(parentLocks); } locks.put(getVmTemplateId().toString(), LockingGroup.TEMPLATE.name()); return locks; }
Source:
<code>public void configure(Binder binder) <START> { <END> }</code><technical_language>need this? binder.bind( new TypeLiteral<SeekableStreamIndexTaskClientFactory<KinesisIndexTaskClient>>() { } ).to(KinesisIndexTaskClientFactory.class).in(LazySingleton.class); Please fix KafkaIndexTaskModule properly too</technical_language>

Target:
public void configure(Binder binder) { binder.bind( new TypeLiteral<SeekableStreamIndexTaskClientFactory<KinesisIndexTaskClient>>() { } ).to(KinesisIndexTaskClientFactory.class).in(LazySingleton.class); JsonConfigProvider.bind(binder, "druid.kinesis", AWSCredentialsConfig.class, Names.named("kinesis")); }
Source:
<code>public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); Matcher matcher; try { matcher = reAccountsUrl.matcher(response); if (!matcher.find()) { throw new BankException(res.getText(R.string.unable_to_find).toString()+" accounts url."); } String strAccountsUrl = "<LINK_0>"+matcher.group(1); response = urlopen.open(strAccountsUrl); matcher = reBalance.matcher(response); Integer accountId = 0; while (matcher.find()) { accounts.add(new Account(Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3).trim()), accountId.toString())); balance = balance.add(Helpers.parseBalance(matcher.group(3))); accountIds.add(matcher.group(1)); accountId += 1; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } <START> } finally { <END> super.updateComplete(); } }</code><technical_language>remove finally {</technical_language>

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); Matcher matcher = reAccountsUrl.matcher(response); if (!matcher.find()) { throw new BankException(res.getText(R.string.unable_to_find).toString()+" accounts url."); } String strAccountsUrl = "<LINK_0>"+matcher.group(1); response = urlopen.open(strAccountsUrl); matcher = reBalance.matcher(response); Integer accountId = 0; while (matcher.find()) { accounts.add(new Account(Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3).trim()), accountId.toString())); balance = balance.add(Helpers.parseBalance(matcher.group(3))); accountIds.add(matcher.group(1)); accountId += 1; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
<code>private void saveTslintError(SensorContext context, TslintError tslintError) { String tslintKey = tslintError.ruleName; InputFile inputFile = getInputFile(context, tslintError.name); if (inputFile == null) { return; } TextRange location = getLocation(tslintError, inputFile); RuleType ruleType = TslintRulesDefinition.ruleType(tslintKey); LOG.debug("External issue, file:\"{}\", id:{}, message:\"{}\", location:{}, type: {}", <START> tslintError.name, tslintKey, tslintError.failure, location, ruleType); <END> NewExternalIssue newExternalIssue = context.newExternalIssue(); NewIssueLocation primaryLocation = newExternalIssue.newLocation() .message(tslintError.failure) .on(inputFile) .at(location); newExternalIssue .at(primaryLocation) .engineId(TslintRulesDefinition.REPOSITORY_KEY) .ruleId(tslintKey) .type(ruleType) .severity(DEFAULT_SEVERITY) .remediationEffortMinutes(DEFAULT_REMEDIATION_COST) .save(); }</code><technical_language>I line for location enough. relying TextRange#toString is reliable, SQ change in future</technical_language>

Target:
private void saveTslintError(SensorContext context, TslintError tslintError) { String tslintKey = tslintError.ruleName; InputFile inputFile = getInputFile(context, tslintError.name); if (inputFile == null) { return; } TextRange location = getLocation(tslintError, inputFile); TextPointer start = location.start(); RuleType ruleType = TslintRulesDefinition.ruleType(tslintKey); LOG.debug("Saving external TSLint issue { file:\"{}\", id:{}, message:\"{}\", line:{}, offset:{}, type: }", tslintError.name, tslintKey, tslintError.failure, start.line(), start.lineOffset(), ruleType); NewExternalIssue newExternalIssue = context.newExternalIssue(); NewIssueLocation primaryLocation = newExternalIssue.newLocation() .message(tslintError.failure) .on(inputFile) .at(location); newExternalIssue .at(primaryLocation) .engineId(TslintRulesDefinition.REPOSITORY_KEY) .ruleId(tslintKey) .type(ruleType) .severity(DEFAULT_SEVERITY) .remediationEffortMinutes(DEFAULT_REMEDIATION_COST) .save(); }
Source:
<code>public Object getValueAt(final int rowIndex, final int columnIndex) { if (_sequence == null) return null; if (_sequence.size() == 0) return null; final Config config = _sequence.getStep(rowIndex); final ItemKey key = _iteratedKeys[columnIndex]; <START> if (!isGcal(config) && "calibration".equals(key.getParent().toString())) return ""; <END> Object val = config.getItemValue(key); if (OBS_CLASS_KEY.equals(key)) { String classStr = (String) val; val = (classStr == null) ? null : ObsClass.parseType(classStr); } return val; }</code><technical_language>part of changes, key.getParent().toString() yield a NPE</technical_language>

Target:
public Object getValueAt(final int rowIndex, final int columnIndex) { if (_sequence == null) return null; if (_sequence.size() == 0) return null; final Config config = _sequence.getStep(rowIndex); final ItemKey key = _iteratedKeys[columnIndex]; if (key.getParent() == null) return null; if (!isGcal(config) && "calibration".equals(key.getParent().toString())) return ""; Object val = config.getItemValue(key); if (OBS_CLASS_KEY.equals(key)) { String classStr = (String) val; val = (classStr == null) ? null : ObsClass.parseType(classStr); } return val; }
Source:
<code>protected void autonomousMain() throws AutonomousModeOverException, InterruptedException { Clamp.mode.set(Clamp.MODE_HEIGHT); Clamp.height.set(startHeight.get()); waitUntil(Clamp.atDesiredHeight); Clamp.openControl.set(true); <START> Clamp.height.set(0.0f); <END> waitUntil(Clamp.atDesiredHeight); Clamp.openControl.set(false); Clamp.height.set(endHeight.get()); running.set(false); }</code><technical_language>This tunable well</technical_language>

Target:
protected void autonomousMain() throws AutonomousModeOverException, InterruptedException { boolean running = Rollers.running.get(); try { Rollers.running.set(false); if (useRollers.get()) { Rollers.overrideRollers.set(true); Rollers.leftPneumaticOverride.set(true); Rollers.rightPneumaticOverride.set(true); Rollers.leftRollerOverride.set(-1.0f); Rollers.rightRollerOverride.set(-1.0f); } Clamp.mode.set(Clamp.MODE_HEIGHT); Clamp.height.set(startHeight.get()); waitUntil(Clamp.atDesiredHeight); atDrop.event(); if (useRollers.get()) { Rollers.overrideRollers.set(false); } Clamp.open.set(true); waitForTime(clampTime); Clamp.height.set(collectHeight.get()); waitUntil(Clamp.atBottom); Clamp.open.set(false); waitForTime(clampTime); Clamp.height.set(endHeight.get()); this.running.set(false); } finally { Rollers.running.set(running); } }
Source:
<code>protected Component deserializeItem(JsonElement src, JsonDeserializationContext context) { <START> return ListDelegate.deserializeComponent(src, context); <END> }</code><technical_language>switching ListDelegate? this: final Component.Type type = getTypeFromJsonElement(src); return type != null ? context.deserialize(src, ComponentsTypeProvider.getClassOfComponentType(type)) : null;</technical_language>

Target:
protected Component deserializeItem(JsonElement src, JsonDeserializationContext context) { return deserializeComponent(src, context); }
Source:
<code><START> @Ignore @Test public void annotatedNestedType() { <END> TypeName type = TypeName.get(Map.Entry.class).annotated(TYPE_USE_ANNOTATION); assertThat(type.toString()).isEqualTo("java.util.Map.@" + TUA + " Entry"); }</code><technical_language>remove @Ignore</technical_language>

Target:
@Test public void annotatedNestedType() { TypeName type = TypeName.get(Map.Entry.class).annotated(TYPE_USE_ANNOTATION); assertThat(type.toString()).isEqualTo("java.util.Map. @" + TUA + " Entry"); }
Source:
<code>private static void applyFrameBoundsHeuristics(FrameDesc a, FrameDesc b) { int end = a.getEnd(), start = b.getStart(); if (end != -1 && start != -1) { return; } long tsDiff = (b.getTimestamp() - a.getTimestamp()) & 0xFFFFFFFFL; if (tsDiff > (1L << 30) && tsDiff < (-(1L << 30) & 0xFFFFFFFFL)) { return; } int min = b.getMinSeen(), max = a.getMaxSeen(); int snDiff = (max - min) & 0xFFFF; if (start != -1 || end != -1) { if (snDiff < 3 || snDiff > (-3 & 0xFFFF)) { if (end == -1) { a.setEnd((max + 1) & 0xFFFF); } if (start == -1) { b.setStart((min - 1) & 0xFFFF); } } } else { <START> if (snDiff < 4 || snDiff > (-4 & 0xFFFF)) <END> { a.setEnd((max + 1) & 0xFFFF); b.setStart((min - 1) & 0xFFFF); } } }</code><technical_language>apply this (start != -1 && end && -1 && diff == 3) If start end is set, a 1-packet frame in-between. If diff is <3 is wrong</technical_language>

Target:
private static void applyFrameBoundsHeuristics(FrameDesc a, FrameDesc b) { int end = a.getEnd(), start = b.getStart(); if (end != -1 && start != -1) { return; } long tsDiff = (b.getTimestamp() - a.getTimestamp()) & 0xFFFFFFFFL; if (tsDiff > (1L << 30) && tsDiff < (-(1L << 30) & 0xFFFFFFFFL)) { return; } else if (tsDiff >= (-(1L << 30) & 0xFFFFFFFFL)) { logger.warn("Frames that are out of order detected."); } else { int min = b.getMinSeen(), max = a.getMaxSeen(); int snDiff = (max - min) & 0xFFFF; if (start != -1 || end != -1) { if (snDiff == 2) { if (end == -1) { a.setEnd((max + 1) & 0xFFFF); } else { b.setStart((min - 1) & 0xFFFF); } } else if (snDiff < 2 || snDiff > (-3 & 0xFFFF)) { logger.warn("Frame corruption or packets that are out of " + "order detected."); } } else { if (snDiff == 3) { a.setEnd((max + 1) & 0xFFFF); b.setStart((min - 1) & 0xFFFF); } else if (snDiff < 3 || snDiff > (-4 & 0xFFFF)) { logger.warn("Frame corruption or packets that are out of" + " order detected."); } } } }
Source:
<code>default String getId() { <START> return getStateTypeName(); <END> }</code><technical_language>This is a good default. Some providers generic state type name (and state type name entry). some providers a state type name clashes another plug-in's providers, inadvertently share color settings. is guaranteed unique default</technical_language>

Target:
default String getId() { return getClass().getCanonicalName(); }
Source:
<code>public int compareTo(@NonNull final NewVersionAvailableEvent another) { <START> int result = BooleanUtils.compare(isUnsupported, another.isUnsupported); <END> if (result == 0) { result = 0 - ObjectUtils.compare(lastSupportedDate, another.lastSupportedDate, true); if (result == 0) { result = ObjectUtils.compare(newVersion, another.newVersion); } } return result; }</code><technical_language>replaced Boolean.valueOf(isUnsupported).compareTo(another.isUnsupported)</technical_language>

Target:
public int compareTo(@NonNull final NewVersionAvailableEvent another) { int result; if (isUnsupported != another.isUnsupported) { result = isUnsupported ? 1 : -1; } else { if (lastSupportedDate == another.lastSupportedDate) { result = 0; } else if (lastSupportedDate == null) { result = -1; } else if (another.lastSupportedDate == null) { result = 1; } else { result = another.lastSupportedDate.compareTo(lastSupportedDate); } if (result == 0) { if (newVersion == another.newVersion) { result = 0; } else if (newVersion == null) { result = -1; } else if (another.newVersion == null) { result = 1; } else { result = newVersion.compareTo(another.newVersion); } } } return result; }
Source:
<code>private void process(final DuplicateSet set) { <START> <END> final List<SAMRecord> records = set.getRecords(); for(SAMRecord rec : records) { if(rec.getStringAttribute(umiTag) == null) { nextSetsIterator = Collections.singleton(set).iterator(); return; } } Map<String, Long> umiFrequencies = records.stream() .collect(Collectors.groupingBy(p -> p.getStringAttribute(umiTag), counting())); UmiGraph umiGraph = new UmiGraph(); int firstGroup = 0; for (Map.Entry<String, Long> umiFrequency : umiFrequencies.entrySet()) { umiGraph.addNode(new UmiSequence(umiFrequency.getKey(), umiFrequency.getValue())); } umiGraph.processNodes(); Map<Integer, List<UmiSequence>> umisByDuplicateSet = umiGraph.getUmisByDuplicateSet(); List<DuplicateSet> duplicateSetList = new ArrayList<>(); for(int i = 0;i < umiGraph.duplicateSetCounter;i++) { DuplicateSet e = new DuplicateSet(); duplicateSetList.add(e); } for(SAMRecord rec : records) { String umi = records.get(records.indexOf(rec)).getStringAttribute(umiTag); int recordGroup = umiGraph.node.get(umi).duplicateSet; duplicateSetList.get(recordGroup).add(records.get(records.indexOf(rec))); } if(addInferredUmi) { for(DuplicateSet ds : duplicateSetList) { List<SAMRecord> recordsFromDuplicateSet = ds.getRecords(); for(SAMRecord record : recordsFromDuplicateSet) { record.setAttribute(inferredUmiTag, umiGraph.getInferredUmiFromOriginalSequence(record.getStringAttribute(umiTag))); } } } nextSetsIterator = duplicateSetList.iterator(); }</code><technical_language>a sanity check nextSetsIterator is empty</technical_language>

Target:
private void process(final DuplicateSet set) { if (nextSetsIterator.hasNext()) { throw new PicardException("nextSetsIterator is expected to be empty, but already contains data."); } final UmiGraph umiGraph = new UmiGraph(set, umiTag, inferredUmiTag, allowMissingUmis); nextSetsIterator = umiGraph.joinUmisIntoDuplicateSets(maxEditDistanceToJoin).iterator(); }
Source:
<code>public Response delete(@PathParam("tenant") String tenant) { <START> LOGGER.debug("Deleting all the resources for [" + tenant + "]"); <END> dao.deleteFromTenant(tenant); return Response.status(204).build(); }</code><technical_language><LINK_0></technical_language>

Target:
public Response delete(@PathParam("tenant") String tenant) { LOGGER.debug("Deleting all the resources for [{}]", tenant); dao.deleteFromTenant(tenant); return Response.status(204).build(); }
Source:
<code>private boolean hasFunctionnalNavigationTool() { boolean hasFunctionnalNavigationTool = false; if (session.isOpen()) { IInterpreter interpreter = session.getInterpreter(); for (RepresentationNavigationDescription representationNavigationDes : dDiagramElement.getMapping().getNavigationDescriptions()) { boolean isActiveRepresentationNavigationDes = <START> session.getSelectedViewpoints(false).contains(representationNavigationDes.getRepresentationDescription().eContainer()); <END> if (isActiveRepresentationNavigationDes) { boolean precondition = true; if (!StringUtil.isEmpty(representationNavigationDes.getPrecondition())) { try { interpreter.setVariable(representationNavigationDes.getContainerVariable().getName(), semanticElement); interpreter.setVariable(representationNavigationDes.getContainerViewVariable().getName(), dDiagramElement); precondition = interpreter.evaluateBoolean(semanticElement, representationNavigationDes.getPrecondition()); } catch (EvaluationException e) { RuntimeLoggerManager.INSTANCE.error(representationNavigationDes, ToolPackage.eINSTANCE.getAbstractToolDescription_Precondition(), e); } finally { interpreter.unSetVariable(representationNavigationDes.getContainerVariable().getName()); interpreter.unSetVariable(representationNavigationDes.getContainerViewVariable().getName()); } } if (precondition) { if (checkRepresentationNavigationDescription(interpreter, representationNavigationDes, dDiagramElement)) { return true; } } } } } return hasFunctionnalNavigationTool; }</code><technical_language>moved out of for loop</technical_language>

Target:
private boolean hasFunctionnalNavigationTool() { boolean hasFunctionnalNavigationTool = false; if (session.isOpen()) { IInterpreter interpreter = session.getInterpreter(); Collection<Viewpoint> selectedViewpoints = session.getSelectedViewpoints(false); for (RepresentationNavigationDescription representationNavigationDes : dDiagramElement.getMapping().getNavigationDescriptions()) { boolean isActiveRepresentationNavigationDes = selectedViewpoints.contains(representationNavigationDes.getRepresentationDescription().eContainer()); if (isActiveRepresentationNavigationDes) { boolean precondition = true; if (!StringUtil.isEmpty(representationNavigationDes.getPrecondition())) { try { interpreter.setVariable(representationNavigationDes.getContainerVariable().getName(), semanticElement); interpreter.setVariable(representationNavigationDes.getContainerViewVariable().getName(), dDiagramElement); precondition = interpreter.evaluateBoolean(semanticElement, representationNavigationDes.getPrecondition()); } catch (EvaluationException e) { RuntimeLoggerManager.INSTANCE.error(representationNavigationDes, ToolPackage.eINSTANCE.getAbstractToolDescription_Precondition(), e); } finally { interpreter.unSetVariable(representationNavigationDes.getContainerVariable().getName()); interpreter.unSetVariable(representationNavigationDes.getContainerViewVariable().getName()); } } if (precondition && checkRepresentationNavigationDescription(interpreter, representationNavigationDes, dDiagramElement)) { return true; } } } } return hasFunctionnalNavigationTool; }
Source:
<code>public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { serverAPIUrl = formData.getString("serverAPIUrl"); username = formData.getString("username"); password = formData.getString("password"); accessToken = formData.getString("accessToken"); adminlist = formData.getString("adminlist"); <START> allowMembersOfWhitelistedOrgsAsAdmin = formData.has("allowMembersOfWhitelistedOrgsAsAdmin") ? formData.getBoolean("allowMembersOfWhitelistedOrgsAsAdmin") : false; <END> publishedURL = formData.getString("publishedURL"); requestForTestingPhrase = formData.getString("requestForTestingPhrase"); whitelistPhrase = formData.getString("whitelistPhrase"); okToTestPhrase = formData.getString("okToTestPhrase"); retestPhrase = formData.getString("retestPhrase"); cron = formData.getString("cron"); useComments = formData.getBoolean("useComments"); logExcerptLines = formData.getInt("logExcerptLines"); unstableAs = formData.getString("unstableAs"); autoCloseFailedPullRequests = formData.getBoolean("autoCloseFailedPullRequests"); msgSuccess = formData.getString("msgSuccess"); msgFailure = formData.getString("msgFailure"); save(); gh = new GhprbGitHub(); return super.configure(req, formData); }</code><technical_language>global config this option add global.jelly file. If want configure globally remove option this section, remove default config.jelly#34. copy 33-35 config.jelly global.jelly want option appear. I this affects local config, I local config set global configure job need corrected time edit config for a job if setting match global</technical_language>

Target:
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { serverAPIUrl = formData.getString("serverAPIUrl"); username = formData.getString("username"); password = formData.getString("password"); accessToken = formData.getString("accessToken"); adminlist = formData.getString("adminlist"); publishedURL = formData.getString("publishedURL"); requestForTestingPhrase = formData.getString("requestForTestingPhrase"); whitelistPhrase = formData.getString("whitelistPhrase"); okToTestPhrase = formData.getString("okToTestPhrase"); retestPhrase = formData.getString("retestPhrase"); skipBuildPhrase = formData.getString("skipBuildPhrase"); cron = formData.getString("cron"); useComments = formData.getBoolean("useComments"); logExcerptLines = formData.getInt("logExcerptLines"); unstableAs = formData.getString("unstableAs"); autoCloseFailedPullRequests = formData.getBoolean("autoCloseFailedPullRequests"); msgSuccess = formData.getString("msgSuccess"); msgFailure = formData.getString("msgFailure"); save(); gh = new GhprbGitHub(); return super.configure(req, formData); }
Source:
<code>public void testEncode(){ if (System.getProperty("os.name").contains("Windows")){ <START> String testPath = "\\foo\\bar\\ham\r"; <END> String expectedEncoded = "\\foo\\bar\\ham%0D"; String actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = "\\foo\\bar\\ham\n"; expectedEncoded = "\\foo\\bar\\ham%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = "\\foo\\bar\\ham\r\n"; expectedEncoded = "\\foo\\bar\\ham%0D%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); } else { Path testPath = Paths.get("/foo/bar/ham\r"); String expectedEncoded = "/foo/bar/ham%0D"; String actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = Paths.get("/foo/bar/ham\n"); expectedEncoded = "/foo/bar/ham%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = Paths.get("/foo/bar/ham\r\n"); expectedEncoded = "/foo/bar/ham%0D%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); } }</code><technical_language>hesitant duplicate code in a test - easy for forget update branch in future. bagit-java requires Java 8, I wondering this unified java.nio.file.Path File.separator</technical_language>

Target:
public void testEncode(){ String actualEncoded; Path testPath; String fileSeparator = FileSystems.getDefault().getSeparator(); StringBuilder sb = new StringBuilder(fileSeparator); String basePathString = sb.append("foo").append(fileSeparator).append("bar"). append(fileSeparator).append("ham").toString(); String testPathString = basePathString.concat("\r"); String expectedEncoded = basePathString.concat("%0D"); if (PathUtils.isWindows()){ actualEncoded = PathUtils.encodeFilenameString(testPathString); } else { testPath = Paths.get(testPathString); actualEncoded = PathUtils.encodeFilename(testPath); } assertEquals(expectedEncoded, actualEncoded); testPathString = basePathString.concat("\n"); expectedEncoded = basePathString.concat("%0A"); if (PathUtils.isWindows()){ actualEncoded = PathUtils.encodeFilenameString(testPathString); } else { testPath = Paths.get(testPathString); actualEncoded = PathUtils.encodeFilename(testPath); } assertEquals(expectedEncoded, actualEncoded); testPathString = basePathString.concat("\r\n"); expectedEncoded = basePathString.concat("%0D%0A"); if (PathUtils.isWindows()){ actualEncoded = PathUtils.encodeFilenameString(testPathString); } else { testPath = Paths.get(testPathString); actualEncoded = PathUtils.encodeFilename(testPath); } assertEquals(expectedEncoded, actualEncoded); }
Source:
<code>private void logCommand(ReplicableCommand command, long requestId, String targets) { if (requestId != Request.NO_REQUEST_ID) { log.tracef("Sending request %d@%s to %s: %s", requestId, address, targets, command); } else { <START> log.tracef("Sending command from %s to %s: %s", address, targets, command); <END> } }</code><technical_language>why? IMO, create InfinispanHeader this kind of information (request id, cache name, etc)</technical_language>

Target:
private void logCommand(ReplicableCommand command, long requestId, String targets) { if (requestId != Request.NO_REQUEST_ID) { log.tracef("%s sending request %d to %s: %s", address, requestId, targets, command); } else { log.tracef("%s sending command to %s: %s", address, targets, command); } }
Source:
<code>protected void execute() { <START> if (this.logger.isDebugEnabled()) { <END> this.logger.debug("refreshing status"); } queryStatus(); }</code><technical_language>unneeded if clause</technical_language>

Target:
protected void execute() { this.logger.debug("refreshing status"); queryStatus(); }
Source:
<code>public void flipPhase(long yieldTimeNsec) { if (!readerLock.isHeldByCurrentThread()) { throw new IllegalStateException("flipPhase() can only be called while holding the readerLock()"); } boolean nextPhaseIsEven = (startEpoch.get(0) < 0); long initialStartValue; if (nextPhaseIsEven) { initialStartValue = 0; for (int i=0; i<stripes; i++) { evenEndEpoch.lazySet(i, initialStartValue + i * stride); } } else { initialStartValue = Long.MIN_VALUE; for (int i=0; i<stripes; i++) { <START> oddEndEpoch.lazySet(i, initialStartValue + i * stride); <END> } } final long[] startValueAtFlip = new long[stripes]; for (int i=0; i<stripes; i++) { startValueAtFlip[i] = startEpoch.getAndSet(i, initialStartValue + i * stride); } for (;;) { if (!caughtUp(startValueAtFlip, nextPhaseIsEven ? oddEndEpoch : evenEndEpoch)) { if (yieldTimeNsec == 0) { Thread.yield(); } else { try { TimeUnit.NANOSECONDS.sleep(yieldTimeNsec); } catch (InterruptedException ex) { } } } else { break; } } }</code><technical_language>need epoch start values a range stripe. stripes independently start 0 (for even) Long.Min_VALUE (for odd). remove + i * stride logic in initialization above</technical_language>

Target:
public void flipPhase(long yieldTimeNsec) { if (!readerLock.isHeldByCurrentThread()) { throw new IllegalStateException("flipPhase() can only be called while holding the readerLock()"); } boolean nextPhaseIsEven = (startEpoch.get(0) < 0); long initialStartValue; if (nextPhaseIsEven) { initialStartValue = 0; for (int i = 0; i < stripes; i++) { evenEndEpoch.lazySet(i * STRIDE, initialStartValue); } } else { initialStartValue = Long.MIN_VALUE; for (int i = 0; i < stripes; i++) { oddEndEpoch.lazySet(i * STRIDE, initialStartValue); } } final long[] startValueAtFlip = new long[stripes]; for (int i = 0; i < stripes; i++) { startValueAtFlip[i] = startEpoch.getAndSet(i * STRIDE, initialStartValue); } while (!caughtUp(startValueAtFlip, nextPhaseIsEven ? oddEndEpoch : evenEndEpoch)) { if (yieldTimeNsec == 0) { Thread.yield(); } else { try { TimeUnit.NANOSECONDS.sleep(yieldTimeNsec); } catch (InterruptedException ex) { } } } }
Source:
<code>private void wipe(long thresholdMillis, Boolean saveResultsToDB) { long currentTimeMillis = System.currentTimeMillis(); LOGGER.info(getDatabaseName() + " Postgres wiper, checking for records older than ms", thresholdMillis); List<String> oldRecords = findOldRecords(currentTimeMillis, thresholdMillis); if (oldRecords.size() > 0) { if (!saveResultsToDB) { for (String recordId : oldRecords) { if (recordId.toLowerCase().contains("output")) { deleteFileOnDisk(recordId); } } } <START> LOGGER.info("Cleaned records from database", deleteRecords(oldRecords)); <END> } }</code><technical_language>actual work a logger statement is a smelly smell. This save a variable previous line</technical_language>

Target:
private void wipe(long thresholdMillis, Boolean saveResultsToDB) { long currentTimeMillis = System.currentTimeMillis(); LOGGER.info(getDatabaseName() + " Postgres wiper, checking for records older than ms", thresholdMillis); List<String> oldRecords = findOldRecords(currentTimeMillis, thresholdMillis); if (oldRecords.size() > 0) { if (!saveResultsToDB) { for (String recordId : oldRecords) { if (recordId.toLowerCase().contains("output")) { deleteFileOnDisk(recordId); } } } Integer recordsDeleted = deleteRecords(oldRecords); LOGGER.info("Cleaned records from database", recordsDeleted); } }