[Bug]: Get mails (POP3/IMAP)" action resets IMAP Retrieve setting to "Get all messages" and fails XML serialization
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 476
- Avg merge
- 18h 32m
- Merged PRs (30d)
- 216
Description
### Apache Hop version?
2.19.0
### Java version?
21
### Operating system
Windows
### What happened?
In the workflow action **Get mails (POP3/IMAP)**, when configured with the **IMAP** protocol, changing the **Retrieve** option in the **Settings** tab (for example, selecting **"Get unread messages"**) fails to persist across sessions. After saving, closing the workflow tab, and reopening it, the setting reverts to **"Get all messages"**.
As a direct consequence, running the workflow retrieves all messages instead of filtering only unread ones. Additionally, attempting to deserialize or inspect the generated XML in previous Hop versions results in a `NumberFormatException: For input string: "ignore"`.
---
### Step-by-Step Guide to Reproduce
Follow these exact steps from a clean session:
#### Step 1: Create a New Workflow
1. Launch Hop GUI.
2. In the file navigation or menu bar, click **File** -> **New** -> **Workflow**.
#### Step 2: Add Required Actions
1. From the actions palette on the left, drag and drop the **Start** action onto the workflow canvas.
2. Drag and drop the **Get mails (POP3/IMAP)** action onto the workflow canvas.
3. Hover over **Start**, click and drag the connecting hop line to **Get mails (POP3/IMAP)** to establish an unconditional connection.
#### Step 3: Configure IMAP Protocol
1. Double-click the **Get mails (POP3/IMAP)** action icon to open its configuration dialog.
2. On the **General** tab:
* Keep the default action name or set any name (e.g., `Get mails (POP3/IMAP)`).
* In the **Protocol** dropdown, select **IMAP**.
#### Step 4: Configure Retrieve Setting
1. Switch to the **Settings** tab at the top of the dialog.
2. Under the **IMAP settings** section:
* Locate the **Retrieve** dropdown field.
* Change its value from the default `Get all messages` to **`Get unread messages`**.
* Leave all other optional fields (such as server credentials or folders) as needed for reproduction.
#### Step 5: Save and Close Workflow
1. Click **OK** at the bottom of the dialog to apply the changes.
2. Save the workflow via **File** -> **Save** (or press `Ctrl + S`), naming it `test_get_mail_issue.hwf`.
3. Close the active workflow tab by clicking the **x** on the editor tab title.
#### Step 6: Reopen and Verify the Regression
1. Open the saved file `test_get_mail_issue.hwf` via **File** -> **Open**.
2. Double-click the **Get mails (POP3/IMAP)** action to open the dialog.
3. Switch to the **Settings** tab and inspect the **Retrieve** dropdown under **IMAP settings**.
---
### Expected Behavior vs. Actual Behavior
| Criteria | Expected Behavior | Actual Behavior |
| :--- | :--- | :--- |
| **Persisted Setting** | The **Retrieve** dropdown remains **`Get unread messages`**. | The dropdown reverts back to **`Get all messages`**. |
| **Pipeline/Workflow Execution** | The step connects to the IMAP server and only processes messages marked unread. | The step pulls **all messages** from the inbox, ignoring the unread filter. |
| **Backward Compatibility / XML Parsing** | Valid XML structure for serialization and deserialization. | Fails with `NumberFormatException: For input string: "ignore"` when parsed or loaded across certain versions. |
---
### Stack Trace / Error Log (Backward Compatibility Failure)
When a workflow containing the **Get mails (POP3/IMAP)** action configured with **IMAP** and **Retrieve: Get unread messages** is created and saved in **Apache Hop 2.13.0** (where it persists and reopens normally), attempting to open this same workflow file in **Apache Hop 2.19.0** completely fails to load with the following error dialog and stack trace:
```text
Unable to load workflow info from XML node
Unable to instantiate a new instance of class org.apache.hop.workflow.action.ActionMeta: make sure there is an empty public constructor available to allow XML de-serialization
For input string: "ignore"
Root cause: NumberFormatException: For input string: "ignore"
```
---
### Visual Evidence
* **Screenshot A (Configuration):** Shows IMAP settings with `Retrieve` set to `Get unread messages`.
* **Screenshot B (Post-Reopen):** Shows IMAP settings automatically reverted to `Get all messages` after reloading the workflow file.
### Issue Priority
Priority: 1
### Issue Component
Component: Workflows, Component: Actions
Contributor guide
Research direction
Start with the Get mails (POP3/IMAP) workflow action and the org.apache.hop.workflow.action.ActionMeta XML deserialization path. Reproduce the IMAP Retrieve setting failure by saving, closing, and reopening a workflow, and inspect the reported NumberFormatException involving "ignore". Done means the selected retrieval mode persists, unread messages are filtered, and affected workflow XML loads successfully across the described versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100