1 package org.apache.turbine.pipeline; 2 3 56 57 64 65 70 71 public class PipelineUtil 72 { 73 private PipelineUtil() 74 { 75 } 76 77 89 90 93 public static int parseTemplatePath(String template,StringBuffer buffer) 94 throws Exception 95 { 96 char c; 97 int j = 0; 98 int ind = -1; 99 buffer.setLength(0); 100 buffer.append(template); 101 int len = buffer.length(); 102 while (j < len) 103 { 104 c = buffer.charAt(j); 105 if (c == ',') 106 { 107 c = '/'; 108 buffer.setCharAt(j,c); 109 } 110 if (c == '/') 111 { 112 ind = j; 113 if (j < (len - 1)) 114 { 115 c = buffer.charAt(j + 1); 116 if ((c == '/') || 117 (c == ',')) 118 { 119 buffer.deleteCharAt(j); 120 len--; 121 continue; 122 } 123 } 124 } 125 j++; 126 } 127 if ((len == 0) || 128 (ind >= (len - 1))) 129 { 130 throw new Exception ( 131 "Syntax error in template name '" + template + '\''); 132 } 133 return ind; 134 } 135 } 136 | Popular Tags |