4141import org .xml .sax .InputSource ;
4242
4343/**
44- * Utitlity class to read a checkstyle configuration and transform to the plugins module objects.
44+ * Utility class to read a checkstyle configuration and transform to the plugins module objects.
4545 *
4646 * @author Lars Ködderitzsch
4747 */
@@ -55,22 +55,68 @@ public final class ConfigurationReader {
5555 //
5656
5757 /** Map containing the public - internal DTD mapping. */
58- private static final Map <String , String > PUBLIC2INTERNAL_DTD_MAP = new HashMap <>() ;
58+ private static final Map <String , String > PUBLIC2INTERNAL_DTD_MAP ;
5959
60- static {
60+ /** The public ID for version 1_0 of the configuration dtd. */
61+ private static final String DTD_PUBLIC_ID_1_0 =
62+ "-//Puppy Crawl//DTD Check Configuration 1.0//EN" ;
63+
64+ /** The new public ID for version 1_0 of the configuration dtd. */
65+ private static final String DTD_PUBLIC_CS_ID_1_0 =
66+ "-//Checkstyle//DTD Checkstyle Configuration 1.0//EN" ;
67+
68+ /** The resource for version 1_0 of the configuration dtd. */
69+ private static final String DTD_CONFIGURATION_NAME_1_0 =
70+ "com/puppycrawl/tools/checkstyle/configuration_1_0.dtd" ;
71+
72+ /** The public ID for version 1_1 of the configuration dtd. */
73+ private static final String DTD_PUBLIC_ID_1_1 =
74+ "-//Puppy Crawl//DTD Check Configuration 1.1//EN" ;
75+
76+ /** The new public ID for version 1_1 of the configuration dtd. */
77+ private static final String DTD_PUBLIC_CS_ID_1_1 =
78+ "-//Checkstyle//DTD Checkstyle Configuration 1.1//EN" ;
79+
80+ /** The resource for version 1_1 of the configuration dtd. */
81+ private static final String DTD_CONFIGURATION_NAME_1_1 =
82+ "com/puppycrawl/tools/checkstyle/configuration_1_1.dtd" ;
83+
84+ /** The public ID for version 1_2 of the configuration dtd. */
85+ private static final String DTD_PUBLIC_ID_1_2 =
86+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN" ;
6187
62- PUBLIC2INTERNAL_DTD_MAP .put ("-//Puppy Crawl//DTD Check Configuration 1.0//EN" , //$NON-NLS-1$
63- "com/puppycrawl/tools/checkstyle/configuration_1_0.dtd" ); //$NON-NLS-1$
64- PUBLIC2INTERNAL_DTD_MAP .put ("-//Puppy Crawl//DTD Check Configuration 1.1//EN" , //$NON-NLS-1$
65- "com/puppycrawl/tools/checkstyle/configuration_1_1.dtd" ); //$NON-NLS-1$
66- PUBLIC2INTERNAL_DTD_MAP .put ("-//Puppy Crawl//DTD Check Configuration 1.2//EN" , //$NON-NLS-1$
67- "com/puppycrawl/tools/checkstyle/configuration_1_2.dtd" ); //$NON-NLS-1$
68- PUBLIC2INTERNAL_DTD_MAP .put ("-//Puppy Crawl//DTD Check Configuration 1.3//EN" , //$NON-NLS-1$
69- "com/puppycrawl/tools/checkstyle/configuration_1_3.dtd" ); //$NON-NLS-1$
70- PUBLIC2INTERNAL_DTD_MAP .put ("-//Puppy Crawl//DTD Check Configuration 1.3//EN" , //$NON-NLS-1$
71- "com/puppycrawl/tools/checkstyle/configuration_1_3.dtd" ); //$NON-NLS-1$
72- PUBLIC2INTERNAL_DTD_MAP .put ("-//Checkstyle//DTD Check Configuration 1.3//EN" , //$NON-NLS-1$
73- "com/puppycrawl/tools/checkstyle/configuration_1_3.dtd" ); //$NON-NLS-1$
88+ /** The new public ID for version 1_2 of the configuration dtd. */
89+ private static final String DTD_PUBLIC_CS_ID_1_2 =
90+ "-//Checkstyle//DTD Checkstyle Configuration 1.2//EN" ;
91+
92+ /** The resource for version 1_2 of the configuration dtd. */
93+ private static final String DTD_CONFIGURATION_NAME_1_2 =
94+ "com/puppycrawl/tools/checkstyle/configuration_1_2.dtd" ;
95+
96+ /** The public ID for version 1_3 of the configuration dtd. */
97+ private static final String DTD_PUBLIC_ID_1_3 =
98+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN" ;
99+
100+ /** The new public ID for version 1_3 of the configuration dtd. */
101+ private static final String DTD_PUBLIC_CS_ID_1_3 =
102+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" ;
103+
104+ /** The resource for version 1_3 of the configuration dtd. */
105+ private static final String DTD_CONFIGURATION_NAME_1_3 =
106+ "com/puppycrawl/tools/checkstyle/configuration_1_3.dtd" ;
107+
108+ static {
109+ final Map <String , String > map = new HashMap <>();
110+ map .put (DTD_PUBLIC_ID_1_0 , DTD_CONFIGURATION_NAME_1_0 );
111+ map .put (DTD_PUBLIC_ID_1_1 , DTD_CONFIGURATION_NAME_1_1 );
112+ map .put (DTD_PUBLIC_ID_1_2 , DTD_CONFIGURATION_NAME_1_2 );
113+ map .put (DTD_PUBLIC_ID_1_3 , DTD_CONFIGURATION_NAME_1_3 );
114+ map .put (DTD_PUBLIC_CS_ID_1_0 , DTD_CONFIGURATION_NAME_1_0 );
115+ map .put (DTD_PUBLIC_CS_ID_1_1 , DTD_CONFIGURATION_NAME_1_1 );
116+ map .put (DTD_PUBLIC_CS_ID_1_2 , DTD_CONFIGURATION_NAME_1_2 );
117+ map .put (DTD_PUBLIC_CS_ID_1_3 , DTD_CONFIGURATION_NAME_1_3 );
118+
119+ PUBLIC2INTERNAL_DTD_MAP = map ;
74120 }
75121
76122 /** Hidden default constructor to prevent instantiation. */
@@ -79,7 +125,7 @@ private ConfigurationReader() {
79125 }
80126
81127 /**
82- * Reads the checkstyle configuration from the given stream an returs a list of all modules within
128+ * Reads the checkstyle configuration from the given stream and returns a list of all modules within
83129 * this configuration.
84130 *
85131 * @param in
0 commit comments