/*
 * Copyright 2014 Open mHealth
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openmhealth.dsu.domain;

/**
 * The modality of a data point. The modality represents whether the data point was sensed by a device or
 * application, or whether it was reported by the user.
 *
 * @author Emerson Farrugia
 */
public enum DataPointModality {

    SENSED,
    SELF_REPORTED
}

/*
 * Copyright 2014 Open mHealth
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openmhealth.dsu.domain;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;

/**
 * The modality of a data point. The modality represents whether the data point was sensed by a device or
 * application, or whether it was reported by the user.
 *
 * @author Emerson Farrugia
 */
public enum DataPointModality {

    SENSED,
    SELF_REPORTED;

    private static Map<String, DataPointModality> constantsByJsonValue = new HashMap<>();

    static {
        for (DataPointModality constant : values()) {
            constantsByJsonValue.put(constant.getJsonValue(), constant);
        }
    }

    @JsonValue
    public String getJsonValue() {
        return name().toLowerCase().replaceAll("_", " ");
    }

    @JsonCreator
    @Nullable
    public static DataPointModality findByJsonValue(String jsonValue) {
        return constantsByJsonValue.get(jsonValue);
    }
}

Add JSON value mapping to modality enumeration.


package wikiboot.data;

import org.junit.Test;
import wikiboot.DataItem;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;

/**
 * Tests for {@link wikiboot.data.YamlDataSet}.
 */
public class YamlDataSetTests {

    @Test
    public void load() {
        YamlDataSet dataSet = new YamlDataSet("wikiboot/data/test-dataset.yaml");
        assertThat(dataSet.getDataItems().size(), is(3));
        for (DataItem item : dataSet.getDataItems()) {
            assertThat(item.getModel().get("name"), is(notNullValue()));
        }
    }

}

package wikiboot.data;

import org.junit.Test;
import org.springframework.core.io.ByteArrayResource;
import wikiboot.DataItem;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;

/**
 * Tests for {@link wikiboot.data.YamlDataSet}.
 */
public class YamlDataSetTests {

    @Test
    public void load() {
        YamlDataSet dataSet = new YamlDataSet("wikiboot/data/test-dataset.yaml");
        assertThat(dataSet.getDataItems().size(), is(3));
        for (DataItem item : dataSet.getDataItems()) {
            assertThat(item.getModel().get("name"), is(notNullValue()));
        }
    }

    @Test
    public void textLiteral() {
        ByteArrayResource resource = new ByteArrayResource("test".getBytes());
        YamlDataSet dataSet = new YamlDataSet(resource);

        assertThat(dataSet.getDataItems().size(), is(1));

        DataItem dataItem = dataSet.getDataItems().get(0);

        assertThat(dataItem.getModel().size(), is(1));
        assertThat(dataItem.getModel().get("document"), is("test"));
    }

    @Test
    public void nonStringKey() {
        ByteArrayResource resource = new ByteArrayResource("1: value".getBytes());
        YamlDataSet dataSet = new YamlDataSet(resource);

        assertThat(dataSet.getDataItems().size(), is(1));

        DataItem dataItem = dataSet.getDataItems().get(0);

        assertThat(dataItem.getModel().size(), is(1));
        assertThat(dataItem.getModel().get("[1]"), is("value"));
    }

    @Test
    public void emptyDocument() {
        ByteArrayResource resource = new ByteArrayResource("---".getBytes());
        YamlDataSet dataSet = new YamlDataSet(resource);
        assertThat(dataSet.getDataItems().size(), is(0));
    }

    @Test(expected = IllegalStateException.class)
    public void dataSetNotFound() {
        new YamlDataSet("doesNotExist.yaml");

    }

}

Add more test cases for YamlDataSet

Add more test cases for YamlDataSet


package com.blackboard.testing.common;

import com.blackboard.testing.driver.LambdaWebDriverThreadLocalContainer;
import com.blackboard.testing.testcontext.EnvironmentDetector;
import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.WebDriverRunner;
import com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName;
import org.junit.BeforeClass;

public abstract class LambdaBaseTest {

    @BeforeClass
    public static void baseTestBeforeClass() {
        Configuration.browser = BrowserName.CHROME.toString();
        Configuration.reopenBrowserOnFail = false;

        if (EnvironmentDetector.inLambda()) {
            Configuration.reportsFolder = "/tmp/selenidereports";
            WebDriverRunner.webdriverContainer = new LambdaWebDriverThreadLocalContainer();
        }
    }
}

package com.blackboard.testing.common;

import com.blackboard.testing.driver.LambdaWebDriverThreadLocalContainer;
import com.blackboard.testing.lambda.LambdaTestHandler;
import com.blackboard.testing.testcontext.EnvironmentDetector;
import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.WebDriverRunner;
import org.junit.BeforeClass;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;

public abstract class LambdaBaseTest {

    @BeforeClass
    public static void baseTestBeforeClass() {
        Configuration.browser = "chrome";
        Configuration.reopenBrowserOnFail = false;

        if (EnvironmentDetector.inLambda()) {
            WebDriverRunner.webdriverContainer = new LambdaWebDriverThreadLocalContainer();
        }
    }

    protected void screenshot(String description) {
        if (EnvironmentDetector.inLambda()) {
            LambdaTestHandler.addAttachment(description + ".png",
                    ((TakesScreenshot) WebDriverRunner.getWebDriver())
                            .getScreenshotAs(OutputType.BYTES));
        } else {
            Selenide.screenshot(description);
        }
    }
}

Add screenshot capability to base test

Add screenshot capability to base test


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.beam.sdk.io.gcp.spanner;

import com.google.auto.value.AutoValue;
import com.google.cloud.spanner.BatchTransactionId;
import java.io.Serializable;
import javax.annotation.Nullable;

/** A transaction object. */
@AutoValue
public abstract class Transaction implements Serializable {

  @Nullable
  abstract BatchTransactionId transactionId();

  public static Transaction create(BatchTransactionId txId) {
    return new AutoValue_Transaction(txId);
  }
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.beam.sdk.io.gcp.spanner;

import com.google.auto.value.AutoValue;
import com.google.cloud.spanner.BatchTransactionId;
import java.io.Serializable;
import javax.annotation.Nullable;

/** A transaction object. */
@AutoValue
public abstract class Transaction implements Serializable {

  @Nullable
  public abstract BatchTransactionId transactionId();

  public static Transaction create(BatchTransactionId txId) {
    return new AutoValue_Transaction(txId);
  }
}

Make Cloud Spanner transaction id public. Allows to build non-library transforms that run in the same transaction with library ones.

Change-Id: Ibf4edd56aec791f7baca8f7e0b79bd0d4ba7a10f


package alien4cloud.tosca.parser.impl.advanced;

import java.util.List;

import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.nodes.MappingNode;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.NodeTuple;

import alien4cloud.model.common.Tag;
import alien4cloud.tosca.parser.ParserUtils;
import alien4cloud.tosca.parser.ParsingContextExecution;
import alien4cloud.tosca.parser.mapping.DefaultParser;

import com.google.common.collect.Lists;

@Component
public class TagParser extends DefaultParser<List<Tag>> {

    @Override
    public List<Tag> parse(Node node, ParsingContextExecution context) {
        List<Tag> tagList = Lists.newArrayList();
        if (node instanceof MappingNode) {
            MappingNode mapNode = (MappingNode) node;
            for (NodeTuple entry : mapNode.getValue()) {
                String key = ParserUtils.getScalar(entry.getKeyNode(), context);
                String value = ParserUtils.getScalar(entry.getValueNode(), context);
                if (value != null) {
                    tagList.add(new Tag(key, value));
                }
            }
        } else {
            ParserUtils.addTypeError(node, context.getParsingErrors(), "Alien Tag");
        }
        return tagList;
    }
}

package alien4cloud.tosca.parser.impl.advanced;

import java.util.List;

import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.nodes.MappingNode;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.NodeTuple;

import alien4cloud.model.common.Tag;
import alien4cloud.tosca.parser.ParserUtils;
import alien4cloud.tosca.parser.ParsingContextExecution;
import alien4cloud.tosca.parser.mapping.DefaultParser;

import com.google.common.collect.Lists;

@Component
public class TagParser extends DefaultParser<List<Tag>> {

    @Override
    public List<Tag> parse(Node node, ParsingContextExecution context) {
        List<Tag> tagList = Lists.newArrayList();
        if (node instanceof MappingNode) {
            MappingNode mapNode = (MappingNode) node;
            for (NodeTuple entry : mapNode.getValue()) {
                String key = ParserUtils.getScalar(entry.getKeyNode(), context);
                String value = ParserUtils.getScalar(entry.getValueNode(), context);
                if (value != null) {
                    tagList.add(new Tag(key, value));
                }
            }
        } else {
            ParserUtils.addTypeError(node, context.getParsingErrors(), "metadata");
        }
        return tagList;
    }
}

Tag parser now instruct the issue as related to metadata


package crystal;

import org.apache.log4j.Level;

public class Constants {

//	public static long TIMER_CONSTANT = 10 * 60 * 1000; // 10 mins default
	public static long TIMER_CONSTANT = 1000; // 10 mins default

	// for debugging
	// public static long TIMER_CONSTANT = 5 * 1000; // 15 seconds

	public static final boolean DEBUG_RUNIT = false;
	public static final boolean DEBUG_UI = false;

	/**
	 * When false the Log4J console appender is quiet only reporting ERROR and above.
	 */
	public static final boolean QUIET_CONSOLE = true;

	public static final Level LOG_LEVEL = Level.INFO;

	public static final String HOME = "$HOME";
}

package crystal;

import org.apache.log4j.Level;

public class Constants {

	public static long TIMER_CONSTANT = 10 * 60 * 1000; // 10 mins default
//	public static long TIMER_CONSTANT = 1000; // 10 mins default

	// for debugging
	// public static long TIMER_CONSTANT = 5 * 1000; // 15 seconds

	public static final boolean DEBUG_RUNIT = false;
	public static final boolean DEBUG_UI = false;

	/**
	 * When false the Log4J console appender is quiet only reporting ERROR and above.
	 */
	public static final boolean QUIET_CONSOLE = true;

	public static final Level LOG_LEVEL = Level.INFO;

	public static final String HOME = "$HOME";
}

Reset the time to fire every 10 minutes

Reset the time to fire every 10 minutes


package br.com.tdsis.lambda.forest.json;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import br.com.tdsis.lambda.forest.http.ResponseBodySerializerStrategy;
import br.com.tdsis.lambda.forest.http.exception.HttpException;
import br.com.tdsis.lambda.forest.http.exception.InternalServerErrorException;

/**
 * The JSON response body serializer strategy
 *
 * @author nmelo
 * @version 1.0.0
 * @since 1.0.0
 */
public class JsonResponseBodySerializerStrategy implements ResponseBodySerializerStrategy {

    @Override
    public String serialize(Object entity) throws HttpException {
        String json = null;

        try {

            ObjectMapper mapper = new ObjectMapper();
            mapper.setSerializationInclusion(Include.NON_NULL);
            json = mapper.writeValueAsString(entity);

        } catch (JsonProcessingException e) {
            throw new InternalServerErrorException(e.getMessage(), e);
        }

        return json;
    }

}

package br.com.tdsis.lambda.forest.json;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

import br.com.tdsis.lambda.forest.http.ResponseBodySerializerStrategy;
import br.com.tdsis.lambda.forest.http.exception.HttpException;
import br.com.tdsis.lambda.forest.http.exception.InternalServerErrorException;

/**
 * The JSON response body serializer strategy
 *
 * @author nmelo
 * @version 1.0.0
 * @since 1.0.0
 */
public class JsonResponseBodySerializerStrategy implements ResponseBodySerializerStrategy {

    @Override
    public String serialize(Object entity) throws HttpException {
        String json = null;

        try {

            ObjectMapper mapper = new ObjectMapper();
            mapper.setSerializationInclusion(Include.NON_NULL);
            mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);

            json = mapper.writeValueAsString(entity);

        } catch (JsonProcessingException e) {
            throw new InternalServerErrorException(e.getMessage(), e);
        }

        return json;
    }

}

Set FAIL_ON_EMPTY_BEANS to false when serializing responses. Fixes gh-6


/*
 * Copyright 2014 Nicolas Morel
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.nmorel.gwtjackson.hello.client;

import com.google.gwt.inject.client.AbstractGinModule;
import com.gwtplatform.dispatch.rest.client.RestApplicationPath;
import com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule;

/**
 * @author Nicolas Morel.
 */
public class HelloModule extends AbstractGinModule {

    @Override
    protected void configure() {
        RestDispatchAsyncModule.Builder dispatchBuilder = new RestDispatchAsyncModule.Builder();
        install( dispatchBuilder.build() );

        bindConstant().annotatedWith( RestApplicationPath.class ).to( "/api" );
    }
}

/*
 * Copyright 2014 Nicolas Morel
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.nmorel.gwtjackson.hello.client;

import com.google.gwt.inject.client.AbstractGinModule;
import com.gwtplatform.dispatch.rest.client.RestApplicationPath;
import com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule;

/**
 * @author Nicolas Morel.
 */
public class HelloModule extends AbstractGinModule {

    @Override
    protected void configure() {
        RestDispatchAsyncModule.Builder dispatchBuilder = new RestDispatchAsyncModule.Builder();
        install( dispatchBuilder.build() );

        bindConstant().annotatedWith( RestApplicationPath.class ).to( "api" );
    }
}

Fix url to rest api in GWTP example

Fix url to rest api in GWTP example


package seedu.tache.logic.commands;

import seedu.tache.commons.core.EventsCenter;
import seedu.tache.commons.events.ui.ExitAppRequestEvent;

/**
 * Terminates the program.
 */
public class ExitCommand extends Command {

    public static final String COMMAND_WORD = "exit";
    //@@author A0150120H
    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Exits Tache\n"
            + "All changes will be saved but undo history will be discarded\n"
            + "Example: " + COMMAND_WORD;
    //@@author
    public static final String MESSAGE_EXIT_ACKNOWLEDGEMENT = "Exiting Tache as requested ...";

    @Override
    public CommandResult execute() {
        EventsCenter.getInstance().post(new ExitAppRequestEvent());
        return new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT);
    }

}

package seedu.tache.logic.commands;

import seedu.tache.commons.core.EventsCenter;
import seedu.tache.commons.events.ui.ExitAppRequestEvent;

/**
 * Terminates the program.
 */
public class ExitCommand extends Command {

    public static final String COMMAND_WORD = "exit";

    public static final String MESSAGE_EXIT_ACKNOWLEDGEMENT = "Exiting Tache as requested ...";

    @Override
    public CommandResult execute() {
        EventsCenter.getInstance().post(new ExitAppRequestEvent());
        return new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT);
    }

}

Revert "Add usage string for exit command"

This reverts commit e5923adaf5bd38c6ad000bc7053bf07051abd8a2.


package jkind;

public class JKindSettings extends Settings {
	public int n = 200;
	public int timeout = 100;

	public boolean excel = false;
	public boolean xml = false;
	public boolean xmlToStdout = false;

	public boolean boundedModelChecking = true;
	public boolean kInduction = true;
	public boolean invariantGeneration = true;
    public int pdrMax = 1;
	public boolean inductiveCounterexamples = false;
	public boolean reduceIvc = false;
	public boolean smoothCounterexamples = false;
    public boolean intervalGeneralization = false;
    public boolean inline = true;

	public SolverOption solver = SolverOption.YICES;
	public boolean scratch = false;

	public String writeAdvice = null;
	public String readAdvice = null;
}

package jkind;

public class JKindSettings extends Settings {
	public int n = 200;
	public int timeout = 100;

	public boolean excel = false;
	public boolean xml = false;
	public boolean xmlToStdout = false;

	public boolean boundedModelChecking = true;
	public boolean kInduction = true;
	public boolean invariantGeneration = true;
    public int pdrMax = 1;
	public boolean inductiveCounterexamples = false;
	public boolean reduceIvc = false;
	public boolean smoothCounterexamples = false;
    public boolean intervalGeneralization = false;
    public boolean inline = true;

	public SolverOption solver = SolverOption.SMTINTERPOL;
	public boolean scratch = false;

	public String writeAdvice = null;
	public String readAdvice = null;
}

Change default solver from Yices to SMTInterpol

Yices is no longer being supported (even bug fixes). Since SMTInterpol is
distributed as part of JKind, making it the default supports ease-of-use.


/*
 *  Copyright (c) 2012-2013 Malhar, Inc.
 *  All Rights Reserved.
 */
package com.malhartech.demos.pi;

import com.malhartech.stram.StramLocalCluster;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;

/**
 *
 * @author Chetan Narsude <chetan@malhar-inc.com>
 */
public class CalculatorTest
{
  @Test
  public void testSomeMethod() throws Exception
  {
    Calculator calculator = new Calculator();
    final StramLocalCluster lc = new StramLocalCluster(calculator.getApplication(new Configuration(false)));

    new Thread("LocalClusterController")
    {
      @Override
      public void run()
      {
        try {
          Thread.sleep(10000);
        }
        catch (InterruptedException ex) {
        }

        lc.shutdown();
      }

    }.start();

    lc.run();
  }
}

/*
 *  Copyright (c) 2012-2013 Malhar, Inc.
 *  All Rights Reserved.
 */
package com.malhartech.demos.pi;

import com.malhartech.stram.StramLocalCluster;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;

/**
 *
 * @author Chetan Narsude <chetan@malhar-inc.com>
 */
public class CalculatorTest
{
  @Test
  public void testSomeMethod() throws Exception
  {
    Calculator calculator = new Calculator();
    final StramLocalCluster lc = new StramLocalCluster(calculator.getApplication(new Configuration(false)));
    lc.run(10000);
  }
}

Add deploy type to allow single operator class to have multiple roles.


package org.utplsql.cli;

import org.utplsql.api.DBHelper;
import org.utplsql.api.Version;
import org.utplsql.api.compatibility.OptionalFeatures;

import java.sql.Connection;
import java.sql.SQLException;

/** Helper class to check several circumstances with RunCommand. Might need refactoring.
 *
 * @author pesse
 */
class RunCommandChecker {

    /** Checks that orai18n library exists if database is an oracle 11
     *
     */
    static void checkOracleI18nExists(Connection con) throws SQLException {

        String oracleDatabaseVersion = DBHelper.getOracleDatabaseVersion(con);
        if ( oracleDatabaseVersion.startsWith("11.") && !OracleLibraryChecker.checkOrai18nExists() )
        {
            System.out.println("Warning: Could not find Oracle i18n driver in classpath. Depending on the database charset " +
                    "utPLSQL-cli might not run properly. It is recommended you download " +
                    "the i18n driver from the Oracle website and copy it to the 'lib' folder of your utPLSQL-cli installation.");
            System.out.println("Download from http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html");
        }
    }
}

package org.utplsql.cli;

import org.utplsql.api.DBHelper;
import org.utplsql.api.Version;
import org.utplsql.api.compatibility.OptionalFeatures;

import java.sql.Connection;
import java.sql.SQLException;

/** Helper class to check several circumstances with RunCommand. Might need refactoring.
 *
 * @author pesse
 */
class RunCommandChecker {

    /** Checks that orai18n library exists if database is an oracle 11
     *
     */
    static void checkOracleI18nExists(Connection con) throws SQLException {

        if ( !OracleLibraryChecker.checkOrai18nExists() )
        {
            System.out.println("WARNING: Could not find Oracle i18n driver in classpath. Depending on the database charset " +
                    "utPLSQL-cli, especially code coverage, might not run properly. It is recommended you download " +
                    "the i18n driver from the Oracle website and copy it to the 'lib' folder of your utPLSQL-cli installation.");
            System.out.println("Download from http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html");
        }
    }
}

Add warning for missing Ora i18n driver independent of DB version


package org.concord.framework.otrunk;

import java.util.Vector;

/**
 * A simple abstract class for being able to define a filtering mechanism for an OTObject or OTObjectList
 *
 * @author aunger
 */
public abstract class OTObjectFilter {

	abstract public boolean keepObject(OTObject obj);

	public Vector<OTObject> filterList(OTObjectList list) {
		Vector<OTObject> originalList = list.getVector();
		return filterList(originalList);
	}

	public Vector<OTObject> filterList(Vector<OTObject> list) {
		Vector<OTObject> filtered = new Vector<OTObject>();
		for (OTObject obj : list) {
			if (keepObject(obj)) {
				filtered.add(obj);
			}
		}
		return filtered;
	}
}

package org.concord.framework.otrunk;

import java.util.Vector;

/**
 * A simple abstract class for being able to define a filtering mechanism for an OTObject or OTObjectList
 *
 * @author aunger
 */
public abstract class OTObjectFilter {

	abstract public boolean keepObject(OTObject obj);

	public Vector<OTObject> filterList(OTObjectList list) {
		Vector<OTObject> originalList = list.getVector();
		return filterList(originalList);
	}

	public Vector<OTObject> filterList(Vector<OTObject> list) {
		Vector<OTObject> filtered = new Vector<OTObject>();
		for (OTObject obj : list) {
			if (obj != null && keepObject(obj)) {
				filtered.add(obj);
			}
		}
		return filtered;
	}
}

Check if filter obj is null to avoid NPE

git-svn-id: fdf63cc6b6871a635be2b727c8623e4c3a9a9ed7@18222 6e01202a-0783-4428-890a-84243c50cc2b


package com.mkl.websuites.test.integration;

import com.mkl.websuites.AnnotatedSuite;
import com.mkl.websuites.SuiteClasses;
import com.mkl.websuites.WebSuites;
import com.mkl.websuites.WebSuitesConfig;
import com.mkl.websuites.WebSuitesRunner;

public class LocalTestConfig {

	@WebSuitesConfig(
			basePath = "/integration/simple/titleOnly.html",
			browsers = {"ff"},
			host = "http://localhost",
			port = 90

		)
	public static class Config {}

	@SuiteClasses(suite = {OneBrowserTitleOnlyTest.class, NonWebSuiteTest.class})
	public static class LocalSuite extends AnnotatedSuite {}

	@WebSuitesRunner(configurationClass = Config.class, suite = {LocalSuite.class})
	public static class Runner extends WebSuites {}

}

package com.mkl.websuites.test.integration;

import com.mkl.websuites.WebSuites;
import com.mkl.websuites.WebSuitesConfig;
import com.mkl.websuites.WebSuitesRunner;

public class LocalTestConfig {

	@WebSuitesConfig(
			basePath = "/integration/simple/titleOnly.html",
			browsers = {"ff"},
			host = "http://localhost",
			port = 90

	)
	public static class Config {}

	@WebSuitesRunner(
			configurationClass = Config.class,
			suite = {OneBrowserTitleOnlyTest.class, NonWebSuiteTest.class}
	)
	public static class Runner extends WebSuites {}

}

Test refacroting and test for Jenkins-Eclipse integration.


package com.nirima.jenkins.plugins.docker;

import hudson.Extension;
import hudson.model.Describable;
import hudson.model.Descriptor;
import jenkins.model.Jenkins;

/**
 * A simple template storage.
 */
public class DockerSimpleTemplate extends DockerTemplateBase implements Describable<DockerSimpleTemplate> {
    public DockerSimpleTemplate(String image,
                                String dnsString,
                                String dockerCommand,
                                String volumesString,
                                String volumesFrom,
                                String environmentsString,
                                String lxcConfString,
                                String hostname,
                                Integer memoryLimit,
                                Integer cpuShares,
                                String bindPorts,
                                boolean bindAllPorts,
                                boolean privileged,
                                boolean tty) {
        super(image,
                dnsString,
                dockerCommand,
                volumesString,
                volumesFrom,
                environmentsString,
                lxcConfString,
                hostname,
                memoryLimit,
                cpuShares,
                bindPorts,
                bindAllPorts,
                privileged,
                tty);
    }

    public Descriptor<DockerSimpleTemplate> getDescriptor() {
        return Jenkins.getInstance().getDescriptor(getClass());
    }

    @Extension
    public static final class DescriptorImpl extends Descriptor<DockerSimpleTemplate> {

        @Override
        public String getDisplayName() {
            return "Docker Template";
        }

    }
}

package com.nirima.jenkins.plugins.docker;

import hudson.Extension;
import hudson.model.Describable;
import hudson.model.Descriptor;
import jenkins.model.Jenkins;

/**
 * A simple template storage.
 */
public class DockerSimpleTemplate extends DockerTemplateBase implements Describable<DockerSimpleTemplate> {
    public DockerSimpleTemplate(String image,
                                String dnsString,
                                String dockerCommand,
                                String volumesString,
                                String volumesFrom,
                                String environmentsString,
                                String lxcConfString,
                                String hostname,
                                Integer memoryLimit,
                                Integer cpuShares,
                                String bindPorts,
                                boolean bindAllPorts,
                                boolean privileged,
                                boolean tty) {
        super(image,
                dnsString,
                dockerCommand,
                volumesString,
                volumesFrom,
                environmentsString,
                lxcConfString,
                hostname,
                memoryLimit,
                cpuShares,
                bindPorts,
                bindAllPorts,
                privileged,
                tty);
    }

    public Descriptor<DockerSimpleTemplate> getDescriptor() {
        return (DescriptorImpl) Jenkins.getInstance().getDescriptor(getClass());
    }

    @Extension
    public static final class DescriptorImpl extends Descriptor<DockerSimpleTemplate> {

        @Override
        public String getDisplayName() {
            return "Docker Template";
        }

    }
}

Fix IDEA warning about unchecked assignment


package com.demigodsrpg.chitchat.command;

import com.demigodsrpg.chitchat.Chitchat;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class CCMuteCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player && sender.hasPermission("chitchat.mute")) {
            if (args.length > 0) {
                if (command.getName().equals("ccmute")) {
                    Chitchat.getMuteSet().add(args[0]);
                    sender.sendMessage(ChatColor.YELLOW + "Muted " + args[0]);
                } else {
                    Chitchat.getMuteSet().remove(args[0]);
                    sender.sendMessage(ChatColor.YELLOW + "Unmuted " + args[0]);
                }
            } else {
                return false;
            }
        } else {
            sender.sendMessage(ChatColor.RED + "You don't have permission to use that command.");
        }
        return true;
    }
}

package com.demigodsrpg.chitchat.command;

import com.demigodsrpg.chitchat.Chitchat;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class CCMuteCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player && sender.hasPermission("chitchat.mute")) {
            if (args.length > 0) {
                if (command.getName().equals("ccmute")) {
                    if ("list".equalsIgnoreCase(args[0])) {
                        sender.sendMessage(ChatColor.YELLOW + "// -- Currently Muted Players -- //");
                        for (String mutedName : Chitchat.getMuteSet()) {
                            sender.sendMessage(ChatColor.YELLOW + "  - " + mutedName);
                        }
                        return true;
                    }
                    Chitchat.getMuteSet().add(args[0]);
                    sender.sendMessage(ChatColor.YELLOW + "Muted " + args[0]);
                } else {
                    Chitchat.getMuteSet().remove(args[0]);
                    sender.sendMessage(ChatColor.YELLOW + "Unmuted " + args[0]);
                }
            } else {
                return false;
            }
        } else {
            sender.sendMessage(ChatColor.RED + "You don't have permission to use that command.");
        }
        return true;
    }
}

Add a quick and dirty mute list.

Add a quick and dirty mute list.


package uk.co.uwcs.choob.modules;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;

class ChoobURLStreamHandler extends URLStreamHandler {
	@Override
	protected URLConnection openConnection(URL u) throws IOException {
		final String path = u.getPath();

		{
			final URL resource = ChoobURLStreamHandler.class.getResource(path);
			if (null != resource)
				return resource.openConnection();
		}

		for (File sourcePath : new File[] {
				new File("main/plugins-alpha"),
				new File("main/plugins"),
				new File("src/main/plugins-alpha"),
				new File("src/main/plugins"),
		}) {
			final File f = new File(sourcePath, u.getPath());
			if (f.isFile())
				return new URL("file:///" + f.getAbsolutePath()).openConnection();
		}

		throw new FileNotFoundException("Couldn't resolve '" + path + "' from the classpath or source directories");
	}
}

package uk.co.uwcs.choob.modules;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;

class ChoobURLStreamHandler extends URLStreamHandler {
	@Override
	protected URLConnection openConnection(URL u) throws IOException {
		final String path = u.getPath();

		for (File sourcePath : new File[] {
				new File("main/plugins-alpha"),
				new File("main/plugins"),
				new File("src/main/plugins-alpha"),
				new File("src/main/plugins"),
		}) {
			final File f = new File(sourcePath, u.getPath());
			if (f.isFile())
				return new URL("file:///" + f.getAbsolutePath()).openConnection();
		}

		{
			final URL resource = ChoobURLStreamHandler.class.getResource(path);
			if (null != resource)
				return resource.openConnection();
		}
		throw new FileNotFoundException("Couldn't resolve '" + path + "' from the classpath or source directories");
	}
}

Load choob-plugin:s from local directories before classpath


package info.u_team.u_team_test.init;

import info.u_team.u_team_core.item.armor.UArmorMaterialVanilla;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.crafting.Ingredient;

public class TestArmorMaterial {

	public static final IArmorMaterial BASIC = new UArmorMaterialVanilla(20, new int[] { 5, 6, 8, 2 }, 20, TestSounds.BETTER_ENDERPEARL_USE.get(), 1, () -> Ingredient.fromItems(TestItems.BASIC));

}

package info.u_team.u_team_test.init;

import info.u_team.u_team_core.item.armor.UArmorMaterialVanilla;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.crafting.Ingredient;

public class TestArmorMaterial {

	public static final IArmorMaterial BASIC = new UArmorMaterialVanilla(20, new int[] { 5, 6, 8, 2 }, 20, TestSounds.BETTER_ENDERPEARL_USE, 1, () -> Ingredient.fromItems(TestItems.BASIC));

}

Use the new supplier method for the armor material


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package sample;

public class Main {
	// Example input for an interactive session.
	// val sqlContext = new org.apache.spark.sql.SQLContext(sc); val pf = sqlContext.read.parquet("wasb:///parquet/data*")
	// pf.registerTempTable("pftbl")
    // pf.count()
	// sqlContext.sql("SELECT para1, param2, param3 FROM pftbl").show(10)
	public static void main(String args[]) throws Exception {

		//InteractiveSample1 client = new InteractiveSample1();
		BatchSample client = new BatchSample();
		client.run();
   }
}

Change sample query in the comment

Change  sample query  in the comment


package br.com.ema.dialogs;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;

import br.com.ema.R;

public class FinishGameDialogFragment extends DialogFragment {
    private static final String TAG = "FinishDialogFragment";

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(R.string.areYouSure)
                .setPositiveButton(R.string.finish, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // Finish the game
                    }
                })
                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        Log.i(TAG, "User cancelled the the end of the game.");
                    }
                });
        // Create the AlertDialog object and return it
        return builder.create();
    }

}

package br.com.ema.dialogs;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;

import br.com.ema.R;

public class FinishGameDialogFragment extends DialogFragment {
    private static final String TAG = "FinishDialogFragment";

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(R.string.areYouSure)
                .setPositiveButton(R.string.finish, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        Log.i(TAG, "finish the game");
                        getActivity().finish();
                    }
                })
                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        Log.i(TAG, "User cancelled the the end of the game.");
                    }
                });
        return builder.create();
    }

}

Add action to finish the activity.

Add action to finish the activity.


package org.monospark.spongematchers.base;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Pattern;

import org.monospark.spongematchers.Matcher;

public final class NameMatcher implements Matcher<String> {

    public static final Map<String, String> REPLACEMENTS = createReplacements();

    public static final Pattern NAME_REGEX = createRegex();

    private static Map<String, String> createReplacements() {
        Map<String, String> replacements = new HashMap<String, String>();
        replacements.put("*", ".*");
        replacements.put("?", ".");
        return replacements;
    }

    private static Pattern createRegex() {
        StringBuilder toAppend = new StringBuilder();
        for (Entry<String, String> entry : REPLACEMENTS.entrySet()) {
            toAppend.append("|").append(entry.getKey());
        }
        return Pattern.compile("(?:\\w" + toAppend.toString() + ")");
    }

    private Pattern regex;

    public NameMatcher(String regex) {
        if (!NAME_REGEX.matcher(regex).matches()) {
            throw new IllegalArgumentException("Invalid name regex: " + regex);
        }

        this.regex = Pattern.compile(regex);
    }

    NameMatcher(Pattern regex) {
        this.regex = regex;
    }

    @Override
    public boolean matches(String o) {
        return regex.matcher(o).matches();
    }
}

package org.monospark.spongematchers.base;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Pattern;

import org.monospark.spongematchers.Matcher;

public final class NameMatcher implements Matcher<String> {

    public static final Map<String, String> REPLACEMENTS = createReplacements();

    public static final Pattern NAME_REGEX = createRegex();

    private static Map<String, String> createReplacements() {
        Map<String, String> replacements = new HashMap<String, String>();
        replacements.put("*", ".*");
        replacements.put("?", ".");
        return replacements;
    }

    private static Pattern createRegex() {
        StringBuilder toAppend = new StringBuilder();
        for (Entry<String, String> entry : REPLACEMENTS.entrySet()) {
            toAppend.append("|").append(entry.getKey());
        }
        return Pattern.compile("[a-zA-Z](?:\\w" + toAppend.toString() + ")+");
    }

    private Pattern regex;

    public NameMatcher(String regex) {
        if (!NAME_REGEX.matcher(regex).matches()) {
            throw new IllegalArgumentException("Invalid name regex: " + regex);
        }

        this.regex = Pattern.compile(regex);
    }

    NameMatcher(Pattern regex) {
        this.regex = regex;
    }

    @Override
    public boolean matches(String o) {
        return regex.matcher(o).matches();
    }
}

Fix wrong pattern for minecraft names

Fix wrong pattern for minecraft names


package managers.nodes;

import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;
import managers.functions.JsonFunction;
import models.nodes.LabeledNodeWithProperties;
import models.nodes.Node;
import neo4play.Neo4jService;
import play.libs.F.Promise;
import play.libs.WS;

public class LabeledNodeWithPropertiesManager extends LabeledNodeManager {

    public Promise<? extends List<? extends Node>> all() {
        return null;
    }

    public Promise<? extends Node> get(JsonNode properties) {
        return null;
    }

    protected Promise<Boolean> connect(
        JsonNode startNode, JsonNode endNode, String location) {
        return null;
    }

    protected Promise<Boolean> disconnect(
        JsonNode startNode, JsonNode endNode, String location) {
        return null;
    }

    public static Promise<JsonNode> get(LabeledNodeWithProperties node) {
        Promise<WS.Response> response = Neo4jService
            .getLabeledNodeWithProperties(
                node.getLabel(), node.jsonProperties);
        return response.map(new JsonFunction());
    }

}

package managers.nodes;

import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;
import managers.functions.JsonFunction;
import models.nodes.LabeledNodeWithProperties;
import models.nodes.Node;
import neo4play.Neo4jService;
import play.libs.F.Promise;
import play.libs.WS;

public abstract class LabeledNodeWithPropertiesManager
    extends LabeledNodeManager {

    public Promise<? extends List<? extends Node>> all() {
        return null;
    }

    public Promise<? extends Node> get(JsonNode properties) {
        return null;
    }

    protected Promise<Boolean> connect(
        JsonNode startNode, JsonNode endNode, String location) {
        return null;
    }

    protected Promise<Boolean> disconnect(
        JsonNode startNode, JsonNode endNode, String location) {
        return null;
    }

    public static Promise<JsonNode> get(LabeledNodeWithProperties node) {
        Promise<WS.Response> response = Neo4jService
            .getLabeledNodeWithProperties(
                node.getLabel(), node.jsonProperties);
        return response.map(new JsonFunction());
    }

}

WIP: Enable operations that write to the DB to be rolled back on error
by wrapping them in transactions.

Clean up: Make LabeledNodeWithPropertiesManager class abstract.


/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */package org.opendaylight.yangtools.yang.model.export;

import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;

interface StatementTextWriter {

    void startStatement(StatementDefinition statement);

    void writeArgument(RevisionAwareXPath xpath);

    void writeArgument(QName name);

    void writeArgument(String argStr);

    void writeArgument(SchemaPath targetPath);

    void endStatement();

}

/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.yangtools.yang.model.export;

import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;

interface StatementTextWriter {

    void startStatement(StatementDefinition statement);

    void writeArgument(RevisionAwareXPath xpath);

    void writeArgument(QName name);

    void writeArgument(String argStr);

    void writeArgument(SchemaPath targetPath);

    void endStatement();

}

Fix license header violations in yang-model-export

Change-Id: I14acb8a5c0adb44046346683938bb0d2464067ab
Signed-off-by: Thanh Ha <09ea4d3a79c8bee41a16519f6a431f6bc0fd8d6f@linuxfoundation.org>


/*
 * Copyright 2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.api.internal.externalresource;

import java.io.IOException;
import java.io.InputStream;

public class MissingExternalResource extends AbstractExternalResource {
    private final String source;

    public MissingExternalResource(String source) {
        this.source = source;
    }

    @Override
    public String toString() {
        return "MissingResource: " + getName();
    }

    public String getName() {
        return source;
    }

    public boolean exists() {
        return false;
    }

    public long getLastModified() {
        throw new UnsupportedOperationException();
    }

    public long getContentLength() {
        throw new UnsupportedOperationException();
    }

    public boolean isLocal() {
        throw new UnsupportedOperationException();
    }

    public InputStream openStream() throws IOException {
        throw new UnsupportedOperationException();
    }
}

/*
 * Copyright 2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.api.internal.externalresource;

import java.io.IOException;
import java.io.InputStream;

public class MissingExternalResource extends AbstractExternalResource {
    private final String source;

    public MissingExternalResource(String source) {
        this.source = source;
    }

    @Override
    public String toString() {
        return "MissingResource: " + getName();
    }

    public String getName() {
        return source;
    }

    public boolean exists() {
        return false;
    }

    public long getLastModified() {
        return -1;
    }

    public long getContentLength() {
        return -1;
    }

    public boolean isLocal() {
        throw new UnsupportedOperationException();
    }

    public InputStream openStream() throws IOException {
        throw new UnsupportedOperationException();
    }
}

Use -1 for metadata about missing resources instead of throwing exceptions.


package com.sailthru.client;

import com.google.gson.JsonSerializer;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonNull;
import java.lang.reflect.Type;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: dennisyu
 * Date: 8/5/13
 * Time: 4:41 PM
 * To change this template use File | Settings | File Templates.
 */
public class NullSerializingMapSerializer implements JsonSerializer<Map> {
    private static final Gson gson = (new GsonBuilder()).serializeNulls().create();
    public JsonElement serialize(Map map, Type typeOfSrc, JsonSerializationContext context) {
        if(map == null) {
            return new JsonNull();
        }
        return new JsonPrimitive(gson.toJson(map));
    }
}

package com.sailthru.client;

import com.google.gson.JsonSerializer;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonNull;
import java.lang.reflect.Type;
import java.util.Map;

public class NullSerializingMapSerializer implements JsonSerializer<Map> {
    private static final Gson gson = (new GsonBuilder()).serializeNulls().create();
    public JsonElement serialize(Map map, Type typeOfSrc, JsonSerializationContext context) {
        if(map == null) {
            return new JsonNull();
        }
        return new JsonPrimitive(gson.toJson(map));
    }
}

Remove auto generated code by Intellj

Remove auto generated code by Intellj


/*-------------------------------------------------------------------------
*
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
*   $PostgreSQL: pgjdbc/org/postgresql/util/PSQLDriverVersion.java,v 1.21 2006/12/01 12:06:21 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;

import org.postgresql.Driver;

/**
 * This class holds the current build number and a utility program to print
 * it and the file it came from.  The primary purpose of this is to keep
 * from filling the cvs history of Driver.java.in with commits simply
 * changing the build number.  The utility program can also be helpful for
 * people to determine what version they really have and resolve problems
 * with old and unknown versions located somewhere in the classpath.
 */
public class PSQLDriverVersion {

    public final static int buildNumber = 601;

    public static void main(String args[]) {
        java.net.URL url = Driver.class.getResource("/org/postgresql/Driver.class");
        System.out.println(Driver.getVersion());
        System.out.println("Found in: " + url);
    }

}

/*-------------------------------------------------------------------------
*
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
*   $PostgreSQL: pgjdbc/org/postgresql/util/PSQLDriverVersion.java,v 1.22 2007/07/31 06:05:43 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;

import org.postgresql.Driver;

/**
 * This class holds the current build number and a utility program to print
 * it and the file it came from.  The primary purpose of this is to keep
 * from filling the cvs history of Driver.java.in with commits simply
 * changing the build number.  The utility program can also be helpful for
 * people to determine what version they really have and resolve problems
 * with old and unknown versions located somewhere in the classpath.
 */
public class PSQLDriverVersion {

    public final static int buildNumber = 602;

    public static void main(String args[]) {
        java.net.URL url = Driver.class.getResource("/org/postgresql/Driver.class");
        System.out.println(Driver.getVersion());
        System.out.println("Found in: " + url);
    }

}

Prepare for release of 8.3dev-602.

Prepare for release of 8.3dev-602.


package in.co.sdslabs.cognizance;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class AlarmReciever extends BroadcastReceiver {

	NotificationManager nm;

	@SuppressWarnings("deprecation")
	@Override
	public void onReceive(Context context, Intent arg1) {

		Intent myIntent = new Intent(context, EventActivity.class);
		nm = (NotificationManager) context
				.getSystemService(Context.NOTIFICATION_SERVICE);
		CharSequence from = "Cognizance 2014";

		CharSequence message = "Your Today's Tasks are.....";
		PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
				myIntent, 0);
		Notification notif = new Notification(R.drawable.launcher_icon,
				"enter name of event that needs to be notified about", System.currentTimeMillis());
		notif.flags = Notification.FLAG_INSISTENT;
		notif.setLatestEventInfo(context, from, message, contentIntent);
		notif.flags |= Notification.FLAG_AUTO_CANCEL;
		nm.notify(1, notif);

	}
};

package in.co.sdslabs.cognizance;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class AlarmReciever extends BroadcastReceiver {

	NotificationManager nm;

	@SuppressWarnings("deprecation")
	@Override
	public void onReceive(Context context, Intent intent) {

		String eventname = intent.getStringExtra("event");
		Intent myIntent = new Intent(context, EventActivity.class);
		Bundle data = new Bundle();
		data.putString("event", eventname);
		myIntent.putExtras(data);
		nm = (NotificationManager) context
				.getSystemService(Context.NOTIFICATION_SERVICE);
		CharSequence from = "Cognizance 2014";

		CharSequence message = eventname;
		PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
				myIntent, 0);
		Notification notif = new Notification(R.drawable.launcher_icon,
				"enter name of event that needs to be notified about", System.currentTimeMillis());
		notif.flags = Notification.FLAG_INSISTENT;
		notif.setLatestEventInfo(context, from, message, contentIntent);
		notif.flags |= Notification.FLAG_AUTO_CANCEL;
		nm.notify(1, notif);

	}
};

Add code for recieving data

Add code for recieving data


/**
 * Place-holder for dataset package info
 *
 *
 */
package com.continuuity.api.data.lib;

/**
 * This package contains utility classes and helper functions
 * {@link com.continuuity.api.data.util.Bytes} class handles byte arrays, conversions to/from other types,
 * comparisons, hash code generation, manufacturing keys for HashMaps or HashSets
 * {@link com.continuuity.api.data.util.Helpers} classes contain utility functions for timestamp
 *
 */
package com.continuuity.api.data.util;

Add java doc for utils

Add java doc for utils


package com.faforever.api.db;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface SchemaVersionRepository extends JpaRepository<SchemaVersion, Integer> {

  @Query("select s.version from SchemaVersion s where s.installedRank = (select max (s.installedRank) from SchemaVersion s)")
  Optional<String> findMaxVersion();
}

package com.faforever.api.db;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface SchemaVersionRepository extends JpaRepository<SchemaVersion, Integer> {

  @Query("select s.version from SchemaVersion s where s.installedRank = (select max (s.installedRank) from SchemaVersion s where s.version is not null)")
  Optional<String> findMaxVersion();
}

Fix crash on startup on repeatable migrations having highest rank


package org.killbill.billing.plugin.notification.womplyClient;

public class EmailRequestModel {

    private String emailType;
    private String invoiceNumber;
    private String subscriptionId;
    private String businessLocationId;

    public EmailRequestModel(String emailType,
                             String invoiceNumber,
                             String subscriptionId,
                             String businessLocationId) {
        this.emailType = emailType;
        this.invoiceNumber = invoiceNumber;
        this.subscriptionId = subscriptionId;
        this.businessLocationId = businessLocationId;
    }

    public String getEmailType() {
        return emailType;
    }

    public void setEmailType(String emailType) {
        this.emailType = emailType;
    }

    public String getInvoiceNumber() { return invoiceNumber; }

    public void setInvoiceNumber(String invoiceNumber) { this.invoiceNumber = invoiceNumber; }

    public String getSubscriptionId() {
        return subscriptionId;
    }

    public void setSubscriptionId(String subscriptionId) {
        this.subscriptionId = subscriptionId;
    }

    public String getBusinessLocationId() {
        return businessLocationId;
    }

    public void setBusinessLocationId(String businessLocationId) {
        this.businessLocationId = businessLocationId;
    }
}

package org.killbill.billing.plugin.notification.womplyClient;

public class EmailRequestModel {

    private String emailType;
    private String invoiceId;
    private String subscriptionId;
    private String businessLocationId;

    public EmailRequestModel(String emailType,
                             String invoiceId,
                             String subscriptionId,
                             String businessLocationId) {
        this.emailType = emailType;
        this.invoiceId = invoiceId;
        this.subscriptionId = subscriptionId;
        this.businessLocationId = businessLocationId;
    }

    public String getEmailType() {
        return emailType;
    }

    public void setEmailType(String emailType) {
        this.emailType = emailType;
    }

    public String getInvoiceId() { return invoiceId; }

    public void setInvoiceId(String invoiceId) { this.invoiceId = invoiceId; }

    public String getSubscriptionId() {
        return subscriptionId;
    }

    public void setSubscriptionId(String subscriptionId) {
        this.subscriptionId = subscriptionId;
    }

    public String getBusinessLocationId() {
        return businessLocationId;
    }

    public void setBusinessLocationId(String businessLocationId) {
        this.businessLocationId = businessLocationId;
    }
}

Fix small error in model naming

[TASK] Fix small error in model naming

-InvoiceNumber should have been InvoiceId


package com.pivotallabs;

import android.net.Uri;
import com.xtremelabs.robolectric.RobolectricTestRunner;
import org.junit.runners.model.InitializationError;

public class RobolectricSampleTestRunner extends RobolectricTestRunner {
    public RobolectricSampleTestRunner(Class testClass) throws InitializationError {
        super(testClass);
        delegateLoadingOf(Uri.class.getName());
    }
 }

package com.pivotallabs;

import com.xtremelabs.robolectric.RobolectricTestRunner;
import org.junit.runners.model.InitializationError;

public class RobolectricSampleTestRunner extends RobolectricTestRunner {
    public RobolectricSampleTestRunner(Class testClass) throws InitializationError {
        super(testClass);
    }
 }

Remove unneeded delegation of Android's Uri class


package me.izstas.rfs.server.service;

import java.nio.file.Path;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

import me.izstas.rfs.server.config.security.RfsUserDetails;

@Service
public class PathService {
    /**
     * Makes sure the provided path is in the user's root.
     * @throws BadPathException if the path is not the user's root
     */
    public void validateUserPath(Path path) {
        Path currentPath = path.toAbsolutePath();
        Path rootPath = getUserRoot().toAbsolutePath();

        do {
            if (currentPath.equals(rootPath)) {
                return;
            }
        }
        while ((currentPath = currentPath.getParent()) != null);

        // If we've reached this line, the provided path is not in the user's root
        throw new BadPathException();
    }

    /**
     * Resolves the provided path against the user's root and validates it with {@link #validateUserPath(Path)}.
     */
    public Path resolveUserPath(String path) {
        Path resolvedPath = getUserRoot().resolve(path);
        validateUserPath(resolvedPath);

        return resolvedPath;
    }

    private Path getUserRoot() {
        return ((RfsUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getRoot();
    }
}

package me.izstas.rfs.server.service;

import java.nio.file.Path;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

import me.izstas.rfs.server.config.security.RfsUserDetails;

@Service
public class PathService {
    /**
     * Makes sure the provided path is in the user's root.
     * @throws BadPathException if the path is not the user's root
     */
    public void validateUserPath(Path path) {
        Path currentPath = path.toAbsolutePath().normalize();
        Path rootPath = getUserRoot().toAbsolutePath().normalize();

        do {
            if (currentPath.equals(rootPath)) {
                return;
            }
        }
        while ((currentPath = currentPath.getParent()) != null);

        // If we've reached this line, the provided path is not in the user's root
        throw new BadPathException();
    }

    /**
     * Resolves the provided path against the user's root and validates it with {@link #validateUserPath(Path)}.
     */
    public Path resolveUserPath(String path) {
        Path resolvedPath = getUserRoot().resolve(path);
        validateUserPath(resolvedPath);

        return resolvedPath;
    }

    private Path getUserRoot() {
        return ((RfsUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getRoot();
    }
}

Make sure to call normalize() on the path before validating


package com.bignerdranch.android.criminalintent;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class CrimeFragment extends Fragment {

    private Crime mCrime;
    private TextView mTitleField;

    @Override public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        mCrime = new Crime();
    }

    @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        View view = inflater.inflate(R.layout.fragment_crime, container, false);

        mTitleField = (TextView)view.findViewById(R.id.crime_title);

        return view;
    }
}

package com.bignerdranch.android.criminalintent;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class CrimeFragment extends Fragment {

    private Crime mCrime;
    private TextView mTitleField;

    @Override public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        mCrime = new Crime();
    }

    @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        View view = inflater.inflate(R.layout.fragment_crime, container, false);

        mTitleField = (TextView)view.findViewById(R.id.crime_title);
        mTitleField.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                mCrime.setTitle(s.toString());
            }

            @Override
            public void afterTextChanged(Editable s) {}
        });

        return view;
    }
}

Implement text listener for title field in crime fragment


package com.theironyard.controllers;

import com.theironyard.entities.User;
import com.theironyard.services.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * Created by Dan on 7/19/16.
 */
@RestController
public class VertoSwapController {

    @Autowired
    UserRepository users;

    @RequestMapping(path = "/login", method = RequestMethod.POST)
    public void login(HttpSession session, @RequestBody User user) {
        //User userFromDB = users.findByName
    }
}

package com.theironyard.controllers;

import com.theironyard.entities.User;
import com.theironyard.services.UserRepository;
import com.theironyard.utilities.PasswordStorage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpSession;

/**
 * Created by Dan on 7/19/16.
 */
@Controller
public class VertoSwapController {

    @Autowired
    UserRepository users;

    @RequestMapping(path = "/account-create", method = RequestMethod.POST)
    public String createAccount(HttpSession session, String username, String password) throws Exception {
        User user = users.findByName(username);
        if (user != null) {
            throw new Exception("Username unavailable.");
        }
        else {
            user = new User(username, PasswordStorage.createHash(password));
            users.save(user);
            session.setAttribute("username", username);
        }
        return "redirect:/";
    }

    @RequestMapping(path = "/login", method = RequestMethod.POST)
    public String login(HttpSession session, String username, String password) throws Exception {
        User userFromDB = users.findByName(username);
        if (userFromDB == null) {
            return "redirect:/create-account";
        }
        else if (!PasswordStorage.verifyPassword(password, userFromDB.getPassword())) {
            throw new Exception("Wrong password.");
        }
        session.setAttribute("username", username);
        return "redirect:/";
    }

    @RequestMapping(path = "/logout", method = RequestMethod.POST)
    public String logout(HttpSession session) {
        session.invalidate();
        return "redirect:/";
    }
}

Create login, logout, create account routes


package org.monospark.actioncontrol.matcher;

import java.util.Optional;

import org.monospark.actioncontrol.matcher.enchantment.EnchantmentKindRegistry;
import org.monospark.actioncontrol.matcher.entity.EntityKindRegistry;
import org.monospark.actioncontrol.matcher.object.all.AllKindRegistry;
import org.monospark.actioncontrol.matcher.object.block.BlockKindRegistry;
import org.monospark.actioncontrol.matcher.object.item.ItemKindRegistry;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.item.inventory.ItemStack;

public final class MatcherType<T> {

	public static final MatcherType<BlockState> BLOCK = new MatcherType<>(new BlockKindRegistry());

	public static final MatcherType<ItemStack> ITEM = new MatcherType<>(new ItemKindRegistry());

	public static final MatcherType<ItemStack> OBJECT = new MatcherType<>(new AllKindRegistry());

	public static final MatcherType<Entity> ENTITY = new MatcherType<>(new EntityKindRegistry());

	public static final MatcherType<?> ENCHANTMENT = new MatcherType<>(new EnchantmentKindRegistry());

	private MatcherCreator<T> creator;

	private MatcherType(MatcherCreator<T> creator) {
		this.creator = creator;
	}

	public Matcher<T> getDefaultMatcher() {
		return creator.getWildcardMatcher();
	}

	public Optional<? extends Matcher<T>> getMatcher(String name) {
		return creator.getMatcher(name);
	}
}

package org.monospark.actioncontrol.matcher;

import java.util.Optional;

import org.monospark.actioncontrol.matcher.enchantment.EnchantmentKindRegistry;
import org.monospark.actioncontrol.matcher.entity.EntityKindRegistry;
import org.monospark.actioncontrol.matcher.object.all.AllKindRegistry;
import org.monospark.actioncontrol.matcher.object.block.BlockKindRegistry;
import org.monospark.actioncontrol.matcher.object.item.ItemKindRegistry;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.data.meta.ItemEnchantment;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.item.inventory.ItemStack;

public final class MatcherType<T> {

	public static final MatcherType<BlockState> BLOCK = new MatcherType<>(new BlockKindRegistry());

	public static final MatcherType<ItemStack> ITEM = new MatcherType<>(new ItemKindRegistry());

	public static final MatcherType<ItemStack> OBJECT = new MatcherType<>(new AllKindRegistry());

	public static final MatcherType<Entity> ENTITY = new MatcherType<>(new EntityKindRegistry());

	public static final MatcherType<ItemEnchantment> ENCHANTMENT = new MatcherType<>(new EnchantmentKindRegistry());

	private MatcherCreator<T> creator;

	private MatcherType(MatcherCreator<T> creator) {
		this.creator = creator;
	}

	public Matcher<T> getDefaultMatcher() {
		return creator.getWildcardMatcher();
	}

	public Optional<? extends Matcher<T>> getMatcher(String name) {
		return creator.getMatcher(name);
	}
}

Add a generic type to the enchantment matcher type


/*
 * Copyright  2014 - 2016 | Wurst-Imperium | All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package tk.wurst_client.options;

import java.util.Arrays;
import java.util.TreeMap;
import java.util.TreeSet;

public class KeybindManager extends TreeMap<String, TreeSet<String>>
{
	public KeybindManager()
	{
		put("B", ".t fastbreak", ".t fastplace");
		put("C", ".t fullbright");
		put("G", ".t flight");
		put("GRAVE", ".t speednuker");
		put("H", ".t /home");
		put("J", ".t phase");
		put("K", ".t multiaura");
		put("L", ".t nuker");
		put("LCONTROL", ".t navigator");
		put("R", ".t killaura");
		put("RSHIFT", ".t navigator");
		put("U", ".t freecam");
		put("X", ".t x-ray");
		put("Z", ".t sneak");
	}

	public void put(String key, String... commands)
	{
		put(key, new TreeSet<String>(Arrays.asList(commands)));
	}
}

/*
 * Copyright  2014 - 2016 | Wurst-Imperium | All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package tk.wurst_client.options;

import java.util.Arrays;
import java.util.TreeMap;
import java.util.TreeSet;

public class KeybindManager extends TreeMap<String, TreeSet<String>>
{
	public KeybindManager()
	{
		put("B", ".t fastbreak", ".t fastplace");
		put("C", ".t fullbright");
		put("G", ".t flight");
		put("GRAVE", ".t speednuker");
		put("H", ".t /home");
		put("J", ".t jesus");
		put("K", ".t multiaura");
		put("L", ".t nuker");
		put("LCONTROL", ".t navigator");
		put("R", ".t killaura");
		put("RSHIFT", ".t navigator");
		put("U", ".t freecam");
		put("X", ".t x-ray");
		put("Z", ".t sneak");
	}

	public void put(String key, String... commands)
	{
		put(key, new TreeSet<String>(Arrays.asList(commands)));
	}
}

Change J keybind to Jesus

Change J keybind to Jesus


package ingraph.bulkloader.csv.loader.cellprocessor;

import org.supercsv.cellprocessor.CellProcessorAdaptor;
import org.supercsv.cellprocessor.ift.StringCellProcessor;
import org.supercsv.exception.SuperCsvCellProcessorException;
import org.supercsv.util.CsvContext;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

abstract public class AbstractParseEpoch extends CellProcessorAdaptor implements StringCellProcessor {

	protected final DateFormat formatter;

	public AbstractParseEpoch(final String dateTimeFormat) {
		super();
		formatter = new SimpleDateFormat(dateTimeFormat);
		formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
	}

	public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);

		if (!(value instanceof String)) {
			throw new SuperCsvCellProcessorException(String.class, value, context, this);
		}

		long epoch = Long.parseLong(value.toString());
		long result = Long.valueOf(formatter.format(new java.util.Date(epoch)));

		return next.execute(result, context);
	}

}

package ingraph.bulkloader.csv.loader.cellprocessor;

import org.supercsv.cellprocessor.CellProcessorAdaptor;
import org.supercsv.cellprocessor.ift.StringCellProcessor;
import org.supercsv.util.CsvContext;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

abstract public class AbstractParseEpoch extends CellProcessorAdaptor implements StringCellProcessor {

	protected final DateFormat formatter;

	public AbstractParseEpoch(final String dateTimeFormat) {
		super();
		formatter = new SimpleDateFormat(dateTimeFormat);
		formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
	}

	public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);

		long epoch = Long.parseLong(value.toString());
		long result = Long.valueOf(formatter.format(new java.util.Date(epoch)));

		return next.execute(result, context);
	}

}

Remove error handling for cases that never occur with benchmark data


package study.hard.javalib.apache.commons.lang;

import static org.junit.Assert.*;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Test Apache Commons Lang's StringUtils.
 * @author iandmyhand@gmail.com
 */
public class StringUtilsTest {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Test
	public void findNthOccurrenceOfCharacterInString() {
		int index = StringUtils.ordinalIndexOf("aaabaaabaaa", "b", 2);
		assertEquals(7, index);
		logger.debug("index: {}", index);
	}

}

package study.hard.javalib.apache.commons.lang;

import static org.junit.Assert.*;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Test Apache Commons Lang's StringUtils.
 * @author iandmyhand@gmail.com
 */
public class StringUtilsTest {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Test
	public void findNthOccurrenceOfCharacterInString() {
		int index = StringUtils.ordinalIndexOf("aaabaaabaaa", "b", 2);
		assertEquals(7, index);
		logger.debug("index: {}", index);
	}

	@Test
	public void findNthOccurrenceOfCharacterInString2() {
		String ip = "123.456.789.012";
		int index = StringUtils.ordinalIndexOf(ip, ".", 2);
		assertEquals(7, index);
		logger.debug("index: {}", index);
		ip = ip.substring(0, StringUtils.ordinalIndexOf(ip, ".", 2));
		assertEquals("123.456", ip);
	}

}

Add a test case to find Nth occurrence of character in String.


package osgi.enroute.capabilities;

import aQute.bnd.annotation.headers.RequireCapability;

/**
 * The purpose of this capability is to be never satisfied. This can be required
 * by bundles that are compile only or class path only.
 */
@RequireCapability(ns = "osgi.missing", filter = "(&(missing=true)(missing=false))")
public @interface Unresolvable {

}

package osgi.enroute.capabilities;

import aQute.bnd.annotation.headers.RequireCapability;

/**
 * The purpose of this capability is to be never satisfied. This can be required
 * by bundles that are compile only or class path only.
 */
@RequireCapability(ns = "osgi.unresolvable", filter = "(&(must.not.resolve=*)(!(must.not.resolve=*)))")
public @interface Unresolvable {

}

unresolvable: Use a better namespace and a truly unsatisfiable filter


package org.squiddev.cctweaks.integration.openperipheral;

import openperipheral.api.ApiAccess;
import openperipheral.api.adapter.IPeripheralAdapterRegistry;
import org.squiddev.cctweaks.core.utils.DebugLogger;
import org.squiddev.cctweaks.integration.APIIntegration;

/**
 * OpenPeripheral integration
 */
public class OpenPeripheralIntegration extends APIIntegration {
	public OpenPeripheralIntegration() {
		super("OpenPeripheralApi");
	}

	@Override
	public void postInit() {
		if (ApiAccess.isApiPresent(IPeripheralAdapterRegistry.class)) {
			DebugLogger.debug("Registering custom AdapterNetworkedInventory");
			ApiAccess.getApi(IPeripheralAdapterRegistry.class).register(new AdapterNetworkedInventory());
		} else {
			DebugLogger.error("Cannot register AdapterNetworkedInventory");
		}
	}
}

package org.squiddev.cctweaks.integration.openperipheral;

import openperipheral.api.ApiAccess;
import openperipheral.api.adapter.IPeripheralAdapterRegistry;
import org.squiddev.cctweaks.core.utils.DebugLogger;
import org.squiddev.cctweaks.integration.ModIntegration;

/**
 * OpenPeripheral integration
 */
public class OpenPeripheralIntegration extends ModIntegration {
	public OpenPeripheralIntegration() {
		super("OpenPeripheral");
	}

	@Override
	public void postInit() {
		if (ApiAccess.isApiPresent(IPeripheralAdapterRegistry.class)) {
			DebugLogger.debug("Registering custom AdapterNetworkedInventory");
			ApiAccess.getApi(IPeripheralAdapterRegistry.class).register(new AdapterNetworkedInventory());
		} else {
			DebugLogger.error("Cannot register AdapterNetworkedInventory");
		}
	}
}

Remove accidental dependency on OpenPeripheral

This needs testing


/*
 * Copyright 2016 higherfrequencytrading.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.openhft.chronicle.core.time;

import java.util.concurrent.TimeUnit;

import static net.openhft.chronicle.core.time.SystemTimeProvider.TIME_PROVIDER;

/*
 * Created by Peter Lawrey on 10/03/16.
 */
@FunctionalInterface
public interface TimeProvider {

    static TimeProvider get() {
        return TIME_PROVIDER.get();
    }

    long currentTimeMillis();

    default long currentTimeMicros() {
        return currentTimeMillis() * 1000;
    }

    default long currentTimeNanos() {
        return currentTimeMillis() * 1000000;
    }

    default long currentTime(TimeUnit timeUnit) {
        return timeUnit == TimeUnit.MILLISECONDS
                ? currentTimeMillis()
                : timeUnit.convert(currentTimeNanos(), TimeUnit.NANOSECONDS);
    }
}

/*
 * Copyright 2016 higherfrequencytrading.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.openhft.chronicle.core.time;

import java.util.concurrent.TimeUnit;

import static net.openhft.chronicle.core.time.SystemTimeProvider.TIME_PROVIDER;

/*
 * Created by Peter Lawrey on 10/03/16.
 */
@FunctionalInterface
public interface TimeProvider {

    static TimeProvider get() {
        return TIME_PROVIDER.get();
    }

    long currentTimeMillis();

    default long currentTimeMicros() {
        return currentTimeMillis() * 1000;
    }

    default long currentTimeNanos() {
        return currentTimeMicros() * 1000;
    }

    default long currentTime(TimeUnit timeUnit) {
        switch (timeUnit) {
            case NANOSECONDS:
                return currentTimeNanos();
            case MICROSECONDS:
                return currentTimeMicros();
            case MILLISECONDS:
                return currentTimeMillis();
            default:
                return timeUnit.convert(currentTimeMillis(), TimeUnit.MILLISECONDS);
        }
    }
}

Use the different time units better.

Use the different time units better.


package com.vaguehope.onosendai.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public final class HashHelper {

	private HashHelper () {
		throw new AssertionError();
	}

	public static BigInteger md5String (final String s) {
		final MessageDigest md = MD_MD5_FACTORY.get();
		md.update(s.getBytes(), 0, s.length());
		return new BigInteger(1, md.digest());
	}

	/**
	 * MessageDigest.getInstance("MD5") can take up to a second, so using this
	 * to cache it and improve performance.
	 */
	private static final ThreadLocal<MessageDigest> MD_MD5_FACTORY = new ThreadLocal<MessageDigest>() {
		@Override
		protected MessageDigest initialValue () {
			try {
				final MessageDigest md = MessageDigest.getInstance("MD5");
				md.reset();
				return md;
			}
			catch (final NoSuchAlgorithmException e) {
				throw new RuntimeException(e);
			}
		}
	};

}

package com.vaguehope.onosendai.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public final class HashHelper {

	private HashHelper () {
		throw new AssertionError();
	}

	public static BigInteger md5String (final String s) {
		final MessageDigest md = MD_MD5_FACTORY.get();
		md.update(s.getBytes(), 0, s.length());
		return new BigInteger(1, md.digest());
	}

	/**
	 * MessageDigest.getInstance("MD5") can take up to a second, so using this
	 * to cache it and improve performance.
	 */
	private static final ThreadLocal<MessageDigest> MD_MD5_FACTORY = new ThreadLocal<MessageDigest>() {
		@Override
		protected MessageDigest initialValue () {
			try {
				final MessageDigest md = MessageDigest.getInstance("MD5");
				md.reset();
				return md;
			}
			catch (final NoSuchAlgorithmException e) {
				throw new IllegalStateException("JVM is missing MD5.", e);
			}
		}
	};

}

Fix Avoid Throwing Raw Exception Types.

Fix Avoid Throwing Raw Exception Types.


package esiptestbed.mudrod.metadata.pre;

import java.util.Map;

import esiptestbed.mudrod.discoveryengine.DiscoveryStepAbstract;
import esiptestbed.mudrod.driver.ESDriver;

/**
 * Say sth
 *
 *
 *
 *
 */

public class Example extends DiscoveryStepAbstract {

	public Example(Map<String, String> config, ESDriver es) {
		super(config, es);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void execute() {
		// TODO Auto-generated method stub
		System.out.println("*****************Step 1: Example******************");
		startTime=System.currentTimeMillis();
		es.createBulkProcesser();
        /* Do something */
		//test 1
		es.destroyBulkProcessor();
		endTime=System.currentTimeMillis();
		System.out.println("*****************Example ends******************Took " + (endTime-startTime)/1000+"s");
	}

}

package esiptestbed.mudrod.metadata.pre;

import java.util.Map;

import esiptestbed.mudrod.discoveryengine.DiscoveryStepAbstract;
import esiptestbed.mudrod.driver.ESDriver;

/**
 * Say sth
 *
 *
 *
 *
 */

public class Example extends DiscoveryStepAbstract {

	public Example(Map<String, String> config, ESDriver es) {
		super(config, es);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void execute() {
		// TODO Auto-generated method stub
		System.out.println("*****************Step 1: Example******************");
		startTime=System.currentTimeMillis();
		es.createBulkProcesser();
        /* Do something */

		es.destroyBulkProcessor();
		endTime=System.currentTimeMillis();
		System.out.println("*****************Example ends******************Took " + (endTime-startTime)/1000+"s");
	}

}

Test commint 2 - yun

Test commint 2 - yun


package info.u_team.u_team_test.init;

import info.u_team.u_team_core.util.registry.CommonDeferredRegister;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.entity.BetterEnderPearlEntity;
import net.minecraft.entity.*;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;

public class TestEntityTypes {

	public static final CommonDeferredRegister<EntityType<?>> ENTITY_TYPES = CommonDeferredRegister.create(ForgeRegistries.ENTITIES, TestMod.MODID);

	public static final RegistryObject<EntityType<BetterEnderPearlEntity>> BETTER_ENDERPEARL = ENTITY_TYPES.register("better_enderpearl", () -> EntityType.Builder.<BetterEnderPearlEntity> create(BetterEnderPearlEntity::new, EntityClassification.MISC).size(0.25F, 0.25F).setTrackingRange(128).setUpdateInterval(20).setShouldReceiveVelocityUpdates(true).build(null));

	public static void register(IEventBus bus) {
		ENTITY_TYPES.register(bus);
	}
}

package info.u_team.u_team_test.init;

import info.u_team.u_team_core.util.registry.EntityTypeDeferredRegister;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.entity.BetterEnderPearlEntity;
import net.minecraft.entity.*;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;

public class TestEntityTypes {

	public static final EntityTypeDeferredRegister ENTITY_TYPES = EntityTypeDeferredRegister.create(TestMod.MODID);

	public static final RegistryObject<EntityType<BetterEnderPearlEntity>> BETTER_ENDERPEARL = ENTITY_TYPES.register("better_enderpearl", () -> EntityType.Builder.<BetterEnderPearlEntity> create(BetterEnderPearlEntity::new, EntityClassification.MISC).size(0.25F, 0.25F).setTrackingRange(128).setUpdateInterval(20).setShouldReceiveVelocityUpdates(true));

	public static void register(IEventBus bus) {
		ENTITY_TYPES.register(bus);
	}
}

Use the new system in test entity types

Use the new system in test entity types


package de.retest.recheck.persistence.xml.util;

import javax.xml.bind.Marshaller;

import de.retest.recheck.ui.descriptors.IdentifyingAttributesAdapter;
import de.retest.recheck.ui.descriptors.RenderContainedElementsAdapter;
import de.retest.recheck.ui.descriptors.StateAttributesAdapter;

public class XmlUtil {

	private XmlUtil() {}

	public static String clean( final Object input ) {
		if ( input == null ) {
			return null;
		}
		String result = input.toString().trim();
		result = result.replaceAll( "&", "&" );
		result = result.replaceAll( "<", "<" );
		result = result.replaceAll( ">", ">" );
		result = result.replaceAll( "\"", "'" );
		return result;
	}

	public static void addLightWeightAdapter( final Marshaller marshaller ) {
		marshaller.setAdapter( new RenderContainedElementsAdapter( true ) );
		marshaller.setAdapter( new StateAttributesAdapter( true ) );
		marshaller.setAdapter( new IdentifyingAttributesAdapter( true ) );
	}
}

package de.retest.recheck.persistence.xml.util;

import javax.xml.bind.Marshaller;

import de.retest.recheck.ui.descriptors.IdentifyingAttributesAdapter;
import de.retest.recheck.ui.descriptors.RenderContainedElementsAdapter;
import de.retest.recheck.ui.descriptors.StateAttributesAdapter;

public class XmlUtil {

	private XmlUtil() {}

	public static String clean( final Object input ) {
		if ( input == null ) {
			return null;
		}
		String result = input.toString().trim();
		result = result.replace( "&", "&" );
		result = result.replace( "<", "<" );
		result = result.replace( ">", ">" );
		result = result.replace( "\"", "'" );
		return result;
	}

	public static void addLightWeightAdapter( final Marshaller marshaller ) {
		marshaller.setAdapter( new RenderContainedElementsAdapter( true ) );
		marshaller.setAdapter( new StateAttributesAdapter( true ) );
		marshaller.setAdapter( new IdentifyingAttributesAdapter( true ) );
	}
}

Replace `replaceAll` with `replace` for better perfomance

if the first argument is not a real regular expression, String::replace does exactly the same thing as String::replaceAll without the performance drawback.


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.lang3.concurrent;

/**
 *
Definition of an interface for a wrapper around a calculation that takes a single parameter and returns a result.

 *

 *
This interface allows for wrapping a calculation into a class so that it maybe passed around an application.

 *
 * @param  the type of the input to the calculation
 * @param <O> the type of the output of the calculation
 *
 * @since 3.6
 */
public interface Computable {

    /**
     * This method carries out the given operation with the provided argument.
     *
     * @param arg
     *            the argument for the calculation
     * @return the result of the calculation
     * @throws InterruptedException
     *             thrown if the calculation is interrupted
     */
    O compute(final I arg) throws InterruptedException;
}

Fix javadoc creation on with Java 8

LANG-1314: Fix javadoc creation on with Java 8

Remove </p> tag from Computable's javadoc

The standard javadoc doclet does not allow self closing tags (such as
</p>). This patch removes such a tag from Computable's javadoc, as it's
redundant anyway, as it's only used to create spaces between two
existing paragraphs.


package com.paritytrading.philadelphia.client.command;

import com.paritytrading.philadelphia.client.TerminalClient;
import java.util.Scanner;

class HelpCommand implements Command {

    @Override
    public void execute(TerminalClient client, Scanner arguments) throws CommandException {
        if (arguments.hasNext()) {
            Command command = Commands.find(arguments.next());

            if (arguments.hasNext())
                throw new CommandException();

            if (command != null)
                displayCommandHelp(client, command);
            else
                displayGeneralHelp(client);
        } else {
            displayGeneralHelp(client);
        }
    }

    private void displayGeneralHelp(TerminalClient client) {
        client.printf("Commands:\n");

        int maxCommandNameLength = calculateMaxCommandNameLength();

        for (Command command : Commands.all())
            client.printf("  %-" + maxCommandNameLength + "s  %s\n", command.getName(), command.getDescription());

        client.printf("\nType 'help <command>' for command specific help.\n");
    }

    private void displayCommandHelp(TerminalClient client, Command command) {
        client.printf("Usage: %s\n\n  %s\n\n", command.getUsage(), command.getDescription());
    }

    private int calculateMaxCommandNameLength() {
        return Commands.all().collectInt(c -> c.getName().length()).max();
    }

    @Override
    public String getName() {
        return "help";
    }

    @Override
    public String getDescription() {
        return "Display the help";
    }

    @Override
    public String getUsage() {
        return "help [command]";
    }

}

package com.paritytrading.philadelphia.client.command;

import com.paritytrading.philadelphia.client.TerminalClient;
import java.util.Scanner;

class HelpCommand implements Command {

    @Override
    public void execute(TerminalClient client, Scanner arguments) throws CommandException {
        if (arguments.hasNext()) {
            Command command = Commands.find(arguments.next());

            if (arguments.hasNext())
                throw new CommandException();

            if (command != null)
                displayCommandHelp(client, command);
            else
                displayGeneralHelp(client);
        } else {
            displayGeneralHelp(client);
        }
    }

    private void displayGeneralHelp(TerminalClient client) {
        client.printf("Commands:\n");

        int maxCommandNameLength = calculateMaxCommandNameLength();

        for (Command command : Commands.all())
            client.printf("  %-" + maxCommandNameLength + "s  %s\n", command.getName(), command.getDescription());

        client.printf("\nType 'help <command>' for command specific help.\n");
    }

    private void displayCommandHelp(TerminalClient client, Command command) {
        client.printf("Usage: %s\n\n  %s\n\n", command.getUsage(), command.getDescription());
    }

    private int calculateMaxCommandNameLength() {
        return Commands.names().collectInt(String::length).max();
    }

    @Override
    public String getName() {
        return "help";
    }

    @Override
    public String getDescription() {
        return "Display the help";
    }

    @Override
    public String getUsage() {
        return "help [command]";
    }

}

philadelphia-client: Simplify command name length calculation


package uk.ac.ebi.quickgo.geneproduct.common;

/**
 * Created by rantunes on 11/02/16.
 */
public interface GeneProductRepository {
}

package uk.ac.ebi.quickgo.geneproduct.common;

import uk.ac.ebi.quickgo.geneproduct.common.document.GeneProductDocument;

import java.util.Optional;

/**
 * Gene product repository interface exposing methods for performing searches over its contents.
 * <p>
 * See here how to change:
 * https://github.com/spring-projects/spring-data-solr/blob/master/README.md
 *
 * @author Ricardo Antunes
 */
public interface GeneProductRepository {

    Optional<GeneProductDocument> findById(String id);
}

Add query to do simple lookup by gene product id.