Skip to content

[ftp] Listener silently fails when errors occur - native log.error() calls are not visible #8655

@niveathika

Description

@niveathika

Problem

Native side log.error() calls in the FTP module are disabled/not visible to users, causing the FTP listener to silently fail in various error scenarios. Errors were being logged but users had no way to see them.

Solution

Replace log.error() calls in catch blocks with creating a BError and calling printStackTrace() which outputs Ballerina-formatted errors that are visible to users.

Files affected

  • FtpListener.java - 4 locations
  • FtpContentCallbackHandler.java - 7 locations
  • FormatMethodsHolder.java - Add upfront regex pattern validation during listener initialization

Changes Required

  1. Error Printing: In catch blocks that were using log.error(message, exception), change to:

    FtpUtil.createError(message, exception, FtpConstants.FTP_ERROR).printStackTrace();
  2. BError Results: When a method returns a BError, call ((BError) result).printStackTrace() instead of log.error()

  3. Pattern Validation: Validate @ftp:FunctionConfig.fileNamePattern regex patterns during FormatMethodsHolder initialization rather than catching errors at runtime

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions