Example usage for org.apache.commons.io FileUtils byteCountToDisplaySize

List of usage examples for org.apache.commons.io FileUtils byteCountToDisplaySize

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils byteCountToDisplaySize.

Prototype

public static String byteCountToDisplaySize(long size) 

Source Link

Document

Returns a human-readable version of the file size, where the input represents a specific number of bytes.

Usage

From source file:org.dataconservancy.packaging.tool.impl.generator.BagItPackageAssembler.java

private File writeBagInfoTxt() throws PackageToolException {
    File bagInfoFile = new File(bagBaseDir, "bag-info.txt");
    try {/*  w w  w.j a v  a2 s . c  om*/
        FileWriter writer = new FileWriter(bagInfoFile);
        String newLine = System.getProperty("line.separator");
        String lineFormat = "%s: %s ";

        Set<String> bagInfoFields = params.getKeys();
        for (String field : bagInfoFields) {
            List<String> fieldValues = params.getParam(field);
            for (String value : fieldValues) {
                writer.write(String.format(lineFormat, field, value) + newLine);
            }
        }

        writer.write(String.format(lineFormat, BagItParameterNames.BAG_SIZE,
                FileUtils.byteCountToDisplaySize(FileUtils.sizeOfDirectory(bagBaseDir))) + newLine);
        writer.write(String.format(lineFormat, BagItParameterNames.PAYLOAD_OXUM,
                FileUtils.sizeOfDirectory(payloadDir) + "." + dataFiles.size()) + newLine);
        writer.write(String.format(lineFormat, BagItParameterNames.BAGGING_DATE,
                (new DateTime().toDate()) + newLine));

        writer.close();
    } catch (IOException e) {
        throw new PackageToolException(PackagingToolReturnInfo.PKG_IO_EXCEPTION, e,
                "Exception occurred when writing bag-info.txt file.");
    }

    return bagInfoFile;
}

From source file:org.devgateway.toolkit.forms.util.MarkupCacheService.java

/**
 * Display some statistics about reports cache
 *///  ww  w .  j a  v a 2  s .co  m
public void getReportsStat() {
    CacheManager cm = CacheManager.getInstance();

    // get the reports cache "reportsCache", declared in ehcache.xml
    Cache cache = cm.getCache("reportsCache");

    @SuppressWarnings("unchecked")
    List<String> cacheKeys = cache.getKeys();
    long size = 0;
    for (String k : cacheKeys) {
        logger.info("key: " + k);
        byte[] buf = (byte[]) cache.get(k).getObjectValue();
        size += buf.length;
    }
    Statistics stats = cache.getStatistics();
    StringBuffer sb = new StringBuffer();
    sb.append(String.format("%s objects, %s hits, %s misses\n", stats.getObjectCount(), stats.getCacheHits(),
            stats.getCacheMisses()));

    logger.info(String.valueOf(sb));
    logger.info("cache total size: " + FileUtils.byteCountToDisplaySize(size));
}

From source file:org.dspace.health.InfoCheck.java

@Override
public String run(ReportInfo ri) {
    StringBuilder sb = new StringBuilder();
    ConfigurationService configurationService = new DSpace().getConfigurationService();
    sb.append("Generated: ").append(new Date().toString()).append("\n");

    sb.append("From - Till: ").append(new SimpleDateFormat("yyyy-MM-dd").format(ri.from().getTime()))
            .append(" - ").append(new SimpleDateFormat("yyyy-MM-dd").format(ri.till().getTime())).append("\n");

    sb.append("Url: ").append(ConfigurationManager.getProperty("dspace.url")).append("\n");
    sb.append("\n");

    DSBitStoreService localStore = new DSpace().getServiceManager().getServicesByType(DSBitStoreService.class)
            .get(0);//from w w  w  . java2s .c o m
    for (String[] ss : new String[][] { new String[] { localStore.getBaseDir().toString(), "Assetstore size", },
            new String[] { configurationService.getProperty("log.report.dir"), "Log dir size", }, }) {
        if (ss[0] != null) {
            try {
                File dir = new File(ss[0]);
                if (dir.exists()) {
                    long dir_size = FileUtils.sizeOfDirectory(dir);
                    sb.append(String.format("%-20s: %s\n", ss[1], FileUtils.byteCountToDisplaySize(dir_size)));
                } else {
                    sb.append(String.format("Directory [%s] does not exist!\n", ss[0]));
                }
            } catch (Exception e) {
                error(e, "directory - " + ss[0]);
            }
        } else { // cannot read property for some reason
            sb.append(String.format("Could not get information for %s!\n", ss[1]));
        }
    }

    return sb.toString();
}

From source file:org.dspace.health.ItemCheck.java

public String getCollectionSizesInfo(final Context context) throws SQLException {
    final StringBuffer ret = new StringBuffer();
    List<Map.Entry<Collection, Long>> colBitSizes = collectionService
            .getCollectionsWithBitstreamSizesTotal(context);
    long total_size = 0;

    Collections.sort(colBitSizes, new Comparator<Map.Entry<Collection, Long>>() {
        @Override//from  w  ww  .j  a va 2  s .  com
        public int compare(Map.Entry<Collection, Long> o1, Map.Entry<Collection, Long> o2) {
            try {
                return CollectionDropDown.collectionPath(context, o1.getKey())
                        .compareTo(CollectionDropDown.collectionPath(context, o2.getKey()));
            } catch (Exception e) {
                ret.append(e.getMessage());
            }
            return 0;
        }
    });
    for (Map.Entry<Collection, Long> row : colBitSizes) {
        Long size = row.getValue();
        total_size += size;
        Collection col = row.getKey();
        ret.append(String.format("\t%s:  %s\n", CollectionDropDown.collectionPath(context, col),
                FileUtils.byteCountToDisplaySize((long) size)));
    }
    ret.append(String.format("Total size:              %s\n", FileUtils.byteCountToDisplaySize(total_size)));

    ret.append(String.format("Resource without policy: %d\n",
            bitstreamService.countBitstreamsWithoutPolicy(context)));

    ret.append(
            String.format("Deleted bitstreams:      %d\n", bitstreamService.countDeletedBitstreams(context)));

    String list_str = "";
    List<Bitstream> bitstreamOrphans = bitstreamService.getNotReferencedBitstreams(context);
    for (Bitstream orphan : bitstreamOrphans) {
        UUID id = orphan.getID();
        list_str += String.format("%s, ", id);
    }
    ret.append(String.format("Orphan bitstreams:       %d [%s]\n", bitstreamOrphans.size(), list_str));

    return ret.toString();
}

From source file:org.dspace.util.SolrImportExport.java

/**
 * Reindexes the specified core/*from  w  ww.ja v a 2s . co m*/
 *
 * @param indexName the name of the core to reindex
 * @param exportDirName the name of the directory to use for export. If this directory doesn't exist, it will be created.
 * @param keepExport whether to keep the contents of the exportDir after the reindex. If keepExport is false and the
 *                      export directory was created by this method, the export directory will be deleted at the end of the reimport.
 * @param overwrite allow export files to be overwritten during re-index
 */
private static void reindex(String indexName, String exportDirName, boolean keepExport, boolean overwrite)
        throws IOException, SolrServerException, SolrImportExportException {
    String tempIndexName = indexName + "-temp";

    String origSolrUrl = makeSolrUrl(indexName);
    String baseSolrUrl = StringUtils.substringBeforeLast(origSolrUrl, "/"); // need to get non-core solr URL
    String tempSolrUrl = baseSolrUrl + "/" + tempIndexName;

    //The configuration details for the statistics shards reside within the "statistics" folder
    String instanceIndexName = indexName.startsWith("statistics-") ? "statistics" : indexName;

    String solrInstanceDir = ConfigurationManager.getProperty("dspace.dir") + File.separator + "solr"
            + File.separator + instanceIndexName;
    // the [dspace]/solr/[indexName]/conf directory needs to be available on the local machine for this to work
    // -- we need access to the schema.xml and solrconfig.xml file, plus files referenced from there
    // if this directory can't be found, output an error message and skip this index
    File solrInstance = new File(solrInstanceDir);
    if (!solrInstance.exists() || !solrInstance.canRead() || !solrInstance.isDirectory()) {
        throw new SolrImportExportException("Directory " + solrInstanceDir
                + "/conf/ doesn't exist or isn't readable."
                + " The reindexing process requires the Solr configuration directory for this index to be present on the local machine"
                + " even if Solr is running on a different host. Not reindexing index " + indexName);
    }

    String timeField = makeTimeField(indexName);

    // Ensure the export directory exists and is writable
    File exportDir = new File(exportDirName);
    boolean createdExportDir = exportDir.mkdirs();
    if (!createdExportDir && !exportDir.exists()) {
        throw new SolrImportExportException("Could not create export directory " + exportDirName);
    }
    if (!exportDir.canWrite()) {
        throw new SolrImportExportException("Can't write to export directory " + exportDirName);
    }

    try {
        HttpSolrServer adminSolr = new HttpSolrServer(baseSolrUrl);

        // try to find out size of core and compare with free space in export directory
        CoreAdminResponse status = CoreAdminRequest.getStatus(indexName, adminSolr);
        Object coreSizeObj = status.getCoreStatus(indexName).get("sizeInBytes");
        long coreSize = coreSizeObj != null ? Long.valueOf(coreSizeObj.toString()) : -1;
        long usableExportSpace = exportDir.getUsableSpace();
        if (coreSize >= 0 && usableExportSpace < coreSize) {
            System.err.println("Not enough space in export directory " + exportDirName
                    + "; need at least as much space as the index ("
                    + FileUtils.byteCountToDisplaySize(coreSize)
                    + ") but usable space in export directory is only "
                    + FileUtils.byteCountToDisplaySize(usableExportSpace)
                    + ". Not continuing with reindex, please use the " + DIRECTORY_OPTION
                    + " option to specify an alternative export directy with sufficient space.");
            return;
        }

        // Create a temp directory to store temporary core data
        File tempDataDir = new File(ConfigurationManager.getProperty("dspace.dir") + File.separator + "temp"
                + File.separator + "solr-data");
        boolean createdTempDataDir = tempDataDir.mkdirs();
        if (!createdTempDataDir && !tempDataDir.exists()) {
            throw new SolrImportExportException(
                    "Could not create temporary data directory " + tempDataDir.getCanonicalPath());
        }
        if (!tempDataDir.canWrite()) {
            throw new SolrImportExportException(
                    "Can't write to temporary data directory " + tempDataDir.getCanonicalPath());
        }

        try {
            // create a temporary core to hold documents coming in during the reindex
            CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create();
            createRequest.setInstanceDir(solrInstanceDir);
            createRequest.setDataDir(tempDataDir.getCanonicalPath());
            createRequest.setCoreName(tempIndexName);

            createRequest.process(adminSolr).getStatus();
        } catch (SolrServerException e) {
            // try to continue -- it may just be that the core already existed from a previous, failed attempt
            System.err.println("Caught exception when trying to create temporary core: " + e.getMessage()
                    + "; trying to recover.");
            e.printStackTrace(System.err);
        }

        // swap actual core with temporary one
        CoreAdminRequest swapRequest = new CoreAdminRequest();
        swapRequest.setCoreName(indexName);
        swapRequest.setOtherCoreName(tempIndexName);
        swapRequest.setAction(CoreAdminParams.CoreAdminAction.SWAP);
        swapRequest.process(adminSolr);

        try {
            // export from the actual core (from temp core name, actual data dir)
            exportIndex(indexName, exportDir, tempSolrUrl, timeField, overwrite);

            // clear actual core (temp core name, clearing actual data dir) & import
            importIndex(indexName, exportDir, tempSolrUrl, true);
        } catch (Exception e) {
            // we ran into some problems with the export/import -- keep going to try and restore the solr cores
            System.err.println("Encountered problem during reindex: " + e.getMessage()
                    + ", will attempt to restore Solr cores");
            e.printStackTrace(System.err);
        }

        // commit changes
        HttpSolrServer origSolr = new HttpSolrServer(origSolrUrl);
        origSolr.commit();

        // swap back (statistics now going to actual core name in actual data dir)
        swapRequest = new CoreAdminRequest();
        swapRequest.setCoreName(tempIndexName);
        swapRequest.setOtherCoreName(indexName);
        swapRequest.setAction(CoreAdminParams.CoreAdminAction.SWAP);
        swapRequest.process(adminSolr);

        // export all docs from now-temp core into export directory -- this won't cause name collisions with the actual export
        // because the core name for the temporary export has -temp in it while the actual core doesn't
        exportIndex(tempIndexName, exportDir, tempSolrUrl, timeField, overwrite);
        // ...and import them into the now-again-actual core *without* clearing
        importIndex(tempIndexName, exportDir, origSolrUrl, false);

        // commit changes
        origSolr.commit();

        // unload now-temp core (temp core name)
        CoreAdminRequest.unloadCore(tempIndexName, false, false, adminSolr);

        // clean up temporary data dir if this method created it
        if (createdTempDataDir && tempDataDir.exists()) {
            FileUtils.deleteDirectory(tempDataDir);
        }
    } finally {
        // clean up export dir if appropriate
        if (!keepExport && createdExportDir && exportDir.exists()) {
            FileUtils.deleteDirectory(exportDir);
        }
    }
}

From source file:org.eclipse.tracecompass.statesystem.core.tests.perf.historytree.HistoryTreeBackendBenchmark.java

/**
 * Benchmarks creating, single querying and full querying the state system
 *//*from www . j a v  a2 s. co m*/
@Test
public void testBenchmark() {
    /* Check arguments */
    long totalTime = this.fNbAvgIntervals * INTERVAL_AVG_TIME;

    Performance perf = Performance.getDefault();
    PerformanceMeter pmBuild = perf.createPerformanceMeter(TEST_PREFIX + TEST_BUILDING_ID + fName);
    perf.tagAsSummary(pmBuild, TEST_BUILDING_ID + fShortName, Dimension.CPU_TIME);

    PerformanceMeter pmSingleQuery = perf.createPerformanceMeter(TEST_PREFIX + TEST_SINGLE_QUERY_ID + fName);
    perf.tagAsSummary(pmSingleQuery, TEST_SINGLE_QUERY_ID + fShortName, Dimension.CPU_TIME);

    PerformanceMeter pmFullQuery = perf.createPerformanceMeter(TEST_PREFIX + TEST_FULL_QUERY_ID + fName);
    perf.tagAsSummary(pmFullQuery, TEST_FULL_QUERY_ID + fShortName, Dimension.CPU_TIME);

    PerformanceMeter pmRangeQuery = perf.createPerformanceMeter(TEST_PREFIX + TEST_QUERY_RANGE_ID + fName);
    perf.tagAsSummary(pmRangeQuery, TEST_QUERY_RANGE_ID + fShortName, Dimension.CPU_TIME);

    for (int i = 0; i < fNbLoops; i++) {
        try {
            /* Create the state system */
            createFile();
            IStateHistoryBackend backend = StateHistoryBackendFactory.createHistoryTreeBackendNewFile(
                    TEST_BUILDING_ID, NonNullUtils.checkNotNull(fTempFile), 1, 1, QUEUE_SIZE);
            ITmfStateSystemBuilder ss = StateSystemFactory.newStateSystem(backend);

            /* Initialize the attributes */
            Queue<QuarkEvent> quarkEvents = new PriorityQueue<>(fNbAttrib);
            Random randomGenerator = new Random(SEED);
            int rootQuark = ss.getQuarkAbsoluteAndAdd(ROOT_NODE);

            /* Create all attributes before testing */
            for (int j = 0; j < fNbAttrib; j++) {
                int quark = ss.getQuarkRelativeAndAdd(rootQuark, String.valueOf(j));
                quarkEvents.add(new QuarkEvent(quark,
                        (Math.abs(randomGenerator.nextLong()) % INTERVAL_AVG_TIME) + 1, fValues.getValues()));
            }

            /* Adds random intervals to the state system */
            pmBuild.start();
            while (true) {
                QuarkEvent quarkEvent = quarkEvents.poll();
                if (quarkEvent == null) {
                    break;
                }
                long eventTime = quarkEvent.getNextEventTime();
                ss.modifyAttribute(eventTime, quarkEvent.getNextValue(), quarkEvent.getQuark());
                long nextDelta = fDistributionMethod.getNextEndTime(randomGenerator, INTERVAL_AVG_TIME);
                long nextEndTime = eventTime + nextDelta;
                if (nextEndTime <= totalTime) {
                    quarkEvent.setNextEventTime(nextEndTime);
                    quarkEvents.add(quarkEvent);
                }
            }
            ss.closeHistory(totalTime);
            pmBuild.stop();

            /*
             * Benchmark the single queries: for each random timestamp,
             * query a random attribute
             */
            List<Integer> subAttributes = ss.getSubAttributes(rootQuark, false);
            pmSingleQuery.start();
            for (int j = 0; j < QUERY_COUNT; j++) {
                long ts = getNextRandomValue(randomGenerator, totalTime);
                int attrib = (int) getNextRandomValue(randomGenerator, subAttributes.size());
                ss.querySingleState(ts, attrib);
            }
            pmSingleQuery.stop();

            /* Benchmark the history range query of 10 attributes */
            pmRangeQuery.start();
            for (int j = 0; j < 10; j++) {
                int attrib = (int) getNextRandomValue(randomGenerator, subAttributes.size());
                StateSystemUtils.queryHistoryRange(ss, attrib, ss.getStartTime(), ss.getCurrentEndTime());
            }
            pmRangeQuery.stop();

            /* Benchmark the full queries */
            pmFullQuery.start();
            for (int j = 0; j < QUERY_COUNT; j++) {
                long ts = getNextRandomValue(randomGenerator, totalTime);
                ss.queryFullState(ts);
            }
            pmFullQuery.stop();

            /* Output some data on the file */
            if (i == 0) {
                if (backend instanceof HistoryTreeBackend) {
                    HistoryTreeBackend htBackend = (HistoryTreeBackend) backend;
                    System.out.println("History tree file size: "
                            + FileUtils.byteCountToDisplaySize(htBackend.getFileSize()));
                    System.out.println("Average node usage: " + htBackend.getAverageNodeUsage());
                }
            }
            deleteFile();
        } catch (IOException | StateValueTypeException | AttributeNotFoundException
                | StateSystemDisposedException e) {
            fail(e.getMessage());
        } finally {
            deleteFile();
        }
    }
    pmBuild.commit();
    pmSingleQuery.commit();
    pmFullQuery.commit();
    pmRangeQuery.commit();
}

From source file:org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule.java

/**
 * @since 2.0//from   ww  w.j  av  a 2 s  .c o m
 */
@Override
public @NonNull Map<@NonNull String, @NonNull String> getProperties() {
    Map<@NonNull String, @NonNull String> properties = super.getProperties();

    StateSystemBackendType backend = getBackendType();
    properties.put(NonNullUtils.checkNotNull(Messages.TmfStateSystemAnalysisModule_PropertiesBackend),
            backend.name());
    switch (backend) {
    case FULL:
    case PARTIAL:
        File htFile = getSsFile();
        if (htFile != null) {
            if (htFile.exists()) {
                properties.put(
                        NonNullUtils.checkNotNull(Messages.TmfStateSystemAnalysisModule_PropertiesFileSize),
                        FileUtils.byteCountToDisplaySize(htFile.length()));
            } else {
                properties.put(
                        NonNullUtils.checkNotNull(Messages.TmfStateSystemAnalysisModule_PropertiesFileSize),
                        NonNullUtils.checkNotNull(
                                Messages.TmfStateSystemAnalysisModule_PropertiesAnalysisNotExecuted));
            }
        }
        break;
    case INMEM:
    case NULL:
    default:
        break;

    }
    return properties;
}

From source file:org.efs.openreports.actions.admin.EditPropertiesAction.java

public String execute() {
    try {/*w ww . j av a 2s  .c o  m*/
        if (submitType == null) {
            dateFormat = dateProvider.getDateFormat().toPattern();
            baseDirectory = directoryProvider.getReportDirectory();
            tempDirectory = directoryProvider.getTempDirectory();
            reportGenerationDirectory = directoryProvider.getReportGenerationDirectory();

            ORProperty property = propertiesProvider.getProperty(ORProperty.MAIL_SMTP_HOST);
            if (property != null)
                mailHost = property.getValue();

            property = propertiesProvider.getProperty(ORProperty.MAIL_SMTP_AUTH);
            if (property != null)
                mailAuthenticatorUsed = new Boolean(property.getValue()).booleanValue();

            property = propertiesProvider.getProperty(ORProperty.MAIL_AUTH_USER);
            if (property != null)
                mailUser = property.getValue();

            property = propertiesProvider.getProperty(ORProperty.MAIL_AUTH_PASSWORD);
            if (property != null)
                mailPassword = property.getValue();

            property = propertiesProvider.getProperty(ORProperty.QUERYREPORT_MAXROWS);
            if (property != null)
                maxRows = property.getValue();

            //
            File imageTempDirFile = new File(directoryProvider.getReportImageTempDirectory());
            imageTempDirectory = imageTempDirFile.getPath();

            long size = FileUtils.sizeOfDirectory(imageTempDirFile);
            directorySize = FileUtils.byteCountToDisplaySize(size);

            numberOfFiles = imageTempDirFile.listFiles().length;
            //

            return INPUT;
        }

        // validate maxRows is an integer
        try {
            Integer.parseInt(maxRows);
        } catch (NumberFormatException nfe) {
            addActionError(LocalStrings.getString(LocalStrings.ERROR_INVALID_MAXROWS));
            return INPUT;
        }

        propertiesProvider.setProperty(ORProperty.BASE_DIRECTORY, baseDirectory);
        if (baseDirectory != null)
            directoryProvider.setReportDirectory(baseDirectory);

        propertiesProvider.setProperty(ORProperty.TEMP_DIRECTORY, tempDirectory);
        if (tempDirectory != null)
            directoryProvider.setTempDirectory(tempDirectory);

        propertiesProvider.setProperty(ORProperty.REPORT_GENERATION_DIRECTORY, reportGenerationDirectory);
        if (tempDirectory != null)
            directoryProvider.setReportGenerationDirectory(reportGenerationDirectory);

        propertiesProvider.setProperty(ORProperty.DATE_FORMAT, dateFormat);
        if (dateFormat != null)
            dateProvider.setDateFormat(dateFormat);

        propertiesProvider.setProperty(ORProperty.MAIL_AUTH_PASSWORD, mailPassword);
        if (mailPassword != null)
            mailProvider.setPassword(mailPassword);

        propertiesProvider.setProperty(ORProperty.MAIL_AUTH_USER, mailUser);
        if (mailUser != null)
            mailProvider.setUserName(mailUser);

        propertiesProvider.setProperty(ORProperty.MAIL_SMTP_AUTH, String.valueOf(mailAuthenticatorUsed));
        mailProvider.setUseMailAuthenticator(mailAuthenticatorUsed);

        propertiesProvider.setProperty(ORProperty.MAIL_SMTP_HOST, mailHost);
        if (mailHost != null)
            mailProvider.setMailHost(mailHost);

        propertiesProvider.setProperty(ORProperty.QUERYREPORT_MAXROWS, maxRows);

        return SUCCESS;
    } catch (Exception e) {
        addActionError(e.toString());
        return INPUT;
    }
}

From source file:org.exoplatform.social.plugin.doc.UIDocActivity.java

protected String getSize() {
    double size = 0;
    Node docNode = getDocNode();//from w  w w.  ja  v a  2 s .c  o m
    try {
        if (docNode.hasNode(Utils.JCR_CONTENT)) {
            Node contentNode = docNode.getNode(Utils.JCR_CONTENT);
            if (contentNode.hasProperty(Utils.JCR_DATA)) {
                size = contentNode.getProperty(Utils.JCR_DATA).getLength();
            }

            return FileUtils.byteCountToDisplaySize((long) size);
        }
    } catch (PathNotFoundException e) {
        return StringUtils.EMPTY;
    } catch (ValueFormatException e) {
        return StringUtils.EMPTY;
    } catch (RepositoryException e) {
        return StringUtils.EMPTY;
    }
    return StringUtils.EMPTY;
}

From source file:org.exoplatform.wcm.ext.component.activity.FileUIActivity.java

protected String getSize(Node node) {
    double size = 0;
    try {//  www .j  av  a2  s .  c om
        if (node.hasNode(org.exoplatform.ecm.webui.utils.Utils.JCR_CONTENT)) {
            Node contentNode = node.getNode(org.exoplatform.ecm.webui.utils.Utils.JCR_CONTENT);
            if (contentNode.hasProperty(org.exoplatform.ecm.webui.utils.Utils.JCR_DATA)) {
                size = contentNode.getProperty(org.exoplatform.ecm.webui.utils.Utils.JCR_DATA).getLength();
            }

            return FileUtils.byteCountToDisplaySize((long) size);
        }
    } catch (PathNotFoundException e) {
        return StringUtils.EMPTY;
    } catch (ValueFormatException e) {
        return StringUtils.EMPTY;
    } catch (RepositoryException e) {
        return StringUtils.EMPTY;
    } catch (NullPointerException e) {
        return StringUtils.EMPTY;
    }
    return StringUtils.EMPTY;
}