-
Notifications
You must be signed in to change notification settings - Fork 271
update judge logic for v2 #513
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the judge logic for v2 in the DownloadTask by separating the resource copying functionality into version-specific methods and implementing proper logic to determine which version to use.
- Separates the
copyFromResource
method into v1 and v2 variants with distinct functionality - Adds logic to detect v2 format based on the presence of
copiesv2
keys - Reorganizes the copies processing to handle v1 and v2 formats in separate code paths
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
param.unzipDirectory.mkdirs(); | ||
HashMap<String, ArrayList<File>> copyList = new HashMap<String, ArrayList<File>>(); | ||
HashMap<String, ArrayList<File>> copiesv2List = new HashMap<String, ArrayList<File>>(); | ||
Boolean isV2 = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use primitive boolean
instead of wrapper Boolean
for simple flag variables. This avoids unnecessary object allocation and potential null pointer issues.
Boolean isV2 = false; | |
boolean isV2 = false; |
Copilot uses AI. Check for mistakes.
if (from.isEmpty()) { | ||
from = to; | ||
Iterator<?> keysV2 = copiesv2.keys(); | ||
if(keysV2.hasNext()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing space after if
keyword. Consider using if (keysV2.hasNext())
for consistent code formatting.
if(keysV2.hasNext()){ | |
if (keysV2.hasNext()) { |
Copilot uses AI. Check for mistakes.
String canonicalPath = toFile.getCanonicalPath(); | ||
if (!canonicalPath.startsWith(param.unzipDirectory.getCanonicalPath() + File.separator)) { | ||
throw new SecurityException("Illegal name: " + to); | ||
}else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing space before opening brace. Consider using } else {
for consistent code formatting.
}else{ | |
} else { |
Copilot uses AI. Check for mistakes.
if(isV2){ | ||
copyFromResourceV2(copiesv2List); | ||
}else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing spaces around if
and else
keywords. Consider using if (isV2) {
and } else {
for consistent code formatting.
if(isV2){ | |
copyFromResourceV2(copiesv2List); | |
}else{ | |
if (isV2) { | |
copyFromResourceV2(copiesv2List); | |
} else { |
Copilot uses AI. Check for mistakes.
No description provided.