@Test public void testlineSplit() { List<String> lines = ValidationFilter.lineSplit("\n212345\n2\n3\n4\n"); assertEquals(6, lines.size()); assertEquals("", lines.get(0)); assertEquals("212345", lines.get(1)); assertEquals("2", lines.get(2)); assertEquals("3", lines.get(3)); assertEquals("4", lines.get(4)); assertEquals("", lines.get(5)); lines = ValidationFilter.lineSplit("\n212345\n2\n3\n4"); assertEquals(5, lines.size()); assertEquals("", lines.get(0)); assertEquals("212345", lines.get(1)); assertEquals("2", lines.get(2)); assertEquals("3", lines.get(3)); assertEquals("4", lines.get(4)); }
public static List<String> lineSplit(String strIn) { StringBuilder sb = new StringBuilder(); int i; List<String> lines = new ArrayList<String>(); char[] chrs = {' '}; for (i = 0; i < strIn.length(); i++) { String singleCharString; chrs[0] = strIn.charAt(i); singleCharString = new String(chrs); if (singleCharString.equals("\n")) { lines.add(sb.toString()); sb = new StringBuilder(); } else { sb.append(singleCharString); } } lines.add(sb.toString()); return lines; }
ValidationFilter implements Filter { public static List<String> lineSplit(String strIn) { StringBuilder sb = new StringBuilder(); int i; List<String> lines = new ArrayList<String>(); char[] chrs = {' '}; for (i = 0; i < strIn.length(); i++) { String singleCharString; chrs[0] = strIn.charAt(i); singleCharString = new String(chrs); if (singleCharString.equals("\n")) { lines.add(sb.toString()); sb = new StringBuilder(); } else { sb.append(singleCharString); } } lines.add(sb.toString()); return lines; } }
ValidationFilter implements Filter { public static List<String> lineSplit(String strIn) { StringBuilder sb = new StringBuilder(); int i; List<String> lines = new ArrayList<String>(); char[] chrs = {' '}; for (i = 0; i < strIn.length(); i++) { String singleCharString; chrs[0] = strIn.charAt(i); singleCharString = new String(chrs); if (singleCharString.equals("\n")) { lines.add(sb.toString()); sb = new StringBuilder(); } else { sb.append(singleCharString); } } lines.add(sb.toString()); return lines; }  }
ValidationFilter implements Filter { public static List<String> lineSplit(String strIn) { StringBuilder sb = new StringBuilder(); int i; List<String> lines = new ArrayList<String>(); char[] chrs = {' '}; for (i = 0; i < strIn.length(); i++) { String singleCharString; chrs[0] = strIn.charAt(i); singleCharString = new String(chrs); if (singleCharString.equals("\n")) { lines.add(sb.toString()); sb = new StringBuilder(); } else { sb.append(singleCharString); } } lines.add(sb.toString()); return lines; }  @Override void init(FilterConfig config); @Override void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc); @Override void destroy(); boolean isHeaderTrue(HttpServletRequest hreq, String name); static Object xml2pojo(String xml, JAXBContext ctx, Schema schema, XmlValidationExceptionHandler errHandler); static String pojo2xml(Object pojo, JAXBContext ctx, Schema schema); static List<String> lineSplit(String strIn); static String getExtendedStackTrace(Throwable th); FilterConfig getConfig(); void setConfig(FilterConfig config); String getpPkg(); void setpPkg(String pPkg); String getpXSD(); void setpXSD(String pXSD); String getfPkg(); void setfPkg(String fPkg); String getfXSD(); void setfXSD(String fXSD); JAXBContext getpCtx(); void setpCtx(JAXBContext pCtx); JAXBContext getfCtx(); void setfCtx(JAXBContext fCtx); Schema getpSchema(); void setpSchema(Schema pSchema); Schema getfSchema(); void setfSchema(Schema fSchema); }
ValidationFilter implements Filter { public static List<String> lineSplit(String strIn) { StringBuilder sb = new StringBuilder(); int i; List<String> lines = new ArrayList<String>(); char[] chrs = {' '}; for (i = 0; i < strIn.length(); i++) { String singleCharString; chrs[0] = strIn.charAt(i); singleCharString = new String(chrs); if (singleCharString.equals("\n")) { lines.add(sb.toString()); sb = new StringBuilder(); } else { sb.append(singleCharString); } } lines.add(sb.toString()); return lines; }  @Override void init(FilterConfig config); @Override void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc); @Override void destroy(); boolean isHeaderTrue(HttpServletRequest hreq, String name); static Object xml2pojo(String xml, JAXBContext ctx, Schema schema, XmlValidationExceptionHandler errHandler); static String pojo2xml(Object pojo, JAXBContext ctx, Schema schema); static List<String> lineSplit(String strIn); static String getExtendedStackTrace(Throwable th); FilterConfig getConfig(); void setConfig(FilterConfig config); String getpPkg(); void setpPkg(String pPkg); String getpXSD(); void setpXSD(String pXSD); String getfPkg(); void setfPkg(String fPkg); String getfXSD(); void setfXSD(String fXSD); JAXBContext getpCtx(); void setpCtx(JAXBContext pCtx); JAXBContext getfCtx(); void setfCtx(JAXBContext fCtx); Schema getpSchema(); void setpSchema(Schema pSchema); Schema getfSchema(); void setfSchema(Schema fSchema); static final int BUFFSIZE; static final int BADREQ; static final String dashline; static final Pattern jsonUriPattern; static final Pattern xmlUriPattern; }