You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Gabriele Kahlout <ga...@mysimpatico.com> on 2011/05/23 09:35:31 UTC

What's the need for a complicated SolrTestCaseJ4.getClassName() ?

Hello,

As long as I subclass SolrTestCaseJ4 I cannot do
this.getClass().getSimpleName(), I don't understand why. I wonder if the
following complicated methods  in SolrTestCaseJ4 have anything to do with
it?

  protected static String getClassName() {
    StackTraceElement[] stack = new
RuntimeException("WhoAmI").fillInStackTrace().getStackTrace();
    for (int i = stack.length-1; i>=0; i--) {
      StackTraceElement ste = stack[i];
      String cname = ste.getClassName();
      if (cname.indexOf(".lucene.")>=0 || cname.indexOf(".solr.")>=0) {
        return cname;
      }
    }
    return SolrTestCaseJ4.class.getName();
  }

  protected static String getSimpleClassName() {
    String cname = getClassName();
    return cname.substring(cname.lastIndexOf('.')+1);
  }

-- 
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
L(-[a-z]+[0-9]X)).