Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ grievanceAllocationRetryConfiguration=3
logging.path=logs/
logging.file.name=logs/common-api.log

video-call-url=https://vc.piramalswasthya.org/
video-call-url=https://vc.piramalswasthya.org/?
jibri.output.path=/srv/jibri/recordings
video.recording.path=/srv/recordings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,23 @@ public class VideoCallServiceImpl implements VideoCallService {
@Autowired
private VideoCallMapper videoCallMapper;

@Value("${video-call-url}")
private String meetingLink;

private boolean isLinkSent = false;
private String consultationStatus = "Not Initiated";

@Value("${video-call-url}")
private String jitsiLink;

public VideoCallServiceImpl() {
// this.jitsiLink = ConfigProperties.getPropertyByName("video-call-url");
// logger.info("Jitsi Link fetched: " + this.jitsiLink);
}

@Override
public String generateMeetingLink() {
meetingLink=jitsiLink+RandomStringUtils.randomAlphanumeric(8);
logger.info("Jitsi Link: " + jitsiLink);
meetingLink=jitsiLink+"m="+RandomStringUtils.randomAlphanumeric(8);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical bug: Using uninitialized variable instead of the populated field.

The code is using the uninitialized jitsiLink variable instead of the meetingLink field that's populated from properties via @Value. Since jitsiLink is null, this will result in "nullm=XXXXXXXX" instead of the intended URL.

Apply this fix to use the correct variable:

-meetingLink=jitsiLink+"m="+RandomStringUtils.randomAlphanumeric(8);
+meetingLink = meetingLink + "m=" + RandomStringUtils.randomAlphanumeric(8);

Additional considerations:

  1. Thread safety: Modifying the field in a service method creates race conditions in multi-threaded environments
  2. Security: Consider using a longer, cryptographically secure meeting ID
  3. Design: The field serves dual purposes (input/output) which is confusing

Consider this alternative approach that addresses thread safety:

-meetingLink=jitsiLink+"m="+RandomStringUtils.randomAlphanumeric(8);
-logger.info("Meeting link: " + meetingLink);
-return meetingLink;
+String generatedLink = meetingLink + "m=" + RandomStringUtils.randomAlphanumeric(8);
+logger.info("Meeting link: " + generatedLink);
+return generatedLink;
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
meetingLink=jitsiLink+"m="+RandomStringUtils.randomAlphanumeric(8);
meetingLink = meetingLink + "m=" + RandomStringUtils.randomAlphanumeric(8);

logger.info("Meeting link: " + meetingLink);
return meetingLink;
}
Expand Down
Loading