This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Commit e271463
committed
refactor: extract shared getConnection() in Util.java to eliminate duplication
The getAppConnection() and getAzialaConnection() methods contained
identical logic for reading env vars, validating the host, loading
the driver, and opening a connection — differing only in the database
name.
Extracted a private getConnection(String database) method that:
- Centralizes credential lookup and host validation
- Validates the database name against injection (alphanumeric + underscore only)
- Reduces duplication from ~20 lines to 2 one-liner delegations
This makes adding new database connections a single-line call and
eliminates the risk of the two methods drifting out of sync.1 parent 1828e5a commit e271463
1 file changed
Lines changed: 28 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
63 | 83 | | |
64 | 84 | | |
65 | 85 | | |
66 | 86 | | |
67 | 87 | | |
68 | 88 | | |
69 | | - | |
70 | | - | |
| 89 | + | |
| 90 | + | |
71 | 91 | | |
72 | 92 | | |
73 | 93 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
78 | 97 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 98 | + | |
| 99 | + | |
84 | 100 | | |
85 | 101 | | |
0 commit comments