Examples of CompilerMessage


Examples of org.openquark.cal.compiler.CompilerMessage

        // Get the module folder.  Create the folder if it doesn't exist.
        ProgramResourceLocator.Folder moduleFolder = getModuleResourceFolder(module);
        try {
            resourceRepository.ensureFolderExists(moduleFolder);
        } catch (IOException e) {
            logger.logMessage(new CompilerMessage(new MessageKind.Warning.DebugMessage("Failed saving compiled module info for " + module.getName()), e));
            return;
        }

        // Get the info file within that folder.
        ProgramResourceLocator.File compileModuleInfoFileLocator = moduleFolder.extendFile(module.getName() + "." + Module.COMPILED_MODULE_SUFFIX);

        // Put the module info into a byte array.
        NakedByteArrayOutputStream bos = new NakedByteArrayOutputStream(8192);
        RecordOutputStream ros = new RecordOutputStream(bos);

        Exception exception = null;
        try {
            module.write(ros);
        } catch (IOException saveException) {
            exception = saveException;
        } finally {
            try {
                ros.close();
            } catch (IOException ioe) {
                exception = ioe;
            }
        }

        if (exception != null) {
            logger.logMessage(new CompilerMessage(new MessageKind.Warning.DebugMessage("Failed saving compiled module info for " + module.getName()), exception));
        }

        // Create an input stream on the byte array, and use this to set the file contents.
        InputStream is = new ByteArrayInputStream(bos.getByteArray(), 0, bos.getCount());
        try {
            resourceRepository.setContents(compileModuleInfoFileLocator, is);
        } catch (IOException e) {
            logger.logMessage(new CompilerMessage(new MessageKind.Warning.DebugMessage("Failed saving compiled module info for " + module.getName()), e));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.