Commit 95c68ff7 authored by Neil Fuller's avatar Neil Fuller
Browse files

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
Change-Id: I02ea38b4a50fc3b7299a35d0a1050455cb9ca970
parent 64bbdb2e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment