LogRecord logRecord = (LogRecord) get(Component.LOG_RECORD);
Item logRecord = get(Component.LOG_RECORD);
    public void finalizz() throws Exception, NullPointerException {        Configuration c = (Configuration) get(Component.CONFIGURATION);        if (c != null) {            Integer logLevel = (Integer) get(Component.LOG_LEVEL);            c.set(Component.LOG_LEVEL, logLevel);            remove(Component.LOG_LEVEL);            destroyItem(logLevel);            String loggerOutput = (String) get(Component.LOGGER_OUTPUT);            c.set(Component.LOGGER_OUTPUT, loggerOutput);            remove(Component.LOGGER_OUTPUT);            destroyItem(loggerOutput);            String namedSubsystem = (String) get(Component.NAMED_SUBSYSTEM);            c.set(Component.NAMED_SUBSYSTEM, namedSubsystem);            remove(Component.NAMED_SUBSYSTEM);            destroyItem(namedSubsystem);            Item g = (Item) get(Component.GLOBALS);                        if (g != null) {                // Only destroy signal memory, if it was also created                // in this component, which can be seen on the flag.                if (get(Component.FINALIZE_SIGNAL_MEMORY_FLAG) != null) {                    if (((Boolean) get(Component.FINALIZE_SIGNAL_MEMORY_FLAG)).isEqualTo(Boolean.TRUE)) {                        Item signalMemory = (Item) get(Component.SIGNAL_MEMORY);                        g.remove(Component.SIGNAL_MEMORY);                        remove(Component.SIGNAL_MEMORY);                        destroyItem(signalMemory);                    }                } else {                                        throw new NullPointerException("Could not finalize component. The finalize configuration item is null.");                }                // Only destroy log record, if it was also created                // in this component, which can be seen on the flag.                            if (get(Component.FINALIZE_LOG_RECORD_FLAG) != null) {                    if (((Boolean) get(Component.FINALIZE_LOG_RECORD_FLAG)).isEqualTo(Boolean.TRUE)) {                        LogRecord logRecord = (LogRecord) get(Component.LOG_RECORD);                        g.remove(Component.LOG_RECORD);                        remove(Component.LOG_RECORD);                        destroyItem(logRecord);                    }                } else {                                        throw new NullPointerException("Could not finalize component. The finalize log record item is null.");                }                // Only destroy configuration, if it was also created                // in this component, which can be seen on the flag.                            if (get(Component.FINALIZE_CONFIGURATION_FLAG) != null) {                    if (((Boolean) get(Component.FINALIZE_CONFIGURATION_FLAG)).isEqualTo(Boolean.TRUE)) {                        Configuration configuration = (Configuration) get(Component.CONFIGURATION);                        g.remove(Component.CONFIGURATION);                        remove(Component.CONFIGURATION);                        destroyItem(configuration);                    }                } else {                                        throw new NullPointerException("Could not finalize component. The finalize configuration item is null.");                }            } else {                                throw new NullPointerException("Could not finalize component. The globals item is null.");            }            // Only destroy globals item, if it was also created            // in this component, which can be seen on the flag.                        if (get(Component.FINALIZE_GLOBALS_FLAG) != null) {                if (((Boolean) get(Component.FINALIZE_GLOBALS_FLAG)).isEqualTo(Boolean.TRUE)) {                    Item globals = (Item) get(Component.GLOBALS);                    remove(Component.GLOBALS);                    destroyItem(globals);                }            } else {                throw new NullPointerException("Could not finalize component. The finalize globals item is null.");            }            Boolean finalizeSignalMemoryFlag = (Boolean) get(Component.FINALIZE_SIGNAL_MEMORY_FLAG);            remove(Component.FINALIZE_SIGNAL_MEMORY_FLAG);            destroyItem(finalizeSignalMemoryFlag);            Boolean finalizeLogRecordFlag = (Boolean) get(Component.FINALIZE_LOG_RECORD_FLAG);            remove(Component.FINALIZE_LOG_RECORD_FLAG);            destroyItem(finalizeLogRecordFlag);            Boolean finalizeConfigurationFlag = (Boolean) get(Component.FINALIZE_CONFIGURATION_FLAG);            remove(Component.FINALIZE_CONFIGURATION_FLAG);            destroyItem(finalizeConfigurationFlag);            Boolean finalizeGlobalsFlag = (Boolean) get(Component.FINALIZE_GLOBALS_FLAG);            remove(Component.FINALIZE_GLOBALS_FLAG);            destroyItem(finalizeGlobalsFlag);        } else {            throw new NullPointerException("Could not finalize component. The configuration is null.");        }        super.finalizz();    }