vgritsenko 2003/06/06 05:21:10
Modified: src/java/org/apache/cocoon/bean CocoonBean.java src/java/org/apache/cocoon/bean/helpers DelayedOutputStream.java Log: some nitpicking... Revision Changes Path 1.9 +13 -6 cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java Index: CocoonBean.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- CocoonBean.java 4 Jun 2003 14:19:09 -0000 1.8 +++ CocoonBean.java 6 Jun 2003 12:21:10 -0000 1.9 @@ -468,6 +468,7 @@ public void addTarget(String sourceURI) { targets.add(new Target(sourceURI, destDir)); } + public void addTarget(String type, String root, String sourceURI, String destURI){ targets.add(new Target(type, root, sourceURI, destURI)); } @@ -479,6 +480,7 @@ public void addTarget(String sourceURI, String destURI){ targets.add(new Target(sourceURI, destURI)); } + public void addTargets(List uris) { Iterator i = uris.iterator(); while (i.hasNext()) { @@ -486,6 +488,7 @@ targets.add(target); } } + /** * Process single URI into given output stream. * @@ -1149,15 +1152,16 @@ */ protected static String getClassPath(final String context) { StringBuffer buildClassPath = new StringBuffer(); - String classDir = context + "/WEB-INF/classes"; - File root = new File(context + "/WEB-INF/lib"); + String classDir = context + "/WEB-INF/classes"; buildClassPath.append(classDir); + File root = new File(context + "/WEB-INF/lib"); if (root.isDirectory()) { File[] libraries = root.listFiles(); Arrays.sort(libraries); for (int i = 0; i < libraries.length; i++) { + // FIXME: endsWith(".jar") or .zip buildClassPath.append(File.pathSeparatorChar) .append(IOUtils.getFullFilename(libraries[i])); } @@ -1170,10 +1174,10 @@ // .append(getExtraClassPath(context)); if (log.isDebugEnabled()) { - log.debug("Context classpath: " + buildClassPath.toString()); + log.debug("Context classpath: " + buildClassPath); } return buildClassPath.toString(); - } + } public class Target { private static final String DEFAULT_TYPE = "default"; @@ -1229,6 +1233,7 @@ throw new ProcessingException("Unknown mapper type: " + this.type); } } + private String getFinalURIWithDefault(String actualSourceURI){ return destDir + "/" + actualSourceURI; } @@ -1255,15 +1260,17 @@ public String getSourceURI() { return root + sourceURI; } + // @todo@ this is misusing the 'hashCode' name - hashCodes should be integer it seems, uv public String getHashCode() { return type + "|" + root +"|" + sourceURI + "|" + destURI; } + public OutputStream getOutputStream(String filename) throws IOException, ProcessingException { final String finalDestinationURI = this.getFinalURI(filename); Source src = (Source) sourceResolver.resolveURI(finalDestinationURI); if (!(src instanceof ModifiableSource)) { - throw new ProcessingException("Source is not Modifiable: "+finalDestinationURI); + throw new ProcessingException("Source is not Modifiable: " + finalDestinationURI); } ModifiableSource outputSource = (ModifiableSource) src; return outputSource.getOutputStream(); 1.2 +3 -15 cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/DelayedOutputStream.java Index: DelayedOutputStream.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/DelayedOutputStream.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DelayedOutputStream.java 4 Jun 2003 09:25:53 -0000 1.1 +++ DelayedOutputStream.java 6 Jun 2003 12:21:10 -0000 1.2 @@ -162,9 +162,7 @@ baos.close(); } } catch (IOException ioe) { - if (ioexception == null) { - ioexception = ioe; - } + ioexception = ioe; } finally { baos = null; } @@ -207,9 +205,7 @@ baos.flush(); } } catch (IOException ioe) { - if (ioexception == null) { - ioexception = ioe; - } + ioexception = ioe; } // flush fos @@ -241,20 +237,12 @@ return baos; } else if (baos != null && fos != null) { // fos is defined, flush boas to fos, and destroy baos - IOException ioexception = null; - try { baos.flush(); baos.writeTo(fos); baos.close(); - } catch (IOException ioe) { - ioexception = ioe; } finally { baos = null; - } - - if (ioexception != null) { - throw ioexception; } return fos;