MCPcopy Index your code
hub / github.com/apache/tomcat / translateCommand

Method translateCommand

java/org/apache/catalina/util/Strftime.java:235–263  ·  view source on GitHub ↗

Try to get the Java Date/Time formatting associated with the C standard provided. @param buf The buffer @param pattern The date/time pattern @param index The char index @param oldInside Flag value @return True if new is inside buffer

(StringBuilder buf, String pattern, int index, boolean oldInside)

Source from the content-addressed store, hash-verified

233 * @return True if new is inside buffer
234 */
235 protected boolean translateCommand(StringBuilder buf, String pattern, int index, boolean oldInside) {
236 char firstChar = pattern.charAt(index);
237 boolean newInside = oldInside;
238
239 // O and E are modifiers, they mean to present an alternative representation of the next char
240 // we just handle the next char as if the O or E wasn't there
241 if (firstChar == 'O' || firstChar == 'E') {
242 if (index + 1 < pattern.length()) {
243 newInside = translateCommand(buf, pattern, index + 1, oldInside);
244 } else {
245 buf.append(quote("%" + firstChar, oldInside));
246 }
247 } else {
248 String command = translate.getProperty(String.valueOf(firstChar));
249
250 // If we don't find a format, treat it as a literal--That's what apache does
251 if (command == null) {
252 buf.append(quote("%" + firstChar, oldInside));
253 } else {
254 // If we were inside quotes, close the quotes
255 if (oldInside) {
256 buf.append('\'');
257 }
258 buf.append(command);
259 newInside = false;
260 }
261 }
262 return newInside;
263 }
264}

Callers 1

convertDateFormatMethod · 0.95

Calls 6

quoteMethod · 0.95
charAtMethod · 0.80
lengthMethod · 0.80
getPropertyMethod · 0.65
appendMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected