Example usage for java.util Locale setDefault

List of usage examples for java.util Locale setDefault

Introduction

In this page you can find the example usage for java.util Locale setDefault.

Prototype

public static synchronized void setDefault(Locale newLocale) 

Source Link

Document

Sets the default locale for this instance of the Java Virtual Machine.

Usage

From source file:pl.bristleback.server.bristle.serialization.jackson.JacksonSerializationPerformanceTest.java

@Test
public void serializeRawSimpleValue() throws Exception {
    Locale.setDefault(Locale.ENGLISH);
    long deserializedForm = 332221L;
    Object serialization = getSerialization("rawLong");

    measurePerformance(deserializedForm, serialization, "Long raw value");
}

From source file:ca.nines.ise.cmd.Chars.java

/**
 * {@inheritDoc}//from   w  w  w  . j  a  v  a  2s . c  o m
 */
@Override
public void execute(CommandLine cmd) throws Exception {
    File[] files;
    Locale.setDefault(Locale.ENGLISH);
    PrintStream out = new PrintStream(System.out, true, "UTF-8");

    if (cmd.hasOption("l")) {
        out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8");
    }

    Map<String, Integer> m = new HashMap<>();
    Map<CharType, HashMap<String, Integer>> types = new HashMap<>();
    files = getFilePaths(cmd);

    for (CharType type : CharType.values()) {
        types.put(type, new HashMap<String, Integer>());
    }

    out.println("Found " + files.length + " files to check.");
    for (File file : files) {
        DOM dom = new DOMBuilder(file).build();
        for (Node n : dom) {
            if (n instanceof CharNode) {
                CharNode c = (CharNode) n;
                m.put(n.getText(), 1);
                types.get(c.getCharType()).put(c.getText(), 1);
            }
        }
    }

    out.println("EXISTING CHARS BY TYPE:");
    for (CharType type : CharType.values()) {
        out.println(type.name());
        for (String str : types.get(type).keySet()) {
            out.println(str);
        }
    }

    out.println("EXISTING CHARS: ");
    for (String k : m.keySet()) {
        out.println(k);
    }
}

From source file:ca.nines.ise.cmd.Syntax.java

/**
 * {@inheritDoc}// w  w  w .  jav a  2  s . c  om
 */
@Override
public void execute(CommandLine cmd) throws Exception {
    File[] files;

    Log log = Log.getInstance();
    Locale.setDefault(Locale.ENGLISH);
    PrintStream out = new PrintStream(System.out, true, "UTF-8");

    if (cmd.hasOption("l")) {
        out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8");
    }

    files = getFilePaths(cmd);
    out.println("Found " + files.length + " files to check.");
    for (File file : files) {
        DOM dom = new DOMBuilder(file).build();
        if (log.count() > 0) {
            out.println(log);
            log.clear();
        }
    }
}

From source file:org.apache.juneau.rest.test.TestMicroservice.java

/**
 * Starts the microservice./* w  ww.  j  av  a 2 s.co m*/
 * @return <jk>true</jk> if the service started, <jk>false</jk> if it's already started.
 * If this returns <jk>false</jk> then don't call stopMicroservice()!.
 */
public static boolean startMicroservice() {
    if (microservice != null)
        return false;
    try {
        Locale.setDefault(Locale.US);
        microservice = new RestMicroservice().setConfig("juneau-rest-test.cfg", false)
                .setManifestContents("Test-Entry: test-value");
        microserviceURI = microservice.start().getURI();
        DEFAULT_CLIENT = client().build();
        DEFAULT_CLIENT_PLAINTEXT = client(PlainTextSerializer.class, PlainTextParser.class).build();
        return true;
    } catch (Throwable e) {
        System.err.println(e); // NOT DEBUG
        return false;
    }
}

From source file:ca.nines.ise.cmd.Renumber.java

@Override
public void execute(CommandLine cmd) throws Exception {
    PrintStream outputStream;//w ww.  ja  v a 2  s. co  m
    Locale.setDefault(Locale.ENGLISH);
    outputStream = new PrintStream(System.out, true, "UTF-8");
    if (cmd.hasOption("o")) {
        outputStream = new PrintStream(new FileOutputStream(cmd.getOptionValue("o")), true, "UTF-8");
    }

    String[] files = getArgList(cmd);
    if (files.length > 1) {
        System.err.println("Can only renumber one file at a time.");
        help();
        System.exit(1);
    }
    DOM dom = new DOMBuilder(new File(files[0])).build();
    if (dom.getStatus() != DOMStatus.ERROR) {
        Renumberer r = new Renumberer();
        if (cmd.hasOption("l")) {
            r.setRenumberLine(true);
        }
        if (cmd.hasOption("qln")) {
            r.setRenumberQln(true);
        }
        if (cmd.hasOption("tln")) {
            r.setRenumberTln(true);
        }
        if (cmd.hasOption("wln")) {
            r.setRenumberWln(true);
        }
        if (cmd.hasOption("act")) {
            r.setRenumberAct(true);
        }
        if (cmd.hasOption("scene")) {
            r.setRenumberScene(true);
        }
        if (cmd.hasOption("stanza")) {
            r.setRenumberStanza(true);
        }
        if (cmd.hasOption("page")) {
            r.setRenumberPage(true);
        }

        dom = r.transform(dom);

    }
    Writer out = new SGMLWriter(outputStream);
    out.render(dom);
}

From source file:ca.nines.ise.cmd.Validate.java

/**
 * {@inheritDoc}//from   w  w  w.j  a  va  2  s. com
 */
@ErrorCode(code = { "dom.errors" })
@Override
public void execute(CommandLine cmd) throws Exception {
    File[] files;

    Log log = Log.getInstance();
    Locale.setDefault(Locale.ENGLISH);
    Schema schema = Schema.defaultSchema();
    DOMValidator dv = new DOMValidator();
    NestingValidator nv = new NestingValidator(schema);
    PrintStream out = new PrintStream(System.out, true, "UTF-8");

    if (cmd.hasOption("l")) {
        out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8");
    }

    files = getFilePaths(cmd);
    if (files != null) {
        out.println("Found " + files.length + " files to check.");
        for (File in : files) {
            DOM dom = new DOMBuilder(in).build();
            if (dom.getStatus() != DOM.DOMStatus.ERROR) {
                dv.validate(dom, schema);
                nv.validate(dom);
            } else {
                Message m = Message.builder("dom.errors").setSource(dom.getSource()).build();
                log.add(m);
            }
            if (log.count() > 0) {
                out.println(log);
            }
            log.clear();
        }
    }
}

From source file:org.firesoa.common.jxpath.JXPathTestCase.java

/**
 * Construct a new instance of this test case.
 */
public JXPathTestCase() {
    Locale.setDefault(Locale.US);
}

From source file:net.sf.dynamicreports.test.jasper.chart.ThermometerChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    Locale.setDefault(Locale.ENGLISH);

    rb.setLocale(Locale.ENGLISH).summary(cht.thermometerChart().setValue(field("field1", Integer.class))
            .setDataRangeLowExpression(3).setDataRangeHighExpression(30).setValueColor(Color.BLUE)
            .setValueMask("#,###.0").setValueFont(stl.fontArial()).setValueLocation(ValueLocation.BULB)
            .setMercuryColor(Color.LIGHT_GRAY).setLowDataRangeLowExpression(8).setLowDataRangeHighExpression(10)
            .setMediumDataRangeLowExpression(18).setMediumDataRangeHighExpression(20)
            .setHighDataRangeLowExpression(28).setHighDataRangeHighExpression(30),
            cht.thermometerChart().setValue(field("field1", Integer.class)));
}

From source file:net.sf.dynamicreports.test.jasper.chart.MeterChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    Locale.setDefault(Locale.ENGLISH);

    rb.setLocale(Locale.ENGLISH).summary(cht.meterChart().setValue(field("field1", Integer.class))
            .setDataRangeLowExpression(3).setDataRangeHighExpression(30).setValueColor(Color.BLUE)
            .setValueMask("#,###.0").setValueFont(stl.fontArial()).setShape(MeterShape.CIRCLE)
            .setMeterAngle(270).setUnits("units").setTickInterval(3d).setMeterBackgroundColor(Color.LIGHT_GRAY)
            .setNeedleColor(Color.CYAN).setTickColor(Color.MAGENTA).setTickLabelFont(stl.fontCourierNew())
            .intervals(//from w w w . j a  va 2s . c  om
                    cht.meterInterval().setLabel("red").setAlpha(0.8).setBackgroundColor(Color.RED)
                            .setDataRangeLowExpression(25).setDataRangeHighExpression(30),
                    cht.meterInterval().setLabel("yellow").setAlpha(0.5).setBackgroundColor(Color.YELLOW)
                            .setDataRangeLowExpression(20).setDataRangeHighExpression(25)),
            cht.meterChart().setValue(5).setShape(MeterShape.DIAL));
}

From source file:ch.ralscha.extdirectspring.controller.RouterControllerFormLoadTest.java

@BeforeClass
public static void beforeTest() {
    Locale.setDefault(Locale.US);
}