Hi,
Please find attached a patch for SW 1.5 on postgresql addressing a ISE
on visibleSystems.java due to default cast to Integer on postgresql.

The ISE does not happen well logged in as Spacewalk administrator,
only with added users.

pierre


---------- Forwarded message ----------
From: Pierre Casenove <pcasen...@gmail.com>
Date: 2011/12/9
Subject: Re: ISE on SW 1.5 on user management
To: spacewalk-l...@redhat.com


Me again.
After reading the PostGreSQLPortingGuide (should have done this
before), I found this:
https://fedorahosted.org/spacewalk/wiki/PostgreSQLPortingGuide#Defaultcasttointeger
I don't have my set up box available, but class
com.redhat.rhn.frontend.dto.VisibleSystems has to be modified. And by
comparing VisibleSystems class to SystemOverview class, here is what
should be modified to correct the error:
At line 78 , add this function:

           /**
            * For compatibility reasons with PostgreSQL we accept also Integer.
            *
            * @param selectableIn Whether a server is selectable one
if selectable,
            * null if not selectable
            */
           public void setSelectable(Integer selectableIn) {
               selectable = (selectableIn != null);
           }


I'm really sorry but I can't format a patch or what so ever, I have no
way to access the spacewalk server for the week end. And with 1.6
branching arriving on monday... I would like to have this patch
included.

Pierre


> 2011/12/8 Pierre Casenove <pcasen...@gmail.com>:
>> Just a quick update:
>> running the query in psql shell works (I forgot the select * at the
>> beggining). So the query is correct.
>> From the error log, I guess that an Integer is returned in case the
>> user is ldap-enabled, and a Long for a regular user.
>> But I wasn't able to find the code behind this.
>>
>> Pierre
>>
>> 2011/12/8 Pierre Casenove <pcasen...@gmail.com>:
>>> Hello List,
>>> I've plugged my SW 1.5 installation with PGSQL on a LDAP.
>>> When I create a user with PAM authentication, and then going to Users
>>> --> <ldapUser> --> Systems, I get an ISE.
>>> If I navigate to this page on a non ldap user, I don't get an ISE.
>>> I've attached the catalina.out logs.
>>> Two errors appears:
>>> First:
>>> ERROR com.redhat.rhn.common.db.datasource.CachedStatement - Error
>>> while processing cached statement sql: select * from (
>>>  SELECT  DISTINCT S.id AS ID,
>>>          S.name AS SERVER_NAME,
>>>          (SELECT 1
>>>          FROM rhnServerFeaturesView SFV
>>>         WHERE SFV.server_id = S.id
>>>           AND SFV.label = 'ftr_system_grouping') AS selectable
>>>    FROM  rhnServer S, rhnUserServerPerms USP
>>>   WHERE  USP.user_id = ?
>>>     AND  S.id = USP.server_id
>>> ) X
>>> ORDER BY  UPPER(COALESCE(X.server_name, '(none)')), X.id
>>>
>>> --> When running it in psql, here is the output : ERROR:
>>> syntax error at or near ")"
>>> LINE 10: ) X
>>>
>>>
>>> Second error:
>>> Could not find method called: setSelectable in class:
>>> com.redhat.rhn.frontend.dto.VisibleSystems with params: [type:
>>> java.lang.Integer, value: 1]
>>> Indeed, looking at the source code, it is public void
>>> setSelectable(Long selectableIn)
>>>
>>>
>>> Could you please point me to some clue? I can't find in the source
>>> code where the query is built,  and I don't see what is erroneous in
>>> the query.
>>>
>>> Thanks,
>>>
>>> Pierre

Attachment: Integer_Long_VisibleSystems.patch
Description: Binary data

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to