Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RAZIN BIN NAZARUDIN
U2102127
GROUP DEADLINE DOMINATOR
Bundles that I change:
1.core
2.automation
3.media
4.audio
5.OAuth2
6.JAAS
7.auth
8.marketplace
9.karaf
10.eclipse
11.addon
12.base
✅ Pull Request: Assignment 1 — Legacy System Reengineering
1. Addressed Issue
The legacy system contained multiple critical maintainability issues across several bundles, including:
Missing or outdated JavaDoc documentation (e.g.,
org.openhab.core.automation, marketplace, eclipse addon).automationmarketplaceWeak or generic exception handling leading to silent failures.
module.mediaauth.jaasResource leaks (e.g.,
InputStreamnot closed in KAR handler).karafHard-coded constants and magic values reducing extensibility.
eclipseIncomplete or unimplemented methods (
UnsupportedOperationExceptionstubs).addonMissing null-safety checks and absence of input validation.
oauth2clientThese issues caused low maintainability, low testability, unclear system behavior, and potential runtime risks such as NPEs and resource leaks.
2. What I Have Reengineered
Across the assigned modules, I performed non-breaking, maintainability-focused improvements including:
✅ Added Comprehensive JavaDoc Documentation
audio✅ Improved Exception Handling
catch (Exception e)with specific exception types (IOException,JsonSyntaxException,AudioException, etc.).module.mediamarketplace✅ Fixed Resource Leaks & Cleanup Issues
try-with-resourcesto ensureInputStreams and file streams are properly closed (e.g., KAR file caching logic).karaf✅ Extracted Magic Numbers & Hard-coded Strings into Constants
eclipse✅ Enhanced Null Safety & Input Validation
oauth2client✅ Improved Logging & Observability
karafmarketplace✅ Applied Formatting & Code Cleanup
spotless:apply.All improvements were safe, backward compatible, and did not alter existing system behavior.
3. Reengineering Strategy or Approach Used (1.5 marks)
The reengineering followed the SME-approved incremental and low-risk approach, aligning with industry best practices and the system's constraints.
Approach Summary
Why this strategy was chosen
automationauth.jaas4. Impact of Changes
The completed reengineering work produced several concrete improvements:
✔ Maintainability Increased Significantly
karafeclipse✔ Debuggability & Error Clarity Improved
✔ Eliminated Resource Leaks
InputStreamleak prevents potential file locks and memory issues.✔ Improved Code Readability
✔ Increased Safety & Robustness
✔ CI/CD Compatibility
No functional behavior was changed
System behavior, API signatures, and addon logic remain unchanged.