@Test public void testLegacy() throws AccessPermissionException { Metadata m = getMetadata(false, false); AccessChecker checker = new AccessChecker(); checker.check(m); assertTrue("no exception", true); m = getMetadata(false, true); assertTrue("no exception", true); checker.check(m); m = getMetadata(true, true); assertTrue("no exception", true); checker.check(m); }
public void check(Metadata metadata) throws AccessPermissionException { if (!needToCheck) { return; } if ("false".equals(metadata.get(AccessPermissions.EXTRACT_CONTENT))) { if (allowAccessibility) { if ("true".equals(metadata.get(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY))) { return; } throw new AccessPermissionException("Content extraction for accessibility is not allowed."); } throw new AccessPermissionException("Content extraction is not allowed."); } }
AccessChecker implements Serializable { public void check(Metadata metadata) throws AccessPermissionException { if (!needToCheck) { return; } if ("false".equals(metadata.get(AccessPermissions.EXTRACT_CONTENT))) { if (allowAccessibility) { if ("true".equals(metadata.get(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY))) { return; } throw new AccessPermissionException("Content extraction for accessibility is not allowed."); } throw new AccessPermissionException("Content extraction is not allowed."); } } }
AccessChecker implements Serializable { public void check(Metadata metadata) throws AccessPermissionException { if (!needToCheck) { return; } if ("false".equals(metadata.get(AccessPermissions.EXTRACT_CONTENT))) { if (allowAccessibility) { if ("true".equals(metadata.get(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY))) { return; } throw new AccessPermissionException("Content extraction for accessibility is not allowed."); } throw new AccessPermissionException("Content extraction is not allowed."); } } AccessChecker();  AccessChecker(boolean allowExtractionForAccessibility); }
AccessChecker implements Serializable { public void check(Metadata metadata) throws AccessPermissionException { if (!needToCheck) { return; } if ("false".equals(metadata.get(AccessPermissions.EXTRACT_CONTENT))) { if (allowAccessibility) { if ("true".equals(metadata.get(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY))) { return; } throw new AccessPermissionException("Content extraction for accessibility is not allowed."); } throw new AccessPermissionException("Content extraction is not allowed."); } } AccessChecker();  AccessChecker(boolean allowExtractionForAccessibility); void check(Metadata metadata); @Override boolean equals(Object o); @Override int hashCode(); }
AccessChecker implements Serializable { public void check(Metadata metadata) throws AccessPermissionException { if (!needToCheck) { return; } if ("false".equals(metadata.get(AccessPermissions.EXTRACT_CONTENT))) { if (allowAccessibility) { if ("true".equals(metadata.get(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY))) { return; } throw new AccessPermissionException("Content extraction for accessibility is not allowed."); } throw new AccessPermissionException("Content extraction is not allowed."); } } AccessChecker();  AccessChecker(boolean allowExtractionForAccessibility); void check(Metadata metadata); @Override boolean equals(Object o); @Override int hashCode();  }