You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Alexander Berger (JIRA)" <ji...@apache.org> on 2012/10/18 08:06:02 UTC

[jira] [Created] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Alexander Berger created FELIX-3720:
---------------------------------------

             Summary: Designate's pid attribute is optional and not mandatory
                 Key: FELIX-3720
                 URL: https://issues.apache.org/jira/browse/FELIX-3720
             Project: Felix
          Issue Type: Bug
          Components: Metatype Service
    Affects Versions: metatype-1.0.4
            Reporter: Alexander Berger


In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:

       designate.setPid( this.getRequiredAttribute( "pid" ) );  
       designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );

This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:

        final String pid = this.getOptionalAttribute( "pid" );
        final String factoryPid = this.getOptionalAttribute( "factoryPid" );
        if ( pid == null && factoryPid == null ) {
        	missingAttribute("pid or factoryPid");
        }
        designate.setPid( pid );
        designate.setFactoryPid( factoryPid );

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13478943#comment-13478943 ] 

Alexander Berger commented on FELIX-3720:
-----------------------------------------

Yes you are right OCD/name is required. I must have been looking at the wrong line in the XSD :-)
                
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Berger updated FELIX-3720:
------------------------------------

    Attachment: metatype.diff
    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned FELIX-3720:
----------------------------------------

    Assignee: Felix Meschberger
    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-3720.
--------------------------------------

       Resolution: Fixed
    Fix Version/s:  metatype-1.0.6

Thanks for the updated patch. I have applied it slightly modified (formatting mostly) in Rev. 1399617.
                
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service, Specification compliance
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>             Fix For:  metatype-1.0.6
>
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Berger updated FELIX-3720:
------------------------------------

    Description: 
In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:

       designate.setPid( this.getRequiredAttribute( "pid" ) );  
       designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );

This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:

        final String pid = this.getOptionalAttribute( "pid" );
        final String factoryPid = this.getOptionalAttribute( "factoryPid" );
        if ( pid == null && factoryPid == null ) {
        	missingAttribute("pid or factoryPid");
        }
        designate.setPid( pid );
        designate.setFactoryPid( factoryPid );

Also the class MetaData should be fixed, its addDesignate member looks like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }

            designates.put( designate.getPid(), designate );
        }
    }

but should be implemented something like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }
            final String factoryPid = designate.getFactoryPid();
            if ( factoryPid == null ) {
            	designates.put( designate.getPid(), designate );	
            } else {
            	designates.put( factoryPid, designate );
            }            
        }
    }

  was:
In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:

       designate.setPid( this.getRequiredAttribute( "pid" ) );  
       designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );

This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:

        final String pid = this.getOptionalAttribute( "pid" );
        final String factoryPid = this.getOptionalAttribute( "factoryPid" );
        if ( pid == null && factoryPid == null ) {
        	missingAttribute("pid or factoryPid");
        }
        designate.setPid( pid );
        designate.setFactoryPid( factoryPid );

    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13478958#comment-13478958 ] 

Alexander Berger commented on FELIX-3720:
-----------------------------------------

Ok, that was a really fast fix and it passed all my tests. Thank you very much.

regards,
Alex
                
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service, Specification compliance
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>             Fix For:  metatype-1.0.6
>
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Comment Edited] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13478943#comment-13478943 ] 

Alexander Berger edited comment on FELIX-3720 at 10/18/12 12:21 PM:
--------------------------------------------------------------------

Yes you are right OCD/name is required. I must have been looking at the wrong line in the XSD :-)
I just updated the patch (diff) file
                
      was (Author: alexberger):
    Yes you are right OCD/name is required. I must have been looking at the wrong line in the XSD :-)
                  
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Berger closed FELIX-3720.
-----------------------------------

    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service, Specification compliance
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>             Fix For:  metatype-1.0.6
>
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Berger updated FELIX-3720:
------------------------------------

    Description: 
In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:

       designate.setPid( this.getRequiredAttribute( "pid" ) );  
       designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );

This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:

        final String pid = this.getOptionalAttribute( "pid" );
        final String factoryPid = this.getOptionalAttribute( "factoryPid" );
        if ( pid == null && factoryPid == null ) {
        	missingAttribute("pid or factoryPid");
        }
        designate.setPid( pid );
        designate.setFactoryPid( factoryPid );

Also the class MetaData should be fixed, its addDesignate member looks like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }

            designates.put( designate.getPid(), designate );
        }
    }

but should be implemented something like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }
            final String factoryPid = designate.getFactoryPid();
            if ( factoryPid == null ) {
            	designates.put( designate.getPid(), designate );	
            } else {
            	designates.put( factoryPid, designate );
            }            
        }
    }

Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).

And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:

                // gather pids and factory pids
                if (designate.getFactoryPid() != null) {
                    this.factoryPids.add( designate.getFactoryPid() );
                    this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
                } else {
                    this.pids.add(designate.getPid());
                    this.addMetaTypeProvider(designate.getPid(), dmtp);
                }

  was:
In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:

       designate.setPid( this.getRequiredAttribute( "pid" ) );  
       designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );

This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:

        final String pid = this.getOptionalAttribute( "pid" );
        final String factoryPid = this.getOptionalAttribute( "factoryPid" );
        if ( pid == null && factoryPid == null ) {
        	missingAttribute("pid or factoryPid");
        }
        designate.setPid( pid );
        designate.setFactoryPid( factoryPid );

Also the class MetaData should be fixed, its addDesignate member looks like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }

            designates.put( designate.getPid(), designate );
        }
    }

but should be implemented something like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }
            final String factoryPid = designate.getFactoryPid();
            if ( factoryPid == null ) {
            	designates.put( designate.getPid(), designate );	
            } else {
            	designates.put( factoryPid, designate );
            }            
        }
    }

Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD)

    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-3720:
-------------------------------------

    Component/s: Specification compliance
    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service, Specification compliance
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>             Fix For:  metatype-1.0.6
>
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Berger updated FELIX-3720:
------------------------------------

    Attachment:     (was: metatype.diff)
    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13478939#comment-13478939 ] 

Felix Meschberger commented on FELIX-3720:
------------------------------------------

Thanks for providing the patch. 

I agree with the optionality of the pid and factoryPid attributes and with the respective changes.

Yet, I do not agree with the OCD/name attribute being optional: According to the schema, this attribute is required. Why should it not be ?
                
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>            Assignee: Felix Meschberger
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Berger updated FELIX-3720:
------------------------------------

    Attachment: metatype.diff

A patch against trunk which should fix all the problems mentioned in this issue.
                
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>         Attachments: metatype.diff
>
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD).
> And last but not least MetaTypeInformationImpl's addMetaData member should be changed like this:
>                 // gather pids and factory pids
>                 if (designate.getFactoryPid() != null) {
>                     this.factoryPids.add( designate.getFactoryPid() );
>                     this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
>                 } else {
>                     this.pids.add(designate.getPid());
>                     this.addMetaTypeProvider(designate.getPid(), dmtp);
>                 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-3720) Designate's pid attribute is optional and not mandatory

Posted by "Alexander Berger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Berger updated FELIX-3720:
------------------------------------

    Description: 
In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:

       designate.setPid( this.getRequiredAttribute( "pid" ) );  
       designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );

This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:

        final String pid = this.getOptionalAttribute( "pid" );
        final String factoryPid = this.getOptionalAttribute( "factoryPid" );
        if ( pid == null && factoryPid == null ) {
        	missingAttribute("pid or factoryPid");
        }
        designate.setPid( pid );
        designate.setFactoryPid( factoryPid );

Also the class MetaData should be fixed, its addDesignate member looks like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }

            designates.put( designate.getPid(), designate );
        }
    }

but should be implemented something like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }
            final String factoryPid = designate.getFactoryPid();
            if ( factoryPid == null ) {
            	designates.put( designate.getPid(), designate );	
            } else {
            	designates.put( factoryPid, designate );
            }            
        }
    }

Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD)

  was:
In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:

       designate.setPid( this.getRequiredAttribute( "pid" ) );  
       designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );

This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:

        final String pid = this.getOptionalAttribute( "pid" );
        final String factoryPid = this.getOptionalAttribute( "factoryPid" );
        if ( pid == null && factoryPid == null ) {
        	missingAttribute("pid or factoryPid");
        }
        designate.setPid( pid );
        designate.setFactoryPid( factoryPid );

Also the class MetaData should be fixed, its addDesignate member looks like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }

            designates.put( designate.getPid(), designate );
        }
    }

but should be implemented something like this:

    public void addDesignate( Designate designate )
    {
        if ( designate != null )
        {
            if ( designates == null )
            {
                designates = new HashMap();
            }
            final String factoryPid = designate.getFactoryPid();
            if ( factoryPid == null ) {
            	designates.put( designate.getPid(), designate );	
            } else {
            	designates.put( factoryPid, designate );
            }            
        }
    }

    
> Designate's pid attribute is optional and not mandatory
> -------------------------------------------------------
>
>                 Key: FELIX-3720
>                 URL: https://issues.apache.org/jira/browse/FELIX-3720
>             Project: Felix
>          Issue Type: Bug
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.4
>            Reporter: Alexander Berger
>
> In class org.apache.felix.metatype.MetaDataReader method readDesignate the "pid" attribute of a "Designate" element is read as required attribute:
>        designate.setPid( this.getRequiredAttribute( "pid" ) );  
>        designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
> This is wrong as according to the Metatype Service Specification (Version 1.2) the attributes "pid" and "factoryPid" are both optional but at least one of these two must be present (either "pid" or "factoryPid"). Thus the code should be changed to something like this:
>         final String pid = this.getOptionalAttribute( "pid" );
>         final String factoryPid = this.getOptionalAttribute( "factoryPid" );
>         if ( pid == null && factoryPid == null ) {
>         	missingAttribute("pid or factoryPid");
>         }
>         designate.setPid( pid );
>         designate.setFactoryPid( factoryPid );
> Also the class MetaData should be fixed, its addDesignate member looks like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             designates.put( designate.getPid(), designate );
>         }
>     }
> but should be implemented something like this:
>     public void addDesignate( Designate designate )
>     {
>         if ( designate != null )
>         {
>             if ( designates == null )
>             {
>                 designates = new HashMap();
>             }
>             final String factoryPid = designate.getFactoryPid();
>             if ( factoryPid == null ) {
>             	designates.put( designate.getPid(), designate );	
>             } else {
>             	designates.put( factoryPid, designate );
>             }            
>         }
>     }
> Additionally the attribute OCD/name should also be treated to be optional (see MetaDataReader's member readOCD)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira