ChoiByungHo created ZEPPELIN-6245:
-------------------------------------
Summary: Improve Repository class stability and validation
Key: ZEPPELIN-6245
URL: https://issues.apache.org/jira/browse/ZEPPELIN-6245
Project: Zeppelin
Issue Type: Bug
Reporter: ChoiByungHo
Description
This improvement enhances the Repository class with comprehensive input
validation, error handling, and stability improvements to ensure robust Maven
repository configuration management.
Motivation
The current Repository class lacks proper validation and error handling, which
can lead to runtime errors and security issues when dealing with malformed or
invalid repository configurations.
Changes Made
1. Enhanced Input Validation
- Repository ID validation: Added regex pattern validation to ensure IDs
contain only alphanumeric characters, dots, underscores, and hyphens
- URL validation: Implemented URL format validation supporting HTTP, HTTPS,
and FILE protocols
- Credentials validation: Added validation to ensure both username and
password are provided together
- Proxy validation: Added comprehensive proxy configuration validation
including protocol, host, and port checks
2. Improved Error Handling
- Custom Exception: Created `RepositoryException` class for
Repository-specific errors
- JSON parsing: Enhanced error handling for malformed JSON with descriptive
error messages
- Validation errors: Comprehensive error messages for all validation failures
3. Builder Pattern Enhancements
- Method chaining: Improved builder pattern with proper validation at each
step
- Fluent API: Enhanced usability with intuitive method names and return types
4. JSON Serialization Improvements
- Robust parsing: Enhanced `fromJson()` method with comprehensive validation
- Backward compatibility: Maintained compatibility with existing JSON formats
- Error resilience: Graceful handling of invalid JSON inputs
--
This message was sent by Atlassian Jira
(v8.20.10#820010)