Skip to content

Commit c3552ee

Browse files
committed
[bugfix] Mail Module XQuery functions when using Jakarta Mail were incorrectly mixing xs:integer and xs:long for handles, should be xs:long
1 parent b39c493 commit c3552ee

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

extensions/modules/mail/src/main/java/org/exist/xquery/modules/mail/MailFolderFunctions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class MailFolderFunctions extends BasicFunction
6363
"Opens a mail folder.",
6464
new SequenceType[]
6565
{
66-
new FunctionParameterSequenceType( "mail-store-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The mail store handle retrieved from mail:get-mail-store()" ),
66+
new FunctionParameterSequenceType( "mail-store-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The mail store handle retrieved from mail:get-mail-store()" ),
6767
new FunctionParameterSequenceType( "foldername", Type.STRING, Cardinality.EXACTLY_ONE, "The name of the folder to open" )
6868
},
6969
new FunctionReturnSequenceType( Type.LONG, Cardinality.ZERO_OR_ONE, "an xs:long representing the folder handle." )
@@ -74,7 +74,7 @@ public class MailFolderFunctions extends BasicFunction
7474
"Closes a mail folder.",
7575
new SequenceType[]
7676
{
77-
new FunctionParameterSequenceType( "mail-folder-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The mail folder handle retrieved from mail:get-mail-folder()" ),
77+
new FunctionParameterSequenceType( "mail-folder-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The mail folder handle retrieved from mail:get-mail-folder()" ),
7878
new FunctionParameterSequenceType( "expunge", Type.BOOLEAN, Cardinality.EXACTLY_ONE, "A boolean that specifies whether to expunge the folder on close." )
7979
},
8080
new SequenceType( Type.ITEM, Cardinality.EMPTY_SEQUENCE )
@@ -128,7 +128,7 @@ private Sequence getMailFolder( Sequence[] args, Sequence contextSequence ) thro
128128

129129
// save the folder and return the handle of the folder
130130

131-
return( new IntegerValue( this, MailModule.storeFolder( context, folder ) ) );
131+
return( new IntegerValue( this, MailModule.storeFolder( context, folder ), Type.LONG ) );
132132
}
133133

134134
private Sequence closeMailFolder( Sequence[] args, Sequence contextSequence ) throws XPathException

extensions/modules/mail/src/main/java/org/exist/xquery/modules/mail/MailSessionFunctions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathEx
9090

9191
// store the session and return the handle of the session
9292

93-
return new IntegerValue( this, MailModule.storeSession( context, session ) );
93+
return new IntegerValue( this, MailModule.storeSession( context, session ), Type.LONG );
9494
}
9595
}

extensions/modules/mail/src/main/java/org/exist/xquery/modules/mail/MailStoreFunctions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class MailStoreFunctions extends BasicFunction
6262
"Opens a mail store. Host/User/Password/Protocol values will be obtained from the session.",
6363
new SequenceType[]
6464
{
65-
new FunctionParameterSequenceType( "mail-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The JavaMail session handle retrieved from mail:get-mail-session()" )
65+
new FunctionParameterSequenceType( "mail-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The JavaMail session handle retrieved from mail:get-mail-session()" )
6666
},
6767
new FunctionReturnSequenceType( Type.LONG, Cardinality.ZERO_OR_ONE, "an xs:long representing the store handle." )
6868
),
@@ -72,7 +72,7 @@ public class MailStoreFunctions extends BasicFunction
7272
"Closes a mail store.",
7373
new SequenceType[]
7474
{
75-
new FunctionParameterSequenceType( "mail-store-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The mail store handle retrieved from mail:get-mail-store()" )
75+
new FunctionParameterSequenceType( "mail-store-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The mail store handle retrieved from mail:get-mail-store()" )
7676
},
7777
new SequenceType( Type.ITEM, Cardinality.EMPTY_SEQUENCE )
7878
)
@@ -128,7 +128,7 @@ private Sequence getMailStore( Sequence[] args, Sequence contextSequence ) throw
128128

129129
// save the store and return the handle of the store
130130

131-
return( new IntegerValue( this, MailModule.storeStore( context, store ) ) );
131+
return( new IntegerValue( this, MailModule.storeStore( context, store ), Type.LONG ) );
132132
}
133133

134134
private Sequence closeMailStore( Sequence[] args, Sequence contextSequence ) throws XPathException

extensions/modules/mail/src/main/java/org/exist/xquery/modules/mail/MessageFunctions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class MessageFunctions extends BasicFunction {
7272
new SequenceType[]
7373
{
7474

75-
new FunctionParameterSequenceType("message-list-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The message list handle retrieved from mail:get-message-list() or mail:search-message-list()"),
75+
new FunctionParameterSequenceType("message-list-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The message list handle retrieved from mail:get-message-list() or mail:search-message-list()"),
7676
new FunctionParameterSequenceType("message-numbers", Type.INTEGER, Cardinality.ZERO_OR_MORE, "The messages to retrieve using the numbers from the message-list '//mail:message/@number' ")
7777

7878
},

extensions/modules/mail/src/main/java/org/exist/xquery/modules/mail/MessageListFunctions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class MessageListFunctions extends BasicFunction
8989
"Returns a message list of all messages in a folder.",
9090
new SequenceType[]
9191
{
92-
new FunctionParameterSequenceType( "mail-folder-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The mail folder handle retrieved from mail:get-mail-folder()" )
92+
new FunctionParameterSequenceType( "mail-folder-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The mail folder handle retrieved from mail:get-mail-folder()" )
9393
},
9494
new FunctionReturnSequenceType( Type.LONG, Cardinality.ZERO_OR_ONE, "an xs:long representing the message list handle." )
9595
),
@@ -107,7 +107,7 @@ public class MessageListFunctions extends BasicFunction
107107
"The format string should conform to Java SimpleDateFormat specifications and the date string must conform to the specified format string.",
108108
new SequenceType[]
109109
{
110-
new FunctionParameterSequenceType( "mail-folder-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The mail folder handle retrieved from mail:get-mail-folder()" ),
110+
new FunctionParameterSequenceType( "mail-folder-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The mail folder handle retrieved from mail:get-mail-folder()" ),
111111
new FunctionParameterSequenceType( "search-parameters", Type.ELEMENT, Cardinality.EXACTLY_ONE, "The xml fragment defining the search terms" )
112112
},
113113
new FunctionReturnSequenceType( Type.LONG, Cardinality.ZERO_OR_ONE, "an xs:long representing the message list handle." )
@@ -118,7 +118,7 @@ public class MessageListFunctions extends BasicFunction
118118
"Returns a message list of all messages in a folder as XML. If there are no messages in the list, an empty sequence will be returned",
119119
new SequenceType[]
120120
{
121-
new FunctionParameterSequenceType( "message-list-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The message list handle retrieved from mail:get-message-list() or mail:search-message-list()" ),
121+
new FunctionParameterSequenceType( "message-list-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The message list handle retrieved from mail:get-message-list() or mail:search-message-list()" ),
122122
new FunctionParameterSequenceType( "include-headers", Type.BOOLEAN, Cardinality.EXACTLY_ONE, "A boolean specifying whether to include message headers" )
123123
},
124124
new FunctionReturnSequenceType( Type.ELEMENT, Cardinality.ZERO_OR_ONE, "the list of all messages in a folder as XML" )
@@ -129,7 +129,7 @@ public class MessageListFunctions extends BasicFunction
129129
"Closes a message list.",
130130
new SequenceType[]
131131
{
132-
new FunctionParameterSequenceType( "message-list-handle", Type.INTEGER, Cardinality.EXACTLY_ONE, "The message list handle retrieved from mail:get-message-list() or mail:search-message-list()" )
132+
new FunctionParameterSequenceType( "message-list-handle", Type.LONG, Cardinality.EXACTLY_ONE, "The message list handle retrieved from mail:get-message-list() or mail:search-message-list()" )
133133
},
134134
new SequenceType( Type.ITEM, Cardinality.EMPTY_SEQUENCE )
135135
)
@@ -207,7 +207,7 @@ private Sequence getMessageList( Sequence[] args, Sequence contextSequence ) thr
207207

208208
// save the message list and return the handle of the message list
209209

210-
return( new IntegerValue( this, MailModule.storeMessageList( context, msgList, folderHandle ) ) );
210+
return( new IntegerValue( this, MailModule.storeMessageList( context, msgList, folderHandle ), Type.LONG ) );
211211
}
212212

213213
private Sequence searchMessageList( Sequence[] args, Sequence contextSequence ) throws XPathException
@@ -239,7 +239,7 @@ private Sequence searchMessageList( Sequence[] args, Sequence contextSequence )
239239

240240
// save the message list and return the handle of the message list
241241

242-
return( new IntegerValue( this, MailModule.storeMessageList( context, msgList, folderHandle ) ) );
242+
return( new IntegerValue( this, MailModule.storeMessageList( context, msgList, folderHandle ), Type.LONG ) );
243243
}
244244

245245
private void prefetchMessages( Folder folder, Message[] msgList ) throws MessagingException

0 commit comments

Comments
 (0)