Search in sources :

Example 16 with ExceptionUtils.getStackTrace

use of org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace in project azure-tools-for-java by Microsoft.

the class StorageAccountFolderNode method refreshItems.

@Override
protected void refreshItems() {
    if (!clusterDetail.isEmulator()) {
        try {
            if (isStorageAccountsAvailable(clusterDetail)) {
                clusterDetail.getConfigurationInfo();
                Optional.ofNullable(clusterDetail.getStorageAccount()).map(defaultStorageAccount -> new StorageAccountNode(this, defaultStorageAccount, clusterDetail, true)).ifPresent(this::addChildNode);
                List<HDStorageAccount> additionalStorageAccount = clusterDetail.getAdditionalStorageAccounts();
                if (additionalStorageAccount != null) {
                    for (HDStorageAccount account : additionalStorageAccount) {
                        addChildNode(new StorageAccountNode(this, account, clusterDetail, false));
                    }
                }
            }
        } catch (Exception ex) {
            String exceptionMsg = ex.getCause() == null ? "" : ex.getCause().getMessage();
            String errorHint = String.format("Failed to get HDInsight cluster %s configuration. ", clusterDetail.getName());
            log().warn(errorHint + ExceptionUtils.getStackTrace(ex));
            DefaultLoader.getUIHelper().showError(errorHint + exceptionMsg, "HDInsight Explorer");
        }
    }
}
Also used : NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull) HDStorageAccount(com.microsoft.azure.hdinsight.sdk.storage.HDStorageAccount) HDInsightAdditionalClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.HDInsightAdditionalClusterDetail) Node(com.microsoft.tooling.msservices.serviceexplorer.Node) CommonConst(com.microsoft.azure.hdinsight.common.CommonConst) HDInsightLoader(com.microsoft.azure.hdinsight.common.HDInsightLoader) ILogger(com.microsoft.azure.hdinsight.common.logger.ILogger) List(java.util.List) ClusterManagerEx(com.microsoft.azure.hdinsight.common.ClusterManagerEx) TelemetryConstants(com.microsoft.azuretools.telemetry.TelemetryConstants) DefaultLoader(com.microsoft.tooling.msservices.components.DefaultLoader) Optional(java.util.Optional) RefreshableNode(com.microsoft.tooling.msservices.serviceexplorer.RefreshableNode) IHDIStorageAccount(com.microsoft.azure.hdinsight.sdk.storage.IHDIStorageAccount) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) HDStorageAccount(com.microsoft.azure.hdinsight.sdk.storage.HDStorageAccount)

Example 17 with ExceptionUtils.getStackTrace

use of org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace in project GDSC-SMLM by aherbert.

the class SeriesImageSource method openSource.

@Override
protected boolean openSource() {
    // Object deserialisation of old data may have non tiff images so check.
    if (!isTiffSeries || images.isEmpty()) {
        return false;
    }
    initialise();
    if (frames == 0) {
        return false;
    }
    // Reset if already open
    // (Should we support only closing the sequential reading functionality)
    close();
    // Open the first TIFF image
    lastImage = openImage(0, images.get(0));
    lastImageId = 0;
    if (lastImage != null && lastImage.size > 0) {
        try {
            // Ignore the pixels returned. This will throw if they are null.
            lastImage.getFrame(0);
            setDimensions(lastImage.width, lastImage.height);
            // Attempt to get the origin if a MicroManager image
            final Rectangle roi = FastTiffDecoder.getOrigin(((TiffImage) lastImage).info[0]);
            if (roi != null && roi.width == getWidth() && roi.height == getHeight()) {
                setOrigin(roi.x, roi.y);
            }
            return true;
        } catch (final Exception ex) {
            // not bubbled up then the source is not opened.
            if (trackProgress.isLog()) {
                trackProgress.log("Failed to open: %s", ExceptionUtils.getStackTrace(ex));
            }
        }
    }
    return false;
}
Also used : Rectangle(java.awt.Rectangle) DataException(uk.ac.sussex.gdsc.core.data.DataException) ConcurrentRuntimeException(org.apache.commons.lang3.concurrent.ConcurrentRuntimeException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

ExceptionUtils (org.apache.commons.lang3.exception.ExceptionUtils)16 IOException (java.io.IOException)11 List (java.util.List)11 LoggerFactory (org.slf4j.LoggerFactory)9 Map (java.util.Map)7 ArrayList (java.util.ArrayList)6 TimeUnit (java.util.concurrent.TimeUnit)6 BlockStoreException (org.bitcoinj.store.BlockStoreException)6 Logger (org.slf4j.Logger)6 Paths (java.nio.file.Paths)4 Arrays (java.util.Arrays)4 Executors (java.util.concurrent.Executors)4 Level (ch.qos.logback.classic.Level)3 Logger (ch.qos.logback.classic.Logger)3 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)3 Guice (com.google.inject.Guice)3 Injector (com.google.inject.Injector)3 URI (java.net.URI)3 HashMap (java.util.HashMap)3 Optional (java.util.Optional)3