incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1073354 [2/2] - in /incubator/easyant/tasks/trunk: mavenivy-adapters/ mavenivy-adapters/src/main/java/org/apache/easyant/ivy/ mavenivy-adapters/src/main/java/org/apache/easyant/tasks/ mavenivy-adapters/src/main/java/org/apache/easyant/task...
Date Tue, 22 Feb 2011 14:53:52 GMT
Modified: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java
(original)
+++ incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java
Tue Feb 22 14:53:51 2011
@@ -48,22 +48,22 @@ import org.w3c.dom.ls.LSSerializer;
  * There are three ways for resolving path with this task:
  * </p>
  * <ul>
- * 	<li> Automatic path resolution (default)</li>
+ *  <li> Automatic path resolution (default)</li>
  *  <li> Flat path resolution</li>
  *  <li> Relative path resolution</li>
  * </ul>
  * <p>
- * 	<b>The automatic path resolution</b> generates uri's corresponding to the
fileset paths.<br/>
+ *  <b>The automatic path resolution</b> generates uri's corresponding to the
fileset paths.<br/>
  *  <b>The flat path resolution</b> permits to specify in hard the prefix for
the path, it is useful if you want deploy the jnlp on a distant server.
  *  <p>
- *  	If the flat path value is http://myserver.com
- *  	The Task will modify the jnlp file like that:
- *  	{@literal  
- *  		<resources>
- *  			<jar href="http://myserver.com/myDependecy1.jar"/>
- *  			<jar href="http://myserver.com/myDependecy2.jar"/>
- *  		</resources>
- *  	} 
+ *      If the flat path value is http://myserver.com
+ *      The Task will modify the jnlp file like that:
+ *      {@literal  
+ *          <resources>
+ *              <jar href="http://myserver.com/myDependecy1.jar"/>
+ *              <jar href="http://myserver.com/myDependecy2.jar"/>
+ *          </resources>
+ *      } 
  *  </p>
  *  <br/>
  *  <b>The relative path resolution</b> generates path in relative corresponding
to the fileset paths.<br/>
@@ -74,257 +74,257 @@ import org.w3c.dom.ls.LSSerializer;
  */
 public class JNLPTask extends Task {
 
-	private Vector<FileSet> filesets = new Vector<FileSet>();
+    private Vector<FileSet> filesets = new Vector<FileSet>();
 
-	private static final String JAR_ENTITY = "jar";
-	private static final String RESOURCES_ENTITY = "resources";
-	private static final String DOM_IMPLEMENTATION = "LS";
-	private static final String PRETTY_PRINT_FORMAT = "format-pretty-print";
-	private static final String HREF_ATTRIBUTE = "href";
-	private static final String DOWNLOAD_ATTRIBUTE = "download";
-	private static final String MAIN_ATTRIBUTE = "main";
-
-	private String mainjar = null;
-	private String jnlpFile = null;
-	private String flatPath = null;
-	private final String tmpFile = "tmp.xml";
-	private PathType pathType = PathType.AUTOMATIC;
-
-
-
-	@Override
-	public synchronized void execute() throws BuildException {
-		validate();
-		log("JNLP modification...");
-		try {
-			DOMImplementationRegistry domRegistry = DOMImplementationRegistry
-					.newInstance();
-			DOMImplementationLS domImpl = (DOMImplementationLS) domRegistry
-					.getDOMImplementation(DOM_IMPLEMENTATION);
-
-			LSParser jnlpBuilder = domImpl.createLSParser(
-					DOMImplementationLS.MODE_SYNCHRONOUS, null);
-			Document jnlpDoc = jnlpBuilder.parseURI(jnlpFile);
-
-			Node root = null;
-			for (int i = 0; i < jnlpDoc.getChildNodes().getLength(); i++) {
-				if (jnlpDoc.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
-					root = jnlpDoc.getChildNodes().item(i);
-					break;
-				}
-			}
-			NodeList nodeList = root.getChildNodes();
-
-			if (nodeList.getLength() > 0) {
-				for (int i = 0; i < nodeList.getLength(); i++) {
-					if (RESOURCES_ENTITY.equals(nodeList.item(i).getNodeName())) {
-						root.removeChild(nodeList.item(i));
-					}
-				}
-			}
-			Element resourcesElement = jnlpDoc.createElement(RESOURCES_ENTITY);
-			root.appendChild(resourcesElement);
-
-			appendAllResources(jnlpDoc, resourcesElement);
-			LSOutput lsOutput = domImpl.createLSOutput();
-			lsOutput.setByteStream(new FileOutputStream(new File(tmpFile)));
-			LSSerializer serializer = domImpl.createLSSerializer();
-			serializer.getDomConfig().setParameter(PRETTY_PRINT_FORMAT, true);
-			serializer.write(jnlpDoc, lsOutput);
-			replaceFile(new File(tmpFile), new File(jnlpFile));
-			log("JNLP modification done !");
-		} catch (IOException e) {
-			throw new BuildException(e.getMessage());
-		} catch (ClassCastException e) {
-			throw new BuildException(e.getMessage());
-		} catch (ClassNotFoundException e) {
-			throw new BuildException(e.getMessage());
-		} catch (InstantiationException e) {
-			throw new BuildException(e.getMessage());
-		} catch (IllegalAccessException e) {
-			throw new BuildException(e.getMessage());
-		} catch (DOMException e) {
-			throw new BuildException(e.getMessage());
-		} catch (Exception e) {
-			throw new BuildException(e.getMessage());
-		}
-
-	}
-
-	private void validate() throws BuildException {
-
-		// less one resources has to be setted.
-		if (null == this.filesets || this.filesets.isEmpty()) {
-			throw new BuildException("the parameter filesets can not be empty");
-		}
-
-		// mainjar can't be empty or null
-		if (null == mainjar || "".equals(mainjar)) {
-			throw new BuildException("the parameter mainjar have to be setted");
-		}
-
-		// jnlp can't null or not exist
-		if (null == jnlpFile) {
-			throw new BuildException("the parameter jnlpFile have to be setted");
-		}
-
-		if (!(new File(jnlpFile).exists())) {
-			throw new BuildException("the jnlpFile " + jnlpFile
-					+ " doesn't exist");
-		}
-
-		if (flatPath != null) {
-			pathType = PathType.FLAT;
-		} else {
-			pathType = PathType.AUTOMATIC;
-		}
-		
-		// check if the main jar parameter is included in the resources and if
-		// the resources exists.
-		for (FileSet currentResource : filesets) {
-
-			for (File currentFile : currentResource.getDir().listFiles()) {
-
-				if (checkDirectories(currentResource, currentFile)) {
-					if (!currentFile.exists()) {
-						throw new BuildException("the resource: "
-								+ currentFile.getAbsolutePath()
-								+ " doesnot exists !");
-					}
-
-				}
-			}
-		}
-		if (!new File(mainjar).exists()) {
-			throw new BuildException("the mainJar does not exists");
-		}
-
-	}
-
-	private void replaceFile(File src, File dest) throws IOException {
-		FileUtils.delete(dest);
-		FileUtils.getFileUtils().copyFile(src, dest);
-	}
-
-	
-	private void appendElement(File currentFile, Document document,
-			Element rootElement, boolean main) throws DOMException, Exception {
-		Element currentElement = document.createElement(JAR_ENTITY);
-
-		currentElement.setAttribute(HREF_ATTRIBUTE, computePath(currentFile,
-				pathType));
-		 // TODO: the download attribute should be parameterizable => lazy or eager, from the
moment it's only "eager".
-		currentElement.setAttribute(DOWNLOAD_ATTRIBUTE, "eager");
-
-		if (main) {
-			currentElement.setAttribute(MAIN_ATTRIBUTE, "true");
-		} else {
-			currentElement.setAttribute(MAIN_ATTRIBUTE, "false");
-		}
-
-		rootElement.appendChild(currentElement);
-	}
-
-	private void appendAllResources(Document jnlpDoc, Element element)
-			throws DOMException, Exception {
-
-		appendElement(new File(mainjar), jnlpDoc, element, true);
-
-		for (FileSet currentResource : filesets) {
-
-			for (File currentFile : currentResource.getDir().listFiles()) {
-				if (checkDirectories(currentResource, currentFile)) {
-					appendElement(currentFile, jnlpDoc, element, false);
-				}
-			}
-
-		}
-	}
-
-	private String computePath(File currentFile, PathType type)
-			throws Exception {
-		switch (type) {
-		case FLAT:
-			return computeFlat(currentFile);
-		default:
-			return computeAutomatic(currentFile);
-		}
-	}
-
-
-
-	private String computeFlat(File currentFile) {
-
-		String finalPath = null;
-		
-		int separatorPos = flatPath.lastIndexOf(File.separator);
-		
-		if (separatorPos == flatPath.length() - 1) {
-			finalPath = flatPath+currentFile.getName();
-		} else {
-			finalPath = flatPath+File.separator + currentFile.getName();
-		}
-		
-		
-		
-		return finalPath;
-	}
-
-	private String computeAutomatic(File currentFile) {
-		return currentFile.toURI().toString();
-	}
-
-	private boolean checkDirectories(FileSet fileset, File file) {
-		for (String fileName : fileset.getDirectoryScanner().getIncludedFiles()) {
-			if (file.getName().equals(fileName)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * Set the jar resources to include inside the jnlp.
-	 * 
-	 * @param fileset
-	 *            the resources to include inside the jnlp.
-	 */
-	public void addConfiguredFileset(FileSet fileset) {
-		filesets.add(fileset);
-
-	}
-
-	/**
-	 * Set the main jar file (that contain the main class to load).
-	 * 
-	 * @param mainjar
-	 *            the main jar file (that contain the main class to load).
-	 */
-	public void setMainJar(String mainjar) {
-		this.mainjar = mainjar;
-	}
-
-	/**
-	 * Set the jnlp file to modify.
-	 * 
-	 * @param jnlpFile
-	 *            the jnlp file to modify.
-	 */
-	public void setJnlpFile(String jnlpFile) {
-		this.jnlpFile = jnlpFile;
-	}
-
-	/**
-	 * Force the resources path in the jnlp file.
-	 * 
-	 * @param flatPath
-	 *            the prefix path to use.
-	 */
-	public void setFlatPathResources(String flatPath) {
-		this.flatPath = flatPath;
-	}
-	
-	private enum PathType {
-		FLAT, AUTOMATIC;
-	}
+    private static final String JAR_ENTITY = "jar";
+    private static final String RESOURCES_ENTITY = "resources";
+    private static final String DOM_IMPLEMENTATION = "LS";
+    private static final String PRETTY_PRINT_FORMAT = "format-pretty-print";
+    private static final String HREF_ATTRIBUTE = "href";
+    private static final String DOWNLOAD_ATTRIBUTE = "download";
+    private static final String MAIN_ATTRIBUTE = "main";
+
+    private String mainjar = null;
+    private String jnlpFile = null;
+    private String flatPath = null;
+    private final String tmpFile = "tmp.xml";
+    private PathType pathType = PathType.AUTOMATIC;
+
+
+
+    @Override
+    public synchronized void execute() throws BuildException {
+        validate();
+        log("JNLP modification...");
+        try {
+            DOMImplementationRegistry domRegistry = DOMImplementationRegistry
+                    .newInstance();
+            DOMImplementationLS domImpl = (DOMImplementationLS) domRegistry
+                    .getDOMImplementation(DOM_IMPLEMENTATION);
+
+            LSParser jnlpBuilder = domImpl.createLSParser(
+                    DOMImplementationLS.MODE_SYNCHRONOUS, null);
+            Document jnlpDoc = jnlpBuilder.parseURI(jnlpFile);
+
+            Node root = null;
+            for (int i = 0; i < jnlpDoc.getChildNodes().getLength(); i++) {
+                if (jnlpDoc.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
+                    root = jnlpDoc.getChildNodes().item(i);
+                    break;
+                }
+            }
+            NodeList nodeList = root.getChildNodes();
+
+            if (nodeList.getLength() > 0) {
+                for (int i = 0; i < nodeList.getLength(); i++) {
+                    if (RESOURCES_ENTITY.equals(nodeList.item(i).getNodeName())) {
+                        root.removeChild(nodeList.item(i));
+                    }
+                }
+            }
+            Element resourcesElement = jnlpDoc.createElement(RESOURCES_ENTITY);
+            root.appendChild(resourcesElement);
+
+            appendAllResources(jnlpDoc, resourcesElement);
+            LSOutput lsOutput = domImpl.createLSOutput();
+            lsOutput.setByteStream(new FileOutputStream(new File(tmpFile)));
+            LSSerializer serializer = domImpl.createLSSerializer();
+            serializer.getDomConfig().setParameter(PRETTY_PRINT_FORMAT, true);
+            serializer.write(jnlpDoc, lsOutput);
+            replaceFile(new File(tmpFile), new File(jnlpFile));
+            log("JNLP modification done !");
+        } catch (IOException e) {
+            throw new BuildException(e.getMessage());
+        } catch (ClassCastException e) {
+            throw new BuildException(e.getMessage());
+        } catch (ClassNotFoundException e) {
+            throw new BuildException(e.getMessage());
+        } catch (InstantiationException e) {
+            throw new BuildException(e.getMessage());
+        } catch (IllegalAccessException e) {
+            throw new BuildException(e.getMessage());
+        } catch (DOMException e) {
+            throw new BuildException(e.getMessage());
+        } catch (Exception e) {
+            throw new BuildException(e.getMessage());
+        }
+
+    }
+
+    private void validate() throws BuildException {
+
+        // less one resources has to be setted.
+        if (null == this.filesets || this.filesets.isEmpty()) {
+            throw new BuildException("the parameter filesets can not be empty");
+        }
+
+        // mainjar can't be empty or null
+        if (null == mainjar || "".equals(mainjar)) {
+            throw new BuildException("the parameter mainjar have to be setted");
+        }
+
+        // jnlp can't null or not exist
+        if (null == jnlpFile) {
+            throw new BuildException("the parameter jnlpFile have to be setted");
+        }
+
+        if (!(new File(jnlpFile).exists())) {
+            throw new BuildException("the jnlpFile " + jnlpFile
+                    + " doesn't exist");
+        }
+
+        if (flatPath != null) {
+            pathType = PathType.FLAT;
+        } else {
+            pathType = PathType.AUTOMATIC;
+        }
+        
+        // check if the main jar parameter is included in the resources and if
+        // the resources exists.
+        for (FileSet currentResource : filesets) {
+
+            for (File currentFile : currentResource.getDir().listFiles()) {
+
+                if (checkDirectories(currentResource, currentFile)) {
+                    if (!currentFile.exists()) {
+                        throw new BuildException("the resource: "
+                                + currentFile.getAbsolutePath()
+                                + " doesnot exists !");
+                    }
+
+                }
+            }
+        }
+        if (!new File(mainjar).exists()) {
+            throw new BuildException("the mainJar does not exists");
+        }
+
+    }
+
+    private void replaceFile(File src, File dest) throws IOException {
+        FileUtils.delete(dest);
+        FileUtils.getFileUtils().copyFile(src, dest);
+    }
+
+    
+    private void appendElement(File currentFile, Document document,
+            Element rootElement, boolean main) throws DOMException, Exception {
+        Element currentElement = document.createElement(JAR_ENTITY);
+
+        currentElement.setAttribute(HREF_ATTRIBUTE, computePath(currentFile,
+                pathType));
+         // TODO: the download attribute should be parameterizable => lazy or eager, from
the moment it's only "eager".
+        currentElement.setAttribute(DOWNLOAD_ATTRIBUTE, "eager");
+
+        if (main) {
+            currentElement.setAttribute(MAIN_ATTRIBUTE, "true");
+        } else {
+            currentElement.setAttribute(MAIN_ATTRIBUTE, "false");
+        }
+
+        rootElement.appendChild(currentElement);
+    }
+
+    private void appendAllResources(Document jnlpDoc, Element element)
+            throws DOMException, Exception {
+
+        appendElement(new File(mainjar), jnlpDoc, element, true);
+
+        for (FileSet currentResource : filesets) {
+
+            for (File currentFile : currentResource.getDir().listFiles()) {
+                if (checkDirectories(currentResource, currentFile)) {
+                    appendElement(currentFile, jnlpDoc, element, false);
+                }
+            }
+
+        }
+    }
+
+    private String computePath(File currentFile, PathType type)
+            throws Exception {
+        switch (type) {
+        case FLAT:
+            return computeFlat(currentFile);
+        default:
+            return computeAutomatic(currentFile);
+        }
+    }
+
+
+
+    private String computeFlat(File currentFile) {
+
+        String finalPath = null;
+        
+        int separatorPos = flatPath.lastIndexOf(File.separator);
+        
+        if (separatorPos == flatPath.length() - 1) {
+            finalPath = flatPath+currentFile.getName();
+        } else {
+            finalPath = flatPath+File.separator + currentFile.getName();
+        }
+        
+        
+        
+        return finalPath;
+    }
+
+    private String computeAutomatic(File currentFile) {
+        return currentFile.toURI().toString();
+    }
+
+    private boolean checkDirectories(FileSet fileset, File file) {
+        for (String fileName : fileset.getDirectoryScanner().getIncludedFiles()) {
+            if (file.getName().equals(fileName)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Set the jar resources to include inside the jnlp.
+     * 
+     * @param fileset
+     *            the resources to include inside the jnlp.
+     */
+    public void addConfiguredFileset(FileSet fileset) {
+        filesets.add(fileset);
+
+    }
+
+    /**
+     * Set the main jar file (that contain the main class to load).
+     * 
+     * @param mainjar
+     *            the main jar file (that contain the main class to load).
+     */
+    public void setMainJar(String mainjar) {
+        this.mainjar = mainjar;
+    }
+
+    /**
+     * Set the jnlp file to modify.
+     * 
+     * @param jnlpFile
+     *            the jnlp file to modify.
+     */
+    public void setJnlpFile(String jnlpFile) {
+        this.jnlpFile = jnlpFile;
+    }
+
+    /**
+     * Force the resources path in the jnlp file.
+     * 
+     * @param flatPath
+     *            the prefix path to use.
+     */
+    public void setFlatPathResources(String flatPath) {
+        this.flatPath = flatPath;
+    }
+    
+    private enum PathType {
+        FLAT, AUTOMATIC;
+    }
 }

Modified: incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml
(original)
+++ incubator/easyant/tasks/trunk/partial-jnlp-ant-task/src/main/resources/org/apache/easyant/antlib.xml
Tue Feb 22 14:53:51 2011
@@ -16,5 +16,5 @@
    limitations under the License.
 -->
 <antlib xmlns:current="ant:current">
-	<typedef name="jnlp" classname="org.apache.easyant.tasks.JNLPTask"/>
+    <typedef name="jnlp" classname="org.apache.easyant.tasks.JNLPTask"/>
 </antlib>

Modified: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy (original)
+++ incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/module.ivy Tue Feb 22 14:53:51
2011
@@ -15,21 +15,21 @@
    limitations under the License.
 -->
 <ivy-module version="2.0" xmlns:ea="http://www.easyant.org">
-	<info organisation="org.apache.easyant.tasks" module="xooki-menu-generator"
-			status="integration" revision="0.1">
-		<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2">
+    <info organisation="org.apache.easyant.tasks" module="xooki-menu-generator"
+            status="integration" revision="0.1">
+        <ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java"
revision="0.2">
             <ea:property name="project.ivy.instance" value="easyant.ivy.instance"/>
             <ea:property name="shared.resolver" value="easyant-shared-modules"/>
-		</ea:build>
-	</info>
-	<configurations>
-		<conf name="default" visibility="public" description="runtime dependencies artifact
can be used with this conf"/>
-		<conf name="test" visibility="private" description="this scope indicates that the dependency
is not required for normal use of the application, and is only available for the test compilation
and execution phases."/>
-		<conf name="provided" visibility="public" description="this is much like compile, but
indicates you expect the JDK or a container to provide it. It is only available on the compilation
classpath, and is not transitive."/>
-	</configurations>
-	<dependencies>
-		<dependency org="org.apache.easyant" name="easyant-core" rev="latest.integration" conf="provided->default"/>
-		<dependency org="org.apache.ant" name="ant" rev="1.8.1" conf="provided->default"/>
-		<dependency org="junit" name="junit" rev="4.4" conf="test->default"/>
-	</dependencies>
+        </ea:build>
+    </info>
+    <configurations>
+        <conf name="default" visibility="public" description="runtime dependencies artifact
can be used with this conf"/>
+        <conf name="test" visibility="private" description="this scope indicates that
the dependency is not required for normal use of the application, and is only available for
the test compilation and execution phases."/>
+        <conf name="provided" visibility="public" description="this is much like compile,
but indicates you expect the JDK or a container to provide it. It is only available on the
compilation classpath, and is not transitive."/>
+    </configurations>
+    <dependencies>
+        <dependency org="org.apache.easyant" name="easyant-core" rev="latest.integration"
conf="provided->default"/>
+        <dependency org="org.apache.ant" name="ant" rev="1.8.1" conf="provided->default"/>
+        <dependency org="junit" name="junit" rev="4.4" conf="test->default"/>
+    </dependencies>
 </ivy-module>

Modified: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/main/java/org/apache/easyant/menu/XookiMenuGenerator.java
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/main/java/org/apache/easyant/menu/XookiMenuGenerator.java?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/main/java/org/apache/easyant/menu/XookiMenuGenerator.java
(original)
+++ incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/main/java/org/apache/easyant/menu/XookiMenuGenerator.java
Tue Feb 22 14:53:51 2011
@@ -137,7 +137,7 @@ public class XookiMenuGenerator implemen
     }
 
     private String toId(String title) {
-        return title.replaceAll("\\W+", "_");
+        return title.replaceAll("\W+", "_");
     }
 
     /**
@@ -146,8 +146,10 @@ public class XookiMenuGenerator implemen
      */
     private class Block {
 
-        private static final String FIRST_ENTRY_SEP = "\n";
-        private static final String NEXT_ENTRY_SEP = ",\n";
+        private static final String FIRST_ENTRY_SEP = "
+";
+        private static final String NEXT_ENTRY_SEP = ",
+";
 
         private Block parent; //points up the context stack
         private char close;   //character to write when this block is ended
@@ -192,7 +194,8 @@ public class XookiMenuGenerator implemen
             if (parent == null) {
                 throw new NoSuchElementException("Cannot pop the root element");
             }
-            fileWriter.append('\n');
+            fileWriter.append('
+');
             return parent.endBlock(close); //return reference to parent, popping the stack
         }
 
@@ -215,7 +218,7 @@ public class XookiMenuGenerator implemen
         /** append a quoted, escaped string literal to this block */
         private Block appendLiteral(String value) throws IOException {
             //escape any ' or " so that they don't screw up our syntax
-            value = value.replaceAll("(['\"])", "\\\\$1");
+            value = value.replaceAll("(['\"])", "\\$1");
             //enclose the value in quotes to include any whitespace
             fileWriter.append("\"").append(value).append("\"");
             return this;

Modified: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testEmptyMenu.json
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testEmptyMenu.json?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testEmptyMenu.json
(original)
+++ incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testEmptyMenu.json
Tue Feb 22 14:53:51 2011
@@ -16,8 +16,8 @@
  *
  */
 {
-	"id":"empty",
-	"title":"empty",
-	"children": [
-	]
-}
\ No newline at end of file
+    "id":"empty",
+    "title":"empty",
+    "children": [
+    ]
+}

Modified: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMenuLifecycle.json
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMenuLifecycle.json?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMenuLifecycle.json
(original)
+++ incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMenuLifecycle.json
Tue Feb 22 14:53:51 2011
@@ -16,12 +16,12 @@
  *
  */
 {
-	"id":"Test",
-	"title":"Test",
-	"children": [
-		{
-			"id":"link",
-			"title":"lonely"
-		}
-	]
-}
\ No newline at end of file
+    "id":"Test",
+    "title":"Test",
+    "children": [
+        {
+            "id":"link",
+            "title":"lonely"
+        }
+    ]
+}

Modified: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMultipleEntries.json
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMultipleEntries.json?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMultipleEntries.json
(original)
+++ incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testMultipleEntries.json
Tue Feb 22 14:53:51 2011
@@ -16,20 +16,20 @@
  *
  */
 {
-	"id":"three",
-	"title":"three",
-	"children": [
-		{
-			"id":"path/to/one",
-			"title":"one"
-		},
-		{
-			"id":"path/to/two",
-			"title":"\'two\'"
-		},
-		{
-			"id":"path/to/three",
-			"title":"item \"three\""
-		}
-	]
-}
\ No newline at end of file
+    "id":"three",
+    "title":"three",
+    "children": [
+        {
+            "id":"path/to/one",
+            "title":"one"
+        },
+        {
+            "id":"path/to/two",
+            "title":"\'two\'"
+        },
+        {
+            "id":"path/to/three",
+            "title":"item \"three\""
+        }
+    ]
+}

Modified: incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testSubMenu.json
URL: http://svn.apache.org/viewvc/incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testSubMenu.json?rev=1073354&r1=1073353&r2=1073354&view=diff
==============================================================================
--- incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testSubMenu.json
(original)
+++ incubator/easyant/tasks/trunk/xooki-menu-generator/trunk/src/test/resources/org/apache/easyant/menu/testSubMenu.json
Tue Feb 22 14:53:51 2011
@@ -16,21 +16,21 @@
  *
  */
 {
-	"id":"parent",
-	"title":"parent",
-	"children": [
-		{
-			"id":"path/to/one",
-			"title":"one"
-		},
-		{
-			"title":"Child Menu",
-			"importNode":"child",
-			"importRoot":"XookiMenuGeneratorTestSub"
-		},
-		{
-			"id":"path/to/three",
-			"title":"item \"three\""
-		}
-	]
-}
\ No newline at end of file
+    "id":"parent",
+    "title":"parent",
+    "children": [
+        {
+            "id":"path/to/one",
+            "title":"one"
+        },
+        {
+            "title":"Child Menu",
+            "importNode":"child",
+            "importRoot":"XookiMenuGeneratorTestSub"
+        },
+        {
+            "id":"path/to/three",
+            "title":"item \"three\""
+        }
+    ]
+}



Mime
View raw message