All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.truelicense.core.LicenseValidationException Maven / Gradle / Ivy

Go to download

The TrueLicense Core module provides essential functionality for license management.

There is a newer version: 2.6.6
Show newest version
/*
 * Copyright (C) 2005-2013 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.truelicense.core;

import java.util.Locale;
import net.java.truelicense.core.util.Message;
import static net.java.truelicense.core.util.Objects.*;

/**
 * Indicates that a
 * {@linkplain LicenseValidation#validate(License) license validation} failed.
 *
 * @author Christian Schlichtherle
 */
public class LicenseValidationException extends LicenseManagementException {

    private static final long serialVersionUID = 1L;

    private final Message msg;

    /**
     * Constructs a license validation exception with the given localized
     * message.
     *
     * @param msg the localized message.
     */
    public LicenseValidationException(final String msg) {
        this(new Message() {
            static final long serialVersionUID = 1L;

            @Override public String toString(Locale locale) { return msg; }
        });
    }

    /**
     * Constructs a license validation exception with the given
     * internationalized message.
     *
     * @param msg the internationalized message.
     */
    public LicenseValidationException(final Message msg) {
        this.msg = requireNonNull(msg);
    }

    @Override
    public String getMessage() { return msg.toString(Locale.ROOT); }

    @Override
    public String getLocalizedMessage() {
        return msg.toString(Locale.getDefault());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy