2121import static org .apache .ofbiz .base .util .UtilMisc .toSet ;
2222import static org .apache .ofbiz .base .util .UtilObject .getObjectException ;
2323import static org .apache .ofbiz .base .util .UtilObject .getObjectFromFactory ;
24+ import static org .hamcrest .MatcherAssert .assertThat ;
2425import static org .hamcrest .Matchers .contains ;
2526import static org .junit .Assert .assertEquals ;
2627import static org .junit .Assert .assertNotNull ;
2728import static org .junit .Assert .assertNotSame ;
2829import static org .junit .Assert .assertNull ;
29- import static org .hamcrest .MatcherAssert .assertThat ;
3030
3131import java .io .ByteArrayInputStream ;
3232import java .io .ByteArrayOutputStream ;
@@ -51,7 +51,7 @@ public class UtilObjectTests {
5151 @ After
5252 public void cleanUp () {
5353 // Ensure that the default value of allowed deserialization classes is used.
54- UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "ListOfSafeObjectsForInputStream " , "" );
54+ UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "allowList " , "" );
5555 }
5656
5757 public static final class ErrorInjector extends FilterInputStream {
@@ -333,22 +333,19 @@ public void testGetObjectExceptionSafe() throws IOException, ClassNotFoundExcept
333333 // Test reading a valid customized list of string object.
334334 @ Test
335335 public void testGetObjectExceptionCustomized () throws IOException , ClassNotFoundException {
336- UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "ListOfSafeObjectsForInputStream" ,
337- "java.util.Arrays.ArrayList,java.lang.String" );
336+ UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "allowList" , "java.util.Arrays.ArrayList,java.lang.String" );
338337 testGetObjectExceptionSafe ();
339338
340339 // With extra whitespace
341- UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "ListOfSafeObjectsForInputStream" ,
342- "java.util.Arrays.ArrayList, java.lang.String" );
340+ UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "allowList" , "java.util.Arrays.ArrayList, java.lang.String" );
343341 testGetObjectExceptionSafe ();
344342 }
345343
346344 // Test reading a basic list of string object after forbidding such kind of objects.
347345 @ Test (expected = ClassCastException .class )
348346 public void testGetObjectExceptionUnsafe () throws IOException , ClassNotFoundException {
349347 // Only allow object of type where the package prefix is 'org.apache.ofbiz'
350- UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "ListOfSafeObjectsForInputStream" ,
351- "org.apache.ofbiz..*" );
348+ UtilProperties .setPropertyValueInMemory ("SafeObjectInputStream" , "allowList" , "org.apache.ofbiz..*" );
352349 try (ByteArrayOutputStream bos = new ByteArrayOutputStream ();
353350 ObjectOutputStream oos = new ObjectOutputStream (bos )) {
354351 List <String > forbiddenObject = Arrays .asList ("foo" , "bar" , "baz" );
0 commit comments