You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hop.apache.org by "leehaut (via GitHub)" <gi...@apache.org> on 2026/09/15 05:51:06 UTC
[PR] Fix#8328 Get mails (POP3/IMAP) IMAP Retrieve persistence and 2.13 XML load (hop)
leehaut opened a new pull request, #8379:
URL: https://github.com/apache/hop/pull/8379
Fix https://github.com/apache/hop/issues/8328
## Summary
- Persist IMAP Retrieve / action type / after-get / received-date condition on the Get mails (POP3/IMAP) action using `@HopMetadataProperty` and `IIntCodeConverter`s, so values such as "Get unread messages" survive save/reopen.
- Load Hop 2.13 string codes (`imaplistunread`, `ignore`, `nothing`, `get`) and Hop 2.19 integer indexes without `NumberFormatException: For input string: "ignore"`.
- Cover the getpop package with serialization, load/save, metadata converter, and MailConnection tests; update deserialize/mail integration workflows and the Get mails user-manual page.
## Test plan
- [x] `./mvnw -pl plugins/misc/mail -am test -Dtest=ActionGetPOPSerializationTest,ActionGetPOPTest,MailConnectionMetaTest,WorkflowActionGetPOPLoadSaveTest,WorkflowEntryGetPOPTest,MailConnectionTest,MailConnectionFilterTest`
- [x] Open a workflow, set Get mails protocol to IMAP and Retrieve to **Get unread messages**, save, close the tab, reopen: the setting stays unread.
- [x] Open a Hop 2.13 workflow with `<conditionreceiveddate>ignore</conditionreceiveddate>` and `<valueimaplist>imaplistunread</valueimaplist>`: it loads, and Retrieve is unread.
- [x] Change Retrieve to another IMAP option, save and reopen: the new value is kept.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix#8328 Get mails (POP3/IMAP) IMAP Retrieve persistence and 2.13 XML load (hop)
Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on code in PR #8379:
URL: https://github.com/apache/hop/pull/8379#discussion_r4028616625
##########
plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMeta.java:
##########
@@ -130,69 +131,48 @@ public static String getValueImapListCode(int i) {
return valueIMAPListCode[i];
}
- public static int getConditionByCode(String tt) {
- if (tt == null) {
+ /**
+ * Resolve a persisted code. Accepts the historical string codes ({@code ignore}, {@code
+ * imaplistunread}, {@code nothing}, …) and integer indexes written by Hop 2.19 before converters
+ * were added.
+ */
Review Comment:
**[suggestion]** The `parseCodeOrInt` javadoc narrates version history (“integer indexes written by Hop 2.19 before converters were added”) instead of stating the current contract.
**Suggestion:** Keep a short contract comment, for example that the value may be a code from the given table or a decimal index in range; drop the 2.19/converter origin story.
##########
plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMeta.java:
##########
@@ -130,69 +131,48 @@ public static String getValueImapListCode(int i) {
return valueIMAPListCode[i];
}
- public static int getConditionByCode(String tt) {
- if (tt == null) {
+ /**
+ * Resolve a persisted code. Accepts the historical string codes ({@code ignore}, {@code
+ * imaplistunread}, {@code nothing}, …) and integer indexes written by Hop 2.19 before converters
+ * were added.
+ */
+ static int parseCodeOrInt(String value, String[] codes) {
+ if (StringUtils.isBlank(value)) {
return 0;
}
-
- for (int i = 0; i < conditionDateCode.length; i++) {
- if (conditionDateCode[i].equalsIgnoreCase(tt)) {
+ String trimmed = value.trim();
+ for (int i = 0; i < codes.length; i++) {
+ if (codes[i].equalsIgnoreCase(trimmed)) {
return i;
}
}
+ if (StringUtils.isNumeric(trimmed)) {
+ int parsed = Integer.parseInt(trimmed);
+ if (parsed >= 0 && parsed < codes.length) {
+ return parsed;
Review Comment:
**[suggestion]** `parseCodeOrInt` is meant to be total over persisted strings (unknown → 0) so XML load never throws. After `StringUtils.isNumeric`, `Integer.parseInt` can still throw `NumberFormatException`: values larger than `Integer.MAX_VALUE`, or Unicode digits that `Character.isDigit` accepts but `parseInt` does not. That exception is wrapped by `XmlMetadataUtil.deSerializeInteger` and fails the whole workflow load — the same class of failure this PR is fixing for `"ignore"`.
**Suggestion:** Do not let the converter throw. Use `NumberUtils.toInt(trimmed, -1)` (already on the Lang3 classpath) or catch `NumberFormatException` and return 0, matching the out-of-range integer path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix#8328 Get mails (POP3/IMAP) IMAP Retrieve persistence and 2.13 XML load (hop)
Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters merged PR #8379:
URL: https://github.com/apache/hop/pull/8379
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org