auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void checkRenderedRendition(DocumentModel doc, String renditionName, boolean store, boolean stale, String expectedFilename, String expectedDigest) { Rendition rendition = rs.getRendition(doc, renditionName, store); assertNotNull(rendition); assertTrue(rendition.isStored() == store); Blob blob = rendition.getBlob(); String mimeType = blob.getMimeType(); assertFalse(blob.getMimeType().contains(LazyRendition.EMPTY_MARKER)); assertTrue( stale ? mimeType.contains(LazyRendition.STALE_MARKER) : !mimeType.contains(LazyRendition.STALE_MARKER)); assertEquals(expectedFilename, blob.getFilename()); assertTrue(blob.getLength() > 0); String digest = blob.getDigest(); log.debug(String.format("Comparing expected digest %s and %s rendition blob digest %s", expectedDigest, stale ? "stale" : "up-to-date", digest)); assertEquals(expectedDigest, digest); }

Target:
protected void checkRenderedRendition(DocumentModel doc, String renditionName, boolean store, boolean stale, String expectedFilename, String expectedDigest) { Rendition rendition = rs.getRendition(doc, renditionName, store); assertNotNull(rendition); assertTrue(rendition.isStored() == store); Blob blob = rendition.getBlob(); String mimeType = blob.getMimeType(); assertFalse(blob.getMimeType().contains(LazyRendition.EMPTY_MARKER)); assertTrue(stale == mimeType.contains(LazyRendition.STALE_MARKER)); assertEquals(expectedFilename, blob.getFilename()); assertTrue(blob.getLength() > 0); String digest = blob.getDigest(); log.debug(String.format("Comparing expected digest %s and %s rendition blob digest %s", expectedDigest, stale ? "stale" : "up-to-date", digest)); assertEquals(expectedDigest, digest); }
Source:
public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fUstAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); assertTrue(requirements.iterator().hasNext()); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, domain); } List<String> expectedEvents = ImmutableList.of( UstMemoryStrings.MALLOC, UstMemoryStrings.FREE, UstMemoryStrings.CALLOC, UstMemoryStrings.REALLOC, UstMemoryStrings.MEMALIGN, UstMemoryStrings.POSIX_MEMALIGN ); assertEquals(6, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } Set<String> infos = eventReq.getInformation(); assertEquals(2, infos.size()); }

Target:
public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fUstAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); assertTrue(requirements.iterator().hasNext()); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, domain); } Set<String> expectedEvents = ImmutableSet.of( UstMemoryStrings.MALLOC, UstMemoryStrings.FREE, UstMemoryStrings.CALLOC, UstMemoryStrings.REALLOC, UstMemoryStrings.MEMALIGN, UstMemoryStrings.POSIX_MEMALIGN ); assertEquals(6, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } Set<String> infos = eventReq.getInformation(); assertEquals(2, infos.size()); }
Source:
private SelectionListener onStartPortForwarding() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if(!wizardModel.checkPortForwardingAllowed()) { MessageDialog.openWarning(getShell(), "Warning", "Some ports are in use now."); return; } try { WizardUtils.runInWizard(new Job("Starting port forwarding...") { @Override protected IStatus run(IProgressMonitor monitor) { wizardModel.startPortForwarding(); refreshViewerInput(wizardModel.getForwardablePorts()); return Status.OK_STATUS; } }, getContainer(), getDataBindingContext()); } catch (OpenShiftException | InvocationTargetException | InterruptedException e1) { LOG.logError(e1); MessageDialog.openError(getShell(), "Error starting port forwarding", e1.getMessage()); } } }; }

Target:
private SelectionListener onStartPortForwarding() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if(!wizardModel.checkPortForwardingAllowed()) { viewer.refresh(true); MessageDialog.openWarning(getShell(), "Warning", "Some ports are in use now."); return; } try { WizardUtils.runInWizard(new Job("Starting port forwarding...") { @Override protected IStatus run(IProgressMonitor monitor) { wizardModel.startPortForwarding(); refreshViewerInput(wizardModel.getForwardablePorts()); return Status.OK_STATUS; } }, getContainer(), getDataBindingContext()); } catch (OpenShiftException | InvocationTargetException | InterruptedException e1) { LOG.logError(e1); MessageDialog.openError(getShell(), "Error starting port forwarding", e1.getMessage()); } } }; }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext()); try { if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); imgPathString = cursor.getString(columnIndex); Timber.i(imgPathString); preferences.edit().putString("deck_background_path", imgPathString); preferences.edit().apply(); Timber.i(imgPathString); cursor.close(); } else { Toast.makeText(this, "You haven't picked Image", Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show(); } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) { Cursor cursor = null; Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; try { cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String imgPathString = cursor.getString(columnIndex); File sourceFile = new File(imgPathString); String currentAnkiDroidDirectory = CollectionHelper.getCurrentAnkiDroidDirectory(this); String imageName = "DeckPickerBackground.png"; File destFile = new File(currentAnkiDroidDirectory, imageName); try (FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel(); FileChannel destChannel = new FileOutputStream(destFile).getChannel()) { destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); UIUtils.showThemedToast(this, getString(R.string.background_image_applied), false); } } finally { if (cursor != null) { cursor.close(); } } } else { UIUtils.showThemedToast(this, getString(R.string.no_image_selected), false); } } catch (OutOfMemoryError | Exception e) { UIUtils.showThemedToast(this, getString(R.string.error_selecting_image, e.getLocalizedMessage()), false); } }
Source:
private CompiledQuery sqlDatabaseBackup(SqlExecutionContext executionContext) throws SqlException { setupBackupRenamePath(); NativeLPSZ nativeLPSZ = new NativeLPSZ(); ff.iterateDir(path.of(configuration.getRoot()).$(), (file, type) -> { nativeLPSZ.of(file); if (type == Files.DT_DIR && nativeLPSZ.charAt(0) != '.') { backupTable(nativeLPSZ, executionContext); } }); return compiledQuery.ofBackupTable(); }

Target:
private CompiledQuery sqlDatabaseBackup(SqlExecutionContext executionContext) throws SqlException { currentExecutionContext = executionContext; try { setupBackupRenamePath(); ff.iterateDir(path.of(configuration.getRoot()).$(), sqlDatabaseBackupOnFind); return compiledQuery.ofBackupTable(); } finally { currentExecutionContext = null; } }
Source:
public FileHash verify(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException { FileHash result = new FileHash(); try { result.uri = request.getParameter(URI_KEY); String sha1 = request.getParameter(SHA1_KEY); if (StringUtils.isBlank(result.uri)) { warn("verify: uri is required but none provided") .log(); response.setStatus(HttpStatus.BAD_REQUEST_400); result.error = true; result.message = "Please provide uri and sha1 parameters."; return result; } if (StringUtils.isBlank(sha1)) { warn("verify: sha1 is required but none provided") .log(); response.setStatus(HttpStatus.BAD_REQUEST_400); result.error = true; result.message = "Please provide uri and sha1 parameters."; return result; } Path path = PathUtils.toPath(result.uri, Website.path()); if (!Files.exists(path)) { warn("verify: file does not exist in website desitantion") .websitePath(Website.path()) .uri(path.toString()) .log(); result.message = "File does not exist in the destination: " + result.uri; return result; } result.sha1 = Hash.sha(path); result.matched = StringUtils.equals(sha1, result.sha1); result.message = "SHA matched: " + result.matched; if (!result.matched) { result.message += " (" + sha1 + " -> " + result.sha1 + ")"; } } catch (Exception e) { error(e, "verify: unexpected error verifing").log(); response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); result.error = true; result.message = ExceptionUtils.getStackTrace(e); } return result; }

Target:
public FileHash verify(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException { LogBuilder log = logBuilder().endpoint(this); FileHash result = new FileHash(); try { result.uri = request.getParameter(URI_KEY); String sha1 = request.getParameter(SHA1_KEY); if (StringUtils.isBlank(result.uri)) { log.responseStatus(BAD_REQUEST_400) .warn("bad request: uri is required but none provided"); response.setStatus(BAD_REQUEST_400); result.error = true; result.message = "Please provide uri and sha1 parameters."; return result; } log.uri(result.uri); if (StringUtils.isBlank(sha1)) { log.responseStatus(BAD_REQUEST_400) .warn("bad request: verify: sha1 is required but none provided"); response.setStatus(BAD_REQUEST_400); result.error = true; result.message = "Please provide uri and sha1 parameters."; return result; } Path path = PathUtils.toPath(result.uri, Website.path()); if (!Files.exists(path)) { log.websitePath(Website.path()) .responseStatus(BAD_REQUEST_400) .warn("bad request: verify: file does not exist in website destination"); result.message = "File does not exist in the destination: " + result.uri; return result; } result.sha1 = Hash.sha(path); result.matched = StringUtils.equals(sha1, result.sha1); result.message = "SHA matched: " + result.matched; if (!result.matched) { result.message += " (" + sha1 + " -> " + result.sha1 + ")"; } } catch (Exception e) { log.responseStatus(INTERNAL_SERVER_ERROR_500) .error(e, "verify: unexpected error verifing"); response.setStatus(INTERNAL_SERVER_ERROR_500); result.error = true; result.message = ExceptionUtils.getStackTrace(e); } return result; }
Source:
private static void checkCipher_Update_invalidMode_Failure(int opmode) throws Exception { String msg = "update() should throw IllegalStateException [mode=" + opmode + "]"; int bs = createAesCipher(opmode).getBlockSize(); assertEquals(16, bs); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[0])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[2 * bs])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update( new byte[2 * bs], bs, 0)); try { createAesCipher(opmode).update( new byte[2*bs], 0, 2 * bs, new byte[2 * bs], 0); fail(msg); } catch (IllegalStateException expected) { } catch (Exception e) { fail(e.getMessage()); } }

Target:
private static void checkCipher_Update_invalidMode_Failure(int opmode) throws Exception { String msg = "update() should throw IllegalStateException [mode=" + opmode + "]"; int bs = createAesCipher(opmode).getBlockSize(); assertEquals(16, bs); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[0])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[2 * bs])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update( new byte[2 * bs] , bs , 0 )); try { createAesCipher(opmode).update(new byte[2*bs] , 0 , 2 * bs , new byte[2 * bs] , 0 ); fail(msg); } catch (IllegalStateException expected) { } }
Source:
public String getID() { return block.getLocalizedName(); }

Target:
public String getID() { return block.getUnlocalizedName(); }
Source:
public void testArraySection() { BytesBuilder bb = Bytes.newBuilder(); bb.append(new byte[] {'c', (byte) 0, (byte) 127, (byte) 128, (byte) 255}, 0, 3); Bytes bytes = bb.toBytes(); Assert.assertEquals(Bytes.of(new byte[] {'c', (byte) 0, (byte) 127, (byte) 128, (byte) 255}), 0, 3); }

Target:
public void testArraySection() { BytesBuilder bb = Bytes.newBuilder(); byte[] testing = new byte[] {'a', 'b', 'c', 'd', 'e'}; bb.append(testing, 0, 3); bb.append(testing, 1, 3); bb.append(testing, 2, 2); Bytes bytes = bb.toBytes(); Assert.assertEquals(Bytes.of("abcbcdcd"), bytes); }
Source:
protected boolean doStatusCheck(T pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<ApiCommand> failedCommands = new ArrayList<>(); for (BigDecimal commandId : pollerObject.getIdList()) { ApiCommand apiCommand = commandsResourceApi.readCommand(commandId); if (apiCommand.getActive()) { LOGGER.debug("Command [" + getCommandName() + "] with id [" + commandId + "] is active, so it hasn't finished yet"); return false; } else if (!apiCommand.getSuccess()) { failedCommands.add(apiCommand); } } if (!failedCommands.isEmpty()) { String message = failedCommands.stream().map(cmd -> { String resultMessage = cmd.getResultMessage(); List<String> detailedMessages = parseResultMessageFromChildren(cmd.getChildren()); ApiHostRef hostRef = cmd.getHostRef(); String hostRefStr = hostRef == null ? "Unknown" : hostRef.getHostname(); return "Command [" + cmd.getName() + ":" + cmd.getId() + "] failed on host [" + hostRefStr + "]: " + resultMessage + ". Detailed messages: " + String.join("\n", detailedMessages); }).collect(Collectors.joining(",")); LOGGER.info(message); throw new ClouderaManagerOperationFailedException(message); } return true; }

Target:
protected boolean doStatusCheck(T pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<ApiCommand> apiCommands = collectApiCommands(pollerObject, commandsResourceApi); boolean allCommandsFinished = apiCommands.stream().noneMatch(ApiCommand::getActive); if (allCommandsFinished) { validateApiCommandResults(apiCommands); return true; } else { return false; } }
Source:
public Schema getSchema() { return null; }

Target:
public Schema getSchema() { return schema; }
Source:
public void handleCommand(ChannelUID channelUID, Command command) { BridgeHandler dssBridgeHandler = getDssBridgeHandler(); if (dssBridgeHandler == null) { logger.warn("BridgeHandler not found. Cannot handle command without bridge."); return; } if (temperatureSensorTransmitter == null && zoneID != null) { logger.warn( "Device not known on TemperationControlManager or temperatureSensorTransreciver is not registerd. Cannot handle command."); return; } if (channelUID.getId().equals(currentChannelID)) { if (command instanceof PercentType || command instanceof DecimalType) { sendCommandAndUpdateChannel(((DecimalType) command).floatValue()); } else if (command instanceof OnOffType) { if (OnOffType.ON.equals(command)) { if (isTemperature()) { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_TEMP); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_CONTROLL_VALUE); } } else { if (isTemperature()) { sendCommandAndUpdateChannel(0f); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MIN_CONTROLL_VALUE); } } } else if (command instanceof IncreaseDecreaseType) { if (IncreaseDecreaseType.INCREASE.equals(command)) { sendCommandAndUpdateChannel(currentValue + step); } else { sendCommandAndUpdateChannel(currentValue - step); } } } else { logger.warn("Command sent to an unknown channel id: {}", channelUID); } }

Target:
public void handleCommand(ChannelUID channelUID, Command command) { BridgeHandler dssBridgeHandler = getDssBridgeHandler(); if (dssBridgeHandler == null) { logger.debug("BridgeHandler not found. Cannot handle command without bridge."); return; } if (temperatureSensorTransmitter == null && zoneID != null) { logger.debug( "Device not known on TemperationControlManager or temperatureSensorTransreciver is not registerd. Cannot handle command."); return; } if (channelUID.getId().equals(currentChannelID)) { if (command instanceof PercentType || command instanceof DecimalType) { sendCommandAndUpdateChannel(((DecimalType) command).floatValue()); } else if (command instanceof OnOffType) { if (OnOffType.ON.equals(command)) { if (isTemperature()) { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_TEMP); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_CONTROLL_VALUE); } } else { if (isTemperature()) { sendCommandAndUpdateChannel(0f); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MIN_CONTROLL_VALUE); } } } else if (command instanceof IncreaseDecreaseType) { if (IncreaseDecreaseType.INCREASE.equals(command)) { sendCommandAndUpdateChannel(currentValue + step); } else { sendCommandAndUpdateChannel(currentValue - step); } } } else { logger.debug("Command sent to an unknown channel id: {}", channelUID); } }
Source:
public static void assertDateIsNow(Date date) { assertDateWithinRange(date, new Date(new Date().getTime() - (1000 * 60)), new Date(new Date().getTime() + (1000 * 60))); }

Target:
public static void assertDateIsNow(Date date) { assertDateWithinRange(date, TimeHelper.getMsOffsetToCurrentTime(-1000 * 60), TimeHelper.getMsOffsetToCurrentTime(1000 * 60)); }
Source:
public void projectClosed() { SonarQubeNotifications.get().remove(eventListener); }

Target:
public void projectClosed() { unregister(); }
Source:
public void afterPropertiesSet() throws Exception { try { this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class); } catch (NoUniqueBeanDefinitionException ex) { throw new BeanCreationNotAllowedException(this.name, "Only one 'PublisherAnnotationBeanPostProcessor' bean can be defined in the application context." + " Consider do not use '@EnablePublisher' (or '<int:enable-publisher>') if you declare" + " 'PublisherAnnotationBeanPostProcessor' bean definition manually. " + "Bean names found: " + ex.getBeanNamesFound()); } }

Target:
public void afterPropertiesSet() throws Exception { try { this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class); } catch (NoUniqueBeanDefinitionException ex) { throw new BeanCreationNotAllowedException(this.name, "Only one 'PublisherAnnotationBeanPostProcessor' bean can be defined in the application context." + " Do not use '@EnablePublisher' (or '<int:enable-publisher>') if you declare a" + " 'PublisherAnnotationBeanPostProcessor' bean definition manually. " + "Bean names found: " + ex.getBeanNamesFound()); } }
Source:
private void ensureLoaded() { if (!loaded) { for (Artifact art : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.User, AtsUtilCore.getAtsBranch())) { User user = (User) art; AtsUser atsUser = new AtsUser(user); userIdToAtsUser.put(user.getUserId(), atsUser); nameToAtsUser.put(user.getName(), atsUser); } loaded = true; } }

Target:
protected synchronized void ensureLoaded() { if (!loaded) { for (Artifact art : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.User, AtsUtilCore.getAtsBranch())) { User user = (User) art; AtsUser atsUser = new AtsUser(user); userIdToAtsUser.put(user.getUserId(), atsUser); nameToAtsUser.put(user.getName(), atsUser); } loaded = true; } }
Source:
public void run(TaskSource taskSource, Schema schema, FileInput input, PageOutput output) { PluginTask task = taskSource.loadTask(PluginTask.class); final boolean stopOnInvalidRecord = task.getStopOnInvalidRecord(); final Column column = schema.getColumn(0); try (PageBuilder pageBuilder = newPageBuilder(schema, output); FileInputInputStream in = new FileInputInputStream(input)) { while (in.nextFile()) { try (JsonParser.Stream stream = newJsonStream(in, task)) { Value value; while ((value = stream.next()) != null) { try { if (!value.isMapValue()) { throw new JsonRecordValidateException( String.format("A Json record must not represent map value but it's %s", value.getValueType().name())); } pageBuilder.setJson(column, value); pageBuilder.addRecord(); } catch (JsonRecordValidateException e) { if (stopOnInvalidRecord) { throw new DataException(String.format("Invalid record: %s", value.toJson()), e); } log.warn(String.format("Skipped record (%s): %s", e.getMessage(), value.toJson())); } } } catch (IOException | JsonParseException e) { throw new DataException(e); } } pageBuilder.finish(); } }

Target:
public void run(TaskSource taskSource, Schema schema, FileInput input, PageOutput output) { PluginTask task = taskSource.loadTask(PluginTask.class); final boolean stopOnInvalidRecord = task.getStopOnInvalidRecord(); final Column column = schema.getColumn(0); try (PageBuilder pageBuilder = newPageBuilder(schema, output); FileInputInputStream in = new FileInputInputStream(input)) { while (in.nextFile()) { boolean evenOneJsonParsed = false; try (JsonParser.Stream stream = newJsonStream(in, task)) { Value value; while ((value = stream.next()) != null) { try { if (!value.isMapValue()) { throw new JsonRecordValidateException( String.format("A Json record must not represent map value but it's %s", value.getValueType().name())); } pageBuilder.setJson(column, value); pageBuilder.addRecord(); evenOneJsonParsed = true; } catch (JsonRecordValidateException e) { if (stopOnInvalidRecord) { throw new DataException(String.format("Invalid record: %s", value.toJson()), e); } log.warn(String.format("Skipped record (%s): %s", e.getMessage(), value.toJson())); } } } catch (IOException | JsonParseException e) { if (Exec.isPreview() && evenOneJsonParsed) { break; } throw new DataException(e); } } pageBuilder.finish(); } }
Source:
public JdbcPrestoAction( SqlExceptionClassifier exceptionClassifier, BenchmarkQuery benchmarkQuery, PrestoClusterConfig prestoClusterConfig, Map<String, String> sessionProperties, RetryConfig networkRetryConfig) { this.exceptionClassifier = requireNonNull(exceptionClassifier, "exceptionClassifier is null"); this.benchmarkQuery = requireNonNull(benchmarkQuery, "benchmarkQuery is null"); this.jdbcUrl = requireNonNull(prestoClusterConfig.getJdbcUrl(), "jdbcUrl is null"); this.queryTimeout = requireNonNull(prestoClusterConfig.getQueryTimeout(), "queryTimeout is null"); this.sessionProperties = ImmutableMap.copyOf(sessionProperties); this.networkRetry = new RetryDriver( networkRetryConfig, exception -> (exception instanceof QueryException) ? (((QueryException) exception).getType() == CLUSTER_CONNECTION) : FALSE); }

Target:
public JdbcPrestoAction( SqlExceptionClassifier exceptionClassifier, BenchmarkQuery benchmarkQuery, PrestoClusterConfig prestoClusterConfig, Map<String, String> sessionProperties, RetryConfig networkRetryConfig) { this.exceptionClassifier = requireNonNull(exceptionClassifier, "exceptionClassifier is null"); this.benchmarkQuery = requireNonNull(benchmarkQuery, "benchmarkQuery is null"); this.jdbcUrl = requireNonNull(prestoClusterConfig.getJdbcUrl(), "jdbcUrl is null"); this.queryTimeout = requireNonNull(prestoClusterConfig.getQueryTimeout(), "queryTimeout is null"); this.sessionProperties = ImmutableMap.copyOf(sessionProperties); this.networkRetry = new RetryDriver( networkRetryConfig, (exception) -> exception instanceof QueryException && (((QueryException) exception).getType() == CLUSTER_CONNECTION)); }
Source:
public Response getPage(final HttpServletRequest req, final User user, final String filter, final int page, final int perPage, final String orderBy, final OrderDirection direction, final Map<String, Object> extraParams) { final int pageValue = page == 0 ? FIRST_PAGE_INDEX : page; final int perPageValue = perPage == 0 ? perPageDefault : perPage; final int minIndex = getMinIndex(pageValue, perPageValue); final String sanitizefilter = SQLUtil.sanitizeParameter(filter); Collection items = paginator.getItems(user, sanitizefilter, perPageValue, minIndex, orderBy, direction, extraParams); items = items == null ? Collections.emptyList() : items; final long totalRecords = paginator.getTotalRecords(filter); final String linkHeaderValue = getHeaderValue(req.getRequestURL().toString(), sanitizefilter, pageValue, perPageValue, totalRecords, orderBy, direction, extraParams); return Response. ok(new ResponseEntityView(items)) .header(LINK_HEADER_NAME, linkHeaderValue) .header(PAGINATION_PER_PAGE_HEADER_NAME, perPageValue) .header(PAGINATION_CURRENT_PAGE_HEADER_NAME, pageValue) .header(PAGINATION_MAX_LINK_PAGES_HEADER_NAME, nLinks) .header(PAGINATION_TOTAL_ENTRIES_HEADER_NAME, totalRecords) .build(); }

Target:
public Response getPage(final HttpServletRequest req, final User user, final String filter, final int page, final int perPage, final String orderBy, final OrderDirection direction, final Map<String, Object> extraParams) { final int pageValue = page == 0 ? FIRST_PAGE_INDEX : page; final int perPageValue = perPage == 0 ? perPageDefault : perPage; final int minIndex = getMinIndex(pageValue, perPageValue); final String sanitizefilter = SQLUtil.sanitizeParameter(filter); Collection items = paginator.getItems(user, sanitizefilter, perPageValue, minIndex, orderBy, direction, extraParams); items = !UtilMethods.isSet(items) ? Collections.emptyList() : items; final long totalRecords = paginator.getTotalRecords(filter); final String linkHeaderValue = getHeaderValue(req.getRequestURL().toString(), sanitizefilter, pageValue, perPageValue, totalRecords, orderBy, direction, extraParams); return Response. ok(new ResponseEntityView(items)) .header(LINK_HEADER_NAME, linkHeaderValue) .header(PAGINATION_PER_PAGE_HEADER_NAME, perPageValue) .header(PAGINATION_CURRENT_PAGE_HEADER_NAME, pageValue) .header(PAGINATION_MAX_LINK_PAGES_HEADER_NAME, nLinks) .header(PAGINATION_TOTAL_ENTRIES_HEADER_NAME, totalRecords) .build(); }
Source:
static void add(StringBuilder sb, String name, long val) { sb.append(name); sb.append(HttpConstants.EQUALS_CHAR); sb.append(val); sb.append(HttpConstants.SEMICOLON_CHAR); sb.append(HttpConstants.SP_CHAR); }

Target:
static void add(StringBuilder sb, String name, long val) { sb.append(name); sb.append('='); sb.append(val); sb.append(';'); sb.append(HttpConstants.SP_CHAR); }
Source:
private JsonObject createAlertForSubject(String journalKey, String subjectName) { String queryString = "{\"startPage\":0,\"filterSubjects\":[],\"unformattedQuery\":\"\",\"query\":\"*:*\"," + "\"eLocationId\":\"\",\"pageSize\":0,\"resultView\":\"\",\"volume\":\"\",\"sortValue\":\"\"," + "\"sortKey\":\"\",\"filterKeyword\":\"\",\"filterArticleTypes\":[]," + "\"filterSubjectsDisjunction\":[],\"filterAuthors\":[],\"filterJournals\":[],\"id\":\"\"}"; JsonObject query = (new Gson()).fromJson(queryString, JsonObject.class); JsonArray filterJournals = query.getAsJsonArray("filterJournals"); filterJournals.add(new JsonPrimitive(journalKey)); JsonArray filterSubjects = query.getAsJsonArray("filterSubjectsDisjunction"); filterSubjects.add(new JsonPrimitive(subjectName)); query.remove("filterJournals"); query.remove("filterSubjects"); query.add("filterJournals", filterJournals); query.add("filterSubjects", filterSubjects); JsonObject alert = new JsonObject(); alert.addProperty("source", ALERT_SOURCE); alert.addProperty("frequency", ALERT_FREQUENCY); alert.addProperty("name", ALERT_NAME); alert.addProperty("query", (new Gson()).toJson(query)); return alert; }

Target:
private Alert createAlertForSubject(String journalKey, String subjectName) { AlertQuery query = new AlertQuery(); query.setFilterJournals(ImmutableList.of(journalKey)); query.setFilterSubjectsDisjunction(ImmutableList.of(subjectName)); Alert alert = new Alert(); alert.setSource(ALERT_SOURCE); alert.setFrequency(ALERT_FREQUENCY); alert.setName(ALERT_NAME); alert.setQuery(gson.toJson(query)); return alert; }
Source:
public Document getCustomData() { String encodedData = nativeCustomData(osUser.getNativePtr()); return JniBsonProtocol.decode(encodedData, app.getConfiguration().getDefaultCodecRegistry().get(Document.class)); }

Target:
public Document getCustomData() { return osUser.getCustomData(); }
Source:
public void failGlobal(Throwable t) { ClusterEntryPointExceptionUtils.tryEnrichClusterEntryPointError(t); if (!isLegacyScheduling()) { internalTaskFailuresListener.notifyGlobalFailure(t); return; } assertRunningInJobMasterMainThread(); while (true) { JobStatus current = state; if (current == JobStatus.FAILING || current == JobStatus.SUSPENDED || current.isGloballyTerminalState()) { return; } else if (transitionState(current, JobStatus.FAILING, t)) { initFailureCause(t); final long globalVersionForRestart = incrementGlobalModVersion(); final CompletableFuture<Void> ongoingSchedulingFuture = schedulingFuture; if (ongoingSchedulingFuture != null) { ongoingSchedulingFuture.cancel(false); } final ConjunctFuture<Void> allTerminal = cancelVerticesAsync(); FutureUtils.assertNoException(allTerminal.handle( (Void ignored, Throwable throwable) -> { if (throwable != null) { transitionState( JobStatus.FAILING, JobStatus.FAILED, new FlinkException("Could not cancel all execution job vertices properly.", throwable)); } else { allVerticesInTerminalState(globalVersionForRestart); } return null; })); return; } } }

Target:
public void failGlobal(Throwable t) { if (!isLegacyScheduling()) { internalTaskFailuresListener.notifyGlobalFailure(t); return; } assertRunningInJobMasterMainThread(); while (true) { JobStatus current = state; if (current == JobStatus.FAILING || current == JobStatus.SUSPENDED || current.isGloballyTerminalState()) { return; } else if (transitionState(current, JobStatus.FAILING, t)) { initFailureCause(t); final long globalVersionForRestart = incrementGlobalModVersion(); final CompletableFuture<Void> ongoingSchedulingFuture = schedulingFuture; if (ongoingSchedulingFuture != null) { ongoingSchedulingFuture.cancel(false); } final ConjunctFuture<Void> allTerminal = cancelVerticesAsync(); FutureUtils.assertNoException(allTerminal.handle( (Void ignored, Throwable throwable) -> { if (throwable != null) { transitionState( JobStatus.FAILING, JobStatus.FAILED, new FlinkException("Could not cancel all execution job vertices properly.", throwable)); } else { allVerticesInTerminalState(globalVersionForRestart); } return null; })); return; } } }
Source:
public boolean addRoute(@NonNull RouteInfo route) { String routeIface = route.getInterface(); if (routeIface != null && !routeIface.equals(mIfaceName)) { throw new IllegalArgumentException( "Route added with non-matching interface: " + routeIface + " vs. " + mIfaceName); } route = routeWithInterface(route); int i = findRouteIndexByDestination(route); if (i < 0) { mRoutes.add(route); return true; } else if (mRoutes.get(i).equals(route)) { return false; } else { mRoutes.set(i, route); return true; } }

Target:
public boolean addRoute(@NonNull RouteInfo route) { String routeIface = route.getInterface(); if (routeIface != null && !routeIface.equals(mIfaceName)) { throw new IllegalArgumentException( "Route added with non-matching interface: " + routeIface + " vs. " + mIfaceName); } route = routeWithInterface(route); int i = findRouteIndexByDestination(route); if (i == -1) { mRoutes.add(route); return true; } else if (mRoutes.get(i).equals(route)) { return false; } else { mRoutes.set(i, route); return true; } }
Source:
public String getNoVncUrl() { String noVncUrl = properties.get(NOVNC_URL); if (noVncUrl == null) { String noVncUrlFromCurrentLocation = getWindowsLocationUrl(); noVncUrlFromCurrentLocation += "/rest/novnc"; return noVncUrlFromCurrentLocation; } return noVncUrl; }

Target:
public String getNoVncUrl() { String noVncUrl = properties.get(NOVNC_URL); if (noVncUrl == null) { String protocol = com.google.gwt.user.client.Window.Location.getProtocol(); String host = com.google.gwt.user.client.Window.Location.getHost(); String noVncUrlFromCurrentLocation = protocol + "://" + host + ":5900/rest/novnc"; noVncUrlFromCurrentLocation.replace(":","\\:"); return noVncUrlFromCurrentLocation; } return noVncUrl; }
Source:
protected void executeCommand() { List<String> macsToRemove = getVmNetworkInterfaceDao().getAllMacsByStoragePool(getStoragePool().getId()); removeNetworks(); List<storage_domains> storageDomains = DbFacade.getInstance().getStorageDomainDao().getAllForStoragePool( getStoragePool().getId()); Collections.sort(storageDomains, new Comparator<storage_domains>() { @Override public int compare(storage_domains o1, storage_domains o2) { return o1.getstorage_domain_type().compareTo(o2.getstorage_domain_type()); } }); if (storageDomains.size() > 0) { if (!getParameters().getForceDelete() && getAllRunningVdssInPool().size() > 0) { if(!regularRemoveStorageDomains(storageDomains)) { setSucceeded(false); return; } } else if (getParameters().getForceDelete()) { forceRemoveStorageDomains(storageDomains); } else { return; } } getStoragePoolDAO().remove(getStoragePool().getId()); setSucceeded(true); if (getSucceeded()) { MacPoolManager.getInstance().freeMacs(macsToRemove); } }

Target:
protected void executeCommand() { List<String> macsToRemove = getVmNetworkInterfaceDao().getAllMacsByDataCenter(getStoragePool().getId()); removeNetworks(); List<storage_domains> storageDomains = DbFacade.getInstance().getStorageDomainDao().getAllForStoragePool( getStoragePool().getId()); Collections.sort(storageDomains, new Comparator<storage_domains>() { @Override public int compare(storage_domains o1, storage_domains o2) { return o1.getstorage_domain_type().compareTo(o2.getstorage_domain_type()); } }); if (storageDomains.size() > 0) { if (!getParameters().getForceDelete() && getAllRunningVdssInPool().size() > 0) { if(!regularRemoveStorageDomains(storageDomains)) { setSucceeded(false); return; } } else if (getParameters().getForceDelete()) { forceRemoveStorageDomains(storageDomains); } else { return; } } getStoragePoolDAO().remove(getStoragePool().getId()); setSucceeded(true); if (macsToRemove != null && !macsToRemove.isEmpty()) { MacPoolManager.getInstance().freeMacs(macsToRemove); } }
Source:
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player) { if(!ToolHelper.isBroken(stack) && this instanceof IAoeTool && ((IAoeTool) this).isAoeHarvestTool()) { for(BlockPos extraPos : ((IAoeTool) this).getAOEBlocks(stack, player.worldObj, player, pos)) { breakBlock(stack, player, extraPos, pos); } } return super.onBlockStartBreak(stack, pos, player); }

Target:
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player) { if(!ToolHelper.isBroken(stack) && this.isAoeHarvestTool()) { for(BlockPos extraPos : ((IAoeTool) this).getAOEBlocks(stack, player.worldObj, player, pos)) { breakBlock(stack, player, extraPos, pos); } } return super.onBlockStartBreak(stack, pos, player); }
Source:
public static Set<String> unzipPathNames(BeanByteSource source) { Set<String> entryNames = new LinkedHashSet<>(); try (ZipInputStream in = new ZipInputStream(source.openStream())) { ZipEntry entry = in.getNextEntry(); while (entry != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName()); } in.closeEntry(); entry = in.getNextEntry(); } } catch (IOException ex) { throw new UncheckedIOException(ex); } return entryNames; }

Target:
public static Set<String> unzipPathNames(BeanByteSource source) { ImmutableSet.Builder<String> entryNames = ImmutableSet.builder(); try (ZipInputStream in = new ZipInputStream(source.openStream())) { ZipEntry entry = in.getNextEntry(); while (entry != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName()); } in.closeEntry(); entry = in.getNextEntry(); } } catch (IOException ex) { throw new UncheckedIOException(ex); } return entryNames.build(); }
Source:
public List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { final Predicate<LauncherActivityInfo> predicatePackage = info -> info.getComponentName() != null && packageName != null && packageName.equals(info.getComponentName().getPackageName()); return activityList.get(user).stream().filter(predicatePackage).collect(Collectors.toList()); }

Target:
protected List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { final Predicate<LauncherActivityInfo> predicatePackage = info -> info.getComponentName() != null && packageName != null && packageName.equals(info.getComponentName().getPackageName()); return activityList.get(user).stream().filter(predicatePackage).collect(Collectors.toList()); }
Source:
public void testUserAgentHeaderIsAddedToRequest() throws Exception { MockWebServer server = new MockWebServer(); server.start(); server.enqueue(new MockResponse()); try { CloudantClient client = CloudantClientHelper.newMockWebServerClientBuilder(server) .build(); client.executeRequest(createPost(client.getBaseUri(), null, "application/json")) .responseAsString(); String userAgentHeader = server.takeRequest(10, TimeUnit.SECONDS) .getHeader("User-Agent"); assertNotNull("The User-Agent header should be present on the request", userAgentHeader); assertTrue("The value of the User-Agent header " + userAgentHeader + " on the request" + " should match the format " + userAgentFormat, userAgentHeader.matches(userAgentRegex)); } finally { server.shutdown(); } }

Target:
public void testUserAgentHeaderIsAddedToRequest() throws Exception { MockWebServer server = new MockWebServer(); server.start(); server.enqueue(new MockResponse()); try { CloudantClient client = CloudantClientHelper.newMockWebServerClientBuilder(server) .build(); String response = client.executeRequest(createPost(client.getBaseUri(), null, "application/json")).responseAsString(); assertTrue("There should be no response body on the mock response", response.isEmpty()); String userAgentHeader = server.takeRequest(10, TimeUnit.SECONDS) .getHeader("User-Agent"); assertNotNull("The User-Agent header should be present on the request", userAgentHeader); assertTrue("The value of the User-Agent header " + userAgentHeader + " on the request" + " should match the format " + userAgentFormat, userAgentHeader.matches(userAgentRegex)); } finally { server.shutdown(); } }
Source:
public String getAnonConfirmation() { return requestConfirmation.getText(); }

Target:
public String getAnonConfirmation() { wait.forElementVisible(requestConfirmation); return requestConfirmation.getText(); }
Source:
public synchronized void assignEventProducers(String connectorType, List<DatastreamTask> addedTasks, List<DatastreamTask> removedTasks, boolean customCheckpointing) { Validate.notNull(connectorType); Validate.notEmpty(connectorType); for (DatastreamTask task : removedTasks) { _taskEventProducerMap.get(task).unassignTask(task); _taskEventProducerMap.remove(task); } removedTasks.forEach(t -> _taskEventProducerMap.remove(t)); if (!_producerPool.containsKey(customCheckpointing)) { _producerPool.put(customCheckpointing, createProducers(_poolSize / 2, customCheckpointing)); } List<EventProducer> producers = _producerPool.get(customCheckpointing); for (int addedTaskIndex = 0; addedTaskIndex < addedTasks.size(); addedTaskIndex++) { DatastreamTask task = addedTasks.get(addedTaskIndex); EventProducer eventProducer; if (addedTaskIndex < removedTasks.size()) { eventProducer = ((DatastreamEventProducerImpl) removedTasks.get(addedTaskIndex).getEventProducer()).getEventProducer(); } else { eventProducer = producers.get(_random.nextInt(producers.size())); } assignEventProducerToTask(eventProducer, task); } }

Target:
public synchronized void assignEventProducers(String connectorType, List<DatastreamTask> addedTasks, List<DatastreamTask> removedTasks, boolean customCheckpointing) { Validate.notNull(connectorType); Validate.notEmpty(connectorType); for (DatastreamTask task : removedTasks) { _taskEventProducerMap.get(task).unassignTask(task); _taskEventProducerMap.remove(task); } if (!_producerPool.containsKey(customCheckpointing)) { _producerPool.put(customCheckpointing, createProducers(_poolSize / 2, customCheckpointing)); } List<EventProducer> producers = _producerPool.get(customCheckpointing); for (int addedTaskIndex = 0; addedTaskIndex < addedTasks.size(); addedTaskIndex++) { DatastreamTask task = addedTasks.get(addedTaskIndex); EventProducer eventProducer; if (addedTaskIndex < removedTasks.size()) { eventProducer = ((DatastreamEventProducerImpl) removedTasks.get(addedTaskIndex).getEventProducer()).getEventProducer(); } else { eventProducer = producers.get(_random.nextInt(producers.size())); } assignEventProducerToTask(eventProducer, task); } }
Source:
private <W extends Widget> void navigate(Request<W> request) { if (locked) { queuedRequests.add(request); return; } redirectDepth++; if (redirectDepth >= MAXIMUM_REDIRECTS) { throw new RuntimeException( "Maximum redirect limit of " + MAXIMUM_REDIRECTS + " reached. " + "Do you have a redirect loop?"); } locked = true; hideCurrentPage(); showPage(request.pageNode, request.state); locked = false; if (queuedRequests.isEmpty()) { redirectDepth = 0; History.newItem(request.state.toString(), false); } else { while (queuedRequests.size() != 0) { navigate(queuedRequests.poll()); } } }

Target:
private <W extends Widget> void navigate(Request<W> request) { if (locked) { queuedRequests.add(request); return; } redirectDepth++; if (redirectDepth >= MAXIMUM_REDIRECTS) { throw new RuntimeException( "Maximum redirect limit of " + MAXIMUM_REDIRECTS + " reached. " + "Do you have a redirect loop?"); } locked = true; try { hideCurrentPage(); showPage(request.pageNode, request.state); } finally { locked = false; } if (queuedRequests.isEmpty()) { redirectDepth = 0; History.newItem(request.state.toString(), false); } else { while (queuedRequests.size() != 0) { navigate(queuedRequests.poll()); } } }
Source:
public BulkReceiveLibraryBackend(LibraryDto dto, Integer quantity, Project project, SampleClass aliquotClass, String defaultSciName, LibraryTemplateService libraryTemplateService) throws IOException { super("libraryReceipt", LibraryDto.class, "Libraries", dto, quantity); if (isDetailedSampleEnabled() && aliquotClass == null) throw new InvalidParameterException("Aliquot class cannot be null"); this.project = project; this.aliquotClass = aliquotClass; this.defaultSciName = defaultSciName; this.libraryTemplateService = libraryTemplateService; newBox = dto.getBox(); }

Target:
public BulkReceiveLibraryBackend(LibraryDto dto, Integer quantity, Project project, SampleClass aliquotClass, String defaultSciName, LibraryTemplateService libraryTemplateService) { super("libraryReceipt", LibraryDto.class, "Libraries", dto, quantity); if (isDetailedSampleEnabled() && aliquotClass == null) throw new InvalidParameterException("Aliquot class cannot be null"); this.project = project; this.aliquotClass = aliquotClass; this.defaultSciName = defaultSciName; this.libraryTemplateService = libraryTemplateService; newBox = dto.getBox(); }
Source:
public void setUp() { classInstance = new urn_perun_entityless_attribute_def_def_homeDirUmask(); facility = new Facility(); session = mock(PerunSessionImpl.class, RETURNS_DEEP_STUBS); }

Target:
public void setUp() { classInstance = new urn_perun_facility_attribute_def_def_homeDirUmask(); facility = new Facility(); session = mock(PerunSessionImpl.class, RETURNS_DEEP_STUBS); }
Source:
public void testEscapeString() { final String[] testPairs = { "", "", "plain string", "plain string", "string with \"quotes\"", "string with \"quotes\"", "C:\\Program Files\\MyProgram", "C:\\\\Program Files\\\\MyProgram", "string\nwith\nnewlines", "string\\nwith\\nnewlines", "string\nwith\ntabs", "string\\nwith\\ntabs" }; for (int i = 0; i < testPairs.length; i += 2) { assertEquals(ColumnFormatter.escapeString(testPairs[i]), testPairs[i + 1]); } }

Target:
public void testEscapeString() { final String[] testPairs = { "", "", "plain string", "plain string", "string with \"quotes\"", "string with \"quotes\"", "C:\\Program Files\\MyProgram", "C:\\\\Program Files\\\\MyProgram", "string\nwith\nnewlines", "string\\nwith\\nnewlines", "string\twith\ttabs", "string\\twith\\ttabs" }; for (int i = 0; i < testPairs.length; i += 2) { assertEquals(ColumnFormatter.escapeString(testPairs[i]), testPairs[i + 1]); } }
Source:
private void clearIndexCache(String uri) throws IOException { ExecutionBlockId ebId = ExecutionBlockId.fromString(uri); String queryId = ebId.getQueryId().toString(); String ebSeqId = Integer.toString(ebId.getId()); List<CacheKey> removed = new ArrayList<>(); synchronized (indexReaderCache) { for (Entry<CacheKey, BSTIndexReader> e : indexReaderCache.asMap().entrySet()) { CacheKey key = e.getKey(); if (key.queryId.equals(queryId) && key.ebSeqId.equals(ebSeqId)) { e.getValue().forceClose(); removed.add(e.getKey()); } } indexReaderCache.invalidateAll(removed); } removed.clear(); synchronized (waitForRemove) { for (Entry<CacheKey, BSTIndexReader> e : waitForRemove.entrySet()) { CacheKey key = e.getKey(); if (key.queryId.equals(queryId) && key.ebSeqId.equals(ebSeqId)) { e.getValue().forceClose(); removed.add(e.getKey()); } } for (CacheKey eachKey : removed) { waitForRemove.remove(eachKey); } } }

Target:
private void clearIndexCache(String uri) throws IOException, InvalidURLException { String[] tokens = uri.split("="); if (tokens.length != 2 || !tokens[0].equals("ebid")) { throw new IllegalArgumentException("invalid params: " + uri); } ExecutionBlockId ebId = TajoIdUtils.createExecutionBlockId(tokens[1]); String queryId = ebId.getQueryId().toString(); String ebSeqId = Integer.toString(ebId.getId()); List<CacheKey> removed = new ArrayList<>(); synchronized (indexReaderCache) { for (Entry<CacheKey, BSTIndexReader> e : indexReaderCache.asMap().entrySet()) { CacheKey key = e.getKey(); if (key.queryId.equals(queryId) && key.ebSeqId.equals(ebSeqId)) { e.getValue().forceClose(); removed.add(e.getKey()); } } indexReaderCache.invalidateAll(removed); } removed.clear(); synchronized (waitForRemove) { for (Entry<CacheKey, BSTIndexReader> e : waitForRemove.entrySet()) { CacheKey key = e.getKey(); if (key.queryId.equals(queryId) && key.ebSeqId.equals(ebSeqId)) { e.getValue().forceClose(); removed.add(e.getKey()); } } for (CacheKey eachKey : removed) { waitForRemove.remove(eachKey); } } }