Bug 478243 - JDBCFilterBuilder throws NPE when filter condition contains wildcard character
JDBCFilterBuilder throws NPE when filter condition contains wildcard character
Status: NEW
Product: penrose
Classification: Retired
Component: Unknown (Show other bugs)
2.0
All Linux
medium Severity low
: ---
: ---
Assigned To: Endi Sukma Dewata
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-27 03:11 EST by Chandrasekar Kannan
Modified: 2015-01-04 19:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Chandrasekar Kannan 2008-12-27 03:11:33 EST
I have a join mapping where one of the sources is a relational table. When running an ldapsearch with a filter condition like (uid=udddd*) it thorws this exception (uid is mapped to the primary key in the table):

java.lang.NullPointerException
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:198)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:51)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:317)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:45)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:35)
        at org.safehaus.penrose.adapter.jdbc.JDBCStatementBuilder.generate(JDBCS
tatementBuilder.java:147)
        at org.safehaus.penrose.adapter.jdbc.JDBCStatementBuilder.generate(JDBCS
tatementBuilder.java:33)
        at org.safehaus.penrose.jdbc.JDBCClient.executeQuery(JDBCClient.java:379
)
        at org.safehaus.penrose.adapter.jdbc.JDBCAdapter.search(JDBCAdapter.java
:983)
        at org.safehaus.penrose.connection.Connection.search(Connection.java:285
)
        at org.safehaus.penrose.connector.Connector.search(Connector.java:271)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.searchSecondary
Sources(BasicSearchResponse.java:178)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.add(BasicSearch
Response.java:102)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.add(BasicSearch
Response.java:23)
        at org.safehaus.penrose.adapter.Adapter$1.add(Adapter.java:649)
        at org.safehaus.penrose.adapter.Adapter$1.add(Adapter.java:651)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter$1.add(LDAPAdapter.java:
497)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter$1.add(LDAPAdapter.java:
488)
        at org.safehaus.penrose.ldap.LDAPClient.search(LDAPClient.java:414)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter.search(LDAPAdapter.java
:503)
        at org.safehaus.penrose.adapter.Adapter.search(Adapter.java:656)
        at org.safehaus.penrose.connection.Connection.search(Connection.java:285
)
        at org.safehaus.penrose.connector.Connector.search(Connector.java:271)
        at org.safehaus.penrose.engine.basic.BasicEngine.search(BasicEngine.java
:814)
        at org.safehaus.penrose.handler.DefaultHandler.performSearch(DefaultHand
ler.java:319)
        at org.safehaus.penrose.handler.DefaultHandler.search(DefaultHandler.jav
a:160)
        at org.safehaus.penrose.handler.DefaultHandler.searchChildren(DefaultHan
dler.java:359)
        at org.safehaus.penrose.handler.DefaultHandler.search(DefaultHandler.jav
a:169)
        at org.safehaus.penrose.handler.Handler.search(Handler.java:278)
        at org.safehaus.penrose.handler.HandlerManager$1.run(HandlerManager.java
:535)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:675)
        at java.lang.Thread.run(Thread.java:595)

Is it working with 1.2.4????

Regards,
Robert
Additional Comments From koszegir dated Thu Nov 22 04:55:31 CST 2007 
To answer my question. In version 1.2.4 it throws a different exception (the filter condition was 'uid=<string>*', if there is no '*' in the condition te querry runs fine):

[11/22/2007 11:50:48] Unknown field: lsyusers.uid
java.lang.Exception: Unknown field: lsyusers.uid
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:109)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:60)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:227)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:54)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:44)
        at org.safehaus.penrose.adapter.jdbc.JDBCStatementBuilder.generate(JDBCS
tatementBuilder.java:154)
        at org.safehaus.penrose.adapter.jdbc.JDBCStatementBuilder.generate(JDBCS
tatementBuilder.java:33)
        at org.safehaus.penrose.jdbc.JDBCClient.executeQuery(JDBCClient.java:379
)
        at org.safehaus.penrose.adapter.jdbc.JDBCAdapter.search(JDBCAdapter.java
:950)
        at org.safehaus.penrose.connection.Connection.search(Connection.java:285
)
        at org.safehaus.penrose.connector.Connector.search(Connector.java:271)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.searchSecondary
Sources(BasicSearchResponse.java:178)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.add(BasicSearch
Response.java:102)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.add(BasicSearch
Response.java:23)
        at org.safehaus.penrose.adapter.Adapter$1.add(Adapter.java:649)
        at org.safehaus.penrose.adapter.Adapter$1.add(Adapter.java:651)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter$1.add(LDAPAdapter.java:
497)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter$1.add(LDAPAdapter.java:
488)
        at org.safehaus.penrose.ldap.LDAPClient.search(LDAPClient.java:414)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter.search(LDAPAdapter.java
:503)
        at org.safehaus.penrose.adapter.Adapter.search(Adapter.java:656)
        at org.safehaus.penrose.connection.Connection.search(Connection.java:285
)
        at org.safehaus.penrose.connector.Connector.search(Connector.java:271)
        at org.safehaus.penrose.engine.basic.BasicEngine.search(BasicEngine.java
:743)
        at org.safehaus.penrose.handler.DefaultHandler.performSearch(DefaultHand
ler.java:311)
        at org.safehaus.penrose.handler.DefaultHandler.search(DefaultHandler.jav
a:157)
        at org.safehaus.penrose.handler.DefaultHandler.searchChildren(DefaultHan
dler.java:351)
        at org.safehaus.penrose.handler.DefaultHandler.search(DefaultHandler.jav
a:166)
        at org.safehaus.penrose.handler.Handler.search(Handler.java:278)
        at org.safehaus.penrose.handler.HandlerManager$1.run(HandlerManager.java
:501)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:675)
        at java.lang.Thread.run(Thread.java:595)

Regards,
Robert

Additional Comments From koszegir dated Thu Nov 22 06:11:28 CST 2007 
I think I found the source of the problem, but I am not sure (for 1.2.5):

org.safehaus.penrose.adapter.jdbc.SearchFilterBuilder.convert(SubstringFilter filter)

returns SimpleFilter but it should be SubstringFilter, right ????

Can anyone check this? 

Regards,
Robert

Additional Comments From koszegir dated Fri Nov 23 06:57:10 CST 2007 
I managed to fix it by changing 
org.safehaus.penrose.adapter.jdbc.SearchRequestBuilder

I removed the line

filterBuilder.append(request.getFilter());

from method 'public QueryRequest generate() '

It messed up the filter passed for sql converting; here comes the relevant part from the server log:
[11/23/2007 13:47:30] Source values:
[11/23/2007 13:47:30]  - lsyconfusers.UUID: xxxxxxxxxxx (String)
[11/23/2007 13:47:30]  - lsyusers.primaryKey.uid: xxxxxxxxx (String)
[11/23/2007 13:47:30]  - lsyusers.cn: xxxxxxxxxxx (String)
[11/23/2007 13:47:30]  - lsyusers.mail: xxxxxxxxxxxx (String)
[11/23/2007 13:47:30]  - lsyusers.sn: xxxxxxxxxxx (String)
[11/23/2007 13:47:30]  - lsyusers.telephoneNumber: xxxxxxxxxx (String)
[11/23/2007 13:47:30]  - lsyusers.uid: xxxxxxxxx (String)
[11/23/2007 13:47:30] Authentication: null
[11/23/2007 13:47:30] Creating filters:
[11/23/2007 13:47:30]  - Filter (lsyconfusers.UUID=u292121)
[11/23/2007 13:47:30] Processing source lsyconfusers
[11/23/2007 13:47:30]  - field UUID
[11/23/2007 13:47:30]  - field MEMBEROF
[11/23/2007 13:47:30] Converting filter (uid=u29212*)
[11/23/2007 13:47:30]  - Filter (lsyusers.uidlikeu29212%)
[11/23/2007 13:47:30] Source filter: (&(lsyconfusers.UUID=u292121)(lsyusers.uidl
ikeu29212%))
[11/23/2007 13:47:30] Generating select statement.
[11/23/2007 13:47:30] Simple Filter: lsyconfusers.UUID = u292121
[11/23/2007 13:47:30] Simple Filter: lsyusers.uid like u29212%
[11/23/2007 13:47:30]
java.lang.NullPointerException
.
.
.

This conversion was wrong:
Source filter: (&(lsyconfusers.UUID=u292121)(lsyusers.uidl
ikeu29212%))

But I am not sure if this is the correct fix (not introducing new ones)...

Regards,
Robert


=========================================================
Issue dump from jira
$VAR1 = {
          'priority' => '3',
          'customFieldValues' => [],
          'project' => 'PENROSE',
          'status' => '1',
          'components' => [
                            {}
                          ],
          'reporter' => 'koszegir',
          'key' => 'PENROSE-276',
          'assignee' => 'jimyang',
          'summary' => 'JDBCFilterBuilder throws NullPointerException when filter condition contains wildcard character',
          'id' => '10920',
          'updated' => '2008-04-07 17:41:56.0',
          'votes' => '0',
          'fixVersions' => [
                           {
                             'releaseDate' => '2008-04-14 00:00:00.0',
                             'sequence' => '27',
                             'name' => 'Penrose-1.2.5',
                             'released' => 'true',
                             'id' => '10124',
                             'archived' => 'false'
                           },
                           {
                             'releaseDate' => '2008-09-18 00:00:00.0',
                             'sequence' => '31',
                             'name' => 'Penrose-2.1',
                             'released' => 'false',
                             'id' => '10130',
                             'archived' => 'false'
                           }
                         ],
          'affectsVersions' => [
                               {
                                 'releaseDate' => '2007-07-17 00:00:00.0',
                                 'sequence' => '26',
                                 'name' => 'Penrose-1.2.4',
                                 'released' => 'true',
                                 'id' => '10123',
                                 'archived' => 'false'
                               }
                             ],
          'description' => 'I have a join mapping where one of the sources is a relational table. When running an ldapsearch with a filter condition like (uid=udddd*) it thorws this exception (uid is mapped to the primary key in the table):

java.lang.NullPointerException
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:198)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:51)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:317)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:45)
        at org.safehaus.penrose.adapter.jdbc.JDBCFilterBuilder.generate(JDBCFilt
erBuilder.java:35)
        at org.safehaus.penrose.adapter.jdbc.JDBCStatementBuilder.generate(JDBCS
tatementBuilder.java:147)
        at org.safehaus.penrose.adapter.jdbc.JDBCStatementBuilder.generate(JDBCS
tatementBuilder.java:33)
        at org.safehaus.penrose.jdbc.JDBCClient.executeQuery(JDBCClient.java:379
)
        at org.safehaus.penrose.adapter.jdbc.JDBCAdapter.search(JDBCAdapter.java
:983)
        at org.safehaus.penrose.connection.Connection.search(Connection.java:285
)
        at org.safehaus.penrose.connector.Connector.search(Connector.java:271)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.searchSecondary
Sources(BasicSearchResponse.java:178)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.add(BasicSearch
Response.java:102)
        at org.safehaus.penrose.engine.basic.BasicSearchResponse.add(BasicSearch
Response.java:23)
        at org.safehaus.penrose.adapter.Adapter$1.add(Adapter.java:649)
        at org.safehaus.penrose.adapter.Adapter$1.add(Adapter.java:651)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter$1.add(LDAPAdapter.java:
497)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter$1.add(LDAPAdapter.java:
488)
        at org.safehaus.penrose.ldap.LDAPClient.search(LDAPClient.java:414)
        at org.safehaus.penrose.adapter.ldap.LDAPAdapter.search(LDAPAdapter.java
:503)
        at org.safehaus.penrose.adapter.Adapter.search(Adapter.java:656)
        at org.safehaus.penrose.connection.Connection.search(Connection.java:285
)
        at org.safehaus.penrose.connector.Connector.search(Connector.java:271)
        at org.safehaus.penrose.engine.basic.BasicEngine.search(BasicEngine.java
:814)
        at org.safehaus.penrose.handler.DefaultHandler.performSearch(DefaultHand
ler.java:319)
        at org.safehaus.penrose.handler.DefaultHandler.search(DefaultHandler.jav
a:160)
        at org.safehaus.penrose.handler.DefaultHandler.searchChildren(DefaultHan
dler.java:359)
        at org.safehaus.penrose.handler.DefaultHandler.search(DefaultHandler.jav
a:169)
        at org.safehaus.penrose.handler.Handler.search(Handler.java:278)
        at org.safehaus.penrose.handler.HandlerManager$1.run(HandlerManager.java
:535)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:675)
        at java.lang.Thread.run(Thread.java:595)

Is it working with 1.2.4????

Regards,
Robert',
          'created' => '2007-11-22 04:35:29.0',
          'environment' => 'Windows XP',
          'type' => '1'
        };


=========================================================

Note You need to log in before you can comment on or make changes to this bug.