Example usage for java.lang InternalError InternalError

List of usage examples for java.lang InternalError InternalError

Introduction

In this page you can find the example usage for java.lang InternalError InternalError.

Prototype

public InternalError() 

Source Link

Document

Constructs an InternalError with no detail message.

Usage

From source file:com.projity.pm.resource.EnterpriseResource.java

public Object clone() {
    try {//  w w w . ja  va2s . co m
        EnterpriseResource resource = (EnterpriseResource) super.clone();
        resource.hasKey = new HasKeyImpl(isLocal() && Environment.getStandAlone(), resource);
        resource.setName(new String(getName()));
        if (notes != null)
            resource.notes = new String(notes);
        if (group != null)
            resource.group = new String(group);
        if (group != null)
            resource.initials = new String(initials);
        if (phonetics != null)
            resource.phonetics = new String(phonetics);
        if (rbsCode != null)
            resource.rbsCode = new String(rbsCode);
        if (emailAddress != null)
            resource.emailAddress = new String(emailAddress);
        if (materialLabel != null)
            resource.materialLabel = new String(materialLabel);
        if (userAccount != null)
            resource.userAccount = new String(userAccount);

        resource.costRateTables = (CostRateTables) costRateTables.clone();
        resource.hasAssignments = (HasAssignments) ((HasAssignmentsImpl) hasAssignments)
                .cloneWithResource(resource);
        resource.customFields = (CustomFieldsImpl) customFields.clone();

        resource.availabilityTable = (AvailabilityTable) availabilityTable.clone();
        resource.availabilityTable.initAfterCloning();

        return resource;
    } catch (CloneNotSupportedException e) {
        throw new InternalError();
    }
}

From source file:org.pentaho.platform.web.http.api.resources.services.FileServiceTest.java

@Test
public void testDoGetFileLocalesException() {
    String param = "file1";
    RepositoryFileDto repositoryFileDto = mock(RepositoryFileDto.class);

    doReturn(param).when(repositoryFileDto).getId();
    doReturn(repositoryFileDto).when(fileService.defaultUnifiedRepositoryWebService).getFile("/" + param);
    when(fileService.defaultUnifiedRepositoryWebService
            .getAvailableLocalesForFileById(repositoryFileDto.getId())).thenThrow(new InternalError());

    try {/*from  w w  w . j  a  va  2 s  . co  m*/
        fileService.doGetFileLocales(param);
    } catch (FileNotFoundException e) {
        fail();
    } catch (InternalError e) {
        verify(fileService.getRepository(), times(0)).getAvailableLocalesForFileById(repositoryFileDto.getId());
    }
}

From source file:org.pentaho.platform.web.http.api.resources.services.FileServiceTest.java

@Test
public void testDoCanAdministerException() throws Exception {
    IAuthorizationPolicy authorizationPolicy = mock(IAuthorizationPolicy.class);
    doReturn(authorizationPolicy).when(fileService).getPolicy();

    doThrow(new InternalError()).when(authorizationPolicy).isAllowed(RepositoryReadAction.NAME);
    doReturn(true).when(authorizationPolicy).isAllowed(RepositoryCreateAction.NAME);
    doReturn(false).when(authorizationPolicy).isAllowed(AdministerSecurityAction.NAME);

    try {/*  w w w .  j a v a 2s  . c o  m*/
        assertFalse(fileService.doCanAdminister());
        fail();
    } catch (InternalError e) {
    }

    doReturn(false).when(authorizationPolicy).isAllowed(RepositoryReadAction.NAME);
    doThrow(new InternalError()).when(authorizationPolicy).isAllowed(RepositoryCreateAction.NAME);
    doReturn(true).when(authorizationPolicy).isAllowed(AdministerSecurityAction.NAME);

    try {
        assertFalse(fileService.doCanAdminister());
    } catch (InternalError e) { //the first comparison fail and the result should be false and no exception returned
        fail();
    }

    doReturn(true).when(authorizationPolicy).isAllowed(RepositoryReadAction.NAME);
    doReturn(false).when(authorizationPolicy).isAllowed(RepositoryCreateAction.NAME);
    doThrow(new InternalError()).when(authorizationPolicy).isAllowed(AdministerSecurityAction.NAME);

    try {
        assertFalse(fileService.doCanAdminister());
    } catch (InternalError e) { //the second comparison fail and the result should be false and no exception returned
        fail();
    }
}

From source file:org.hippoecm.repository.FacetedNavigationEngineImpl.java

/**
 * Creates a path with a single element out of the given <code>name</code>.
 *
 * @param name the name to create the path from.
 * @return a path with a single element.
 *//*www .ja v  a  2  s. c  om*/
private static Path createPath(Name name) {
    try {
        PathBuilder builder = new PathBuilder();
        builder.addLast(name);
        return builder.getPath();
    } catch (MalformedPathException e) {
        // never happens, we just added an element
        throw new InternalError();
    }
}

From source file:com.projity.pm.task.Task.java

public Object clone() {
    try {//from  w w  w  .  ja  v a2s  . c o  m
        Task task = (Task) super.clone();
        _cloneTo(task);
        //            Handle wbs outside
        return task;
    } catch (CloneNotSupportedException e) {
        throw new InternalError();
    }
}

From source file:NavigableMap.java

/**
 * Returns a shallow copy of this <tt>Map</tt> instance. (The keys and
 * values themselves are not cloned.)//from   w ww . j a va 2 s .  co  m
 * 
 * @return a shallow copy of this Map.
 */
public Object clone() {
    ConcurrentSkipListMap<K, V> clone = null;
    try {
        clone = (ConcurrentSkipListMap<K, V>) super.clone();
    } catch (CloneNotSupportedException e) {
        throw new InternalError();
    }

    clone.initialize();
    clone.buildFromSorted(this);
    return clone;
}

From source file:com.projity.pm.assignment.Assignment.java

public Object clone() {
    try {/*from  www  .  ja  va 2  s  .c  o m*/
        Assignment a = (Assignment) super.clone();
        a.hasKey = new HasKeyImpl(true, a);
        a.setName(getName());
        //         barClosureInstance = new BarClosure();
        a.detail = (AssignmentDetail) detail.clone();
        return a;
    } catch (CloneNotSupportedException e) {
        throw new InternalError();
    }
}