private void testConnection() throws IOException { // Test database connection. URLConnection conn = makeTestConnection(); if (conn != null) { conn.connect(); StringBuilder buf = readResponse(conn); buf.insert(0, "Experiment confirmation: "); LogContext.getLogger().fine(buf.toString()); } }
/** Return next string in the sequence "a", "b", ... "z", "aa", "ab", ... */ static String getNextDirName(String old) { StringBuilder sb = new StringBuilder(old); // go through and increment the first non-'z' char // counts back from the last char, so 'aa'->'ab', not 'ba' for (int ii = sb.length() - 1; ii >= 0; ii--) { char curChar = sb.charAt(ii); if (curChar < 'z') { sb.setCharAt(ii, (char) (curChar + 1)); return sb.toString(); } sb.setCharAt(ii, 'a'); } sb.insert(0, 'a'); return sb.toString(); }
private String formatDateW3c(final Date date) { final String iso8601Date = ISO_8601_DATE.format(date); final StringBuilder w3cDate = new StringBuilder(iso8601Date); // Hmm..is it really not possible to create a w3c compliant date using java.util.Date... return w3cDate.insert(w3cDate.length() - 2, ':').toString(); }