Skip to content

Commit 35e7664

Browse files
committed
[bugfix] Don't stop startup if an EXPath Package cannot be loaded. Closes #4693
1 parent 40ef8fe commit 35e7664

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

exist-core/src/main/java/org/exist/repo/ExistRepository.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
*/
7171
public class ExistRepository extends Observable implements BrokerPoolService {
7272

73+
private final static Logger EXIST_LOG = LogManager.getLogger(BrokerPool.class);
7374
private final static Logger LOG = LogManager.getLogger(ExistRepository.class);
7475
private static final String EXPATH_REPO_DIR_NAME = "expathrepo";
7576
private static final String LEGACY_DEFAULT_EXPATH_REPO_DIR = "webapp/WEB-INF/" + EXPATH_REPO_DIR_NAME;
@@ -98,13 +99,27 @@ public void prepare(final BrokerPool brokerPool) throws BrokerPoolServiceExcepti
9899

99100
LOG.info("Using directory {} for expath package repository", expathDir.toAbsolutePath().toString());
100101

102+
final FileSystemStorage storage;
103+
try {
104+
storage = new FileSystemStorage(expathDir);
105+
} catch(final PackageException e) {
106+
throw new BrokerPoolServiceException("Unable to open storage for EXPath Package Repository: " + expathDir.toAbsolutePath(), e);
107+
}
108+
storage.setErrorIfNoContentDir(false);
109+
110+
this.myParent = new Repository(storage);
111+
final List<PackageException> exceptions = this.myParent.init();
112+
if (exceptions.size() > 0) {
113+
EXIST_LOG.warn("It may not have been possible to load all EXPath Packages, see repo.log for details...");
114+
for (final PackageException exception : exceptions) {
115+
LOG.error(exception.getMessage(), exception);
116+
}
117+
}
118+
101119
try {
102-
final FileSystemStorage storage = new FileSystemStorage(expathDir);
103-
storage.setErrorIfNoContentDir(false);
104-
this.myParent = new Repository(storage);
105120
myParent.registerExtension(new ExistPkgExtension());
106121
} catch(final PackageException e) {
107-
throw new BrokerPoolServiceException("Unable to prepare EXPath Package Repository: " + expathDir.toAbsolutePath().toString(), e);
122+
throw new BrokerPoolServiceException("Unable to register EXPath Package Repository extension 'ExistPkgExtension': " + e.getMessage(), e);
108123
}
109124
}
110125

exist-parent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
<dependency>
395395
<groupId>org.expath.packaging</groupId>
396396
<artifactId>pkg-java</artifactId>
397-
<version>1.6.1</version>
397+
<version>2.0.0</version>
398398
</dependency>
399399

400400
<dependency>

0 commit comments

Comments
 (0)