Source:
<code>public boolean chkAuthorization(String userName, Object workspaceObj, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { String workspaceId = null; IWorkSpace workspace; if (workspaceObj instanceof String) { workspaceId = (String) workspaceObj; workspace = wsManager.getWorkspaceDetails(workspaceId, userName); } else { try { workspace = (IWorkSpace) workspaceObj; } catch (ClassCastException cce) { throw new IllegalObjectException(cce); } } if (workspace == null) <START> { <END> throw new QuadrigaAccessException(); } if (workspace.getOwner() != null) { if (userName.equals(workspace.getOwner().getUserName())) { return true; } else { if (userRoles.length > 0) { ArrayList<String> roles = getAccessRoleList(userRoles); List<IWorkspaceCollaborator> workspaceCollaboratorList = workspace.getWorkspaceCollaborators(); List<IQuadrigaRole> collaboratorRoles = null; if (workspaceCollaboratorList != null) { for (IWorkspaceCollaborator workspaceCollaborator : workspaceCollaboratorList) { String collaboratorName = null; if (workspaceCollaborator.getCollaborator() != null) { collaboratorName = workspaceCollaborator.getCollaborator().getUserObj().getUserName(); } if (collaboratorName != null) { if (userName.equals(collaboratorName)) { if (workspaceCollaborator.getCollaborator() != null) { collaboratorRoles = workspaceCollaborator.getCollaborator() .getCollaboratorRoles(); } if (collaboratorRoles != null) { for (IQuadrigaRole collabRole : collaboratorRoles) { String collaboratorRoleId = collabRole.getId(); if (roles.contains(collaboratorRoleId)) { return true; } } } } } } } } } } return false; }</code><technical_language>formatting</technical_language>

Target:
public boolean chkAuthorization(String userName, Object workspaceObj, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { IWorkSpace workspace; if (workspaceObj instanceof String) { String workspaceId = (String) workspaceObj; workspace = wsManager.getWorkspaceDetails(workspaceId, userName); } else { try { workspace = (IWorkSpace) workspaceObj; } catch (ClassCastException cce) { throw new IllegalObjectException(cce); } } if (workspace == null) { throw new QuadrigaAccessException(); } if (workspace.getOwner() != null) { if (userName.equals(workspace.getOwner().getUserName())) { return true; } else { if (userRoles.length > 0) { List<String> roles = Arrays.asList(userRoles); List<IWorkspaceCollaborator> workspaceCollaboratorList = workspace.getWorkspaceCollaborators(); List<IQuadrigaRole> collaboratorRoles = null; if (workspaceCollaboratorList != null) { for (IWorkspaceCollaborator workspaceCollaborator : workspaceCollaboratorList) { String collaboratorName = null; if (workspaceCollaborator.getCollaborator() != null) { collaboratorName = workspaceCollaborator.getCollaborator().getUserObj().getUserName(); } if (collaboratorName != null) { if (userName.equals(collaboratorName)) { if (workspaceCollaborator.getCollaborator() != null) { collaboratorRoles = workspaceCollaborator.getCollaborator() .getCollaboratorRoles(); } if (collaboratorRoles != null) { for (IQuadrigaRole collabRole : collaboratorRoles) { String collaboratorRoleId = collabRole.getId(); if (roles.contains(collaboratorRoleId)) { return true; } } } } } } } } } } return false; }