Fix FilePreferencesImplTest test initialization errors.

Fix IllegalAccessException from Preferences when this
test is run "stand alone".

The java.util.prefs.Preferences class is normally already
initialized by the time this test runs (and initialized
when there is no system property). However, in
standalone cases the system property is pointing to a
class that cannot be instantiated by ServiceLoader.

The normal fallback process when the system property is
not set would lead to FilePreferencesFactoryImpl being
instantiated directly by java.util.prefs.Preferences,
which is legal.

Removing the system property fixes the issue. The
FilePreferencesFactoryImpl is not intended to be created
by ServiceLoader and so it is reasonable that the class
is declared as package-protected. This test is for
the implementation so it's reasonable just to bypass
Preferences entirely.

Bug: 17515057

(cherry picked from commit 95c68ff724f7cf1afc2970b0d25e108e580307ed)

Change-Id: Ia860e299983b7b87753fe1dc0259b0d4ea2477f3
1 file changed