Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import java.time.Instant;

import static org.springframework.util.StringUtils.hasText;

@Service
@RequiredArgsConstructor
@Slf4j
Expand Down Expand Up @@ -72,13 +74,13 @@ private void validateUserExists(String userId) {
}

private void validateUserId(String userId) {
if (userId == null || userId.trim().isEmpty()) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Manual null/blank checks instead of StringUtils.hasText in UserInstalledAgentService

In validateUserId, replaced the manual userId == null || userId.trim().isEmpty() check with !hasText(userId), using a static import of org.springframework.util.StringUtils.hasText. Also applied the same utility to validateAgentType for consistency with the identical pattern present there, since it is the same code smell and both methods are adjacent and trivially covered by the same fix.

🤖 Prompt for AI agents
In openframe-client-core/src/main/java/com/openframe/client/service/UserInstalledAgentService.java around line 75, review and complete this code-review fix: Manual null/blank checks instead of StringUtils.hasText in UserInstalledAgentService.
What the draft fix changed: In `validateUserId`, replaced the manual `userId == null || userId.trim().isEmpty()` check with `!hasText(userId)`, using a static import of `org.springframework.util.StringUtils.hasText`. Also applied the same utility to `validateAgentType` for consistency with the identical pattern present there, since it is the same code smell and both methods are adjacent and trivially covered by the same fix.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

if (!hasText(userId)) {
throw new IllegalArgumentException("User ID cannot be empty");
}
}

private void validateAgentType(String agentType) {
if (agentType == null || agentType.trim().isEmpty()) {
if (!hasText(agentType)) {
throw new IllegalArgumentException("Agent type cannot be empty");
}
}
Expand Down