/*
 * Copyright 2002-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      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 org.springframework.aop.framework.adapter;

import java.io.Serializable;

import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;

import org.springframework.aop.Advisor;
import org.springframework.aop.ThrowsAdvice;

/**
 * Adapter to enable {@link org.springframework.aop.MethodBeforeAdvice}
 * to be used in the Spring AOP framework.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 */
@SuppressWarnings("serial")
class ThrowsAdviceAdapter implements AdvisorAdapter, Serializable {

	@Override
	public boolean supportsAdvice(Advice advice) {
		return (advice instanceof ThrowsAdvice);
	}

	@Override
	public MethodInterceptor getInterceptor(Advisor advisor) {
		return new ThrowsAdviceInterceptor(advisor.getAdvice());
	}

}

/*
 * Copyright 2002-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      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 org.springframework.aop.framework.adapter;

import java.io.Serializable;

import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;

import org.springframework.aop.Advisor;
import org.springframework.aop.ThrowsAdvice;

/**
 * Adapter to enable {@link org.springframework.aop.ThrowsAdvice}
 * to be used in the Spring AOP framework.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 */
@SuppressWarnings("serial")
class ThrowsAdviceAdapter implements AdvisorAdapter, Serializable {

	@Override
	public boolean supportsAdvice(Advice advice) {
		return (advice instanceof ThrowsAdvice);
	}

	@Override
	public MethodInterceptor getInterceptor(Advisor advisor) {
		return new ThrowsAdviceInterceptor(advisor.getAdvice());
	}

}

Fix javadoc reference to ThrowsAdvice


package org.gwtbootstrap3.extras.toggleswitch.client.ui.base.constants;

/*
 * #%L
 * GwtBootstrap3
 * %%
 * Copyright (C) 2013 - 2014 GwtBootstrap3
 * %%
 * 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.
 * #L%
 */

public enum ColorType {
    PRIMARY("primary"), INFO("info"), SUCCESS("primary"), WARNING("warning"), DANGER("danger"), DEFAULT("default");

    private final String type;

    private ColorType(final String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }
}

package org.gwtbootstrap3.extras.toggleswitch.client.ui.base.constants;

/*
 * #%L
 * GwtBootstrap3
 * %%
 * Copyright (C) 2013 - 2014 GwtBootstrap3
 * %%
 * 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.
 * #L%
 */

public enum ColorType {
    PRIMARY("primary"), INFO("info"), SUCCESS("success"), WARNING("warning"), DANGER("danger"), DEFAULT("default");

    private final String type;

    private ColorType(final String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }
}

Fix incorrect colour value in SUCCESS constant


package net.tjololo.openshift.havoc.connector.kubernetes;

/**
 * Created by veg on 19.12.2016.
 */
public class KubernetesDiscoveryTest {
    private KubernetesDiscovery kubernetesDiscovery;

}

package net.tjololo.openshift.havoc.connector.kubernetes;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.web.client.RestTemplate;

import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Created by veg on 19.12.2016.
 */
@RunWith(MockitoJUnitRunner.class)
public class KubernetesDiscoveryTest {
    private KubernetesDiscovery kubernetesDiscovery;
    @Mock
    private RestTemplate restTemplate;
    private static final String TOKEN="22Token22";

    @Before
    public void setUp() {
        kubernetesDiscovery = new KubernetesDiscovery(restTemplate, TOKEN);
    }

    @Test
    public void check_that_kubernetesDiscovery_not_null() throws Exception {
        assertThat(kubernetesDiscovery, not(nullValue()));
    }
}

Improve code quality. Implementet simple test


package forager.events;

import java.io.IOException;

import galileo.event.Event;
import galileo.serialization.SerializationInputStream;
import galileo.serialization.SerializationOutputStream;

public class TaskSpec implements Event {

    public int taskId;
    public String[] command;

    public TaskSpec(int taskId, String[] command) {
        this.taskId = taskId;
        this.command = command;
    }

    public String toString() {
        String str = "[" + taskId + "] ";
        for (String s : command) {
            str += s + " ";
        }
        return str;
    }

    @Deserialize
    public TaskSpec(SerializationInputStream in)
    throws IOException {
        taskId = in.readInt();
        int numArgs = in.readInt();
        command = new String[numArgs];
        for (int i = 0; i < numArgs; ++i) {
            command[i] = in.readString();
        }
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeInt(taskId);
        out.writeInt(command.length);
        for (String s : command) {
            out.writeString(s);
        }
    }
}

package forager.events;

import java.io.IOException;

import galileo.event.Event;
import galileo.serialization.SerializationInputStream;
import galileo.serialization.SerializationOutputStream;

public class TaskSpec implements Event {

    public int taskId;
    public String[] command;

    public TaskSpec(int taskId, String[] command) {
    private List<NetworkDestination> assignments = new ArrayList<>();
        this.taskId = taskId;
        this.command = command;
    }

    public void addAssignment(NetworkDestination host) {
        assignments.add(host);
    }

    public void removeAssignment(NetworkDestination host) {
        assignments.remove(host);
    }

    /**
     * Determine whether the Task associated with this TaskSpec has been
     * assigned to any resources yet.
     *
     * @return true if the Task has been assigned, false otherwise.
     */
    public boolean isAssigned() {
        return assignments.isEmpty() == false;
    }

    public String toString() {
        String str = "[" + taskId + "] ";
        for (String s : command) {
            str += s + " ";
        }
        return str;
    }

    @Deserialize
    public TaskSpec(SerializationInputStream in)
    throws IOException {
        taskId = in.readInt();
        int numArgs = in.readInt();
        command = new String[numArgs];
        for (int i = 0; i < numArgs; ++i) {
            command[i] = in.readString();
        }
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeInt(taskId);
        out.writeInt(command.length);
        for (String s : command) {
            out.writeString(s);
        }
    }
}

Add concept of task assignment


package au.org.ands.vocabs.toolkit.restlet;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/** Testing restlet. */
@Path("testing2")
public class TestRestlet2 {

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.TEXT_PLAIN)
    @GET
    public final String getMessage() {
        return "Hello World! Again!";
        }

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.APPLICATION_JSON)
    @GET
    public final String getMessageJson() {
        return "{\"hello\":\"Hello JSON!\"}";
        }

}

package au.org.ands.vocabs.toolkit.restlet;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

/** Testing restlet. */
@Path("testing2")
public class TestRestlet2 {

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.TEXT_PLAIN)
    @GET
    public final String getMessage() {
        return "Hello World! Again!";
        }

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.APPLICATION_JSON)
    @GET
    public final String getMessageJson() {
        return "{\"hello\":\"Hello JSON!\"}";
        }

    /** getException.
     * This shows how to return a status code 503 "service unavailable"
     * and also some content.
     * @return the message. */
    @Path("except")
    @Produces(MediaType.TEXT_PLAIN)
    @GET
    public final Response getExcept() {
        return Response.status(Status.SERVICE_UNAVAILABLE).
                entity("Hi there").build();
        }

}

Test generating a 503 status


package wumpus;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;

import wumpus.Environment.*;

/**
 * The iteration of plays that the player can take until reaches its end.
 */
public class Runner implements Iterable<Player>, Iterator<Player> {
    private static final int DEFAULT_MAX_ITERATIONS = 200;

    private final World world;
    private int iterations = 0;

    /**
     * The runner constructor.
     * @param world The world instance.
     */
    public Runner(World world) {
        this.world = world;
    }

    /**
     * Returns the iterator that can be user in a loop.
     * @return Itself
     */
    public Iterator<Player> iterator() {
        return this;
    }

    /**
     * Check if the game has ended.
     * @return
     */
    public boolean hasNext() {
        Player player = world.getPlayer();
        return iterations < DEFAULT_MAX_ITERATIONS &&
                player.isAlive() && player.getResult() == Result.WIN;
    }

    /**
     * Get player instance to calculate the next iteration.
     * @return The current player instance
     */
    public Player next() {
        if (!hasNext()) throw new NoSuchElementException();
        iterations++;
        return world.getPlayer();
    }

    /**
     * Operation not supported, throws an error.
     */
    public void remove() {
        throw new UnsupportedOperationException();
    }

    /**
     * Get how many iterations have been made so far.
     * @return The amount of iterations
     */
    public int getDepth() {
        return iterations;
    }
}

package wumpus;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;

import wumpus.Environment.*;

/**
 * The iteration of plays that the player can take until reaches its end.
 */
public class Runner implements Iterable<Player>, Iterator<Player> {
    private static final int DEFAULT_MAX_ITERATIONS = 200;

    private final World world;
    private int iterations = 0;

    /**
     * The runner constructor.
     * @param world The world instance.
     */
    public Runner(World world) {
        this.world = world;
    }

    /**
     * Returns the iterator that can be user in a loop.
     * @return Itself
     */
    public Iterator<Player> iterator() {
        return this;
    }

    /**
     * Check if the game has ended.
     * @return
     */
    public boolean hasNext() {
        Player player = world.getPlayer();
        return iterations < DEFAULT_MAX_ITERATIONS &&
                player.isAlive() && player.getResult() != Result.WIN;
    }

    /**
     * Get player instance to calculate the next iteration.
     * @return The current player instance
     */
    public Player next() {
        if (!hasNext()) throw new NoSuchElementException();
        iterations++;
        return world.getPlayer();
    }

    /**
     * Operation not supported, throws an error.
     */
    public void remove() {
        throw new UnsupportedOperationException();
    }

    /**
     * Get how many iterations have been made so far.
     * @return The amount of iterations
     */
    public int getDepth() {
        return iterations;
    }
}

Fix hasNext method to only stop when play not have winned


package models;
import static org.junit.Assert.*;

import java.util.Calendar;

import org.junit.Before;
import org.junit.Test;

public class PersonModelTest {
	private Calendar now = Calendar.getInstance();
	private int currentYear = now.get(Calendar.YEAR);
	private Person bart;
	private int bartAge;

	@Before
	public void setUp() throws Exception {
		bart = new Person(101,"Bart","Simpsons",1987,"Springfield","USA");
		bartAge = (currentYear - bart.getBirthYear());
	}

	@Test
	public void getAgeReturnItem() {
		assertEquals(bartAge, bart.getAge());
	}

	@Test
	public void toStringReturnItem() {
		assertEquals("firstName: Bart, lastName: Simpsons, age: "+bartAge,
						bart.toString());
	}

}

package models;
import static org.junit.Assert.*;

import java.util.Calendar;

import org.junit.Before;
import org.junit.Test;

public class PersonModelTest {
	private Calendar now = Calendar.getInstance();
	private int currentYear = now.get(Calendar.YEAR);
	private Person bart;
	private int bartAge;

	@Before
	public void setUp() throws Exception {
		bart = new Person(101,"Bart","Simpsons",1987,"Springfield","USA");
		bartAge = (currentYear - bart.getBirthYear());
	}

	@Test
	public void getAgeReturnItem() {
		int expectedAge = bartAge;
		assertEquals(expectedAge, bart.getAge());
	}

	@Test
	public void toStringReturnItem() {
		String expectedToString = "firstName: Bart, lastName: Simpsons, age: " + bartAge;
		assertEquals(expectedToString, bart.toString());
	}

}

Add variables to express intent


package fr.mantal.wcdl;

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main
{
	public static void main(String[] args)
	{
		Downloader.fromConfig(getPath(args[0])).download();
	}

	private static String getPath(String arg0)
	{
		if (arg0.isEmpty())
			arg0 = System.getProperty("user.dir");

		if (Files.isDirectory(Paths.get(arg0)))
			return Paths.get(arg0, ".config.wcdl").toString();
		return arg0;
	}
}

package fr.mantal.wcdl;

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main
{
	public static void main(String[] args)
	{
		Downloader.fromConfig(getPath(args)).download();
	}

	private static String getPath(String[] args)
	{
		String arg0 = args.length > 1 ? args[0] : System.getProperty("user.dir");

		if (Files.isDirectory(Paths.get(arg0)))
			return Paths.get(arg0, ".config.wcdl").toString();
		return arg0;
	}
}

Fix crash when launched without arguments


package net.shadowfacts.zcraft.block;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.shadowfacts.zcraft.item.ZItems;

public class BlockOre extends Block {

	public BlockOre(int par1) {
		super(par1, Material.rock);
	}

	public int idDropped(int par1, Random par2Random, int par3) {

		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return ZItems.greenZinchoriumGem.itemID;
		} else {
			return this.blockID;
		}

	}

	public int quantityDropped(Random par1Random) {
		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return 3;
		} else {
			return 1;
		}
	}

}

package net.shadowfacts.zcraft.block;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.world.World;
import net.shadowfacts.zcraft.item.ZItems;

public class BlockOre extends Block {

	public BlockOre(int par1) {
		super(par1, Material.rock);
	}

	@Override
	public int idDropped(int par1, Random par2Random, int par3) {

		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return ZItems.greenZinchoriumGem.itemID;
		} else {
			return this.blockID;
		}

	}

	@Override
	public int quantityDropped(Random par1Random) {
		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return 3;
		} else {
			return 1;
		}
	}

	@Override
	public void dropXpOnBlockBreak(World world, int par2, int par3, int par4, int par5) {
		if (!world.isRemote) {
			int i1 = EntityXPOrb.getXPSplit(par5);
			par5 -= i1;
			world.spawnEntityInWorld(new EntityXPOrb(world, (double)par2 + 0.5d, (double)par3 + 0.5d, (double)par4 + 0.5d, 20));
		}
	}

}

Add experience drop to ores


package org.fountanio.juancode.out;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.event.*;

public class IPWindow extends JFrame {
	private static final long serialVersionUID = 1L;

	private JButton gotoip = new JButton("Go");
	private JButton gotoipf = new JButton("Go");
	private Border topborder = BorderFactory.createTitledBorder("Connect");
	private Border bottomborder = BorderFactory.createTitledBorder("Friends");
	private JTextField ipinput = new JTextField();
	private JList<String> friendlist = new JList();

	public IPWindow() {
		super("Speed Civilization");
		setSize(400, 340);
		setLayout(new BorderLayout());
		ipinput.setBorder(topborder);
		gotoip.setBorder(topborder);
		gotoipf.setBorder(bottomborder);
		friendlist.setBorder(bottomborder);
		// actions

	}

}

package org.fountanio.juancode.out;

import java.awt.BorderLayout;

import javax.swing.*;
import javax.swing.border.Border;

import org.fountanio.juancode.eng.Engine;
import org.lwjgl.openal.AL;
import org.lwjgl.opengl.Display;

import java.awt.event.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;

public class IPWindow extends JFrame {
	private static final long serialVersionUID = 1L;

	private JButton gotoip = new JButton("Go");
	private JButton gotoipf = new JButton("Go");
	private Border topborder = BorderFactory.createTitledBorder("Connect");
	private Border bottomborder = BorderFactory.createTitledBorder("Friends");
	private JTextField ipinput = new JTextField();
	private JList<String> friendlist = new JList();

	public IPWindow() {
		super("Speed Civilization");
		setSize(400, 340);
		setLayout(new BorderLayout());
		ipinput.setBorder(topborder);
		gotoip.setBorder(topborder);
		gotoipf.setBorder(bottomborder);
		friendlist.setBorder(bottomborder);
		// actions

	}

	void refreshList() {
		try {
			File file = new File(Engine.getAppDataDir() + "\\fountanio\\speedcivilization\\friends.fls");
			Reader r = new FileReader(file);
			BufferedReader reader = new BufferedReader(r);
		} catch (FileNotFoundException e) {
			Main.getConsole().errorln("Data directory NOT found!\nPerhaps you may want to restart the game?");
		}
	}
}

Set up a few items


package com.kickstarter.libs;

import com.kickstarter.viewmodels.DiscoveryViewModel;
import com.kickstarter.services.WebClient;

public class NoopBuildCheck implements BuildCheck {
  @Override
  public void bind(final DiscoveryViewModel viewModel, final WebClientType client) {
    // No-op, distribution through Play Store
  }
}

package com.kickstarter.libs;

import android.support.annotation.NonNull;

import com.kickstarter.services.WebClientType;
import com.kickstarter.viewmodels.DiscoveryViewModel;

public class NoopBuildCheck implements BuildCheck {
  @Override
  public void bind(final @NonNull DiscoveryViewModel viewModel, final @NonNull WebClientType client) {
    // No-op, distribution through Play Store
  }
}

Fix import for external builds


/**
 * 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.
 */
/**
 * A simple in-memory implementation of the Commons RDF API.
 *

 * This package contains a simple (if not naive) implementation of the Commons RDF API
 * using in-memory POJO objects.
 *

 * Note that although this module fully implements the commons-rdf API,
 * it should *not*  be considered a reference implementation.
 * It is not thread-safe nor scalable, but may be useful for testing
 * and simple usage (e.g. output from an independent RDF parser).
 *

 * To use this implementation, create an instance of {@link SimpleRDFTermFactory}
 * and use methods like {@link SimpleRDFTermFactory#createGraph} and
 * {@link SimpleRDFTermFactory#createIRI(String)}.
 *
 */
package org.apache.commons.rdf.simple;

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

/**
 * A simple in-memory implementation of the Commons RDF API.
 *

 * This package contains a simple (if not naive) implementation of the Commons RDF API
 * using in-memory POJO objects.
 *

 * Note that although this module fully implements the commons-rdf API,
 * it should *not*  be considered a reference implementation.
 * It is not thread-safe nor scalable, but may be useful for testing
 * and simple usage (e.g. output from an independent RDF parser).
 *

 * To use this implementation, create an instance of {@link SimpleRDFTermFactory}
 * and use methods like {@link SimpleRDFTermFactory#createGraph} and
 * {@link SimpleRDFTermFactory#createIRI(String)}.
 *
 */

Move javadoc after package to avoid warnings


package seedu.address.commons.core;

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

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 : Date App\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/scheduler.xml\n" +
                "Scheduler name : MyScheduler";

        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 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 : Scheduler App\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/scheduler.xml\n" +
                "Scheduler name : MyScheduler";

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

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

}

Fix a failure in test


package seedu.manager.commons.core;

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

import seedu.manager.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 Ninja\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.manager.commons.core;

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

import seedu.manager.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 Ninja\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/taskmanager.xml\n" +
                "TaskManager name : Task Ninja";

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

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

}

Fix failing test due to change in taskmanager name


package vooga.request.forwarder;

/**
 * An exception capturing when an invalid address has been used
 */
public class InvalidAddressException extends Exception {

    private static final long serialVersionUID = 7207103882222096620L;

    private String myAddress;
    private String myReason;

    /**
     * Create a new invalid address exception
     *
     * @param address The invalid address
     * @param reason The reason the address is invalid
     */
    public InvalidAddressException(String address, String reason){
        super(address + " is invalid: " + reason);
        myAddress = address;
        myReason = reason;
    }

    /**
     * Get the invalid address
     *
     * @return The invalid address
     */
    public String address(){
        return myAddress;
    }

    /**
     * Get the reason the address is invalid
     *
     * @return The reason the address is invalid
     */
    public String reason(){
        return myReason;
    }
}

Remove spacing between static and non static variables


package ee.tuleva.onboarding.mandate;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.*;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
@Getter
@Entity
@Table(name = "fund_transfer_exchange")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString(exclude = {"mandate"})
public class FundTransferExchange {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonView(MandateView.Default.class)
    private Long id;

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "mandate_id", nullable = false)
    private Mandate mandate;

    @NotBlank
    @JsonView(MandateView.Default.class)
    private String sourceFundIsin;
    @NotNull
    @Min(0)
    @Max(1)
    @JsonView(MandateView.Default.class)
    private BigDecimal amount;
    @NotNull
    @JsonView(MandateView.Default.class)
    private String targetFundIsin;

}

package ee.tuleva.onboarding.mandate;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.*;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
@Getter
@Entity
@Table(name = "fund_transfer_exchange")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString(exclude = {"mandate"})
public class FundTransferExchange {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonView(MandateView.Default.class)
    private Long id;

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "mandate_id", nullable = false)
    private Mandate mandate;

    @NotBlank
    @JsonView(MandateView.Default.class)
    private String sourceFundIsin;
    @NotNull
    @Min(0)
    @JsonView(MandateView.Default.class)
    private BigDecimal amount;
    @NotNull
    @JsonView(MandateView.Default.class)
    private String targetFundIsin;

}

Fix 3rd pillar validation constraint


package com.github.tdesjardins.ol3.demo.client.example;

/**
 * Provided example types.
 *
 * @author Tino Desjardins
 *
 */
public enum OL3ExampleType {

    AnimationExample(new AnimationExample()),
    ArcGISExample(new ArcGISExample()),
    GeoJSONExample(new GeoJSONExample()),
    GraticuleExample(new GraticuleExample()),
    ImageExample(new StaticImageExample()),
    MapEventsExample(new MapEventsExample()),
    MapGuideExample(new MapGuideExample()),
    MarkerExample(new MarkerExample()),
    MeasureExample(new MeasureExample()),
    OsmExample(new OsmExample()),
    OverlayExample(new OverlayExample()),
    SelectFeatureExample(new SelectFeaturesExample()),
    TileExample(new TileExample()),
    TileWmsExample(new TileWmsExample()),
    WmsExample(new WmsExample()),
    WmtsExample(new WmtsExample()),
    XyzExample(new XyzExample());

    private transient Example example;

    OL3ExampleType(Example example) {
        this.example = example;
    }

    public Example getExample() {
        return this.example;
    }

}

package com.github.tdesjardins.ol3.demo.client.example;

/**
 * Provided example types.
 *
 * @author Tino Desjardins
 *
 */
public enum OL3ExampleType {

    AnimationExample(new AnimationExample()),
    ArcGISExample(new ArcGISExample()),
    GeoJSONExample(new GeoJSONExample()),
    GraticuleExample(new GraticuleExample()),
    ImageExample(new StaticImageExample()),
    MapBoxExample(new MapboxExample()),
    MapEventsExample(new MapEventsExample()),
    MapGuideExample(new MapGuideExample()),
    MarkerExample(new MarkerExample()),
    MeasureExample(new MeasureExample()),
    OsmExample(new OsmExample()),
    OverlayExample(new OverlayExample()),
    SelectFeatureExample(new SelectFeaturesExample()),
    TileExample(new TileExample()),
    TileWmsExample(new TileWmsExample()),
    WmsExample(new WmsExample()),
    WmtsExample(new WmtsExample()),
    XyzExample(new XyzExample());

    private transient Example example;

    OL3ExampleType(Example example) {
        this.example = example;
    }

    public Example getExample() {
        return this.example;
    }

}

Add an example for Mapbox.


package com.simperium.client;

import com.simperium.util.AuthUtil;

import org.json.JSONException;
import org.json.JSONObject;

public class AuthResponseHandler {

    private AuthResponseListener mListener;
    private User mUser;

    public AuthResponseHandler(User user, AuthResponseListener listener){
        mUser = user;
        mListener = listener;
    }

    public void onResponse(JSONObject response){

        try {
            mUser.setUserId(response.getString(AuthUtil.USERID_KEY));
            mUser.setAccessToken(response.getString(AuthUtil.ACCESS_TOKEN_KEY));
        } catch(JSONException error){
            mListener.onFailure(mUser, AuthException.defaultException());
            return;
        }

        mUser.setStatus(User.Status.AUTHORIZED);
        mListener.onSuccess(mUser, mUser.getUserId(), mUser.getAccessToken());
    }

    public void onError(AuthException error){
        mListener.onFailure(mUser, error);
    }

}

package com.simperium.client;

import com.simperium.util.AuthUtil;

import org.json.JSONObject;

public class AuthResponseHandler {
    private AuthResponseListener mListener;
    private User mUser;

    public AuthResponseHandler(User user, AuthResponseListener listener) {
        mUser = user;
        mListener = listener;
    }

    public void onResponse(JSONObject response){
        if (!response.optString(AuthUtil.USERID_KEY).isEmpty() && !response.optString(AuthUtil.ACCESS_TOKEN_KEY).isEmpty()) {
            mListener.onSuccess(mUser, response.optString(AuthUtil.USERID_KEY), response.optString(AuthUtil.ACCESS_TOKEN_KEY));
        } else {
            mListener.onFailure(mUser, AuthException.defaultException());
        }
    }

    public void onError(AuthException error) {
        mListener.onFailure(mUser, error);
    }
}

Remove setting user id and access token from response method in auth response handler


package icepick.annotation;

import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

class IcicleField {

    public final String name;
    public final String typeCast;
    public final String command;

    IcicleField(String name, String typeCast, String command) {
        this.name = name;
        this.command = command;
        this.typeCast = typeCast;
    }

    static class Factory {

        private final Types typeUtils;
        private final IcicleConversionMap conversionMap;

        Factory(Elements elementUtils, Types typeUtils) {
            this.typeUtils = typeUtils;
            this.conversionMap = new IcicleConversionMap(elementUtils, typeUtils);
        }

        public IcicleField from(Element element) {
            TypeMirror typeMirror = element.asType();
            String command = convert(typeMirror);
            String typeCast = IcicleConversionMap.TYPE_CAST_COMMANDS.contains(command) ? "(" + typeMirror.toString() + ")" : "";
            String name = element.getSimpleName().toString();
            return new IcicleField(name, typeCast, command);
        }

        public String convert(TypeMirror typeMirror) {
            for (TypeMirror other : conversionMap.keySet()) {
                if (typeUtils.isAssignable(typeMirror, other)) {
                    return conversionMap.get(other);
                }
            }
            throw new AssertionError("Cannot insert a " + typeMirror + " into a Bundle");
        }
    }
}

package icepick.annotation;

import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

class IcicleField {

    public final String name;
    public final String typeCast;
    public final String command;

    IcicleField(String name, String typeCast, String command) {
        this.name = name;
        this.command = command;
        this.typeCast = typeCast;
    }

    static class Factory {

        private final Types typeUtils;
        private final IcicleConversionMap conversionMap;

        Factory(Elements elementUtils, Types typeUtils) {
            this.typeUtils = typeUtils;
            this.conversionMap = new IcicleConversionMap(elementUtils, typeUtils);
        }

        public IcicleField from(Element element) {
            TypeMirror typeMirror = element.asType();
            String command = convert(typeMirror);
            String typeCast = IcicleConversionMap.TYPE_CAST_COMMANDS.contains(command) ? "(" + typeMirror.toString() + ")" : "";
            String name = element.getSimpleName().toString();
            return new IcicleField(name, typeCast, command);
        }

        private String convert(TypeMirror typeMirror) {
            for (TypeMirror other : conversionMap.keySet()) {
                if (typeUtils.isAssignable(typeMirror, other)) {
                    return conversionMap.get(other);
                }
            }
            throw new UnableToSerializeException(typeMirror);
        }
    }

    public static class UnableToSerializeException extends RuntimeException {
        UnableToSerializeException(TypeMirror fieldType) {
            super("Don't know how to put a " + fieldType + " into a Bundle");
        }
    }
}

Add a proper exception type for failed conversion


/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import com.codenvy.dto.shared.DTO;

@DTO
public interface ColumnDTO extends DatabaseMetadataEntityDTO {

    ColumnDTO withName(String name);

    ColumnDTO withColumnDataType(String datatypeName);

    String getColumnDataType();

    void setColumnDataType(String columnDataTypeName);
}

/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import com.codenvy.dto.shared.DTO;

@DTO
public interface ColumnDTO extends DatabaseMetadataEntityDTO {

    ColumnDTO withName(String name);

    ColumnDTO withColumnDataType(String datatypeName);

    String getColumnDataType();

    void setColumnDataType(String columnDataTypeName);

    ColumnDTO withDefaultValue(String defaultValue);

    void setDefaultValue(String defaultValue);

    String getDefalulValue();

    ColumnDTO withDataSize(int size);

    void setDataSize(int size);

    int getDataSize();

    ColumnDTO withDecimalDigits(int digits);

    void setDecimalDigits(int digits);

    int getDecimalDigits();

    ColumnDTO withNullable(boolean nullable);

    void setNullable(boolean nullable);

    boolean getNullable();
}

Add properties to column DTO


package io.mypojo.framework;

import io.mypojo.felix.framework.ServiceRegistry;
import io.mypojo.felix.framework.util.EventDispatcher;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;

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

@SuppressWarnings("PackageAccessibility")
public class PojoSRInternals {
    public BundleContext m_context;
    public final Map<String, Bundle> m_symbolicNameToBundle = new HashMap<>();
    public final ServiceRegistry m_reg = new ServiceRegistry(
            new ServiceRegistry.ServiceRegistryCallbacks() {
                public void serviceChanged(ServiceEvent event,
                                           Dictionary oldProps) {
                    m_dispatcher.fireServiceEvent(event, oldProps, null);
                }
            });
    public final EventDispatcher m_dispatcher = new EventDispatcher(m_reg);
    public final Map<Long, Bundle> m_bundles = new HashMap<Long, Bundle>();
    public final Map bundleConfig = new HashMap();
}

package io.mypojo.framework;

import io.mypojo.felix.framework.ServiceRegistry;
import io.mypojo.felix.framework.util.EventDispatcher;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;

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

@SuppressWarnings("PackageAccessibility")
public class PojoSRInternals {
    public BundleContext m_context;
    public final Map<String, Bundle> m_symbolicNameToBundle = new HashMap<>();
    public final ServiceRegistry m_reg = new ServiceRegistry(
            new ServiceRegistry.ServiceRegistryCallbacks() {
                public void serviceChanged(ServiceEvent event,
                                           Dictionary oldProps) {
                    m_dispatcher.fireServiceEvent(event, oldProps, null);
                }
            });
    public final EventDispatcher m_dispatcher = new EventDispatcher(m_reg);
    public final Map<Long, Bundle> m_bundles = new HashMap<>();
    public final Map bundleConfig = new HashMap();
}

Fix generics as a result of Java 7 upgrade


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

package org.apache.tapestry5.internal.services.security;

import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.security.WhitelistAnalyzer;

/**
 * Standard analyzer that places requests from the "localhost", "127.0.0.1", or "0:0:0:0:0:0:0:1%0" onto the white list.
 *
 * @since 5.3
 */
public class LocalhostOnly implements WhitelistAnalyzer
{
    public boolean isRequestOnWhitelist(Request request)
    {
        String remoteHost = request.getRemoteHost();

        return remoteHost.equals("localhost") || remoteHost.equals("127.0.0.1") || remoteHost.equals("0:0:0:0:0:0:0:1%0");
    }
}

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

package org.apache.tapestry5.internal.services.security;

import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.security.WhitelistAnalyzer;

/**
 * Standard analyzer that places requests from the "localhost", "127.0.0.1", "0:0:0:0:0:0:0:1%0", or :"0:0:0:0:0:0:0:1" onto the white list.
 *
 * @since 5.3
 */
public class LocalhostOnly implements WhitelistAnalyzer
{
    public boolean isRequestOnWhitelist(Request request)
    {
        String remoteHost = request.getRemoteHost();

        return remoteHost.equals("localhost") || remoteHost.equals("127.0.0.1") || remoteHost.equals("0:0:0:0:0:0:0:1%0") || remoteHost.equals("0:0:0:0:0:0:0:1");
    }
}

Add 0:0:0:0:0:0:0:1 as another recognized value for remoteHost meaning local


package org.fakekoji.jobmanager;

import org.fakekoji.jobmanager.model.JobUpdateResults;

import java.util.Objects;

public class ManagementResult {

    public final Object config;
    public final JobUpdateResults jobUpdateResults;

    public ManagementResult(Object config, JobUpdateResults jobUpdateResults) {
        this.config = config;
        this.jobUpdateResults = jobUpdateResults;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ManagementResult)) return false;
        ManagementResult that = (ManagementResult) o;
        return Objects.equals(config, that.config) &&
                Objects.equals(jobUpdateResults, that.jobUpdateResults);
    }

    @Override
    public int hashCode() {
        return Objects.hash(config, jobUpdateResults);
    }

    @Override
    public String toString() {
        return "ManagementResult{" +
                "config=" + config +
                ", jobupdateResults=" + jobUpdateResults +
                '}';
    }
}

package org.fakekoji.jobmanager;

import org.fakekoji.jobmanager.model.JobUpdateResults;

import java.util.Objects;

public class ManagementResult <C> {

    public final C config;
    public final JobUpdateResults jobUpdateResults;

    public ManagementResult(C config, JobUpdateResults jobUpdateResults) {
        this.config = config;
        this.jobUpdateResults = jobUpdateResults;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ManagementResult)) return false;
        ManagementResult that = (ManagementResult) o;
        return Objects.equals(config, that.config) &&
                Objects.equals(jobUpdateResults, that.jobUpdateResults);
    }

    @Override
    public int hashCode() {
        return Objects.hash(config, jobUpdateResults);
    }

    @Override
    public String toString() {
        return "ManagementResult{" +
                "config=" + config +
                ", jobupdateResults=" + jobUpdateResults +
                '}';
    }
}

Add generic Config type in Management Result


/*
 * ******************************************************************************
 *  Copyright 2011-2015 CovertJaguar
 *
 *  This work (the API) is licensed under the "MIT" License, see LICENSE.md for details.
 * ***************************************************************************
 */
@API(apiVersion="2.0.0", owner="RailcraftAPI|core", provides="RailcraftAPI|electricity")
package mods.railcraft.api.electricity;
import net.minecraftforge.fml.common.API;

/*
 * ******************************************************************************
 *  Copyright 2011-2015 CovertJaguar
 *
 *  This work (the API) is licensed under the "MIT" License, see LICENSE.md for details.
 * ***************************************************************************
 */
@API(apiVersion="3.0.0", owner="RailcraftAPI|core", provides="RailcraftAPI|electricity")
package mods.railcraft.api.electricity;
import net.minecraftforge.fml.common.API;

Bump the version for the electricity package.


package com.faforever.client.play;

import com.google.api.client.util.Key;

import java.util.Date;

public class PlayerAchievement {

  @Key("state")
  private AchievementState state;
  @Key("achievement_id")
  private String achievementId;
  @Key("current_steps")
  private int currentSteps;
  @Key("create_time")
  private long createTime;
  @Key("update_time")
  private long updateTime;

  public AchievementState getState() {
    return state;
  }

  public void setState(AchievementState state) {
    this.state = state;
  }

  public String getAchievementId() {
    return achievementId;
  }

  public void setAchievementId(String achievementId) {
    this.achievementId = achievementId;
  }

  public int getCurrentSteps() {
    return currentSteps;
  }

  public void setCurrentSteps(int currentSteps) {
    this.currentSteps = currentSteps;
  }

  public Date getCreateTime() {
    return new Date(createTime * 1000);
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime.getTime() / 1000;
  }

  public Date getUpdateTime() {
    return new Date(updateTime * 1000);
  }

  public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime.getTime() / 1000;
  }
}

package com.faforever.client.play;

import com.google.api.client.util.Key;

import java.util.Date;

public class PlayerAchievement {

  @Key("state")
  private AchievementState state;
  @Key("achievement_id")
  private String achievementId;
  @Key("current_steps")
  private Integer currentSteps;
  @Key("create_time")
  private long createTime;
  @Key("update_time")
  private long updateTime;

  public AchievementState getState() {
    return state;
  }

  public void setState(AchievementState state) {
    this.state = state;
  }

  public String getAchievementId() {
    return achievementId;
  }

  public void setAchievementId(String achievementId) {
    this.achievementId = achievementId;
  }

  public int getCurrentSteps() {
    return currentSteps;
  }

  public void setCurrentSteps(int currentSteps) {
    this.currentSteps = currentSteps;
  }

  public Date getCreateTime() {
    return new Date(createTime * 1000);
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime.getTime() / 1000;
  }

  public Date getUpdateTime() {
    return new Date(updateTime * 1000);
  }

  public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime.getTime() / 1000;
  }
}

Allow NULL values for current_steps


package net.openhft.chronicle.queue;

import net.openhft.chronicle.core.threads.EventHandler;
import net.openhft.chronicle.core.threads.HandlerPriority;
import net.openhft.chronicle.core.threads.InvalidEventHandlerException;
import net.openhft.chronicle.queue.impl.single.Pretoucher;
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueue;
import org.jetbrains.annotations.NotNull;

public final class PretouchHandler implements EventHandler {
    private final Pretoucher pretoucher;

    public PretouchHandler(final SingleChronicleQueue queue) {
        this.pretoucher = new Pretoucher(queue);
    }

    @Override
    public boolean action() throws InvalidEventHandlerException {
        pretoucher.execute();
        return false;
    }

    @NotNull
    @Override
    public HandlerPriority priority() {
        return HandlerPriority.MONITOR;
    }

    public void shutdown() {
        pretoucher.shutdown();
    }
}

package net.openhft.chronicle.queue;

import net.openhft.chronicle.core.threads.EventHandler;
import net.openhft.chronicle.core.threads.HandlerPriority;
import net.openhft.chronicle.core.threads.InvalidEventHandlerException;
import net.openhft.chronicle.queue.impl.single.Pretoucher;
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueue;
import org.jetbrains.annotations.NotNull;

public final class PretouchHandler implements EventHandler {
    private final Pretoucher pretoucher;
    private long lastRun = 0;

    public PretouchHandler(final SingleChronicleQueue queue) {
        this.pretoucher = new Pretoucher(queue);
    }

    @Override
    public boolean action() throws InvalidEventHandlerException {
        long now = System.currentTimeMillis();
        // don't check too often.
        if (now > lastRun + 100) {
            pretoucher.execute();
            lastRun = now;
        }
        return false;
    }

    @NotNull
    @Override
    public HandlerPriority priority() {
        return HandlerPriority.MONITOR;
    }

    public void shutdown() {
        pretoucher.shutdown();
    }
}

Make the pretoucher touch further ahead for long delays on new chunks.


package de.graeuler.garden.config;

import java.util.EnumMap;

public class StaticAppConfig implements AppConfig {

	private EnumMap<AppConfig.Key, Object> config = new EnumMap<>(Key.class);

	public StaticAppConfig() {

		this.config.put(AppConfig.Key.TF_DAEMON_HOST, "192.168.1.10");
		this.config.put(AppConfig.Key.TF_DAEMON_PORT, Integer.valueOf(4223));
		this.config.put(AppConfig.Key.UPLINK_ADRESS, "http://localhost:8081/datafeed/collect/garden");
		// this.config.put(AppConfig.Key.API_TOKEN, "non-working-token");
	}

	@Override
	public Object get(Key key) {
		if (config.containsKey(key))
			return config.get(key);
		else
			return key.getDefaultValue();
	}

	@Override
	public Object get(Key key, Object defaultValue) {
		return this.config.getOrDefault(key, defaultValue);
	}

}

package de.graeuler.garden.config;

import java.util.EnumMap;

public class StaticAppConfig implements AppConfig {

	private EnumMap<AppConfig.Key, Object> config = new EnumMap<>(Key.class);

	public StaticAppConfig() {

		this.config.put(AppConfig.Key.TF_DAEMON_HOST, "localhost");
		this.config.put(AppConfig.Key.TF_DAEMON_PORT, Integer.valueOf(4223));
		this.config.put(AppConfig.Key.UPLINK_ADRESS, "http://localhost:8081/datafeed/collect/garden");
		// this.config.put(AppConfig.Key.API_TOKEN, "non-working-token");
	}

	@Override
	public Object get(Key key) {
		if (config.containsKey(key))
			return config.get(key);
		else
			return key.getDefaultValue();
	}

	@Override
	public Object get(Key key, Object defaultValue) {
		return this.config.getOrDefault(key, defaultValue);
	}

}

Connect to localhost brick daemon.


// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.container.logging;

import com.google.inject.Inject;
import com.yahoo.component.AbstractComponent;

import java.util.logging.Logger;

/**
 * @author mortent
 */
public class FileConnectionLog extends AbstractComponent implements ConnectionLog {

    private static final Logger logger = Logger.getLogger(FileConnectionLog.class.getName());
    private final ConnectionLogHandler logHandler;

    @Inject
    public FileConnectionLog(ConnectionLogConfig config) {
        logHandler = new ConnectionLogHandler(config.cluster(), config.logDirectoryName(), config.queueSize(), new JsonConnectionLogWriter());
    }

    @Override
    public void log(ConnectionLogEntry connectionLogEntry) {
        logHandler.log(connectionLogEntry);
    }

    @Override
    public void deconstruct() {
        logHandler.shutdown();
    }

}

// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.container.logging;

import com.google.inject.Inject;
import com.yahoo.component.AbstractComponent;

/**
 * @author mortent
 */
public class FileConnectionLog extends AbstractComponent implements ConnectionLog {

    private final ConnectionLogHandler logHandler;

    @Inject
    public FileConnectionLog(ConnectionLogConfig config) {
        logHandler = new ConnectionLogHandler(config.logDirectoryName(), config.cluster(), config.queueSize(), new JsonConnectionLogWriter());
    }

    @Override
    public void log(ConnectionLogEntry connectionLogEntry) {
        logHandler.log(connectionLogEntry);
    }

    @Override
    public void deconstruct() {
        logHandler.shutdown();
    }

}

Fix ordering of constructor arguments


package com.elmakers.mine.bukkit.plugins.magic;

import java.util.Set;

import org.bukkit.Material;
import org.bukkit.block.Block;

import com.elmakers.mine.bukkit.utilities.borrowed.ConfigurationNode;

public abstract class BlockSpell extends Spell {

	private Set<Material>	indestructible;
	private Set<Material>	destructible;

	public boolean isIndestructible(Block block)
	{
		if (indestructible == null) {
			return mage.isIndestructible(block);
		}
		return indestructible.contains(block);
	}

	public boolean isDestructible(Block block)
	{
		if (destructible == null) {
			return mage.isDestructible(block);
		}
		return destructible.contains(block);
	}

	@Override
	protected void processParameters(ConfigurationNode parameters) {
		super.processParameters(parameters);
		indestructible = null;
		if (parameters.containsKey("indestructible")) {
			indestructible = parameters.getMaterials("indestructible", "");
		}
		destructible = null;
		if (parameters.containsKey("destructible")) {
			destructible = parameters.getMaterials("destructible", "");
		}
	}
}

package com.elmakers.mine.bukkit.plugins.magic;

import java.util.Set;

import org.bukkit.Material;
import org.bukkit.block.Block;

import com.elmakers.mine.bukkit.utilities.borrowed.ConfigurationNode;

public abstract class BlockSpell extends Spell {

	private Set<Material>	indestructible;
	private Set<Material>	destructible;

	public boolean isIndestructible(Block block)
	{
		if (indestructible == null) {
			return mage.isIndestructible(block);
		}
		return indestructible.contains(block.getType());
	}

	public boolean isDestructible(Block block)
	{
		if (destructible == null) {
			return mage.isDestructible(block);
		}
		return destructible.contains(block.getType());
	}

	@Override
	protected void processParameters(ConfigurationNode parameters) {
		super.processParameters(parameters);
		indestructible = null;
		if (parameters.containsKey("indestructible")) {
			indestructible = parameters.getMaterials("indestructible", "");
		}
		destructible = null;
		if (parameters.containsKey("destructible")) {
			destructible = parameters.getMaterials("destructible", "");
		}
	}
}

Fix really broken destructible material test.


package com.thegongoliers.output.motors;

import com.thegongoliers.annotations.Untested;

import java.util.function.BooleanSupplier;

@Untested
public class LimiterMotorModule implements MotorModule {

    private BooleanSupplier mPositiveLimit;
    private BooleanSupplier mNegativeLimit;

    public LimiterMotorModule(BooleanSupplier positiveLimit, BooleanSupplier negativeLimit) {
        mPositiveLimit = positiveLimit;
        mNegativeLimit = negativeLimit;

        if (mPositiveLimit == null) {
            mPositiveLimit = () -> false;
        }

        if (mNegativeLimit == null) {
            mNegativeLimit = () -> false;
        }
    }

    @Override
    public double run(double currentSpeed, double desiredSpeed, double deltaTime) {
        if (shouldStop(desiredSpeed)) {
            return 0.0;
        }
        return desiredSpeed;
    }

    public boolean isAtPositiveLimit(){
        return mPositiveLimit.getAsBoolean();
    }

    public boolean isAtNegativeLimit(){
        return mNegativeLimit.getAsBoolean();
    }

    private boolean shouldStop(double speed) {
        if (speed > 0 && isAtPositiveLimit()) {
            return true;
        }

        if (speed < 0 && isAtNegativeLimit()) {
            return true;
        }

        return false;
    }
}

package com.thegongoliers.output.motors;

import com.thegongoliers.annotations.Untested;

import java.util.function.BooleanSupplier;

@Untested
public class LimiterMotorModule implements MotorModule {

    private BooleanSupplier mPositiveLimit;
    private BooleanSupplier mNegativeLimit;

    public LimiterMotorModule(BooleanSupplier positiveLimit, BooleanSupplier negativeLimit) {
        mPositiveLimit = positiveLimit;
        mNegativeLimit = negativeLimit;

        if (mPositiveLimit == null) {
            mPositiveLimit = () -> false;
        }

        if (mNegativeLimit == null) {
            mNegativeLimit = () -> false;
        }
    }

    public void setNegativeLimit(BooleanSupplier mNegativeLimit) {
        this.mNegativeLimit = mNegativeLimit;
    }

    public void setPositiveLimit(BooleanSupplier mPositiveLimit) {
        this.mPositiveLimit = mPositiveLimit;
    }

    @Override
    public double run(double currentSpeed, double desiredSpeed, double deltaTime) {
        if (shouldStop(desiredSpeed)) {
            return 0.0;
        }
        return desiredSpeed;
    }

    public boolean isAtPositiveLimit(){
        return mPositiveLimit.getAsBoolean();
    }

    public boolean isAtNegativeLimit(){
        return mNegativeLimit.getAsBoolean();
    }

    private boolean shouldStop(double speed) {
        if (speed > 0 && isAtPositiveLimit()) {
            return true;
        }

        if (speed < 0 && isAtNegativeLimit()) {
            return true;
        }

        return false;
    }
}

Add setters for limited motor


package codenizer.sonarqube.typescript;

public class AnalysisRunnerImpl implements AnalysisRunner {
    public AnalysisResult[] Execute(String projectRootDirectory) {
        AnalysisResult[] result = new AnalysisResult[0];

       try {
           // 1) Set working directory to projectRootDirectory
           // 2) Call analyzer.js
           // 3) Parse result file
           Process p = Runtime.getRuntime().exec("node analyzer.js");

           p.waitFor();
       }
       catch(Exception ex) {

       }

        return result;
    }
}

package codenizer.sonarqube.typescript;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AnalysisRunnerImpl implements AnalysisRunner {
    private final Logger log = LoggerFactory.getLogger(this.getClass());

    public AnalysisResult[] Execute(String projectRootDirectory) {
        AnalysisResult[] result = new AnalysisResult[0];

       try {
           // 1) Set working directory to projectRootDirectory
           // 2) Call analyzer.js
           // 3) Parse result file

           String[] commands = new String[] {
               "node",
               "analyzer.js",
               "**/*.ts"    /* we can specify this glob because we're already in the source directory */
           };

           Process p = Runtime.getRuntime().exec(commands, null /* inherit env */, new File(projectRootDirectory));

           int exitCode = p.waitFor();

           if(exitCode != 0) {
               log.error("Running analyzer failed with exit code " + exitCode);
           }

           // Look for file in current directory
           String pathToResultFile = "ts-analysis-results.json";

           result = AnalysisResultParser.FromFile(pathToResultFile);
       }
       catch(Exception ex) {
           log.error(ex.getMessage());
       }

        return result;
    }
}

Set working directory and command arguments


package devopsdistilled.operp.server.data.repo.items;

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

import devopsdistilled.operp.server.data.entity.items.Item;

@Repository
public interface ItemRepository extends JpaRepository<Item, Long> {

}

package devopsdistilled.operp.server.data.repo.items;

import java.util.List;

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

import devopsdistilled.operp.server.data.entity.items.Item;

@Repository
public interface ItemRepository extends JpaRepository<Item, Long> {

	List<Item> findByProductNameAndBrandName(String productName,
			String brandName);

	List<Item> findByItemName(String itemName);

}

Correct return type of the methods


package uk.ac.ebi.quickgo.index.annotation.coterms;

import uk.ac.ebi.quickgo.index.annotation.Annotation;

import java.util.function.Predicate;
import org.springframework.batch.item.ItemProcessor;

/**
 * @author Tony Wardell
 * Date: 06/09/2016
 * Time: 16:30
 * Created with IntelliJ IDEA.
 *
 * A version of ItemProcessor for adding details from an {@link uk.ac.ebi.quickgo.index.annotation.Annotation}
 * to a matrix of permutations where GOTerm A and GOTerm B both annotate the same Gene Product.
 *
 * Version of GPAFileToSummary from Beta
 */
public class AnnotationCoStatsProcessor implements ItemProcessor<Annotation, Annotation> {

    private final CoStatsPermutations coStatsPermutations;
    private final Predicate<Annotation> toBeProcessed;

    public AnnotationCoStatsProcessor(CoStatsPermutations coStatsPermutations,
            Predicate<Annotation> toBeProcessed) {
        this.coStatsPermutations = coStatsPermutations;
        this.toBeProcessed = toBeProcessed;
    }

    @Override
    public Annotation process(Annotation annotation) throws Exception {

        if(toBeProcessed.test(annotation)){
            coStatsPermutations.addRowToMatrix(annotation);
        }

        return annotation;
    }
}

package uk.ac.ebi.quickgo.index.annotation.coterms;

import uk.ac.ebi.quickgo.index.annotation.Annotation;

import com.google.common.base.Preconditions;
import java.util.function.Predicate;
import org.springframework.batch.item.ItemProcessor;

/**
 * @author Tony Wardell
 * Date: 06/09/2016
 * Time: 16:30
 * Created with IntelliJ IDEA.
 *
 * A version of ItemProcessor for adding details from an {@link uk.ac.ebi.quickgo.index.annotation.Annotation}
 * to a matrix of permutations where GOTerm A and GOTerm B both annotate the same Gene Product.
 *
 * Version of GPAFileToSummary from Beta
 */
public class AnnotationCoStatsProcessor implements ItemProcessor<Annotation, Annotation> {

    private final CoStatsPermutations coStatsPermutations;
    private final Predicate<Annotation> toBeProcessed;

    public AnnotationCoStatsProcessor(CoStatsPermutations coStatsPermutations,Predicate<Annotation> toBeProcessed) {
        Preconditions.checkArgument(coStatsPermutations!=null);
        Preconditions.checkArgument(toBeProcessed!=null);
        this.coStatsPermutations = coStatsPermutations;
        this.toBeProcessed = toBeProcessed;
    }

    @Override
    public Annotation process(Annotation annotation) throws Exception {

        if(toBeProcessed.test(annotation)){
            coStatsPermutations.addRowToMatrix(annotation);
        }

        return annotation;
    }
}

Add some preconditions to check state of constructor arguments.


//
// $Id: ActionSequence.java,v 1.2 2001/11/27 08:09:34 mdb Exp $

package com.threerings.cast;

import java.awt.Point;
import java.io.Serializable;

/**
 * The action sequence class describes a particular character animation
 * sequence. An animation sequence consists of one or more frames of
 * animation, renders at a particular frame rate, and has an origin point
 * that specifies the location of the base of the character in relation to
 * the bounds of the animation images.
 */
public class ActionSequence implements Serializable
{
    /** The action sequence name. */
    public String name;

    /** The number of frames per second to show when animating. */
    public int framesPerSecond;

    /** The position of the character's base for this sequence. */
    public Point origin = new Point();

    /**
     * Returns a string representation of this action sequence.
     */
    public String toString ()
    {
        return "[name=" + name + ", framesPerSecond=" + framesPerSecond +
            ", origin=" + origin + "]";
    }
}

//
// $Id: ActionSequence.java,v 1.3 2002/03/27 21:51:33 mdb Exp $

package com.threerings.cast;

import java.awt.Point;
import java.io.Serializable;

/**
 * The action sequence class describes a particular character animation
 * sequence. An animation sequence consists of one or more frames of
 * animation, renders at a particular frame rate, and has an origin point
 * that specifies the location of the base of the character in relation to
 * the bounds of the animation images.
 */
public class ActionSequence implements Serializable
{
    /** The action sequence name. */
    public String name;

    /** The number of frames per second to show when animating. */
    public float framesPerSecond;

    /** The position of the character's base for this sequence. */
    public Point origin = new Point();

    /**
     * Returns a string representation of this action sequence.
     */
    public String toString ()
    {
        return "[name=" + name + ", framesPerSecond=" + framesPerSecond +
            ", origin=" + origin + "]";
    }
}

Define frames per second in floating point.


/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2019 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * 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.axelor.tools.changelog;

public enum EntryType {
  FEATURE("Feature"),
  CHANGE("Change"),
  DEPRECATED("Deprecated"),
  REMOVED("Removed"),
  FIXED("Fixed"),
  SECURITY("Security");

  private final String value;

  private EntryType(String value) {
    this.value = value;
  }

  public String getValue() {
    return value;
  }
}

/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2019 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * 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.axelor.tools.changelog;

public enum EntryType {
  FEATURE("Features"),
  CHANGE("Changes"),
  DEPRECATE("Deprecated"),
  REMOVE("Removed"),
  FIX("Fixed"),
  SECURITY("Security");

  private final String value;

  private EntryType(String value) {
    this.value = value;
  }

  public String getValue() {
    return value;
  }
}

Rename changelog types and headers


package cz.cuni.mff.d3s.spl.example.newton.checker;

import cz.cuni.mff.d3s.spl.core.data.SerieDataSource;
import cz.cuni.mff.d3s.spl.core.data.instrumentation.InstrumentingDataSource;
import cz.cuni.mff.d3s.spl.core.formula.Formula;
import cz.cuni.mff.d3s.spl.core.formula.Result;
import cz.cuni.mff.d3s.spl.core.formula.SlaFormula;

public class SlaChecker implements Runnable {

	private final static String METHOD = "org.apache.commons.math.analysis.solvers.NewtonSolver#solve";
			//"org.apache.commons.math.analysis.polynomials.PolynomialFunction#value";
	private final static long SEC_TO_NANOS = 1000 * 1000 * 1000;

	SerieDataSource source;
	Formula sla;

	public SlaChecker() {
		source = InstrumentingDataSource.create(METHOD);
		sla = SlaFormula.createSimple(source, 1 * SEC_TO_NANOS);
	}

	@Override
	public void run() {
		Result result = sla.evaluate();

		System.err.printf("Contract of NewtonSolver.solve(): %s.\n", result);
	}
}

package cz.cuni.mff.d3s.spl.example.newton.checker;

import cz.cuni.mff.d3s.spl.core.data.SerieDataSource;
import cz.cuni.mff.d3s.spl.core.data.Statistics;
import cz.cuni.mff.d3s.spl.core.data.instrumentation.InstrumentingDataSource;
import cz.cuni.mff.d3s.spl.core.formula.Formula;
import cz.cuni.mff.d3s.spl.core.formula.Result;
import cz.cuni.mff.d3s.spl.core.formula.SlaFormula;

public class SlaChecker implements Runnable {

	private final static String METHOD = "org.apache.commons.math.analysis.solvers.NewtonSolver#solve";
	private final static long SEC_TO_NANOS = 1000 * 1000 * 1000;

	SerieDataSource source;
	Formula sla;

	public SlaChecker() {
		source = InstrumentingDataSource.create(METHOD);
		sla = SlaFormula.createSimple(source, 1 * SEC_TO_NANOS);
	}

	@Override
	public void run() {
		Result result = sla.evaluate();
		Statistics stats = source.get();

		/* Explicitly flush all previous output to prevent interleaving. */
		System.out.flush();
		System.err.flush();

		System.err.printf(
				"NewtonSolver.solve(): mean is %2.1fns, %d samples: %s.\n",
				stats.getArithmeticMean(), stats.getSampleCount(), result);
	}
}

Print more statistics on exit


package com.github.aureliano.verbum_domini.helper;

import org.apache.commons.lang.StringUtils;

public final class UrlHelper {

	private UrlHelper() {
		super();
	}

	public static String join(Object...tokens) {
		return "/" + StringUtils.join(tokens, '/');
	}
}

package com.github.aureliano.verbum_domini.helper;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;

public final class UrlHelper {

	private UrlHelper() {
		super();
	}

	public static String join(Object...tokens) {
		return "/" + StringUtils.join(tokens, '/');
	}

	public static String buildWebAppUrl(ServletRequest request, String path) {
		String contextPath = ((HttpServletRequest) request).getContextPath();
		return join(contextPath.substring(1), path);
	}

	public static String buildWebAppUrl(String path) {
		return buildWebAppUrl(WebHelper.getRequest(), path);
	}
}

Add method to build URLs with context path.


package net.sf.clirr.ant;

import junit.framework.TestCase;
import net.sf.clirr.event.ApiDifference;
import net.sf.clirr.event.Severity;

public class ChangeCounterTest extends TestCase
{
  public void testCorrectCounting()
  {
      ChangeCounter counter = new ChangeCounter();
      counter.reportDiff(new ApiDifference("blah", Severity.WARNING, "Test", null, null));
      counter.reportDiff(new ApiDifference("blah", Severity.ERROR, "Test", null, null));
      counter.reportDiff(new ApiDifference("blah", Severity.INFO, "Test", null, null));
      counter.reportDiff(new ApiDifference("blah", Severity.ERROR, "Test", null, null));
      counter.reportDiff(new ApiDifference("blah", Severity.ERROR, "Test", null, null));
      counter.reportDiff(new ApiDifference("blah", Severity.WARNING, "Test", null, null));
      assertEquals("number of expected errors", 3, counter.getBinErrors());
      assertEquals("number of expected warnings", 2, counter.getBinWarnings());
      assertEquals("number of expected infos", 1, counter.getBinInfos());
  }
}

package net.sf.clirr.ant;

import junit.framework.TestCase;
import net.sf.clirr.event.ApiDifference;
import net.sf.clirr.event.Severity;
import net.sf.clirr.event.Message;

public class ChangeCounterTest extends TestCase
{
  public void testCorrectCounting()
  {
      // a dummy message object
      Message msg = new Message(0, false);

      ChangeCounter counter = new ChangeCounter();
      counter.reportDiff(new ApiDifference(msg, Severity.WARNING, "Test", null, null, null));
      counter.reportDiff(new ApiDifference(msg, Severity.ERROR, "Test", null, null, null));
      counter.reportDiff(new ApiDifference(msg, Severity.INFO, "Test", null, null, null));
      counter.reportDiff(new ApiDifference(msg, Severity.ERROR, "Test", null, null, null));
      counter.reportDiff(new ApiDifference(msg, Severity.ERROR, "Test", null, null, null));
      counter.reportDiff(new ApiDifference(msg, Severity.WARNING, "Test", null, null, null));
      assertEquals("number of expected errors", 3, counter.getBinErrors());
      assertEquals("number of expected warnings", 2, counter.getBinWarnings());
      assertEquals("number of expected infos", 1, counter.getBinInfos());
  }
}

Use dummy Message object to be compatible with new ApiDifference API


/*****************************************************************************
 ** Copyright (c) 2010 - 2012 Ushahidi Inc
 ** All rights reserved
 ** Contact: team@ushahidi.com
 ** Website: http://www.ushahidi.com
 **
 ** GNU Lesser General Public License Usage
 ** This file may be used under the terms of the GNU Lesser
 ** General Public License version 3 as published by the Free Software
 ** Foundation and appearing in the file LICENSE.LGPL included in the
 ** packaging of this file. Please review the following information to
 ** ensure the GNU Lesser General Public License version 3 requirements
 ** will be met: http://www.gnu.org/licenses/lgpl.html.
 **
 **
 ** If you have questions regarding the use of this file, please contact
 ** Ushahidi developers at team@ushahidi.com.
 **
 *****************************************************************************/
package com.crowdmap.java.sdk.net;

/**
 * Crowdmap constants for http related activities
 */
public interface ICrowdmapConstants {

	public String CHARSET_UTF8 = "UTF-8";

	public String CONTENT_TYPE_JSON = "application/json";

	public String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
}

/*****************************************************************************
 ** Copyright (c) 2010 - 2012 Ushahidi Inc
 ** All rights reserved
 ** Contact: team@ushahidi.com
 ** Website: http://www.ushahidi.com
 **
 ** GNU Lesser General Public License Usage
 ** This file may be used under the terms of the GNU Lesser
 ** General Public License version 3 as published by the Free Software
 ** Foundation and appearing in the file LICENSE.LGPL included in the
 ** packaging of this file. Please review the following information to
 ** ensure the GNU Lesser General Public License version 3 requirements
 ** will be met: http://www.gnu.org/licenses/lgpl.html.
 **
 **
 ** If you have questions regarding the use of this file, please contact
 ** Ushahidi developers at team@ushahidi.com.
 **
 *****************************************************************************/
package com.crowdmap.java.sdk.net;

/**
 * Crowdmap constants for http related activities
 */
public interface ICrowdmapConstants {

	public String CHARSET_UTF8 = "UTF-8";

	public String CONTENT_TYPE_JSON = "application/json";

	public String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";

	public String HOST_API = "api.crdmp3.com";

	public String API_VERSION = "v1";

	public String PROTOCOL_HTTPS = "https";

	public String PROTOCOL_HTTP = "http";

	public String URL_API = PROTOCOL_HTTP + "://" + HOST_API;

	public String SEGMENT_MEDIA = "/media";

	public String SEGMENT_MAPS = "/maps";

	public String SEGMENT_LOCATIONS = "/locations";

	public String SEGMENT_POSTS = "/posts";

	public String SEGMENT_PEOPLE = "/people";

	public String SEGMENT_EXTERNALS = "/externals";

	public String SEGMENT_ABOUT = "/about";

	public String SEGMENT_HEARTBEAT = "/heartbeat";

	public String SEGMENT_PLACES_SEARCH = "/places/search";

}

Add the different segments that makes up crowdmap endit point as constants for easier maintenance


package com.williamfiset.algorithms.graphtheory;

public class NewAlgorithm {

  public static void main(String[] args) {

                       }
}

Test hooks/ dir pre-push hook works


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package net.kirauks.minigames.engine.utils;

import javafx.scene.input.KeyCode;

/**
 *
 * @author Karl
 */
public class Options {
    public Options(){}

    public KeyCode getUpKey(){
        return KeyCode.UP;
    }
    public KeyCode getDownKey(){
        return KeyCode.DOWN;
    }
    public KeyCode getLeftKey(){
        return KeyCode.LEFT;
    }
    public KeyCode getRightKey(){
        return KeyCode.RIGHT;
    }
    public KeyCode getActionKey(){
        return KeyCode.SPACE;
    }
    public KeyCode getPauseKey(){
        return KeyCode.ESCAPE;
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package net.kirauks.minigames.engine.utils;

import javafx.scene.input.KeyCode;

/**
 *
 * @author Karl
 */
public class Options {
    public static KeyCode getUpKey(){
        return KeyCode.UP;
    }
    public static KeyCode getDownKey(){
        return KeyCode.DOWN;
    }
    public static KeyCode getLeftKey(){
        return KeyCode.LEFT;
    }
    public static KeyCode getRightKey(){
        return KeyCode.RIGHT;
    }
    public static KeyCode getActionKey(){
        return KeyCode.SPACE;
    }
    public static KeyCode getPauseKey(){
        return KeyCode.ESCAPE;
    }
}

Use static methods for options


package edu.umich.lib.solr.analysis;
import java.util.Map;
import org.apache.lucene.analysis.util.TokenFilterFactory;
import org.apache.lucene.analysis.TokenStream;

public class LCCNNormalizerFilterFactory extends TokenFilterFactory
{
    protected LCCNNormalizerFilterFactory(Map<String, String> args) {
		super(args);
	}

    public LCCNNormalizerFilter create(TokenStream input)
    {
        return new LCCNNormalizerFilter(input);
    }
}

package edu.umich.lib.solr.analysis;
import java.util.Map;
import org.apache.lucene.analysis.util.TokenFilterFactory;
import org.apache.lucene.analysis.TokenStream;

public class LCCNNormalizerFilterFactory extends TokenFilterFactory
{
    public LCCNNormalizerFilterFactory(Map<String, String> args) {
        super(args);
    }

    @Override
    public LCCNNormalizerFilter create(TokenStream input)
    {
        return new LCCNNormalizerFilter(input);
    }
}

Fix constructor in LCCNNormalizationFilterFactory too


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

package org.openmhealth.shimmer.common.domain.parameters;

import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author Chris Schaefbauer
 */
public class DateTimeRequestParameter extends RequestParameter<OffsetDateTime> {

    private DateTimeFormatter dateTimeFormat;

    public DateTimeFormatter getDateTimeFormat() {
        return dateTimeFormat;
    }

    public void setDateTimeFormat(DateTimeFormatter dateTimeFormat) {
        this.dateTimeFormat = dateTimeFormat;
    }
}

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

package org.openmhealth.shimmer.common.domain.parameters;

import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author Chris Schaefbauer
 */
public class DateTimeRequestParameter extends RequestParameter<OffsetDateTime> {

    // TODO unix time?
    // TODO how do we parse?
    private DateTimeFormatter dateTimeFormat;

    public DateTimeFormatter getDateTimeFormat() {
        return dateTimeFormat;
    }

    public void setDateTimeFormat(DateTimeFormatter dateTimeFormat) {
        this.dateTimeFormat = dateTimeFormat;
    }
}

Add TODOs to date time request parameter


package org.webdsl.lang;

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

/**
 *  lookup of session variables
 */
public class EnvironmentSessionVariableLookup {

	protected Map<String,Object> variables = new HashMap<String,Object>();

	public EnvironmentSessionVariableLookup(){}

	public Object getVariable(String key) {
		Object o = variables.get(key);
		if(o != null){
			return o;
		}
		else{
			throw new RuntimeException("session variable lookup failed for name: "+key);
		}
	}

	public void putVariable(String key, Object value) {
		variables.put(key, value);
	}

}

package org.webdsl.lang;

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

import org.webdsl.logging.Logger;

/**
 *  lookup of session variables
 */
public class EnvironmentSessionVariableLookup {

	protected Map<String,Object> variables = new HashMap<String,Object>();

	public EnvironmentSessionVariableLookup(){}

	public Object getVariable(String key) {
		Object o = variables.get(key);
		if(o == null){
			Logger.error(new RuntimeException("session variable lookup failed for name: "+key));
		}
		return o;
	}

	public void putVariable(String key, Object value) {
		variables.put(key, value);
	}

}

Change handling session variables. When lookup fails, return null instead of throwing exception. It still logs an exception.


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

/**
 * This package contains the types representing the queries to a relational Database.
 *
 * <p>The package is {@linkplain io.spine.annotation.Internal internal} to Spine code and should not
 * be used outside of the library.
 */

@Internal
@ParametersAreNonnullByDefault
package io.spine.server.storage.jdbc.query;

import io.spine.annotation.Internal;

import javax.annotation.ParametersAreNonnullByDefault;

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

/**
 * This package contains the API for working with queries and common queries for different storages.
 *
 * <p>The package is {@linkplain io.spine.annotation.Internal internal} to Spine code and should not
 * be used outside of the library.
 */

@Internal
@ParametersAreNonnullByDefault
package io.spine.server.storage.jdbc.query;

import io.spine.annotation.Internal;

import javax.annotation.ParametersAreNonnullByDefault;

Update package info for `query` package


/*
 * Licensed to Crate under one or more contributor license agreements.
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.  Crate 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.
 *
 * However, if you have executed another commercial license agreement
 * with Crate these terms will supersede the license and you may use the
 * software solely pursuant to the terms of the relevant commercial
 * agreement.
 */

package io.crate.operation.projectors;

import io.crate.core.collections.Row;
import io.crate.core.collections.Row1;

public class MergeCountProjector extends AbstractProjector {

    private long sum;

    @Override
    public boolean setNextRow(Row row) {
        Long count = (Long)row.get(0);
        sum += count.longValue();
        return true;
    }

    @Override
    public void finish() {
        downstream.setNextRow(new Row1(sum));
        downstream.finish();
    }

    @Override
    public void fail(Throwable throwable) {
        downstream.fail(throwable);
    }
}

/*
 * Licensed to Crate under one or more contributor license agreements.
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.  Crate 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.
 *
 * However, if you have executed another commercial license agreement
 * with Crate these terms will supersede the license and you may use the
 * software solely pursuant to the terms of the relevant commercial
 * agreement.
 */

package io.crate.operation.projectors;

import io.crate.core.collections.Row;
import io.crate.core.collections.Row1;

public class MergeCountProjector extends AbstractProjector {

    private long sum;

    @Override
    public boolean setNextRow(Row row) {
        Long count = (Long)row.get(0);
        sum += count;
        return true;
    }

    @Override
    public void finish() {
        downstream.setNextRow(new Row1(sum));
        downstream.finish();
    }

    @Override
    public void fail(Throwable throwable) {
        downstream.fail(throwable);
    }
}

Remove explicit unboxing to primitive


package me.coley.recaf.ui.component;

import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JPanel;

/**
 * A group of radio-buttons that handles singular radio selection.
 *
 * @author Matt
 */
@SuppressWarnings("serial")
public class LabeledComponentGroup extends JPanel {
	private final GridBagConstraints c = new GridBagConstraints();

	public LabeledComponentGroup(LabeledComponent... components) {
		setLayout(new GridBagLayout());
		c.anchor = GridBagConstraints.WEST;
		c.weightx = 1.0;
		c.weighty = 1.0;
		for (LabeledComponent comp : components) {
			add(comp);
			c.gridy += 1;
		}
	}

	/**
	 * Overridden to prevent adding components the default way.
	 */
	@Override
	public Component add(Component comp) throws RuntimeException {
		if (comp instanceof LabeledComponent) {
			LabeledComponent lc = (LabeledComponent) comp;
			c.fill = GridBagConstraints.HORIZONTAL;
			c.gridx = 0;
			c.gridwidth = 1;
			super.add(lc.getLabel(), c);
			c.fill = GridBagConstraints.HORIZONTAL;
			c.gridx = 0;
			c.gridwidth = 1;
			super.add(lc.getComponent(), c);
			return comp;
		} else throw new RuntimeException("Non-LabeledComponent are not supported!!");
	}
}

package me.coley.recaf.ui.component;

import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JPanel;

/**
 * A group of radio-buttons that handles singular radio selection.
 *
 * @author Matt
 */
@SuppressWarnings("serial")
public class LabeledComponentGroup extends JPanel {
	private final GridBagConstraints c = new GridBagConstraints();

	public LabeledComponentGroup(LabeledComponent... components) {
		setLayout(new GridBagLayout());
		c.anchor = GridBagConstraints.WEST;
		c.weightx = 1.0;
		c.weighty = 1.0;
		c.gridy = 1;
		for (LabeledComponent comp : components) {
			add(comp);
		}
	}

	/**
	 * Overridden to prevent adding components the default way.
	 */
	@Override
	public Component add(Component comp) throws RuntimeException {
		if (comp instanceof LabeledComponent) {
			LabeledComponent lc = (LabeledComponent) comp;
			c.fill = GridBagConstraints.HORIZONTAL;
			c.gridx = 0;
			c.gridwidth = 1;
			super.add(lc.getLabel(), c);
			c.fill = GridBagConstraints.HORIZONTAL;
			c.gridx = 1;
			c.gridwidth = 1;
			super.add(lc.getComponent(), c);
			c.gridy += 1;
			return comp;
		} else throw new RuntimeException("Non-LabeledComponent are not supported!!");
	}
}

Fix overlapping elements in groups


package org.usfirst.frc.team4761.robot.subsystems;

import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 */
public class Shooter extends Subsystem {

    // Put methods for controlling this subsystem
    // here. Call these from Commands.

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    }

    public void shoot() {
    	//TODO: Implement shooting
    }
}

package org.usfirst.frc.team4761.robot.subsystems;

import org.usfirst.frc.team4761.robot.XAxisRelativeDirection;

import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 */
public class Shooter extends Subsystem {

    // Put methods for controlling this subsystem
    // here. Call these from Commands.

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    }

    public void shoot() {
    	//TODO: Implement shooting
    }

    public void rotate(XAxisRelativeDirection direction) {
    	//TODO: Implement turning (must be very precise)
    }
}

Add stub function for rotating


package org.usfirst.frc.team4761.robot.subsystems;

import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 */
public class Shooter extends Subsystem {

    // Put methods for controlling this subsystem
    // here. Call these from Commands.

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    }

    public void shoot() {
    	//TODO: Implement shooting
    }

}

Add shoot function to shooter (stub)


package de.fernunihagen.dna.jkn.scalephant.distribution.resource;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;

import de.fernunihagen.dna.jkn.scalephant.distribution.membership.DistributedInstance;

public class RandomResourcePlacementStrategy implements ResourcePlacementStrategy {

	/**
	 * The random generator
	 */
	protected final Random randomGenerator;

	public RandomResourcePlacementStrategy() {
		randomGenerator = new Random();
	}

	@Override
	public DistributedInstance findSystemToAllocate(final Collection<DistributedInstance> systems) {

		synchronized (systems) {
			final List<DistributedInstance> elements = new ArrayList<DistributedInstance>(systems);
			final int element = Math.abs(randomGenerator.nextInt()) % elements.size();
			return elements.get(element);
		}

	}

}

package de.fernunihagen.dna.jkn.scalephant.distribution.resource;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;

import de.fernunihagen.dna.jkn.scalephant.distribution.membership.DistributedInstance;

public class RandomResourcePlacementStrategy implements ResourcePlacementStrategy {

	/**
	 * The random generator
	 */
	protected final Random randomGenerator;

	public RandomResourcePlacementStrategy() {
		randomGenerator = new Random();
	}

	@Override
	public DistributedInstance findSystemToAllocate(final Collection<DistributedInstance> systems) {

		if(systems.isEmpty()) {
			throw new IllegalArgumentException("Unable to choose a system, list of systems is empty");
		}

		synchronized (systems) {
			final List<DistributedInstance> elements = new ArrayList<DistributedInstance>(systems);
			final int element = Math.abs(randomGenerator.nextInt()) % elements.size();
			return elements.get(element);
		}

	}

}

Throw an exception on empty resource list