Suppressing Trivial FindBugs Warnings for Android Projects

FindBugs is an extremely useful static analysis tool for Java code that will flag many subtle bugs and point out bad practice. However, when using FindBugs with Android projects, it will complain about the name of the auto-generated Android resource inner classes, which start with a lower-case letter, e.g. com.example.app.R$attr. Obviously, there is not much you can do to change the names, so these warnings are of little use.

By defining a filter for FindBugs, the warnings can be suppressed. Create an XML-file with the following content and include the file as a filter when running FindBugs.

<FindBugsFilter>
 <Match>
  <Class name="~.*\.R\$.*"/>
  <Bug pattern="NM_CLASS_NAMING_CONVENTION"/>
 </Match>
</FindBugsFilter>

If you run FindBugs through the Eclipse plugin, open Eclipse Preferences, go to Java > FindBugs and select the “Filter Files” tab. Click “Add…” next to “Exclude filter files” and select the XML-file you created earlier.

If you run FindBugs from a command line, include the option “-exclude <file.xml>”, where “<file.xml>” is the path and name of the XML-file you created.

The FindBugs filter mechanism is very versatile. Have a look at chapter 8 of the FindBugs manual for more information.

 

Posted in Android | Tagged , | 3 Comments

Searching Active Directory root with Apache’s mod_authnz_ldap

While setting up an Apache server for authenticating users accessing a Subversion repository using mod_authnz_ldap, I came across a problem previously reported by phiroc on the users@httpd mailing list:

Hi,

when I use the following AuthLDAPURL

“ldap://adserver/ou=city1,dc=abc,dc=com?sAMAccountName?sub?(&(objectClass=user)(!(objectClass=computer)))” NONE

I can authenticate any user in “ou” city1.

If I replace the AuthLDPAURL by

“ldap://adserver/dc=abc,dc=com?sAMAccountName?sub?(&(objectClass=user)(!(objectClass=computer)))” NONE

I get an Apache 2.2 internal error and in the error log the following message:

[debug] mod_authnz_ldap.c(379): [client xxxx] [8655] auth_ldap authenticate: using URL ldap://adserver/dc=abc,dc=com?sAMAccountName?sub?(&(objectClass=user)(!(objectClass=computer)))
[info] [client xxxx] [8655] auth_ldap authenticate: user myusername authentication failed; URI /test/ [ldap_search_ext_s() for user failed][Operations error]

When I do ldapsearch … -b ‘dc=abc,dc=com’ ‘(&(objectClass=user)(!(objectClass=computer))(samaccountname=myusername)’, the Active Directory server returns data, which seems to imply that there’s something wrong with the mod_authnz_ldap module, or with the way I set it up or use it.

Has anyone encountered this problem before?

Is there a solution?

Many thanks.

Best regards,

p

It turns out that this problem can occur if the Active Directory has been partitioned among several domain servers in a so-called forest. The solution appears to be to query the Global Catalog instead of the domain server. To do this, access the domain server using TCP port 3268 instead of the standard port 389. Continuing the example given by phiroc, the AuthLDAPURL should be changed to:

“ldap://adserver:3268/dc=abc,dc=com?sAMAccountName?sub?(&(objectClass=user)(!(objectClass=computer)))” NONE

Posted in Configuration | Leave a comment

Recovering from a bad initrd image

When Linux is booted by the boot loader, it will first load the kernel image (usually /boot/vmlinuz) into memory, followed by the initial boot ramdisk (usually /boot/initrd). If for some reason the initrd image has been corrupted, booting may fail. The following procedure can be used to re-generate the initrd image.

  1. Make sure the BIOS is set to boot from the optical drive
  2. Insert the OpenSUSE install DVD into the optical drive.
  3. Boot the machine
  4. Select the menu option “Rescue System”
  5. When prompted to login, type “root”
  6. Mount the Linux root partition, typically something like “mount -t ext3 /dev/sda1 /mnt”
  7. If the Linux /boot area is on a separate partition, also mount that into the root partition, f.ex. “mount -t ext3 /dev/sda2 /mnt/boot”
  8. Bind the rescue system’s /dev to the mounted root filesystem with “mount –bind /dev /mnt/dev” – this will make sure all your device nodes are correct
  9. Chroot to the mounted root filesystem with “chroot /mnt”
  10. Mount proc and sys: “mount /proc” and “mount /sys”
  11. Re-generate initrd image with “mkinitrd”
  12. Remove DVD and reboot
Posted in Installation, OpenSUSE 11.1 | Leave a comment

Changing GDM theme in OpenSUSE 11.1

OpenSUSE 11.1 ships with GDM 2.24.x which is a not yet feature-complete rewrite of the original GDM codebase. One consequence of this is that it is no longer possible to customize the login screen using gdmsetup. It is, however, still possible to customize the background image, icon theme and Gtk theme by editing gconf settings.

The properties for GDM are defined in the distribution-specific gconf settings in /etc/gconf/gconf.xml.vendor/%gconf-tree.xml.

To change the background image, look for:

<dir entry=”background”>

<entry name=”picture_filename” mtime=”1241629069″ type=”string”>

<stringvalue>/usr/share/backgrounds/glass/glass.xml</stringvalue>

</entry>

</dir>

Change the string value to the location of the background image you want to use.  This can be either a JPG file or an XML file in the Gnome background slideshow XML format (which does not seem to be documented).

The icon theme and Gtk theme can be similarly modified by editing the properties “icon_theme” and “gtk_theme” respectively.

Posted in Configuration, OpenSUSE 11.1 | Leave a comment

OpenOffice troubles

Since I upgraded my T60 from OpenSUSE 10.2 to 10.3, I have been unable to start OpenOffice. No matter what I did the OpenSUSE customized splash screen appeared, but the progress bar never moved. Starting OO as root, it actually managed to freeze X, requiring me to bail out of X with Ctrl+Alt+Backspace.

To debug the problem I tried stracing oowriter without much luck. Around the net people reported various similar problems, but none of the suggested solutions worked. Eventually I found a bug report in Novell’s Bugzilla where Martin Tessun explained, that with the ATI Radeon fglrx driver, LD_LIBRARY_PATH must be set to point to /usr/X11R6/lib:/usr/X11R6/lib64. True enough, after exporting LD_LIBRARY_PATH with these paths, OO started without a hitch.

To make the change permanent, I added the export statement to /etc/profile.local.

Posted in OpenSUSE 10.3 | Comments Off