/*
 * Copyright 2016 Datalogics Inc.
 */

package com.datalogics.pdf.hsm.samples;

import com.datalogics.pdf.security.HsmManager;

/**
 * Used to get instances of a HsmManager object.
 */
public final class HsmManagerFactory {

    /**
     * Factory class should not be instantiated.
     */
    private HsmManagerFactory() {}

    /**
     * Gets a new instance of a HsmManager for the needed type of HSM device.
     *
     * @param hsm - Type of HSM device you are connecting to
     * @return HsmManager
     */

    public static HsmManager newInstance(final HsmType hsm) {
        if (hsm.equals(HsmType.LUNA_SA_HSM)) {
            return new LunaHsmManager();
        }
        return null;
    }

    public enum HsmType {
        LUNA_SA_HSM
    }
}

@@ -683,19 +683,70 @@
     
-return null
+throw new IllegalArgumentException(%22Must use a valid HsmType%22)
 ;%0A  

Throw exception if valid parameter not passed.