Skip to content

Commit 4b92888

Browse files
committed
[refactor] Swap arguments for internal consistency purposes
1 parent 9e54ea0 commit 4b92888

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

exist-core/src/main/java/org/exist/xquery/ModuleContext.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,17 @@ public class ModuleContext extends XQueryContext {
5858
private static final Logger LOG = LogManager.getLogger(ModuleContext.class);
5959

6060
private XQueryContext parentContext;
61-
private String modulePrefix;
6261
private String moduleNamespace;
62+
private String modulePrefix;
6363
private final String location;
6464

65-
public ModuleContext(final XQueryContext parentContext, final String modulePrefix, final String moduleNamespace,
66-
final String location) {
65+
public ModuleContext(final XQueryContext parentContext, final String moduleNamespace, final String modulePrefix, final String location) {
6766
super(parentContext != null ? parentContext.db : null,
6867
parentContext != null ? parentContext.getConfiguration() : null,
6968
null,
7069
false);
71-
72-
this.modulePrefix = modulePrefix;
7370
this.moduleNamespace = moduleNamespace;
71+
this.modulePrefix = modulePrefix;
7472
this.location = location;
7573

7674
setParentContext(parentContext);
@@ -196,7 +194,7 @@ public void updateContext(final XQueryContext from) {
196194

197195
@Override
198196
public XQueryContext copyContext() {
199-
final ModuleContext ctx = new ModuleContext(parentContext, modulePrefix, moduleNamespace, location);
197+
final ModuleContext ctx = new ModuleContext(parentContext, moduleNamespace, modulePrefix, location);
200198
copyFields(ctx);
201199
try {
202200
ctx.declareNamespace(modulePrefix, moduleNamespace);

exist-core/src/main/java/org/exist/xquery/XQueryContext.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ public Optional<ExistRepository> getRepository() {
591591
}
592592

593593
// build a module object from the source
594-
final ExternalModule module = compileOrBorrowModule(prefix, namespace, location, src);
594+
final ExternalModule module = compileOrBorrowModule(namespace, prefix, location, src);
595595
return module;
596596

597597
} catch (final PermissionDeniedException e) {
@@ -2522,7 +2522,7 @@ public boolean tailRecursiveCall(final FunctionSignature signature) {
25222522
}
25232523

25242524
final Source moduleSource = new DBSource(getBroker().getBrokerPool(), (BinaryDocument) sourceDoc, true);
2525-
return compileOrBorrowModule(prefix, namespaceURI, location, moduleSource);
2525+
return compileOrBorrowModule(namespaceURI, prefix, location, moduleSource);
25262526

25272527
} catch (final PermissionDeniedException e) {
25282528
throw moduleLoadException("Permission denied to read module source from location hint URI '" + location + ".", location, e);
@@ -2559,7 +2559,7 @@ public boolean tailRecursiveCall(final FunctionSignature signature) {
25592559
throw moduleLoadException("Permission denied to read module source from location hint URI '" + location + ".", location, e);
25602560
}
25612561

2562-
return compileOrBorrowModule(prefix, namespaceURI, location, moduleSource);
2562+
return compileOrBorrowModule(namespaceURI, prefix, location, moduleSource);
25632563
}
25642564

25652565
protected XPathException moduleLoadException(final String message, final String moduleLocation)
@@ -2591,18 +2591,18 @@ public Iterator<String> getMappedModuleURIs() {
25912591
/**
25922592
* Compile of borrow an already compile module from the cache.
25932593
*
2594-
* @param prefix the module namespace prefix
25952594
* @param namespaceURI the module namespace URI
2595+
* @param prefix the module namespace prefix
25962596
* @param location the location hint
25972597
* @param source the source for the module
25982598
*
25992599
* @return the module or null
26002600
*
26012601
* @throws XPathException if the module could not be loaded (XQST0059) or compiled (XPST0003)
26022602
*/
2603-
private ExternalModule compileOrBorrowModule(final String prefix, final String namespaceURI, final String location,
2603+
private ExternalModule compileOrBorrowModule(final String namespaceURI, final String prefix, final String location,
26042604
final Source source) throws XPathException {
2605-
final ExternalModule module = compileModule(prefix, namespaceURI, location, source);
2605+
final ExternalModule module = compileModule(namespaceURI, prefix, location, source);
26062606
if (module != null) {
26072607
addModule(module.getNamespaceURI(), module);
26082608
declareModuleVars(module);
@@ -2613,14 +2613,14 @@ private ExternalModule compileOrBorrowModule(final String prefix, final String n
26132613
/**
26142614
* Compile an XQuery Module
26152615
*
2616-
* @param prefix the namespace prefix of the module.
26172616
* @param namespaceURI the namespace URI of the module.
2617+
* @param prefix the namespace prefix of the module.
26182618
* @param location the location of the module
26192619
* @param source the source of the module.
26202620
* @return The compiled module, or null if the source is not a module
26212621
* @throws XPathException if the module could not be loaded (XQST0059) or compiled (XPST0003)
26222622
*/
2623-
private @Nullable ExternalModule compileModule(final String prefix, String namespaceURI, final String location,
2623+
private @Nullable ExternalModule compileModule(String namespaceURI, final String prefix, final String location,
26242624
final Source source) throws XPathException {
26252625
if (LOG.isDebugEnabled()) {
26262626
LOG.debug("Loading module from {}", location);
@@ -2641,7 +2641,7 @@ private ExternalModule compileOrBorrowModule(final String prefix, final String n
26412641
}
26422642

26432643
final ExternalModuleImpl modExternal = new ExternalModuleImpl(namespaceURI, prefix);
2644-
final XQueryContext modContext = new ModuleContext(this, prefix, namespaceURI, location);
2644+
final XQueryContext modContext = new ModuleContext(this, namespaceURI, prefix, location);
26452645
modExternal.setContext(modContext);
26462646
final XQueryLexer lexer = new XQueryLexer(modContext, reader);
26472647
final XQueryParser parser = new XQueryParser(lexer);

0 commit comments

Comments
 (0)