1515 * @author Andy Shaules
1616 */
1717public class Red5Root {
18-
19- protected static Logger log = LoggerFactory .getLogger (Red5Root .class );
20-
18+
19+ protected static Logger log = LoggerFactory .getLogger (Red5Root .class );
20+
2121 private static final String PropertyRed5Root = "red5.root" ;
2222
2323 private static final String VarRed5Home = "RED5_HOME" ;
@@ -30,11 +30,12 @@ public class Red5Root {
3030
3131 private static ReentrantLock lookupLock = new ReentrantLock ();
3232
33- private static ThreadLocal <Throwable > lastError = ThreadLocal .withInitial (()->null );
33+ private static ThreadLocal <Throwable > lastError = ThreadLocal .withInitial (() -> null );
34+
3435 /**
35- * Get Root directory of server.
36+ * Get Root directory of server.
3637 * @return String path or throws exception.
37- * @throws RootResolutionException if server root cannot be resolved.
38+ * @throws RootResolutionException if server root cannot be resolved.
3839 */
3940 public static String get () throws RootResolutionException {
4041 if (homeDirectory == null ) {
@@ -48,15 +49,15 @@ public static String get() throws RootResolutionException {
4849 }
4950 }
5051 if (homeDirectory == null ) {
51- if (lastError .get ()!= null ) {
52- try {
53- throw new RootResolutionException ("Server root path cannot be resolved from system/env properties or code location." ,lastError .get ());
54- } finally {
55- lastError .remove ();
56- }
57- } else {
58- throw new RootResolutionException ("Server root path cannot be resolved from system/env properties or code location." );
59- }
52+ if (lastError .get () != null ) {
53+ try {
54+ throw new RootResolutionException ("Server root path cannot be resolved from system/env properties or code location." , lastError .get ());
55+ } finally {
56+ lastError .remove ();
57+ }
58+ } else {
59+ throw new RootResolutionException ("Server root path cannot be resolved from system/env properties or code location." );
60+ }
6061 }
6162 return homeDirectory ;
6263 }
@@ -97,7 +98,7 @@ private static String resolve() {
9798 try {
9899 return Paths .get (location .toURI ());
99100 } catch (Exception e ) {
100- log .warn ("" ,e );
101+ log .warn ("" , e );
101102 // Wrap URI-specific issues
102103 throw new RuntimeException ("Failed to convert URL to URI" , e );
103104 }
@@ -108,8 +109,8 @@ private static String resolve() {
108109 }
109110 } catch (Throwable t ) {
110111 //Catch everything possible
111- lastError .set (t );//Bubble it to the caller gracefully.
112- log .debug ("" ,t );
112+ lastError .set (t );//Bubble it to the caller gracefully.
113+ log .debug ("" , t );
113114 }
114115 return path ;
115116 }
0 commit comments