auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void show(final @NonNull CheckoutResult result) { if (result.getStatus() == CheckoutResult.Status.CONFLICTS) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.BranchResultDialog_CheckoutConflictsTitle, NLS.bind( UIText.BranchResultDialog_CheckoutConflictsMessage, Repository.shortenRefName(target)), repository, result.getConflictList()); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { BranchOperationUI op = BranchOperationUI .checkoutWithoutQuestion(repository, target); op.start(); } } }); } else if (result.getStatus() == CheckoutResult.Status.NONDELETED) { boolean show = false; List<String> pathList = result.getUndeletedList(); for (String path : pathList) if (new File(repository.getWorkTree(), path).exists()) { show = true; break; } if (!show) return; PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new NonDeletedFilesDialog(shell, repository, result .getUndeletedList()).open(); } }); } else if (result.getStatus() == CheckoutResult.Status.OK) { if (RepositoryUtil.isDetachedHead(repository)) showDetachedHeadWarning(); } }

Target:
private void show(final @NonNull CheckoutResult result) { if (result.getStatus() == CheckoutResult.Status.CONFLICTS) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.BranchResultDialog_CheckoutConflictsTitle, NLS.bind( UIText.BranchResultDialog_CheckoutConflictsMessage, Repository.shortenRefName(target)), repository, result.getConflictList()); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { BranchOperationUI op = BranchOperationUI .checkoutWithoutQuestion(repository, target); op.start(); } } }); } else if (result.getStatus() == CheckoutResult.Status.NONDELETED) { boolean show = false; List<String> pathList = result.getUndeletedList(); for (String path : pathList) if (new File(repository.getWorkTree(), path).exists()) { show = true; break; } if (!show) return; PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new NonDeletedFilesDialog(shell, repository, result .getUndeletedList()).open(); } }); } else if (result.getStatus() == CheckoutResult.Status.OK) { if (RepositoryUtil.isDetachedHead(repository)) showDetachedHeadWarning(); } }
Source:
private void onLocalReplaysWatchEvent(WatchKey key) { Collection<Replay> newReplays = new ArrayList<Replay>(); Collection<Replay> deletedReplays = new ArrayList<Replay>(); for (WatchEvent<?> watchEvent : key.pollEvents()) { Path path = (Path) watchEvent.context(); Path fullPathToReplay = preferencesService.getReplaysDirectory().resolve(path); if (watchEvent.kind() == ENTRY_CREATE) { try { loadLocalReplay(fullPathToReplay) .thenAccept(newReplay -> { newReplays.add(newReplay); }); } catch (Exception e) { logger.warn("Failed to load local replay file '{}'", path, e); } } else if (watchEvent.kind() == ENTRY_DELETE) { Optional<Replay> existingReplay = localReplays.stream().filter(replay -> replay.getReplayFile().compareTo(fullPathToReplay) == 0).findFirst(); if (existingReplay.isPresent()) { Replay deletedReplay = existingReplay.get(); deletedReplays.add(deletedReplay); localReplays.remove(deletedReplay); } } } localReplays.addAll(newReplays); eventBus.post(new LocalReplaysChangedEvent(newReplays, deletedReplays)); }

Target:
private void onLocalReplaysWatchEvent(WatchKey key) { Collection<Replay> newReplays = new ArrayList<Replay>(); Collection<Replay> deletedReplays = new ArrayList<Replay>(); for (WatchEvent<?> watchEvent : key.pollEvents()) { Path path = (Path) watchEvent.context(); Path fullPathToReplay = preferencesService.getReplaysDirectory().resolve(path); if (watchEvent.kind() == ENTRY_CREATE) { tryLoadingLocalReplay(fullPathToReplay) .thenAccept(newReplay -> newReplays.add(newReplay)); } else if (watchEvent.kind() == ENTRY_DELETE) { Optional<Replay> existingReplay = localReplays .stream() .filter(replay -> replay.getReplayFile().compareTo(fullPathToReplay) == 0) .findFirst(); if (existingReplay.isPresent()) { Replay deletedReplay = existingReplay.get(); deletedReplays.add(deletedReplay); localReplays.remove(deletedReplay); } } } localReplays.addAll(newReplays); publisher.publishEvent(new LocalReplaysChangedEvent(this, newReplays, deletedReplays)); }
Source:
private InterceptorManager(String testName, String playbackRecordName, TestMode testMode, boolean doNotRecord) { Objects.requireNonNull(testName, "'testName' cannot be null."); this.testName = testName; this.playbackRecordName = playbackRecordName; this.testMode = testMode; this.textReplacementRules = new HashMap<>(); this.allowedToReadRecordedValues = (testMode == TestMode.PLAYBACK && !doNotRecord); this.allowedToRecordValues = (testMode == TestMode.RECORD && !doNotRecord); if (allowedToReadRecordedValues) { this.recordedData = readDataFromFile(); } else if (allowedToRecordValues) { this.recordedData = new RecordedData(); } else { this.recordedData = null; } }

Target:
private InterceptorManager(String testName, String playbackRecordName, TestMode testMode, boolean doNotRecord) { Objects.requireNonNull(testName, "'testName' cannot be null."); this.testName = testName; this.playbackRecordName = CoreUtils.isNullOrEmpty(playbackRecordName) ? testName : playbackRecordName; this.testMode = testMode; this.textReplacementRules = new HashMap<>(); this.allowedToReadRecordedValues = (testMode == TestMode.PLAYBACK && !doNotRecord); this.allowedToRecordValues = (testMode == TestMode.RECORD && !doNotRecord); if (allowedToReadRecordedValues) { this.recordedData = readDataFromFile(); } else if (allowedToRecordValues) { this.recordedData = new RecordedData(); } else { this.recordedData = null; } }
Source:
public static PointArray pointArray( Value[] maybePoints ) { PointValue[] values = new PointValue[maybePoints.length]; for ( int i = 0; i < maybePoints.length; i++ ) { Value maybePoint = maybePoints[i]; if ( !(maybePoint instanceof PointValue) ) { throw new IllegalArgumentException( format( "[%s:%s] is not a supported point value", maybePoint, maybePoint.getClass().getName() ) ); } values[i] = Values.point( (PointValue) maybePoint ); } return new PointArray.Direct( values ); }

Target:
public static PointArray pointArray( Value[] maybePoints ) { PointValue[] values = new PointValue[maybePoints.length]; for ( int i = 0; i < maybePoints.length; i++ ) { Value maybePoint = maybePoints[i]; if ( !(maybePoint instanceof PointValue) ) { throw new IllegalArgumentException( format( "[%s:%s] is not a supported point value", maybePoint, maybePoint.getClass().getName() ) ); } values[i] = Values.point( (PointValue) maybePoint ); } return pointArray( values ); }
Source:
public Double randomDatum(final CopyNumberTriState state, final Random rdn) { Utils.nonNull(state); Utils.nonNull(rdn); final NormalDistribution stateDistro = this.stateDistribution(state); return rdn.nextGaussian() * stateDistro.getStandardDeviation() + stateDistro.getMean(); }

Target:
public Double randomDatum(final CopyNumberTriState state, final Random rdn) { Utils.nonNull(state); Utils.nonNull(rdn); final NormalDistribution stateDistro = emissionDistributionByState.get(state); return rdn.nextGaussian() * stateDistro.getStandardDeviation() + stateDistro.getMean(); }
Source:
public void processLeftData(final MistDataEvent event) { final long timestamp = event.getTimestamp(); if (recentLeftTimestamp > timestamp) { throw new RuntimeException("The upstream events should be ordered by timestamp."); } else if (recentLeftWatermark.getTimestamp() > timestamp){ throw new RuntimeException("The watermark should guarantee that " + "all events having less timestamp than it are arrived already."); } recentLeftTimestamp = timestamp; leftUpstreamQueue.add(event); final long leftWatermarkTimestamp = recentLeftWatermark.getTimestamp(); final long rightWatermarkTimestamp = recentRightWatermark.getTimestamp(); final long minimumWatermark = Math.min( Math.max(recentLeftTimestamp, leftWatermarkTimestamp), Math.max(recentRightTimestamp, rightWatermarkTimestamp)); drainUntilTimestamp(minimumWatermark); if (recentLeftWatermark != defaultWatermark && leftWatermarkTimestamp <= minimumWatermark) { outputEmitter.emitWatermark(recentLeftWatermark); recentLeftWatermark = defaultWatermark; } if (recentRightWatermark != defaultWatermark && rightWatermarkTimestamp <= minimumWatermark) { outputEmitter.emitWatermark(recentRightWatermark); recentRightWatermark = defaultWatermark; } }

Target:
public void processLeftData(final MistDataEvent event) { final long timestamp = event.getTimestamp(); if (recentLeftTimestamp > timestamp) { throw new RuntimeException("The upstream events should be ordered by timestamp."); } else if (recentLeftWatermark.getTimestamp() > timestamp){ throw new RuntimeException("The watermark should guarantee that " + "all events having less timestamp than it are arrived already."); } recentLeftTimestamp = timestamp; leftUpstreamQueue.add(event); drainUntilMinimumWatermark(); }
Source:
public void onMediaUploaded(OnMediaUploaded event) { if (event.media == null || mMediaLatchMap.get(event.media.getId()) == null) { AppLog.w(T.POSTS, "Media event not recognized: " + event.media); return; } if (event.completed) { AppLog.i(T.POSTS, "Media upload completed for post. Media id: " + event.media.getId() + ", post id: " + mCurrentUploadingPost.getId()); mMediaLatchMap.get(event.media.getId()).countDown(); mMediaLatchMap.remove(event.media.getId()); } else if (!event.canceled && !event.isError()) { mPostUploadNotifier.updateNotificationProgress(mCurrentUploadingPost, event.progress); } }

Target:
public void onMediaUploaded(OnMediaUploaded event) { if (event.media == null || mCurrentUploadingPost == null || mMediaLatchMap.get(event.media.getId()) == null) { AppLog.w(T.POSTS, "Media event not recognized: " + event.media); return; } if (event.isError()) { SiteModel site = mSiteStore.getSiteByLocalId(mCurrentUploadingPost.getLocalSiteId()); String message = TextUtils.isEmpty(event.error.message) ? event.error.type.toString() : event.error.message; mPostUploadNotifier.updateNotificationError(mCurrentUploadingPost, site, message, true); mFirstPublishPosts.remove(mCurrentUploadingPost.getId()); finishUpload(); return; } if (event.canceled) { return; } if (event.completed) { AppLog.i(T.POSTS, "Media upload completed for post. Media id: " + event.media.getId() + ", post id: " + mCurrentUploadingPost.getId()); mMediaLatchMap.get(event.media.getId()).countDown(); mMediaLatchMap.remove(event.media.getId()); } else { mPostUploadNotifier.updateNotificationProgress(mCurrentUploadingPost, event.progress); } }
Source:
public boolean handleExisting(WriteMode writeMode, long lastModForSource, Configuration entries) { if (view == null) { try { view = Datasets.load(uri); } catch (DatasetNotFoundException e) { LOG.info("Writing to new dataset/view: " + uri); return true; } } boolean ready = false; try { ready = view.isReady(); } catch (UnsupportedOperationException ex) { } boolean exists = !view.isEmpty() || ready; if (exists) { switch (writeMode) { case DEFAULT: LOG.error("Dataset/view " + view + " already exists!"); throw new CrunchRuntimeException("Dataset/view already exists: " + view); case OVERWRITE: LOG.info("Deleting all data from: " + view); delete(view); break; case APPEND: LOG.info("Writing to existing dataset/view: " + view); break; case CHECKPOINT: long lastModForTarget = -1; if (view instanceof LastModifiedAccessor) { lastModForTarget = ((LastModifiedAccessor) view).getLastModified(); } if (ready && (lastModForTarget > lastModForSource)) { LOG.info("Re-starting pipeline from checkpoint dataset/view: " + view); break; } else { if (!ready) { LOG.info("Checkpoint is not ready. Deleting data from existing " + "checkpoint dataset/view: " + view); } else { LOG.info("Source data has recent updates. Deleting data from existing " + "checkpoint dataset/view: " + view); } delete(view); return false; } default: throw new CrunchRuntimeException("Unknown WriteMode: " + writeMode); } } else { LOG.info("Writing to empty dataset/view: " + view); } return exists; }

Target:
public boolean handleExisting(WriteMode writeMode, long lastModForSource, Configuration entries) { if (view == null) { try { view = Datasets.load(uri); } catch (DatasetNotFoundException e) { LOG.info("Writing to new dataset/view: " + uri); return true; } } boolean ready = false; if (view instanceof Signalable) { ready = ((Signalable)view).isReady(); } boolean exists = ready || !view.isEmpty(); if (exists) { switch (writeMode) { case DEFAULT: LOG.error("Dataset/view " + view + " already exists!"); throw new CrunchRuntimeException("Dataset/view already exists: " + view); case OVERWRITE: LOG.info("Deleting all data from: " + view); delete(view); break; case APPEND: LOG.info("Writing to existing dataset/view: " + view); break; case CHECKPOINT: long lastModForTarget = -1; if (view instanceof LastModifiedAccessor) { lastModForTarget = ((LastModifiedAccessor) view).getLastModified(); } if (ready && (lastModForTarget > lastModForSource)) { LOG.info("Re-starting pipeline from checkpoint dataset/view: " + view); break; } else { if (!ready) { LOG.info("Checkpoint is not ready. Deleting data from existing " + "checkpoint dataset/view: " + view); } else { LOG.info("Source data has recent updates. Deleting data from existing " + "checkpoint dataset/view: " + view); } delete(view); return false; } default: throw new CrunchRuntimeException("Unknown WriteMode: " + writeMode); } } else { LOG.info("Writing to empty dataset/view: " + view); } return exists; }
Source:
public boolean isValid(String vatIdentificationNumber) { return vatIdentificationNumber.matches("^[0-9]{9}$"); }

Target:
public boolean isValid(String vatIdentificationNumber) { return vatIdentificationNumber.matches(VALID_NUMBER_PATTERN); }
Source:
public int getPositiveAmount(final MagicSource source, final MagicPlayer player) { if (this == MagicAmountFactory.NegXCost) { return Math.min(getAmount(source, player), 0); } else { return Math.max(getAmount(source, player), 0); } }

Target:
public int getPositiveAmount(final MagicSource source, final MagicPlayer player) { return Math.max(getAmount(source, player), 0); }
Source:
Project(String name, String path, String groups) { this.name = name; this.path = path; this.groups = new HashSet<String>(); if (groups != null && groups.length() > 0) { this.groups.addAll(Arrays.asList(groups.split(","))); } }

Target:
Project(String name, String path, String groups) { this.name = name; this.path = path; this.groups = new HashSet<String>(); if (groups != null && groups.length() > 0) this.groups.addAll(Arrays.asList(groups.split(","))); }
Source:
protected void startServerImpl() { SelendroidLogger.info("*** ServerInstrumentation#startSeverImpl() ***"); if (server != null) { server.stop(); } try { if (server == null) { server = new AndroidServer(this, serverPort); } DefaultServerInstrumentation.startAndroidServer( server, wakeLock); } catch (Exception e) { SelendroidLogger.error("Error starting httpd.", e); throw new SelendroidException("Httpd failed to start!"); } }

Target:
protected void startServerImpl() { SelendroidLogger.info("*** ServerInstrumentation#startServerImpl() ***"); if (server != null) { server.stop(); } try { if (server == null) { server = new AndroidServer(this, serverPort); } DefaultServerInstrumentation.startAndroidServer( server, wakeLock); } catch (Exception e) { SelendroidLogger.error("Error starting httpd.", e); throw new SelendroidException("Httpd failed to start!"); } }
Source:
public ValidationResult validateDeletion(Lab object) { ValidationResult result = new ValidationResult(); long usage = labDao.getUsage(object); if (usage > 0L) { result.addError(new ValidationError(usage + " sample" + (usage > 1L ? "s are" : " is") + " associated with this lab")); } return result; }

Target:
public ValidationResult validateDeletion(Lab object) { ValidationResult result = new ValidationResult(); long usage = labDao.getUsage(object); if (usage > 0L) { result.addError(new ValidationError(usage + " sample" + (usage > 1L ? "s are" : " is") + " associated with lab '" + object.getAlias() + "'")); } return result; }
Source:
protected boolean undeployModuleAndWait(IModule[] module, IPath remote, int maxWait, IProgressMonitor monitor) throws CoreException { if( module.length > 1) return true; if( supportsJBoss7Markers() && Platform.getOS().equals(Platform.OS_WIN32) && getServer().getServerState() == IServer.STATE_STARTED && getFilesystemController() instanceof LocalFilesystemController ) { DeploymentMarkerUtils.removeDeployedMarker(remote, getFilesystemController()); long timeout = System.currentTimeMillis() + maxWait; boolean done = false; while( !done && System.currentTimeMillis() < timeout) { done = DeploymentMarkerUtils.markerExists(remote, getFilesystemController(), DeploymentMarkerUtils.UNDEPLOYED); if( !done ) { try { Thread.sleep(500); } catch(InterruptedException ie) } } return done; } return true; }

Target:
protected boolean undeployModuleAndWait(IModule[] module, IPath remote, int maxWait, IProgressMonitor monitor) throws CoreException { if( module.length > 1) return true; if( supportsJBoss7Markers() && Platform.getOS().equals(Platform.OS_WIN32) && getServer().getServerState() == IServer.STATE_STARTED && getFilesystemController() instanceof LocalFilesystemController ) { if( DeploymentMarkerUtils.markerExists(remote, getFilesystemController(), DeploymentMarkerUtils.DEPLOYED)) { DeploymentMarkerUtils.removeDeployedMarker(remote, getFilesystemController()); long timeout = System.currentTimeMillis() + maxWait; boolean done = false; while( !done && System.currentTimeMillis() < timeout) { done = DeploymentMarkerUtils.markerExists(remote, getFilesystemController(), DeploymentMarkerUtils.UNDEPLOYED); if( !done ) { try { Thread.sleep(500); } catch(InterruptedException ie) } } return done; } } return true; }
Source:
public Page<UserDevfilePermissionImpl> getByInstance( String instanceId, int maxItems, long skipCount) throws ServerException { requireNonNull(instanceId, "User devfile identifier required"); checkArgument( skipCount <= Integer.MAX_VALUE, "The number of items to skip can't be greater than " + Integer.MAX_VALUE); try { final EntityManager entityManager = managerProvider.get(); final List<UserDevfilePermissionImpl> permissions = entityManager .createNamedQuery( "UserDevfilePermission.getByUserDevfileId", UserDevfilePermissionImpl.class) .setParameter("userDevfileId", instanceId) .setMaxResults(maxItems) .setFirstResult((int) skipCount) .getResultList() .stream() .map(UserDevfilePermissionImpl::new) .collect(toList()); final Long workersCount = entityManager .createNamedQuery("UserDevfilePermission.getCountByUserDevfileId", Long.class) .setParameter("userDevfileId", instanceId) .getSingleResult(); return new Page<>(permissions, skipCount, maxItems, workersCount); } catch (RuntimeException e) { throw new ServerException(e.getLocalizedMessage(), e); } }

Target:
public Page<UserDevfilePermissionImpl> getByInstance( String instanceId, int maxItems, long skipCount) throws ServerException { requireNonNull(instanceId, "User devfile identifier required"); checkArgument( skipCount <= Integer.MAX_VALUE, "The number of items to skip can't be greater than " + Integer.MAX_VALUE); try { final EntityManager entityManager = managerProvider.get(); final List<UserDevfilePermissionImpl> permissions = entityManager .createNamedQuery( "UserDevfilePermission.getByUserDevfileId", UserDevfilePermissionImpl.class) .setParameter("userDevfileId", instanceId) .setMaxResults(maxItems) .setFirstResult((int) skipCount) .getResultList() .stream() .map(UserDevfilePermissionImpl::new) .collect(toList()); final Long permissionsCount = entityManager .createNamedQuery("UserDevfilePermission.getCountByUserDevfileId", Long.class) .setParameter("userDevfileId", instanceId) .getSingleResult(); return new Page<>(permissions, skipCount, maxItems, permissionsCount); } catch (RuntimeException e) { throw new ServerException(e.getLocalizedMessage(), e); } }
Source:
private double[] getFirstDimensionArray(final double[][][] array, final int dim2Index, final int dim3Index) { final double[] result = new double[array.length]; for (int i = 0; i < result.length; i++) { result[i] = array[i][dim2Index][dim3Index]; } return result; }

Target:
private double[] getFirstDimensionArray(final double[][][] array, final int dim2Index, final int dim3Index) { return Arrays.stream(array).mapToDouble(array2D -> array2D[dim2Index][dim3Index]).toArray(); }
Source:
public boolean sendCommand(Command command) throws Exception { long deviceId = command.getDeviceId(); if (command.getId() != 0) { Command savedCommand = getById(command.getId()); command.setTextChannel(savedCommand.getTextChannel()); command.setType(savedCommand.getType()); command.setAttributes(savedCommand.getAttributes()); command.setDescription(savedCommand.getDescription()); } boolean sent = true; if (command.getTextChannel()) { Position lastPosition = Context.getIdentityManager().getLastPosition(deviceId); String phone = Context.getIdentityManager().getById(deviceId).getPhone(); if (lastPosition != null) { BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol()); protocol.sendTextCommand(phone, command); } else if (command.getType().equals(Command.TYPE_CUSTOM)) { if (Context.getSmppManager() != null) { Context.getSmppManager().sendMessageSync(phone, command.getString(Command.KEY_DATA), true); } else { throw new RuntimeException("SMPP client is not enabled"); } } else { throw new RuntimeException("Command " + command.getType() + " is not supported"); } } else { ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(deviceId); if (activeDevice != null) { activeDevice.sendCommand(command); } else { sent = !getDeviceQueue(deviceId).add(command); } } return sent; }

Target:
public boolean sendCommand(Command command) throws Exception { long deviceId = command.getDeviceId(); if (command.getId() != 0) { command = getById(command.getId()).clone(); command.setDeviceId(deviceId); } if (command.getTextChannel()) { Position lastPosition = Context.getIdentityManager().getLastPosition(deviceId); String phone = Context.getIdentityManager().getById(deviceId).getPhone(); if (lastPosition != null) { BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol()); protocol.sendTextCommand(phone, command); } else if (command.getType().equals(Command.TYPE_CUSTOM)) { if (Context.getSmppManager() != null) { Context.getSmppManager().sendMessageSync(phone, command.getString(Command.KEY_DATA), true); } else { throw new RuntimeException("SMPP client is not enabled"); } } else { throw new RuntimeException("Command " + command.getType() + " is not supported"); } } else { ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(deviceId); if (activeDevice != null) { activeDevice.sendCommand(command); } else { getDeviceQueue(deviceId).add(command); return false; } } return true; }
Source:
public static Instant ofEpochSecond(long epochSecond) { return new Instant(epochSecond * 1000); }

Target:
public static Instant ofEpochSecond(long epochSecond) { return new Instant(FieldUtils.safeMultiply(epochSecond, 1000)); }
Source:
public void testDescribeImagesWithFilter() { String region = getFirst(ec2Api.getConfiguredRegions(), null); if (region != null) { Set<? extends Image> allResults = client.describeImagesInRegion(region); assertNotNull(allResults); assert allResults.size() >= 2 : allResults.size(); Iterator<? extends Image> iterator = allResults.iterator(); String id1 = iterator.next().getId(); Set<? extends Image> filterResult = client.describeImagesInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("image-id", id1) .build()); assertNotNull(filterResult); assertEquals(filterResult.size(), 1); iterator = filterResult.iterator(); assertEquals(iterator.next().getId(), id1); } }

Target:
public void testDescribeImagesWithFilter() { String region = getFirst(ec2Api.getConfiguredRegions(), null); assertNotNull(region, "region should not be null"); Set<? extends Image> allResults = client.describeImagesInRegion(region); assertNotNull(allResults); assertTrue(allResults.size() >= 2); String id1 = allResults.iterator().next().getId(); Set<? extends Image> filterResult = client.describeImagesInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("image-id", id1) .build()); assertNotNull(filterResult); assertEquals(filterResult.size(), 1); assertEquals(filterResult.iterator().next().getId(), id1); }
Source:
public RestBinding[] getBindings() { List<RestBinding> descriptors = getDescriptors(XP_BINDINGS); return descriptors.toArray(new RestBinding[descriptors.size()]); }

Target:
public RestBinding[] getBindings() { List<RestBinding> descriptors = getDescriptors(XP_BINDINGS); return descriptors.toArray(new RestBinding[0]); }
Source:
protected void updateAllInBatch(String procedureName, Collection<T> paramValues, MapSqlParameterMapper<T> mapper) { List<T> sortedParamValues = new ArrayList<>(paramValues); Collections.sort(sortedParamValues, new Comparator<T>() { @Override public int compare(T o1, T o2) { if (o1 instanceof Comparable) { return ((Comparable)o1).compareTo(o2); } else if (o1.getId() instanceof Comparable) { return ((Comparable)o1.getId()).compareTo(o2.getId()); } return ((Integer) o1.getId().hashCode()).compareTo(o2.getId().hashCode()); } }); getCallsHandler().executeStoredProcAsBatch(procedureName == null ? getProcedureNameForUpdate() : procedureName, paramValues, mapper); }

Target:
protected void updateAllInBatch(String procedureName, Collection<T> paramValues, MapSqlParameterMapper<T> mapper) { List<T> sortedParamValues = new ArrayList<>(paramValues); Collections.sort(sortedParamValues, new Comparator<T>() { @Override public int compare(T o1, T o2) { if (o1 == o2) return 0; if (o1 == null) return 1; if (o2 == null) return -1; if (o1 instanceof Comparable) { return ((Comparable)o1).compareTo(o2); } else if (o1.getId() instanceof Comparable) { if (o1.getId() == o2.getId()) return 0; if (o1.getId() == null) return 1; if (o2.getId() == null) return -1; return ((Comparable)o1.getId()).compareTo(o2.getId()); } return ((Integer) o1.getId().hashCode()).compareTo(o2.getId().hashCode()); } }); getCallsHandler().executeStoredProcAsBatch(procedureName == null ? getProcedureNameForUpdate() : procedureName, paramValues, mapper); }
Source:
public Map<String, IndexedSymlink> getSymlinks(String projectName) { if (mappedIndexedSymlinks == null) { throw new IllegalStateException("getSettings() not yet called"); } String k = projectName != null ? projectName : ""; Map<String, IndexedSymlink> indexSymlinks = mappedIndexedSymlinks.get(k); if (indexSymlinks != null) { return Collections.unmodifiableMap(indexSymlinks); } return null; }

Target:
public Map<String, IndexedSymlink> getSymlinks(String projectName) throws IOException { getSettings(projectName); String projectKey = projectName != null ? projectName : ""; Map<String, IndexedSymlink> indexSymlinks = mappedIndexedSymlinks.get(projectKey); if (indexSymlinks != null) { return Collections.unmodifiableMap(indexSymlinks); } return null; }
Source:
public void add(@NotNull(message = "labels can't be NULL") final Iterable<String> labels ) throws IOException { final Set<String> oldlabels = this.labelSet(); final Set<String> addedlabels = new HashSet<String>(); final Directives dirs = new Directives().xpath(this.xpath()); for (final String label : labels) { dirs.add("label").set(label).up(); if (!oldlabels.contains(label)) { addedlabels.add(label); } } this.storage.apply(dirs); if (!addedlabels.isEmpty()) { final MkIssueEvents events = new MkIssueEvents( this.storage, this.self, this.repo ); for (final String label : addedlabels) { events.create( Event.LABELED, this.ticket, this.self, Optional.of(label) ); } } }

Target:
public void add(@NotNull(message = "labels can't be NULL") final Iterable<String> labels ) throws IOException { final Collection<String> existing = this.labels(); final Set<String> added = new HashSet<String>(); final Directives dirs = new Directives().xpath(this.xpath()); for (final String label : labels) { dirs.add("label").set(label).up(); if (!existing.contains(label)) { added.add(label); } } this.storage.apply(dirs); if (!added.isEmpty()) { final MkIssueEvents events = new MkIssueEvents( this.storage, this.self, this.repo ); for (final String label : added) { events.create( Event.LABELED, this.ticket, this.self, Optional.of(label) ); } } }
Source:
private void displayAccounts() { List<SiteModel> sites = mSiteStore.getVisibleSites(); ListView listView = (ListView) findViewById(android.R.id.list); ImageView iv = new ImageView(this); iv.setBackgroundResource(R.drawable.list_divider); listView.addFooterView(iv); listView.setVerticalFadingEdgeEnabled(false); listView.setVerticalScrollBarEnabled(true); if (sites.size() > 0) { ScrollView sv = new ScrollView(this); sv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout layout = new LinearLayout(this); layout.setPadding(10, 10, 10, 0); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); layout.setOrientation(LinearLayout.VERTICAL); blogNames = new String[sites.size()]; siteIds = new int[sites.size()]; accountUsers = new String[sites.size()]; blavatars = new String[sites.size()]; for (int i = 0; i < sites.size(); i++) { SiteModel site = sites.get(i); blogNames[i] = SiteUtils.getSiteNameOrHomeURL(site); accountUsers[i] = site.getUsername(); siteIds[i] = site.getId(); blavatars[i] = SiteUtils.getSiteIconUrl(site, 60); accountNames.add(i, blogNames[i]); } setListAdapter(new HomeListAdapter()); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View row, int position, long id) { AddQuickPressShortcutActivity.this.buildDialog(position); } }); if (sites.size() == 1) { AddQuickPressShortcutActivity.this.buildDialog(0); } } else { ActivityLauncher.showSignInForResult(AddQuickPressShortcutActivity.this); } }

Target:
private void displayAccounts() { List<SiteModel> sites = mSiteStore.getVisibleSites(); ListView listView = (ListView) findViewById(android.R.id.list); View iv = new View(this); iv.setBackgroundResource(R.drawable.list_divider); listView.addFooterView(iv); listView.setVerticalFadingEdgeEnabled(false); listView.setVerticalScrollBarEnabled(true); if (sites.size() > 0) { ScrollView sv = new ScrollView(this); sv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout layout = new LinearLayout(this); layout.setPadding(10, 10, 10, 0); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); layout.setOrientation(LinearLayout.VERTICAL); blogNames = new String[sites.size()]; siteIds = new int[sites.size()]; accountUsers = new String[sites.size()]; blavatars = new String[sites.size()]; for (int i = 0; i < sites.size(); i++) { SiteModel site = sites.get(i); blogNames[i] = SiteUtils.getSiteNameOrHomeURL(site); accountUsers[i] = site.getUsername(); siteIds[i] = site.getId(); blavatars[i] = SiteUtils.getSiteIconUrl(site, 60); accountNames.add(i, blogNames[i]); } setListAdapter(new HomeListAdapter()); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View row, int position, long id) { AddQuickPressShortcutActivity.this.buildDialog(position); } }); if (sites.size() == 1) { AddQuickPressShortcutActivity.this.buildDialog(0); } } else { ActivityLauncher.showSignInForResult(AddQuickPressShortcutActivity.this); } }
Source:
public void initTopNAlgorithmSelector(TopNAlgorithmSelector selector) { if (dimensionSpec.getExtractionFn() != null) { selector.setHasDimExtractionFn(true); } topNMetricSpec.initTopNAlgorithmSelector(selector); }

Target:
public void initTopNAlgorithmSelector(TopNAlgorithmSelector selector) { if (dimensionSpec.getExtractionFn() != null) { selector.setHasExtractionFn(true); } topNMetricSpec.initTopNAlgorithmSelector(selector); }
Source:
public static void register(ScalarFunctionModule module) { module.register(NAME, new BaseFunctionResolver(FUNCTION_PARAMS) { @Override public FunctionImplementation getForTypes(List<DataType> signatureTypes) throws IllegalArgumentException { return new PgTypeofFunction(new FunctionInfo(new FunctionIdent(NAME, signatureTypes), DataTypes.STRING)); } }); }

Target:
public static void register(ScalarFunctionModule module) { module.register(FQNAME, new BaseFunctionResolver(FUNCTION_PARAMS) { @Override public FunctionImplementation getForTypes(List<DataType> signatureTypes) throws IllegalArgumentException { return new PgTypeofFunction(new FunctionInfo(new FunctionIdent(FQNAME, signatureTypes), DataTypes.STRING)); } }); }
Source:
public FatekDimmerItem(Item item, List<String> confItems) throws BindingConfigParseException { super(item, confItems); step = getParamsFromConfAsInt(confItems, "step", 5); if (confItems.size() != 1) { throw new BindingConfigParseException("Incorect binding for dimmer item"); } try { reg1 = Reg.parse(confItems.get(0)); } catch (UnknownRegNameException e) { throw new BindingConfigParseException(e.getMessage()); } if (reg1.isDiscrete()) { throw new BindingConfigParseException("Please use data reg for dimmer item"); } }

Target:
public FatekDimmerItem(Item item, List<String> confItems) throws BindingConfigParseException { super(item, confItems); step = getParamsFromConfAsInt(confItems, "step", 5); if (confItems.size() != 1) { throw new BindingConfigParseException("Incorrect binding for dimmer item"); } try { reg1 = Reg.parse(confItems.get(0)); } catch (UnknownRegNameException e) { throw new BindingConfigParseException(e.getMessage()); } if (reg1.isDiscrete()) { throw new BindingConfigParseException("Please use data reg for dimmer item"); } }
Source:
private void parseReportsXML() { RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, "/" + BaseContextPathData.getInstance().getRelativePath() + "services/reports-xml"); try { requestBuilder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { setXmlInitialized(); scheduleParseReportsXML(); } @Override public void onResponseReceived(Request request, Response response) { try { if (response.getStatusCode() == Response.SC_OK) { if (response.getText().trim().equals(REPORTS_WEBAPP_NOT_DEPLOYED_MSG)) { scheduleParseReportsXML(); } else if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } } } catch (DOMParseException e) { } finally { setXmlInitialized(); } } }); } catch (RequestException e) { setXmlInitialized(); } }

Target:
private void parseReportsXML() { RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, "/" + BaseContextPathData.getInstance().getRelativePath() + "services/reports-xml"); try { requestBuilder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { scheduleCheckStatus(); setXmlInitialized(); } @Override public void onResponseReceived(Request request, Response response) { try { switch (response.getStatusCode()) { case Response.SC_NOT_FOUND: scheduleCheckStatus(); break; case Response.SC_OK: if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } break; } } catch (DOMParseException e) { } finally { setXmlInitialized(); } } }); } catch (RequestException e) { setXmlInitialized(); } }
Source:
public void addProcess(final String processName, final String authKey, final List<String> command, final Map<String, String> env, final String workingDirectory, final boolean isPrivileged, final boolean respawn) { for (String s : command) { if (s == null) { throw ProcessLogger.ROOT_LOGGER.nullCommandComponent(); } } synchronized (lock) { if (shutdown) { return; } final Map<String, ManagedProcess> processes = this.processes; if (processes.containsKey(processName)) { ProcessLogger.ROOT_LOGGER.duplicateProcessName(processName); return; } final ManagedProcess process = new ManagedProcess(processName, command, env, workingDirectory, lock, this, authKey, isPrivileged, respawn); processes.put(processName, process); processesByKey.put(new Key(authKey.getBytes()), process); processAdded(processName); } }

Target:
public void addProcess(final String processName, final String authKey, final List<String> command, final Map<String, String> env, final String workingDirectory, final boolean isPrivileged, final boolean respawn) { for (String s : command) { if (s == null) { throw ProcessLogger.ROOT_LOGGER.nullCommandComponent(); } } synchronized (lock) { if (shutdown) { return; } final Map<String, ManagedProcess> processes = this.processes; if (processes.containsKey(processName)) { ProcessLogger.ROOT_LOGGER.duplicateProcessName(processName); return; } final ManagedProcess process = new ManagedProcess(processName, command, env, workingDirectory, lock, this, authKey, isPrivileged, respawn); processes.put(processName, process); processesByKey.put(new Key(authKey.getBytes(Charset.forName("US-ASCII"))), process); processAdded(processName); } }
Source:
private void registerShoutListeners() { listen(Message.LOADED, (sender, subject, args) -> { if (!subject.equals("sequences")) { return; } assert (args[0] instanceof Map<?, ?>); Map<String, Sequence> newSequences = (Map<String, Sequence>) args[0]; load(newSequences); }); listen(Message.FILTERED, (sender, subject, args) -> { assert args.length == 1; assert (args[0] instanceof Set<?>); updateVisible((Set<Sequence>) args[0]); }); listen(Message.RESET, (sender, subject, args) -> { Set<Sequence> visibleSet = new HashSet<>(sequences.values()); updateVisible(visibleSet); shout(Message.FILTERED, "", visibleSet); }); listen(Message.OPENED, (sender, subject, args) -> { if (!subject.equals("meta")) { return; } assert args[0] instanceof File; SequenceMetaParser parser = new SequenceMetaParser(); try { parser.parse((File) args[0]); addMetaData(parser); } catch (Exception exception) { Logging.exception(exception); AbstractNotification notification = new NotificationFactory() .getNotification(exception); shout(NotificationController.NOTIFY, "", notification); } }); }

Target:
private void registerShoutListeners() { listen(Message.LOADED, (sender, subject, args) -> { if (!subject.equals("sequences")) { return; } assert (args[0] instanceof Map<?, ?>); Map<String, Sequence> newSequences = (Map<String, Sequence>) args[0]; load(newSequences); }); listen(Message.FILTERED, (sender, subject, args) -> { assert args.length == 1; assert (args[0] instanceof Set<?>); updateVisible((Set<Sequence>) args[0]); }); listen(Message.RESET, (sender, subject, args) -> { Set<Sequence> visibleSet = new HashSet<>(sequences.values()); updateVisible(visibleSet); shout(Message.FILTERED, "", visibleSet); }); listen(Message.OPENED, (sender, subject, args) -> { if (!subject.equals("meta")) { return; } assert args[0] instanceof File; SequenceMetaParser parser = new SequenceMetaParser(); try { parser.parse((File) args[0]); addMetaData(parser.getColumns(), parser.getData()); } catch (Exception exception) { Logging.exception(exception); AbstractNotification notification = new NotificationFactory() .getNotification(exception); shout(NotificationController.NOTIFY, "", notification); } }); }
Source:
protected void interpolate(Properties properties, File baseDir) { MavenSession mavenSession = legacySupport.getSession(); if (mavenSession == null) { return; } MavenProject mavenProject = MavenSessionUtils.getMavenProject(mavenSession, baseDir); if (mavenProject == null) { return; } Interpolator interpolator = new Interpolator(mavenSession, mavenProject); for (Entry<Object, Object> entry : properties.entrySet()) { try { entry.setValue(interpolator.interpolate((String) entry.getValue())); } catch (InterpolationException e) { logger.warn("Cannot interpolate build.properties value: " + entry.getValue()); } } }

Target:
protected void interpolate(Properties properties, File baseDir) { MavenSession mavenSession = legacySupport.getSession(); if (mavenSession == null) { logger.warn("No maven session available, values in the build.properties will not be interpolated!"); return; } MavenProject mavenProject = MavenSessionUtils.getMavenProject(mavenSession, baseDir); if (mavenProject == null) { return; } Interpolator interpolator = new Interpolator(mavenSession, mavenProject); for (Entry<Object, Object> entry : properties.entrySet()) { try { entry.setValue(interpolator.interpolate((String) entry.getValue())); } catch (InterpolationException e) { logger.warn("Cannot interpolate build.properties value: " + entry.getValue()); } } }
Source:
void reset() { LOG.info("Reset HelixTaskExecutor"); if (_messageQueueMonitor != null) { _messageQueueMonitor.reset(); } for (String msgType : _hdlrFtyRegistry.keySet()) { ExecutorService pool = _executorMap.remove(msgType); _monitor.removeExecutorMonitor(msgType); if (pool != null) { LOG.info("Reset exectuor for msgType: " + msgType + ", pool: " + pool); shutdownAndAwaitTermination(pool); } MsgHandlerFactoryRegistryItem item = _hdlrFtyRegistry.get(msgType); if (item.factory() != null) { try { item.factory().reset(); } catch (Exception ex) { LOG.error("Failed to reset the factory of message type {}.", item.factory().toString(), msgType); } } } StringBuilder sb = new StringBuilder(); for (String taskId : _taskMap.keySet()) { MessageTaskInfo info = _taskMap.get(taskId); sb.append( "Task: " + taskId + " fails to terminate. Message: " + info._task.getMessage() + "\n"); } LOG.info(sb.toString()); _taskMap.clear(); _messageTaskMap.clear(); _knownMessageIds.clear(); _lastSessionSyncTime = null; }

Target:
void reset() { LOG.info("Reset HelixTaskExecutor"); if (_messageQueueMonitor != null) { _messageQueueMonitor.reset(); } for (String msgType : _hdlrFtyRegistry.keySet()) { ExecutorService pool = _executorMap.remove(msgType); _monitor.removeExecutorMonitor(msgType); if (pool != null) { LOG.info("Reset exectuor for msgType: " + msgType + ", pool: " + pool); shutdownAndAwaitTermination(pool); } MsgHandlerFactoryRegistryItem item = _hdlrFtyRegistry.get(msgType); if (item.factory() != null) { try { item.factory().reset(); } catch (Exception ex) { LOG.error("Failed to reset the factory of message type {}.", item.factory().toString(), msgType, ex); } } } StringBuilder sb = new StringBuilder(); for (String taskId : _taskMap.keySet()) { MessageTaskInfo info = _taskMap.get(taskId); sb.append( "Task: " + taskId + " fails to terminate. Message: " + info._task.getMessage() + "\n"); } LOG.info(sb.toString()); _taskMap.clear(); _messageTaskMap.clear(); _knownMessageIds.clear(); _lastSessionSyncTime = null; }
Source:
static final ReplicaMap<InetAddressAndPort> endpointMap(ReplicaList list) { return new ReplicaMap<>(list, Replica::endpoint); }

Target:
static ReplicaMap<InetAddressAndPort> endpointMap(ReplicaList list) { return new ReplicaMap<>(list, Replica::endpoint); }
Source:
public int hashCode() { int hash = 7; hash = 31 * hash + containers; hash = 31 * hash + Boolean.hashCode(debug); hash = 31 * hash + Objects.hashCode(dockerRootDir); hash = 31 * hash + Objects.hashCode(driver); hash = 31 * hash + Arrays.hashCode(driverStatus); hash = 31 * hash + Objects.hashCode(executionDriver); hash = 31 * hash + Objects.hashCode(httpProxy); hash = 31 * hash + Objects.hashCode(httpsProxy); hash = 31 * hash + Objects.hashCode(iD); hash = 31 * hash + Boolean.hashCode(iPv4Forwarding); hash = 31 * hash + images; hash = 31 * hash + Objects.hashCode(indexServerAddress); hash = 31 * hash + Objects.hashCode(initPath); hash = 31 * hash + Objects.hashCode(initSha1); hash = 31 * hash + Objects.hashCode(kernelVersion); hash = 31 * hash + Arrays.hashCode(labels); hash = 31 * hash + Long.hashCode(memTotal); hash = 31 * hash + Boolean.hashCode(memoryLimit); hash = 31 * hash + nCPU; hash = 31 * hash + nEventsListener; hash = 31 * hash + nFd; hash = 31 * hash + nGoroutines; hash = 31 * hash + Objects.hashCode(name); hash = 31 * hash + Objects.hashCode(noProxy); hash = 31 * hash + Objects.hashCode(operatingSystem); hash = 31 * hash + Boolean.hashCode(swapLimit); hash = 31 * hash + Objects.hashCode(systemTime); hash = 31 * hash + Arrays.hashCode(systemStatus); return hash; }

Target:
public int hashCode() { return Objects.hash(containers, debug, dockerRootDir, driver, driverStatus, executionDriver, httpProxy, httpsProxy, iD, iPv4Forwarding, images, indexServerAddress, initPath, initSha1, kernelVersion, labels, memTotal, memoryLimit, nCPU, nEventsListener, nFd, nGoroutines, name, noProxy, operatingSystem, swapLimit, systemTime, systemStatus); }
Source:
public Host getHostByName(String serverName) { Host host = null; if (hostMap.containsKey(serverName)) { return hostMap.get(serverName); } host = (Host) loadObject(Host.class, serverName); if (host == null) { host = CDI.current().select(Host.class, AppLifecycleListener.DefaultLiteral.INSTANCE).get(); host.setName(serverName); host.setId(serverName); host.initializeHost(); storeObject(host); } else { log.info("Host restored from file, name: {}", serverName); } hostMap.put(serverName, host); return host; }

Target:
public Host getHostByName(String serverName) { Host host = null; if (hostMap.containsKey(serverName)) { return hostMap.get(serverName); } host = (Host) loadObject(Host.class, serverName); if (host == null) { host = createHost(); host.setName(serverName); host.setId(serverName); host.initializeHost(); storeObject(host); } else { log.info("Host restored from file, name: {}", serverName); } hostMap.put(serverName, host); return host; }
Source:
public UserAuthorization findUserAuthorization(Long userId, Long roleId, String objectPath) { PersistenceManager pm = PersistenceFilter.getManager(); javax.jdo.Query query = pm.newQuery(UserAuthorization.class); Map<String, Object> paramMap = new HashMap<String, Object>(); ; StringBuilder filterString = new StringBuilder(); StringBuilder paramString = new StringBuilder(); appendNonNullParam("userId", filterString, paramString, "Long", userId, paramMap); appendNonNullParam("roleId", filterString, paramString, "Long", roleId, paramMap); appendNonNullParam("objectPath", filterString, paramString, "String", objectPath, paramMap); query.setFilter(filterString.toString()); query.declareParameters(paramString.toString()); List<UserAuthorization> authList = (List<UserAuthorization>) query.executeWithMap(paramMap); if (authList.isEmpty()) { return null; } else { return authList.get(0); } }

Target:
public UserAuthorization findUserAuthorization(Long userId, Long roleId, String objectPath) { PersistenceManager pm = PersistenceFilter.getManager(); javax.jdo.Query query = pm.newQuery(UserAuthorization.class); Map<String, Object> paramMap = new HashMap<String, Object>(); StringBuilder filterString = new StringBuilder(); StringBuilder paramString = new StringBuilder(); appendNonNullParam("userId", filterString, paramString, "Long", userId, paramMap); appendNonNullParam("roleId", filterString, paramString, "Long", roleId, paramMap); appendNonNullParam("objectPath", filterString, paramString, "String", objectPath, paramMap); query.setFilter(filterString.toString()); query.declareParameters(paramString.toString()); List<UserAuthorization> authList = (List<UserAuthorization>) query.executeWithMap(paramMap); if (authList.isEmpty()) { return null; } else { return authList.get(0); } }