18
18
*/
19
19
20
20
/*
21
- * Copyright (c) 2005, 2021 , Oracle and/or its affiliates. All rights reserved.
21
+ * Copyright (c) 2005, 2022 , Oracle and/or its affiliates. All rights reserved.
22
22
* Portions Copyright (c) 2017, 2021, Chris Fraire <[email protected] >.
23
23
*/
24
24
package org .opengrok .indexer .analysis ;
125
125
* Manages and provides Analyzers as needed. Please see
126
126
* <a href="https://github.com/oracle/opengrok/wiki/Internals">
127
127
* this</a> page for a great description of the purpose of the AnalyzerGuru.
128
- *
128
+ * <p>
129
129
* Created on September 22, 2005
130
- *
130
+ * </p>
131
131
* @author Chandan
132
132
*/
133
133
public class AnalyzerGuru {
@@ -550,9 +550,8 @@ public static AbstractAnalyzer getAnalyzer(InputStream in, String file) throws I
550
550
if (factory == null ) {
551
551
AbstractAnalyzer defaultAnalyzer = getAnalyzer ();
552
552
if (LOGGER .isLoggable (Level .FINEST )) {
553
- LOGGER .log (Level .FINEST , "{0}: fallback {1}" ,
554
- new Object []{file ,
555
- defaultAnalyzer .getClass ().getSimpleName () });
553
+ LOGGER .log (Level .FINEST , "''{0}'': fallback {1}" ,
554
+ new Object []{file , defaultAnalyzer .getClass ().getSimpleName ()});
556
555
}
557
556
return defaultAnalyzer ;
558
557
}
@@ -849,8 +848,7 @@ public static Class<?> getFactoryClass(String simpleName) {
849
848
* @param factoryClass the factory class
850
849
* @return a file analyzer factory
851
850
*
852
- * @throws ClassCastException if the class is not a subclass of {@code
853
- * FileAnalyzerFactory}
851
+ * @throws ClassCastException if the class is not a subclass of {@code FileAnalyzerFactory}
854
852
* @throws IllegalAccessException if the constructor cannot be accessed
855
853
* @throws InstantiationException if the class cannot be instantiated
856
854
* @throws NoSuchMethodException if no-argument constructor could not be found
@@ -871,7 +869,7 @@ private static AnalyzerFactory findFactory(Class<?> factoryClass)
871
869
/**
872
870
* Finds a suitable analyzer class for file name. If the analyzer cannot be
873
871
* determined by the file extension, try to look at the data in the
874
- * InputStream to find a suitable analyzer.
872
+ * {@link InputStream} to find a suitable analyzer.
875
873
* <p>
876
874
* Use if you just want to find file type.
877
875
* </p>
@@ -914,9 +912,8 @@ public static AnalyzerFactory find(String file) {
914
912
factory = pre .get (path .substring (0 , dotpos ).toUpperCase (Locale .ROOT ));
915
913
if (factory != null ) {
916
914
if (LOGGER .isLoggable (Level .FINEST )) {
917
- LOGGER .log (Level .FINEST , "{0}: chosen by prefix: {1}" ,
918
- new Object []{file ,
919
- factory .getClass ().getSimpleName () });
915
+ LOGGER .log (Level .FINEST , "''{0}'': chosen by prefix: {1}" ,
916
+ new Object []{file , factory .getClass ().getSimpleName ()});
920
917
}
921
918
return factory ;
922
919
}
@@ -928,9 +925,8 @@ public static AnalyzerFactory find(String file) {
928
925
factory = ext .get (path .substring (dotpos + 1 ).toUpperCase (Locale .ROOT ));
929
926
if (factory != null ) {
930
927
if (LOGGER .isLoggable (Level .FINEST )) {
931
- LOGGER .log (Level .FINEST , "{0}: chosen by suffix: {1}" ,
932
- new Object []{file ,
933
- factory .getClass ().getSimpleName () });
928
+ LOGGER .log (Level .FINEST , "''{0}'': chosen by suffix: {1}" ,
929
+ new Object []{file , factory .getClass ().getSimpleName ()});
934
930
}
935
931
return factory ;
936
932
}
@@ -959,8 +955,7 @@ public static AnalyzerFactory find(InputStream in) throws IOException {
959
955
* @param in The stream containing the data to analyze
960
956
* @param file The file name to get the analyzer for
961
957
* @return the analyzer factory to use
962
- * @throws java.io.IOException if an error occurs while reading data from
963
- * the stream
958
+ * @throws java.io.IOException if an error occurs while reading data from the stream
964
959
*/
965
960
private static AnalyzerFactory findForStream (InputStream in ,
966
961
String file ) throws IOException {
@@ -989,8 +984,8 @@ private static AnalyzerFactory findForStream(InputStream in,
989
984
if (fac != null ) {
990
985
if (LOGGER .isLoggable (Level .FINEST )) {
991
986
LOGGER .log (Level .FINEST ,
992
- "{0}: chosen by precise magic: {1}" , new Object []{
993
- file , fac .getClass ().getSimpleName () });
987
+ "{0}: chosen by precise magic: {1}" ,
988
+ new Object []{ file , fac .getClass ().getSimpleName ()});
994
989
}
995
990
return fac ;
996
991
}
@@ -1011,9 +1006,8 @@ private static AnalyzerFactory findForStream(InputStream in,
1011
1006
if (fac != null ) {
1012
1007
if (LOGGER .isLoggable (Level .FINEST )) {
1013
1008
LOGGER .log (Level .FINEST ,
1014
- "{0}: chosen by imprecise magic: {1}" ,
1015
- new Object []{file ,
1016
- fac .getClass ().getSimpleName () });
1009
+ "''{0}'': chosen by imprecise magic: {1}" ,
1010
+ new Object []{file , fac .getClass ().getSimpleName ()});
1017
1011
}
1018
1012
return fac ;
1019
1013
}
@@ -1030,9 +1024,8 @@ private static AnalyzerFactory findMagicString(String opening, String file) {
1030
1024
AnalyzerFactory fac = magics .get (fragment );
1031
1025
if (fac != null ) {
1032
1026
if (LOGGER .isLoggable (Level .FINEST )) {
1033
- LOGGER .log (Level .FINEST , "{0}: chosen by magic {2}: {1}" ,
1034
- new Object []{file , fac .getClass ().getSimpleName (),
1035
- fragment });
1027
+ LOGGER .log (Level .FINEST , "''{0}'': chosen by magic {2}: {1}" ,
1028
+ new Object []{file , fac .getClass ().getSimpleName (), fragment });
1036
1029
}
1037
1030
return fac ;
1038
1031
}
@@ -1042,9 +1035,8 @@ private static AnalyzerFactory findMagicString(String opening, String file) {
1042
1035
fac = magics .get (fragment );
1043
1036
if (fac != null ) {
1044
1037
if (LOGGER .isLoggable (Level .FINEST )) {
1045
- LOGGER .log (Level .FINEST , "{0}: chosen by magic {2}: {1}" ,
1046
- new Object []{file , fac .getClass ().getSimpleName (),
1047
- fragment });
1038
+ LOGGER .log (Level .FINEST , "''{0}'': chosen by magic {2}: {1}" ,
1039
+ new Object []{file , fac .getClass ().getSimpleName (), fragment });
1048
1040
}
1049
1041
return fac ;
1050
1042
}
@@ -1057,8 +1049,8 @@ private static AnalyzerFactory findMagicString(String opening, String file) {
1057
1049
fac = entry .getValue ();
1058
1050
if (LOGGER .isLoggable (Level .FINEST )) {
1059
1051
LOGGER .log (Level .FINEST ,
1060
- "{0}: chosen by magic(substr) {2}: {1}" , new Object []{
1061
- file , fac .getClass ().getSimpleName (), magic });
1052
+ "'' {0}'' : chosen by magic(substr) {2}: {1}" ,
1053
+ new Object []{ file , fac .getClass ().getSimpleName (), magic });
1062
1054
}
1063
1055
return fac ;
1064
1056
}
0 commit comments