@@ -132,9 +132,9 @@ public final class RuntimeEnvironment {
132
132
private Statistics statistics = new Statistics ();
133
133
134
134
/**
135
- * Instance of authorization framework. Allowing every request by default.
135
+ * Instance of authorization framework.
136
136
*/
137
- private AuthorizationFramework authFramework = new AuthorizationFramework ( null ) ;
137
+ private AuthorizationFramework authFramework ;
138
138
139
139
/* Get thread pool used for top-level repository history generation. */
140
140
public static synchronized ExecutorService getHistoryExecutor () {
@@ -1552,15 +1552,18 @@ public void loadStatistics(InputStream in) throws IOException, ParseException {
1552
1552
* @see AuthorizationFramework#getPluginVersion()
1553
1553
*/
1554
1554
public int getPluginVersion () {
1555
- return authFramework .getPluginVersion ();
1555
+ return getAuthorizationFramework () .getPluginVersion ();
1556
1556
}
1557
1557
1558
1558
/**
1559
1559
* Return the authorization framework used in this environment.
1560
1560
*
1561
1561
* @return the framework
1562
1562
*/
1563
- public AuthorizationFramework getAuthorizationFramework () {
1563
+ synchronized public AuthorizationFramework getAuthorizationFramework () {
1564
+ if (authFramework == null ) {
1565
+ authFramework = new AuthorizationFramework (threadConfig .get ().getPluginDirectory ());
1566
+ }
1564
1567
return authFramework ;
1565
1568
}
1566
1569
@@ -1570,7 +1573,7 @@ public AuthorizationFramework getAuthorizationFramework() {
1570
1573
*
1571
1574
* @param fw the new framework
1572
1575
*/
1573
- public void setAuthorizationFramework (AuthorizationFramework fw ) {
1576
+ synchronized public void setAuthorizationFramework (AuthorizationFramework fw ) {
1574
1577
if (this .authFramework != null ) {
1575
1578
this .authFramework .removeAll (this .authFramework .getStack ());
1576
1579
}
@@ -1637,8 +1640,8 @@ public void applyConfig(Configuration config, boolean reindex) {
1637
1640
config .refreshDateForLastIndexRun ();
1638
1641
}
1639
1642
1640
- authFramework .setPluginDirectory (config .getPluginDirectory ());
1641
- authFramework .reload ();
1643
+ getAuthorizationFramework () .setPluginDirectory (config .getPluginDirectory ());
1644
+ getAuthorizationFramework () .reload ();
1642
1645
}
1643
1646
1644
1647
/**
@@ -1805,7 +1808,7 @@ public FileVisitResult postVisitDirectory(Path d, IOException exc) throws IOExce
1805
1808
}
1806
1809
if (reload ) {
1807
1810
Thread .sleep (THREAD_SLEEP_TIME ); // experimental wait if file is being written right now
1808
- authFramework .reload ();
1811
+ getAuthorizationFramework () .reload ();
1809
1812
}
1810
1813
if (!key .reset ()) {
1811
1814
break ;
0 commit comments