@Test public void testHandleDataWithSecret() { String data = "js_code=001tZveq0SMoiq1AEXeq0ECJeq0tZveZ&secret=5681022fa1643845392367ea88888888&grant_type=authorization_code&appid=wxe156d4848d999999"; final String s = DataUtils.handleDataWithSecret(data); assertThat(s).contains("&secret=******&"); }
public static <E> E handleDataWithSecret(E data) { E dataForLog = data; if(data instanceof String && StringUtils.contains((String)data, "&secret=")){ dataForLog = (E) StringUtils.replaceAll((String)data,"&secret=\\w+&","&secret=******&"); } return dataForLog; }
DataUtils { public static <E> E handleDataWithSecret(E data) { E dataForLog = data; if(data instanceof String && StringUtils.contains((String)data, "&secret=")){ dataForLog = (E) StringUtils.replaceAll((String)data,"&secret=\\w+&","&secret=******&"); } return dataForLog; } }
DataUtils { public static <E> E handleDataWithSecret(E data) { E dataForLog = data; if(data instanceof String && StringUtils.contains((String)data, "&secret=")){ dataForLog = (E) StringUtils.replaceAll((String)data,"&secret=\\w+&","&secret=******&"); } return dataForLog; }  }
DataUtils { public static <E> E handleDataWithSecret(E data) { E dataForLog = data; if(data instanceof String && StringUtils.contains((String)data, "&secret=")){ dataForLog = (E) StringUtils.replaceAll((String)data,"&secret=\\w+&","&secret=******&"); } return dataForLog; }  static E handleDataWithSecret(E data); }
DataUtils { public static <E> E handleDataWithSecret(E data) { E dataForLog = data; if(data instanceof String && StringUtils.contains((String)data, "&secret=")){ dataForLog = (E) StringUtils.replaceAll((String)data,"&secret=\\w+&","&secret=******&"); } return dataForLog; }  static E handleDataWithSecret(E data);  }