private static Void checkPermission() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { if (!allowSubclass) sm.checkPermission(new SerializablePermission("enableSubclassImplementation")); } return null; }
private static Void checkPermission() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SerializablePermission( "enableSubclassImplementation")); } return null; }
/** * {@inheritDoc} * * @see java.lang.SecurityManager#checkPermission(java.security.Permission) */ @Override public void checkPermission ( Permission perm ) { if ( perm instanceof RuntimePermission ) { if ( checkRuntimePermission((RuntimePermission) perm) ) { return; } } else if ( perm instanceof ReflectPermission ) { return; } else if ( perm instanceof LoggingPermission ) { return; } else if ( perm instanceof SecurityPermission ) { return; } else if ( perm instanceof PropertyPermission ) { return; } else if ( perm instanceof NetPermission && perm.getName().equals("specifyStreamHandler") ) { return; } else if ( perm instanceof FilePermission && perm.getActions().equals("read") ) { return; } else if ( perm instanceof SerializablePermission ) { return; } super.checkPermission(perm); }
/** * Set the process-wide filter if it has not already been configured or set. * * @param filter the serialization filter to set as the process-wide filter; not null * @throws SecurityException if there is security manager and the * {@code SerializablePermission("serialFilter")} is not granted * @throws IllegalStateException if the filter has already been set {@code non-null} */ public static void setSerialFilter(ObjectInputFilter filter) { Objects.requireNonNull(filter, "filter"); SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SerializablePermission("serialFilter")); } synchronized (serialFilterLock) { if (serialFilter != null) { throw new IllegalStateException("Serial filter can only be set once"); } serialFilter = filter; } }
private static void isCustomSerializationPermitted() { SecurityManager sm = System.getSecurityManager(); if ( sm != null) { // check that a serialization permission has been // set to allow the loading of the Util delegate // which provides access to custom ValueHandler sm.checkPermission(new SerializablePermission( "enableCustomValueHandler")); } }
private static void isCustomSerializationPermitted() { SecurityManager sm = System.getSecurityManager(); if (!allowCustomValueHandler) { if ( sm != null) { // check that a serialization permission has been // set to allow the loading of the Util delegate // which provides access to custom ValueHandler sm.checkPermission(new SerializablePermission( "enableCustomValueHandler")); } } }
/** * @tests java.io.SerializablePermission#SerializablePermission(java.lang.String) */ @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "SerializablePermission", args = {java.lang.String.class} ) public void test_ConstructorLjava_lang_String() { // Test for method java.io.SerializablePermission(java.lang.String) assertEquals("permission ill-formed", "enableSubclassImplementation", new SerializablePermission( "enableSubclassImplementation").getName()); }
/** * @tests java.io.SerializablePermission#SerializablePermission(java.lang.String, * java.lang.String) */ @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "SerializablePermission", args = {java.lang.String.class, java.lang.String.class} ) public void test_ConstructorLjava_lang_StringLjava_lang_String() { // Test for method java.io.SerializablePermission(java.lang.String, // java.lang.String) assertEquals("permission ill-formed", "enableSubclassImplementation", new SerializablePermission( "enableSubclassImplementation", "").getName()); }
/** * @tests java.io.SerializablePermission#SerializablePermission(java.lang.String) */ public void test_ConstructorLjava_lang_String() { // Test for method java.io.SerializablePermission(java.lang.String) assertEquals("permission ill-formed", "enableSubclassImplementation", new SerializablePermission( "enableSubclassImplementation").getName()); }
/** * @tests java.io.SerializablePermission#SerializablePermission(java.lang.String, * java.lang.String) */ public void test_ConstructorLjava_lang_StringLjava_lang_String() { // Test for method java.io.SerializablePermission(java.lang.String, // java.lang.String) assertEquals("permission ill-formed", "enableSubclassImplementation", new SerializablePermission( "enableSubclassImplementation", "").getName()); }