Added a customized checkstyle configuration file to tame the Maven 2 checkstyle report to the extent that it gives some useful infomation. Tidied up comments, excessively long lines, use of tabs etc. to match.
This commit is contained in:
@@ -53,9 +53,9 @@ public class WebXmlConverter {
|
||||
private Document newWebXml, acegiBeansXml;
|
||||
|
||||
public WebXmlConverter() throws IOException, TransformerConfigurationException {
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Source source = createTransformerSource(WEB_TO_SPRING_XSL_FILE);
|
||||
System.out.println("1");
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Source source = createTransformerSource(WEB_TO_SPRING_XSL_FILE);
|
||||
System.out.println("1");
|
||||
acegiSecurityTransformer = tf.newTransformer(source);
|
||||
System.out.println("2");
|
||||
newWebXmlTransformer = tf.newTransformer(createTransformerSource(NEW_WEB_XSLT_FILE));
|
||||
@@ -109,14 +109,14 @@ public class WebXmlConverter {
|
||||
private void validateWebXml(Document document) throws DocumentException {
|
||||
Node authMethodNode =
|
||||
document.selectSingleNode("/web-app/login-config/auth-method");
|
||||
if(authMethodNode == null)
|
||||
if (authMethodNode == null)
|
||||
throw new DocumentException("login-config and auth-method must be present");
|
||||
String authMethod = authMethodNode.getStringValue().toUpperCase();
|
||||
if(!authMethod.equals("BASIC") && !authMethod.equals("FORM")) {
|
||||
if (!authMethod.equals("BASIC") && !authMethod.equals("FORM")) {
|
||||
throw new DocumentException("unsupported auth-method: " + authMethod);
|
||||
}
|
||||
List roles = document.selectNodes("/web-app/security-role");
|
||||
if(roles.isEmpty()) {
|
||||
if (roles.isEmpty()) {
|
||||
throw new DocumentException("Each role used must be defined in a security-role element");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,24 +32,24 @@ import org.dom4j.io.XMLWriter;
|
||||
*/
|
||||
public class WebXmlConverterTests extends TestCase {
|
||||
|
||||
private static final String XML_TRANSFORMER = "javax.xml.transform.TransformerFactory";
|
||||
|
||||
private static final String XML_TRANSFORMER = "javax.xml.transform.TransformerFactory";
|
||||
|
||||
public void testFileConversion() throws Exception {
|
||||
/*
|
||||
|
||||
THIS TEST HAS BEEN DISABLED AS IT BREAKS THE BUILD (see SEC-181 for details)
|
||||
|
||||
WebXmlConverter converter;
|
||||
try {
|
||||
converter = new WebXmlConverter();
|
||||
} catch (Exception e) {
|
||||
// TODO: Something went wrong, set transforer manually and retry...
|
||||
System.out.println("**** WARNING: NEEDING TO FALLBACK TO A MANUAL SYSTEM PROPERTY ****");
|
||||
System.setProperty(XML_TRANSFORMER, "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
|
||||
System.out.println(XML_TRANSFORMER + ": " + System.getProperty(XML_TRANSFORMER));
|
||||
converter = new WebXmlConverter();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
THIS TEST HAS BEEN DISABLED AS IT BREAKS THE BUILD (see SEC-181 for details)
|
||||
|
||||
WebXmlConverter converter;
|
||||
try {
|
||||
converter = new WebXmlConverter();
|
||||
} catch (Exception e) {
|
||||
// TODO: Something went wrong, set transforer manually and retry...
|
||||
System.out.println("**** WARNING: NEEDING TO FALLBACK TO A MANUAL SYSTEM PROPERTY ****");
|
||||
System.setProperty(XML_TRANSFORMER, "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
|
||||
System.out.println(XML_TRANSFORMER + ": " + System.getProperty(XML_TRANSFORMER));
|
||||
converter = new WebXmlConverter();
|
||||
}
|
||||
|
||||
Resource r = new ClassPathResource("test-web.xml");
|
||||
converter.setInput(r.getInputStream());
|
||||
converter.doConversion();
|
||||
|
||||
Reference in New Issue
Block a user