MCPcopy Create free account
hub / github.com/M66B/FairEmail / packageOf

Method packageOf

app/src/main/java/com/sun/mail/util/MailLogger.java:361–371  ·  view source on GitHub ↗

Return the package name of the class. Sometimes there will be no Package object for the class, e.g., if the class loader hasn't created one (see Class.getPackage()). @param clazz the class source. @return the package name or an empty string.

(Class<?> clazz)

Source from the content-addressed store, hash-verified

359 * @return the package name or an empty string.
360 */
361 private String packageOf(Class<?> clazz) {
362 Package p = clazz.getPackage();
363 if (p != null)
364 return p.getName(); // hopefully the common case
365 String cname = clazz.getName();
366 int i = cname.lastIndexOf('.');
367 if (i > 0)
368 return cname.substring(0, i);
369 // no package name, now what?
370 return "";
371 }
372
373 /**
374 * A disadvantage of not being able to use Logger directly in Jakarta Mail

Callers 1

MailLoggerMethod · 0.95

Calls 1

getNameMethod · 0.65

Tested by

no test coverage detected