Browse Source

- Fixed some case issues related to JProbe directories under Solaris.

- SourceFile attribute does not always exists in the bytecode, so take care of it.

PR: 5217
Submitted by: garrick.olson@aceva.com (Garrick Olson)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270060 13f79535-47bb-0310-9956-ffa450edef68
master
Stephane Bailliez 23 years ago
parent
commit
ec8358d87b
4 changed files with 11 additions and 7 deletions
  1. +4
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  4. +5
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java

+ 4
- 3
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java View File

@@ -160,7 +160,7 @@ public class CovMerge extends Task {
if (home == null || !home.isDirectory()) {
throw new BuildException("Invalid home directory. Must point to JProbe home directory");
}
home = new File(home, "Coverage");
home = new File(home, "coverage");
File jar = new File(home, "coverage.jar");
if (!jar.exists()) {
throw new BuildException("Cannot find Coverage directory: " + home);
@@ -207,16 +207,17 @@ public class CovMerge extends Task {
// last file is the output snapshot
pw.println(project.resolveFile(tofile.getPath()));
pw.flush();
return file;
} catch (IOException e) {
throw new BuildException("I/O error while writing to " + file, e);
} finally {
if (fw != null) {
try {
fw.close();
} catch (IOException ignored) {
}
}
throw new BuildException("I/O error while writing to " + file, e);
}
return file;
}

/** create a temporary file in the current dir (For JDK1.1 support) */


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java View File

@@ -256,7 +256,7 @@ public class CovReport extends Task {
if (home == null) {
throw new BuildException("'home' attribute must be set to JProbe home directory");
}
home = new File(home, "Coverage");
home = new File(home, "coverage");
File jar = new File(home, "coverage.jar");
if (!jar.exists()) {
throw new BuildException("Cannot find Coverage directory: " + home);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java View File

@@ -297,7 +297,7 @@ public class Coverage extends Task {
if (home == null || !home.isDirectory()) {
throw new BuildException("Invalid home directory. Must point to JProbe home directory");
}
home = new File(home, "Coverage");
home = new File(home, "coverage");
File jar = new File(home, "coverage.jar");
if (!jar.exists()) {
throw new BuildException("Cannot find Coverage directory: " + home);


+ 5
- 2
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java View File

@@ -210,7 +210,7 @@ public class XMLReport {
DocumentBuilder dbuilder = newBuilder();
InputSource is = new InputSource(new FileInputStream(file));
if (jprobeHome != null) {
File dtdDir = new File(jprobeHome, "Dtd");
File dtdDir = new File(jprobeHome, "dtd");
is.setSystemId("file:///" + dtdDir.getAbsolutePath() + "/");
}
report = dbuilder.parse(is);
@@ -324,7 +324,10 @@ public class XMLReport {
// create the class element
Element classElem = report.createElement("class");
classElem.setAttribute("name", classFile.getName());
classElem.setAttribute("source", classFile.getSourceFile());
// source file possibly does not exist in the bytecode
if ( null != classFile.getSourceFile() ){
classElem.setAttribute("source", classFile.getSourceFile());
}
// create the cov.data elem
Element classData = report.createElement("cov.data");
classElem.appendChild(classData);


Loading…
Cancel
Save