Skip to content

Commit a4a3824

Browse files
authored
Merge pull request #4980 from joewiz/hotfix/empty-sequence-signatures
[bugfix] Correct function signatures that return empty sequences
2 parents 0a932f9 + 1891a36 commit a4a3824

File tree

14 files changed

+32
-32
lines changed

14 files changed

+32
-32
lines changed

exist-core/src/main/java/org/exist/xquery/functions/securitymanager/GroupManagementFunction.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class GroupManagementFunction extends BasicFunction {
5151
new SequenceType[]{
5252
new FunctionParameterSequenceType("group-name", Type.STRING, Cardinality.EXACTLY_ONE, "The name of the group to create.")
5353
},
54-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
54+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
5555
);
5656

5757
public final static FunctionSignature FNS_CREATE_GROUP_WITH_METADATA = new FunctionSignature(
@@ -61,7 +61,7 @@ public class GroupManagementFunction extends BasicFunction {
6161
new FunctionParameterSequenceType("group-name", Type.STRING, Cardinality.EXACTLY_ONE, "The name of the group to create."),
6262
new FunctionParameterSequenceType("description", Type.STRING, Cardinality.EXACTLY_ONE, "A description of the group.")
6363
},
64-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
64+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
6565
);
6666

6767
public final static FunctionSignature FNS_CREATE_GROUP_WITH_MANAGERS_WITH_METADATA = new FunctionSignature(
@@ -72,7 +72,7 @@ public class GroupManagementFunction extends BasicFunction {
7272
new FunctionParameterSequenceType("managers", Type.STRING, Cardinality.ONE_OR_MORE, "The usernames of users that will be a manager of this group."),
7373
new FunctionParameterSequenceType("description", Type.STRING, Cardinality.EXACTLY_ONE, "A description of the group.")
7474
},
75-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
75+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
7676
);
7777

7878
public final static FunctionSignature FNS_REMOVE_GROUP = new FunctionSignature(
@@ -81,7 +81,7 @@ public class GroupManagementFunction extends BasicFunction {
8181
new SequenceType[]{
8282
new FunctionParameterSequenceType("group-name", Type.STRING, Cardinality.EXACTLY_ONE, "The group-id to delete")
8383
},
84-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
84+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
8585
);
8686

8787
//TODO implement later
@@ -92,7 +92,7 @@ public class GroupManagementFunction extends BasicFunction {
9292
new FunctionParameterSequenceType("group-id", Type.STRING, Cardinality.EXACTLY_ONE, "The group-id to delete"),
9393
new FunctionParameterSequenceType("successor-group-id", Type.STRING, Cardinality.EXACTLY_ONE, "The group-id that should take over ownership of any resources")
9494
},
95-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
95+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
9696
); */
9797

9898
public GroupManagementFunction(final XQueryContext context, final FunctionSignature signature) {

exist-core/src/main/java/org/exist/xquery/functions/system/FunctionTrace.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class FunctionTrace extends BasicFunction {
4545
new QName( "enable-tracing", SystemModule.NAMESPACE_URI, SystemModule.PREFIX ),
4646
"Enable function tracing on the database instance.",
4747
new SequenceType[] { new FunctionParameterSequenceType("enable", Type.BOOLEAN, Cardinality.EXACTLY_ONE, "The boolean flag to enable/disable function tracing") },
48-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
48+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
4949
),
5050
new FunctionSignature(
5151
new QName( "enable-tracing", SystemModule.NAMESPACE_URI, SystemModule.PREFIX ),
@@ -55,7 +55,7 @@ public class FunctionTrace extends BasicFunction {
5555
new FunctionParameterSequenceType("tracelog", Type.BOOLEAN, Cardinality.EXACTLY_ONE,
5656
"The tracelog boolean flag: if set to true, entering/exiting a function will be logged to the logger 'xquery.profiling'")
5757
},
58-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
58+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
5959
),
6060
new FunctionSignature(
6161
new QName( "tracing-enabled", SystemModule.NAMESPACE_URI, SystemModule.PREFIX ),
@@ -67,7 +67,7 @@ public class FunctionTrace extends BasicFunction {
6767
new QName( "clear-trace", SystemModule.NAMESPACE_URI, SystemModule.PREFIX ),
6868
"Clear the global trace log.",
6969
null,
70-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
70+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
7171
)
7272
};
7373

exist-core/src/main/java/org/exist/xquery/functions/system/Shutdown.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class Shutdown extends BasicFunction
5454
new QName("shutdown", SystemModule.NAMESPACE_URI, SystemModule.PREFIX),
5555
"Shutdown eXist immediately. This method is only available to the DBA role.",
5656
null,
57-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
57+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
5858
),
5959

6060
new FunctionSignature(
@@ -63,7 +63,7 @@ public class Shutdown extends BasicFunction
6363
new SequenceType[] {
6464
new FunctionParameterSequenceType("delay", Type.LONG, Cardinality.EXACTLY_ONE, "The delay in milliseconds before eXist starts to shutdown.")
6565
},
66-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
66+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
6767
)
6868
};
6969

exist-core/src/main/java/org/exist/xquery/functions/system/TriggerSystemTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class TriggerSystemTask extends BasicFunction {
5656
new FunctionParameterSequenceType("java-classname", Type.STRING, Cardinality.EXACTLY_ONE, "The full name of the Java class to execute. It must implement org.exist.storage.SystemTask"),
5757
new FunctionParameterSequenceType("task-parameters", Type.NODE, Cardinality.ZERO_OR_ONE, "The XML fragment with the following structure: <parameters><param name=\"param-name1\" value=\"param-value1\"/></parameters>")
5858
},
59-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE));
59+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE));
6060

6161

6262
public TriggerSystemTask(XQueryContext context) {

exist-core/src/main/java/org/exist/xquery/functions/transform/Transform.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public class Transform extends BasicFunction {
121121
new FunctionParameterSequenceType("stylesheet", Type.ITEM, Cardinality.EXACTLY_ONE, "The XSL stylesheet"),
122122
new FunctionParameterSequenceType("parameters", Type.NODE, Cardinality.ZERO_OR_ONE, "The transformer parameters")
123123
},
124-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)),
124+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)),
125125
new FunctionSignature(
126126
new QName("stream-transform", TransformModule.NAMESPACE_URI, TransformModule.PREFIX),
127127
"Applies an XSL stylesheet to the node tree passed as first argument. The parameters are the same " +
@@ -134,7 +134,7 @@ public class Transform extends BasicFunction {
134134
new FunctionParameterSequenceType("parameters", Type.NODE, Cardinality.ZERO_OR_ONE, "The transformer parameters"),
135135
new FunctionParameterSequenceType("attributes", Type.NODE, Cardinality.ZERO_OR_ONE, "Attributes to pass to the transformation factory"),
136136
new FunctionParameterSequenceType("serialization-options", Type.STRING, Cardinality.ZERO_OR_ONE, "The serialization options")},
137-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE))
137+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE))
138138
};
139139

140140
private static final Logger logger = LogManager.getLogger(Transform.class);

exist-core/src/main/java/org/exist/xquery/functions/util/LogFunction.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,25 @@ public class LogFunction extends BasicFunction {
6060
new QName(FUNCTION_LOG, UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
6161
"Logs the message to the current logger.",
6262
new SequenceType[]{PRIORITY_PARAMETER, MESSAGE_PARAMETER},
63-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
63+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
6464
),
6565
new FunctionSignature(
6666
new QName(FUNCTION_LOG_SYSTEM_OUT, UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
6767
"Logs the message to System.out.",
6868
new SequenceType[]{MESSAGE_PARAMETER},
69-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
69+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
7070
),
7171
new FunctionSignature(
7272
new QName(FUNCTION_LOG_SYSTEM_ERR, UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
7373
"Logs the message to System.err.",
7474
new SequenceType[]{MESSAGE_PARAMETER},
75-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
75+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
7676
),
7777
new FunctionSignature(
7878
new QName(FUNCTION_LOGAPP, UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
7979
"Logs the message to the named logger",
8080
new SequenceType[]{PRIORITY_PARAMETER, LOGGER_NAME_PARAMETER, MESSAGE_PARAMETER},
81-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)
81+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)
8282
)
8383
};
8484

exist-core/src/main/java/org/exist/xquery/functions/util/Profile.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public class Profile extends BasicFunction {
5050
new SequenceType[] {
5151
new FunctionParameterSequenceType("verbosity", Type.INT, Cardinality.EXACTLY_ONE, "The verbosity of the profiling"),
5252
},
53-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)),
53+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)),
5454
new FunctionSignature(
5555
new QName("disable-profiling", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
5656
"Disable profiling output within the query.",
5757
null,
58-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE))
58+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE))
5959
};
6060

6161
public Profile(XQueryContext context, FunctionSignature signature) {

exist-core/src/main/java/org/exist/xquery/functions/util/PrologFunctions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class PrologFunctions extends BasicFunction {
4242
new FunctionParameterSequenceType("prefix", Type.STRING, Cardinality.EXACTLY_ONE, "The prefix to be assigned to the namespace"),
4343
new FunctionParameterSequenceType("location", Type.ANY_URI, Cardinality.ZERO_OR_MORE, "The location of the module")
4444
},
45-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE),
45+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE),
4646
"Use fn:load-module#2 instead!"),
4747
new FunctionSignature(
4848
new QName("declare-namespace", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
@@ -51,15 +51,15 @@ public class PrologFunctions extends BasicFunction {
5151
new FunctionParameterSequenceType("prefix", Type.STRING, Cardinality.EXACTLY_ONE, "The prefix to be assigned to the namespace"),
5252
new FunctionParameterSequenceType("namespace-uri", Type.ANY_URI, Cardinality.EXACTLY_ONE, "The namespace URI")
5353
},
54-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)),
54+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)),
5555
new FunctionSignature(
5656
new QName("declare-option", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
5757
"Dynamically declares a serialization option as with 'declare option'.",
5858
new SequenceType[] {
5959
new FunctionParameterSequenceType("name", Type.STRING, Cardinality.EXACTLY_ONE, "The serialization option name"),
6060
new FunctionParameterSequenceType("option", Type.STRING, Cardinality.EXACTLY_ONE, "The serialization option value")
6161
},
62-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)),
62+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)),
6363
new FunctionSignature(
6464
new QName("get-option", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
6565
"Gets the value of a serialization option as set with 'declare option'.",

exist-core/src/main/java/org/exist/xquery/functions/xmldb/XMLDBDefragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class XMLDBDefragment extends BasicFunction {
6565
new FunctionParameterSequenceType("integer", Type.INTEGER, Cardinality.EXACTLY_ONE,
6666
"The minimum number of fragmented pages required before defragmenting")
6767
},
68-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)),
68+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)),
6969
new FunctionSignature(
7070
new QName("defragment", XMLDBModule.NAMESPACE_URI, XMLDBModule.PREFIX),
7171
"Start a defragmentation run on each document which has a node in $nodes. " +
@@ -78,7 +78,7 @@ public class XMLDBDefragment extends BasicFunction {
7878
new FunctionParameterSequenceType("nodes", Type.NODE, Cardinality.ONE_OR_MORE,
7979
"The sequence of nodes from the documents to defragment"),
8080
},
81-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE))
81+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE))
8282
};
8383

8484
public XMLDBDefragment(XQueryContext context, FunctionSignature signature) {

exist-core/src/main/java/org/exist/xquery/functions/xmldb/XMLDBMove.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ public class XMLDBMove extends XMLDBAbstractCollectionManipulator {
5959
"$target-collection-uri. " +
6060
XMLDBModule.COLLECTION_URI,
6161
new SequenceType[]{ ARG_SOURCE, ARG_TARGET },
62-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE)),
62+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE)),
6363

6464
new FunctionSignature(
6565
new QName("move", XMLDBModule.NAMESPACE_URI, XMLDBModule.PREFIX),
6666
"Moves the resource $resource from the collection $source-collection-uri " +
6767
"into collection $target-collection-uri. " +
6868
XMLDBModule.COLLECTION_URI,
6969
new SequenceType[]{ ARG_SOURCE, ARG_TARGET, ARG_RESOURCE },
70-
new SequenceType(Type.ITEM, Cardinality.EMPTY_SEQUENCE))
70+
new SequenceType(Type.EMPTY, Cardinality.EMPTY_SEQUENCE))
7171
};
7272

7373
public XMLDBMove(XQueryContext context, FunctionSignature signature) {

0 commit comments

Comments
 (0)