auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String getLocal(final Server server, final User user, final long radius) { final Location loc = user.getLocation(); final World world = loc.getWorld(); final StringBuilder output = new StringBuilder(); final long radiusSquared = radius * radius; boolean showHidden = user.canInteractVanished(); Queue<User> nearbyPlayers = new PriorityQueue<>((o1, o2) -> (int) (o1.getLocation().distanceSquared(loc) - o2.getLocation().distanceSquared(loc))); for (User player : ess.getOnlineUsers()) { if (!player.equals(user) && !player.getBase().hasPermission("essentials.near.exclude") && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase()))) { final Location playerLoc = player.getLocation(); if (playerLoc.getWorld() != world) { continue; } final long delta = (long) playerLoc.distanceSquared(loc); if (delta < radiusSquared) { nearbyPlayers.offer(player); } } } while (!nearbyPlayers.isEmpty()) { if (output.length() > 0) { output.append(", "); } User nearbyPlayer = nearbyPlayers.poll(); output.append(nearbyPlayer.getDisplayName()).append("§f(§4").append((long) nearbyPlayer.getLocation().distance(loc)).append("m§f)"); } return output.length() > 1 ? output.toString() : tl("none"); }

Target:
private String getLocal(final Server server, final User user, final long radius) { final Location loc = user.getLocation(); final World world = loc.getWorld(); final StringBuilder output = new StringBuilder(); final long radiusSquared = radius * radius; boolean showHidden = user.canInteractVanished(); Queue<User> nearbyPlayers = new PriorityQueue<>((o1, o2) -> (int) (o1.getLocation().distanceSquared(loc) - o2.getLocation().distanceSquared(loc))); for (User player : ess.getOnlineUsers()) { if (!player.equals(user) && !player.isAuthorized("essentials.near.exclude") && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase()))) { final Location playerLoc = player.getLocation(); if (playerLoc.getWorld() != world) { continue; } final long delta = (long) playerLoc.distanceSquared(loc); if (delta < radiusSquared) { nearbyPlayers.offer(player); } } } while (!nearbyPlayers.isEmpty()) { if (output.length() > 0) { output.append(", "); } User nearbyPlayer = nearbyPlayers.poll(); output.append(nearbyPlayer.getDisplayName()).append("§f(§4").append((long) nearbyPlayer.getLocation().distance(loc)).append("m§f)"); } return output.length() > 1 ? output.toString() : tl("none"); }
Source:
public static LookupJoinMatcher create( LookupExtractor extractor, ColumnSelectorFactory leftSelectorFactory, JoinConditionAnalysis condition, boolean remainderNeeded ) { final List<Expr> keyExprs; if (condition.isAlwaysTrue()) { keyExprs = null; } else if (condition.isAlwaysFalse()) { keyExprs = null; } else if (condition.getNonEquiConditions().isEmpty() && condition.getEquiConditions() .stream() .allMatch(eq -> eq.getRightColumn().equals(LookupColumnSelectorFactory.KEY_COLUMN))) { keyExprs = condition.getEquiConditions().stream() .map(Equality::getLeftExpr) .collect(Collectors.toList()); } else { throw new IAE("Cannot join lookup with condition: %s", condition); } return new LookupJoinMatcher(extractor, leftSelectorFactory, condition, keyExprs, remainderNeeded); }

Target:
public static LookupJoinMatcher create( LookupExtractor extractor, ColumnSelectorFactory leftSelectorFactory, JoinConditionAnalysis condition, boolean remainderNeeded ) { final List<Expr> keyExprs; if (condition.isAlwaysTrue()) { keyExprs = null; } else if (condition.isAlwaysFalse()) { keyExprs = null; } else if (!condition.getNonEquiConditions().isEmpty()) { throw new IAE("Cannot join lookup with non-equi condition: %s", condition); } else if (!condition.getEquiConditions() .stream() .allMatch(eq -> eq.getRightColumn().equals(LookupColumnSelectorFactory.KEY_COLUMN))) { throw new IAE("Cannot join lookup with condition referring to non-key column: %s", condition); } else { keyExprs = condition.getEquiConditions().stream().map(Equality::getLeftExpr).collect(Collectors.toList()); } return new LookupJoinMatcher(extractor, leftSelectorFactory, condition, keyExprs, remainderNeeded); }
Source:
public boolean isExcluded(final InetAddress address, String location) { getReadLock().lock(); try { final List<ExcludeRange> excludeRanges = getConfiguration().getExcludeRanges(); getConfiguration().getDefinitions().forEach(def -> { setLocationFromDefinition(def); excludeRanges.addAll(def.getExcludeRanges()); }); if (!excludeRanges.isEmpty()) { final byte[] laddr = address.getAddress(); for (final ExcludeRange range : excludeRanges) { if(!isLocationMatched(range.getLocation(), location)) { continue; } if (InetAddressUtils.isInetAddressInRange(laddr, range.getBegin(), range.getEnd())) { return true; } } } return false; } finally { getReadLock().unlock(); } }

Target:
public boolean isExcluded(final InetAddress address, String location) { String defaultLocation = LocationUtils.DEFAULT_LOCATION_NAME; if (!m_excludeRanges.isEmpty()) { final byte[] laddr = address.getAddress(); for (final ExcludeRange range : m_excludeRanges) { if (!isLocationMatched(range.getLocation().orElse(defaultLocation), location)) { continue; } if (InetAddressUtils.isInetAddressInRange(laddr, range.getBegin(), range.getEnd())) { return true; } } } return false; }
Source:
private KafkaSystemAdmin createSystemAdmin(String system) { String kafkaConsumerPropertyPrefix = "systems." + system + ".consumer."; Map<String, String> map = new HashMap<>(); map.put(kafkaConsumerPropertyPrefix + BOOTSTRAP_SERVERS_CONFIG, brokerList()); map.put(JobConfig.JOB_NAME(), "test.job"); map.put(kafkaConsumerPropertyPrefix + KafkaConsumerConfig.ZOOKEEPER_CONNECT, zkConnect()); Config config = new MapConfig(map); HashMap<String, Object> consumerConfig = KafkaConsumerConfig.getKafkaSystemConsumerConfig(config, system, KafkaConsumerConfig.createClientId("kafka-admin-consumer", config)); return new KafkaSystemAdmin(system, new MapConfig(map), KafkaSystemConsumer.createKafkaConsumerImpl(system, consumerConfig)); }

Target:
private KafkaSystemAdmin createSystemAdmin(String system) { String kafkaConsumerPropertyPrefix = "systems." + system + ".consumer."; Map<String, String> map = new HashMap<>(); map.put(kafkaConsumerPropertyPrefix + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, brokerList()); map.put(JobConfig.JOB_NAME(), "test.job"); Config config = new MapConfig(map); HashMap<String, Object> consumerConfig = KafkaConsumerConfig.getKafkaSystemConsumerConfig(config, system, KafkaConsumerConfig.createClientId("kafka-admin-consumer", config)); return new KafkaSystemAdmin(system, new MapConfig(map), KafkaSystemConsumer.createKafkaConsumerImpl(system, consumerConfig)); }
Source:
private void parseLibraryClassLoader() { if (null == libraryDir) { return; } Path libraryPath = Paths.get(libraryDir); if( Files.notExists(libraryPath) || !Files.isDirectory(libraryPath) ) { return; } try { List<URI> jarUris = Files.list(libraryPath) .filter(file -> file.toString().endsWith(".jar")) .map(Path::toUri) .collect(Collectors.toList()); List<URL> jarUrls = new ArrayList<>(jarUris.size()); for (URI jarUri : jarUris) { try { jarUrls.add(jarUri.toURL()); } catch (MalformedURLException malformedURLException) { LOG.error("Unable to load the stack library {}", jarUri, malformedURLException); } } URL[] jarUrlArray = new URL[jarUris.size()]; libraryClassLoader = new URLClassLoader(jarUrls.toArray(jarUrlArray), ClassUtils.getDefaultClassLoader()); try { @SuppressWarnings("unchecked") Class<UpgradeCheck> clazz = (Class<UpgradeCheck>) libraryClassLoader.loadClass( "testbed.FooCheck"); UpgradeCheck check = clazz.newInstance(); check.perform(null); } catch (Exception exception) { exception.printStackTrace(); } } catch (IOException ioException) { LOG.error("Unable to load libraries from {}", libraryPath, ioException); } }

Target:
private void parseLibraryClassLoader() { if (null == libraryDir) { return; } Path libraryPath = Paths.get(libraryDir); if (Files.notExists(libraryPath) || !Files.isDirectory(libraryPath)) { return; } try { List<URI> jarUris = Files.list(libraryPath).filter( file -> file.toString().endsWith(".jar")).map(Path::toUri).collect(Collectors.toList()); List<URL> jarUrls = new ArrayList<>(jarUris.size()); for (URI jarUri : jarUris) { try { jarUrls.add(jarUri.toURL()); } catch (MalformedURLException malformedURLException) { LOG.error("Unable to load the stack library {}", jarUri, malformedURLException); } } URL[] jarUrlArray = new URL[jarUris.size()]; libraryClassLoader = new URLClassLoader(jarUrls.toArray(jarUrlArray), ClassUtils.getDefaultClassLoader()); } catch (IOException ioException) { LOG.error("Unable to load libraries from {}", libraryPath, ioException); } }
Source:
public void testConstantBoolean() { Assume.assumeFalse("Skip: Pig/Hadoop tests do not work on Windows", isWindows()); checkTranslation("g == false", inTree("NOT($6)")); }

Target:
public void testConstantBoolean() { checkTranslation("g == false", inTree("NOT($6)")); }
Source:
public static Sla getSLA(String clusterName, Process process) { Cluster cluster = getCluster(process, clusterName); return cluster != null ? getSLA(cluster, process) : null; }

Target:
public static Sla getSLA(String clusterName, Process process) throws FalconException{ Cluster cluster = getCluster(process, clusterName); if (cluster == null){ throw new FalconException("Invalid cluster: " + clusterName + " for process: " + process.getName()); } return getSLA(cluster, process); }
Source:
private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject, boolean isMetricsEnabled) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { final long timestamp = rt.getSequencerView() .query(getStreamID()); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); try { return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp && !o.isOptimisticallyModifiedUnsafe(), o -> o.syncObjectUnsafe(timestamp), o -> accessMethod.access(o)); } catch (TrimmedException te) { log.warn("accessInner: Encountered a trim exception while accessing version on attempt {}", timestamp, x); underlyingObject.update(o -> { o.resetUnsafe(); return null; }); } } throw new TrimmedException(String.format("Encounter TrimmedException %d times during Non-transactional " + "object access.", rt.getParameters().getTrimRetry())); }

Target:
private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject, boolean isMetricsEnabled) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { final long timestamp = rt.getSequencerView() .query(getStreamID()); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); try { return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp && !o.isOptimisticallyModifiedUnsafe(), o -> o.syncObjectUnsafe(timestamp), o -> accessMethod.access(o)); } catch (TrimmedException te) { log.warn("accessInner: Encountered a trim exception while accessing version on attempt {}", timestamp, x); } } throw new TrimmedException(String.format("Encounter TrimmedException %d times during Non-transactional " + "object access.", rt.getParameters().getTrimRetry())); }
Source:
public Void visitMethodInvocation(MethodInvocationTree tree, AnnotatedTypeMirror type) { if (returnsThis(tree)) { ExpressionTree receiverTree = TreeUtils.getReceiverTree(tree.getMethodSelect()); AnnotatedTypeMirror receiverType; AnnotationMirror receiverAnno; if (receiverTree != null && (receiverType = getAnnotatedType(receiverTree)) != null) { receiverAnno = receiverType.getAnnotationInHierarchy(TOP); } else { receiverAnno = TOP; } type.replaceAnnotation(receiverAnno); } return super.visitMethodInvocation(tree, type); }

Target:
public Void visitMethodInvocation(MethodInvocationTree tree, AnnotatedTypeMirror type) { if (returnsThis(tree)) { ExpressionTree receiverTree = TreeUtils.getReceiverTree(tree.getMethodSelect()); AnnotatedTypeMirror receiverType = receiverTree == null ? null : getAnnotatedType(receiverTree); AnnotationMirror receiverAnno = receiverType == null ? top : receiverType.getAnnotationInHierarchy(top); AnnotationMirror returnAnno = type.getAnnotationInHierarchy(top); type.replaceAnnotation(qualHierarchy.greatestLowerBound(returnAnno, receiverAnno)); } return super.visitMethodInvocation(tree, type); }
Source:
private SolrQuery addFieldQueryParameters(SolrQuery query) { query.set(DisMaxParams.PF, "name^40 nameSpell^70 synonym^15 synonymSpell^25 text^3 textSpell^5"); query.set(DisMaxParams.QF, "name^10 short_name^5 included_name^5 nameSpell^18 nameStub^5 " + "synonym^6 synonymSpell^10 synonymStub^3 text^1 textSpell^2 textStub^0.5"); return query; }

Target:
private SolrQuery addFieldQueryParameters(SolrQuery query) { query.set(DisMaxParams.PF, "name^40 nameSpell^70 synonym^15 synonymSpell^25 " + "included_name^15 included_nameSpell^25 text^3 textSpell^5"); query.set(DisMaxParams.QF, "id^40 name^10 nameSpell^18 nameStub^5 " + "short_name^18 short_nameStub^5 " + "synonym^6 synonymSpell^10 synonymStub^3 " + "included_name^6 included_nameSpell^10 included_nameStub^3 " + "text^1 textSpell^2 textStub^0.5"); return query; }
Source:
public String toString() { return MoreObjects.toStringHelper(this) .add("level", level) .add("loggers", loggers) .add("appenders", appenders) .add("loggerContext", loggerContext) .add("configurationErrorsStream", configurationErrorsStream) .toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("level", level) .add("loggers", loggers) .add("appenders", appenders) .toString(); }
Source:
public static void waitTillInstancesAreCreated(ColoHelper cluster, Entity entity, String startTime, String endTime, int totalMinutesToWait) throws URISyntaxException, AuthenticationException, InterruptedException, IOException { String entityName = entity.getName(); EntityType type = entity.getEntityType(); String params = "?start=" + startTime; params += (endTime.isEmpty() ? "" : "&end=" + endTime); for (int sleepCount = 0; sleepCount < totalMinutesToWait; sleepCount++) { InstancesResult statusResult = cluster.getProcessHelper().getProcessInstanceStatus(entityName, params); if (statusResult.getInstances() != null) { break; } LOGGER.info(type + " " + entityName + " still doesn't have instance created"); TimeUtil.sleepSeconds(5); } }

Target:
public static void waitTillInstancesAreCreated(ColoHelper cluster, Entity entity, String startTime, String endTime, int totalMinutesToWait) throws URISyntaxException, AuthenticationException, InterruptedException, IOException { String entityName = entity.getName(); EntityType type = entity.getEntityType(); String params = "?start=" + startTime; params += (endTime.isEmpty() ? "" : "&end=" + endTime); int totalSecondsToWait = totalMinutesToWait * 60; for (int sleepSeconds = 0; sleepSeconds < totalSecondsToWait; sleepSeconds = sleepSeconds+10) { InstancesResult statusResult = cluster.getProcessHelper().getProcessInstanceStatus(entityName, params); if (statusResult.getInstances() != null) { return; } LOGGER.info(type + " " + entityName + " still doesn't have instance created"); TimeUtil.sleepSeconds(10); } Assert.fail("Instances not created"); }
Source:
private List<CrewMember> getOtherPublisherPeople(Film film) { ImmutableList.Builder<CrewMember> builder = ImmutableList.builder(); for (CrewMember crewMember : film.getPeople()) { if (crewMember.publisher() != Publisher.RADIO_TIMES) { builder.add(crewMember); } } return builder.build(); }

Target:
private List<CrewMember> getOtherPublisherPeople(Film film) { return film.getPeople().stream() .filter(crewMember -> crewMember.publisher() != Publisher.RADIO_TIMES) .collect(MoreCollectors.toImmutableList()); }
Source:
public void testGetAndSetConfiguration() throws IOException, JAXBException { SpringClient client = new SpringClient().getTestInstanceLoggedInAsAdmin(); final String storageId = "storage2"; final String repositoryId1 = "repository0"; Storage storage2 = new Storage(storageId); Storage storage1 = new Storage("storage1"); client.addStorage(storage1); System.out.println("111111111111111"); ProxyConfiguration proxyConfiguration = createProxyConfiguration(); System.out.println("22222222222222222222222"); System.out.println(client.setProxyConfiguration(proxyConfiguration) + " ++++++++++++++++ "); client.getProxyConfiguration(storageId, repositoryId1); client.deleteStorage("storage1", true); Repository r1 = new Repository(repositoryId1); r1.setAllowsRedeployment(true); r1.setSecured(true); r1.setStorage(storage2); r1.setProxyConfiguration(createProxyConfiguration()); client.addRepository(r1); final Configuration configuration = client.getConfiguration(); Storage storage = new Storage("storage3"); configuration.addStorage(storage); final int response = client.setConfiguration(configuration); assertEquals("Failed to retrieve configuration!", 200, response); final Configuration c = client.getConfiguration(); Assert.assertNotNull("Failed to create storage3!", c.getStorage("storage3")); }

Target:
public void testGetAndSetConfiguration() throws IOException, JAXBException { Configuration configuration = getConfiguration(); Storage storage = new Storage("storage3"); configuration.addStorage(storage); String url = getContextBaseUrl() + "/configuration/strongbox/xml"; GenericParser<Configuration> parser2 = new GenericParser<>(Configuration.class); String serializedConfiguration = parser2.serialize(configuration); given().contentType(MediaType.TEXT_PLAIN_VALUE) .body(serializedConfiguration) .when() .put(url) .then() .statusCode(200); final Configuration c = getConfiguration(); assertNotNull("Failed to create storage3!", c.getStorage("storage3")); }
Source:
public WebSocketClientHandshaker00 setForceCloseTimeoutMillis(long forceCloseTimeoutMillis) { this.forceCloseTimeoutMillis = forceCloseTimeoutMillis; return this; }

Target:
public WebSocketClientHandshaker00 setForceCloseTimeoutMillis(long forceCloseTimeoutMillis) { super.setForceCloseTimeoutMillis(forceCloseTimeoutMillis); return this; }
Source:
private void setLogInfo(final TaskEventType type, final TaskEventSummary model) { String logInfoContent = constants.ByUser() + " " + model.getUserId() + " "; switch (type) { case ADDED: { if (model.getUserId() != null && !model.getUserId().isEmpty()) { logInfoContent = constants.ByProcess() + " '" + model.getUserId() + "' "; } else { logInfoContent = ""; } break; } case UPDATED: { logInfoContent += " (" + model.getMessage() + " ) "; break; } } logInfo.setTextContent(logInfoContent); }

Target:
private void setLogInfo(final TaskEventType type, final TaskEventSummary model) { String logInfoContent = constants.ByUser() + " " + model.getUserId(); switch (type) { case ADDED: { if (model.getUserId() != null && !model.getUserId().isEmpty()) { logInfoContent = constants.ByProcess() + " '" + model.getUserId() + "'"; } else { logInfoContent = ""; } break; } case UPDATED: { logInfoContent += " (" + model.getMessage() + ")"; break; } } logInfo.setTextContent(logInfoContent); }
Source:
private void traverseXObjectsOnUpdate(Map<DocumentReference, List<BaseObject>> oldXObjects, Map<DocumentReference, List<BaseObject>> xObjects, DocumentReference documentReference, DocumentReference authorReference, Syntax syntax) { for (Map.Entry<DocumentReference, List<BaseObject>> entry : xObjects.entrySet()) { List<BaseObject> oldEntry = oldXObjects.get(entry.getKey()); for (BaseObject baseObject : entry.getValue()) { if (baseObject != null) { handBaseObject(oldEntry, baseObject, documentReference, authorReference, syntax); } } } }

Target:
private void traverseXObjectsOnUpdate(Map<DocumentReference, List<BaseObject>> oldXObjects, Map<DocumentReference, List<BaseObject>> xObjects, DocumentReference documentReference, DocumentReference authorReference, Syntax syntax) { for (Map.Entry<DocumentReference, List<BaseObject>> entry : xObjects.entrySet()) { List<BaseObject> oldEntry = oldXObjects.get(entry.getKey()); for (BaseObject baseObject : entry.getValue()) { if (baseObject != null) { handleBaseObject(oldEntry, baseObject, documentReference, authorReference, syntax); } } } }
Source:
static void recursiveUnmanage(IContainer container, IProgressMonitor monitor) { try { monitor.beginTask(null, 10); monitor.subTask(NLS.bind(CVSMessages.EclipseFolder_0, new String[] {container.getFullPath().toString() })); EclipseSynchronizer.getInstance().deleteFolderSync(container); IResource[] members = container.members(true); for (IResource member : members) { monitor.worked(1); IResource resource = member; if (resource.getType() == IResource.FILE) { ResourceAttributes attrs = resource.getResourceAttributes(); if (attrs != null && attrs.isReadOnly()) { attrs.setReadOnly(false); resource.setResourceAttributes(attrs); } } else { recursiveUnmanage((IContainer) resource, monitor); } } } catch (CoreException e) { } finally { monitor.done(); } }

Target:
static void recursiveUnmanage(IContainer container, IProgressMonitor monitor) { try { monitor.beginTask(null, 10); monitor.subTask(NLS.bind(CVSMessages.EclipseFolder_0, new String[] {container.getFullPath().toString() })); EclipseSynchronizer.getInstance().deleteFolderSync(container); IResource[] members = container.members(true); for (IResource resource : members) { monitor.worked(1); if (resource.getType() == IResource.FILE) { ResourceAttributes attrs = resource.getResourceAttributes(); if (attrs != null && attrs.isReadOnly()) { attrs.setReadOnly(false); resource.setResourceAttributes(attrs); } } else { recursiveUnmanage((IContainer) resource, monitor); } } } catch (CoreException e) { } finally { monitor.done(); } }
Source:
public boolean isSubtypeOf(DeclType dt, TypeContext ctx, FailureReason reason) { if (!(dt instanceof DefDeclType)) { reason.setReason("declaration type of " + getName() + " didn't match"); return false; } DefDeclType ddt = (DefDeclType) dt; if (args.size() != ddt.args.size() || !ddt.getName().equals(getName())) { reason.setReason("number of arguments of " + getName() + " didn't match"); return false; } View adaptationView = null; for (int i = 0; i < args.size(); ++i) { FormalArg myArg = args.get(i); FormalArg theirArg = ddt.args.get(i); ValueType theirType = theirArg.getType(); if (adaptationView == null) { adaptationView = new ReceiverView(new Variable(theirArg.getName()), new Variable(myArg.getName())); } else { theirType = theirType.adapt(adaptationView); adaptationView = new ViewExtension(new Variable(theirArg.getName()), new Variable(myArg.getName()), adaptationView); } if (!theirType.isSubtypeOf(myArg.getType(), ctx, reason)) { return false; } ctx = ctx.extend(myArg.getSite(), myArg.getType()); } EffectSet rawEffectSet = getEffectSet(); EffectSet otherEffectSet = ddt.getEffectSet(); if (rawEffectSet != null && otherEffectSet == null) { return false; } ValueType rawResultType = getRawResultType(); ValueType otherRawResultType = ddt.getRawResultType(); if (adaptationView != null) { otherRawResultType = otherRawResultType.adapt(adaptationView); } if (rawEffectSet != null && otherEffectSet != null) { return rawEffectSet.equalsByName(otherEffectSet) && rawResultType.isSubtypeOf(otherRawResultType, ctx, reason); } return rawResultType.isSubtypeOf(otherRawResultType, ctx, reason); }

Target:
public boolean isSubtypeOf(DeclType dt, TypeContext ctx, FailureReason reason) { if (!(dt instanceof DefDeclType)) { reason.setReason("declaration type of " + getName() + " didn't match"); return false; } DefDeclType ddt = (DefDeclType) dt; if (args.size() != ddt.args.size() || !ddt.getName().equals(getName())) { reason.setReason("number of arguments of " + getName() + " didn't match"); return false; } View adaptationView = null; for (int i = 0; i < args.size(); ++i) { FormalArg myArg = args.get(i); FormalArg theirArg = ddt.args.get(i); ValueType theirType = theirArg.getType(); if (adaptationView == null) { adaptationView = new ReceiverView(new Variable(theirArg.getName()), new Variable(myArg.getName())); } else { theirType = theirType.adapt(adaptationView); adaptationView = new ViewExtension(new Variable(theirArg.getName()), new Variable(myArg.getName()), adaptationView); } if (!theirType.isSubtypeOf(myArg.getType(), ctx, reason)) { return false; } ctx = ctx.extend(myArg.getSite(), myArg.getType()); } EffectSet rawEffectSet = getEffectSet(); EffectSet otherEffectSet = ddt.getEffectSet(); if (rawEffectSet != null && otherEffectSet == null) { return false; } ValueType rawResultType = getRawResultType(); ValueType otherRawResultType = ddt.getRawResultType(); if (adaptationView != null) { otherRawResultType = otherRawResultType.adapt(adaptationView); } return rawResultType.isSubtypeOf(otherRawResultType, ctx, reason); }
Source:
public String getText(Object object) { String label = ((ViewValidationRule) object).getName(); return label == null || label.length() == 0 ? getString("_UI_ViewValidationRule_type") : getString("_UI_ViewValidationRule_type") + " " + label; }

Target:
public String getText(Object object) { IdentifiedElementQuery query = new IdentifiedElementQuery((SemanticValidationRule) object); String label = query.getLabel(); return label == null || label.length() == 0 ? getString("_UI_ViewValidationRule_type") : getString("_UI_ViewValidationRule_type") + " " + label; }
Source:
private String getValidationKey(final VAbstractCategorization categorization) { switch (categorization.getDiagnostic().getHighestSeverity()) { case 1: return VALIDATION_ERRORS + "_info"; case 2: return VALIDATION_ERRORS + "_warning"; case 4: return VALIDATION_ERRORS + "_error"; case 8: return VALIDATION_ERRORS + "_cancel"; default: return VALIDATION_ERRORS; } }

Target:
private String getValidationKey(final VAbstractCategorization categorization) { switch (categorization.getDiagnostic().getHighestSeverity()) { case Diagnostic.INFO: return VALIDATION_ERRORS + "_info"; case Diagnostic.WARNING: return VALIDATION_ERRORS + "_warning"; case Diagnostic.ERROR: return VALIDATION_ERRORS + "_error"; case Diagnostic.CANCEL: return VALIDATION_ERRORS + "_cancel"; default: return VALIDATION_ERRORS; } }
Source:
public void testServiceUnregistration() throws Exception { MemoryDirectoryDescriptor descr = new MemoryDirectoryDescriptor(); descr.name = "mydir"; descr.schemaName = SCHEMA_NAME; descr.idField = "i"; descr.passwordField = "pw"; descr.schemaSet = new HashSet<>(Arrays.asList("i")); deployBundle("org.nuxeo.ecm.core.cache"); deployBundle("org.nuxeo.ecm.directory"); applyInlineDeployments(); postSetUp(); DirectoryService service = Framework.getService(DirectoryService.class); service.registerDirectoryDescriptor(descr); Directory dir = service.getDirectory("mydir"); assertNotNull(dir); List<Directory> dirs = service.getDirectories(); assertEquals(1, dirs.size()); assertNotNull(dirs.get(0)); assertEquals(dir, dirs.get(0)); service.unregisterDirectoryDescriptor(descr); dir = service.getDirectory("mydir"); assertNull(dir); dirs = service.getDirectories(); assertEquals(0, dirs.size()); }

Target:
public void testServiceUnregistration() throws Exception { MemoryDirectoryDescriptor descr = new MemoryDirectoryDescriptor(); descr.name = "mydir"; descr.schemaName = SCHEMA_NAME; descr.idField = "i"; descr.passwordField = "pw"; descr.schemaSet = new HashSet<>(Arrays.asList("i")); deployBundle("org.nuxeo.ecm.core.cache"); deployBundle("org.nuxeo.ecm.directory"); applyInlineDeployments(); DirectoryService service = Framework.getService(DirectoryService.class); service.registerDirectoryDescriptor(descr); Directory dir = service.getDirectory("mydir"); assertNotNull(dir); List<Directory> dirs = service.getDirectories(); assertEquals(1, dirs.size()); assertNotNull(dirs.get(0)); assertEquals(dir, dirs.get(0)); service.unregisterDirectoryDescriptor(descr); dir = service.getDirectory("mydir"); assertNull(dir); dirs = service.getDirectories(); assertEquals(0, dirs.size()); }
Source:
public void deallocateFlow(String flowId) throws FlowNotFoundException, ProvisionerException { try { String netId = getNetworkSelector().findNetworkForFlowId(flowId); getNclController().deallocateFlow(netId, flowId); } catch (Exception e) { throw new ProvisionerException(e); } }

Target:
public void deallocateFlow(String flowId) throws FlowNotFoundException, ProvisionerException { try { String netId = getNetworkSelector().findNetworkForFlowId(flowId); getNclController().deallocateFlow(flowId, netId); } catch (Exception e) { throw new ProvisionerException(e); } }
Source:
private byte[] readElement(ByteBuffer buffer) { byte[] element = null; try { int length = UnsignedNumeric.readUnsignedInt(buffer); element = new byte[length]; buffer.get(element); } catch (Exception ex) { } return element; }

Target:
private byte[] readElement(ByteBuffer buffer) { if (buffer.remaining() == 0) return null; int length = UnsignedNumeric.readUnsignedInt(buffer); byte[] element = new byte[length]; buffer.get(element); return element; }
Source:
public static boolean isMethod(MethodInvocation node, String typeQualifiedName, String methodName, String... parameterTypesQualifiedNames) { if (node == null) { return false; } final IMethodBinding methodBinding = node.resolveMethodBinding(); return isMethod(methodBinding, typeQualifiedName, methodName, parameterTypesQualifiedNames); }

Target:
public static boolean isMethod(MethodInvocation node, String typeQualifiedName, String methodName, String... parameterTypesQualifiedNames) { return node != null && isMethod(node.resolveMethodBinding(), typeQualifiedName, methodName, parameterTypesQualifiedNames); }
Source:
public CompleteBuilder limit(final int limit) { if (limit <= 0) { throw new IllegalStateException("Limit should have a positive value"); } this.limit = String.valueOf(limit); return this; }

Target:
public CompleteBuilder limit(final int limit) { if (limit <= 0) { throw new IllegalStateException("Parameter `limit` should be positive, but was = " + limit); } this.limit = String.valueOf(limit); return this; }
Source:
private boolean hasReviewsIncoming(ITask task) { Set<String> reviewUrls = Collections.emptySet(); boolean anyIncomingReviews = false; for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl); String taskId = connector.getTaskIdFromTaskUrl(reviewUrl); String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); ITask reviewTask = taskList.getTask(repositoryUrl, taskId); anyIncomingReviews |= (reviewTask.getSynchronizationState() == SynchronizationState.INCOMING || reviewTask.getSynchronizationState() == SynchronizationState.INCOMING_NEW); } return anyIncomingReviews; }

Target:
private boolean hasReviewsIncoming(ITask task) { Set<String> reviewUrls = Collections.emptySet(); for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl); String taskId = connector.getTaskIdFromTaskUrl(reviewUrl); String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); ITask reviewTask = taskList.getTask(repositoryUrl, taskId); boolean anyIncomingReviews = (reviewTask.getSynchronizationState().isIncoming()); if (anyIncomingReviews) { return true; } } return false; }
Source:
private void updateAngularObjectRegistry(NotebookSocket conn, Note note) { for(Paragraph paragraph : note.getParagraphs()) { InterpreterGroup interpreterGroup = null; try { interpreterGroup = findInterpreterGroupForParagraph(note, paragraph.getId()); } catch (Exception e) { LOG.error(e.getMessage(), e); } if (null == interpreterGroup) { return; } RemoteAngularObjectRegistry registry = (RemoteAngularObjectRegistry) interpreterGroup.getAngularObjectRegistry(); List<AngularObject> angularObjects = note.getAngularObjects(interpreterGroup.getId()); for (AngularObject ao : angularObjects) { if (StringUtils.equals(ao.getNoteId(), note.getId()) && StringUtils.equals(ao.getParagraphId(), paragraph.getId())) { pushAngularObjectToRemoteRegistry(ao.getNoteId(), ao.getParagraphId(), ao.getName(), ao.get(), registry, interpreterGroup.getId(), conn); } } } }

Target:
private void updateAngularObjectRegistry(NotebookSocket conn, Note note) { for(Paragraph paragraph : note.getParagraphs()) { InterpreterGroup interpreterGroup = null; try { interpreterGroup = findInterpreterGroupForParagraph(note, paragraph.getId()); } catch (Exception e) { LOG.warn(e.getMessage(), e); } if (null == interpreterGroup) { return; } RemoteAngularObjectRegistry registry = (RemoteAngularObjectRegistry) interpreterGroup.getAngularObjectRegistry(); List<AngularObject> angularObjects = note.getAngularObjects(interpreterGroup.getId()); for (AngularObject ao : angularObjects) { if (StringUtils.equals(ao.getNoteId(), note.getId()) && StringUtils.equals(ao.getParagraphId(), paragraph.getId())) { pushAngularObjectToRemoteRegistry(ao.getNoteId(), ao.getParagraphId(), ao.getName(), ao.get(), registry, interpreterGroup.getId(), conn); } } } }
Source:
private Quota mockBasicQuota() { dbWasCalled = true; Quota quota = new Quota(); quota.setId(Guid.NewGuid()); quota.setStoragePoolId(new Guid("00000000-0000-0000-0000-000000001111")); quota.setDescription("My Quota description"); quota.setQuotaName("My Quota Name"); quota.setGraceStoragePercentage(20); quota.setGraceVdsGroupPercentage(20); quota.setThresholdStoragePercentage(80); quota.setThresholdVdsGroupPercentage(80); quota.setQuotaEnforcementType(QuotaEnforcementTypeEnum.HARD_ENFORCEMENT); return quota; }

Target:
private Quota mockBasicQuota() { dbWasCalled = true; Quota quota = new Quota(); quota.setId(Guid.NewGuid()); quota.setStoragePoolId(storage_pool.getId().getValue()); quota.setDescription("My Quota description"); quota.setQuotaName("My Quota Name"); quota.setGraceStoragePercentage(20); quota.setGraceVdsGroupPercentage(20); quota.setThresholdStoragePercentage(80); quota.setThresholdVdsGroupPercentage(80); quota.setQuotaEnforcementType(QuotaEnforcementTypeEnum.HARD_ENFORCEMENT); return quota; }
Source:
public List<RepoCollection> getCollectionVersions(String bucketName, String key) throws RepoException { List<RepoCollection> repoCollections = null; try { sqlService.getReadOnlyConnection(); if (StringUtil.isEmpty(bucketName)) { throw new RepoException(RepoException.Type.NoBucketEntered); } if (StringUtil.isEmpty(key)) { throw new RepoException(RepoException.Type.NoCollectionKeyEntered); } repoCollections = sqlService.listCollectionVersions(bucketName, key); } catch (SQLException e) { throw new RepoException(e); } finally { sqlReleaseConnection(); } return repoCollections; }

Target:
public List<RepoCollection> getCollectionVersions(String bucketName, String key) throws RepoException { try { sqlService.getReadOnlyConnection(); if (StringUtil.isEmpty(bucketName)) { throw new RepoException(RepoException.Type.NoBucketEntered); } if (StringUtil.isEmpty(key)) { throw new RepoException(RepoException.Type.NoCollectionKeyEntered); } List<RepoCollection> repoCollections = sqlService.listCollectionVersions(bucketName, key); return repoCollections; } catch (SQLException e) { throw new RepoException(e); } finally { sqlReleaseConnection(); } }
Source:
private Description checkMethodInvocation( MethodInvocationTree methodInvocation, LambdaExpressionTree root, VisitorState state) { Symbol.MethodSymbol methodSymbol = ASTHelpers.getSymbol(methodInvocation); if (methodSymbol == null || !methodInvocation.getTypeArguments().isEmpty()) { return Description.NO_MATCH; } ExpressionTree receiver = ASTHelpers.getReceiver(methodInvocation); boolean isLocal = isLocal(methodInvocation); if (!isLocal && !(receiver instanceof IdentifierTree)) { return Description.NO_MATCH; } if (methodInvocation.getArguments().isEmpty() && root.getParameters().size() == 1) { return convertVariableInstanceMethods(methodSymbol, methodInvocation, root, state); } if (methodInvocation.getArguments().size() == root.getParameters().size()) { return convertMethodInvocations(methodSymbol, methodInvocation, root, state); } return Description.NO_MATCH; }

Target:
private Description checkMethodInvocation( MethodInvocationTree methodInvocation, LambdaExpressionTree root, VisitorState state) { Symbol.MethodSymbol methodSymbol = ASTHelpers.getSymbol(methodInvocation); if (methodSymbol == null || !methodInvocation.getTypeArguments().isEmpty() || hasExplicitParameterTypes(root, state)) { return Description.NO_MATCH; } ExpressionTree receiver = ASTHelpers.getReceiver(methodInvocation); boolean isLocal = isLocal(methodInvocation); if (!isLocal && !(receiver instanceof IdentifierTree)) { return Description.NO_MATCH; } if (methodInvocation.getArguments().isEmpty() && root.getParameters().size() == 1) { return convertVariableInstanceMethods(methodSymbol, methodInvocation, root, state); } if (methodInvocation.getArguments().size() == root.getParameters().size()) { return convertMethodInvocations(methodSymbol, methodInvocation, root, state); } return Description.NO_MATCH; }
Source:
private long getMaxBytesPerRowForAggregators(IncrementalIndexSchema incrementalIndexSchema) { long maxAggregatorIntermediateSize = Integer.BYTES * incrementalIndexSchema.getMetrics().length; maxAggregatorIntermediateSize += Arrays.stream(incrementalIndexSchema.getMetrics()) .reduce( 0, (sum, aggregator) -> sum += aggregator.getMaxIntermediateSize(), (sum1, sum2) -> sum1 + sum2 ); return maxAggregatorIntermediateSize; }

Target:
private static long getMaxBytesPerRowForAggregators(IncrementalIndexSchema incrementalIndexSchema) { long maxAggregatorIntermediateSize = Integer.BYTES * incrementalIndexSchema.getMetrics().length; maxAggregatorIntermediateSize += Arrays.stream(incrementalIndexSchema.getMetrics()) .mapToLong(aggregator -> aggregator.getMaxIntermediateSize() + Long.BYTES * 2) .sum(); return maxAggregatorIntermediateSize; }
Source:
public void watchForData(String path) { if (!checkIfPathBelongsToZkRealm(path)) { throw new IllegalArgumentException( "The given path does not map to the ZK realm for this DedicatedZkClient! Path: " + path + " ZK realm sharding key: " + _zkRealmShardingKey); } _rawZkClient.watchForData(path); }

Target:
public void watchForData(String path) { checkIfPathContainsShardingKey(path); _rawZkClient.watchForData(path); }
Source:
protected Option[] configurePaxExam() { return options( logLevel(LogLevelOption.LogLevel.DEBUG), useOwnExamBundlesStartLevel(100), systemTimeout(GENERIC_TIMEOUT_MILLISECONDS), when(Boolean.getBoolean("keepRuntimeFolder")).useOptions(keepRuntimeFolder()), cleanCaches(true)); }

Target:
protected Option[] configurePaxExam() { return options( logLevel(LogLevelOption.LogLevel.WARN), useOwnExamBundlesStartLevel(100), systemTimeout(GENERIC_TIMEOUT_MILLISECONDS), when(Boolean.getBoolean("keepRuntimeFolder")).useOptions(keepRuntimeFolder()), cleanCaches(true)); }
Source:
public void process(AudioStream audioStream) throws UnsupportedAudioFormatException { logger.debug("Received audio stream of format {}", audioStream.getFormat()); if (audioStream instanceof URLAudioStream) { URLAudioStream urlAudioStream = (URLAudioStream) audioStream; sendEvent(urlAudioStream.getURL()); try { audioStream.close(); } catch (IOException e) { } } else { if (audioStream instanceof FixedLengthAudioStream) { String url = audioHTTPServer.serve((FixedLengthAudioStream) audioStream, 10).toString(); sendEvent(url); } else { logger.warn("Only FixedLengthAudioStream are supported for web audio sink"); } } }

Target:
public void process(AudioStream audioStream) throws UnsupportedAudioFormatException { logger.debug("Received audio stream of format {}", audioStream.getFormat()); if (audioStream instanceof URLAudioStream) { URLAudioStream urlAudioStream = (URLAudioStream) audioStream; sendEvent(urlAudioStream.getURL()); IOUtils.closeQuietly(audioStream); } else { if (audioStream instanceof FixedLengthAudioStream) { String url = audioHTTPServer.serve((FixedLengthAudioStream) audioStream, 10).toString(); sendEvent(url); } else { logger.warn("Only FixedLengthAudioStream are supported for the web audio sink."); IOUtils.closeQuietly(audioStream); } } }
Source:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) { out.println(MessageFormat.format( CLIText.get().noRemoteUriSubscribe, remote)); return; } String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null) { p = new Publisher(uriRoot); pubsubConfig.addPublisher(p); } Subscriber s = p.getSubscriber(remote, dir); if (s == null) p.addSubscriber(new Subscriber(p, remote, dir)); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { out.println(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); return; } out.println(MessageFormat.format( CLIText.get().didSubscribe, remote, uriRoot)); }

Target:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) throw die(MessageFormat.format( CLIText.get().noRemoteUriSubscribe, remote)); String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null) { p = new Publisher(uriRoot); pubsubConfig.addPublisher(p); } Subscriber s = p.getSubscriber(remote, dir); if (s == null) p.addSubscriber(new Subscriber(p, remote, dir)); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { throw die(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); } out.println(MessageFormat.format( CLIText.get().didSubscribe, remote, uriRoot)); }
Source:
public static boolean isNotEmpty(final Collection coll) { return coll != null && !coll.isEmpty(); }

Target:
public static boolean isNotEmpty(final Collection coll) { return !isEmpty(coll); }
Source:
public Person updatePerson(String configName, Person person) { try { Config config = configService.getConfigByName(configName); Person fetchedPerson = personResource.getPersonById(config, person.getUuid()); Person.Address addressForUpdate = fetchedPerson.getPreferredAddress(); if(addressForUpdate != null) { person.getPreferredAddress().setUuid(addressForUpdate.getUuid()); } personResource.updatePersonAddress(config, person.getUuid(), person.getPreferredAddress()); Person.Name nameForUpdate = fetchedPerson.getPreferredName(); person.getPreferredName().setUuid(nameForUpdate.getUuid()); personResource.updatePersonName(config, person.getUuid(), person.getPreferredName()); Person generalInformationForUpdate = prepareGeneralInformationForUpdate(person); Person updated = personResource.updatePerson(config, generalInformationForUpdate); eventRelay.sendEventMessage(new MotechEvent(EventKeys.UPDATED_PERSON_SUBJECT, EventHelper.personParameters(updated))); return updated; } catch (HttpClientErrorException e) { throw new OpenMRSException("Failed to update a person in OpenMRS with id: " + person.getUuid(), e); } }

Target:
public Person updatePerson(String configName, Person person) { Validate.notEmpty(person.getUuid(), "Person uuid cannot be null"); try { Config config = configService.getConfigByName(configName); Person fetchedPerson = personResource.getPersonById(config, person.getUuid()); Person.Address addressForUpdate = fetchedPerson.getPreferredAddress(); if(addressForUpdate != null) { person.getPreferredAddress().setUuid(addressForUpdate.getUuid()); } personResource.updatePersonAddress(config, person.getUuid(), person.getPreferredAddress()); Person.Name nameForUpdate = fetchedPerson.getPreferredName(); person.getPreferredName().setUuid(nameForUpdate.getUuid()); personResource.updatePersonName(config, person.getUuid(), person.getPreferredName()); Person updated = personResource.updatePerson(config, person); eventRelay.sendEventMessage(new MotechEvent(EventKeys.UPDATED_PERSON_SUBJECT, EventHelper.personParameters(updated))); return updated; } catch (HttpClientErrorException e) { throw new OpenMRSException("Failed to update a person in OpenMRS with id: " + person.getUuid(), e); } }
Source:
public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (scopeDescription instanceof AggregateScopeDescriptor) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); Aggregate<T> aggregate = load(aggregateIdentifier); if (aggregate != null) { aggregate.handle(message); } else { logger.debug("Aggregate (with id: " + aggregateIdentifier + ") cannot be loaded. Hence, message '" + message + "' cannot be handled."); } } }

Target:
public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (canResolve(scopeDescription)) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); load(aggregateIdentifier).handle(message); } }
Source:
void removeFromIndexes(TransactionContext transactionContext, Object key) { transactionContext = transactionContext == null ? makeTransactionalEventContext() : transactionContext; Stream<IndexedTypeIdentifier> typeIdentifiers = getKnownClasses().stream().map(PojoIndexedTypeIdentifier::new); Set<Work> deleteWorks = typeIdentifiers .flatMap(e -> searchWorkCreator.createPerEntityIdWorks(keyToString(key), e, WorkType.DELETE).stream()) .collect(Collectors.toSet()); performSearchWorks(deleteWorks, transactionContext); }

Target:
void removeFromIndexes(TransactionContext transactionContext, Object key) { transactionContext = transactionContext == null ? makeTransactionalEventContext() : transactionContext; Stream<IndexedTypeIdentifier> typeIdentifiers = getKnownClasses().stream().map(PojoIndexedTypeIdentifier::new); Set<Work> deleteWorks = typeIdentifiers .map(e -> searchWorkCreator.createEntityWork(keyToString(key), e, WorkType.DELETE)) .collect(Collectors.toSet()); performSearchWorks(deleteWorks, transactionContext); }
Source:
public void setIdleMinutesStr(String idleMinutes) { if ("".equals(idleMinutes)) { setIdleMinutes(Integer.MIN_VALUE); } else { setIdleMinutes(Integer.parseInt(idleMinutes)); } }

Target:
public void setIdleMinutesStr(String idleMinutes) { if (StringUtils.isBlank(idleMinutes)) { setIdleMinutes(0); } else { setIdleMinutes(Integer.parseInt(idleMinutes)); } }
Source:
public void setup() { CatalogProvider catProvider1 = mock(CatalogProvider.class); when(catProvider1.getId()).thenReturn("cat1"); source = mock(CatalogProvider.class); when(source.getId()).thenReturn("cat1"); subject = mock(Subject.class); properties.put(SecurityConstants.SECURITY_SUBJECT, subject); filterAdapter = new GeotoolsFilterAdapterImpl(); filterBuilder = new GeotoolsFilterBuilder(); testValidationWarningQueryDelegate = new ValidationQueryDelegate(Validation.VALIDATION_WARNINGS); testValidationErrorQueryDelegate = new ValidationQueryDelegate(Validation.VALIDATION_ERRORS); plugin = new ValidationFilterPlugin(filterAdapter, filterBuilder); List<String> attributeMapping = new ArrayList<>(); attributeMapping.add("invalid-state=datamanager,admin"); plugin.setAttributeMap(attributeMapping); }

Target:
public void setup() { source = mock(CatalogProvider.class); when(source.getId()).thenReturn("cat1"); subject = mock(Subject.class); properties.put(SecurityConstants.SECURITY_SUBJECT, subject); filterAdapter = new GeotoolsFilterAdapterImpl(); filterBuilder = new GeotoolsFilterBuilder(); testValidationWarningQueryDelegate = new ValidationQueryDelegate(Validation.VALIDATION_WARNINGS); testValidationErrorQueryDelegate = new ValidationQueryDelegate(Validation.VALIDATION_ERRORS); plugin = new ValidationFilterPlugin(filterBuilder); List<String> attributeMapping = new ArrayList<>(); attributeMapping.add("invalid-state=data-manager,system-admin"); plugin.setAttributeMap(attributeMapping); }