User Profile Path Mystery!

I have a very strange issue going on. I’m running Openfire 3.6.4 with Spark 2.5.8 in a Citrix environment.

Spark has been running without issue for about a year, but just this week it began doing some strange things. The current way that Spark is started is by double-clicking a .bat file which (1) modifies the registry to prevent Spark from automatically starting, (2) creates a spark.properties file in the %userprofile%\spark directory if it doesn’t already exist, and (3) run the Spark executable. Spark is installed in the D:\program files\Spark directory.

Now, Spark doesn’t seem to be reading from the %userprofile%\Spark directory (c:\documents and settings\username\spark). Instead, it has created a C:\Spark directory and each time a user starts up Spark, it reads and stores the spark.properties file in here. This obviously causes problems on Citrix since there are multiple users using each server and this means the same spark.properties file is being used by all users (which leads to users accidentally logging in as other users, etc).

I thought Spark was hard-coded to always use the %userprofile%\Spark directory, so I can’t figure out why this may be happening. Our network admin recently modified roaming profiles to make them not copy back some unnecessary information (cookies, temp files, etc), but did not mess with the \Spark directory. When run from a command line, %userprofile% resolves to the C:\documents and settings\username\spark directory, not to C:.

Any ideas what could cause Spark to begin looking at C:\spark instead of %userprofile%\spark?!?!?

spark is hardcoded to look in the %userprofile%\spark folder, but has been know to act weird with redirects and other non-standard profile settings. Maybe an environment change that was done is causing your issue.

That’s what I thought (about it being hardcoded). I have a Spark plugin which I wrote and I used it to test and found that the user.home system property is pointing to c:. On my workstation, user.home points to c:\documents and settings\username. I read that there is a bug in Java that makes user.home not point to the same thing as %userprofile%, but Spark is supposed to be using the 1.6 JRE located in the D:\program files\Spark\jre directory and I would think this issue would be fixed in Java 1.6.

Any ideas what would have caused java to change the user.home path and/or how I can change it back?

Finally found the issue. Here’s what happened for anyone else that may have run into this same problem. Our network admin exempted folders from being copied back to the roaming profile. One of these folders was the user’s desktop folder. When this was exempted, it actually deleted the %userprofile%\desktop folder from the user’s profile. It turns out that Spark must be hardcoded to look at the user.home system property to determine where to save/open the spark.properties file. To find the user.home property, Java actually looks at the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop key, strips off the word “Desktop”, and assigns the remainder of the path to user.home. Since the users’ desktop folder was no longer present, the registry key automatically updated to a blank value, which resulted in user.home being set to C:\ and which is why all users were pulling spark.properties from the C:\Spark directory. We recreated the desktop folder, updated the reg key, removed the desktop folder from the exemption list, and everything seems to be working normally now.