auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Set<LockToken> unlock(Set<LockToken> tokens) { <START> Set<LeasedLockToken> leasedLockTokens = tokens.stream() <END> .map(token -> (LeasedLockToken) token) .collect(Collectors.toSet()); leasedLockTokens.forEach(LeasedLockToken::inValidate); return delegate.unlock(leasedLockTokens.stream() .map(LeasedLockToken::serverToken) .collect(Collectors.toSet())); }</code><technical_language>this snippet feels a static method factor out in method, private static Set<LeasedLockToken> leasedTokens(Set<LockToken> tokens)</technical_language>

Target:
public Set<LockToken> unlock(Set<LockToken> tokens) { Set<LeasedLockToken> leasedLockTokens = leasedTokens(tokens); leasedLockTokens.forEach(LeasedLockToken::inValidate); return delegate.unlock(serverTokens(leasedLockTokens)); }
Source:
<code>private void showDeveloperContact() { View parentLayout = findViewById(android.R.id.content); String snackbarMsg; <START> if (developerContact.equals("")) { <END> snackbarMsg = getString(R.string.api_version_no_developer_contact); } else { snackbarMsg = getString(R.string.api_version_developer_contact, developerContact); } Snackbar snackbar = Snackbar.make(parentLayout, snackbarMsg, 5000); View snackbarView = snackbar.getView(); TextView snackTextView = (TextView) snackbarView.findViewById(com.google.android.material.R.id.snackbar_text); snackTextView.setTextColor(Color.WHITE); snackTextView.setMaxLines(3); snackbar.setActionTextColor(Color.MAGENTA) .setAction("VIEW", view -> { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("<LINK_0>")); getApplicationContext().startActivity(intent); }); snackbar.show(); }</code><technical_language>Needs handle user supplying null suggestion if (TextUtils.isEmpty(developerContact)) {</technical_language>

Target:
private void showDeveloperContact() { View parentLayout = findViewById(android.R.id.content); String snackbarMsg; if (TextUtils.isEmpty(mCardSuppliedDeveloperContact)) { snackbarMsg = getString(R.string.api_version_no_developer_contact); } else { snackbarMsg = getString(R.string.api_version_developer_contact, mCardSuppliedDeveloperContact ); } Snackbar snackbar = Snackbar.make(parentLayout, snackbarMsg, Snackbar.LENGTH_LONG); View snackbarView = snackbar.getView(); TextView snackTextView = snackbarView.findViewById(com.google.android.material.R.id.snackbar_text); snackTextView.setTextColor(Color.WHITE); snackTextView.setMaxLines(3); snackbar.setActionTextColor(Color.MAGENTA) .setAction(getString(R.string.reviewer_invalid_api_version_visit_documentation), view -> { openUrl(Uri.parse("<LINK_0>")); }); snackbar.show(); }
Source:
<code>public StreamingAggregate(@Nullable final Operator child, @Nonnull final int[] gfields, @Nonnull final AggregatorFactory... factories) { super(child); gFields = Objects.requireNonNull(gfields, "gfields"); gTypes = new Type[gfields.length]; this.factories = Objects.requireNonNull(factories, "factories"); Preconditions.checkArgument(gfields.length > 0, " must have at least one group by field"); Preconditions.checkArgument(factories.length > 0, "to use StreamingAggregate, must specify some aggregates"); gRange = new int[gfields.length]; <START> for (int i = 0; i < gfields.length; ++i) { <END> gRange[i] = i; } }</code><technical_language>Nitpick: prefer gRange.length array bounds of array modified</technical_language>

Target:
public StreamingAggregate(@Nullable final Operator child, @Nonnull final int[] gfields, @Nonnull final AggregatorFactory... factories) { super(child); gFields = Objects.requireNonNull(gfields, "gfields"); this.factories = Objects.requireNonNull(factories, "factories"); Preconditions.checkArgument(gfields.length > 0, " must have at least one group by field"); Preconditions.checkArgument(factories.length > 0, "to use StreamingAggregate, must specify some aggregates"); gRange = new int[gfields.length]; for (int i = 0; i < gRange.length; ++i) { gRange[i] = i; } }
Source:
<code><START> private OAuthFederatedSource getSource(Source source) { <END> Bundle bundle = FrameworkUtil.getBundle(OAuthPlugin.class); if (bundle == null) { return null; } BundleContext bundleContext = bundle.getBundleContext(); if (bundleContext == null) { return null; } OAuthFederatedSource oauthSource; try { Collection<ServiceReference<OAuthFederatedSource>> implementers = bundleContext.getServiceReferences(OAuthFederatedSource.class, null); oauthSource = implementers .stream() .map(bundleContext::getService) .filter(s -> s.getId().equals(source.getId())) .filter(s -> s.getAuthenticationType().equals(OAUTH)) .filter(s -> s.getOauthFlow().equals(CODE_FLOW)) .findFirst() .orElse(null); } catch (InvalidSyntaxException e) { return null; } return oauthSource; }</code><technical_language>a good idea add some logging a lot wrong</technical_language>

Target:
OAuthFederatedSource getSource(Source source) { Bundle bundle = FrameworkUtil.getBundle(OAuthPlugin.class); if (bundle == null) { return null; } BundleContext bundleContext = bundle.getBundleContext(); if (bundleContext == null) { return null; } OAuthFederatedSource oauthSource; try { Collection<ServiceReference<OAuthFederatedSource>> implementers = bundleContext.getServiceReferences(OAuthFederatedSource.class, null); oauthSource = implementers .stream() .map(bundleContext::getService) .filter(s -> s.getId().equals(source.getId())) .filter(s -> s.getAuthenticationType().equals(OAUTH)) .filter(s -> s.getOauthFlow().equals(CODE_FLOW)) .findFirst() .orElse(null); } catch (InvalidSyntaxException e) { LOGGER.warn("Error getting source.", e); return null; } return oauthSource; }
Source:
<code>public boolean getSaveOffline() { <START> if (pages.size() == 0) { <END> return emptyListSavePagesState; } for (ReadingListPage page : pages) { if (!page.savedOrSaving()) { return false; } } return true; }</code><technical_language>isEmpty()</technical_language>

Target:
public boolean getSaveOffline() { if (pages.isEmpty()) { return emptyListSavePagesState; } for (ReadingListPage page : pages) { if (!page.savedOrSaving()) { return false; } } return true; }
Source:
<code>private double getAverageTimeInMillis() { <START> return Arrays.stream(sortedTimes).average().getAsDouble() / 1_000_000f; <END> }</code><technical_language>specific reason explicitly float divisor widen double? this return Arrays.stream(sortedTimes).average().getAsDouble() / 1_000_000.0;</technical_language>

Target:
private double getAverageTimeInMillis() { return Arrays.stream(sortedTimes).average().getAsDouble() / 1_000_000.0; }
Source:
<code>private void populateRemitAddress(PaymentWorksVendor pmwVendor, VendorDetail vendorDetail) { List<VendorAddress> remitAddresses = findAllActiveRemitAddresses(vendorDetail.getVendorAddresses()); <START> if (remitAddresses.size() == 1) { <END> VendorAddress remitAddress = remitAddresses.get(0); pmwVendor.setRemittanceAddressStreet1(remitAddress.getVendorLine1Address()); pmwVendor.setRemittanceAddressStreet2(remitAddress.getVendorLine2Address()); pmwVendor.setRemittanceAddressCity(remitAddress.getVendorCityName()); pmwVendor.setRemittanceAddressState(remitAddress.getVendorStateCode()); pmwVendor.setRemittanceAddressCountry(convertFipsCountryCodeToIsoCountryCode(remitAddress.getVendorCountryCode())); pmwVendor.setRemittanceAddressZipCode(remitAddress.getVendorZipCode()); } else { LOG.error("populateRemitAddress: KFS Approved PVEN does not contain one and only one Active Remit Address for vendor " + vendorDetail.getVendorHeaderGeneratedIdentifier() + "-" + vendorDetail.getVendorDetailAssignedIdentifier()); } }</code><technical_language>do need check for nulls this return a list</technical_language>

Target:
private void populateRemitAddress(PaymentWorksVendor pmwVendor, VendorDetail vendorDetail) { List<VendorAddress> remitAddresses = findAllActiveRemitAddresses(vendorDetail.getVendorAddresses()); if (ObjectUtils.isNotNull(remitAddresses) && remitAddresses.size() == 1) { VendorAddress remitAddress = remitAddresses.get(0); pmwVendor.setRemittanceAddressStreet1(remitAddress.getVendorLine1Address()); pmwVendor.setRemittanceAddressStreet2(remitAddress.getVendorLine2Address()); pmwVendor.setRemittanceAddressCity(remitAddress.getVendorCityName()); pmwVendor.setRemittanceAddressState(remitAddress.getVendorStateCode()); pmwVendor.setRemittanceAddressCountry(convertFipsCountryCodeToIsoCountryCode(remitAddress.getVendorCountryCode())); pmwVendor.setRemittanceAddressZipCode(remitAddress.getVendorZipCode()); } else { LOG.error("populateRemitAddress: KFS Approved PVEN does not contain one and only one Active Remit Address for vendor " + vendorDetail.getVendorHeaderGeneratedIdentifier() + "-" + vendorDetail.getVendorDetailAssignedIdentifier()); } }
Source:
<code>private static ApiResponseElement processLogs( String filePath, ExtensionImportLogFiles importer, LogType logType, String httpPOSTData) { String sourceFilePath = filePath; String targetfileName = sourceFilePath.substring( sourceFilePath.lastIndexOf("\\") + 1, sourceFilePath.lastIndexOf(".")) + ".txt"; String absoluteTargetFilePath = getLoggingStorageDirectory(logType) + "\\" + targetfileName; File targetFile = new File(absoluteTargetFilePath); if (!targetFile.isFile() ) { try { targetFile.createNewFile(); } catch (Exception ex) { return new ApiResponseElement( "Parsing logs files to ZAPs site tree", "Failed - Could not create file on server"); } } else { return new ApiResponseElement( "Parsing logs files to ZAPs site tree", "Not processed - File already added"); } if (httpPOSTData == null) { try (BufferedReader br = new BufferedReader(new FileReader(sourceFilePath)); BufferedWriter wr = new BufferedWriter(new FileWriter(targetFile))) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { wr.write(sCurrentLine); wr.newLine(); } } catch (IOException e) { log.error(e.getMessage(), e); } } else { try (FileOutputStream fop = new FileOutputStream(targetFile)) { byte[] contentInBytes = httpPOSTData.getBytes(); fop.write(contentInBytes); fop.flush(); <START> fop.close(); <END> } catch (IOException ex) { log.error(ex.getMessage(), ex); } } importer.processInput(targetFile, logType); return new ApiResponseElement("Parsing log files to ZAPs site tree", "Suceeded"); }</code><technical_language>This needs removed (causing build fail)</technical_language>

Target:
private static ApiResponseElement processLogs( String filePath, ExtensionImportLogFiles importer, LogType logType, String httpPOSTData) { String sourceFilePath = filePath; String targetfileName = sourceFilePath.substring( sourceFilePath.lastIndexOf("\\") + 1, sourceFilePath.lastIndexOf(".")) + ".txt"; String absoluteTargetFilePath = getLoggingStorageDirectory(logType) + "\\" + targetfileName; File targetFile = new File(absoluteTargetFilePath); if (!targetFile.isFile() ) { try { targetFile.createNewFile(); } catch (Exception ex) { return new ApiResponseElement( "Parsing logs files to ZAPs site tree", "Failed - Could not create file on server"); } } else { return new ApiResponseElement( "Parsing logs files to ZAPs site tree", "Not processed - File already added"); } if (httpPOSTData == null) { try (BufferedReader br = new BufferedReader(new FileReader(sourceFilePath)); BufferedWriter wr = new BufferedWriter(new FileWriter(targetFile))) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { wr.write(sCurrentLine); wr.newLine(); } } catch (IOException e) { log.error(e.getMessage(), e); } } else { try (FileOutputStream fop = new FileOutputStream(targetFile)) { byte[] contentInBytes = httpPOSTData.getBytes(); fop.write(contentInBytes); fop.flush(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } importer.processInput(targetFile, logType); return new ApiResponseElement("Parsing log files to ZAPs site tree", "Suceeded"); }
Source:
<code>public void simpleTest() { VisibleAssertions.assertThrows("starting with an invalid docker-compose file throws an exception", <START> IllegalStateException.class, <END> () -> { DockerComposeContainer environment = new DockerComposeContainer(new File("src/test/resources/invalid-compose.yml")) .withExposedService("something", 123); }); }</code><technical_language>I IllegalArgumentException is better</technical_language>

Target:
public void simpleTest() { VisibleAssertions.assertThrows("starting with an invalid docker-compose file throws an exception", IllegalArgumentException.class, () -> { DockerComposeContainer environment = new DockerComposeContainer(new File("src/test/resources/invalid-compose.yml")) .withExposedService("something", 123); }); }
Source:
<code>private void loadBufferAndDrawerState() { NetworkCollection networks = NetworkCollection.getInstance(); if (networks != null) { if (openedBuffer == -1 || networks.getBufferById(openedBuffer) == null) { Log.d(TAG, "Loading state: Empty"); openedBuffer = -1; BusProvider.getInstance().post(new BufferOpenedEvent(-1, false)); drawer.closeDrawer(Gravity.END); <START> drawer.openDrawer(Gravity.START); <END> } else { Log.d(TAG, "Loading state: "+openedBuffer); manager.openDrawer(openedDrawer); BusProvider.getInstance().post(new BufferOpenedEvent(openedBuffer, true)); } } }</code><technical_language>drawer state is handled partly MainActivity other places manager abstraction. this unified drawer handing place, in manager</technical_language>

Target:
private void loadBufferAndDrawerState() { NetworkCollection networks = NetworkCollection.getInstance(); if (networks != null) { if (openedBuffer == -1 || networks.getBufferById(openedBuffer) == null) { Log.d(TAG, "Loading state: Empty"); openedBuffer = -1; BusProvider.getInstance().post(new BufferOpenedEvent(-1, false)); manager.openDrawer(Gravity.START); } else { Log.d(TAG, "Loading state: "+openedBuffer); manager.openDrawer(openedDrawer); BusProvider.getInstance().post(new BufferOpenedEvent(openedBuffer, true)); } } }
Source:
<code>public List<MassRepairOption> getActiveMassRepairOptions() { if (!hasActiveMassRepairOption()) { <START> return new ArrayList<>(); <END> } List<MassRepairOption> activeMassRepairOptions = new ArrayList<>(); for (MassRepairOption massRepairOption : getMassRepairOptions()) { if (massRepairOption.isActive()) { activeMassRepairOptions.add(massRepairOption); } } return activeMassRepairOptions; }</code><technical_language>If this immutable prefer Collections.emptyList(). (realizing this inherited code)</technical_language>

Target:
public List<MassRepairOption> getActiveMassRepairOptions() { if (!hasActiveMassRepairOption()) { return Collections.emptyList(); } List<MassRepairOption> activeMassRepairOptions = new ArrayList<>(); for (MassRepairOption massRepairOption : getMassRepairOptions()) { if (massRepairOption.isActive()) { activeMassRepairOptions.add(massRepairOption); } } return activeMassRepairOptions; }
Source:
<code>public @NonNull <START> ITmfCommonXAxisResponse fetchXY(@NonNull <END> TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { long[] xValues = filter.getTimesRequested(); int n = xValues.length; final double[] y = new double[n]; final long[] yLong = new long[n]; for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); final ITmfStatistics stats = Objects.requireNonNull(statsMod.getStatistics()); List<Long> values = stats.histogramQuery(filter.getStart(), filter.getEnd(), n); for (int i = 0; i < n; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < n; i++) { y[i] = yLong[i]; } Map<String, IYModel> ySeries = new HashMap<>(); String name = "Number of events"; ySeries.put(name, new YModel(name, y)); return TmfCommonXAxisResponseFactory.create("New Histogram", xValues, ySeries, filter.getEnd(), true); }</code><technical_language>API</technical_language>

Target:
public @NonNull ITmfCommonXAxisResponse fetchXY(@NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { long[] xValues = filter.getTimesRequested(); int n = xValues.length; double[] y = new double[n]; long[] yLong = new long[n]; for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); final ITmfStatistics stats = Objects.requireNonNull(statsMod.getStatistics()); List<Long> values = stats.histogramQuery(filter.getStart(), filter.getEnd(), n); for (int i = 0; i < n; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < n; i++) { y[i] = yLong[i]; } String title = Messages.HistogramDataProvider_Title; ImmutableMap.Builder<String, IYModel> ySeries = ImmutableMap.builder(); String seriesName = Messages.HistogramDataProvider_NumberOfEvent; ySeries.put(seriesName, new YModel(seriesName, y)); return TmfCommonXAxisResponseFactory.create(title, xValues, ySeries.build(), filter.getEnd(), true); }
Source:
<code>public String getLocalTime(Date date) { <START> Assert.notNull(date, "The provided date must not be null."); <END> return CommonUtils.getLocalTime(date, this.clientTimeZone); }</code><technical_language>reason for NPE in doStopJobExecution(org.springframework.xd.shell.command.JobCommandTests) here: final String startTimeAsString = this.configuration.getLocalTime(jobExecutionInfoResource.getJobExecution().getStartTime()); JobExecution startTime null</technical_language>

Target:
public String getLocalTime(Date date) { return CommonUtils.getLocalTime(date, this.clientTimeZone); }
Source:
<code>public String obtainSst(final HttpClient httpClient, final HttpHost httpHost) throws IOException { notNull(httpClient, "client can't be null"); notNull(httpHost, "host can't be null"); log.debug("Obtaining SST"); final HttpPost postLogin = new HttpPost(LOGIN_URL); try { final HttpEntity requestEntity = new StringEntity(createLoginJson(), ContentType.APPLICATION_JSON); postLogin.setEntity(requestEntity); postLogin.setHeader(HttpHeaders.ACCEPT, YAML_CONTENT_TYPE); final HttpResponse response = httpClient.execute(httpHost, postLogin); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { <START> Header requestIdHeader = response.getFirstHeader(X_GDC_REQUEST_HEADER_NAME); <END> HttpEntity responseEntity = response.getEntity(); String message = String.format("Unable to login reason='%s'. Request tracking details httpStatus=%s requestId=%s", (responseEntity != null) ? EntityUtils.toString(responseEntity) : null, status, (requestIdHeader != null) ? requestIdHeader.getValue() : null); log.info(message); throw new GoodDataAuthException(message); } return TokenUtils.extractToken(response); } finally { postLogin.reset(); } }</code><technical_language>Please, variables final if assigned again</technical_language>

Target:
public String obtainSst(final HttpClient httpClient, final HttpHost httpHost) throws IOException { notNull(httpClient, "client can't be null"); notNull(httpHost, "host can't be null"); log.debug("Obtaining SST"); final HttpPost postLogin = new HttpPost(LOGIN_URL); try { final HttpEntity requestEntity = new StringEntity(createLoginJson(), ContentType.APPLICATION_JSON); postLogin.setEntity(requestEntity); postLogin.setHeader(HttpHeaders.ACCEPT, YAML_CONTENT_TYPE); final HttpResponse response = httpClient.execute(httpHost, postLogin); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { final Header requestIdHeader = response.getFirstHeader(X_GDC_REQUEST_HEADER_NAME); final HttpEntity responseEntity = response.getEntity(); final String message = format("Unable to login reason='%s'. Request tracking details httpStatus=%s requestId=%s", getReason(responseEntity), status, getRequestId(requestIdHeader)); log.info(message); throw new GoodDataAuthException(message); } return TokenUtils.extractToken(response); } finally { postLogin.reset(); } }
Source:
<code>private void executeDeletion() { List<Metacard> allSystemTemplates = retrieveSystemMetacards(); if (allSystemTemplates.isEmpty()) { console.println(ansi().fgBrightRed().a("No system forms exist.").reset()); return; } try { List<String> systemTempIds = singleDeletion != null ? ImmutableList.of(singleDeletion) : retrieveListMetacardIds(allSystemTemplates); List<String> deletedMetacardIds = this.executeSystemTemplateRemoval(systemTempIds); if (deletedMetacardIds.isEmpty()) { <START> console.println(ansi().fgBrightRed().a("No system forms were deleted").reset()); <END> } else { for (String id : deletedMetacardIds) { console.println(ansi().fgBrightYellow().a("Deleted: ").fgGreen().a(id).reset()); } } } catch (IngestException | SourceUnavailableException e) { console.println(ansi().fgBrightRed().a("Error removing system forms").reset()); LOGGER.debug("Error removing system forms", e); } }</code><technical_language>I recommend pulling brightRed brightYellow chains functions called warn error</technical_language>

Target:
private void executeDeletion() { List<Metacard> allSystemTemplates = retrieveSystemMetacards(); if (allSystemTemplates.isEmpty()) { printColor(WARNING_COLOR, "No system forms exist."); return; } try { List<String> systemTemplateIds = singleDeletion != null ? ImmutableList.of(singleDeletion) : retrieveMetacardIds(allSystemTemplates); List<String> deletedMetacardIds = this.executeSystemTemplateRemoval(systemTemplateIds); if (deletedMetacardIds.isEmpty()) { printColor(WARNING_COLOR, "No system forms were deleted"); } else { for (String id : deletedMetacardIds) { console.println(ansi().fgBrightYellow().a("Deleted: ").fgGreen().a(id).reset()); } } } catch (IngestException | SourceUnavailableException e) { LOGGER.debug("Error removing system forms", e); printErrorMessage("Error removing system forms: " + e.getMessage()); } }
Source:
<code>public String readLine() { <START> String line = System.console().readLine(); <END> log.info("Read from stdin \"" + line + "\"."); return line; }</code><technical_language>this is stdin? I this is terminal... check echo "alon" | java xxx, if reads "alon"</technical_language>

Target:
public String readLine() { StringBuilder buffer = new StringBuilder(); for (;;) { int character; try { character = System.in.read(); } catch (IOException exception) { log.error( "Error while reading line from standard input. Will " + "consider it the end of the line and continue.", exception ); break; } if (character == -1 || character == '\n') { break; } buffer.append((char) character); } String line = buffer.toString(); log.info("Read from stdin \"" + line + "\"."); return line; }
Source:
<code>public void addToBatch(RowData record) throws SQLException { <START> RowData key = keyExtractor.apply(record); <END> reduceBuffer.put(key, Tuple2.of(changeFlag(record.getRowKind()), valueTransform.apply(record))); }</code><technical_language>omit this local variable? reduceBuffer.put(keyExtractor.apply(record), Tuple2.of(changeFlag(record.getRowKind()), recordExtractor.apply(record)));</technical_language>

Target:
public void addToBatch(RowData record) throws SQLException { RowData key = keyExtractor.apply(record); boolean flag = changeFlag(record.getRowKind()); RowData value = valueTransform.apply(record); reduceBuffer.put(key, Tuple2.of(flag, value)); }
Source:
<code>private void filterSortPaginateSanityCheck(Environment environment) { if(environment.filters.isPresent() || environment.sort.isPresent() || environment.offset.isPresent() || environment.first.isPresent()) { <START> throw new IllegalArgumentException("Pagination/Filtering/Sorting is only supported with FETCH operation"); <END> } }</code><technical_language>throw BadRequestException. throw IllegalArgumentException. consistent</technical_language>

Target:
private void filterSortPaginateSanityCheck(Environment environment) { if(environment.filters.isPresent() || environment.sort.isPresent() || environment.offset.isPresent() || environment.first.isPresent()) { throw new BadRequestException("Pagination/Filtering/Sorting is only supported with FETCH operation"); } }
Source:
<code>private void sendDeletedEvents(List<Entitlement> entsToRevoke) { for (Entitlement entitlement : entsToRevoke) { Consumer consumer = entitlement.getConsumer(); Event event = eventFactory.entitlementDeleted(entitlement); if (!entitlement.isValid() && entitlement.getPool().isUnmappedGuestPool() && consumerCurator.getHost(consumer.getFact("virt.uuid"), consumer.getOwner()) == null) { event = eventFactory.entitlementExpired(entitlement); event.setMessageText(event.getMessageText() + ": " + i18n .tr("Unmapped guest entitlement expired " + <START> "without establishing a host/guest mapping.")); <END> } sink.queueEvent(event); } }</code><technical_language>Small formatting issue here. fit line above</technical_language>

Target:
private void sendDeletedEvents(List<Entitlement> entsToRevoke) { for (Entitlement entitlement : entsToRevoke) { Consumer consumer = entitlement.getConsumer(); Event event = eventFactory.entitlementDeleted(entitlement); if (!entitlement.isValid() && entitlement.getPool().isUnmappedGuestPool() && consumerCurator.getHost(consumer.getFact("virt.uuid"), consumer.getOwner()) == null) { event = eventFactory.entitlementExpired(entitlement); event.setMessageText(event.getMessageText() + ": " + i18n .tr("Unmapped guest entitlement expired without establishing a host/guest mapping.")); } sink.queueEvent(event); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart editor = HandlerUtil.getActiveEditor(event); ISelection selection = HandlerUtil.getCurrentSelection(event); if(editor != null && selection != null) { if(selection instanceof ITextSelection) { ITextSelection text = (ITextSelection) selection; IEditorInput input = editor.getEditorInput(); if(input instanceof IFileEditorInput) { try { IFileEditorInput fileInput = (IFileEditorInput) input; IFile file = fileInput.getFile(); String fileExtension = file.getFileExtension(); String title = editor.getTitle(); Set<TaskRepository> repositories = TasksUi.getRepositoryManager().getRepositories(GitHub.CONNECTOR_KIND); TaskRepository repository = repositories.iterator().next(); GitHubService service = new GitHubService(); GitHubCredentials credentials = GitHubCredentials.create(repository); String url = service.createGist(title, fileExtension, text.getText(), credentials); Shell shell = HandlerUtil.getActiveShell(event); GistNotificationPopup popup = new GistNotificationPopup(shell.getDisplay(), url, title); popup.create(); popup.open(); } catch (GitHubServiceException e) { <START> e.printStackTrace(); <END> } catch (IOException e) { e.printStackTrace(); } } } } return null; }</code><technical_language>1 exception handling please ..</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart editor = HandlerUtil.getActiveEditor(event); ISelection selection = HandlerUtil.getCurrentSelection(event); IStructuredSelection menuSelection = (IStructuredSelection) HandlerUtil .getActiveMenuSelection(event); if(selection != null && menuSelection == null) { if(selection instanceof ITextSelection) { ITextSelection text = (ITextSelection) selection; IEditorInput input = editor.getEditorInput(); if(input instanceof IFileEditorInput) { IFileEditorInput fileInput = (IFileEditorInput) input; IFile file = fileInput.getFile(); createGistJob(file.getName(), file.getFileExtension(), text.getText()); } } } if(menuSelection != null) { Object obj = menuSelection.getFirstElement(); if(obj instanceof IFile) { IFile file = (IFile) obj; createGistJob(file); } } return null; }
Source:
<code>public boolean sendSerialData(XBee16BitAddress address, byte[] data) throws InvalidOperatingModeException, XBeeException { XBeePacket xbeePacket; XBeePacket receivedPacket; <START> <END> if (address == null || data == null) throw new XBeeException(XBeeException.INVALID_ARGUMENT, "Address and data cannot be null"); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX16Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket instanceof TXStatusPacket) { switch (((TXStatusPacket)receivedPacket).getStatus()) { case SUCCESS: return true; default: return false; } } else return false; default: xbeePacket = new TransmitPacket(getNextFrameID(), XBee64BitAddress.UNKNOWN_ADDRESS, address, 0, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket instanceof TransmitStatusPacket) { switch (((TransmitStatusPacket)receivedPacket).getDeliveryStatus()) { case SUCCESS: return true; default: return false; } } else return false; } }</code><technical_language>check isOpened status anything</technical_language>

Target:
public boolean sendSerialData(XBee16BitAddress address, byte[] data) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); XBeePacket xbeePacket; XBeePacket receivedPacket; if (address == null || data == null) throw new XBeeException(XBeeException.INVALID_ARGUMENT, "Address and data cannot be null"); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX16Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TXStatusPacket) { switch (((TXStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; default: xbeePacket = new TransmitPacket(getNextFrameID(), XBee64BitAddress.UNKNOWN_ADDRESS, address, 0, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TransmitStatusPacket) { switch (((TransmitStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; } }
Source:
<code>private void executeStreamer(IgniteZeroMqStreamer streamer, int clientSocket, byte[] topic) throws InterruptedException { streamer.setSingleTupleExtractor(new ZeroMqStringSingleTupleExtractor()); CacheListener listener = subscribeToPutEvents(); streamer.start(); <START> <END> startZeroMqClient(clientSocket, topic); CountDownLatch latch = listener.getLatch(); latch.await(); unsubscribeToPutEvents(listener); IgniteCache<Integer, String> cache = grid().cache(null); int testId = CACHE_ENTRY_COUNT - 1; String cachedValue = cache.get(testId); assertTrue(cachedValue != null && cachedValue.equals(String.valueOf(testId))); assertTrue(cache.size() == CACHE_ENTRY_COUNT); cache.clear(); }</code><technical_language>cache is empty assertEquals(0, cache.size(CachePeekMode.PRIMARY));</technical_language>

Target:
private void executeStreamer(IgniteZeroMqStreamer streamer, int clientSocket, byte[] topic) throws Exception { streamer.setSingleTupleExtractor(new ZeroMqStringSingleTupleExtractor()); IgniteCache<Integer, String> cache = grid().cache(null); CacheListener listener = subscribeToPutEvents(); streamer.start(); assertEquals(0, cache.size(CachePeekMode.PRIMARY)); startZeroMqClient(clientSocket, topic); CountDownLatch latch = listener.getLatch(); latch.await(); unsubscribeToPutEvents(listener); int testId = CACHE_ENTRY_COUNT - 1; String cachedValue = cache.get(testId); assertTrue(cachedValue != null && cachedValue.equals(String.valueOf(testId))); assertTrue(cache.size() == CACHE_ENTRY_COUNT); cache.clear(); }
Source:
<code>public EventTypeRepository eventTypeRepository() throws Exception { final EventTypeRepository dbRepo = new EventTypeDbRepository(jdbcTemplate, jsonConfig.jacksonObjectMapper()); final String connectString = zookeeperConfig.zooKeeperHolder().get().getZookeeperClient().getCurrentConnectionString(); final RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); <START> final CuratorFramework client = CuratorFrameworkFactory.newClient(connectString, retryPolicy); <END> client.start(); return new EventTypeCachedRepository(dbRepo, new EventTypeCache(dbRepo, client)); }</code><technical_language>do create a seconds CuratorFramework here? in <LINK_0></technical_language>

Target:
public EventTypeRepository eventTypeRepository() throws Exception { final EventTypeRepository dbRepo = new EventTypeDbRepository(jdbcTemplate, jsonConfig.jacksonObjectMapper()); final CuratorFramework client = zookeeperConfig.zooKeeperHolder().get(); final EventTypeCache cache = new EventTypeCache(dbRepo, client); return new CachingEventTypeRepository(dbRepo, cache); }
Source:
<code>private void handleAccount(Account account) { if (account == null) { Logger.debug("Authentication failed."); return; } myAccount = account; if (account.isFirst()) { final CommandOutputBuffer co = new CommandOutputBuffer(this); <START> handleBotCommand(new String[]{"show", "firsttime"}, co); <END> if (account.isAdmin()) { sendBotMessage(""); handleBotCommand(new String[]{"show", "firsttime", "admin"}, co); } co.send(); } }</code><technical_language>new stuff replicate this behaviour anywhere? moment, pass a "client type" in username. "Dataforce+mobile+tapchat" for example is User "Dataforce", subclient "mobile", client-type "tapchat". client-type is for allowing tapchat send "./me", "./nick" "./away" commands (#51, #54)</technical_language>

Target:
private void handleAccount(Account account) { if (account == null) { Logger.debug("Authentication failed."); return; } myAccount = account; if (account.isFirst()) { final CommandOutputBuffer co = new CommandOutputBuffer(this); handleBotCommand(new String[]{"show", "firsttime"}, co); if (account.isAdmin()) { sendBotMessage(""); handleBotCommand(new String[]{"show", "firsttime", "admin"}, co); } co.send(); } if (authenticator.getClientType() != null) { clientType = ClientType.getFromName(authenticator.getClientType().toLowerCase()); } }
Source:
<code>private void addBulkMethodEntriesCount(BulkOps op, long count) { LongAdder current = bulkMethodEntries.get(op); <START> if (current == null) { <END> LongAdder newCount = new LongAdder(); current = bulkMethodEntries.putIfAbsent(op, newCount); if (current == null) { current = newCount; } } current.add(count); }</code><technical_language>a pre-inited EnumMap do this null check</technical_language>

Target:
private void addBulkMethodEntriesCount(BulkOps op, long count) { bulkMethodEntries.get(op).add(count); }
Source:
<code>public final int getSubPartitionIndex() { return subpartitionInfo.getSubPartitionIdx(); <START> } <END></code><technical_language>nit: is necessary define final for method</technical_language>

Target:
public int getSubPartitionIndex() { return subpartitionInfo.getSubPartitionIdx(); }
Source:
<code>public void execute(QueryRunner prestoExecutor, DataSetup dataSetup) { List<Type> expectedTypes = inputs.stream().map(Input::getPrestoResultType).collect(toList()); List<Object> expectedResults = inputs.stream().map(Input::toPrestoQueryResult).collect(toList()); try (TestTable testTable = dataSetup.setupTestTable(unmodifiableList(inputs))) { MaterializedResult materializedRows = prestoExecutor.execute("SELECT * from " + testTable.getName()); assertEquals(materializedRows.getTypes(), expectedTypes); List<Object> actualResults = getOnlyElement(materializedRows).getFields(); assertEquals(actualResults.size(), expectedResults.size(), "lists don't have the same size"); for (int i = 0; i < expectedResults.size(); i++) { <START> assertEquals(actualResults.get(i), expectedResults.get(i), format("Element %s", i)); <END> } } }</code><technical_language>Nit: this java assertEquals(..., "Element " + i);</technical_language>

Target:
public void execute(QueryRunner prestoExecutor, DataSetup dataSetup) { List<Type> expectedTypes = inputs.stream().map(Input::getPrestoResultType).collect(toList()); List<Object> expectedResults = inputs.stream().map(Input::toPrestoQueryResult).collect(toList()); try (TestTable testTable = dataSetup.setupTestTable(unmodifiableList(inputs))) { MaterializedResult materializedRows = prestoExecutor.execute("SELECT * from " + testTable.getName()); assertEquals(materializedRows.getTypes(), expectedTypes); List<Object> actualResults = getOnlyElement(materializedRows).getFields(); assertEquals(actualResults.size(), expectedResults.size(), "lists don't have the same size"); for (int i = 0; i < expectedResults.size(); i++) { assertEquals(actualResults.get(i), expectedResults.get(i), "Element " + i); } } }
Source:
<code>public void addVirtSpecifier(ICPPASTVirtSpecifier virtSpecifier) { assertNotFrozen(); if (virtSpecifier != null) { assert virtSpecifiers != null; virtSpecifiers = ArrayUtil.append(virtSpecifiers, virtSpecifier); virtSpecifier.setParent(this); <START> virtSpecifier.setPropertyInParent(EXCEPTION_TYPEID); <END> } }</code><technical_language>This is a pre-existing bug, property VIRT_SPECIFIER, EXCEPTION_TYPEID</technical_language>

Target:
public void addVirtSpecifier(ICPPASTVirtSpecifier virtSpecifier) { assertNotFrozen(); if (virtSpecifier != null) { assert virtSpecifiers != null; virtSpecifiers = ArrayUtil.append(virtSpecifiers, virtSpecifier); virtSpecifier.setParent(this); virtSpecifier.setPropertyInParent(VIRT_SPECIFIER); } }
Source:
<code>public void fetchMenu(long menuId) { String path = formatPath(MENU_REST_PATH, String.valueOf(menuId)); Map<String, String> params = new HashMap<>(); WordPress.getRestClientUtilsV1_1().get(path, params, null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { JSONObject menuObject = response.optJSONObject(MENU_KEY); <START> mDelegate.onMenuReceived(HttpURLConnection.HTTP_OK, menuFromJson(menuObject)); <END> } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { mDelegate.onMenuReceived(statusCodeFromVolleyError(error), null); } }); }</code><technical_language>Awesome! I follow in sense I imagine intention of server API is, is right follow REST principles strictly. a purist myself, worth observing this leave some decisions hanging in air if agreed first</technical_language>

Target:
public int fetchMenu(long menuId) { if (menuId < 0) return -1; final int requestId = ++mRequestCounter; String path = formatPath(MENU_REST_PATH, String.valueOf(menuId)); Map<String, String> params = new HashMap<>(); WordPress.getRestClientUtilsV1_1().get(path, params, null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { MenuModel result = menuFromJson(response.optJSONObject(MENU_KEY)); List<MenuModel> resultList = new ArrayList<>(); if (result != null) resultList.add(result); mListener.onMenusReceived(requestId, resultList); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { int statusCode = statusCodeFromVolleyError(volleyError); REST_ERROR error = REST_ERROR.FETCH_ERROR; if (statusCode == HTTP_FORBIDDEN) error = REST_ERROR.AUTHENTICATION_ERROR; else if (statusCode == HTTP_BAD_REQUEST) error = REST_ERROR.RESERVED_ID_ERROR; mListener.onErrorResponse(requestId, error); } }); return requestId; }
Source:
<code>private Config loadHazelcastConfig(GeoServerResourceLoader rl) throws IOException{ Resource hzf = getConfigFile(HAZELCAST_FILENAME, HzCluster.class); InputStream hzIn = hzf.in(); try { return new XmlConfigBuilder(hzIn).build(); } finally { hzIn.close(); <START> } <END> }</code><technical_language>@NielsCharlier try-with-resources</technical_language>

Target:
private Config loadHazelcastConfig(GeoServerResourceLoader rl) throws IOException{ Resource hzf = getConfigFile(HAZELCAST_FILENAME, HzCluster.class); try (InputStream hzIn = hzf.in()) { return new XmlConfigBuilder(hzIn).build(); } }
Source:
<code>public void testClear() { serverStoreProxy.append(1L, createPayload(100L)); Chain chain = serverStoreProxy.get(1); <START> assertThat(chain.isEmpty(), is(false)); <END> assertThat(readPayLoad(chain.iterator().next().getPayload()), is(100L)); serverStoreProxy.clear(); chain = serverStoreProxy.get(1); assertThat(chain.isEmpty(), is(true)); }</code><technical_language>assert needed here, fact append works tested already</technical_language>

Target:
public void testClear() { serverStoreProxy.append(1L, createPayload(100L)); serverStoreProxy.clear(); Chain chain = serverStoreProxy.get(1); assertThat(chain.isEmpty(), is(true)); }
Source:
<code>public void setValueGenerator (ValueGenerator generator) { <START> this.generator = generator; <END> }</code><technical_language>validate non-null (to fail sooner)</technical_language>

Target:
public void setValueGenerator (ValueGenerator generator) { if (generator == null){ throw new IllegalArgumentException("Parameter generator must not be null."); } this.generator = generator; }
Source:
<code>public synchronized void cancelAllScheduledActions() { if (!isShuttingDown) { stopScheduler(); ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(String.format(DEBOUNCE_THREAD_NAME_FORMAT)).setDaemon(true).build(); <START> this.scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(threadFactory); <END> } }</code><technical_language>1. Instead of re-initializing executor, a single instance of SingleThreadedExecutor a clear ordering tasks submitted it. hard prove correctness current in-flight task is stuck re-instantiate a new executor. Is a reason require this? 2. If existing mechanism cancel tasks submitted executor, leverage it</technical_language>

Target:
public synchronized void cancelAllScheduledActions() { if (!isShuttingDown) { futureHandles.keySet().forEach(this::tryCancelScheduledAction); futureHandles.clear(); } }
Source:
<code>private COREEnvelopeRealTimeResponse buildAdapterCORE_X12DSRealTimeResponseMetadata() { COREEnvelopeRealTimeResponse oResponse = new COREEnvelopeRealTimeResponse(); oResponse.setPayloadType("X12_278_Response_005010X279A1"); oResponse.setProcessingMode("RealTime"); oResponse.setPayloadID("a81d44ae-7dec-11d0-a765-00a0c91e6ba0"); oResponse.setTimeStamp("2007-08-30T10:20:34Z"); oResponse.setSenderID("PayerB"); oResponse.setReceiverID("HospitalA"); oResponse.setCORERuleVersion("2.2.0"); oResponse.setPayload("PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxDbGluaWNhbERvY3VtZW50\n" + "IG1vb2RDb2RlPSJFVk4iIHhtbG5zPSJ1cm46aGw3LW9yZzp2MyINCiAgICB4bWxuczp4c2k9Imh0"); oResponse.setErrorCode("Success"); <START> oResponse.setErrorMessage(null); <END> return oResponse; }</code><technical_language>do need explicitly set this null. null default</technical_language>

Target:
private COREEnvelopeRealTimeResponse buildAdapterCORE_X12DSRealTimeResponseMetadata() { COREEnvelopeRealTimeResponse oResponse = new COREEnvelopeRealTimeResponse(); oResponse.setPayloadType("X12_278_Response_005010X279A1"); oResponse.setProcessingMode("RealTime"); oResponse.setPayloadID("a81d44ae-7dec-11d0-a765-00a0c91e6ba0"); oResponse.setTimeStamp("2007-08-30T10:20:34Z"); oResponse.setSenderID("PayerB"); oResponse.setReceiverID("HospitalA"); oResponse.setCORERuleVersion("2.2.0"); oResponse.setPayload("PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxDbGluaWNhbERvY3VtZW50\n" + "IG1vb2RDb2RlPSJFVk4iIHhtbG5zPSJ1cm46aGw3LW9yZzp2MyINCiAgICB4bWxuczp4c2k9Imh0"); oResponse.setErrorCode("Success"); oResponse.setErrorMessage("None"); return oResponse; }
Source:
<code>public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { if (delta.getElement() instanceof ITask) { ITask updatedReview = (ITask) delta.getElement(); <START> if (updatedReview != null && isTaskAssosciatedWithReviewConnector(updatedReview)) { <END> SynchronizationState taskState = updatedReview.getSynchronizationState(); if (taskState.isIncoming()) { ITask assosciatedTask = getTasksAssociatedWithReviewTask(updatedReview); if (assosciatedTask != null) { updateTaskWithIncomingReviewState(assosciatedTask, true); } } else { forceFullRefreshFor(updatedReview); } } } } }</code><technical_language>This null if instanceof ITask</technical_language>

Target:
public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { if (delta.getElement() instanceof ITask) { ITask updatedReview = (ITask) delta.getElement(); if (isTaskAssosciatedWithReviewConnector(updatedReview)) { SynchronizationState taskState = updatedReview.getSynchronizationState(); if (taskState.isIncoming()) { ITask assosciatedTask = getTaskAssociatedWithReviewTask(updatedReview); if (assosciatedTask != null) { updateTaskWithIncomingReviewState(assosciatedTask, true); } } else { forceFullRefreshFor(updatedReview); } } } } }
Source:
<code>public Boolean checkUserDrinksCaffeine(final Long accountId) { final Optional<Response> optionalResponse = this.getSingleUserResponse(accountId, AccountInfo.Type.CAFFEINE); if(optionalResponse.isPresent()) { final String responseText = optionalResponse.get().response; <START> if (responseText.equalsIgnoreCase("coffee")) { <END> return true; } } return false; }</code><technical_language>"coffee" a final static String named (maybe) COFFEE_RESPONSE put top of class</technical_language>

Target:
public Boolean checkUserDrinksCaffeine(final Long accountId) { final Optional<Response> optionalResponse = this.getSingleUserResponse(accountId, AccountInfo.Type.CAFFEINE); if(optionalResponse.isPresent()) { final String responseText = optionalResponse.get().response; if (responseText.equalsIgnoreCase(RESPONSE_DRINKS_COFFEE)) { return true; } } return false; }
Source:
<code>public boolean equals(Object obj) { if (!(obj instanceof AuthorizationContext)) { return false; } <START> return true; <END> }</code><technical_language>I is right return return true for AuthorizationContext instances</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj == null || getClass() != obj.getClass()) { return false; } AuthorizationContext other = (AuthorizationContext)obj; return getFsOwner().equals(other.getFsOwner()) && getSupergroup().equals(other.getSupergroup()) && getCallerUgi().equals(other.getCallerUgi()) && Arrays.deepEquals(getInodeAttrs(), other.getInodeAttrs()) && Arrays.deepEquals(getInodes(), other.getInodes()) && Arrays.deepEquals(getPathByNameArr(), other.getPathByNameArr()) && getSnapshotId() == other.getSnapshotId() && getPath().equals(other.getPath()) && getAncestorIndex() == other.getAncestorIndex() && isDoCheckOwner() == other.isDoCheckOwner() && getAncestorAccess() == other.getAncestorAccess() && getParentAccess() == other.getParentAccess() && getAccess() == other.getAccess() && getSubAccess() == other.getSubAccess() && isIgnoreEmptyDir() == other.isIgnoreEmptyDir(); }
Source:
<code>public boolean deleteIndexNamed(final String indexName) throws CheckedQueryException { if (indexName == null || indexName.isEmpty()) { <START> logger.log(Level.WARNING, "TO delete an index, index name should be provided."); <END> return false; } Future<Boolean> result = dbQueue.submitTransaction(new SQLQueueCallable<Boolean>() { @Override public Boolean call(SQLDatabase database) throws Exception { String tableName = QueryConstants.tableNameForIndex(indexName); String sql = String.format("DROP TABLE \"%s\"", tableName); database.execSQL(sql); String where = " index_name = ? "; database.delete(QueryConstants.INDEX_METADATA_TABLE_NAME, where, new String[]{ indexName }); return Boolean.TRUE; } }); boolean success; try { success = result.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error during index deletion:", e); return false; } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error during index deletion:", e); return false; } return success; }</code><technical_language>Fix capitalization in</technical_language>

Target:
public boolean deleteIndexNamed(final String indexName) throws CheckedQueryException { if (indexName == null || indexName.isEmpty()) { logger.log(Level.WARNING, "To delete an index, index name should be provided."); return false; } Future<Boolean> result = indexDbQueue.submitTransaction(new SQLQueueCallable<Boolean>() { @Override public Boolean call(SQLDatabase database) throws Exception { String tableName = QueryConstants.tableNameForIndex(indexName); String sql = String.format("DROP TABLE \"%s\"", tableName); database.execSQL(sql); String where = " index_name = ? "; database.delete(QueryConstants.INDEX_METADATA_TABLE_NAME, where, new String[]{ indexName }); return Boolean.TRUE; } }); boolean success; try { success = result.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error during index deletion:", e); return false; } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error during index deletion:", e); return false; } return success; }