-
Notifications
You must be signed in to change notification settings - Fork 7
DINC0645325:Empty error message when large file is uploaded #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Gemini Automated Review This diff introduces significant changes to support virus scanning and versioning capabilities within a document repository. The Best Practices Review
Potential Bugs
Recommendations
Code Snippet (Improved try {
JSONObject json = new JSONObject(jsonString); //jsonString is fetched from Repo
RepoValue repoValue = new RepoValue(
json.getBoolean("virusScanEnabled"),
json.getBoolean("versionEnabled"),
json.getBoolean("disableVirusScannerForLargeFile")
);
return repoValue;
} catch (JSONException e) {
log.error("Error parsing JSON response: {}", e.getMessage(), e);
throw new RuntimeException("Failed to fetch repository data", e); // Or more specific exception
} catch (NumberFormatException e) {
log.error("Invalid number format in JSON response: {}", e.getMessage(), e);
throw new RuntimeException("Invalid repository data format", e);
} Quality Rating 6/10 Overall The changes introduce valuable functionality but require further improvements to address potential bugs and best practices violations. The thorough testing in the provided diff is positive, but the potential for issues in production code interacting with the new |
Gemini Automated Review Best Practices Review
Potential Bugs
Recommendations
RepoValue fetchRepositoryData(String repoId) {
try {
JSONObject repoInfo = getRepoInfo(repoId); // Assume this fetches JSON data
if (repoInfo.has("virusScanner") && repoInfo.has("disableVirusScannerForLargeFile")) {
boolean virusScanEnabled = repoInfo.getBoolean("virusScanner");
boolean disableForLargeFiles = repoInfo.getBoolean("disableVirusScannerForLargeFile");
// ... rest of the logic
} else {
// Handle missing keys appropriately, e.g., log a warning and return a default RepoValue
log.warn("Missing virus scanner information in repository info for repoId: {}", repoId);
return new RepoValue(false, false, false); // Or throw a custom exception
}
} catch (JSONException e) {
log.error("Error parsing repository info for repoId: {}", repoId, e);
// Handle exception, e.g., return a default RepoValue or throw a custom exception
return new RepoValue(false, false, false);
}
}
Quality Rating Overall |
Gemini Automated Review This commit introduces significant changes to enhance repository versioning and virus scanning within a document management system. Key changes include the addition of a Best Practices Review
Potential Bugs
Recommendations
try {
JSONObject json = new JSONObject(response);
if (json.has("virusScanEnabled")) {
boolean virusScanEnabled = json.getBoolean("virusScanEnabled");
// ... use virusScanEnabled ...
} else {
// Handle missing key
log.warn("Key 'virusScanEnabled' missing in JSON response.");
}
// ... similar handling for other keys
} catch (JSONException e) {
log.error("Error parsing JSON response: ", e);
// Handle the exception appropriately (e.g., throw a custom exception, return a default value)
} Quality Rating 6/10 Overall The code introduces valuable features, but requires significant improvements in error handling and test robustness before merging. Addressing the prioritized recommendations is crucial to ensure stability and reliability. |
Gemini Automated Review Best Practices Review
Potential Bugs
Recommendations
// Example improved fetchRepositoryData method (Illustrative)
public RepoValue fetchRepositoryData(String repoUrl) {
try {
// ... existing code ...
JSONObject json = JSON.parse(jsonString); // Use a robust JSON library like Jackson
if (json.has("virusScanEnabled") && json.has("versionEnabled") && json.has("largeFileHandling")) {
return new RepoValue(json.getBoolean("virusScanEnabled"), json.getBoolean("versionEnabled"), json.getString("largeFileHandling"));
} else {
throw new JSONException("Missing required fields in repository data");
}
} catch (JSONException e) {
log.error("Error parsing repository data: {}", e.getMessage());
throw new ServiceException("Failed to fetch repository data", e); // Or a custom exception
}
}
Quality Rating Overall |
Gemini Automated Review Best Practices Review
Potential Bugs
Recommendations
RepoValue fetchRepositoryData(String repoId) {
try {
// ... existing code ...
} catch (JSONException e) {
log.error("Error parsing repository data for {}: {}", repoId, e.getMessage());
return null; // Or throw a custom exception
} catch (IOException e){
log.error("IO error fetching repository data for {}: {}", repoId, e.getMessage());
return null; // Or throw a custom exception
}
}
Quality Rating Overall |
An error occurred while generating the final review. Partial reviews are below: Error: Could not generate review for this chunk due to: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [404 Not Found] Publisher Model Error: Could not generate review for this chunk due to: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [404 Not Found] Publisher Model |
An error occurred while generating the final review. Partial reviews are below: Error: Could not generate review for this chunk due to: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [404 Not Found] Publisher Model Error: Could not generate review for this chunk due to: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [404 Not Found] Publisher Model |
Describe your changes
Currently if the repository onboarded is a virus enabled one and if i try to upload a file with size greater than 400 MB it should throw an error but file is getting uploaded successfully because of chunking and this is not the behaviour in application option an error comes up .
Same has been done here, if file size greater than 400MB and virus scan enabled and skipVirusScanForLargeFile is false error is thrown.
If skipVirusScanForLargeFile is set to true and virus scan enabled is true the errr is not thrown file is uploaded as chunks
Any documentation
Type of change
Please delete options that are not relevant.
Checklist before requesting a review
Upload Screenshots/lists of the scenarios tested
Scenarios tested
2)Repo is non versioned virus enabled and disableVirusScannerForLargeFile is false : Uploaded file greater than 400 M error message appears
3)Repo is non versioned virus enabled true and disableVirusScannerForLargeFile is true : Uploaded file greater than 400 M file gets uploaded
4)Repo is non versioned virus enabled true and disableVirusScannerForLargeFile is false : Uploaded file lesser than 400 MB upload is success
5)Repo is non versioned virus enabled true and disableVirusScannerForLargeFile is true : Uploaded file lesser than 400 MB upload is success