@Test public void testReplaceThrowsNullPointerException7() throws Throwable { String[] src = new String[8]; src[0] = "testString"; String[] patterns = new String[1]; String[] to = new String[1]; try { BSHLogListener.replace(src, patterns, to); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"String.length()\" because \"src[i]\" is null", ex.getMessage(), "ex.getMessage()"); } } }
protected static String[] replace(String[] src, String[] patterns, String[] to){ String[] ret = new String[src.length]; for(int i=0; i<src.length; i++){ StringBuilder buff = new StringBuilder(2*src[i].length()); int begin, end=0; while ((begin = src[i].indexOf('$',end))>=0 && begin<src[i].length()){ buff.append(src[i].substring(end, begin)); boolean patternFound = false; for(int k=0; k<patterns.length && !patternFound ; k++){ if(patternFound = src[i].indexOf(patterns[k], begin) == begin+1){ buff.append(to[k]); end = begin + patterns[k].length() + 1; } } if(!patternFound) end = begin + 1; } buff.append(src[i].substring(end)); ret[i] = buff.toString(); } return ret; }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected static String[] replace(String[] src, String[] patterns, String[] to){ String[] ret = new String[src.length]; for(int i=0; i<src.length; i++){ StringBuilder buff = new StringBuilder(2*src[i].length()); int begin, end=0; while ((begin = src[i].indexOf('$',end))>=0 && begin<src[i].length()){ buff.append(src[i].substring(end, begin)); boolean patternFound = false; for(int k=0; k<patterns.length && !patternFound ; k++){ if(patternFound = src[i].indexOf(patterns[k], begin) == begin+1){ buff.append(to[k]); end = begin + patterns[k].length() + 1; } } if(!patternFound) end = begin + 1; } buff.append(src[i].substring(end)); ret[i] = buff.toString(); } return ret; } }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected static String[] replace(String[] src, String[] patterns, String[] to){ String[] ret = new String[src.length]; for(int i=0; i<src.length; i++){ StringBuilder buff = new StringBuilder(2*src[i].length()); int begin, end=0; while ((begin = src[i].indexOf('$',end))>=0 && begin<src[i].length()){ buff.append(src[i].substring(end, begin)); boolean patternFound = false; for(int k=0; k<patterns.length && !patternFound ; k++){ if(patternFound = src[i].indexOf(patterns[k], begin) == begin+1){ buff.append(to[k]); end = begin + patterns[k].length() + 1; } } if(!patternFound) end = begin + 1; } buff.append(src[i].substring(end)); ret[i] = buff.toString(); } return ret; } BSHLogListener(); }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected static String[] replace(String[] src, String[] patterns, String[] to){ String[] ret = new String[src.length]; for(int i=0; i<src.length; i++){ StringBuilder buff = new StringBuilder(2*src[i].length()); int begin, end=0; while ((begin = src[i].indexOf('$',end))>=0 && begin<src[i].length()){ buff.append(src[i].substring(end, begin)); boolean patternFound = false; for(int k=0; k<patterns.length && !patternFound ; k++){ if(patternFound = src[i].indexOf(patterns[k], begin) == begin+1){ buff.append(to[k]); end = begin + patterns[k].length() + 1; } } if(!patternFound) end = begin + 1; } buff.append(src[i].substring(end)); ret[i] = buff.toString(); } return ret; } BSHLogListener(); @Override void setConfiguration(org.jpos.core.Configuration cfg); @Override LogEvent log(LogEvent ev); }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected static String[] replace(String[] src, String[] patterns, String[] to){ String[] ret = new String[src.length]; for(int i=0; i<src.length; i++){ StringBuilder buff = new StringBuilder(2*src[i].length()); int begin, end=0; while ((begin = src[i].indexOf('$',end))>=0 && begin<src[i].length()){ buff.append(src[i].substring(end, begin)); boolean patternFound = false; for(int k=0; k<patterns.length && !patternFound ; k++){ if(patternFound = src[i].indexOf(patterns[k], begin) == begin+1){ buff.append(to[k]); end = begin + patterns[k].length() + 1; } } if(!patternFound) end = begin + 1; } buff.append(src[i].substring(end)); ret[i] = buff.toString(); } return ret; } BSHLogListener(); @Override void setConfiguration(org.jpos.core.Configuration cfg); @Override LogEvent log(LogEvent ev);  }