package io.github.saidie.plantuml_api;

import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Account {
    @Id
    @GeneratedValue
    private long id;

    @NotNull
    @Column(nullable = false)
    private String username;

    @OneToMany(mappedBy = "account", cascade = CascadeType.ALL)
    private List<Federation> federations;
}

package io.github.saidie.plantuml_api;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Account {
    @Id
    @GeneratedValue
    private long id;

    @NotNull
    @Column(nullable = false)
    private String username;
}

Remove a dependency from account to federations


package org.twig.syntax.parser.node.type;

import org.twig.compiler.*;
import org.twig.syntax.parser.node.Node;

import java.util.ArrayList;
import java.util.HashMap;

public class Text extends Node {
    public Text(ArrayList<Node> nodes, HashMap<String, Object> attributes, Integer line, String tag) {
        super(nodes, attributes, line, tag);
    }

    public Text(Integer line) {
        super(line);
    }

    @Override
    public void compile(ClassCompiler compiler) {
        String text = String.valueOf(attributes.get("data"));
        compiler.write("output = output.concat(");
        compiler.writeString(text);
        compiler.writeLine(");");
    }
}

package org.twig.syntax.parser.node.type;

import org.twig.compiler.*;
import org.twig.syntax.parser.node.Node;

import java.util.ArrayList;
import java.util.HashMap;

public class Text extends Node {
    public Text(ArrayList<Node> nodes, HashMap<String, Object> attributes, Integer line, String tag) {
        super(nodes, attributes, line, tag);
    }

    public Text(Integer line) {
        super(line);
    }

    @Override
    public void compile(ClassCompiler compiler) {
        String text = String.valueOf(attributes.get("data"));
        compiler.write("output = output.concat(");
        compiler.writeString(text);
        compiler.writeRaw(");\n");
    }
}

Make formatting of text node nicer


package seedu.address.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.task.commons.core.Config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Address App\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/taskmanager.xml\n" +
                "TaskManager name : MyTaskManager";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

package seedu.address.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.task.commons.core.Config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Task Manager\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/taskmanager.xml\n" +
                "TaskManager name : MyTaskManager";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

Change 'Address App' to Task Manager'


package org.edx.mobile.base;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import org.edx.mobile.event.NewRelicEvent;

import de.greenrobot.event.EventBus;
import roboguice.fragment.RoboFragment;

public class BaseFragment extends RoboFragment {
    private boolean isFirstVisit;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().post(new NewRelicEvent(getClass().getSimpleName()));
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        isFirstVisit = true;
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onResume() {
        super.onResume();
        if (isFirstVisit) {
            isFirstVisit = false;
        } else {
            onRevisit();
        }
    }

    /**
     * Called when a Fragment is re-displayed to the user (the user has navigated back to it).
     * Defined to mock the behavior of {@link Activity#onRestart() Activity.onRestart} function.
     */
    protected void onRevisit() {
    }
}

package org.edx.mobile.base;

import android.app.Activity;
import android.os.Bundle;

import org.edx.mobile.event.NewRelicEvent;

import de.greenrobot.event.EventBus;
import roboguice.fragment.RoboFragment;

public class BaseFragment extends RoboFragment {
    private boolean isFirstVisit = true;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().post(new NewRelicEvent(getClass().getSimpleName()));
    }

    @Override
    public void onResume() {
        super.onResume();
        if (isFirstVisit) {
            isFirstVisit = false;
        } else {
            onRevisit();
        }
    }

    /**
     * Called when a Fragment is re-displayed to the user (the user has navigated back to it).
     * Defined to mock the behavior of {@link Activity#onRestart() Activity.onRestart} function.
     */
    protected void onRevisit() {
    }
}

Fix 'onRevisit' callback calls wrongly issue.


package <%=packageName%>.web.rest.errors;

import java.util.HashMap;
import java.util.Map;

/**
 * Custom, parameterized exception, which can be translated on the client side.
 * For example:
 *
 *

 * throw new CustomParameterizedException("myCustomError", "hello", "world");
 *

 *
 * Can be translated with:
 *
 *

 * "error.myCustomError" :  "The server says {{param0}} to {{param1}}"
 *

 */
public class CustomParameterizedException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private static final String PARAM = "param";

    private final String message;
    private Map<String, String> paramMap;

    public CustomParameterizedException(String message, String... params) {
        super(message);
        this.message = message;
        if (params != null && params.length > 0) {
            this.paramMap = new HashMap<>();
            for (int i = 0; i < params.length; i++) {
                paramMap.put(PARAM + i, params[i]);
            }
        }
    }

    public CustomParameterizedException(String message, Map<String, String> paramMap) {
        super(message);
        this.message = message;
        this.paramMap = paramMap;
    }

    public ParameterizedErrorVM getErrorVM() {
        return new ParameterizedErrorVM(message, paramMap);
    }

}

package <%=packageName%>.web.rest.errors;

import java.util.HashMap;
import java.util.Map;

/**
 * Custom, parameterized exception, which can be translated on the client side.
 * For example:
 *
 *

 * throw new CustomParameterizedException("myCustomError", "hello", "world");
 *

 *
 * Can be translated with:
 *
 *

 * "error.myCustomError" :  "The server says {{param0}} to {{param1}}"
 *

 */
public class CustomParameterizedException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private static final String PARAM = "param";

    private final String message;

    private final Map<String, String> paramMap = new HashMap<>();

    public CustomParameterizedException(String message, String... params) {
        super(message);
        this.message = message;
        if (params != null && params.length > 0) {
            for (int i = 0; i < params.length; i++) {
                paramMap.put(PARAM + i, params[i]);
            }
        }
    }

    public CustomParameterizedException(String message, Map<String, String> paramMap) {
        super(message);
        this.message = message;
        this.paramMap.putAll(paramMap);
    }

    public ParameterizedErrorVM getErrorVM() {
        return new ParameterizedErrorVM(message, paramMap);
    }
}

Change code to make Sonar happy


/*
 * generated by Xtext
 */
package org.yakindu.base.expressions.ui;

import org.eclipse.ui.plugin.AbstractUIPlugin;

/**
 * Use this class to register components to be used within the IDE.
 */
public class ExpressionsUiModule extends org.yakindu.base.expressions.ui.AbstractExpressionsUiModule {
	public ExpressionsUiModule(AbstractUIPlugin plugin) {
		super(plugin);
	}
}

/*
 * generated by Xtext
 */
package org.yakindu.base.expressions.ui;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.xtext.ui.editor.model.IResourceForEditorInputFactory;
import org.eclipse.xtext.ui.editor.model.JavaClassPathResourceForIEditorInputFactory;
import org.eclipse.xtext.ui.editor.model.ResourceForIEditorInputFactory;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
import org.eclipse.xtext.ui.resource.SimpleResourceSetProvider;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
import org.eclipse.xtext.ui.shared.Access;

/**
 * Use this class to register components to be used within the IDE.
 */
public class ExpressionsUiModule extends org.yakindu.base.expressions.ui.AbstractExpressionsUiModule {
	public ExpressionsUiModule(AbstractUIPlugin plugin) {
		super(plugin);
	}

	public com.google.inject.Provider<org.eclipse.xtext.resource.containers.IAllContainersState> provideIAllContainersState() {
		if (Access.getJdtHelper().get().isJavaCoreAvailable()) {
			return Access.getJavaProjectsState();
		} else {
			return Access.getWorkspaceProjectsState();
		}
	}

	@Override
	public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
		if (Access.getJdtHelper().get().isJavaCoreAvailable()) {
			return XtextResourceSetProvider.class;
		} else {
			return SimpleResourceSetProvider.class;
		}
	}

	@Override
	public Class<? extends IResourceForEditorInputFactory> bindIResourceForEditorInputFactory() {
		if (Access.getJdtHelper().get().isJavaCoreAvailable()) {
			return JavaClassPathResourceForIEditorInputFactory.class;
		} else {
			return ResourceForIEditorInputFactory.class;
		}
	}
}

Check if JST is available


package eu.scasefp7.eclipse.core.handlers;

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;

/**
 * A command handler for exporting all service compositions to the linked ontology.
 *
 * @author themis
 */
public class CompileServiceCompositionsHandler extends CommandExecutorHandler {

	/**
	 * This function is called when the user selects the menu item. It populates the linked ontology.
	 *
	 * @param event the event containing the information about which file was selected.
	 * @return the result of the execution which must be {@code null}.
	 */
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		if (getProjectOfExecutionEvent(event) != null) {
			// executeCommand("eu.scasefp7.eclipse.servicecomposition.commands.exportAllToOntology");
			return null;
		} else {
			throw new ExecutionException("No project selected");
		}
	}

}

package eu.scasefp7.eclipse.core.handlers;

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;

/**
 * A command handler for exporting all service compositions to the linked ontology.
 *
 * @author themis
 */
public class CompileServiceCompositionsHandler extends CommandExecutorHandler {

	/**
	 * This function is called when the user selects the menu item. It populates the linked ontology.
	 *
	 * @param event the event containing the information about which file was selected.
	 * @return the result of the execution which must be {@code null}.
	 */
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		if (getProjectOfExecutionEvent(event) != null) {
			executeCommand("eu.scasefp7.eclipse.servicecomposition.commands.exportAllToOntology");
			return null;
		} else {
			throw new ExecutionException("No project selected");
		}
	}

}

Enable service compositions command to instantiate the linked ontology


/*
 * 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 io.trino.plugin.clickhouse;

import io.trino.plugin.jdbc.BaseJdbcConnectorSmokeTest;
import io.trino.testing.TestingConnectorBehavior;
import org.testng.annotations.Test;

public abstract class BaseClickHouseConnectorSmokeTest
        extends BaseJdbcConnectorSmokeTest
{
    @Override
    protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
    {
        switch (connectorBehavior) {
            case SUPPORTS_DELETE:
                return false;
            default:
                return super.hasBehavior(connectorBehavior);
        }
    }

    // TODO (https://github.com/trinodb/trino/issues/10653) Disable until fixing the flaky test issue
    @Test(enabled = false)
    @Override
    public void testRenameSchema()
    {
        super.testRenameSchema();
    }
}

/*
 * 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 io.trino.plugin.clickhouse;

import io.trino.plugin.jdbc.BaseJdbcConnectorSmokeTest;
import io.trino.testing.TestingConnectorBehavior;
import org.testng.annotations.Test;

public abstract class BaseClickHouseConnectorSmokeTest
        extends BaseJdbcConnectorSmokeTest
{
    @Override
    protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
    {
        switch (connectorBehavior) {
            case SUPPORTS_DELETE:
                return false;
            default:
                return super.hasBehavior(connectorBehavior);
        }
    }

    @Test
    @Override
    public void testRenameSchema()
    {
        super.testRenameSchema();
    }
}

Enable testRenameSchema in ClickHouse smoke test


package replicant;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class ConvergerTest
  extends AbstractReplicantTest
{
  @Test
  public void construct_withUnnecessaryContext()
  {
    final ReplicantContext context = Replicant.context();
    final IllegalStateException exception =
      expectThrows( IllegalStateException.class, () -> Converger.create( context ) );
    assertEquals( exception.getMessage(),
                  "Replicant-0124: SubscriptioConvergernService passed a context but Replicant.areZonesEnabled() is false" );
  }

  @Test
  public void getReplicantContext()
  {
    final ReplicantContext context = Replicant.context();
    final Converger converger = context.getConverger();
    assertEquals( converger.getReplicantContext(), context );
    assertEquals( getFieldValue( converger, "_context" ), null );
  }
}

package replicant;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class ConvergerTest
  extends AbstractReplicantTest
{
  @Test
  public void construct_withUnnecessaryContext()
  {
    final ReplicantContext context = Replicant.context();
    final IllegalStateException exception =
      expectThrows( IllegalStateException.class, () -> Converger.create( context ) );
    assertEquals( exception.getMessage(),
                  "Replicant-0124: SubscriptioConvergernService passed a context but Replicant.areZonesEnabled() is false" );
  }

  @Test
  public void getReplicantContext()
  {
    final ReplicantContext context = Replicant.context();
    final Converger converger = context.getConverger();
    assertEquals( converger.getReplicantContext(), context );
    assertEquals( getFieldValue( converger, "_context" ), null );
  }

  @Test
  public void getReplicantContext_zonesEnabled()
  {
    ReplicantTestUtil.enableZones();
    ReplicantTestUtil.resetState();

    final ReplicantContext context = Replicant.context();
    final Converger converger = context.getConverger();
    assertEquals( converger.getReplicantContext(), context );
    assertEquals( getFieldValue( converger, "_context" ), context );
  }
}

Add test for getReplicantContext with zones enabled


package bwyap.familyfeud.game.fastmoney.state;

/**
 * States in a family feud game whilst playing Fast Money
 * @author bwyap
 *
 */
public enum FFFastMoneyStateType {
	// TODO
	;

	private String name;

	private FFFastMoneyStateType(String name) {
		this.name = name;
	}

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

package bwyap.familyfeud.game.fastmoney.state;

/**
 * States in a family feud game whilst playing Fast Money
 * @author bwyap
 *
 */
public enum FFFastMoneyStateType {

	P1_ANSWER("p1 answer"),
	P1_REVEAL("p1 reveal"),
	P2_ANSWER("p2 answer"),
	P2_REVEAL("p2 reveal");

	private String name;

	private FFFastMoneyStateType(String name) {
		this.name = name;
	}

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

Add Fast Money state types


/*
Copyright 2011-2017 Frederic Langlet
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 kanzi.test;

import kanzi.util.sort.BucketSort;
import org.junit.Assert;
import org.junit.Test;

public class TestBucketSort extends TestAbstractSort
{
    @Test
    public void testBucketSort()
    {
        Assert.assertTrue(testCorrectness("BucketSort", new BucketSort(8), 20));
        testSpeed("BucketSort", new BucketSort(16), 20000, 0xFFFF);
    }
}

/*
Copyright 2011-2017 Frederic Langlet
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 kanzi.test;

import kanzi.util.sort.BucketSort;
import org.junit.Assert;
import org.junit.Test;

public class TestBucketSort extends TestAbstractSort
{
    @Test
    public void testBucketSort()
    {
        Assert.assertTrue(testCorrectness("BucketSort", new BucketSort(8), 20));
        testSpeed("BucketSort", new BucketSort(16), 10000, 0xFFFF);
    }
}

Speed up test by reducing iterations.


package com.opnitech.rules.core.test.engine.test_validators;

import org.junit.Test;

import com.opnitech.rules.core.test.engine.AbstractRuleEngineExecutorTest;
import com.opnitech.rules.core.test.engine.test_validators.group.InvalidGroupDefinition;
import com.opnitech.rules.core.test.engine.test_validators.group.ValidGroupDefinition;
import com.opnitech.rules.core.test.engine.test_validators.rules.group.InvalidGroupRule;
import com.opnitech.rules.core.test.engine.test_validators.rules.group.ValidGroupRule;

/**
 * @author Rigre Gregorio Garciandia Sonora
 */
public class GroupRuleValidatorTest extends AbstractRuleEngineExecutorTest {

    @Test
    public void testValidRule() throws Exception {

        // Group need to be defined
        validateRule(ValidGroupDefinition.class, new ValidGroupRule());
    }

    @Test
    public void testValidRuleButNoGroupDefinition() throws Exception {

        // Group need to be defined
        validateExceptionRule(new ValidGroupRule());
    }

    @Test
    public void testInvalidRuleButNoGroupDefinition() throws Exception {

        validateExceptionRule(new InvalidGroupRule());
    }

    @Test
    public void testInvalidRule() throws Exception {

        validateExceptionRule(InvalidGroupDefinition.class, new InvalidGroupRule());
    }
}

package com.opnitech.rules.core.test.engine.test_validators;

import org.junit.Test;

import com.opnitech.rules.core.test.engine.AbstractRuleEngineExecutorTest;
import com.opnitech.rules.core.test.engine.test_validators.group.InvalidGroupDefinition;
import com.opnitech.rules.core.test.engine.test_validators.group.ValidGroupDefinition;
import com.opnitech.rules.core.test.engine.test_validators.rules.group.InvalidGroupRule;
import com.opnitech.rules.core.test.engine.test_validators.rules.group.ValidGroupRule;

/**
 * @author Rigre Gregorio Garciandia Sonora
 */
public class GroupRuleValidatorTest extends AbstractRuleEngineExecutorTest {

    @Test
    public void testValidRule() throws Exception {

        // Group need to be defined
        validateRule(ValidGroupDefinition.class, new ValidGroupRule());
    }

    @Test
    public void testValidRuleButNoGroupDefinition() throws Exception {

        // Group need to be defined
        validateRule(new ValidGroupRule());
    }

    @Test
    public void testInvalidRuleButNoGroupDefinition() throws Exception {

        validateExceptionRule(new InvalidGroupRule());
    }

    @Test
    public void testInvalidRule() throws Exception {

        validateExceptionRule(InvalidGroupDefinition.class, new InvalidGroupRule());
    }
}

Fix some unit test after the implementation allowing grouped rules without the group definition declared as executable


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

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

public class AssertJava {
    private static TreeSet<JavaVersion> SUPPORTED_VERSIONS = new TreeSet<>(Arrays.asList(
            JavaVersion.VERSION_11,
            JavaVersion.VERSION_12,
            JavaVersion.VERSION_13,
            JavaVersion.VERSION_14
    ));

    public static void assertVMVersion() {
        checkSupported(JavaVersion.current());
    }

    private static void checkSupported(JavaVersion currentJavaVersion) {
        if (!SUPPORTED_VERSIONS.contains(currentJavaVersion)) {
            System.err.println("Running GoCD requires Java version >= " + SUPPORTED_VERSIONS.first().name() +
                    " and <= " + SUPPORTED_VERSIONS.last() +
                    ". You are currently running with Java version " + currentJavaVersion + ". GoCD will now exit!");
            System.exit(1);
        }
    }
}

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

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

public class AssertJava {
    private static TreeSet<JavaVersion> SUPPORTED_VERSIONS = new TreeSet<>(Arrays.asList(
            JavaVersion.VERSION_11,
            JavaVersion.VERSION_12,
            JavaVersion.VERSION_13,
            JavaVersion.VERSION_14,
            JavaVersion.VERSION_15
    ));

    public static void assertVMVersion() {
        checkSupported(JavaVersion.current());
    }

    private static void checkSupported(JavaVersion currentJavaVersion) {
        if (!SUPPORTED_VERSIONS.contains(currentJavaVersion)) {
            System.err.println("Running GoCD requires Java version >= " + SUPPORTED_VERSIONS.first().name() +
                    " and <= " + SUPPORTED_VERSIONS.last() +
                    ". You are currently running with Java version " + currentJavaVersion + ". GoCD will now exit!");
            System.exit(1);
        }
    }
}

Allow JDK 15 in prep for 20.9.0


package io.cucumber.junit;

import io.cucumber.core.exception.CucumberException;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

final class Assertions {
    private Assertions() {
    }

    static void assertNoCucumberAnnotatedMethods(Class clazz) {
        for (Method method : clazz.getDeclaredMethods()) {
            for (Annotation annotation : method.getAnnotations()) {
                if (annotation.annotationType().getName().startsWith("cucumber") //TODO: Remove once migrated
                 || annotation.annotationType().getName().startsWith("io.cucumber")) {
                    throw new CucumberException(
                            "\n\n" +
                                    "Classes annotated with @RunWith(Cucumber.class) must not define any\n" +
                                    "Step Definition or Hook methods. Their sole purpose is to serve as\n" +
                                    "an entry point for JUnit. Step Definitions and Hooks should be defined\n" +
                                    "in their own classes. This allows them to be reused across features.\n" +
                                    "Offending class: " + clazz + "\n"
                    );
                }
            }
        }
    }
}

package io.cucumber.junit;

import io.cucumber.core.exception.CucumberException;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

final class Assertions {
    private Assertions() {
    }

    static void assertNoCucumberAnnotatedMethods(Class clazz) {
        for (Method method : clazz.getDeclaredMethods()) {
            for (Annotation annotation : method.getAnnotations()) {
                if (annotation.annotationType().getName().startsWith("io.cucumber")) {
                    throw new CucumberException(
                            "\n\n" +
                                    "Classes annotated with @RunWith(Cucumber.class) must not define any\n" +
                                    "Step Definition or Hook methods. Their sole purpose is to serve as\n" +
                                    "an entry point for JUnit. Step Definitions and Hooks should be defined\n" +
                                    "in their own classes. This allows them to be reused across features.\n" +
                                    "Offending class: " + clazz + "\n"
                    );
                }
            }
        }
    }
}

Remove cucumber.api glue annotation check


package net.glowstone.scoreboard;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.glowstone.net.message.play.scoreboard.ScoreboardScoreMessage;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
import org.bukkit.scoreboard.Scoreboard;

/**
 * Implementation/data holder for Scores.
 */
@RequiredArgsConstructor
public final class GlowScore implements Score {

    @Getter
    private final GlowObjective objective;
    @Getter
    private final String entry;
    private int score;
    @Getter
    @Setter
    private boolean locked;

    @Override
    public Scoreboard getScoreboard() {
        return objective.getScoreboard();
    }

    @Override
    @Deprecated
    public OfflinePlayer getPlayer() {
        return Bukkit.getOfflinePlayer(entry);
    }

    @Override
    public int getScore() throws IllegalStateException {
        objective.checkValid();
        return score;
    }

    /**
     * Sets this score's value.
     * @param score the new value
     * @throws IllegalStateException if the objective is not registered on a scoreboard
     */
    @Override
    public void setScore(int score) throws IllegalStateException {
        objective.checkValid();
        this.score = score;
        objective.getScoreboard()
            .broadcast(new ScoreboardScoreMessage(entry, objective.getName(), score));
    }

    @Override
    public boolean isScoreSet() throws IllegalStateException {
        objective.checkValid();
        return objective.getScoreboard().getScores(entry).contains(this);
    }
}

package net.glowstone.scoreboard;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.glowstone.net.message.play.scoreboard.ScoreboardScoreMessage;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
import org.bukkit.scoreboard.Scoreboard;

/**
 * Implementation/data holder for Scores.
 */
@RequiredArgsConstructor
public final class GlowScore implements Score {

    @Getter
    private final GlowObjective objective;
    @Getter
    private final String entry;
    private int score;
    @Setter
    private boolean locked;

    @Override
    public Scoreboard getScoreboard() {
        return objective.getScoreboard();
    }

    @Override
    @Deprecated
    public OfflinePlayer getPlayer() {
        return Bukkit.getOfflinePlayer(entry);
    }

    @Override
    public int getScore() throws IllegalStateException {
        objective.checkValid();
        return score;
    }

    /**
     * Sets this score's value.
     * @param score the new value
     * @throws IllegalStateException if the objective is not registered on a scoreboard
     */
    @Override
    public void setScore(int score) throws IllegalStateException {
        objective.checkValid();
        this.score = score;
        objective.getScoreboard()
            .broadcast(new ScoreboardScoreMessage(entry, objective.getName(), score));
    }

    @Override
    public boolean isScoreSet() throws IllegalStateException {
        objective.checkValid();
        return objective.getScoreboard().getScores(entry).contains(this);
    }

    public boolean getLocked() {
        return locked;
    }
}

Revert getLocked (Lombokified name was isLocked)


package com.java.laiy;

import com.java.laiy.controller.Game;
import com.java.laiy.controller.GameController;
import com.java.laiy.model.Board;
import com.java.laiy.model.Figure;
import com.java.laiy.model.Player;
import com.java.laiy.view.ConsoleView;

public class Main {

    public static void main(final String[] args) {
        final String GAME_NAME = "XO";
        final Board board = new Board();
        final Player[] players = new Player[2];
        players[0] = new Player("Xonstantin", Figure.X);
        players[1] = new Player("Oleg", Figure.O);
        final GameController gameController = new GameController(GAME_NAME, players, board);
        final ConsoleView consoleView = new ConsoleView(gameController);
        final Game game = new Game(consoleView,gameController);

        game.theGame();
    }

}

package com.java.laiy;

import com.java.laiy.view.ConsoleMenuView;

public class Main {

    public static void main(final String[] args) {
        ConsoleMenuView.showMenuWithResult();
    }

}

Move game start and settings to MenuView, MenuView renamed in ConsoleMenuView


package bj.pranie.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * Created by noon on 13.10.16.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
        http.authorizeRequests()
                .antMatchers("/", "/week" ,"/week/*", "/wm/*", "/user/registration", "/user/restore", "/images/*", "/js/*").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/")
                .permitAll()
                .and()
                .logout()
                .permitAll();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication()
                .withUser("admin").password("admin").roles("USER");
    }
}

package bj.pranie.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * Created by noon on 13.10.16.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
        http.authorizeRequests()
                .antMatchers("/", "/week" ,"/week/*", "/wm/*/*", "/user/registration", "/user/restore", "/images/*", "/js/*").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/")
                .permitAll()
                .and()
                .logout()
                .permitAll();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication()
                .withUser("admin").password("admin").roles("USER");
    }
}

Change path to site no requested authorization.


package info.sleeplessacorn.nomagi.client;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Loader;

/**
 * Used for blocks that implement the Chisel CTM format
 *
 * When Chisel is not loaded, a secondary blockstate file, with {@code _noctm} appended, is used instead.
 */
public class StateMapperNoCTM extends StateMapperBase {

    @Override
    protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
        ResourceLocation location = state.getBlock().getRegistryName();
        if (!Loader.isModLoaded("chisel"))
            location = new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + "_noctm");

        return new ModelResourceLocation(location, getPropertyString(state.getProperties()));
    }
}

package info.sleeplessacorn.nomagi.client;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Loader;

/**
 * Used for blocks that implement the Chisel CTM format
 *
 * When neither Chisel nor ConnectedTexturesMod are loaded, a secondary blockstate file, with {@code _noctm} appended, is used instead.
 */
public class StateMapperNoCTM extends StateMapperBase {

    @Override
    protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
        ResourceLocation location = state.getBlock().getRegistryName();
        if (!Loader.isModLoaded("chisel") || !Loader.isModLoaded("ctm"))
            location = new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + "_noctm");

        return new ModelResourceLocation(location, getPropertyString(state.getProperties()));
    }
}

Update CTM statemapper to check for ConnectedTexturesMod


/*
 * ToroDB
 * Copyright © 2014 8Kdata Technology (www.8kdata.com)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package com.torodb.packaging.config.validation;

import com.torodb.packaging.config.model.protocol.mongo.AbstractReplication;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class MutualExclusiveReplSetOrShardsValidator implements
    ConstraintValidator<MutualExclusiveReplSetOrShards, AbstractReplication> {

  @Override
  public void initialize(MutualExclusiveReplSetOrShards constraintAnnotation) {
  }

  @Override
  public boolean isValid(AbstractReplication value, ConstraintValidatorContext context) {
    if ((value.getShardList() != null && !value.getShardList().isEmpty())
        && (value.getReplSetName().notDefault() || value.getSyncSource().notDefault())) {
      return false;
    }

    return true;
  }
}

/*
 * ToroDB
 * Copyright © 2014 8Kdata Technology (www.8kdata.com)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package com.torodb.packaging.config.validation;

import com.torodb.packaging.config.model.protocol.mongo.AbstractReplication;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class MutualExclusiveReplSetOrShardsValidator implements
    ConstraintValidator<MutualExclusiveReplSetOrShards, AbstractReplication<?>> {

  @Override
  public void initialize(MutualExclusiveReplSetOrShards constraintAnnotation) {
  }

  @Override
  public boolean isValid(AbstractReplication<?> value, ConstraintValidatorContext context) {
    if ((value.getShardList() != null && !value.getShardList().isEmpty())
        && value.getSyncSource().notDefault()) {
      return false;
    }

    return true;
  }
}

Allow a commond replSetName for all shards


package net.stickycode.configured.finder;

import static org.fest.assertions.Assertions.assertThat;

import org.junit.Test;

public abstract class AbstractBeanFinderTest {

  protected abstract BeanFinder getFinder();

  @Test
  public void lookupPrototype() {
    Bean bean = getFinder().find(Bean.class);
    assertThat(bean).isNotNull();
    Bean bean2 = getFinder().find(Bean.class);
    assertThat(bean).isNotSameAs(bean2);
  }

  @Test
  public void lookupSingleton() {
    BeanFinder finder = getFinder();
    SingletonBean bean = finder.find(SingletonBean.class);
    assertThat(bean).isNotNull();
    SingletonBean bean2 = finder.find(SingletonBean.class);
    assertThat(bean).isSameAs(bean2);
  }

  @Test(expected = BeanNotFoundException.class)
  public void notFound() {
    getFinder().find(getClass());
  }

  @Test
  // (expected = BeanNotFoundException.class)
  public void tooMany() {
    getFinder().find(TooMany.class);
  }
}

package net.stickycode.configured.finder;

import static org.fest.assertions.Assertions.assertThat;

import org.junit.Test;

public abstract class AbstractBeanFinderTest {

  protected abstract BeanFinder getFinder();

  @Test
  public void lookupPrototype() {
    Bean bean = getFinder().find(Bean.class);
    assertThat(bean).isNotNull();
    Bean bean2 = getFinder().find(Bean.class);
    assertThat(bean).isNotSameAs(bean2);
  }

  @Test
  public void lookupSingleton() {
    BeanFinder finder = getFinder();
    SingletonBean bean = finder.find(SingletonBean.class);
    assertThat(bean).isNotNull();
    SingletonBean bean2 = finder.find(SingletonBean.class);
    assertThat(bean).isSameAs(bean2);
  }

  @Test(expected = BeanNotFoundException.class)
  public void notFound() {
    getFinder().find(getClass());
  }

  @Test(expected = BeanNotFoundException.class)
  public void tooMany() {
    getFinder().find(TooMany.class);
  }
}

Enable the correct exception check on the test, was disabled when inspecting the contents of the exception


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

public class JobCompletedConfigServiceURLBuilderImpl implements ServiceURLBuilder {

	public String build(String ... parameters) {
		// parameters[0] = baseUrl, parameters[1] = jobID
		// {historyUrl}/jobhistory/conf/job_xxxxxxxxxxxxx_xxxxxx
		return parameters[0] + "jobhistory/conf/" + parameters[1];
	}
}

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

import org.apache.eagle.jobrunning.common.JobConstants;

public class JobCompletedConfigServiceURLBuilderImpl implements ServiceURLBuilder {

	public String build(String ... parameters) {
		// parameters[0] = baseUrl, parameters[1] = jobID
		// {historyUrl}/jobhistory/conf/job_xxxxxxxxxxxxx_xxxxxx
		return parameters[0] + "jobhistory/conf/" + parameters[1]
				+ "?" + JobConstants.ANONYMOUS_PARAMETER;
	}
}

Add a missing anonymous parameter in hive running spout


package com.intellij.find.findUsages;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.usageView.UsageViewUtil;

import javax.swing.*;

/**
 * Created by IntelliJ IDEA.
 * User: max
 * Date: Feb 14, 2005
 * Time: 5:40:05 PM
 * To change this template use File | Settings | File Templates.
 */
public class CommonFindUsagesDialog extends AbstractFindUsagesDialog {
  private PsiElement myPsiElement;

  public CommonFindUsagesDialog(PsiElement element,
                                Project project,
                                FindUsagesOptions findUsagesOptions,
                                boolean toShowInNewTab,
                                boolean mustOpenInNewTab,
                                boolean isSingleFile) {
    super(project, findUsagesOptions, toShowInNewTab, mustOpenInNewTab, isSingleFile,
          FindUsagesUtil.isSearchForTextOccurencesAvailable(element, isSingleFile), !isSingleFile && !element.getManager().isInProject(element));
    myPsiElement = element;
  }

  protected JPanel createFindWhatPanel() {
    return null;
  }

  protected JComponent getPreferredFocusedControl() {
    return null;
  }

  public String getLabelText() {
    return StringUtil.capitalize(UsageViewUtil.getType(myPsiElement)) + " " + UsageViewUtil.getDescriptiveName(myPsiElement);
  }
}

package com.intellij.find.findUsages;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.usageView.UsageViewUtil;

import javax.swing.*;

/**
 * Created by IntelliJ IDEA.
 * User: max
 * Date: Feb 14, 2005
 * Time: 5:40:05 PM
 * To change this template use File | Settings | File Templates.
 */
public class CommonFindUsagesDialog extends AbstractFindUsagesDialog {
  private PsiElement myPsiElement;

  public CommonFindUsagesDialog(PsiElement element,
                                Project project,
                                FindUsagesOptions findUsagesOptions,
                                boolean toShowInNewTab,
                                boolean mustOpenInNewTab,
                                boolean isSingleFile) {
    super(project, findUsagesOptions, toShowInNewTab, mustOpenInNewTab, isSingleFile,
          FindUsagesUtil.isSearchForTextOccurencesAvailable(element, isSingleFile), !isSingleFile && !element.getManager().isInProject(element));
    myPsiElement = element;
    init();
  }

  protected JPanel createFindWhatPanel() {
    return null;
  }

  protected JComponent getPreferredFocusedControl() {
    return null;
  }

  public String getLabelText() {
    return StringUtil.capitalize(UsageViewUtil.getType(myPsiElement)) + " " + UsageViewUtil.getDescriptiveName(myPsiElement);
  }
}

Fix non-java find usages dialogs.


// Copyright 2019 Google LLC
//
// 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
//
//     https://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.google.sps.servlets;

import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/** Servlet that takes in audio stream and retrieves
 ** user input string to display. */

@WebServlet("/audio-input")
public class AudioInputServlet extends HttpServlet {

  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    response.setContentType("text/html;");
    response.getWriter().println("
Hello world!
");
  }
}

// Copyright 2019 Google LLC
//
// 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
//
//     https://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.google.sps.servlets;
import java.util.*;

import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/** Servlet that takes in audio stream and retrieves
 ** user input string to display. */

@WebServlet("/audio-input")
public class AudioInputServlet extends HttpServlet {

  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    Object formdata = request.getParameter("file");
    System.out.println(formdata);
    System.out.println("Got to servlet");
    //response.setContentType("text/html;");
    //response.getWriter().println("
Hello world!
");
  }
}

Add get retrieval of FormData


package uk.co.alynn.games.ld30.world;

public abstract class Invader implements Adversary {

    private final float m_x, m_y;

    public Invader(float x, float y) {
        m_x = x;
        m_y = y;
    }

    @Override
    public String getImage() {
        return "invader";
    }

    @Override
    public float getX() {
        return m_x;
    }

    @Override
    public float getY() {
        return m_y;
    }

    abstract public Adversary update(float dt);

    @Override
    public Adversary hitPlayer(Runnable terminateGame) {
        return this;
    }

    @Override
    public Adversary hitBullet() {
        return null;
    }

    @Override
    public float getHeading() {
        return 0.0f;
    }

}

package uk.co.alynn.games.ld30.world;

public abstract class Invader implements Adversary {

    private final float m_x, m_y;

    public Invader(float x, float y) {
        m_x = x;
        m_y = y;
    }

    @Override
    public String getImage() {
        return "invader";
    }

    @Override
    public float getX() {
        return m_x;
    }

    @Override
    public float getY() {
        return m_y;
    }

    abstract public Adversary update(float dt);

    @Override
    public Adversary hitPlayer(Runnable terminateGame) {
        terminateGame.run();
        return null;
    }

    @Override
    public Adversary hitBullet() {
        return null;
    }

    @Override
    public float getHeading() {
        return 0.0f;
    }

}

Make collisions with invaders destroy the player


package com.xdrop.passlock.core;
import org.apache.commons.codec.binary.Base64;

import com.xdrop.passlock.crypto.EncryptionModel;
import com.xdrop.passlock.crypto.aes.AESEncryptionData;
import com.xdrop.passlock.crypto.aes.AESEncryptionModel;
import com.xdrop.passlock.datasource.Datasource;
import com.xdrop.passlock.datasource.sqlite.SQLiteAESDatasource;
import com.xdrop.passlock.model.EncryptionData;
import com.xdrop.passlock.model.PasswordEntry;
import com.xdrop.passlock.utils.ByteUtils;

public class PasswordManager {

    public void addPassword(String description, char[] newPassword, String reference){

        EncryptionModel<AESEncryptionData> encryptionModel = new AESEncryptionModel();

        AESEncryptionData encryptionData = encryptionModel.encrypt(ByteUtils.getBytes(newPassword), pass.toCharArray());

        PasswordEntry<AESEncryptionData> passwordEntry = new PasswordEntry<>();
        passwordEntry.setDescription(description);
        passwordEntry.setRef(reference);
        passwordEntry.setEncryptionData(encryptionData);

        Datasource<AESEncryptionData> datasource = new SQLiteAESDatasource();
        datasource.addPass(reference, passwordEntry);

        byte[] b64 = Base64.encodeBase64(encryptionData.getEncryptedPayload());

        System.out.println(new String(b64));

    }

}

package com.xdrop.passlock.core;
import org.apache.commons.codec.binary.Base64;

import com.xdrop.passlock.crypto.EncryptionModel;
import com.xdrop.passlock.crypto.aes.AESEncryptionData;
import com.xdrop.passlock.crypto.aes.AESEncryptionModel;
import com.xdrop.passlock.datasource.Datasource;
import com.xdrop.passlock.datasource.sqlite.SQLiteAESDatasource;
import com.xdrop.passlock.model.EncryptionData;
import com.xdrop.passlock.model.PasswordEntry;
import com.xdrop.passlock.utils.ByteUtils;

public class PasswordManager {

    public void addPassword(String description, char[] newPassword, char[] masterPass, String reference){

        EncryptionModel<AESEncryptionData> encryptionModel = new AESEncryptionModel();

        AESEncryptionData encryptionData = encryptionModel.encrypt(ByteUtils.getBytes(newPassword), masterPass);

        PasswordEntry<AESEncryptionData> passwordEntry = new PasswordEntry<>();
        passwordEntry.setDescription(description);
        passwordEntry.setRef(reference);
        passwordEntry.setEncryptionData(encryptionData);

        Datasource<AESEncryptionData> datasource = new SQLiteAESDatasource();
        datasource.addPass(reference, passwordEntry);

        byte[] b64 = Base64.encodeBase64(encryptionData.getEncryptedPayload());

        System.out.println(new String(b64));

    }

}

Fix issue with missing var


package org.ethereum.config.net;

import org.ethereum.config.blockchain.FrontierConfig;

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class TestNetConfig extends AbstractNetConfig {
    public TestNetConfig() {
        add(0, new FrontierConfig());
    }
}

package org.ethereum.config.net;

import org.ethereum.config.blockchain.FrontierConfig;
import org.ethereum.config.blockchain.HomesteadConfig;

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class TestNetConfig extends AbstractNetConfig {
    public TestNetConfig() {
        add(0, new FrontierConfig());
        add(1_150_000, new HomesteadConfig());
    }
}

Switch testnet config to Homestead


public interface MatrixInterface {
	// boolean modify means function returns the modified matrix
	// no boolean modify means function returns a new matrix

	// matrix addition
	public Matrix m_add(Matrix m);

	public Matrix m_add(Matrix m, boolean modify);

	// matrix multiplication
	public Matrix m_multiply(Matrix m);

	public Matrix m_multiply(Matrix m, boolean modify);

	// transpose matrix
	public Matrix m_transpose(Matrix m);

	public Matrix m_transpose(Matrix m, boolean modify);

	// change element in matrix
	public void m_edit(double[][] a1);

}

public interface MatrixInterface {
	// boolean modify means function returns the modified matrix
	// no boolean modify means function returns a new matrix

	// matrix addition
	public Matrix add(Matrix m);

	public Matrix add(Matrix m, boolean modify);

	// matrix multiplication
	public Matrix multiply(Matrix m);

	public Matrix multiply(Matrix m, boolean modify);

	// transpose matrix
	public Matrix transpose(Matrix m);

	public Matrix transpose(Matrix m, boolean modify);

	// change element in matrix
	public double[][] edit();

}

Fix method names and change edit


/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.hod.client.api.textindex;

/**
 * Enum type representing the possible options for the index flavor parameter
 */
public enum IndexFlavor {
    standard,
    explorer,
    categorization,
    custom_fields,
    web_cloud,
    querymanipulation
}

/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.hod.client.api.textindex;

/**
 * Enum type representing the possible options for the index flavor parameter
 */
public enum IndexFlavor {
    standard,
    explorer,
    categorization,
    custom_fields,
    querymanipulation
}

Remove web_cloud as it can't be used to create a text index


package com.microsoft.azure.documentdb.sample.dao;

import com.microsoft.azure.documentdb.ConnectionPolicy;
import com.microsoft.azure.documentdb.ConsistencyLevel;
import com.microsoft.azure.documentdb.DocumentClient;

public class DocumentClientFactory {
    private static final String HOST = "https://docdb-java-sample.documents.azure.com:443/";
    private static final String MASTER_KEY = "[YOUR_KEY_HERE]";

    private static DocumentClient documentClient;

    public static DocumentClient getDocumentClient() {
        if (documentClient == null) {
            documentClient = new DocumentClient(HOST, MASTER_KEY,
                    ConnectionPolicy.GetDefault(), ConsistencyLevel.Session);
        }

        return documentClient;
    }

}

package com.microsoft.azure.documentdb.sample.dao;

import com.microsoft.azure.documentdb.ConnectionPolicy;
import com.microsoft.azure.documentdb.ConsistencyLevel;
import com.microsoft.azure.documentdb.DocumentClient;

public class DocumentClientFactory {
    private static final String HOST = "https://docdb-java-sample.documents.azure.com:443/";
    private static final String MASTER_KEY = "[YOUR_KEY_HERE]";

    private static DocumentClient documentClient = new DocumentClient(HOST, MASTER_KEY,
            ConnectionPolicy.GetDefault(), ConsistencyLevel.Session);

    public static DocumentClient getDocumentClient() {
        return documentClient;
    }

}

Load DocumentDB client at class-load time


package com.fabiohideki.socialbooks.resources;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.fabiohideki.socialbooks.domain.Livro;
import com.fabiohideki.socialbooks.repository.LivrosRepository;

@RestController
@RequestMapping("/livros")
public class LivrosResources {

	@Autowired
	private LivrosRepository livrosRepository;

	@RequestMapping(method = RequestMethod.GET)
	public List<Livro> listar() {
		return livrosRepository.findAll();
	}

	@RequestMapping(method = RequestMethod.POST)
	public void salvar(@RequestBody Livro livro) {
		livrosRepository.save(livro);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public Livro buscar(@PathVariable Long id) {
		return livrosRepository.findOne(id);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
	public void deletar(@PathVariable Long id) {
		livrosRepository.delete(id);
	}

}

package com.fabiohideki.socialbooks.resources;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.fabiohideki.socialbooks.domain.Livro;
import com.fabiohideki.socialbooks.repository.LivrosRepository;

@RestController
@RequestMapping("/livros")
public class LivrosResources {

	@Autowired
	private LivrosRepository livrosRepository;

	@RequestMapping(method = RequestMethod.GET)
	public List<Livro> listar() {
		return livrosRepository.findAll();
	}

	@RequestMapping(method = RequestMethod.POST)
	public void salvar(@RequestBody Livro livro) {
		livrosRepository.save(livro);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public Livro buscar(@PathVariable("id") Long id) {
		return livrosRepository.findOne(id);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
	public void deletar(@PathVariable("id") Long id) {
		livrosRepository.delete(id);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
	public void atualizar(@RequestBody Livro livro, @PathVariable("id") Long id) {
		livro.setId(id);
		livrosRepository.save(livro);
	}

}

PUT para atualizar o recurso Livro


package edu.washington.escience.myriad;

/**
 * This class holds the constants for the Myria execution.
 *
 * @author dhalperi
 *
 */
public final class MyriaConstants {
  /** Private constructor to disallow building utility class. */
  private MyriaConstants() {
  }

  /** The identity of the master worker is current always zero. */
  public static final Integer MASTER_ID = Integer.valueOf(0);

}

package edu.washington.escience.myriad;

/**
 * This class holds the constants for the Myria execution.
 *
 * @author dhalperi
 *
 */
public final class MyriaConstants {
  /** Private constructor to disallow building utility class. */
  private MyriaConstants() {
  }

  /** The identity of the master worker is current always zero. */
  public static final int MASTER_ID = 0;

  public static final String SYSTEM_NAME = "Myria";

}

Move some more constants here


package pokefenn.totemic.init;

import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.registries.ObjectHolder;
import pokefenn.totemic.Totemic;
import pokefenn.totemic.tile.totem.TileTotemBase;

@ObjectHolder(Totemic.MOD_ID)
public final class ModTileEntities {
    public static final TileEntityType<TileTotemBase> totem_base = null;

    @SubscribeEvent
    public static void init(RegistryEvent.Register<TileEntityType<?>> event) {
        event.getRegistry().registerAll(
            TileEntityType.Builder.create(TileTotemBase::new).build(null).setRegistryName("totem_base")
        );
    }
}

package pokefenn.totemic.init;

import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.registries.ObjectHolder;
import pokefenn.totemic.Totemic;
import pokefenn.totemic.tile.totem.TileTotemBase;

@ObjectHolder(Totemic.MOD_ID)
public final class ModTileEntities {
    public static final TileEntityType<TileTotemBase> totem_base = null;

    @SubscribeEvent
    public static void init(RegistryEvent.Register<TileEntityType<?>> event) {
        event.getRegistry().registerAll(
            TileEntityType.Builder.create(TileTotemBase::new, ModBlocks.getTotemBases().values().toArray(new Block[0])).build(null).setRegistryName("totem_base")
        );
    }
}

Fix invalid tile entity error


package tutorial.storm.trident;

import backtype.storm.generated.DRPCExecutionException;
import backtype.storm.utils.DRPCClient;
import org.apache.thrift7.TException;

/**
 * @author Enno Shioji (eshioji@gmail.com)
 */
public class DrpcTestClient {
    public static void main(String[] args) throws TException, DRPCExecutionException {
        DRPCClient cl = new DRPCClient("localhost",3772, 3000);
        System.out.println(cl.execute("ping", "ted"));

    }
}

package tutorial.storm.trident;

import backtype.storm.generated.DRPCExecutionException;
import backtype.storm.utils.DRPCClient;
import org.apache.thrift7.TException;

/**
 * @author Enno Shioji (eshioji@gmail.com)
 */
public class DrpcTestClient {
    public static void main(String[] args) throws TException, DRPCExecutionException {
        DRPCClient cl = new DRPCClient("localhost",3772, 3000);
        if (args.length != 2){
            System.err.println("<functionName> <arguments>");
        }else{
            String func = args[0];
            String argument = args[1];
            System.out.println(cl.execute(func, argument));
        }

    }
}

Generalize the test DRPC client


/*
 * 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.
 */

@Version("2.3")
package org.apache.sling.api.resource;

import aQute.bnd.annotation.Version;

/*
 * 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.
 */

@Version("2.3.2")
package org.apache.sling.api.resource;

import aQute.bnd.annotation.Version;

Update package version because of SLING-2844 and SLING-2845


package com.nelsonjrodrigues.pchud.net;

import static java.lang.Byte.toUnsignedInt;

public class Extractor {

    private byte[] buffer;
    private int offset;
    private int length;

    public Extractor(byte[] buffer, int offset, int length) {
        this.buffer = buffer;
        this.offset = offset;
        this.length = length;
    }

    public int u8() {
        if (offset > length) {
            throw new ArrayIndexOutOfBoundsException();
        }
        return toUnsignedInt(buffer[offset++]);
    }

    public int u16() {
        return u8() ^
               u8() << 8;
    }

    public float f32() {
        return Float.intBitsToFloat(u8() ^
                                    u8() << 8 ^
                                    u8() << 16 ^
                                    u8() << 24);
    }

}

package com.nelsonjrodrigues.pchud.net;

public class Extractor {

    private byte[] buffer;
    private int offset;
    private int length;

    public Extractor(byte[] buffer, int offset, int length) {
        this.buffer = buffer;
        this.offset = offset;
        this.length = length;
    }

    public int u8() {
        if (offset > length) {
            throw new ArrayIndexOutOfBoundsException();
        }
        return Byte.toUnsignedInt(buffer[offset++]);
    }

    public int u16() {
        return u8() ^
               u8() << 8;
    }

    public float f32() {
        return Float.intBitsToFloat(u8() ^
                                    u8() << 8 ^
                                    u8() << 16 ^
                                    u8() << 24);
    }

}

Remove static import, code is more readable like this


/*
 * This file is provided 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.basho.riak.client.raw.itest;

import java.io.IOException;

import com.basho.riak.client.http.Hosts;
import com.basho.riak.client.raw.RawClient;
import com.basho.riak.client.raw.http.HTTPClientConfig;
import com.basho.riak.client.raw.http.HTTPRiakClientFactory;

/**
 * @author russell
 *
 */
public class ITestHTTPClientAdapter extends ITestRawClientAdapter {

    /*
     * (non-Javadoc)
     *
     * @see com.basho.riak.client.raw.itest.ITestRawClientAdapter#getClient()
     */
    @Override protected RawClient getClient() throws IOException {
        HTTPClientConfig config = new HTTPClientConfig.Builder().withHost(Hosts.RIAK_HOST).build();
        return HTTPRiakClientFactory.getInstance().newClient(config);
    }

}

/*
 * This file is provided 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.basho.riak.client.raw.itest;

import java.io.IOException;

import com.basho.riak.client.http.Hosts;
import com.basho.riak.client.raw.RawClient;
import com.basho.riak.client.raw.http.HTTPClientConfig;
import com.basho.riak.client.raw.http.HTTPRiakClientFactory;

/**
 * @author russell
 *
 */
public class ITestHTTPClientAdapter extends ITestRawClientAdapter {

    /*
     * (non-Javadoc)
     *
     * @see com.basho.riak.client.raw.itest.ITestRawClientAdapter#getClient()
     */
    @Override protected RawClient getClient() throws IOException {
        HTTPClientConfig config = new HTTPClientConfig.Builder().withUrl(Hosts.RIAK_URL).build();
        return HTTPRiakClientFactory.getInstance().newClient(config);
    }

}

Add URL config to HTTP client adapter itest


package com.cflint.plugins.core;

import ro.fortsoft.pf4j.Extension;
import cfml.parsing.cfscript.CFFunctionExpression;
import cfml.parsing.cfscript.script.CFAbortStatement;
import cfml.parsing.cfscript.script.CFExpressionStatement;
import cfml.parsing.cfscript.script.CFScriptStatement;

import com.cflint.BugInfo;
import com.cflint.BugList;
import com.cflint.plugins.CFLintScannerAdapter;
import com.cflint.plugins.Context;

@Extension
public class AbortChecker extends CFLintScannerAdapter {
	final String severity = "WARNING";

	public void expression(final CFScriptStatement expression, final Context context, final BugList bugs) {
		System.out.println(expression.getClass().getName());

		if (expression instanceof CFAbortStatement) {
			int lineNo = ((CFAbortStatement) expression).getLine();
			bugs.add(new BugInfo.BugInfoBuilder().setLine(lineNo).setMessageCode("AVOID_USING_ABORT")
				.setSeverity(severity).setFilename(context.getFilename())
				.setMessage("Abort statement at " + lineNo + ". Avoid using abort in production code.")
				.build());
		}
	}
}

package com.cflint.plugins.core;

import ro.fortsoft.pf4j.Extension;
import cfml.parsing.cfscript.CFFunctionExpression;
import cfml.parsing.cfscript.script.CFAbortStatement;
import cfml.parsing.cfscript.script.CFExpressionStatement;
import cfml.parsing.cfscript.script.CFScriptStatement;

import com.cflint.BugInfo;
import com.cflint.BugList;
import com.cflint.plugins.CFLintScannerAdapter;
import com.cflint.plugins.Context;

@Extension
public class AbortChecker extends CFLintScannerAdapter {
	final String severity = "WARNING";

	@Override
	public void expression(final CFScriptStatement expression, final Context context, final BugList bugs) {
		if (expression instanceof CFAbortStatement) {
			int lineNo = ((CFAbortStatement) expression).getLine() + context.startLine() - 1;
			bugs.add(new BugInfo.BugInfoBuilder().setLine(lineNo).setMessageCode("AVOID_USING_ABORT")
				.setSeverity(severity).setFilename(context.getFilename())
				.setMessage("Abort statement at line " + lineNo + ". Avoid using abort in production code.")
				.build());
		}
	}
}

Remove debug and fix line number


package org.recap.route;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.impl.DefaultMessage;
import org.recap.model.jpa.ReportEntity;
import org.recap.repository.ReportDetailRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * Created by peris on 8/20/16.
 */
@Component
public class XMLFileLoadValidator implements Processor {

    @Autowired
    ReportDetailRepository reportDetailRepository;

    @Override
    public void process(Exchange exchange) throws Exception {
        String camelFileName = (String) exchange.getIn().getHeader("CamelFileName");

        List<ReportEntity> reportEntity =
                reportDetailRepository.findByFileName(camelFileName);

        if(!CollectionUtils.isEmpty(reportEntity)){
            DefaultMessage defaultMessage = new DefaultMessage();
            defaultMessage.setBody("");
            exchange.setIn(defaultMessage);
            exchange.setOut(defaultMessage);
        }
    }
}

package org.recap.route;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.impl.DefaultMessage;
import org.recap.model.jpa.ReportEntity;
import org.recap.repository.ReportDetailRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * Created by peris on 8/20/16.
 */
@Component
public class XMLFileLoadValidator implements Processor {

    @Autowired
    ReportDetailRepository reportDetailRepository;

    /**
     * Check to see if the xml file has been loaded already. If so, set empty body such that the file doesn't get
     * processed again.
     * @param exchange
     * @throws Exception
     */
    @Override
    public void process(Exchange exchange) throws Exception {
        String camelFileName = (String) exchange.getIn().getHeader("CamelFileName");

        List<ReportEntity> reportEntity =
                reportDetailRepository.findByFileName(camelFileName);

        if(!CollectionUtils.isEmpty(reportEntity)){
            DefaultMessage defaultMessage = new DefaultMessage();
            defaultMessage.setBody("");
            exchange.setIn(defaultMessage);
            exchange.setOut(defaultMessage);
        }
    }
}

Check to validated xml file has been loaded already; if so, dont load it again.


package Functions;
import javax.swing.*;
import javax.swing.border.*;

import Elements.Element;

import java.awt.*;

public class ElementPanel extends JPanel
{
	private Element element;

	public ElementPanel(Element element)
	{
		this.element = element;
		if(element != null)
		{
			String name = element.getSymbol();
			if(element.getName().equals("Lanthanum"))
			{
				name = "*" + name;
			}
			if(element.getName().equals("Barium"))
			{
				name += "*";
			}
			if(element.getName().equals("Actinium"))
			{
				name = "**" + name;
			}
			if(element.getName().equals("Radium"))
			{
				name += "**";
			}

			add(new JLabel(name));
			setBorder(new CompoundBorder(new LineBorder(Color.BLACK, 1), new EmptyBorder(6, 6, 6, 6)));
		}
	}

	public Element getElement()
	{
		return element;
	}
}

package Functions;
import javax.swing.*;
import javax.swing.border.*;

import Elements.Element;

import java.awt.*;

public class ElementPanel extends JPanel
{
	private Element element;

	public ElementPanel(Element element)
	{
		this.element = element;
		if(element != null)
		{
			String name = element.getSymbol();
			if(element.getName().equals("Lanthanum"))
			{
				name = "*" + name;
			}
			if(element.getName().equals("Barium"))
			{
				name += "*";
			}
			if(element.getName().equals("Actinium"))
			{
				name = "**" + name;
			}
			if(element.getName().equals("Radium"))
			{
				name += "**";
			}

			this.setLayout(new GridBagLayout());
			GridBagConstraints c = new GridBagConstraints();
			c.ipady = -5;
			c.gridy = 0;
			add(new JLabel("" + element.getNum()), c);

			c.gridy = 1;
			add(new JLabel("
" + name + "
"), c);

			c.gridy = 2;
			c.ipady = 0;
			add(new JLabel("" + element.getName() + ""), c);

			setBorder(new CompoundBorder(new LineBorder(Color.BLACK, 1), new EmptyBorder(3, 3, 3, 3)));

			/*add(new JLabel("" + element.getNum() + "

" + name + "

" + element.getName() + ""));
			setBorder(new CompoundBorder(new LineBorder(Color.BLACK, 1), new EmptyBorder(6, 6, 6, 6)));
			setSize(50, 50);*/
		}
	}

	public Element getElement()
	{
		return element;
	}
}

Revert "Revert "Made the periodic table different""


package android.org.json;

import com.google.gwt.json.client.JSONParser;

/**
 * Proxy to the GWT class
 */
public class JSONObject {

	com.google.gwt.json.client.JSONObject jsonObject;

	public JSONObject(String json) {
		jsonObject = JSONParser.parseStrict(json).isObject();
	}

	public String getString(String name) {
		return jsonObject.get(name).toString();
	}

	public int getInt(String name) {
		return Integer.valueOf(jsonObject.get(name).toString());
	}
}

package android.org.json;

import com.google.gwt.json.client.JSONParser;

/**
 * Proxy to the GWT class
 */
public class JSONObject {

	com.google.gwt.json.client.JSONObject jsonObject;

	public JSONObject(String json) {
		jsonObject = JSONParser.parseStrict(json).isObject();
	}

	public String getString(String name) {
		return jsonObject.get(name).toString().replaceAll("^\"|\"$", "");
	}

	public int getInt(String name) {
		return Integer.valueOf(jsonObject.get(name).toString().replaceAll("^\"|\"$", ""));
	}
}

Remove quotation marks from JSON objects


package org.jtrim2.build;

import java.io.IOException;
import org.gradle.api.Project;

import static org.jtrim2.build.BuildFileUtils.*;

public final class Versions {
    private static final String GROUP_NAME = "org.jtrim2";

    private static final String VERSION_BASE_PROPERTY = "versionBase";

    public static void setVersion(Project project) throws IOException {
        String suffix = ReleaseUtils.isRelease(project) ? "" : "-SNAPSHOT";

        String versionBase = readTextFile(rootPath(project, "version.txt")).trim();
        project.getExtensions().add(VERSION_BASE_PROPERTY, versionBase);

        project.setGroup(GROUP_NAME);
        project.setVersion(versionBase + suffix);
    }

    public static String getVersion(Project project) {
        Object version = project.getVersion();
        return version != null ? version.toString() : null;
    }

    public static String getVersionBase(Project project) {
        return ProjectUtils.getStringProperty(project, VERSION_BASE_PROPERTY, "");
    }

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

package org.jtrim2.build;

import java.io.IOException;
import org.gradle.api.Project;

import static org.jtrim2.build.BuildFileUtils.*;

public final class Versions {
    private static final String GROUP_NAME = "org.jtrim2";

    private static final String VERSION_BASE_PROPERTY = "versionBase";
    private static final String VERSION_SUFFIX_PROPERTY = "versionSuffix";

    public static void setVersion(Project project) throws IOException {
        String versionBase = readTextFile(rootPath(project, "version.txt")).trim();
        project.getExtensions().add(VERSION_BASE_PROPERTY, versionBase);

        project.setGroup(GROUP_NAME);
        project.setVersion(versionBase + getVersionSuffix(project));
    }

    private static String getVersionSuffix(Project project) {
        boolean release = ReleaseUtils.isRelease(project);

        String defaultSuffix = release ? "" : "SNAPSHOT";
        String suffix = ProjectUtils.getStringProperty(project, VERSION_SUFFIX_PROPERTY, defaultSuffix);
        return suffix.isEmpty()
                ? ""
                : "-" + suffix;
    }

    public static String getVersion(Project project) {
        Object version = project.getVersion();
        return version != null ? version.toString() : null;
    }

    public static String getVersionBase(Project project) {
        return ProjectUtils.getStringProperty(project, VERSION_BASE_PROPERTY, "");
    }

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

Build now allows to specify custom version suffix.


import java.util.*;

public class Solution {
  public int jump(int[] jumps) {
    if (jumps.length == 0) return 0;

    int lastIndex = jumps.length - 1;
    boolean[] visited = new boolean[jumps.length];
    LinkedList<Integer> queue = new LinkedList<Integer>();
    queue.add(0);
    int stepCount = 0;
    visited[0] = true;

    while (!queue.isEmpty()) {
      int queueSize = queue.size();
      for (int i = 0; i < queueSize; i++) {
        int index = queue.removeFirst();
        if (index == lastIndex) {
          return stepCount;
        }

        int maxJump = jumps[index];
        for (int jump = 1; jump <= maxJump; jump++) {
          int newIndex = index + jump;
          if (newIndex >= jumps.length) {
            break;
          }
          if (!visited[newIndex]) {
            visited[newIndex] = true;
            queue.addLast(newIndex);
          }
        }
      }

      stepCount++;
    }

    return stepCount;
  }
}

import java.util.*;

public class Solution {
  public int jump(int[] jumps) {
    if (jumps.length == 0) return 0;
    if (jumps.length == 1) return 0;

    int lastIndex = jumps.length - 1;
    boolean[] visited = new boolean[jumps.length];
    LinkedList<Integer> queue = new LinkedList<Integer>();
    queue.add(0);
    int stepCount = 0;
    visited[0] = true;

    while (!queue.isEmpty()) {
      int queueSize = queue.size();
      for (int i = 0; i < queueSize; i++) {
        int index = queue.removeFirst();
        int maxIndex = Math.min(index + jumps[index], lastIndex);
        if (maxIndex == lastIndex) {
          return stepCount + 1;
        }

        for (int newIndex = maxIndex; newIndex > index; newIndex--) {
          if (visited[newIndex]) break;

          visited[newIndex] = true;
          queue.addLast(newIndex);
        }
      }

      stepCount++;
    }

    return stepCount;
  }
}

Optimize jump game ii solution


package bj.pranie.controller;

import bj.pranie.util.TimeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import java.util.Calendar;

/**
 * Created by Sebastian Sokolowski on 12.10.16.
 */

@Controller
public class IndexController {
    private final Logger log = LoggerFactory.getLogger(this.getClass());

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView index(Model model) {
        ModelAndView modelAndView = new ModelAndView("index");
        modelAndView.addObject("time", TimeUtil.getTime());
        log.debug("time" + Calendar.getInstance().getTime().toString());

        return modelAndView;
    }
}

package bj.pranie.controller;

import bj.pranie.entity.User;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by Sebastian Sokolowski on 12.10.16.
 */

@Controller
public class IndexController {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index() {
        if (isAuthenticatedUser()) {
            return "redirect:/week";
        }
        return "index";
    }

    private boolean isAuthenticatedUser() {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (authentication.getPrincipal() instanceof User) {
            return true;
        }
        return false;
    }
}

Implement auto redirect authenticated user to week page.


package no.stelar7.api.r4j.pojo.val.matchlist;

import java.io.Serializable;
import java.util.Objects;

public class MatchReference implements Serializable
{
    private static final long serialVersionUID = -5301457261872587385L;

    private String matchId;
    private Long   gameStartTime;
    private String teamId;

    public String getMatchId()
    {
        return matchId;
    }

    public Long getGameStartTime()
    {
        return gameStartTime;
    }

    public String getTeamId()
    {
        return teamId;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (o == null || getClass() != o.getClass())
        {
            return false;
        }
        MatchReference match = (MatchReference) o;
        return Objects.equals(matchId, match.matchId) &&
               Objects.equals(gameStartTime, match.gameStartTime) &&
               Objects.equals(teamId, match.teamId);
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(matchId, gameStartTime, teamId);
    }

    @Override
    public String toString()
    {
        return "Match{" +
               "matchId='" + matchId + '\'' +
               ", gameStartTime=" + gameStartTime +
               ", teamId='" + teamId + '\'' +
               '}';
    }
}

package no.stelar7.api.r4j.pojo.val.matchlist;

import java.io.Serializable;
import java.util.Objects;

public class MatchReference implements Serializable
{
    private static final long serialVersionUID = -5301457261872587385L;

    private String matchId;
    private Long   gameStartTimeMillis;
    private String queueId;

    public String getMatchId()
    {
        return matchId;
    }

    public Long getGameStartTimeMillis()
    {
        return gameStartTimeMillis;
    }

    public String getQueueId()
    {
        return queueId;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (o == null || getClass() != o.getClass())
        {
            return false;
        }
        MatchReference match = (MatchReference) o;
        return Objects.equals(matchId, match.matchId) &&
               Objects.equals(gameStartTimeMillis, match.gameStartTimeMillis) &&
               Objects.equals(queueId, match.queueId);
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(matchId, gameStartTimeMillis, queueId);
    }

    @Override
    public String toString()
    {
        return "Match{" +
               "matchId='" + matchId + '\'' +
               ", gameStartTimeMillis=" + gameStartTimeMillis +
               ", queueId='" + queueId + '\'' +
               '}';
    }
}

Fix property names to be related to response from riot valorant api


package com.tobi.movies;

import android.support.annotation.IdRes;
import android.support.test.espresso.contrib.RecyclerViewActions;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.*;
import static org.hamcrest.core.AllOf.allOf;

public abstract class Robot<T extends Robot> {

    protected T checkTextIsDisplayed(String text, @IdRes int view) {
        onView(allOf(withId(view), withText(text))).check(matches(isDisplayed()));
        return (T) this;
    }

    protected T selectPositionInRecyclerView(int position, @IdRes int recyclerView) {
        onView(withId(recyclerView))
                .perform(RecyclerViewActions.actionOnItemAtPosition(position, click()));
        return (T) this;
    }

    public <K> K toRobot(Class<K> robotClass) throws IllegalAccessException, InstantiationException {
        return robotClass.newInstance();
    }
}

package com.tobi.movies;

import android.support.annotation.IdRes;
import android.support.test.espresso.contrib.RecyclerViewActions;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.*;
import static org.hamcrest.core.AllOf.allOf;

public abstract class Robot<T extends Robot> {

    protected T checkTextIsDisplayed(String text, @IdRes int view) {
        onView(allOf(withId(view), withText(text))).check(matches(isDisplayed()));
        return (T) this;
    }

    protected T selectPositionInRecyclerView(int position, @IdRes int recyclerView) {
        onView(withId(recyclerView))
                .perform(RecyclerViewActions.actionOnItemAtPosition(position, click()));
        return (T) this;
    }

    public T waitFor(int seconds) throws InterruptedException {
        Thread.sleep(seconds * 1000);
        return (T) this;
    }

    public <K> K toRobot(Class<K> robotClass) throws IllegalAccessException, InstantiationException {
        return robotClass.newInstance();
    }
}

Add sleep method to robot


package com.box.l10n.mojito.aws.s3;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty("l10n.aws.s3.enabled")
public class AmazonS3Configuration {

    @Bean
    public AmazonS3 amazonS3Client(AmazonS3ConfigurationProperties amazonS3ConfigurationProperties) {
         AmazonS3ClientBuilder amazonS3ClientBuilder = AmazonS3ClientBuilder
                .standard()
                .withRegion(Regions.fromName(amazonS3ConfigurationProperties.getRegion()));

        if (amazonS3ConfigurationProperties.getAccessKeyId() != null) {
            AWSCredentials credentials = new BasicAWSCredentials(amazonS3ConfigurationProperties.getAccessKeyId(), amazonS3ConfigurationProperties.getAccessKeySecret());
            amazonS3ClientBuilder.withCredentials(new AWSStaticCredentialsProvider(credentials));
        }

        AmazonS3 amazonS3 = amazonS3ClientBuilder.build();
        return amazonS3;
    }
}

package com.box.l10n.mojito.aws.s3;

import com.amazonaws.PredefinedClientConfigurations;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty("l10n.aws.s3.enabled")
public class AmazonS3Configuration {

    @Bean
    public AmazonS3 amazonS3Client(AmazonS3ConfigurationProperties amazonS3ConfigurationProperties) {
        AmazonS3ClientBuilder amazonS3ClientBuilder = AmazonS3ClientBuilder
                .standard()
                .withClientConfiguration(PredefinedClientConfigurations.defaultConfig().withGzip(true))
                .withRegion(Regions.fromName(amazonS3ConfigurationProperties.getRegion()));

        if (amazonS3ConfigurationProperties.getAccessKeyId() != null) {
            AWSCredentials credentials = new BasicAWSCredentials(amazonS3ConfigurationProperties.getAccessKeyId(), amazonS3ConfigurationProperties.getAccessKeySecret());
            amazonS3ClientBuilder.withCredentials(new AWSStaticCredentialsProvider(credentials));
        }

        AmazonS3 amazonS3 = amazonS3ClientBuilder.build();
        return amazonS3;
    }
}

Use GZip compression in the Amazon S3 client to speed up large object transfer


package com.github.aureliano.edocs.app.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.github.aureliano.edocs.app.gui.menu.MenuBar;

public class AppFrame extends JFrame {

	private static final long serialVersionUID = 7618501026967569839L;

	public AppFrame() {
		this.buildGui();
	}

	private void buildGui() {
		super.setTitle("e-Docs");
		super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JPanel panel = new JPanel(new BorderLayout());
		panel.setOpaque(true);
		panel.add(new VerticalToolBar(), BorderLayout.WEST);

		super.setContentPane(panel);
		super.setJMenuBar(new MenuBar());
	}

	public void showFrame() {
		super.pack();
		super.setVisible(true);
		super.setSize(new Dimension(500, 500));
	}
}

package com.github.aureliano.edocs.app.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.github.aureliano.edocs.app.gui.menu.MenuBar;

public class AppFrame extends JFrame {

	private static final long serialVersionUID = 7618501026967569839L;

	private TabbedPane tabbedPane;

	public AppFrame() {
		this.buildGui();
	}

	private void buildGui() {
		super.setTitle("e-Docs");
		super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JPanel panel = new JPanel(new BorderLayout());
		panel.setOpaque(true);
		panel.add(new VerticalToolBar(), BorderLayout.WEST);

		this.tabbedPane = new TabbedPane();
		panel.add(this.tabbedPane, BorderLayout.CENTER);

		super.setContentPane(panel);
		super.setJMenuBar(new MenuBar());
	}

	public void showFrame() {
		super.pack();
		super.setVisible(true);
		super.setSize(new Dimension(500, 500));
	}
}

Add tabbed pane to the center of the frame.


package com.phonegap.device;

import net.rim.device.api.script.Scriptable;
import net.rim.device.api.system.DeviceInfo;

public final class DeviceFeature extends Scriptable {
	public static final String FIELD_PLATFORM = "platform";
	public static final String FIELD_UUID     = "uuid";
	public static final String FIELD_PHONEGAP = "phonegap";

	public Object getField(String name) throws Exception {

		if (name.equals(FIELD_PLATFORM)) {
			return new String(DeviceInfo.getPlatformVersion());
		}
		else if (name.equals(FIELD_UUID)) {
			return new Integer(DeviceInfo.getDeviceId());
		}
		else if (name.equals(FIELD_PHONEGAP)) {
			return "pre-0.92 EDGE";
		}

		return super.getField(name);
	}
}

/*
 * PhoneGap is available under *either* the terms of the modified BSD license *or* the
 * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
 *
 * Copyright (c) 2005-2010, Nitobi Software Inc.
 * Copyright (c) 2010, IBM Corporation
 */
package com.phonegap.device;

import net.rim.device.api.script.Scriptable;
import net.rim.device.api.system.DeviceInfo;

/**
 * PhoneGap plugin that provides device information, including:
 *
 * - Device platform version (e.g. 2.13.0.95). Not to be confused with BlackBerry OS version.
 * - Unique device identifier (UUID).
 * - PhoneGap software version.
 */
public final class DeviceFeature extends Scriptable {
	public static final String FIELD_PLATFORM = "platform";
	public static final String FIELD_UUID     = "uuid";
	public static final String FIELD_PHONEGAP = "phonegap";

	public Object getField(String name) throws Exception {

		if (name.equals(FIELD_PLATFORM)) {
			return new String(DeviceInfo.getPlatformVersion());
		}
		else if (name.equals(FIELD_UUID)) {
			return new Integer(DeviceInfo.getDeviceId());
		}
		else if (name.equals(FIELD_PHONEGAP)) {
			return "0.9.2";
		}

		return super.getField(name);
	}
}

Change PhoneGap version to '0.9.2'.