GenericValue and nulls

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

GenericValue and nulls

BJ Freeman
I know you can, through expressions, setup null_field parms.
I have a field as a string and do a GenericValue.getString("fieldname")
and it throws a null exception.
what I am looking for is to go through I iteration and check if the
field is empty(null).

is there something I missed?
Reply | Threaded
Open this post in threaded view
|

Re: GenericValue and nulls

Scott Gray-2
You'll have to provide more detail about the error, but GenericEntity.getXXX(...) doesn't really throw any sort of exceptions.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 29/06/2011, at 10:45 AM, BJ Freeman wrote:

> I know you can, through expressions, setup null_field parms.
> I have a field as a string and do a GenericValue.getString("fieldname")
> and it throws a null exception.
> what I am looking for is to go through I iteration and check if the
> field is empty(null).
>
> is there something I missed?


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GenericValue and nulls

BJ Freeman
I am calling a new routine from controller.java
So I am not down to the log4 level yet.

denylist = delegator.findList("VisitFllter", EntityCondition
        .makeCondition(exprs, EntityOperator.AND), null, null,
                                        null, Boolean.FALSE);

while (denylistitr.hasNext()&&status == Boolean.FALSE) {
  GenericValue denylistrcd = (GenericValue) denylistitr.next();
I am getting a
java.lang.NullPointerException on this line
String remoteHoststr =denylistrcd.getString("remoteHost");

it works find it the field is not null

Scott Gray sent the following on 6/28/2011 3:55 PM:

> You'll have to provide more detail about the error, but GenericEntity.getXXX(...) doesn't really throw any sort of exceptions.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 29/06/2011, at 10:45 AM, BJ Freeman wrote:
>
>> I know you can, through expressions, setup null_field parms.
>> I have a field as a string and do a GenericValue.getString("fieldname")
>> and it throws a null exception.
>> what I am looking for is to go through I iteration and check if the
>> field is empty(null).
>>
>> is there something I missed?
>
Reply | Threaded
Open this post in threaded view
|

Re: GenericValue and nulls

Scott Gray-2
The only reason I can see why you'd get an NPE on that line is if denylistrcd were null.  GenericValue won't throw an NPE on a call to getString().

Regards
Scott

On 29/06/2011, at 12:28 PM, BJ Freeman wrote:

> I am calling a new routine from controller.java
> So I am not down to the log4 level yet.
>
> denylist = delegator.findList("VisitFllter", EntityCondition
> .makeCondition(exprs, EntityOperator.AND), null, null,
> null, Boolean.FALSE);
>
> while (denylistitr.hasNext()&&status == Boolean.FALSE) {
>  GenericValue denylistrcd = (GenericValue) denylistitr.next();
> I am getting a
> java.lang.NullPointerException on this line
> String remoteHoststr =denylistrcd.getString("remoteHost");
>
> it works find it the field is not null
>
> Scott Gray sent the following on 6/28/2011 3:55 PM:
>> You'll have to provide more detail about the error, but GenericEntity.getXXX(...) doesn't really throw any sort of exceptions.
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 29/06/2011, at 10:45 AM, BJ Freeman wrote:
>>
>>> I know you can, through expressions, setup null_field parms.
>>> I have a field as a string and do a GenericValue.getString("fieldname")
>>> and it throws a null exception.
>>> what I am looking for is to go through I iteration and check if the
>>> field is empty(null).
>>>
>>> is there something I missed?
>>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GenericValue and nulls

BJ Freeman
each row has on field that is not null. did not think to
testsdenylistrcd for null. will give it a try.




Scott Gray sent the following on 6/28/2011 5:41 PM:

> The only reason I can see why you'd get an NPE on that line is if denylistrcd were null.  GenericValue won't throw an NPE on a call to getString().
>
> Regards
> Scott
>
> On 29/06/2011, at 12:28 PM, BJ Freeman wrote:
>
>> I am calling a new routine from controller.java
>> So I am not down to the log4 level yet.
>>
>> denylist = delegator.findList("VisitFllter", EntityCondition
>> .makeCondition(exprs, EntityOperator.AND), null, null,
>> null, Boolean.FALSE);
>>
>> while (denylistitr.hasNext()&&status == Boolean.FALSE) {
>>  GenericValue denylistrcd = (GenericValue) denylistitr.next();
>> I am getting a
>> java.lang.NullPointerException on this line
>> String remoteHoststr =denylistrcd.getString("remoteHost");
>>
>> it works find it the field is not null
>>
>> Scott Gray sent the following on 6/28/2011 3:55 PM:
>>> You'll have to provide more detail about the error, but GenericEntity.getXXX(...) doesn't really throw any sort of exceptions.
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 29/06/2011, at 10:45 AM, BJ Freeman wrote:
>>>
>>>> I know you can, through expressions, setup null_field parms.
>>>> I have a field as a string and do a GenericValue.getString("fieldname")
>>>> and it throws a null exception.
>>>> what I am looking for is to go through I iteration and check if the
>>>> field is empty(null).
>>>>
>>>> is there something I missed?
>>>
>
Reply | Threaded
Open this post in threaded view
|

Re: GenericValue and nulls

BJ Freeman
nope it is not null
here is part of the log as you can see it work till this record what
ever it is.
2011-06-28 18:01:42,978 (http-0.0.0.0-8443-1) [
VisitHandler.java:455:INFO ] VisitFllter checking
initialUserAgent=Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
2011-06-28 18:01:42,979 (http-0.0.0.0-8443-1) [
VisitHandler.java:467:INFO ] VisitFllter checking remoteAddr=0:0:0:0:0:0:0:1
2011-06-28 18:01:43,021 (http-0.0.0.0-8443-1)
[StandardWrapperValve.java:281:ERROR] Servlet.service() for servlet
ControlServlet threw exception
java.lang.NullPointerException
        at org.ofbiz.webapp.stats.VisitHandler.filterVisitor(VisitHandler.java:473)

will ponder some more
thanks for replies


BJ Freeman sent the following on 6/28/2011 5:52 PM:

> each row has on field that is not null. did not think to
> testsdenylistrcd for null. will give it a try.
>
>
>
>
> Scott Gray sent the following on 6/28/2011 5:41 PM:
>> The only reason I can see why you'd get an NPE on that line is if denylistrcd were null.  GenericValue won't throw an NPE on a call to getString().
>>
>> Regards
>> Scott
>>
>> On 29/06/2011, at 12:28 PM, BJ Freeman wrote:
>>
>>> I am calling a new routine from controller.java
>>> So I am not down to the log4 level yet.
>>>
>>> denylist = delegator.findList("VisitFllter", EntityCondition
>>> .makeCondition(exprs, EntityOperator.AND), null, null,
>>> null, Boolean.FALSE);
>>>
>>> while (denylistitr.hasNext()&&status == Boolean.FALSE) {
>>>  GenericValue denylistrcd = (GenericValue) denylistitr.next();
>>> I am getting a
>>> java.lang.NullPointerException on this line
>>> String remoteHoststr =denylistrcd.getString("remoteHost");
>>>
>>> it works find it the field is not null
>>>
>>> Scott Gray sent the following on 6/28/2011 3:55 PM:
>>>> You'll have to provide more detail about the error, but GenericEntity.getXXX(...) doesn't really throw any sort of exceptions.
>>>>
>>>> Regards
>>>> Scott
>>>>
>>>> HotWax Media
>>>> http://www.hotwaxmedia.com
>>>>
>>>> On 29/06/2011, at 10:45 AM, BJ Freeman wrote:
>>>>
>>>>> I know you can, through expressions, setup null_field parms.
>>>>> I have a field as a string and do a GenericValue.getString("fieldname")
>>>>> and it throws a null exception.
>>>>> what I am looking for is to go through I iteration and check if the
>>>>> field is empty(null).
>>>>>
>>>>> is there something I missed?
>>>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: GenericValue and nulls

BJ Freeman
this is more just my thinking out-loud However if something clicks
please chime in.
so the problem happens in an iterator.
1) I can run though this looking at one field and it goes all the way
through the list.
2) I add processing a second field and it goes through about 49 records
then has this error
a)looking at the original list creation by findlist, but not a real high
probability.
b)looking at the iterator and its storing of the list also not a high
probability.
c)looking at the String handling of the key of the record. is my guess.
possible memory allocated in processing the string.



BJ Freeman sent the following on 6/28/2011 6:05 PM:

> nope it is not null
> here is part of the log as you can see it work till this record what
> ever it is.
> 2011-06-28 18:01:42,978 (http-0.0.0.0-8443-1) [
> VisitHandler.java:455:INFO ] VisitFllter checking
> initialUserAgent=Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
> rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
> 2011-06-28 18:01:42,979 (http-0.0.0.0-8443-1) [
> VisitHandler.java:467:INFO ] VisitFllter checking remoteAddr=0:0:0:0:0:0:0:1
> 2011-06-28 18:01:43,021 (http-0.0.0.0-8443-1)
> [StandardWrapperValve.java:281:ERROR] Servlet.service() for servlet
> ControlServlet threw exception
> java.lang.NullPointerException
> at org.ofbiz.webapp.stats.VisitHandler.filterVisitor(VisitHandler.java:473)
>
> will ponder some more
> thanks for replies
>
>
> BJ Freeman sent the following on 6/28/2011 5:52 PM:
>> each row has on field that is not null. did not think to
>> testsdenylistrcd for null. will give it a try.
>>
>>
>>
>>
>> Scott Gray sent the following on 6/28/2011 5:41 PM:
>>> The only reason I can see why you'd get an NPE on that line is if denylistrcd were null.  GenericValue won't throw an NPE on a call to getString().
>>>
>>> Regards
>>> Scott
>>>
>>> On 29/06/2011, at 12:28 PM, BJ Freeman wrote:
>>>
>>>> I am calling a new routine from controller.java
>>>> So I am not down to the log4 level yet.
>>>>
>>>> denylist = delegator.findList("VisitFllter", EntityCondition
>>>> .makeCondition(exprs, EntityOperator.AND), null, null,
>>>> null, Boolean.FALSE);
>>>>
>>>> while (denylistitr.hasNext()&&status == Boolean.FALSE) {
>>>>  GenericValue denylistrcd = (GenericValue) denylistitr.next();
>>>> I am getting a
>>>> java.lang.NullPointerException on this line
>>>> String remoteHoststr =denylistrcd.getString("remoteHost");
>>>>
>>>> it works find it the field is not null
>>>>
>>>> Scott Gray sent the following on 6/28/2011 3:55 PM:
>>>>> You'll have to provide more detail about the error, but GenericEntity.getXXX(...) doesn't really throw any sort of exceptions.
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> HotWax Media
>>>>> http://www.hotwaxmedia.com
>>>>>
>>>>> On 29/06/2011, at 10:45 AM, BJ Freeman wrote:
>>>>>
>>>>>> I know you can, through expressions, setup null_field parms.
>>>>>> I have a field as a string and do a GenericValue.getString("fieldname")
>>>>>> and it throws a null exception.
>>>>>> what I am looking for is to go through I iteration and check if the
>>>>>> field is empty(null).
>>>>>>
>>>>>> is there something I missed?
>>>>>
>>>
>>
>