package net.simpvp.NoSpam;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

public class CommandListener implements Listener {

	public CommandListener(NoSpam plugin) {
		plugin.getServer().getPluginManager().registerEvents(this, plugin);
	}

	@EventHandler(priority=EventPriority.LOW, ignoreCancelled=false)
	public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) {

		Player player = event.getPlayer();

		String message = event.getMessage();

		/* Important: The spaces afterwards are necessary. Otherwise we get something like this being activated on /world because of /w */
		if (message.startsWith("/tell ")
				|| message.startsWith("/me ")
				|| message.startsWith("/msg ")
				|| message.startsWith("/w ")
				|| message.startsWith("/op ")) {

			boolean cancel = SpamHandler.isSpamming(player); // The Handler class checks if it's spam

			if ( cancel ) event.setCancelled(true);

				}

	}

}

package net.simpvp.NoSpam;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

public class CommandListener implements Listener {

	public CommandListener(NoSpam plugin) {
		plugin.getServer().getPluginManager().registerEvents(this, plugin);
	}

	@EventHandler(priority=EventPriority.LOW, ignoreCancelled=false)
	public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) {

		Player player = event.getPlayer();

		String message = event.getMessage().toLowerCase();

		/* Important: The spaces afterwards are necessary. Otherwise we get something like this being activated on /world because of /w */
		if (message.startsWith("/tell ")
				|| message.startsWith("/me ")
				|| message.startsWith("/msg ")
				|| message.startsWith("/w ")
				|| message.startsWith("/op ")
				|| message.equals("/op")) {

			boolean cancel = SpamHandler.isSpamming(player); // The Handler class checks if it's spam

			if ( cancel ) event.setCancelled(true);

		}

	}

}

Update list of blocked commands


/*
 * 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 com.hp.hpl.jena.tdb.nodetable;

public class NodeTableReadonly extends NodeTableWrapper
{
    public NodeTableReadonly(NodeTable nodeTable)
    {
        super(nodeTable) ;
    }

}

/*
 * 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 com.hp.hpl.jena.tdb.nodetable;

import com.hp.hpl.jena.graph.Node ;
import com.hp.hpl.jena.tdb.TDBException ;
import com.hp.hpl.jena.tdb.store.NodeId ;

public class NodeTableReadonly extends NodeTableWrapper
{
    public NodeTableReadonly(NodeTable nodeTable)
    {
        super(nodeTable) ;
    }

    @Override
    public NodeId getAllocateNodeId(Node node)
    {
        NodeId nodeId = getNodeIdForNode(node) ;
        if ( NodeId.isDoesNotExist(nodeId) )
            throw new TDBException("Allocation attempt on NodeTableReadonly") ;
        return nodeId ;
    }
}

Make a read-only node table check it is used read-only.


package net.kencochrane.raven.log4j;

import net.kencochrane.raven.stub.SentryStub;
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class SentryAppenderIT {
    private static final Logger logger = Logger.getLogger(SentryAppenderIT.class);
    private SentryStub sentryStub;

    @Before
    public void setUp() {
        sentryStub = new SentryStub();
        sentryStub.removeEvents();
    }

    @After
    public void tearDown() {
        sentryStub.removeEvents();
    }

    @Test
    public void testInfoLog() {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.info("This is a test");
        assertThat(sentryStub.getEventCount(), is(1));
    }

    @Test
    public void testChainedExceptions() {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.error("This is an exception",
                new UnsupportedOperationException("Test", new UnsupportedOperationException()));
        assertThat(sentryStub.getEventCount(), is(1));
    }
}

package net.kencochrane.raven.log4j;

import net.kencochrane.raven.stub.SentryStub;
import org.apache.log4j.Logger;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class SentryAppenderIT {
    private static final Logger logger = Logger.getLogger(SentryAppenderIT.class);
    private SentryStub sentryStub = new SentryStub();

    @AfterMethod
    public void tearDown() {
        sentryStub.removeEvents();
    }

    @Test
    public void testInfoLog() {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.info("This is a test");
        assertThat(sentryStub.getEventCount(), is(1));
    }

    @Test
    public void testChainedExceptions() {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.error("This is an exception",
                new UnsupportedOperationException("Test", new UnsupportedOperationException()));
        assertThat(sentryStub.getEventCount(), is(1));
    }
}

Move from junit to testng for integration tests


package org.pitest.cucumber;

import org.pitest.junit.CompoundTestUnitFinder;
import org.pitest.junit.JUnitCompatibleConfiguration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.Log;

import java.util.List;

import static java.util.Arrays.asList;

public class CucumberJUnitCompatibleConfiguration extends JUnitCompatibleConfiguration {

    public CucumberJUnitCompatibleConfiguration(TestGroupConfig config) {
        super(config);
    }

    @Override
    public TestUnitFinder testUnitFinder() {
        final TestUnitFinder finder;
        if (isCucumberUsed()) {
            Log.getLogger().info("Cucumber detected, scenarios will be used");
            List<TestUnitFinder> finders
                    = asList(new CucumberTestUnitFinder(), super.testUnitFinder());
            finder = new CompoundTestUnitFinder(finders);
        } else {
            Log.getLogger().info("Cucumber not used in this project");
            finder = super.testUnitFinder();
        }
        return finder;
    }

    private boolean isCucumberUsed() {
        boolean result = false;
        try {
            Class.forName("cucumber.api.junit.Cucumber");
            result = true;
        } catch (ClassNotFoundException e) {
        }
        return result;
    }
}

package org.pitest.cucumber;

import org.pitest.junit.CompoundTestUnitFinder;
import org.pitest.junit.JUnitCompatibleConfiguration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.Log;

import java.util.List;

import static java.util.Arrays.asList;

public class CucumberJUnitCompatibleConfiguration extends JUnitCompatibleConfiguration {

    public CucumberJUnitCompatibleConfiguration(TestGroupConfig config) {
        super(config);
    }

    @Override
    public TestUnitFinder testUnitFinder() {
        final TestUnitFinder finder;
        if (isCucumberUsed()) {
            Log.getLogger().fine("Cucumber detected, scenarios will be used");
            List<TestUnitFinder> finders
                    = asList(new CucumberTestUnitFinder(), super.testUnitFinder());
            finder = new CompoundTestUnitFinder(finders);
        } else {
            Log.getLogger().fine("Cucumber not used in this project");
            finder = super.testUnitFinder();
        }
        return finder;
    }

    private boolean isCucumberUsed() {
        boolean result = false;
        try {
            Class.forName("cucumber.api.junit.Cucumber");
            result = true;
        } catch (ClassNotFoundException e) {
        }
        return result;
    }
}

Reduce log level to avoid log polution


public class Sort {
	public enum DIRECTION {ASCENDING,DESCENDING};

	public void sort(Table _targetTable, DIRECTION d) {

	}
}

Revert "Started the sort method"


/**
 * Copyright 2015 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * 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.palantir.atlasdb.config;

import java.io.File;
import java.io.IOException;

import javax.annotation.Nullable;

public final class AtlasDbConfigs {
    public static final String ATLASDB_CONFIG_ROOT = "/atlasdb";

    private AtlasDbConfigs() {
        // uninstantiable
    }

    public static AtlasDbConfig load(File configFile) throws IOException {
        return load(configFile, ATLASDB_CONFIG_ROOT);
    }

    public static AtlasDbConfig load(File configFile, @Nullable String configRoot) throws IOException {
        ConfigFinder finder = new ConfigFinder(configRoot);
        return finder.getConfig(configFile);
    }

    public static AtlasDbConfig loadFromString(String fileContents, @Nullable String configRoot) throws IOException {
        ConfigFinder finder = new ConfigFinder(configRoot);
        return finder.getConfig(fileContents);
    }
}

/**
 * Copyright 2015 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * 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.palantir.atlasdb.config;

import java.io.File;
import java.io.IOException;

import com.fasterxml.jackson.databind.JsonNode;

public final class AtlasDbConfigs {
    public static final String ATLASDB_CONFIG_ROOT = "/atlasdb";

    private AtlasDbConfigs() {
        // uninstantiable
    }

    public static AtlasDbConfig load(File configFile) throws IOException {
        return load(configFile, ATLASDB_CONFIG_ROOT);
    }

    public static AtlasDbConfig load(File configFile, String configRoot) throws IOException {
        ConfigFinder finder = new ConfigFinder(configRoot);
        return finder.getConfig(configFile);
    }

    public static AtlasDbConfig loadFromString(String fileContents, String configRoot) throws IOException {
        ConfigFinder finder = new ConfigFinder(configRoot);
        return finder.getConfig(fileContents);
    }
}

Revert "Update nullables and unused import"


public class Tuple implements Comparable<Tuple> {
	private String contents;
	public Tuple(String contents) {
		this.contents = contents;
	}
	public String toString() {
		return "TUPLE {" + contents + "}";
	}
	public boolean equals(Object o) {
		return contents.equals(((Tuple)o).contents);
	}
	@Override
	public int compareTo(Tuple o) {
		return contents.compareTo(o.contents);
	}
	public int hashCode() {
		return contents.hashCode();
	}
}

public class Tuple implements Comparable<Tuple> {
	private String contents;

	public Tuple(String contents) {
		this.contents = contents;
	}

	@Override
	public String toString() {
		return "TUPLE {" + contents + "}";
	}

	@Override
	public boolean equals(Object o) {
		return contents.equals(((Tuple) o).contents);
	}

	@Override
	public int compareTo(Tuple o) {
		return contents.compareTo(o.contents);
	}

	@Override
	public int hashCode() {
		return contents.hashCode();
	}
}

Tweak formatting and add @OverrideS.


/**
 * Abstract Syntax Tree for JUnit.
 *
 * <pre>
 * CompilationUnit ::= ClassDecl
 *
 * ClassDecl ::= TestMethod*
 *
 * TestMethod ::= Binding* TestStateMent*
 *
 * TestStatement ::= IsStatement
 *                 | IsNotStatement
 *                 | ThrowsStatement
 * </pre>
 *
 */
package yokohama.unit.ast_junit;

/**
 * Abstract Syntax Tree for JUnit.
 *
 * <pre>
 * CompilationUnit ::= ClassDecl
 *
 * ClassDecl ::= TestMethod*
 *
 * TestMethod ::= Binding* ActionStatement* TestStateMent* ActionStatement*
 *
 * TestStatement ::= IsStatement
 *                 | IsNotStatement
 *                 | ThrowsStatement
 * </pre>
 *
 */
package yokohama.unit.ast_junit;

Change BNF description for JUnit AST


/*-------------------------------------------------------------------------
*
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
*   $PostgreSQL: pgjdbc/org/postgresql/util/PSQLDriverVersion.java,v 1.20 2006/12/01 12:02:39 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 static int buildNumber = 600;

    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.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);
    }

}

Prepare for release for 8.3dev-601.


package in.co.nebulax.magpie;

public class Constants {

	// url to get data JSON
	public static String url = "http://10.0.2.2:1111/all";

	//JSON Node Names
	public static String TAG_DATA = "data";
	public static String TAG_DEVICE = "device";
	public static String TAG_STATUS = "status";
	public static String TAG_NAME = "name";
}

package in.co.nebulax.magpie;

public class Constants {

	// url to get data JSON
	public static String urlGet = "http://10.0.2.2:1111/all";
	public static String urlPost = "http://10.0.2.2:1111/change";

	//JSON Node Names
	public static String TAG_DATA = "data";
	public static String TAG_DEVICE = "device";
	public static String TAG_STATUS = "status";
	public static String TAG_NAME = "name";
}

Add url for post request


package org.fest.assertions.api.android;

import java.util.List;

public final class Utils {
  public static String join(List<String> parts) {
    StringBuilder builder = new StringBuilder();
    for (String part : parts) {
      if (builder.length() > 0) {
        builder.append(", ");
      }
      builder.append(part);
    }
    return builder.toString();
  }

  private Utils() {
    // No instances.
  }
}

package org.fest.assertions.api.android;

import android.text.TextUtils;
import java.util.List;

public final class Utils {
  public static String join(List<String> parts) {
    return TextUtils.join(", ", parts);
  }

  private Utils() {
    // No instances.
  }
}

Change custom String joiner to use framework one.


package org.aikodi.chameleon.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * A debugging class that stores the current stacktrace.
 *
 * @author Marko van Dooren
 */
public class CreationStackTrace {

	private StackTraceElement[] _stackTrace;

	public List<StackTraceElement> trace() {
		return new ArrayList<StackTraceElement>(Arrays.asList(_stackTrace));
	}

	public CreationStackTrace() {
		try {
			throw new Exception();
		} catch (Exception e) {
			_stackTrace = e.getStackTrace();
		}
	}

}

package org.aikodi.chameleon.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * A debugging class that stores the current stacktrace.
 *
 * @author Marko van Dooren
 */
public class CreationStackTrace {

	private List<StackTraceElement> _stackTrace;

	public List<StackTraceElement> trace() {
		return new ArrayList<StackTraceElement>(_stackTrace);
	}

	public CreationStackTrace() {
		try {
			throw new Exception();
		} catch (Exception e) {
			_stackTrace = Arrays.asList(e.getStackTrace());
		}
	}

  public CreationStackTrace(int size) {
    try {
      throw new Exception();
    } catch (Exception e) {
      _stackTrace = Arrays.asList(e.getStackTrace()).subList(0, size);
    }
  }
}

Allow taking a limited snapshot of the full trace


/**
 * Copyright (c) 2012-2013 André Bargull
 * Alle Rechte vorbehalten / All Rights Reserved.  Use is subject to license terms.
 *
 * <https://github.com/anba/es6draft>
 */
package com.github.anba.es6draft.runtime.internal;

import com.github.anba.es6draft.runtime.ExecutionContext;

/**
 * Base class for internal exceptions
 */
@SuppressWarnings("serial")
public abstract class InternalException extends java.lang.RuntimeException {
    /**
     * {@inheritDoc}
     */
    public InternalException() {
        super();
    }

    /**
     * {@inheritDoc}
     */
    public InternalException(String message) {
        super(message);
    }

    /**
     * {@inheritDoc}
     */
    public InternalException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * {@inheritDoc}
     */
    public InternalException(Throwable cause) {
        super(cause);
    }

    /**
     * {@inheritDoc}
     */
    protected InternalException(String message, Throwable cause, boolean enableSuppression,
            boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    /**
     * Returns a {@link ScriptException} for this exception object
     */
    public abstract ScriptException toScriptException(ExecutionContext cx);
}

/**
 * Copyright (c) 2012-2013 André Bargull
 * Alle Rechte vorbehalten / All Rights Reserved.  Use is subject to license terms.
 *
 * <https://github.com/anba/es6draft>
 */
package com.github.anba.es6draft.runtime.internal;

import com.github.anba.es6draft.runtime.ExecutionContext;

/**
 * Base class for internal exceptions
 */
@SuppressWarnings("serial")
public abstract class InternalException extends RuntimeException {
    /**
     * {@inheritDoc}
     */
    public InternalException() {
        super();
    }

    /**
     * {@inheritDoc}
     */
    public InternalException(String message) {
        super(message);
    }

    /**
     * {@inheritDoc}
     */
    public InternalException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * {@inheritDoc}
     */
    public InternalException(Throwable cause) {
        super(cause);
    }

    /**
     * {@inheritDoc}
     */
    protected InternalException(String message, Throwable cause, boolean enableSuppression,
            boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    /**
     * Returns a {@link ScriptException} for this exception object
     */
    public abstract ScriptException toScriptException(ExecutionContext cx);
}

Remove unnecessary complete class name


package com.tinkerpop.gremlin.structure;

import java.io.Serializable;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class MockSerializable implements Serializable {
    private String testField;

    public MockSerializable(final String testField) {
        this.testField = testField;
    }

    public String getTestField() {
        return this.testField;
    }

    public void setTestField(final String testField) {
        this.testField = testField;
    }

    @Override
    public boolean equals(Object oth) {
        if (this == oth) return true;
        else if (oth == null) return false;
        else if (!getClass().isInstance(oth)) return false;
        MockSerializable m = (MockSerializable) oth;
        if (testField == null) {
            return (m.testField == null);
        } else return testField.equals(m.testField);
    }
}

package com.tinkerpop.gremlin.structure;

import java.io.Serializable;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class MockSerializable implements Serializable {
    private String testField;

    private MockSerializable() {}

    public MockSerializable(final String testField) {
        this.testField = testField;
    }

    public String getTestField() {
        return this.testField;
    }

    public void setTestField(final String testField) {
        this.testField = testField;
    }

    @Override
    public boolean equals(Object oth) {
        if (this == oth) return true;
        else if (oth == null) return false;
        else if (!getClass().isInstance(oth)) return false;
        MockSerializable m = (MockSerializable) oth;
        if (testField == null) {
            return (m.testField == null);
        } else return testField.equals(m.testField);
    }
}

Add private constructor to mockserializable.


package com.lyubenblagoev.postfixrest.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CorsConfiguration {

    @Bean
    WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/api/v1/**");
            }
        };
    }
}

package com.lyubenblagoev.postfixrest.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CorsConfiguration {

    @Bean
    WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/api/v1/**")
                        .allowedMethods("*")
                        .allowedOrigins("*");
            }
        };
    }
}

Improve CORS configuration to allow all methods and origins


package jp.ne.opt.redshiftfake.views;

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

/**
 * Created by ffarrell on 14/06/2018.
 *
 * Some system tables that exist in redshift do not necessarily exist in postgres
 *
 * This creates pg_tableef as a view on each connection if it does not exist
 */
public class SystemViews {

    private static final String createPgTableDefView =
            "CREATE VIEW pg_table_def (schemaname, tablename, \"column\", \"type\", \"encoding\", distkey, sortkey, \"notnull\") " +
                    "AS SELECT table_schema, table_name, column_name, data_type, 'none', false, 0, CASE is_nullable WHEN 'yes' THEN false ELSE true END " +
                    "FROM information_schema.columns;";

    public static void create(final Connection connection) throws SQLException {

        final ResultSet resultSet = connection.createStatement().executeQuery("SELECT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'pg_tab_def')");

        if(resultSet.next() && !resultSet.getBoolean(1)){
            connection.createStatement().execute(createPgTableDefView);
        }
    }

}

package jp.ne.opt.redshiftfake.views;

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

/**
 * Created by frankfarrell on 14/06/2018.
 *
 * Some system tables that exist in redshift do not necessarily exist in postgres
 *
 * This creates pg_tableef as a view on each connection if it does not exist
 */
public class SystemViews {

    private static final String pgTableDefExistsQuery =
            "SELECT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'pg_table_def')";
    private static final String createPgTableDefView =
            "CREATE VIEW pg_table_def (schemaname, tablename, \"column\", \"type\", \"encoding\", distkey, sortkey, \"notnull\") " +
                    "AS SELECT table_schema, table_name, column_name, data_type, 'none', false, 0, CASE is_nullable WHEN 'yes' THEN false ELSE true END " +
                    "FROM information_schema.columns;";

    public static void create(final Connection connection) throws SQLException {

        final ResultSet resultSet = connection.createStatement().executeQuery(pgTableDefExistsQuery);

        if(resultSet.next() && !resultSet.getBoolean(1)){
            connection.createStatement().execute(createPgTableDefView);
        }
    }

}

Correct typo in pg_table_def create view query


package jp.ne.opt.redshiftfake.views;

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

/**
 * Created by ffarrell on 14/06/2018.
 *
 * Some system tables that exist in redshift do not necessarily exist in postgres
 *
 * This creates pg_tableef as a view on each connection if it does not exist
 */
public class SystemViews {

    private static final String createPgTableDefView =
            "CREATE VIEW pg_table_def (schemaname, tablename, \"column\", \"type\", \"encoding\", distkey, sortkey, \"notnull\") " +
                    "AS SELECT table_schema, table_name, column_name, data_type, 'none', false, 0, CASE is_nullable WHEN 'yes' THEN false ELSE true END " +
                    "FROM information_schema.columns;";

    public static void create(final Connection connection) throws SQLException {

        final ResultSet resultSet = connection.createStatement().executeQuery("SELECT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'pg_tab_def')");

        resultSet.first();
        if(!resultSet.getBoolean(1)){
            connection.createStatement().execute(createPgTableDefView);
        }
    }

}

package jp.ne.opt.redshiftfake.views;

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

/**
 * Created by ffarrell on 14/06/2018.
 *
 * Some system tables that exist in redshift do not necessarily exist in postgres
 *
 * This creates pg_tableef as a view on each connection if it does not exist
 */
public class SystemViews {

    private static final String createPgTableDefView =
            "CREATE VIEW pg_table_def (schemaname, tablename, \"column\", \"type\", \"encoding\", distkey, sortkey, \"notnull\") " +
                    "AS SELECT table_schema, table_name, column_name, data_type, 'none', false, 0, CASE is_nullable WHEN 'yes' THEN false ELSE true END " +
                    "FROM information_schema.columns;";

    public static void create(final Connection connection) throws SQLException {

        final ResultSet resultSet = connection.createStatement().executeQuery("SELECT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'pg_tab_def')");

        if(resultSet.next() && !resultSet.getBoolean(1)){
            connection.createStatement().execute(createPgTableDefView);
        }
    }

}

Fix issue with FORWARD_ONLY resultSets


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;
}

package jkind;

public class JKindSettings extends Settings {
	public int n = Integer.MAX_VALUE;
	public int timeout = Integer.MAX_VALUE;

	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 timeout and depth to be effectively unbounded by default


package rs.pelotas.tracker.core;

import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.ws.rs.ApplicationPath;
import rs.pelotas.arch.batch.JobScheduler;
import rs.pelotas.arch.core.BaseApplication;
import rs.pelotas.tracker.batch.PositionJob;

/**
 *
 * @author Rafael Guterres
 */
@ApplicationPath("/api")
public class Application extends BaseApplication {

    @Inject
    JobScheduler scheduler;

    @Inject
    Logger logger;

    @Override
    public JobScheduler getScheduler() {
        return scheduler;
    }

    @Override
    public Logger getLogger() {
        return logger;
    }

    @PostConstruct
    @Override
    protected void init() {
        //TODO: implementar annotation para agendamento automatico
        scheduler.addJob(new PositionJob());
        scheduler.scheduleJobs();
    }
}

package rs.pelotas.tracker.core;

import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.ws.rs.ApplicationPath;
import rs.pelotas.arch.batch.JobScheduler;
import rs.pelotas.arch.core.BaseApplication;
import rs.pelotas.tracker.batch.PositionJob;

/**
 *
 * @author Rafael Guterres
 */
@ApplicationPath("/api")
public class Application extends BaseApplication {

    @Inject
    JobScheduler scheduler;

    @Inject
    Logger logger;

    @Override
    public JobScheduler getScheduler() {
        return scheduler;
    }

    @Override
    public Logger getLogger() {
        return logger;
    }

    @PostConstruct
    @Override
    protected void init() {
        //TODO: implementar annotation para agendamento automatico
        //scheduler.addJob(new PositionJob());
        //scheduler.scheduleJobs();
    }
}

FIX to Exception in thread "hornetq-expiry-reaper-thread" java.lang.OutOfMemoryError: unable to create new native thread


package jenkins.advancedqueue;

import hudson.Plugin;
import hudson.model.Job;
import hudson.model.Queue;
import jenkins.advancedqueue.sorter.ItemInfo;
import jenkins.advancedqueue.sorter.QueueItemCache;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;

class PriorityConfigurationPlaceholderTaskHelper {

    boolean isPlaceholderTask(Queue.Task task) {
        return isPlaceholderTaskUsed() && task instanceof  ExecutorStepExecution.PlaceholderTask;
    }

    PriorityConfigurationCallback getPriority(ExecutorStepExecution.PlaceholderTask task, PriorityConfigurationCallback priorityCallback) {
        Job<?, ?> job = (Job<?, ?>) task.getOwnerTask();
        ItemInfo itemInfo = QueueItemCache.get().getItem(job.getName());
        itemInfo.getPriority();
        priorityCallback.setPrioritySelection(itemInfo.getPriority());
        return priorityCallback;
    }

    static boolean isPlaceholderTaskUsed() {
        Plugin plugin = Jenkins.getInstance().getPlugin("workflow-durable-task-step");
        return plugin != null && plugin.getWrapper().isActive();
    }

}

package jenkins.advancedqueue;

import hudson.Plugin;
import hudson.model.Job;
import hudson.model.Queue;
import jenkins.advancedqueue.sorter.ItemInfo;
import jenkins.advancedqueue.sorter.QueueItemCache;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;

class PriorityConfigurationPlaceholderTaskHelper {

	boolean isPlaceholderTask(Queue.Task task) {
		return isPlaceholderTaskUsed() && task instanceof ExecutorStepExecution.PlaceholderTask;
	}

	PriorityConfigurationCallback getPriority(ExecutorStepExecution.PlaceholderTask task,
			PriorityConfigurationCallback priorityCallback) {
		Job<?, ?> job = (Job<?, ?>) task.getOwnerTask();
		ItemInfo itemInfo = QueueItemCache.get().getItem(job.getName());

		// Can be null if job didn't run yet

		if (itemInfo != null) {
			priorityCallback.setPrioritySelection(itemInfo.getPriority());
		} else {
			priorityCallback.setPrioritySelection(PrioritySorterConfiguration.get().getStrategy().getDefaultPriority());
		}

		return priorityCallback;
	}

	static boolean isPlaceholderTaskUsed() {
		Plugin plugin = Jenkins.getInstance().getPlugin("workflow-durable-task-step");
		return plugin != null && plugin.getWrapper().isActive();
	}

}

Fix upstream job priority retrieval


package controllers;

import play.db.jpa.JPA;
import play.db.jpa.Transactional;
import play.mvc.Result;

import java.io.IOException;

import static play.mvc.Results.ok;

public class File {
    @Transactional
    public Result get(Long id) {
        models.FileMeta fileMeta = JPA.em().find(models.FileMeta.class, id);
        java.io.File file = models.FileManager.getFile(fileMeta);
        return ok(file).as(fileMeta.getMimeType());
    }

    @Transactional
    public Result getPreview(Long id) throws IOException {
        models.FileMeta fileMeta = JPA.em().find(models.FileMeta.class, id);
        java.io.File file = models.FileManager.getThumbnail(fileMeta);
        return ok(file).as(fileMeta.getMimeType());
    }
}

package controllers;

import play.db.jpa.JPA;
import play.db.jpa.Transactional;
import play.mvc.Result;

import java.io.IOException;

import static play.mvc.Results.ok;

public class File {
    @Transactional
    public Result get(Long id) {
        models.FileMeta fileMeta = JPA.em().find(models.FileMeta.class, id);
        java.io.File file = models.FileManager.getFile(fileMeta);
        return ok(file).as(fileMeta.getMimeType());
    }

    @Transactional
    public Result getPreview(Long id) throws IOException {
        models.FileMeta fileMeta = JPA.em().find(models.FileMeta.class, id);
        java.io.File file = models.FileManager.getThumbnail(fileMeta);
        return ok(file);
    }
}

Fix wrong Content-Type header in /file/min/


/**
 * Copyright (C) 2011-2020 Red Hat, Inc. (https://github.com/Commonjava/indy)
 *
 * 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.
 */
import javax.enterprise.context.ApplicationScoped;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@ApplicationScoped
public class SlashTolerationFilter
        implements Filter
{
    @Override
    public void init( final FilterConfig filterConfig )
                    throws ServletException
    {
    }

    @Override
    public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain )
            throws IOException, ServletException
    {
        final HttpServletRequest hsr = (HttpServletRequest) servletRequest;
        String newURI = hsr.getRequestURI().replaceAll( "/+", "/" );
        servletRequest.getRequestDispatcher(newURI).forward(servletRequest, servletResponse);
    }

    @Override
    public void destroy()
    {
    }

}

/**
 * Copyright (C) 2011-2020 Red Hat, Inc. (https://github.com/Commonjava/indy)
 *
 * 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.commonjava.indy.bind.jaxrs;

import javax.enterprise.context.ApplicationScoped;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@ApplicationScoped
public class SlashTolerationFilter
        implements Filter
{
    @Override
    public void init( final FilterConfig filterConfig )
                    throws ServletException
    {
    }

    @Override
    public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain )
            throws IOException, ServletException
    {
        final HttpServletRequest hsr = (HttpServletRequest) servletRequest;
        String newURI = hsr.getRequestURI().replaceAll( "/+", "/" );
        servletRequest.getRequestDispatcher(newURI).forward(servletRequest, servletResponse);
    }

    @Override
    public void destroy()
    {
    }

}

Fix a wrong line problem


package me.eddiep.minecraft.ls.game.shop.impl;

import me.eddiep.minecraft.ls.Lavasurvival;
import me.eddiep.minecraft.ls.game.shop.Shop;
import me.eddiep.minecraft.ls.game.shop.ShopManager;
import me.eddiep.minecraft.ls.ranks.UserInfo;
import me.eddiep.minecraft.ls.ranks.UserManager;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;

public class BankShopManager implements ShopManager {
    @Override
    public void shopClicked(Player owner, Shop shop) {
        UserManager um = Lavasurvival.INSTANCE.getUserManager();

        UserInfo user = um.getUser(owner.getUniqueId());

        Inventory bankInventory = user.createBankInventory();

        owner.openInventory(bankInventory);
    }

    @Override
    public boolean isShopInventory(Inventory inventory, Player owner) {
        return inventory.getTitle().equals("Bank");
    }

    @Override
    public void shopClosed(Player owner, Inventory inventory, Shop shop) {
        if (inventory.contains(shop.getOpener())) {
            inventory.remove(shop.getOpener());
            inventory.setItem(inventory.firstEmpty(), shop.getOpener());
        }

        UserManager um = Lavasurvival.INSTANCE.getUserManager();

        UserInfo user = um.getUser(owner.getUniqueId());

        user.saveBank(inventory);
    }
}

package me.eddiep.minecraft.ls.game.shop.impl;

import me.eddiep.minecraft.ls.Lavasurvival;
import me.eddiep.minecraft.ls.game.shop.Shop;
import me.eddiep.minecraft.ls.game.shop.ShopManager;
import me.eddiep.minecraft.ls.ranks.UserInfo;
import me.eddiep.minecraft.ls.ranks.UserManager;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;

public class BankShopManager implements ShopManager {
    @Override
    public void shopClicked(Player owner, Shop shop) {
        UserManager um = Lavasurvival.INSTANCE.getUserManager();

        UserInfo user = um.getUser(owner.getUniqueId());

        Inventory bankInventory = user.createBankInventory();

        owner.openInventory(bankInventory);
    }

    @Override
    public boolean isShopInventory(Inventory inventory, Player owner) {
        return inventory.getTitle().equals("Bank");
    }

    @Override
    public void shopClosed(Player owner, Inventory inventory, Shop shop) {
        if (inventory.contains(shop.getOpener())) {
            inventory.remove(shop.getOpener());
            inventory.setItem(owner.getInventory().firstEmpty(), shop.getOpener());
        }

        UserManager um = Lavasurvival.INSTANCE.getUserManager();

        UserInfo user = um.getUser(owner.getUniqueId());

        user.saveBank(inventory);
    }
}

Fix being able to put bank item in bank


package org.pdxfinder.rdbms.repositories;

import org.pdxfinder.rdbms.dao.MappingEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface MappingEntityRepository extends JpaRepository<MappingEntity, Long> {

    MappingEntity findByMappingKey(String mappingKey);

    List<MappingEntity> findByMappedTermLabel(String mappedTermLabel);
}

package org.pdxfinder.rdbms.repositories;

import org.pdxfinder.rdbms.dao.MappingEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by abayomi on 25/07/2019.
 */
@Repository
public interface MappingEntityRepository extends JpaRepository<MappingEntity, Long> {

    MappingEntity findByMappingKey(String mappingKey);

    List<MappingEntity> findByMappedTermLabel(String mappedTermLabel);

    @Query(value = "Select distinct me from MappingEntity me JOIN me.mappingValues mv " +
            "WHERE ((lower(me.entityType) = lower(:entityType)) OR :entityType = '') "+
            "AND ((KEY(mv) = :mappingLabel AND mv = :mappingValue) OR  :mappingValue = '') "
    )
    Page<MappingEntity> findByMultipleFilters(@Param("entityType") String entityType,

                                              @Param("mappingLabel") String mappingLabel,
                                              @Param("mappingValue") String mappingValue,

                                              Pageable pageable);

    @Query(value = "select me from MappingEntity me JOIN me.mappingValues mv WHERE KEY(mv) = :dataKey AND mv = :dataValue ")
    List<MappingEntity> findByAttributeAndValue(@Param("dataKey") String dataKey,
                                                @Param("dataValue") String dataValue);

}

Create Search Filter for the Persisted Mapping Entities


package org.adaptlab.chpir.android.participanttracker.validators;

/**
 * Created by mn127 on 3/3/15.
 */
public class CaregiverIdValidator extends ParticipantIdValidator {

    @Override
    public boolean validate(String value) {
        if (value.length() > 0) {
            return value.charAt(0) == 'E' && super.validate(value);
        }

        return false;
    }
}

package org.adaptlab.chpir.android.participanttracker.validators;

public class CaregiverIdValidator extends ParticipantIdValidator {

    @Override
    public boolean validate(String value) {
        if (value.length() > 0) {
            return value.charAt(0) == 'E' && super.validate(value);
        }

        return false;
    }
}

Clean up comments for caregiver id validator


package tars.testutil;

import tars.model.task.*;
import tars.model.tag.UniqueTagList;

/**
 * A mutable task object. For testing only.
 */
public class TestTask implements ReadOnlyTask {

    private Name name;
    private UniqueTagList tags;
    private DateTime dateTime;
    private Status status;
    private Priority priority;

    public TestTask() {
        tags = new UniqueTagList();
    }

    public void setName(Name name) {
        this.name = name;
    }

    @Override
    public Name getName() {
        return name;
    }

    @Override
    public DateTime getDateTime() {
        return dateTime;
    }

    @Override
    public Status getStatus() {
        return status;
    }

    @Override
    public Priority getPriority() {
        return priority;
    }

    @Override
    public UniqueTagList getTags() {
        return tags;
    }

    @Override
    public String toString() {
        return getAsText();
    }

    public String getAddCommand() {
        StringBuilder sb = new StringBuilder();
        sb.append("add " + this.getName().taskName + " ");
        sb.append("-dt " + this.getDateTime().toString() + " ");
        sb.append("-p " + this.getPriority().toString() + " ");
        this.getTags().getInternalList().stream().forEach(s -> sb.append("t/" + s.tagName + " "));
        return sb.toString();
    }
}

package tars.testutil;

import tars.model.task.*;
import tars.model.tag.UniqueTagList;

/**
 * A mutable task object. For testing only.
 */
public class TestTask implements ReadOnlyTask {

    private Name name;
    private UniqueTagList tags;
    private DateTime dateTime;
    private Status status;
    private Priority priority;

    public TestTask() {
        tags = new UniqueTagList();
    }

    public void setName(Name name) {
        this.name = name;
    }

    public void setDateTime(DateTime dateTime) {
        this.dateTime = dateTime;
    }

    public void setPriority(Priority priority) {
        this.priority = priority;
    }

    @Override
    public Name getName() {
        return name;
    }

    @Override
    public DateTime getDateTime() {
        return dateTime;
    }

    @Override
    public Status getStatus() {
        return status;
    }

    @Override
    public Priority getPriority() {
        return priority;
    }

    @Override
    public UniqueTagList getTags() {
        return tags;
    }

    @Override
    public String toString() {
        return getAsText();
    }

    public String getAddCommand() {
        StringBuilder sb = new StringBuilder();
        sb.append("add " + this.getName().taskName + " ");
        sb.append("-dt " + this.getDateTime().toString() + " ");
        sb.append("-p " + this.getPriority().toString() + " ");
        this.getTags().getInternalList().stream().forEach(s -> sb.append("t/" + s.tagName + " "));
        return sb.toString();
    }
}

Add setDateTime(DateTime) and setPriority(Priority) methods


package org.alien4cloud.tosca.model.instances;

import com.google.common.collect.Maps;
import lombok.Getter;
import lombok.Setter;
import org.alien4cloud.tosca.model.CSARDependency;
import org.alien4cloud.tosca.model.templates.NodeTemplate;
import org.elasticsearch.annotation.NestedObject;
import org.elasticsearch.annotation.ObjectField;
import org.elasticsearch.annotation.StringField;
import org.elasticsearch.annotation.query.FetchContext;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.mapping.IndexType;

import java.util.Map;

import static alien4cloud.dao.model.FetchContext.SUMMARY;

/**
 * An instance of a node.
 */
@Getter
@Setter
public class NodeInstance {
    // The node template actually does not include the type version (maybe we should add that to the node template ?).
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String typeVersion;

    @ObjectField
    private NodeTemplate nodeTemplate;

    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private Map<String, String> attributeValues = Maps.newHashMap();

    public void setAttribute(String key, String value) {
        attributeValues.put(key, value);
    }
}

package org.alien4cloud.tosca.model.instances;

import com.google.common.collect.Maps;
import lombok.Getter;
import lombok.Setter;
import org.alien4cloud.tosca.model.CSARDependency;
import org.alien4cloud.tosca.model.templates.NodeTemplate;
import org.elasticsearch.annotation.NestedObject;
import org.elasticsearch.annotation.ObjectField;
import org.elasticsearch.annotation.StringField;
import org.elasticsearch.annotation.query.FetchContext;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.mapping.IndexType;

import java.util.Map;

import static alien4cloud.dao.model.FetchContext.SUMMARY;

/**
 * An instance of a node.
 */
@Getter
@Setter
public class NodeInstance {
    // The node template actually does not include the type version (maybe we should add that to the node template ?).
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String typeVersion;

    @ObjectField
    private NodeTemplate nodeTemplate;

    @ObjectField(enabled = false)
    private Map<String, String> attributeValues = Maps.newHashMap();

    public void setAttribute(String key, String value) {
        attributeValues.put(key, value);
    }
}

Correct service attributes mapping to ES


package org.mozilla.mozstumbler;

import android.annotation.SuppressLint;

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

public final class DateTimeUtils {
    private static final DateFormat sLocaleFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
    private static final DateFormat sISO8601Format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);

    static final long MILLISECONDS_PER_DAY = 86400000;  // milliseconds/day

    static {
        sISO8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
    }

    private DateTimeUtils() {
    }

    @SuppressLint("SimpleDateFormat")
    static String formatDate(Date date) {
        return sISO8601Format.format(date);
    }

    public static String formatTime(long time) {
        return formatDate(new Date(time));
    }

    static String formatTimeForLocale(long time) {
        return sLocaleFormat.format(time);
    }

    static String formatCurrentTime() {
        return formatTimeForLocale(System.currentTimeMillis());
    }
}

package org.mozilla.mozstumbler;

import android.annotation.SuppressLint;

import java.util.Calendar;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.TimeZone;

public final class DateTimeUtils {
    private static final DateFormat sLocaleFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
    private static final DateFormat sISO8601Format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);

    static final long MILLISECONDS_PER_DAY = 86400000;  // milliseconds/day

    static {
        sISO8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
    }

    private DateTimeUtils() {
    }

    @SuppressLint("SimpleDateFormat")
    static String formatDate(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.set(Calendar.DAY_OF_MONTH,1);
        date = c.getTime();
        return sISO8601Format.format(date);
    }

    public static String formatTime(long time) {
        return formatDate(new Date(time));
    }

    static String formatTimeForLocale(long time) {
        return sLocaleFormat.format(time);
    }

    static String formatCurrentTime() {
        return formatTimeForLocale(System.currentTimeMillis());
    }
}

Modify the date format to YYYY-mm-01.


package com.rmd.personal.projecteuler;

import java.util.ArrayList;
import java.util.List;

public final class Main {

    private List<Problem> problemList;

    private Main() {
        this.problemList = new ArrayList<Problem>();
        this.getProblemList().add(new Problem1());
    }

    private List<Problem> getProblemList() {
        return this.problemList;
    }

    public static void main(String[] args) {
        (new Main()).run();
    }

    private void run() {
        for (Problem problem : this.getProblemList()) {
            System.out.println("Problem: " + this.getProblemList().indexOf(problem));
            System.out.println(problem.getDescription());
            System.out.println(problem.run());
        }
    }
}

package com.rmd.personal.projecteuler;

import java.util.ArrayList;
import java.util.List;

public final class Main {

    private List<Problem> problemList;

    private Main() {
        this.problemList = new ArrayList<Problem>();
        this.getProblemList().add(new Problem1());
        this.getProblemList().add(new Problem2());
        this.getProblemList().add(new Problem3());
    }

    private List<Problem> getProblemList() {
        return this.problemList;
    }

    public static void main(String[] args) {
        (new Main()).run();
    }

    private void run() {
        for (Problem problem : this.getProblemList()) {
            System.out.println("Problem: " + this.getProblemList().indexOf(problem));
            System.out.println(problem.getDescription());
            System.out.println(problem.run());
        }
    }
}

Add problem 2 and 3 to main class.


package strings;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
import static strings.BaseConversion.baseConversion;

class BaseConversionTest {

    private String expected;
    private String input;
    private int b1;
    private int b2;

    @Test
    void baseConversion1() {
        expected = "314F";
        input = "12623";
        b1 = 10;
        b2 = 16;

        test(expected, input, b1, b2);
    }

    @Test
    void baseConversion2() {
        expected = "2C996B726";
        input = "114152520463";
        b1 = 7;
        b2 = 13;

        test(expected, input, b1, b2);
    }

    @Test
    void baseConversion3() {
        expected = "111";
        input = "7";
        b1 = 10;
        b2 = 2;

        test(expected, input, b1, b2);
    }

    @Test
    void baseConversion4() {
        expected = "33CD";
        input = "10001100101001";
        b1 = 2;
        b2 = 14;

        test(expected, input, b1, b2);
    }

    private void test(String expected, String input, int b1, int b2) {
        assertEquals(expected, baseConversion(input, b1, b2));
    }

}

package strings;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
import static strings.BaseConversion.baseConversion;

class BaseConversionTest {

    private String expected;
    private String input;
    private int b1;
    private int b2;

    @Test
    void baseConversion1() {
        expected = "314F";
        input = "12623";
        b1 = 10;
        b2 = 16;

        test(expected, input, b1, b2);
    }

    @Test
    void baseConversion2() {
        expected = "-6CC2";
        input = "-62543";
        b1 = 7;
        b2 = 13;

        test(expected, input, b1, b2);
    }

    @Test
    void baseConversion3() {
        expected = "111";
        input = "7";
        b1 = 10;
        b2 = 2;

        test(expected, input, b1, b2);
    }

    @Test
    void baseConversion4() {
        expected = "33CD";
        input = "10001100101001";
        b1 = 2;
        b2 = 14;

        test(expected, input, b1, b2);
    }

    private void test(String expected, String input, int b1, int b2) {
        assertEquals(expected, baseConversion(input, b1, b2));
    }

}

Remove test with integer > Integer.MAX. Replaced it with negative number test


package org.bouncycastle.crypto.tls;

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

/**
 * A generic interface for key exchange implementations in TLS 1.0.
 */
interface TlsKeyExchange
{
    static final short KE_RSA = 1;
//    static final short KE_RSA_EXPORT = 2;
    static final short KE_DHE_DSS = 3;
//    static final short KE_DHE_DSS_EXPORT = 4;
    static final short KE_DHE_RSA = 5;
//    static final short KE_DHE_RSA_EXPORT = 6;
    static final short KE_DH_DSS = 7;
    static final short KE_DH_RSA = 8;
//    static final short KE_DH_anon = 9;
    static final short KE_SRP = 10;
    static final short KE_SRP_DSS = 11;
    static final short KE_SRP_RSA = 12;

    void skipServerCertificate() throws IOException;

    void processServerCertificate(Certificate serverCertificate) throws IOException;

    void skipServerKeyExchange() throws IOException;

    void processServerKeyExchange(InputStream is, SecurityParameters securityParameters)
        throws IOException;

    void generateClientKeyExchange(OutputStream os) throws IOException;

    byte[] generatePremasterSecret() throws IOException;
}

package org.bouncycastle.crypto.tls;

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

/**
 * A generic interface for key exchange implementations in TLS 1.0.
 */
interface TlsKeyExchange
{
    static final short KE_RSA = 1;
//    static final short KE_RSA_EXPORT = 2;
    static final short KE_DHE_DSS = 3;
//    static final short KE_DHE_DSS_EXPORT = 4;
    static final short KE_DHE_RSA = 5;
//    static final short KE_DHE_RSA_EXPORT = 6;
    static final short KE_DH_DSS = 7;
    static final short KE_DH_RSA = 8;
//    static final short KE_DH_anon = 9;
    static final short KE_SRP = 10;
    static final short KE_SRP_DSS = 11;
    static final short KE_SRP_RSA = 12;
    static final short KE_ECDH_ECDSA = 13;
    static final short KE_ECDHE_ECDSA = 14;
    static final short KE_ECDH_RSA = 15;
    static final short KE_ECDHE_RSA = 16;
    static final short KE_ECDH_anon = 17;

    void skipServerCertificate() throws IOException;

    void processServerCertificate(Certificate serverCertificate) throws IOException;

    void skipServerKeyExchange() throws IOException;

    void processServerKeyExchange(InputStream is, SecurityParameters securityParameters)
        throws IOException;

    void generateClientKeyExchange(OutputStream os) throws IOException;

    byte[] generatePremasterSecret() throws IOException;
}

Add constants for EC key exchange methods


/*++

NASM Assembly Language Plugin
Copyright (c) 2017-2018 Aidan Khoury. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

--*/

package com.nasmlanguage.psi.impl;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.nasmlanguage.psi.NASMNamedElement;
import org.jetbrains.annotations.NotNull;

public abstract class NASMNamedElementImpl extends ASTWrapperPsiElement implements NASMNamedElement {
    public NASMNamedElementImpl(@NotNull ASTNode node) {
        super(node);
    }
}

/*++

NASM Assembly Language Plugin
Copyright (c) 2017-2018 Aidan Khoury

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--*/

package com.nasmlanguage.psi.impl;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.nasmlanguage.psi.NASMNamedElement;
import org.jetbrains.annotations.NotNull;

public abstract class NASMNamedElementImpl extends ASTWrapperPsiElement implements NASMNamedElement {
    public NASMNamedElementImpl(@NotNull ASTNode node) {
        super(node);
    }
}

Update copyright notice with MIT license


package main.java.player;

import jgame.platform.JGEngine;

public class TDPlayerEngine extends JGEngine {

	public TDPlayerEngine() {
		super();
		initEngineComponent(960, 640);
	}

	@Override
	public void initCanvas() {
		setCanvasSettings(15, 10, 32, 32, null, null, null);
	}

	@Override
	public void initGame() {
		setFrameRate(35, 2);
	}

	public void doFrame() {

	}
}

package main.java.player;

import jgame.JGColor;
import jgame.JGPoint;
import jgame.platform.JGEngine;
import main.java.engine.Model;

public class TDPlayerEngine extends JGEngine {
    private Model model;

	public TDPlayerEngine() {
		super();
		initEngineComponent(960, 640);
	}

	@Override
	public void initCanvas() {
		setCanvasSettings(15, 10, 32, 32, null, JGColor.black, null);
	}

	@Override
	public void initGame() {
		setFrameRate(45, 1);
        this.model = new Model();
        model.setEngine(this);
        model.addNewPlayer();
        model.loadMap("testmap.json");
        defineMedia("/main/resources/media.tbl");
        model.setTemporaryWaveSchema();
	}

    @Override
    public void paintFrame() {
        highlightMouseoverTile();
        displayGameStats();
    }

    private void highlightMouseoverTile() {
        JGPoint mousePos = getMousePos();
        int curXTilePos = mousePos.x/tileWidth() * tileWidth();
        int curYTilePos = mousePos.y/tileHeight() * tileHeight();

        this.drawRect(curXTilePos, curYTilePos, tileWidth(), tileHeight(), false, false, 1.0, JGColor.yellow);
    }

    private void displayGameStats() {
    	this.drawString("Score: "+model.getScore(), 50, 25, -1);
    	this.drawString("Lives left: "+model.getPlayerLife(), 50, 50, -1);
    	this.drawString("Money: "+model.getMoney(), 50, 75, -1);
    	this.drawString("Game clock: "+model.getGameClock(), 50, 100, -1);
    }

    @Override
    public void doFrame() {
        super.doFrame();
        model.updateGameClockByFrame();
        if (getMouseButton(1)) {
            model.placeTower(getMouseX(), getMouseY());
        }
        if (model.getGameClock() % 100 == 0)
        	model.spawnNextWave();
        moveObjects();
//        model.spawnMonster(100, 150);
    }
}

Make player talk to engine


package peergos.shared.storage;

import peergos.shared.crypto.hash.*;

import java.util.concurrent.*;
import java.util.function.*;

public class Transaction {

    /** Run a series of operations under a transaction, ensuring that it is closed correctly
     *
     * @param owner
     * @param processor
     * @param ipfs
     * @param <V>
     * @return
     */
    public static <V> CompletableFuture<V> run(PublicKeyHash owner,
                                               Function<TransactionId, CompletableFuture<V>> processor,
                                               ContentAddressedStorage ipfs) {
        CompletableFuture<V> res = new CompletableFuture<>();
        ipfs.startTransaction(owner).thenCompose(tid -> processor.apply(tid)
                .thenCompose(v -> ipfs.closeTransaction(owner, tid)
                        .thenApply(x -> res.complete(v)))
                .exceptionally(t -> {
                    ipfs.closeTransaction(owner, tid)
                            .thenApply(x -> res.completeExceptionally(t))
                            .exceptionally(e -> res.completeExceptionally(e));
                    return false;
                }));
        return res;
    }
}

package peergos.shared.storage;

import peergos.shared.crypto.hash.*;

import java.util.concurrent.*;
import java.util.function.*;

public class Transaction {

    /** Run a series of operations under a transaction, ensuring that it is closed correctly
     *
     * @param owner
     * @param processor
     * @param ipfs
     * @param <V>
     * @return
     */
    public static <V> CompletableFuture<V> run(PublicKeyHash owner,
                                               Function<TransactionId, CompletableFuture<V>> processor,
                                               ContentAddressedStorage ipfs) {
        CompletableFuture<V> res = new CompletableFuture<>();
        ipfs.startTransaction(owner).thenCompose(tid -> processor.apply(tid)
                .thenCompose(v -> ipfs.closeTransaction(owner, tid)
                        .thenApply(x -> res.complete(v)))
                .exceptionally(t -> {
                    ipfs.closeTransaction(owner, tid)
                            .thenApply(x -> res.completeExceptionally(t))
                            .exceptionally(e -> res.completeExceptionally(e));
                    return false;
                })).exceptionally(e -> res.completeExceptionally(e));
        return res;
    }
}

Make sure a transaction completes exceptionally if it fails to start


package com.meedan;

import android.app.Activity;

import java.util.*;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import com.meedan.ShareMenuModule;

public class ShareMenuPackage implements ReactPackage {

  public ShareMenuPackage() {
    super();
  }

  @Override
  public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new ShareMenuModule(reactContext));
    return modules;
  }

  @Override
  public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
  }

  @Override
  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
  }
}

package com.meedan;

import android.app.Activity;

import java.util.*;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import com.meedan.ShareMenuModule;

public class ShareMenuPackage implements ReactPackage {

  public ShareMenuPackage() {
    super();
  }

  @Override
  public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new ShareMenuModule(reactContext));
    return modules;
  }

  @Override
  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
  }
}

Fix Compilation Error in React Native 0.47.0


package com.github.ferstl.depgraph;

import java.io.File;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecutionResult;
import io.takari.maven.testing.executor.MavenRuntime;
import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
import io.takari.maven.testing.executor.MavenVersions;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;

@RunWith(MavenJUnitTestRunner.class)
@MavenVersions("3.3.9")
public class IntegrationTest {

  @Rule
  public final TestResources resources = new TestResources();

  private final MavenRuntime mavenRuntime;

  public IntegrationTest(MavenRuntimeBuilder builder) throws Exception {
    this.mavenRuntime = builder.build();
  }

  @Test
  public void graph() throws Exception {
    File basedir = this.resources.getBasedir("depgraph-maven-plugin-test");
    MavenExecutionResult result = this.mavenRuntime
        .forProject(basedir)
        .execute("clean", "depgraph:graph");

    result.assertErrorFreeLog();
  }
}

package com.github.ferstl.depgraph;

import java.io.File;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecutionResult;
import io.takari.maven.testing.executor.MavenRuntime;
import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
import io.takari.maven.testing.executor.MavenVersions;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
import static io.takari.maven.testing.TestResources.assertFilesPresent;

@RunWith(MavenJUnitTestRunner.class)
@MavenVersions("3.3.9")
public class IntegrationTest {

  @Rule
  public final TestResources resources = new TestResources();

  private final MavenRuntime mavenRuntime;

  public IntegrationTest(MavenRuntimeBuilder builder) throws Exception {
    this.mavenRuntime = builder.build();
  }

  @Test
  public void graph() throws Exception {
    File basedir = this.resources.getBasedir("depgraph-maven-plugin-test");
    MavenExecutionResult result = this.mavenRuntime
        .forProject(basedir)
        .execute("clean", "depgraph:graph");

    result.assertErrorFreeLog();
    assertFilesPresent(
        basedir,
        "module-1/target/dependency-graph.dot",
        "module-2/target/dependency-graph.dot",
        "sub-parent/module-3/target/dependency-graph.dot");
  }
}

Add assertion for dot files


package endtoend;

import static org.junit.Assert.assertEquals;
import me.moodcat.api.models.RoomModel;
import me.moodcat.api.models.SongModel;

import org.junit.Test;

public class ApiEndToEndTest extends EndToEndTest {

    @Test
    public void canRetrieveRooms() {
        RoomModel room = this.performGETRequest(RoomModel.class, "rooms/1");

        assertEquals(1, room.getId().intValue());
        assertEquals(1, room.getNowPlaying().getSong().getId().intValue());
    }

    @Test
    public void canRetrieveSongs() {
        SongModel song = this.performGETRequest(SongModel.class, "songs/1");

        assertEquals(1, song.getId().intValue());
        assertEquals(202330997, song.getSoundCloudId().intValue());
    }

}

package endtoend;

import static org.junit.Assert.assertEquals;

import java.util.List;

import javax.ws.rs.core.GenericType;

import me.moodcat.api.models.RoomModel;
import me.moodcat.api.models.SongModel;

import org.junit.Test;

public class ApiEndToEndTest extends EndToEndTest {

    @Test
    public void canRetrieveRoom() {
        RoomModel room = this.performGETRequest(RoomModel.class, "rooms/1");

        assertEquals(1, room.getId().intValue());
        assertEquals(1, room.getNowPlaying().getSong().getId().intValue());
    }

    @Test
    public void canRetrieveSongs() {
        SongModel song = this.performGETRequest(SongModel.class, "songs/1");

        assertEquals(1, song.getId().intValue());
        assertEquals(202330997, song.getSoundCloudId().intValue());
    }

    @Test
    public void canRetrieveRooms() {
        List<RoomModel> rooms = this.performGETRequestWithGenericType(new GenericType<List<RoomModel>>(){}, "rooms");

        assertEquals(1, rooms.get(0).getId().intValue());
    }

}

Test that might be failing. Let's see.


package de.stefanhoth.android.got2048.logic;

import de.stefanhoth.android.got2048.logic.model.Cell;
import de.stefanhoth.android.got2048.logic.model.Grid;
import de.stefanhoth.android.got2048.logic.model.MOVE_DIRECTION;

/**
 * TODO describe class
 *
 * @author Stefan Hoth <sh@jnamic.com>
 *         date: 20.03.14 20:40
 * @since TODO add version
 */
public class MCP {

    protected static final int DEFAULT_START_FIELDS = 2;
    protected static final int DEFAULT_START_VALUE = 2;
    private Grid playlingField;

    public MCP() {

        playlingField = new Grid();
    }

    protected Grid getPlaylingField() {
        return playlingField;
    }

    public void addStartCells() {

        Cell cell = playlingField.getRandomCell();

        cell.setValue(DEFAULT_START_VALUE);

        Cell nextCell = playlingField.getRandomCell();

        for (int count = playlingField.getActiveCells(); count < DEFAULT_START_FIELDS; count++) {
            while (cell.equals(nextCell)) {
                nextCell = playlingField.getRandomCell();
            }

            nextCell.setValue(DEFAULT_START_VALUE);
            cell = nextCell;
        }
    }

    public void move(MOVE_DIRECTION direction) {

        //left to right
        playlingField.moveCells();

    }
}

package de.stefanhoth.android.got2048.logic;

import de.stefanhoth.android.got2048.logic.model.Cell;
import de.stefanhoth.android.got2048.logic.model.Grid;
import de.stefanhoth.android.got2048.logic.model.MOVE_DIRECTION;

/**
 * TODO describe class
 *
 * @author Stefan Hoth <sh@jnamic.com>
 *         date: 20.03.14 20:40
 * @since TODO add version
 */
public class MCP {

    protected static final int DEFAULT_START_FIELDS = 2;
    protected static final int DEFAULT_START_VALUE = 2;
    private Grid playlingField;

    public MCP() {
        playlingField = new Grid();
    }

    public MCP(int gridSize) {
        playlingField = new Grid(gridSize);
    }

    protected Grid getPlaylingField() {
        return playlingField;
    }

    public void addStartCells() {

        Cell cell = playlingField.getRandomCell();

        cell.setValue(DEFAULT_START_VALUE);

        Cell nextCell = playlingField.getRandomCell();

        for (int count = playlingField.getActiveCells(); count < DEFAULT_START_FIELDS; count++) {
            while (cell.equals(nextCell)) {
                nextCell = playlingField.getRandomCell();
            }

            nextCell.setValue(DEFAULT_START_VALUE);
            cell = nextCell;
        }
    }

    public void move(MOVE_DIRECTION direction) {

        //left to right
        playlingField.moveCells();

    }
}

Enable customization of gridSize during instance creation


package info.u_team.u_team_test.init;

import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.RenderTooltipEvent.Color;
import net.minecraftforge.eventbus.api.IEventBus;

public class TestColors {

	private static void colorItem(ColorHandlerEvent.Item event) {
		// This use the awt color class. Might not work but was too lazy to write an own color class.
		event.getItemColors().register((stack, index) -> Color.getHSBColor((float) stack.getDamageValue() / (float) stack.getMaxDamage(), 0.8F, 0.5F).getRGB(), TestItems.BASIC.get());
	}

	public static void registerMod(IEventBus bus) {
		bus.addListener(TestColors::colorItem);
	}
}

package info.u_team.u_team_test.init;

import java.awt.Color;

import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.eventbus.api.IEventBus;

public class TestColors {

	private static void colorItem(ColorHandlerEvent.Item event) {
		// This use the awt color class. Might not work but was too lazy to write an own color class.
		event.getItemColors().register((stack, index) -> Color.getHSBColor((float) stack.getDamageValue() / (float) stack.getMaxDamage(), 0.8F, 0.5F).getRGB(), TestItems.BASIC.get());
	}

	public static void registerMod(IEventBus bus) {
		bus.addListener(TestColors::colorItem);
	}
}

Fix test mod, compiles now :)


package fr.jmini.htmlchecker.settings;

import java.io.File;

import com.selesse.jxlint.settings.ProgramSettings;

public class HtmlCheckerProgramSettings implements ProgramSettings {
  @Override
  public String getProgramVersion() {
    return "1.2.2";
  }

  @Override
  public String getProgramName() {
    return "htmlchecker";
  }

  @Override
  public void initializeForWeb(File projectRoot) {
  }
}

package fr.jmini.htmlchecker.settings;

import java.io.File;

import com.selesse.jxlint.settings.ProgramSettings;

public class HtmlCheckerProgramSettings implements ProgramSettings {
  @Override
  public String getProgramVersion() {
    return "1.2.3";
  }

  @Override
  public String getProgramName() {
    return "htmlchecker";
  }

  @Override
  public void initializeForWeb(File projectRoot) {
  }
}

Fix test after version bump


package org.apache.ddlutils.platform;

/*
 * Copyright 1999-2005 The Apache Software Foundation.
 *
 * 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.
 */

import java.io.IOException;

import org.apache.ddlutils.PlatformInfo;
import org.apache.ddlutils.model.Table;

/**
 * The SQL Builder for the HsqlDb database.
 *
 * @author James Strachan
 * @author Thomas Dudziak
 * @version $Revision$
 */
public class HsqlDbBuilder extends SqlBuilder
{
    /**
     * Creates a new builder instance.
     *
     * @param info The platform info
     */
    public HsqlDbBuilder(PlatformInfo info)
    {
        super(info);
    }

    /**
     * {@inheritDoc}
     */
    public void dropTable(Table table) throws IOException
    {
        print("DROP TABLE ");
        printIdentifier(getTableName(table));
        print(" IF EXISTS");
        printEndOfStatement();
    }
}

package org.apache.ddlutils.platform;

/*
 * Copyright 1999-2005 The Apache Software Foundation.
 *
 * 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.
 */

import java.io.IOException;

import org.apache.ddlutils.PlatformInfo;
import org.apache.ddlutils.model.Table;

/**
 * The SQL Builder for the HsqlDb database.
 *
 * @author James Strachan
 * @author Thomas Dudziak
 * @version $Revision$
 */
public class HsqlDbBuilder extends SqlBuilder
{
    /**
     * Creates a new builder instance.
     *
     * @param info The platform info
     */
    public HsqlDbBuilder(PlatformInfo info)
    {
        super(info);
    }

    /**
     * {@inheritDoc}
     */
    public void dropTable(Table table) throws IOException
    {
        print("DROP TABLE ");
        printIdentifier(getTableName(table));
        print(" IF EXISTS");
        printEndOfStatement();
    }

    /**
     * @see org.apache.ddlutils.platform.SqlBuilder#getSelectLastInsertId(org.apache.ddlutils.model.Table)
     */
    public String getSelectLastInsertId(Table table)
    {
        return "CALL IDENTITY()";
    }

}

Add call identity to hsqldb.


package com.nickww.finitefield;

public abstract class ChecksumVector
{
	/**
	 * Calculates checksums for the given data, and returns a vector which is the given data bytes followed by the
	 * checksum bytes.
	 *
	 * @param data The data to checksum.
	 * @return An array with the data and the checksums.
	 */
	public abstract byte[] withChecksums(byte[] data);

	/**
	 * Calculates the data bytes from the given array. The array must represent the data bytes, in order, followed by
	 * the checksum bytes, in order. Values which are missing (to be solved for) should be present as a
	 * null.
	 *
	 * @param dataWithChecksums The data, followed by the checksums, with nulls for unknown values.
	 * @return An array with the original data bytes (no checksums).
	 * @throws IllegalArgumentException if the given byte array has too many missing values (nulls) to recalculate the
	 * original data, or if the array is not large enough to be valid.
	 */
	public abstract byte[] solveMissingValues(Byte[] dataWithChecksums);
}

package com.nickww.finitefield;

import java.util.ArrayList;
import java.util.List;

public abstract class ChecksumVector
{
	/**
	 * Calculates checksums for the given data, and returns a vector which is the given data bytes followed by the
	 * checksum bytes.
	 *
	 * @param data The data to checksum.
	 * @return An array with the data and the checksums.
	 */
	public abstract byte[] withChecksums(byte[] data);

	/**
	 * Calculates the data bytes from the given array. The array must represent the data bytes, in order, followed by
	 * the checksum bytes, in order. Values which are missing (to be solved for) should be present as a
	 * null.
	 *
	 * @param dataWithChecksums The data, followed by the checksums, with nulls for unknown values.
	 * @return An array with the original data bytes (no checksums).
	 * @throws IllegalArgumentException if the given byte array has too many missing values (nulls) to recalculate the
	 * original data, or if the array is not large enough to be valid.
	 */
	public abstract byte[] solveMissingValues(Byte[] dataWithChecksums);

	/**
	 * Returns a list of the indices of the given array whose values are null. If the given array is null, null is
	 * returned.
	 *
	 * @param array The array in which to check for nulls.
	 * @return The indices of the given array which are null, sorted in ascending order, or null.
	 */
	protected List<Integer> missingIndices(Byte[] array)
	{
		if(array == null)
			return null;

		List<Integer> nulls = new ArrayList<>();
		for(int index = 0; index < array.length; index++)
			nulls.add(index);
		return nulls;
	}
}

Create convenience method to determine the indices of null in an array


package me.mrten.mysqlapi;

public class MySQL {

    private ConnectionManager connectionManager;

    public MySQL() {

    }

    /**
     * Get the connection manager.
     *
     * @return the connection manager
     */
    public ConnectionManager getConnectionManager() {
        return connectionManager;
    }

    /**
     * Connect to a MySQL database.
     * @param host - the host for connecting to the database
     * @param port - the port (by default 3306)
     * @param username - username used to connect to the database
     * @param password - password used to connect to the database
     * @param database - name of the database to connect to
     */
    public void connect(String host, String port, String username, String password, String database) {
        connectionManager = new ConnectionManager(host, port, username, password, database);
    }

    /**
     * Close all connections and the data source.
     */
    public void disconnect() {
        if (connectionManager != null)
            connectionManager.close();
    }
}

package me.mrten.mysqlapi;

public class MySQL {

    private ConnectionManager connectionManager;

    public MySQL() {

    }

    /**
     * Get the connection manager.
     *
     * @return the connection manager
     */
    public ConnectionManager getConnectionManager() {
        return connectionManager;
    }

    /**
     * Connect to a MySQL database.
     * @param host - the host for connecting to the database
     * @param port - the port (by default 3306)
     * @param username - username used to connect to the database
     * @param password - password used to connect to the database
     * @param database - name of the database to connect to
     */
    public void connect(String host, String port, String username, String password, String database) {
        connectionManager = new ConnectionManager(host, port, username, password, database);
        connectionManager.open();
    }

    /**
     * Close all connections and the data source.
     */
    public void disconnect() {
        if (connectionManager != null)
            connectionManager.close();
    }
}

Fix connection manager not opening connection


/*
 * DatasourceConfig.java
 *
 * Copyright (C) 2017 [ A Legge Up ]
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

package com.aleggeup.confagrid.config;

import javax.sql.DataSource;

import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

@Configuration
public class DatasourceConfig {

    @Bean
    DataSource datasource(final DataSourceProperties datasourceProperties) {
        final DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(datasourceProperties.getDriverClassName());
        dataSource.setUsername(datasourceProperties.getUsername());
        dataSource.setPassword(datasourceProperties.getPassword());
        dataSource.setUrl(datasourceProperties.getUrl());

        return dataSource;
    }
}

/*
 * DatasourceConfig.java
 *
 * Copyright (C) 2017 [ A Legge Up ]
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

package com.aleggeup.confagrid.config;

import javax.sql.DataSource;

import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

@Configuration
public class DatasourceConfig {

    @Bean
    @Primary
    DataSource datasource(final DataSourceProperties datasourceProperties) {
        final DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(datasourceProperties.getDriverClassName());
        dataSource.setUsername(datasourceProperties.getUsername());
        dataSource.setPassword(datasourceProperties.getPassword());
        dataSource.setUrl(datasourceProperties.getUrl());

        return dataSource;
    }
}

Add 'Primary' annotation so that it is clear for AutoWired


package org.orienteer.core.widget.command;

import java.util.Optional;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.model.IModel;
import org.orienteer.core.component.BootstrapSize;
import org.orienteer.core.component.BootstrapType;
import org.orienteer.core.component.FAIconType;
import org.orienteer.core.component.command.AjaxCommand;
import org.orienteer.core.component.property.DisplayMode;
import org.orienteer.core.widget.DashboardPanel;
import org.orienteer.core.widget.IDashboardContainer;

import com.orientechnologies.orient.core.record.impl.ODocument;

/**
 * Command to save silently current dashboard
 */
public class SilentSaveDashboardCommand extends AjaxCommand<ODocument> {
	private static final long serialVersionUID = 1L;

	public SilentSaveDashboardCommand(String id, IModel<ODocument> dashboardDocumentModel) {
		super(id, "command.save", dashboardDocumentModel);
		setIcon(FAIconType.save);
		setChangingDisplayMode(true);
	}

	@Override
	public void onClick(Optional<AjaxRequestTarget> targetOptional) {
		IDashboardContainer container = findParent(IDashboardContainer.class);
		DashboardPanel<?> dashboard = container.getCurrentDashboard().getSelfComponent();
		dashboard.storeDashboard();
		dashboard.getModeModel().setObject(DisplayMode.VIEW);
		targetOptional.ifPresent(target -> target.add(dashboard));
	}
}

package org.orienteer.core.widget.command;

import com.orientechnologies.orient.core.record.impl.ODocument;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.model.IModel;
import org.orienteer.core.component.FAIconType;
import org.orienteer.core.component.command.AjaxCommand;
import org.orienteer.core.component.property.DisplayMode;
import org.orienteer.core.widget.DashboardPanel;
import org.orienteer.core.widget.IDashboardContainer;

import java.util.Optional;

/**
 * Command to save silently current dashboard
 */
public class SilentSaveDashboardCommand extends AjaxCommand<ODocument> {
	private static final long serialVersionUID = 1L;

	public SilentSaveDashboardCommand(String id, IModel<ODocument> dashboardDocumentModel) {
		super(id, "command.save", dashboardDocumentModel);
		setIcon(FAIconType.save);
		setChangingDisplayMode(true);
	}

	@Override
	public void onClick(Optional<AjaxRequestTarget> targetOptional) {
		IDashboardContainer container = findParent(IDashboardContainer.class);
		DashboardPanel<?> dashboard = container.getCurrentDashboard().getSelfComponent();
		dashboard.storeDashboard();
		dashboard.getModeModel().setObject(DisplayMode.VIEW);
		targetOptional.ifPresent(target -> {
			target.add(container.getSelf().get("pageHeader"));
			target.add(dashboard);
		});
	}
}

Update page header on click


package org.realityforge.arez.api2;

import java.util.function.Supplier;
import javax.annotation.Nonnull;

final class Guards
{
  private Guards()
  {
  }

  /**
   * Check an invariant in code base.
   * If the condition is false then an {@link IllegalStateException} is thrown.
   * The invariant check will be skipped unless the configuration setting {@link ArezConfig#checkInvariants()}
   * is true. A null message is used rather than supplied message unless {@link ArezConfig#verboseErrorMessages()}
   * is true.
   *
   * @throws IllegalStateException if condition returns false.
   */
  static void invariant( @Nonnull final Supplier<Boolean> condition,
                         @Nonnull final Supplier<String> message )
  {
    if ( ArezConfig.checkInvariants() && !condition.get() )
    {
      fail( message );
    }
  }

  /**
   * Throw an IllegalStateException with supplied detail message.
   * The exception is not thrown unless {@link ArezConfig#checkInvariants()} is true.
   * The exception will ignore the supplied message unless {@link ArezConfig#verboseErrorMessages()} is true.
   */
  static void fail( @Nonnull final Supplier<String> message )
  {
    if ( ArezConfig.checkInvariants() )
    {
      if ( ArezConfig.verboseErrorMessages() )
      {
        throw new IllegalStateException( ArezUtil.safeGetString( message ) );
      }
      else
      {
        throw new IllegalStateException();
      }
    }
  }
}

package org.realityforge.arez.api2;

import java.util.function.Supplier;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.Contract;

final class Guards
{
  private Guards()
  {
  }

  /**
   * Check an invariant in code base.
   * If the condition is false then an {@link IllegalStateException} is thrown.
   * The invariant check will be skipped unless the configuration setting {@link ArezConfig#checkInvariants()}
   * is true. A null message is used rather than supplied message unless {@link ArezConfig#verboseErrorMessages()}
   * is true.
   *
   * @throws IllegalStateException if condition returns false.
   */
  static void invariant( @Nonnull final Supplier<Boolean> condition,
                         @Nonnull final Supplier<String> message )
  {
    if ( ArezConfig.checkInvariants() && !condition.get() )
    {
      fail( message );
    }
  }

  /**
   * Throw an IllegalStateException with supplied detail message.
   * The exception is not thrown unless {@link ArezConfig#checkInvariants()} is true.
   * The exception will ignore the supplied message unless {@link ArezConfig#verboseErrorMessages()} is true.
   */
  @Contract( "_ -> fail" )
  static void fail( @Nonnull final Supplier<String> message )
  {
    if ( ArezConfig.checkInvariants() )
    {
      if ( ArezConfig.verboseErrorMessages() )
      {
        throw new IllegalStateException( ArezUtil.safeGetString( message ) );
      }
      else
      {
        throw new IllegalStateException();
      }
    }
  }
}

Add Contract annotation to help idea perform flow analysis


package editor.util;

import java.awt.Color;
import java.lang.reflect.Type;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class ColorAdapter implements JsonSerializer<Color>, JsonDeserializer<Color>
{
    @Override
    public JsonElement serialize(Color src, Type typeOfSrc, JsonSerializationContext context)
    {
        return new JsonPrimitive(Integer.toHexString(src.getRGB()));
    }

    @Override
    public Color deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
    {
        return new Color(Integer.valueOf(json.getAsString(), 16), true);
    }
}

package editor.util;

import java.awt.Color;
import java.lang.reflect.Type;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class ColorAdapter implements JsonSerializer<Color>, JsonDeserializer<Color>
{
    @Override
    public JsonElement serialize(Color src, Type typeOfSrc, JsonSerializationContext context)
    {
        return new JsonPrimitive(Integer.toHexString(src.getRGB()));
    }

    @Override
    public Color deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
    {
        // Need to parse as a long and cast to int in case the color is white,
        // which has value 0xFFFFFFFF and is outside the range of an int
        return new Color((int)Long.parseLong(json.getAsString(), 16), true);
    }
}

Fix parsing bug for white colors


/*
 * Copyright 2015, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.server.storage.filesystem;

import org.spine3.server.storage.CommandStorage;
import org.spine3.server.storage.CommandStoreRecord;

public class FileSystemCommandStorage extends CommandStorage {

    @Override
    protected void write(CommandStoreRecord record) {
        Helper.write(record);
    }
}

/*
 * Copyright 2015, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.server.storage.filesystem;

import org.spine3.server.storage.CommandStorage;
import org.spine3.server.storage.CommandStoreRecord;

import static com.google.common.base.Preconditions.checkNotNull;

public class FileSystemCommandStorage extends CommandStorage {

    @Override
    protected void write(CommandStoreRecord record) {
        checkNotNull(record, "CommandRecord shouldn't be null.");
        Helper.write(record);
    }

}

Check that command is not null before saving.