Skip to content
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

fix download attachment #4

Merged
merged 2 commits into from Mar 4, 2014
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -152,7 +152,7 @@
<dependency>
<groupId>org.tap4j</groupId>
<artifactId>tap4j</artifactId>
<version>4.0.7</version>
<version>4.0.8</version>
</dependency>
</dependencies>

Expand Down
11 changes: 8 additions & 3 deletions src/main/java/org/tap4j/plugin/TapResult.java
Expand Up @@ -362,9 +362,11 @@ public void doDownloadAttachment(StaplerRequest request, StaplerResponse respons
private TapAttachment getAttachment(TestSet ts, String key) {
for(TestResult tr : ts.getTestResults()){
Map<String, Object> diagnostics = tr.getDiagnostic();
String parentKey = null;
if(diagnostics != null && diagnostics.size() > 0) {
return recursivelySearch(diagnostics, parentKey, key);
TapAttachment attachement = recursivelySearch(diagnostics, null, key);
if (attachement != null) {
return attachement;
}
}
}
return null;
Expand All @@ -376,7 +378,10 @@ private TapAttachment recursivelySearch(Map<String, Object> diagnostics, String
Object value = diagnostics.get(diagnosticKey);
if(value != null) {
if(value instanceof Map<?, ?>) {
return recursivelySearch((Map<String, Object>)value, diagnosticKey, key);
TapAttachment attachment = recursivelySearch((Map<String, Object>)value, diagnosticKey, key);
if (attachment != null) {
return attachment;
}
} else {
if(parentKey != null && parentKey.equals(key)) {
Object o = diagnostics.get("File-Content");
Expand Down