You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Matthew Broadhead <ma...@nbmlaw.co.uk> on 2017/10/03 11:15:04 UTC
DefaultAttribute NPE
i am reinvestigating some code that i previously had working and now i
get a NPE
AttributeType attributeType = new AttributeType("mail");
StringValue stringValue = new StringValue(attributeType, "test@test.com");
Attribute attribute = new DefaultAttribute(attributeType, stringValue);
on the third line i get a NullPointerException and stepping through the
code inside DefaultAttribute at line 1857 isHR =
attributeType.getSyntax().isHumanReadable(); attributeType.syntax is null.
Re: DefaultAttribute NPE
Posted by Matthew Broadhead <ma...@nbmlaw.co.uk>.
https://issues.apache.org/jira/projects/DIRAPI/issues/DIRAPI-302?filter=allopenissues
On 05/10/2017 18:41, Emmanuel Lécharny wrote:
> Le 05/10/2017 à 17:19, Matthew Broadhead a écrit :
>> thanks Emmanuel that worked fine. if the error was down to me
>> misusing the API then there is no need to fill a JIRA?
> I do think that providing a feedback other than a NPE is better. To me,
> it's a kind of a improvement we should bring to the API beside a better
> doc, of course). That deserves a JIRA, otherwise we will forget about it
> quickly...
>
>
Re: DefaultAttribute NPE
Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 05/10/2017 à 17:19, Matthew Broadhead a écrit :
> thanks Emmanuel that worked fine. if the error was down to me
> misusing the API then there is no need to fill a JIRA?
I do think that providing a feedback other than a NPE is better. To me,
it's a kind of a improvement we should bring to the API beside a better
doc, of course). That deserves a JIRA, otherwise we will forget about it
quickly...
--
Emmanuel Lecharny
Symas.com
directory.apache.org
Re: DefaultAttribute NPE
Posted by Matthew Broadhead <ma...@nbmlaw.co.uk>.
thanks Emmanuel that worked fine. if the error was down to me misusing
the API then there is no need to fill a JIRA?
On 03/10/2017 18:27, Emmanuel Lécharny wrote:
> Yes, this is not very user friendly.
>
>
> You should not define an AttributeType if you don't define teh
> associated syntax - and we should check that teh attributeType is valid
> in the DefaultAttribute constructor -.
>
>
> do something like :
>
>
> Attribute attribute = new DefaultAttribute( "mail", "test@test.com");
>
>
> That should work.
>
>
> Feel free to fill a JIRA for the NPE you are facing, we should fix it.
>
>
> Thanks !
>
>
>
> Le 03/10/2017 à 13:15, Matthew Broadhead a écrit :
>> i am reinvestigating some code that i previously had working and now i
>> get a NPE
>>
>> AttributeType attributeType = new AttributeType("mail");
>> StringValue stringValue = new StringValue(attributeType,
>> "test@test.com");
>> Attribute attribute = new DefaultAttribute(attributeType, stringValue);
>>
>> on the third line i get a NullPointerException and stepping through
>> the code inside DefaultAttribute at line 1857 isHR =
>> attributeType.getSyntax().isHumanReadable(); attributeType.syntax is
>> null.
Re: DefaultAttribute NPE
Posted by Emmanuel Lécharny <el...@gmail.com>.
Yes, this is not very user friendly.
You should not define an AttributeType if you don't define teh
associated syntax - and we should check that teh attributeType is valid
in the DefaultAttribute constructor -.
do something like :
Attribute attribute = new DefaultAttribute( "mail", "test@test.com");
That should work.
Feel free to fill a JIRA for the NPE you are facing, we should fix it.
Thanks !
Le 03/10/2017 à 13:15, Matthew Broadhead a écrit :
> i am reinvestigating some code that i previously had working and now i
> get a NPE
>
> AttributeType attributeType = new AttributeType("mail");
> StringValue stringValue = new StringValue(attributeType,
> "test@test.com");
> Attribute attribute = new DefaultAttribute(attributeType, stringValue);
>
> on the third line i get a NullPointerException and stepping through
> the code inside DefaultAttribute at line 1857 isHR =
> attributeType.getSyntax().isHumanReadable(); attributeType.syntax is
> null.
--
Emmanuel Lecharny
Symas.com
directory.apache.org