@@ -132,9 +132,9 @@ public final class RuntimeEnvironment {
132132 private Statistics statistics = new Statistics ();
133133
134134 /**
135- * Instance of authorization framework. Allowing every request by default.
135+ * Instance of authorization framework.
136136 */
137- private AuthorizationFramework authFramework = new AuthorizationFramework ( null ) ;
137+ private AuthorizationFramework authFramework ;
138138
139139 /* Get thread pool used for top-level repository history generation. */
140140 public static synchronized ExecutorService getHistoryExecutor () {
@@ -1552,15 +1552,18 @@ public void loadStatistics(InputStream in) throws IOException, ParseException {
15521552 * @see AuthorizationFramework#getPluginVersion()
15531553 */
15541554 public int getPluginVersion () {
1555- return authFramework .getPluginVersion ();
1555+ return getAuthorizationFramework () .getPluginVersion ();
15561556 }
15571557
15581558 /**
15591559 * Return the authorization framework used in this environment.
15601560 *
15611561 * @return the framework
15621562 */
1563- public AuthorizationFramework getAuthorizationFramework () {
1563+ synchronized public AuthorizationFramework getAuthorizationFramework () {
1564+ if (authFramework == null ) {
1565+ authFramework = new AuthorizationFramework (threadConfig .get ().getPluginDirectory ());
1566+ }
15641567 return authFramework ;
15651568 }
15661569
@@ -1570,7 +1573,7 @@ public AuthorizationFramework getAuthorizationFramework() {
15701573 *
15711574 * @param fw the new framework
15721575 */
1573- public void setAuthorizationFramework (AuthorizationFramework fw ) {
1576+ synchronized public void setAuthorizationFramework (AuthorizationFramework fw ) {
15741577 if (this .authFramework != null ) {
15751578 this .authFramework .removeAll (this .authFramework .getStack ());
15761579 }
@@ -1637,8 +1640,8 @@ public void applyConfig(Configuration config, boolean reindex) {
16371640 config .refreshDateForLastIndexRun ();
16381641 }
16391642
1640- authFramework .setPluginDirectory (config .getPluginDirectory ());
1641- authFramework .reload ();
1643+ getAuthorizationFramework () .setPluginDirectory (config .getPluginDirectory ());
1644+ getAuthorizationFramework () .reload ();
16421645 }
16431646
16441647 /**
@@ -1805,7 +1808,7 @@ public FileVisitResult postVisitDirectory(Path d, IOException exc) throws IOExce
18051808 }
18061809 if (reload ) {
18071810 Thread .sleep (THREAD_SLEEP_TIME ); // experimental wait if file is being written right now
1808- authFramework .reload ();
1811+ getAuthorizationFramework () .reload ();
18091812 }
18101813 if (!key .reset ()) {
18111814 break ;
0 commit comments