Search in sources :

Example 1 with ContentException

use of org.pentaho.platform.api.repository.ContentException in project pentaho-platform by pentaho.

the class ContentExceptionTest method testContentException3.

public void testContentException3() {
    logger.info("Expected: A Content Exception will be created with Throwable as a parameter");
    ContentException ce2 = new ContentException(new Throwable("This is a throwable exception"));
    System.out.println("ContentException" + ce2);
    assertTrue(true);
}
Also used : ContentException(org.pentaho.platform.api.repository.ContentException)

Example 2 with ContentException

use of org.pentaho.platform.api.repository.ContentException in project pentaho-platform by pentaho.

the class ContentExceptionTest method testContentException4.

public void testContentException4() {
    logger.info("Expected: Exception will be caught and thrown as a Content Exception");
    ContentException ce3 = new ContentException("A test UI Exception has been thrown", new Throwable());
    System.out.println("ContentException :" + ce3);
    assertTrue(true);
}
Also used : ContentException(org.pentaho.platform.api.repository.ContentException)

Example 3 with ContentException

use of org.pentaho.platform.api.repository.ContentException in project pentaho-platform by pentaho.

the class RepositoryFileContentItem method getInputStream.

public InputStream getInputStream() throws ContentException {
    if (inputStream == null) {
        try {
            RepositoryFileOutputStream outputStream = (RepositoryFileOutputStream) getOutputStream(null);
            if ((outputStream.autoCreateUniqueFileName) && !(outputStream.flushed)) {
                throw new FileNotFoundException("File not yet versioned.");
            }
            if (inputStream == null) {
                IUnifiedRepository repository = PentahoSystem.get(IUnifiedRepository.class);
                RepositoryFile repositoryFile = repository.getFile(outputStream.path);
                if ((repositoryFile == null) || repositoryFile.isFolder()) {
                    throw new FileNotFoundException();
                }
                return new RepositoryFileInputStream(repositoryFile);
            }
        } catch (FileNotFoundException e) {
            throw new ContentException(e);
        } catch (IOException e) {
            throw new ContentException(e);
        }
    }
    return inputStream;
}
Also used : FileNotFoundException(java.io.FileNotFoundException) ContentException(org.pentaho.platform.api.repository.ContentException) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) IOException(java.io.IOException) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 4 with ContentException

use of org.pentaho.platform.api.repository.ContentException in project pentaho-platform by pentaho.

the class ContentExceptionTest method testContentException2.

public void testContentException2() {
    logger.info("Expected: Exception will be caught and thrown as a Content Exception");
    ContentException ce1 = new ContentException("A test Content Exception has been thrown");
    System.out.println("ContentException :" + ce1);
    assertTrue(true);
}
Also used : ContentException(org.pentaho.platform.api.repository.ContentException)

Example 5 with ContentException

use of org.pentaho.platform.api.repository.ContentException in project pentaho-platform by pentaho.

the class MultipleComponentIT method testMiscExceptionClasses.

/*
   * public void testCrosstab() { startTest(); IRuntimeContext context = run("test", "rules", "CrossTabTest.xaction");
   * //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ assertEquals(
   * Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS,
   * context.getStatus()); //$NON-NLS-1$ IActionParameter rtn = context.getOutputParameter("rule-result"); //$NON-NLS-1$
   * assertNotNull(rtn); IPentahoResultSet resultset = (IPentahoResultSet) rtn.getValue();
   * assertEquals(resultset.getRowCount(), 7); Object[][] colHeaders = resultset.getMetaData().getColumnHeaders();
   * assertEquals(colHeaders[0][0], "DEPARTMENT"); //$NON-NLS-1$ assertEquals(colHeaders[0][1], "Central"); //$NON-NLS-1$
   * assertEquals(colHeaders[0][2], "Western"); //$NON-NLS-1$ assertEquals(colHeaders[0][3], "Southern"); //$NON-NLS-1$
   * assertEquals(colHeaders[0][4], "Eastern"); //$NON-NLS-1$
   * 
   * finishTest(); }
   */
public void testMiscExceptionClasses() {
    // Making sure we create an instance of all the Hitachi Vantara
    // Exception classes.
    startTest();
    Exception ex = new RepositoryException();
    // $NON-NLS-1$
    Exception ex2 = new RepositoryException("Ignored");
    Exception ex3 = new RepositoryException(ex2);
    // $NON-NLS-1$
    Exception ex4 = new RepositoryException("Ignored", ex3);
    Exception ex5 = new AuditException();
    // $NON-NLS-1$
    Exception ex6 = new AuditException("Ignored");
    // $NON-NLS-1$
    Exception ex7 = new AuditException("Ignored", ex);
    Exception ex8 = new AuditException(ex4);
    // $NON-NLS-1$
    ex = new ContentException("Ignored");
    // $NON-NLS-1$
    ex = new ContentException("Ignored", ex5);
    ex = new ContentException(ex6);
    ex = new InvalidParameterException();
    ex = new SQLResultSetException();
    ex = new PentahoChainedException();
    // $NON-NLS-1$
    ex = new PentahoChainedException("Ignored");
    // $NON-NLS-1$
    ex = new PentahoChainedException("Ignored", ex7);
    ex = new PentahoChainedException(ex8);
    finishTest();
}
Also used : InvalidParameterException(org.pentaho.platform.api.engine.InvalidParameterException) SQLResultSetException(org.pentaho.platform.plugin.services.connections.sql.SQLResultSetException) PentahoChainedException(org.pentaho.platform.api.util.PentahoChainedException) AuditException(org.pentaho.platform.api.engine.AuditException) ContentException(org.pentaho.platform.api.repository.ContentException) RepositoryException(org.pentaho.platform.api.repository.RepositoryException) SQLResultSetException(org.pentaho.platform.plugin.services.connections.sql.SQLResultSetException) InvalidParameterException(org.pentaho.platform.api.engine.InvalidParameterException) AuditException(org.pentaho.platform.api.engine.AuditException) ContentException(org.pentaho.platform.api.repository.ContentException) PentahoChainedException(org.pentaho.platform.api.util.PentahoChainedException) RepositoryException(org.pentaho.platform.api.repository.RepositoryException)

Aggregations

ContentException (org.pentaho.platform.api.repository.ContentException)5 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 AuditException (org.pentaho.platform.api.engine.AuditException)1 InvalidParameterException (org.pentaho.platform.api.engine.InvalidParameterException)1 RepositoryException (org.pentaho.platform.api.repository.RepositoryException)1 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)1 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)1 PentahoChainedException (org.pentaho.platform.api.util.PentahoChainedException)1 SQLResultSetException (org.pentaho.platform.plugin.services.connections.sql.SQLResultSetException)1