eclipse-ee4j / metro-jax-ws

metro-jax-ws
https://eclipse-ee4j.github.io/metro-jax-ws/
BSD 3-Clause "New" or "Revised" License
70 stars 40 forks source link

Bugno34600318 #630

Closed vavishal closed 1 year ago

vavishal commented 1 year ago

The faultstring in the SOAPFault contains the exception message if any which is the default current behavior

The customer has a requirement where they do not want any exception messages to be displayed in the faultstring for security concerns of exposing class

Therefore, we are adding a new system property -Dcom.sun.xml.ws.fault.doNotPrintExpMsg=true to implement the behavior requested by the customer

Added testcase at ./jaxws-ri/runtime/rt/src/test/java/com/sun/xml/ws/fault/SOAPFaultBuilderTest.java

vavishal commented 1 year ago

I have tried to create the private variable as follows in SOAPFaultBuilder.java

private static final boolean captureExceptionMessage = getBooleanSystemProperty();

private static boolean getBooleanSystemProperty() { final String propertyString = System.getProperty("com.sun.xml.ws.fault.SOAPFaultBuilder.captureExceptionMessage"); if (propertyString == null) { //default value return true; } else { return Boolean.getBoolean(propertyString); } }

But the above change is causing the testcase at SOAPFaultBuilderTest.java to fail always since while executing the ExceptionBeanTest.java it calls the SOAPFaultBuilder which initialized the property captureExceptionMessage with default value and also its value is not getting changed in SOAPFaultBuilderTest.java as captureExceptionMessage is a static variable

lukasj commented 1 year ago

would non-final field with package private/public access or having public getter/setter for the field to toggle the value help the test?

vavishal commented 1 year ago

The following piece of code and then calling SOAPFaultBuilder.setCaptureExceptionMessage(); from the testcase helped

private static boolean captureExceptionMessage = getBooleanSystemProperty();

private static boolean getBooleanSystemProperty() { final String propertyString = System.getProperty("com.sun.xml.ws.fault.SOAPFaultBuilder.captureExceptionMessage"); if (propertyString == null) { default value return true; } else { return Boolean.getBoolean(propertyString); } } public static boolean getCaptureExceptionMessage() { return captureExceptionMessage; } public static void setCaptureExceptionMessage() { captureExceptionMessage = getBooleanSystemProperty(); }

vavishal commented 1 year ago

Gentle reminder to review this change