// NComp.java

/*
**  Your system has FULL PRODUCTION NCOMP if the exception stack contains:
**  at java.util.Locale.setDefault(Locale.java)
**  at ncompp.x(NCOMPP:1)
**
**  Your system has NCOMP DISABLED if the exception stack contains:
**  at java.util.Locale.setDefault(Locale.java:340)
**  at ncompp.x(NCOMPP:1)
*/

import java.util.*;
import java.io.*;

public class NComp
{
static java.util.Locale y = null;

  public static String status()
  {
    StringWriter sw = new StringWriter();
    PrintWriter out = new PrintWriter(sw);
    String s = "", msg = "";
    int i;
    
    try {
      y.setDefault(null);
      msg = "NComp test failed.";
    } catch (Exception e) {
      e.printStackTrace(out);
      out.flush();

      s = sw.toString();
      s = s.substring(s.indexOf("("), s.indexOf(")")); // grab text between ()
      i = s.indexOf(":");
      if (i > 0) {
        System.out.println(sw.toString());
        msg = "NComp status: DISABLED";
      } else {
        System.out.println(sw.toString());
        msg = "NComp status: full enabled";
      }
      out.close();
    }
    return msg;
  }
}
