auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object apply(ConfigResource resource, Input input) throws BadRequestException, ResourceConflictException, UnprocessableEntityException, OrmException, IOException { if (input == null) { input = new Input(); } if (input.username != null && !username.equals(input.username)) { throw new BadRequestException("username must match URL"); } if (Strings.isNullOrEmpty(input.sshKey)) { throw new BadRequestException("sshKey not set"); } if (blockedNames.contains(username.toLowerCase())) { throw new BadRequestException("The username '" + username + "' is not allowed as name for service users."); } CreateAccount.Input in = new ServiceUserInput(username, input.sshKey, cfg); Object response = createAccountFactory.create(username) .apply(TopLevelResource.INSTANCE, in); Config db = storage.get(); db.setString(USER_SECTION, username, CREATED_BY_KEY, userProvider.get().getUserName()); db.setString(USER_SECTION, username, CREATED_AT_KEY, rfc2822DateFormatter.format(new Date())); MetaDataUpdate md = metaDataUpdateFactory.create(allProjects); md.setMessage("Create Service User '" + username + "'\n"); storage.commit(md); return response; }

Target:
public Object apply(ConfigResource resource, Input input) throws BadRequestException, ResourceConflictException, UnprocessableEntityException, OrmException, IOException { if (input == null) { input = new Input(); } if (input.username != null && !username.equals(input.username)) { throw new BadRequestException("username must match URL"); } if (Strings.isNullOrEmpty(input.sshKey)) { throw new BadRequestException("sshKey not set"); } if (blockedNames.contains(username.toLowerCase())) { throw new BadRequestException("The username '" + username + "' is not allowed as name for service users."); } CreateAccount.Input in = new ServiceUserInput(username, input.sshKey, cfg); Object response = createAccountFactory.create(username) .apply(TopLevelResource.INSTANCE, in); Config db = storage.get(); db.setString(USER, username, KEY_CREATED_BY, userProvider.get().getUserName()); db.setString(USER, username, KEY_CREATED_AT, rfc2822DateFormatter.format(new Date())); MetaDataUpdate md = metaDataUpdateFactory.create(allProjects); md.setMessage("Create Service User '" + username + "'\n"); storage.commit(md); return response; }
Source:
synchronized int balance() { int currentNodeCount = nodeSupplier.getWorkerNodes().size(); if (currentNodeCount < minimumNodeCount) { log.warn(format("Give up rebalancing because too many nodes are down (required: %s, current: %s)", minimumNodeCount, currentNodeCount)); return 0; } log.info("Bucket balancer started. Computing assignments..."); Multimap<String, BucketAssignment> sourceToAssignmentChanges = computeAssignmentChanges(fetchClusterState()); log.info("Moving buckets..."); int moves = updateAssignments(sourceToAssignmentChanges); log.info("Bucket balancing finished. Moved %s buckets.", moves); return moves; }

Target:
synchronized int balance() { int currentNodeCount = nodeSupplier.getWorkerNodes().size(); if (currentNodeCount < minimumNodeCount) { log.warn(format("Rebalancing skipped because not enough nodes are available (required: %s, current: %s)", minimumNodeCount, currentNodeCount)); return 0; } log.info("Bucket balancer started. Computing assignments..."); Multimap<String, BucketAssignment> sourceToAssignmentChanges = computeAssignmentChanges(fetchClusterState()); log.info("Moving buckets..."); int moves = updateAssignments(sourceToAssignmentChanges); log.info("Bucket balancing finished. Moved %s buckets.", moves); return moves; }
Source:
public StandaloneCatalogWithPriceOverride(final StaticCatalog catalog, final PriceOverride priceOverride, final Long tenantRecordId, final InternalCallContextFactory internalCallContextFactory) { setCatalogName(catalog.getCatalogName()); setEffectiveDate(catalog.getEffectiveDate()); setProducts(((StandaloneCatalog) catalog).getCurrentProducts()); setPlans(((StandaloneCatalog) catalog).getCurrentPlans()); setPriceLists(((StandaloneCatalog) catalog).getPriceLists()); setPlanRules((DefaultPlanRules) ((StandaloneCatalog) catalog).getPlanRules()); setSupportedCurrencies(((StandaloneCatalog) catalog).getCurrentSupportedCurrencies()); setUnits(((StandaloneCatalog) catalog).getCurrentUnits()); this.tenantRecordId = tenantRecordId; this.priceOverride = priceOverride; this.internalCallContextFactory = internalCallContextFactory; }

Target:
public StandaloneCatalogWithPriceOverride(final StaticCatalog catalog, final PriceOverride priceOverride, final Long tenantRecordId, final InternalCallContextFactory internalCallContextFactory) { setCatalogName(catalog.getCatalogName()); setEffectiveDate(catalog.getEffectiveDate()); setProducts(catalog.getProducts()); setPlans(catalog.getPlans()); setPriceLists(((StandaloneCatalog) catalog).getPriceLists()); setPlanRules((DefaultPlanRules) catalog.getPlanRules()); setSupportedCurrencies(catalog.getSupportedCurrencies()); setUnits((DefaultUnit[]) catalog.getUnits()); this.tenantRecordId = tenantRecordId; this.priceOverride = priceOverride; this.internalCallContextFactory = internalCallContextFactory; initialize(this); }
Source:
public List<WriteEventInfo> getAllWriteEventInfo(long txnId, String dbName, String tableName) throws MetaException { List<WriteEventInfo> writeEventInfoList = null; boolean commited = false; Query query = null; try { openTransaction(); List<String> parameterVals = new ArrayList<>(); StringBuilder filterBuilder = new StringBuilder(" txnId == " + Long.toString(txnId)); if (dbName != null) { appendSimpleCondition(filterBuilder, "database", new String[]{dbName}, parameterVals); } if (tableName != null) { appendSimpleCondition(filterBuilder, "table", new String[]{tableName}, parameterVals); } query = pm.newQuery(MWriteNotificationLog.class, filterBuilder.toString()); query.setOrdering("table ascending"); List<MWriteNotificationLog> mplans = (List<MWriteNotificationLog>)query.executeWithArray( parameterVals.toArray(new String[parameterVals.size()])); pm.retrieveAll(mplans); commited = commitTransaction(); if (mplans != null && mplans.size() > 0) { writeEventInfoList = Lists.newArrayList(); for (MWriteNotificationLog mplan : mplans) { WriteEventInfo writeEventInfo = new WriteEventInfo(mplan.getWriteId(), mplan.getDatabase(), mplan.getTable(), mplan.getFiles()); writeEventInfo.setPartition(mplan.getPartition()); writeEventInfo.setPartitionObj(mplan.getPartObject()); writeEventInfo.setTableObj(mplan.getTableObject()); writeEventInfoList.add(writeEventInfo); } } } finally { rollbackAndCleanup(commited, query); } return writeEventInfoList; }

Target:
public List<WriteEventInfo> getAllWriteEventInfo(long txnId, String dbName, String tableName) throws MetaException { List<WriteEventInfo> writeEventInfoList = null; boolean commited = false; Query query = null; try { openTransaction(); List<String> parameterVals = new ArrayList<>(); StringBuilder filterBuilder = new StringBuilder(" txnId == " + Long.toString(txnId)); if (dbName != null && !"*".equals(dbName)) { appendSimpleCondition(filterBuilder, "database", new String[]{dbName}, parameterVals); } if (tableName != null && !"*".equals(tableName)) { appendSimpleCondition(filterBuilder, "table", new String[]{tableName}, parameterVals); } query = pm.newQuery(MTxnWriteNotificationLog.class, filterBuilder.toString()); query.setOrdering("database,table ascending"); List<MTxnWriteNotificationLog> mplans = (List<MTxnWriteNotificationLog>)query.executeWithArray( parameterVals.toArray(new String[parameterVals.size()])); pm.retrieveAll(mplans); commited = commitTransaction(); if (mplans != null && mplans.size() > 0) { writeEventInfoList = Lists.newArrayList(); for (MTxnWriteNotificationLog mplan : mplans) { WriteEventInfo writeEventInfo = new WriteEventInfo(mplan.getWriteId(), mplan.getDatabase(), mplan.getTable(), mplan.getFiles()); writeEventInfo.setPartition(mplan.getPartition()); writeEventInfo.setPartitionObj(mplan.getPartObject()); writeEventInfo.setTableObj(mplan.getTableObject()); writeEventInfoList.add(writeEventInfo); } } } finally { rollbackAndCleanup(commited, query); } return writeEventInfoList; }
Source:
public static void updateDiskStats(HWDiskStore diskStore) { Map<String,List<Object>> vals = WmiUtil.selectObjectsFrom(null, "Win32_DiskDrive", "Name,Manufacturer,Model,SerialNumber,Size,Index", "WHERE SerialNumber = " + diskStore.getSerial(),DRIVE_TYPES); diskStore.setName((String) vals.get("Name").get(0)); diskStore.setModel(String.format("%s %s", vals.get("Model").get(0), vals.get("Manufacturer").get(0)).trim()); String index = vals.get("Index").get(0).toString(); diskStore.setReads(MapUtil.getOrDefault(readMap, index, 0L)); diskStore.setReadBytes(MapUtil.getOrDefault(readByteMap, index, 0L)); diskStore.setWrites(MapUtil.getOrDefault(writeMap, index, 0L)); diskStore.setWriteBytes(MapUtil.getOrDefault(writeByteMap, index, 0L)); diskStore.setTransferTime(MapUtil.getOrDefault(xferTimeMap, index, 0L)); diskStore.setTimeStamp(MapUtil.getOrDefault(timeStampMap, index, 0L)); diskStore.setSize(ParseUtil.parseLongOrDefault((String) vals.get("Size").get(0), 0L)); HWPartition[] partitions = diskStore.getPartitions(); List<String> partList = driveToPartitionMap.get(diskStore.getName()); if (partList != null && !partList.isEmpty()) { for (int i = 0; i < partList.size(); i++) { String part = partList.get(i); partitions[i] = partitionMap.get(part); } } }

Target:
public static boolean updateDiskStats(HWDiskStore diskStore) { populateReadWriteMaps(); Map<String, List<Object>> vals = WmiUtil.selectObjectsFrom(null, "Win32_DiskDrive", "Index", "WHERE SerialNumber=" + diskStore.getSerial(), DRIVE_TYPES); if(vals.get("Index").size() == 0) { return false; } String index = vals.get("Index").get(0).toString(); if(readMap.containsKey(index)) { diskStore.setReads(MapUtil.getOrDefault(readMap, index, 0L)); diskStore.setReadBytes(MapUtil.getOrDefault(readByteMap, index, 0L)); diskStore.setWrites(MapUtil.getOrDefault(writeMap, index, 0L)); diskStore.setWriteBytes(MapUtil.getOrDefault(writeByteMap, index, 0L)); diskStore.setTransferTime(MapUtil.getOrDefault(xferTimeMap, index, 0L)); diskStore.setTimeStamp(MapUtil.getOrDefault(timeStampMap, index, 0L)); return true; } else { return false; } }
Source:
public void dequeueMessage() { TestHelpers.assertResponseStatusCode(client.create(), 201); String messageText = "test message"; TestHelpers.assertResponseStatusCode(client.enqueueMessage(messageText), 201); Iterator<DequeuedMessage> response = client.dequeueMessages().iterator(); assertEquals(messageText, response.next().messageText()); assertFalse(response.hasNext()); }

Target:
public void dequeueMessage() { helper.assertResponseStatusCode(client.create(), 201); String messageText = "test message"; helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); Iterator<DequeuedMessage> response = client.dequeueMessages().iterator(); assertEquals(messageText, response.next().messageText()); assertFalse(response.hasNext()); }
Source:
public void publish(StreamPayload<Exchange> data) { List<CamelSubscription> subs = new LinkedList<>(subscriptions); DispatchCallback<Exchange> originalCallback = data.getCallback(); if (originalCallback != null && subs.size() > 0) { AtomicInteger counter = new AtomicInteger(0); AtomicReference<Throwable> thrown = new AtomicReference<>(null); data = new StreamPayload<>(data.getItem(), (ex, error) -> { int status = counter.incrementAndGet(); thrown.compareAndSet(null, error); if (status == subs.size()) { originalCallback.processed(ex, thrown.get()); } }); } if (subs.size() > 0) { LOG.debug("Exchange published to subscriptions for the stream {}: {}", subs.size(), name, data.getItem()); for (CamelSubscription sub : subs) { sub.publish(data); } } else { data.getCallback().processed(data.getItem(), new IllegalStateException("The stream has no active subscriptions")); } }

Target:
public void publish(StreamPayload<Exchange> data) { List<CamelSubscription> subs = new LinkedList<>(subscriptions); DispatchCallback<Exchange> originalCallback = data.getCallback(); if (originalCallback != null && subs.size() > 0) { AtomicInteger counter = new AtomicInteger(subs.size()); AtomicReference<Throwable> thrown = new AtomicReference<>(null); data = new StreamPayload<>(data.getItem(), (ex, error) -> { thrown.compareAndSet(null, error); if (counter.decrementAndGet() == 0) { originalCallback.processed(ex, thrown.get()); } }); } if (subs.size() > 0) { LOG.debug("Exchange published to subscriptions for the stream {}: {}", subs.size(), name, data.getItem()); for (CamelSubscription sub : subs) { sub.publish(data); } } else { data.getCallback().processed(data.getItem(), new IllegalStateException("The stream has no active subscriptions")); } }
Source:
private URL getActionUrl(String metacardSource, String metacardId) throws MalformedURLException, URISyntaxException { StringBuilder sb = new StringBuilder(); sb.append(baseUrl); sb.append(context); sb.append("/"); sb.append( String.format( "%s%s/%s/%s?transform=%s", CONTEXT_ROOT, SOURCES_PATH, metacardSource, metacardId, metacardTransformerId)); return new URI(sb.toString()).toURL(); }

Target:
private URL getActionUrl(String metacardSource, String metacardId) throws MalformedURLException, URISyntaxException { String actionUrl = String.format( "%s%s/%s%s/%s/%s?transform=%s", baseUrl, context, CONTEXT_ROOT, SOURCES_PATH, metacardSource, metacardId, metacardTransformerId); return new URI(actionUrl).toURL(); }
Source:
public Stream<BytesHandle> getParamValues() { return paramValues; }

Target:
public Stream<BytesHandle> getParamValues() { return Stream.of(paramValues); }
Source:
public Optional<Application> applicationFor(HttpServletRequest request) throws InvalidApiKeyException { String apiKey; try { apiKey = MoreObjects.firstNonNull( request.getParameter(API_KEY_QUERY_PARAMETER), request.getHeader(API_KEY_QUERY_PARAMETER) ); } catch (NullPointerException e) { throw InvalidApiKeyException.create(e.getMessage(), "No api key supplied"); } Result result = applicationsClient.resolve( Query.create(apiKey, environment) ); if (result.getErrorCode().isPresent()) { throw InvalidApiKeyException.create(apiKey, result.getErrorCode().get().toString()); } return result.getSingleResult(); }

Target:
public Optional<Application> applicationFor(HttpServletRequest request) throws ApplicationResolutionException { String apiKeyParam = request.getParameter(API_KEY_QUERY_PARAMETER); String apiKeyHeader = request.getHeader(API_KEY_QUERY_PARAMETER); if (Strings.isNullOrEmpty(apiKeyParam) && Strings.isNullOrEmpty(apiKeyHeader)) { return Optional.empty(); } String apiKey = MoreObjects.firstNonNull(apiKeyParam, apiKeyHeader); Result result = applicationsClient.resolve( Query.create(apiKey, environment) ); if (result.getErrorCode().isPresent()) { log.error("Unable to resolve application: - {}", result.getErrorCode().get(), apiKey); throw ApplicationResolutionException.create( apiKey, "Unable to resolve application" ); } return result.getSingleResult(); }
Source:
public WPSwitchPreference(Context context, AttributeSet attrs) { super(context, attrs); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.SummaryEditTextPreference); for (int i = 0; i < array.getIndexCount(); ++i) { int index = array.getIndex(i); if (index == R.styleable.SummaryEditTextPreference_longClickHint) { mHint = array.getString(index); } else if (index == R.styleable.SummaryEditTextPreference_iconTint) { mTint = array.getResourceId(index, R.color.neutral); } else if (index == R.styleable.SummaryEditTextPreference_switchThumbTint) { mThumbTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_switchTrackTint) { mTrackTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_preferenceTextColor) { mTextColor = array.getResourceId(index, R.color.white); } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorChecked) { mBackgroundCheckedColor = array.getResourceId(index, R.color.white); } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorUnchecked) { mBackgroundUncheckedColor = array.getResourceId(index, R.color.white); } } array.recycle(); }

Target:
public WPSwitchPreference(Context context, AttributeSet attrs) { super(context, attrs); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.SummaryEditTextPreference); for (int i = 0; i < array.getIndexCount(); ++i) { int index = array.getIndex(i); if (index == R.styleable.SummaryEditTextPreference_longClickHint) { mHint = array.getString(index); } else if (index == R.styleable.SummaryEditTextPreference_iconTint) { mTint = array.getResourceId(index, R.color.neutral); } else if (index == R.styleable.SummaryEditTextPreference_switchThumbTint) { mThumbTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_switchTrackTint) { mTrackTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_preferenceTextColor) { mTextColor = array.getResourceId(index, android.R.color.white); } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorChecked) { mBackgroundCheckedColor = array.getResourceId(index, android.R.color.white); } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorUnchecked) { mBackgroundUncheckedColor = array.getResourceId(index, android.R.color.white); } } array.recycle(); }
Source:
public static @Nullable List<String> getOutputFromCommand(List<String> command) { try { ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); Process p = builder.start(); try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream(), Charset.defaultCharset()));) { List<String> output = new LinkedList<>(); String line = br.readLine(); while (line != null) { output.add(line); line = br.readLine(); } int ret = p.waitFor(); return (ret == 0 ? output : null); } } catch (IOException | InterruptedException e) { return null; } }

Target:
public static @Nullable List<String> getOutputFromCommand(List<String> command) { try { ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); Process p = builder.start(); try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream(), Charsets.UTF_8));) { List<String> output = new LinkedList<>(); String line = br.readLine(); while (line != null) { output.add(line); line = br.readLine(); } int ret = p.waitFor(); return (ret == 0 ? output : null); } } catch (IOException | InterruptedException e) { return null; } }
Source:
public int update(String sql, Object... args) throws SQLException { try (PreparedStatement ps = connection.prepareStatement(sql)) { setParameters(ps, args); return ps.executeUpdate(); } }

Target:
public int update(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); return ps.executeUpdate(); } finally { try { ps.close(); } catch (SQLException e) { } } }
Source:
private static int findFreePort() throws IOException { try (ServerSocket socket = new ServerSocket(0);) { return socket.getLocalPort(); } }

Target:
private static int findFreePort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } }
Source:
private View getScrollTarget(View target) { return mScrollTargetCallback != null ? mScrollTargetCallback.callback(target) : target; }

Target:
private View getScrollTarget(View target) { return mScrollTargetCallback != null ? mScrollTargetCallback.callback(target) : getSupportedScrollTarget(target); }
Source:
public @CheckForNull VersionNumber version() throws IOException, InterruptedException { LaunchResult result = launch(new EnvVars(), true, "-v"); final String stdout = result.getOut(); if (result.getStatus() == 0 && stdout != null) { return parseVersionNumber(stdout); } else { return null; } }

Target:
public @CheckForNull VersionNumber version() throws IOException, InterruptedException { LaunchResult result = launch(new EnvVars(), true, "-v"); if (result.getStatus() == 0) { return parseVersionNumber(result.getOut()); } else { return null; } }
Source:
public ResponseEntity<String> visualizeNetworks(@ProjectIdentifier @PathVariable("projectUnixName") String unixName, @PathVariable("networkId") String networkId, Principal principal, @CheckAccess @InjectProject IProject project) { ITransformedNetwork transformedNetwork = null; try { transformedNetwork = transformationManager.getTransformedNetwork(networkId); } catch (QuadrigaStorageException qse) { logger.error("Error while retrieving networks for display:" + qse); return new ResponseEntity<String>("", HttpStatus.INTERNAL_SERVER_ERROR); } String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } else { return new ResponseEntity<String>(json, HttpStatus.NOT_FOUND); } return new ResponseEntity<String>(json, HttpStatus.OK); }

Target:
public ResponseEntity<String> visualizeNetworks(@ProjectIdentifier @PathVariable("projectUnixName") String unixName, @PathVariable("networkId") String networkId, Principal principal, @CheckAccess @InjectProject IProject project) { ITransformedNetwork transformedNetwork = null; try { transformedNetwork = transformationManager.getTransformedNetwork(networkId); } catch (QuadrigaStorageException qse) { logger.error("Error while retrieving networks for display:", qse); return new ResponseEntity<String>("", HttpStatus.INTERNAL_SERVER_ERROR); } String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } else { return new ResponseEntity<String>("", HttpStatus.NOT_FOUND); } return new ResponseEntity<String>(json, HttpStatus.OK); }
Source:
public PageableResult search(RequestContext context) throws ResponseException { String patientUuid = context.getRequest().getParameter("patient"); String encounterTypeUuid = context.getRequest().getParameter("encounterType"); if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class).getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); if (patient != null && encounterType != null) { List<Encounter> encounters = Context.getEncounterService() .getEncounters(patient, null, null, null, null, Arrays.asList(encounterType), null, false); return new NeedsPaging<Encounter>(encounters, context); } } return new EmptySearchResult(); }

Target:
public PageableResult search(RequestContext context) throws ResponseException { String patientUuid = context.getRequest().getParameter("patient"); String encounterTypeUuid = context.getRequest().getParameter("encounterType"); Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class).getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); if (patient != null && encounterType != null) { List<Encounter> encounters = Context.getEncounterService() .getEncounters(patient, null, null, null, null, Arrays.asList(encounterType), null, false); return new NeedsPaging<Encounter>(encounters, context); } return new EmptySearchResult(); }
Source:
public List<Path> loadPaths(final Path path, final String suffix) { final List<Path> items = new ArrayList<Path>(); if (!Files.exists(Paths.convert(path))) { return items; } org.uberfire.java.nio.file.Path pPath = Paths.convert(path); if (!Files.isDirectory(pPath)) { pPath = pPath.getParent(); } final Set<ValueIndexTerm> queryTerms = new HashSet<>(); final ArrayList<String> extensions = new ArrayList<>(); extensions.add(suffix); queryTerms.add(new LibraryValueRepositoryRootIndexTerm(Paths.convert(pPath).toURI(), ValueIndexTerm.TermSearchType.NORMAL)); queryTerms.add(new LibraryValueFileExtensionIndexTerm(extensions)); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindAllLibraryAssetsQuery.NAME, queryTerms); for (RefactoringPageRow row : rows) { items.add((Path) row.getValue()); } return items; }

Target:
public List<Path> loadPaths(final Path path, final String suffix) { PortablePreconditions.checkNotNull("path", path); PortablePreconditions.checkNotNull("suffix", suffix); org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); final List<Path> items = new ArrayList<>(); if (!Files.exists(nioPath)) { return items; } if (!Files.isDirectory(nioPath)) { nioPath = nioPath.getParent(); } final Set<ValueIndexTerm> queryTerms = new HashSet<>(); final ArrayList<String> extensions = new ArrayList<>(); extensions.add(suffix); queryTerms.add(new LibraryValueRepositoryRootIndexTerm(Paths.convert(nioPath).toURI(), ValueIndexTerm.TermSearchType.NORMAL)); queryTerms.add(new LibraryValueFileExtensionIndexTerm(extensions)); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindAllLibraryAssetsQuery.NAME, queryTerms); for (RefactoringPageRow row : rows) { items.add((Path) row.getValue()); } return items; }
Source:
public Stream<ContainerItem> listContainers(ListContainersOptions options, Duration timeout) { Flux<ContainerItem> response = blobServiceAsyncClient.listContainers(options); return timeout == null ? response.toStream() : response.timeout(timeout).toStream(); }

Target:
public PagedIterable<ContainerItem> listContainers(ListContainersOptions options, Duration timeout) { return new PagedIterable<>(blobServiceAsyncClient.listContainersWithOptionalTimeout(options, timeout)); }
Source:
public List<String> getPagesValues() { return getForm() .findElements(By.xpath(". .map(webElement -> webElement.getAttribute(VALUE_ATTR)).collect(Collectors.toList()); }

Target:
public List<String> getPagesValues() { return getForm().findElements(By.cssSelector("input[type=hidden][name=pages]")).stream() .map(webElement -> webElement.getAttribute(VALUE_ATTR)).collect(Collectors.toList()); }
Source:
protected void EndSuccessfully() { VM vm = getVm(); if (vm != null) { VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOps(vm); } else { this.endDefaultOps(vm); } setSucceeded(true); } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } }

Target:
protected void EndSuccessfully() { VM vm = getVm(); if (vm != null) { VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOperations(vm); } else { this.endDefaultOps(vm); } setSucceeded(true); } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } }
Source:
TableConfWatcher(Instance instance) { this.instance = instance; tablesPrefix = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/"; tablesPrefixLength = tablesPrefix.length(); scf = new ServerConfigurationFactory(instance); }

Target:
TableConfWatcher(Instance instance) { this.instance = instance; tablesPrefix = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/"; scf = new ServerConfigurationFactory(instance); }
Source:
public void requireLastHeartbeat() { if (lastHeartbeat == null) { throw new RuntimeException("BinlogPosition.lastHeartbeat must be set"); } }

Target:
public void requireLastHeartbeat() { if (lastHeartbeat == null) { throw new AssertionError("BinlogPosition.lastHeartbeat must be set"); } }
Source:
protected void onPreExecute() { super.onPreExecute(); if (context == null) { return; } String title = context.getString(R.string.please_wait); String message = context.getString(R.string.fetching_templates); progressDialog = ProgressDialog.show(context, title, message); }

Target:
protected void onPreExecute() { super.onPreExecute(); if (context == null) { return; } String title = context.getString(R.string.please_wait); String progressMessage = context.getString(R.string.fetching_templates); progressDialog = ProgressDialog.show(context, title, progressMessage); }
Source:
void verifyRawQueryBehavior(@Nullable TestItem actualItem) { verify(storIOSQLite, times(1)).get(); verify(getResolver, times(1)).performGet(storIOSQLite, rawQuery); verify(getResolver, times(1)).mapFromCursor(cursor); verify(cursor, times(1)).close(); assertThat(actualItem).isEqualTo(item); }

Target:
void verifyRawQueryBehavior(@Nullable TestItem actualItem) { verify(storIOSQLite).get(); verify(getResolver).performGet(storIOSQLite, rawQuery); verify(getResolver).mapFromCursor(cursor); verify(cursor).close(); assertThat(actualItem).isEqualTo(item); }
Source:
public List<AstProcessingStage<?>> testOnlyGetDependencies(RuleSets ruleSets, LanguageVersion languageVersion) { return getDependencies(ruleSets, languageVersion); }

Target:
List<AstProcessingStage<?>> testOnlyGetDependencies(RuleSets ruleSets, LanguageVersion languageVersion) { return getDependencies(ruleSets, languageVersion); }
Source:
public void setDOMStorageItem(JsonRpcPeer peer, JSONObject params) throws JSONException { StorageId storage = mObjectMapper.convertValue( params.getJSONObject("storageId"), StorageId.class); String key = params.getString("key"); String value = params.getString("value"); if (storage.isLocalStorage) { SharedPreferences prefs = mContext.getSharedPreferences( storage.securityOrigin, Context.MODE_PRIVATE); Object exitingValue = prefs.getAll().get(key); SharedPreferences.Editor editor = prefs.edit(); if (!tryAssignByType(editor, key, value, exitingValue)) { editor.putString(key, value); } editor.apply(); } }

Target:
public void setDOMStorageItem(JsonRpcPeer peer, JSONObject params) throws JSONException, JsonRpcException { StorageId storage = mObjectMapper.convertValue( params.getJSONObject("storageId"), StorageId.class); String key = params.getString("key"); String value = params.getString("value"); if (storage.isLocalStorage) { SharedPreferences prefs = mContext.getSharedPreferences( storage.securityOrigin, Context.MODE_PRIVATE); Object existingValue = prefs.getAll().get(key); try { if (existingValue == null) { throw new DOMStorageAssignmentException( "Unsupported: cannot add new key " + key + " due to lack of type inference"); } else { SharedPreferences.Editor editor = prefs.edit(); try { assignByType(editor, key, SharedPreferencesHelper.valueFromString(value, existingValue)); editor.apply(); } catch (IllegalArgumentException e) { throw new DOMStorageAssignmentException( String.format(Locale.US, "Type mismatch setting %s to %s (expected %s)", key, value, existingValue.getClass().getSimpleName())); } } } catch (DOMStorageAssignmentException e) { CLog.writeToConsole( mDOMStoragePeerManager, Console.MessageLevel.ERROR, Console.MessageSource.STORAGE, e.getMessage()); if (prefs.contains(key)) { mDOMStoragePeerManager.signalItemUpdated( storage, key, value, SharedPreferencesHelper.valueToString(existingValue)); } else { mDOMStoragePeerManager.signalItemRemoved(storage, key); } } } }
Source:
private static String getSessionDescription(ISarosSession sarosSession) { final Set<IReferencePoint> referencePoints = sarosSession.getReferencePoints(); final StringBuilder result = new StringBuilder(); for (IReferencePoint referencePoint : referencePoints) { final Pair<Long, Long> fileCountAndSize; final List<IResource> resources = Collections.singletonList(ResourceConverter.getDelegate(referencePoint)); fileCountAndSize = FileUtils.getFileCountAndSize(resources, true, IContainer.EXCLUDE_DERIVED); result.append( String.format( "\nReference Point: %s, Files: %d, Size: %s", referencePoint.getName(), fileCountAndSize.getRight(), format(fileCountAndSize.getLeft()))); } return result.toString(); }

Target:
private static String getSessionDescription(ISarosSession sarosSession) { final Set<IReferencePoint> referencePoints = sarosSession.getReferencePoints(); final StringBuilder result = new StringBuilder(); for (IReferencePoint referencePoint : referencePoints) { final IContainer referencePointDelegate = ResourceConverter.getDelegate(referencePoint); final Pair<Long, Long> fileCountAndSize; final List<IResource> resources = Collections.singletonList(ResourceConverter.getDelegate(referencePoint)); fileCountAndSize = FileUtils.getFileCountAndSize(resources, true, IContainer.EXCLUDE_DERIVED); result.append( String.format( "\nReference Point: %s, Files: %d, Size: %s", referencePointDelegate.getFullPath(), fileCountAndSize.getRight(), format(fileCountAndSize.getLeft()))); } return result.toString(); }
Source:
public static void Init() { Class<?>[] inspectedClasses = new Class<?>[] { VDS.class, VdsStatic.class, VdsDynamic.class }; mUpdateVdsStatic = new ObjectIdentityChecker(VdsHandler.class, Arrays.asList(inspectedClasses), VDSStatus.class); for (Pair<EditableField,String> pair : extractyAnnotatedFields(EditableField.class, inspectedClasses)) { mUpdateVdsStatic.AddPermittedFields(pair.getSecond()); } for (Pair<EditableOnVdsStatus,String> pair : extractyAnnotatedFields(EditableOnVdsStatus.class, inspectedClasses)) { mUpdateVdsStatic.AddField(Arrays.asList(pair.getFirst().statuses()),pair.getSecond()); } }

Target:
public static void Init() { Class<?>[] inspectedClasses = new Class<?>[] { VDS.class, VdsStatic.class, VdsDynamic.class }; mUpdateVdsStatic = new ObjectIdentityChecker(VdsHandler.class, Arrays.asList(inspectedClasses), VDSStatus.class); for (Pair<EditableField,String> pair : extractAnnotatedFields(EditableField.class, inspectedClasses)) { mUpdateVdsStatic.AddPermittedField(pair.getSecond()); } for (Pair<EditableOnVdsStatus,String> pair : extractAnnotatedFields(EditableOnVdsStatus.class, inspectedClasses)) { mUpdateVdsStatic.AddField(Arrays.asList(pair.getFirst().statuses()),pair.getSecond()); } }
Source:
public void assertValidType( String key, Object value, IndexIdentifier identifier ) { DocValuesType expectedType; String expectedTypeName; if ( value instanceof Number ) { expectedType = DocValuesType.SORTED_NUMERIC; expectedTypeName = "numbers"; } else { expectedType = DocValuesType.SORTED_SET; expectedTypeName = "strings"; } Map<String,DocValuesType> stringDocValuesTypeMap = indexTypeMap.get( identifier ); if ( stringDocValuesTypeMap == null ) { getIndexSearcher( identifier ); stringDocValuesTypeMap = indexTypeMap.get( identifier ); } DocValuesType actualType; synchronized ( stringDocValuesTypeMap ) { actualType = stringDocValuesTypeMap.get( key ); if ( actualType == null ) { actualType = expectedType; stringDocValuesTypeMap.put( key, expectedType ); } } if ( !actualType.equals( expectedType ) ) { throw new IllegalArgumentException( String.format( "Cannot index '%s' for key '%s', since this key has been used to index another %s.", value, key, expectedTypeName ) ); } }

Target:
public void assertValidType( String key, Object value, IndexIdentifier identifier ) { DocValuesType expectedType; String expectedTypeName; if ( value instanceof Number ) { expectedType = DocValuesType.SORTED_NUMERIC; expectedTypeName = "numbers"; } else { expectedType = DocValuesType.SORTED_SET; expectedTypeName = "strings"; } Map<String,DocValuesType> stringDocValuesTypeMap = indexTypeMap.get( identifier ); if ( stringDocValuesTypeMap == null ) { getIndexSearcher( identifier ); stringDocValuesTypeMap = indexTypeMap.get( identifier ); } DocValuesType actualType; actualType = stringDocValuesTypeMap.putIfAbsent( key, expectedType ); if ( actualType != null && !actualType.equals( expectedType ) ) { throw new IllegalArgumentException( String.format( "Cannot index '%s' for key '%s', since this key has been used to index another %s.", value, key, expectedTypeName ) ); } }
Source:
public ForumList getForums(String communityUuid, Map<String, String> parameters) throws CommunityServiceException { if (StringUtil.isEmpty(communityUuid)){ throw new CommunityServiceException(null, Messages.NullCommunityIdException); } if(null == parameters){ parameters = new HashMap<String, String>(); } parameters.put(COMMUNITY_UNIQUE_IDENTIFIER, communityUuid); ForumList forums = null; try { ForumService svc = new ForumService(this.endpoint); forums = svc.getAllForums(parameters); }catch (Exception e) { throw new CommunityServiceException(e, Messages.CommunityForumTopicsException, communityUuid); } return forums; }

Target:
public ForumList getForums(String communityUuid, Map<String, String> parameters) throws CommunityServiceException { if (StringUtil.isEmpty(communityUuid)){ throw new CommunityServiceException(null, Messages.NullCommunityIdException); } if(null == parameters){ parameters = new HashMap<String, String>(); } parameters.put(COMMUNITY_UNIQUE_IDENTIFIER, communityUuid); ForumList forums; try { ForumService svc = new ForumService(this.endpoint); forums = svc.getAllForums(parameters); }catch (Exception e) { throw new CommunityServiceException(e, Messages.CommunityForumTopicsException, communityUuid); } return forums; }
Source:
public void shouldResumeWhenWritabilityChanged() throws Exception { TransportThrottle throttle = newThrottleAndInstall( channel ); when( channel.isWritable() ).thenReturn( false ); Future future = Executors.newSingleThreadExecutor().submit( () -> throttle.acquire( channel ) ); Thread.sleep( 500 ); when( channel.isWritable() ).thenReturn( true ); ArgumentCaptor<ChannelInboundHandler> captor = ArgumentCaptor.forClass( ChannelInboundHandler.class ); verify( channel.pipeline() ).addLast( captor.capture() ); captor.getValue().channelWritabilityChanged( context ); try { future.get( 2000, TimeUnit.MILLISECONDS ); } catch ( Throwable t ) { fail( "should not throw" ); } verify( lock, atLeastOnce() ).lock( any(), anyLong() ); verify( lock, times( 1 ) ).unlock( any() ); }

Target:
public void shouldResumeWhenWritabilityChanged() throws Exception { TransportThrottle throttle = newThrottleAndInstall( channel ); when( channel.isWritable() ).thenReturn( false ); Future future = Executors.newSingleThreadExecutor().submit( () -> throttle.acquire( channel ) ); if ( !lock.waitLocked( 1, TimeUnit.SECONDS ) ) { fail( "lock should be acquired" ); } when( channel.isWritable() ).thenReturn( true ); ArgumentCaptor<ChannelInboundHandler> captor = ArgumentCaptor.forClass( ChannelInboundHandler.class ); verify( channel.pipeline() ).addLast( captor.capture() ); captor.getValue().channelWritabilityChanged( context ); try { future.get( 2000, TimeUnit.MILLISECONDS ); } catch ( Throwable t ) { fail( "should not throw" ); } assertThat( lock.lockCallCount(), greaterThan( 0 ) ); assertThat( lock.unlockCallCount(), is( 1 ) ); }
Source:
private static boolean isExternal(File directory) { boolean state = false; String cacheDirPath = null; File extStoragePath = Environment.getExternalStorageDirectory(); if(extStoragePath != null) { cacheDirPath = extStoragePath.toString(); try { String appCacheDirPath = directory.getCanonicalPath(); if (appCacheDirPath.contains(cacheDirPath)) state = true; } catch (IOException e) { e.printStackTrace(); } }else{ state = false;} return state; }

Target:
private static boolean isExternal(File directory) { boolean state = false; String cacheDirPath = null; File extStoragePath = Environment.getExternalStorageDirectory(); if(extStoragePath != null) { cacheDirPath = extStoragePath.toString(); try { String appCacheDirPath = directory.getCanonicalPath(); if (appCacheDirPath.contains(cacheDirPath)) { state = true;} } catch (IOException e) { e.printStackTrace(); } } return state; }
Source:
public void map() throws Exception { PinotSegmentRecordReader segmentRecordReader = new PinotSegmentRecordReader(_inputSegment); GenericRow reusableRow = new GenericRow(); GenericData.Record reusableRecord = new GenericData.Record(_avroSchema); Set<String> selectedPartitions = new HashSet<>(); Set<String> rejectedPartitions = new HashSet<>(); while (segmentRecordReader.hasNext()) { reusableRow = segmentRecordReader.next(reusableRow); reusableRow = _recordTransformer.transformRecord(reusableRow); String partition = _partitioner.getPartition(reusableRow); if (rejectedPartitions.contains(partition)) { continue; } if (!selectedPartitions.contains(partition)) { boolean filter = _partitionFilter.filter(partition); if (filter) { rejectedPartitions.add(partition); continue; } else { selectedPartitions.add(partition); } } if (!_partitionToDataFileWriterMap.containsKey(partition)) { File partDir = new File(_mapperOutputDir, partition); if (!partDir.exists()) { Files.createDirectory(Paths.get(partDir.getAbsolutePath())); } DataFileWriter<GenericData.Record> recordWriter = new DataFileWriter<>(new GenericDatumWriter<>(_avroSchema)); recordWriter.create(_avroSchema, new File(partDir, createMapperOutputFileName(_mapperId))); _partitionToDataFileWriterMap.put(partition, recordWriter); } SegmentProcessorUtils.convertGenericRowToAvroRecord(reusableRow, reusableRecord); _partitionToDataFileWriterMap.get(partition).append(reusableRecord); } }

Target:
public void map() throws Exception { PinotSegmentRecordReader segmentRecordReader = new PinotSegmentRecordReader(_inputSegment); GenericRow reusableRow = new GenericRow(); GenericData.Record reusableRecord = new GenericData.Record(_avroSchema); while (segmentRecordReader.hasNext()) { reusableRow = segmentRecordReader.next(reusableRow); reusableRow = _recordTransformer.transformRecord(reusableRow); if (_recordFilter.filter(reusableRow)) { continue; } String partition = _partitioner.getPartition(reusableRow); DataFileWriter<GenericData.Record> recordWriter = _partitionToDataFileWriterMap.get(partition); if (recordWriter == null) { File partDir = new File(_mapperOutputDir, partition); if (!partDir.exists()) { Files.createDirectory(Paths.get(partDir.getAbsolutePath())); } recordWriter = new DataFileWriter<>(new GenericDatumWriter<>(_avroSchema)); recordWriter.create(_avroSchema, new File(partDir, createMapperOutputFileName(_mapperId))); _partitionToDataFileWriterMap.put(partition, recordWriter); } SegmentProcessorUtils.convertGenericRowToAvroRecord(reusableRow, reusableRecord); recordWriter.append(reusableRecord); } }
Source:
protected JobPartTrackerDecorator(final List<Objects> chunks, final EventRunner eventRunner) { clientJobPartTracker = JobPartTrackerFactory.buildPartTracker(Iterables.concat(getAllBlobApiBeans(chunks)), eventRunner); internalJobPartTracker = JobPartTrackerFactory.buildPartTracker(Iterables.concat(getAllBlobApiBeans(chunks)), eventRunner); }

Target:
protected JobPartTrackerDecorator(final List<Objects> chunks, final EventRunner eventRunner) { clientJobPartTracker = JobPartTrackerFactory.buildPartTracker(getAllBlobApiBeans(chunks), eventRunner); internalJobPartTracker = JobPartTrackerFactory.buildPartTracker(getAllBlobApiBeans(chunks), eventRunner); }
Source:
public void prepareRun(BatchAggregatorContext context) throws Exception { setNumPartitions(context, dedupConfig.numPartitions); if (SchemaValidator.canRecordLineage(context.getOutputSchema(), "output")) { TransformLineageRecorderUtils.generateOneToOnes( TransformLineageRecorderUtils.getFields(context.getInputSchema()), "dedup", "Removed duplicate records based on unique fields."); } }

Target:
public void prepareRun(BatchAggregatorContext context) throws Exception { super.prepareRun(context); if (SchemaValidator.canRecordLineage(context.getOutputSchema(), context.getStageName())) { TransformLineageRecorderUtils.generateOneToOnes( TransformLineageRecorderUtils.getFields(context.getInputSchema()), "dedup", "Removed duplicate records based on unique fields."); } }
Source:
public void visitMethodInvocation(MethodInvocationTree tree) { if (SUPER_THREAD.matches(tree) && ThreadOverridesRunCheck.hasRunnableArgument(tree.arguments())) { callSuperWithRunnable = true; } super.visitMethodInvocation(tree); }

Target:
public void visitMethodInvocation(MethodInvocationTree tree) { if (SUPER_THREAD.matches(tree) && ThreadOverridesRunCheck.hasRunnableArgument(tree.arguments())) { callSuperWithRunnable = true; return; } super.visitMethodInvocation(tree); }
Source:
private int compileShader(int type, Set<ShaderProgramFeature> features) { int shaderId = GL20.glCreateShader(type); String shader = createShader(type, features); Config config = CoreRegistry.get(Config.class); if (config.getRendering().isDumpShaders()) { dumpCode(type, features, shader); } GL20.glShaderSource(shaderId, shader); GL20.glCompileShader(shaderId); int featureHash = ShaderProgramFeature.getBitset(features); if (type == GL20.GL_FRAGMENT_SHADER) { fragmentPrograms.put(featureHash, shaderId); } else if (type == GL20.GL_VERTEX_SHADER) { vertexPrograms.put(featureHash, shaderId); } return shaderId; }

Target:
private int compileShader(int type, Set<ShaderProgramFeature> features) { int shaderId = GL20.glCreateShader(type); String shader = assembleShader(type, features); if (config.getRendering().isDumpShaders()) { dumpCode(type, features, shader); } GL20.glShaderSource(shaderId, shader); GL20.glCompileShader(shaderId); return shaderId; }
Source:
public Connection createConnection(String userName, String password) throws JMSException { Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (JMSConstants.JMSDestinationType.TOPIC.equals(this.destinationType)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { if (connection != null) { connection.setClientID(clientId); } else { throw new JMSException("Connection is null. Cannot set client ID " + clientId + "for durable subscription"); } } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }

Target:
public Connection createConnection(String userName, String password) throws JMSException { Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (JMSConstants.JMSDestinationType.TOPIC.equals(this.destinationType)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { if (connection == null) { throw new JMSException( "Connection is null. Cannot set client ID " + clientId + "for durable subscription"); } connection.setClientID(clientId); } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }
Source:
protected Query complete(Criteria criteria, Sort sort) { Criteria toUse = null; if (accessor.getSampleObject() != null) { toUse = new Criteria().alike(accessor.getSampleObject()); } if (criteria != null) { if (toUse == null) { toUse = criteria; } else { toUse.andOperator(criteria); } } Query query = (toUse == null ? new Query() : new Query(toUse)).with(sort); if (LOG.isDebugEnabled()) { LOG.debug("Created query " + query); } return query; }

Target:
protected Query complete(Criteria criteria, Sort sort) { Query query = (criteria == null ? new Query() : new Query(criteria)).with(sort); if (LOG.isDebugEnabled()) { LOG.debug("Created query " + query); } return query; }