[jboss-jira] [JBoss JIRA] (WFCORE-3347) add-content operation of deployment resource contains alternative attributes that doesn't exist

Chao Wang (JIRA) issues at jboss.org
Thu Oct 19 06:10:00 EDT 2017


    [ https://issues.jboss.org/browse/WFCORE-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479190#comment-13479190 ] 

Chao Wang commented on WFCORE-3347:
-----------------------------------

There are {{setAlternatives()}} and {{addAlternatives()}}. I think we can add a new {{removeAlternatives (String... alternatives)}} in {{AbstractAttributeDefinitionBuilder}} which allows to remove varargs alternatives, and call {{SimpleAttributeDefinitionBuilder}} create with a basis to customize {{SimpleAttributeDefinition}} creation for such case. 

I also noticed there is [AbstractAttributeDefinitionBuilder.removeFlag|https://github.com/wildfly/wildfly-core/blob/1bfe3e1159076dd3d9b7d539df22b51eb64d6545/controller/src/main/java/org/jboss/as/controller/AbstractAttributeDefinitionBuilder.java#L413]

{code:java}
    public BUILDER removeFlag(final AttributeAccess.Flag flag) {
        if (!isFlagPresent(flag)) {
            return (BUILDER) this; //if not present no need to remove
        }
        final int length = flags.length;
        final AttributeAccess.Flag[] newFlags = new AttributeAccess.Flag[length - 1];
        int k = 0;
        for (AttributeAccess.Flag flag1 : flags) {
            if (flag1 != flag) {
                newFlags[k] = flag1;
                k++;
            }
        }
        if (k != length - 1) {
            flags = newFlags;
        }
        return (BUILDER) this;
    }
{code}

However it only sets newFlags back to flags when k != length - 1. The flag will not be removed due to that if condition. Shouldn't it be {{k == length - 1}} ?
Hi [~brian.stansberry] Do you have any knowledge about intention behind this condition? Is this a valid bug? 

> add-content operation of deployment resource contains alternative attributes that doesn't exist
> -----------------------------------------------------------------------------------------------
>
>                 Key: WFCORE-3347
>                 URL: https://issues.jboss.org/browse/WFCORE-3347
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: Domain Management
>            Reporter: Claudio Miranda
>            Assignee: Chao Wang
>            Priority: Minor
>
> add-content operation contains "content" attribute, 
> {code}
> /deployment=*:read-operation-description(name=add-content)
> {code}
> "content" attribute it is a list of other attributes as: input-stream-index, hash, bytes, url. They themselves contains the alternatives metadata as
> {code}
> "url" => {
>     "type" => STRING,
>     "description" => "The URL at which the deployment content is available for upload to the domain's or standalone server's deployment content repository.. Note that the URL must be accessible from the target of the operation (i.e. the Domain Controller or standalone server).",
>     "expressions-allowed" => false,
>     "required" => false,
>     "nillable" => true,
>     "alternatives" => [
>         "input-stream-index",
>         "hash",
>         "bytes",
>         "path",
>         "relative-to",
>         "empty"
>     ],
>     "min-length" => 1L,
>     "max-length" => 2147483647L
> },
> {code}
> But the following attributes doesn't exist: path, relative-to, empty 



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list