indentation changes only

This commit is contained in:
Ceki Gulcu 2014-12-09 22:39:17 +01:00
parent 26b0111672
commit 7a57f1a080
2 changed files with 82 additions and 44 deletions

38
.idea/codeStyleSettings.xml Executable file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<option name="RIGHT_MARGIN" value="120" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_TRY_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SYNCHRONIZED_PARENTHESES" value="false" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
<option name="KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE" value="true" />
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

@ -26,7 +26,6 @@ package org.slf4j.helpers;
/**
*
* An internal utility class.
*
* @author Alexandre Dorokhine
@ -34,53 +33,54 @@ package org.slf4j.helpers;
*/
public final class Util {
private Util() {}
private Util() {}
/**
* In order to call {@link SecurityManager#getClassContext()}, which is a
* protected method, we add this wrapper which allows the method to be visible
* inside this package.
*/
private static final class ClassContextSecurityManager extends SecurityManager {
protected Class<?>[] getClassContext() {
return super.getClassContext();
}
};
private static final ClassContextSecurityManager SECURITY_MANAGER =
new ClassContextSecurityManager();
/**
* Returns the name of the class which called the invoking method.
* @return the name of the class which called the invoking method.
*/
public static Class<?> getCallingClass() {
Class<?>[] trace = SECURITY_MANAGER.getClassContext();
String thisClassName = Util.class.getName();
// Advance until Util is found
int i;
for (i = 0 ; i < trace.length ; i++) {
if (thisClassName.equals(trace[i].getName()))
break;
/**
* In order to call {@link SecurityManager#getClassContext()}, which is a
* protected method, we add this wrapper which allows the method to be visible
* inside this package.
*/
private static final class ClassContextSecurityManager extends SecurityManager {
protected Class<?>[] getClassContext() {
return super.getClassContext();
}
}
// trace[i] = Util; trace[i+1] = caller; trace[i+2] = caller's caller
if (i >= trace.length || i + 2 >= trace.length) {
throw new IllegalStateException(
"Failed to find org.slf4j.helpers.Util or its caller in the stack; " +
"this should not happen");
private static final ClassContextSecurityManager SECURITY_MANAGER = new ClassContextSecurityManager();
/**
* Returns the name of the class which called the invoking method.
*
* @return the name of the class which called the invoking method.
*/
public static Class<?> getCallingClass() {
Class<?>[] trace = SECURITY_MANAGER.getClassContext();
String thisClassName = Util.class.getName();
// Advance until Util is found
int i;
for(i = 0; i < trace.length; i++) {
if(thisClassName.equals(trace[i].getName()))
break;
}
// trace[i] = Util; trace[i+1] = caller; trace[i+2] = caller's caller
if(i >= trace.length || i + 2 >= trace.length) {
throw new IllegalStateException(
"Failed to find org.slf4j.helpers.Util or its caller in the stack; " +
"this should not happen");
}
return trace[i + 2];
}
return trace[i+2];
}
static final public void report(String msg, Throwable t) {
System.err.println(msg);
System.err.println("Reported exception:");
t.printStackTrace();
}
static final public void report(String msg, Throwable t) {
System.err.println(msg);
System.err.println("Reported exception:");
t.printStackTrace();
}
static final public void report(String msg) {
System.err.println("SLF4J: " +msg);
}
static final public void report(String msg) {
System.err.println("SLF4J: " + msg);
}
}