Author: asoldano
Date: 2014-06-18 11:15:40 -0400 (Wed, 18 Jun 2014)
New Revision: 18745
Modified:
projects/shrinkwrapConverter/src/main/java/processor/CodeBlockGenerator.java
Log:
Fix a couple of bugs
Modified: projects/shrinkwrapConverter/src/main/java/processor/CodeBlockGenerator.java
===================================================================
---
projects/shrinkwrapConverter/src/main/java/processor/CodeBlockGenerator.java 2014-06-18
10:09:08 UTC (rev 18744)
+++
projects/shrinkwrapConverter/src/main/java/processor/CodeBlockGenerator.java 2014-06-18
15:15:40 UTC (rev 18745)
@@ -61,14 +61,22 @@
if (archive instanceof JarDeclaration) {
JarDeclaration jar = (JarDeclaration)archive;
for (String clazz : getClassesFromFilesetsOrClasses(jar.getFilesets())) {
- sb.append(" .addClass(");
- sb.append(clazz);
- sb.append(")\n");
+ if (clazz.endsWith(".class")) {
+ sb.append(" .addClass(");
+ sb.append(clazz);
+ sb.append(")\n");
+ } else {
+ sb.append(" .addAsResource(\"");
+ sb.append(clazz);
+ sb.append("\")\n");
+ }
}
for (Entry<String, List<String>> entry :
resolveWebOrMetaInfRes(jar.getMetaInfItems()).entrySet()) {
for (String file : entry.getValue()) {
sb.append(" .addAsManifestResource(new
File(getTestResourcesDir() + \"");
sb.append(entry.getKey());
+ sb.append(File.separator);
+ sb.append(file);
sb.append("\"), \"");
sb.append(file);
sb.append("\")\n");
@@ -77,15 +85,23 @@
} else if (archive instanceof WarDeclaration) {
WarDeclaration war = (WarDeclaration)archive;
for (String clazz : getClassesFromFilesetsOrClasses(war.getClasses())) {
- sb.append(" .addClass(");
- sb.append(clazz);
- sb.append(")\n");
+ if (clazz.endsWith(".class")) {
+ sb.append(" .addClass(");
+ sb.append(clazz);
+ sb.append(")\n");
+ } else {
+ sb.append(" .addAsResource(\"");
+ sb.append(clazz);
+ sb.append("\")\n");
+ }
}
for (Entry<String, List<String>> entry :
resolveZipFileset(war).entrySet()) {
String dir = entry.getKey();
for (String file : entry.getValue()) {
sb.append(" .addAsManifestResource(new
File(getTestResourcesDir() + \"");
sb.append(dir);
+ sb.append(File.separator);
+ sb.append(file);
sb.append("\"), \"");
sb.append(file);
sb.append("\")\n");
@@ -95,6 +111,8 @@
for (String file : entry.getValue()) {
sb.append(" .addAsWebInfResource(new File(getTestResourcesDir()
+ \"");
sb.append(entry.getKey());
+ sb.append(File.separator);
+ sb.append(file);
sb.append("\"), \"");
sb.append(file);
sb.append("\")\n");
@@ -103,9 +121,11 @@
if (war.getWebXmlFile() != null) {
sb.append(" .setWebXML(new File(getTestResourcesDir() +
\"");
sb.append(getTestResourcesDirChild(war.getWebXmlFile()));
- sb.append("\"));\n");
+ sb.append("\"))\n");
}
}
+ sb.deleteCharAt(sb.length() - 1);
+ sb.append(";\n");
sb.append(" }\n");
sb.append(" });\n");
@@ -150,7 +170,11 @@
String[] files = scanner.getIncludedFiles();
for (String f : files) {
// result.add(convertFullPathToClassName(dir, f));
- result.add(f.replace(File.separatorChar, '.'));
+ if (f.endsWith(".class")) {
+ result.add(f.replace(File.separatorChar, '.'));
+ } else {
+ result.add(f);
+ }
}
}
return result;
Show replies by date