package vg.civcraft.mc.citadel.command.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import vg.civcraft.mc.citadel.PlayerState;
import vg.civcraft.mc.citadel.Utility;
import vg.civcraft.mc.civmodcore.command.PlayerCommand;

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

public class Off extends PlayerCommand{

	public Off(String name) {
		super(name);
		setIdentifier("cto");
		setDescription("Turns all Reinforcement Modes off.");
		setUsage("/cto");
		setArguments(0,0);
	}

	@Override
	public boolean execute(CommandSender sender, String[] args) {
		if (!(sender instanceof Player)){
			sender.sendMessage("Must be a player to run this command.");
			return true;
		}
		Player p = (Player) sender;
		PlayerState state = PlayerState.get(p);
		state.reset();
		if (state.isBypassMode()) {
			state.toggleBypassMode();
		}
		Utility.sendAndLog(p, ChatColor.GREEN, "Reinforcement mode has been set to Normal.");
		return true;
	}

	@Override
	public List<String> tabComplete(CommandSender sender, String[] args) {
		return new ArrayList<String>();
	}

}

package vg.civcraft.mc.citadel.command.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import vg.civcraft.mc.citadel.PlayerState;
import vg.civcraft.mc.citadel.Utility;
import vg.civcraft.mc.civmodcore.command.PlayerCommand;

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

public class Off extends PlayerCommand{

	public Off(String name) {
		super(name);
		setIdentifier("cto");
		setDescription("Turns all Reinforcement Modes off.");
		setUsage("/cto");
		setArguments(0,0);
	}

	@Override
	public boolean execute(CommandSender sender, String[] args) {
		if (!(sender instanceof Player)){
			sender.sendMessage("Must be a player to run this command.");
			return true;
		}
		Player p = (Player) sender;
		PlayerState state = PlayerState.get(p);
		state.reset();
		if (state.isBypassMode()) {
			state.toggleBypassMode();
		}
		if (state.getEasyMode()) {
			state.toggleEasyMode();
		}
		Utility.sendAndLog(p, ChatColor.GREEN, "Reinforcement mode has been set to Normal.");
		return true;
	}

	@Override
	public List<String> tabComplete(CommandSender sender, String[] args) {
		return new ArrayList<String>();
	}

}

Clear easy mode on /cto


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * This is the interface for controlling the log level of a
 * component logger.  This hides the actual controlling
 * mechanism.
 *
 * @author arnej27959
 *
 */

/**
 * @author arnej27959
 **/
package com.yahoo.log;

import java.util.logging.Level;

public interface LevelController {

    /**
     * should we actually publish a log message with the given Level now?
     **/
    public boolean shouldLog(Level level);

    /**
     * return a string suitable for printing in a logctl file.
     * the string must be be 4 * 8 characters, where each group
     * of 4 characters is either "  ON" or " OFF".
     **/
    public String getOnOffString();

    /**
     * check the current state of logging and reflect it into the
     * associated Logger instance, if available.
     **/
    public void checkBack();
    public Level getLevelLimit();
}

// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.log;

import java.util.logging.Level;

/**
 * This is the interface for controlling the log level of a
 * component logger.  This hides the actual controlling
 * mechanism.
 *
 * @author arnej27959
 *
 */
public interface LevelController {

    /**
     * should we actually publish a log message with the given Level now?
     */
    boolean shouldLog(Level level);

    /**
     * return a string suitable for printing in a logctl file.
     * the string must be be 4 * 8 characters, where each group
     * of 4 characters is either "  ON" or " OFF".
     */
    String getOnOffString();

    /**
     * check the current state of logging and reflect it into the
     * associated Logger instance, if available.
     */
    void checkBack();
    Level getLevelLimit();
}

Remove 'public' for interface methods


package org.kohsuke.github;

import java.util.Locale;

/**
 * Hook event type.
 *
 * @author Kohsuke Kawaguchi
 * @see GHEventInfo
 * @see Event type reference
 */
public enum GHEvent {
    COMMIT_COMMENT,
    CREATE,
    DELETE,
    DEPLOYMENT,
    DEPLOYMENT_STATUS,
    DOWNLOAD,
    FOLLOW,
    FORK,
    FORK_APPLY,
    GIST,
    GOLLUM,
    INSTALLATION,
    INSTALLATION_REPOSITORIES,
    ISSUE_COMMENT,
    ISSUES,
    LABEL,
    MARKETPLACE_PURCHASE,
    MEMBER,
    MEMBERSHIP,
    MILESTONE,
    ORGANIZATION,
    ORG_BLOCK,
    PAGE_BUILD,
    PROJECT_CARD,
    PROJECT_COLUMN,
    PROJECT,
    PUBLIC,
    PULL_REQUEST,
    PULL_REQUEST_REVIEW,
    PULL_REQUEST_REVIEW_COMMENT,
    PUSH,
    RELEASE,
    REPOSITORY, // only valid for org hooks
    STATUS,
    TEAM,
    TEAM_ADD,
    WATCH,
    PING,
    /**
     * Special event type that means "every possible event"
     */
    ALL;

    /**
     * Returns GitHub's internal representation of this event.
     */
    String symbol() {
        if (this==ALL)  return "*";
        return name().toLowerCase(Locale.ENGLISH);
    }
}

package org.kohsuke.github;

import java.util.Locale;

/**
 * Hook event type.
 *
 * @author Kohsuke Kawaguchi
 * @see GHEventInfo
 * @see Event type reference
 */
public enum GHEvent {
    COMMIT_COMMENT,
    CREATE,
    DELETE,
    DEPLOYMENT,
    DEPLOYMENT_STATUS,
    DOWNLOAD,
    FOLLOW,
    FORK,
    FORK_APPLY,
    GIST,
    GOLLUM,
    INSTALLATION,
    INSTALLATION_REPOSITORIES,
    INTEGRATION_INSTALLATION_REPOSITORIES,
    ISSUE_COMMENT,
    ISSUES,
    LABEL,
    MARKETPLACE_PURCHASE,
    MEMBER,
    MEMBERSHIP,
    MILESTONE,
    ORGANIZATION,
    ORG_BLOCK,
    PAGE_BUILD,
    PROJECT_CARD,
    PROJECT_COLUMN,
    PROJECT,
    PUBLIC,
    PULL_REQUEST,
    PULL_REQUEST_REVIEW,
    PULL_REQUEST_REVIEW_COMMENT,
    PUSH,
    RELEASE,
    REPOSITORY, // only valid for org hooks
    STATUS,
    TEAM,
    TEAM_ADD,
    WATCH,
    PING,
    /**
     * Special event type that means "every possible event"
     */
    ALL;

    /**
     * Returns GitHub's internal representation of this event.
     */
    String symbol() {
        if (this==ALL)  return "*";
        return name().toLowerCase(Locale.ENGLISH);
    }
}

Add missing INTEGRATION_INSTALLATION_REPOSITORIES github event


package com.example.todocloud.app;

public class AppConfig {

  private static String prefix = "http://192.168.1.100/todo_cloud/";  // LAN IP
  /*private static String prefix = "http://192.168.56.1/todo_cloud/";*/  // Genymotion IP
  /*private static String prefix = "http://192.168.173.1/todo_cloud/";*/  // ad hoc network IP

  public static String URL_REGISTER = prefix + "v1/user/register";
  public static String URL_LOGIN = prefix + "v1/user/login";
  public static String URL_GET_TODOS = prefix + "v1/todo/:row_version";
  public static String URL_GET_LISTS = prefix + "v1/list/:row_version";
  public static String URL_GET_CATEGORIES = prefix + "v1/category/:row_version";
  public static String URL_UPDATE_TODO = prefix + "v1/todo/update";
  public static String URL_UPDATE_LIST = prefix + "v1/list/update";
  public static String URL_UPDATE_CATEGORY = prefix + "v1/category/update";
  public static String URL_INSERT_TODO = prefix + "v1/todo/insert";
  public static String URL_INSERT_LIST = prefix + "v1/list/insert";
  public static String URL_INSERT_CATEGORY = prefix + "v1/category/insert";

}

package com.example.todocloud.app;

public class AppConfig {

  /*private static String prefix = "http://192.168.1.100/todo_cloud/";*/  // LAN IP
  /*private static String prefix = "http://192.168.56.1/todo_cloud/";*/  // Genymotion IP
  private static String prefix = "http://10.0.2.2/todo_cloud/";  // AVD IP
  /*private static String prefix = "http://192.168.173.1/todo_cloud/";*/  // ad hoc network IP

  public static String URL_REGISTER = prefix + "v1/user/register";
  public static String URL_LOGIN = prefix + "v1/user/login";
  public static String URL_GET_TODOS = prefix + "v1/todo/:row_version";
  public static String URL_GET_LISTS = prefix + "v1/list/:row_version";
  public static String URL_GET_CATEGORIES = prefix + "v1/category/:row_version";
  public static String URL_UPDATE_TODO = prefix + "v1/todo/update";
  public static String URL_UPDATE_LIST = prefix + "v1/list/update";
  public static String URL_UPDATE_CATEGORY = prefix + "v1/category/update";
  public static String URL_INSERT_TODO = prefix + "v1/todo/insert";
  public static String URL_INSERT_LIST = prefix + "v1/list/insert";
  public static String URL_INSERT_CATEGORY = prefix + "v1/category/insert";

}

Add Android Virtual Device IP


package com.github.dump247.jenkins.plugins.dockerjob.slaves;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

public class DirectoryMapping {
    private static final Pattern MAPPING_PATTERN = Pattern.compile("^(/[^:]+):(/[^:]+)(?::(ro|rw))?$");

    private final String _hostPath;
    private final String _containerPath;
    private final Access _access;

    public DirectoryMapping(String hostPath, String containerPath, Access access) {
        _hostPath = checkNotNull(hostPath);
        _containerPath = checkNotNull(containerPath);
        _access = checkNotNull(access);
    }

    public String getHostPath() {
        return _hostPath;
    }

    public String getContainerPath() {
        return _containerPath;
    }

    public Access getAccess() {
        return _access;
    }

    public static enum Access {
        READ("ro"),
        READ_WRITE("rw");

        private final String _value;

        Access(String value) {
            _value = value;
        }

        public String value() {
            return _value;
        }
    }

    public static DirectoryMapping parse(String value) {
        checkNotNull(value);

        Matcher match = MAPPING_PATTERN.matcher(value);

        if (!match.matches()) {
            throw new IllegalArgumentException("Invalid directory mapping: " + value);
        }

        return new DirectoryMapping(
                match.group(1),
                match.group(2),
                match.group(3).equals("rw") ? Access.READ_WRITE : Access.READ);
    }
}

package com.github.dump247.jenkins.plugins.dockerjob.slaves;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

public class DirectoryMapping {
    private static final Pattern MAPPING_PATTERN = Pattern.compile("^(/[^:]+):(/[^:]+)(?::(ro|rw))?$");

    private final String _hostPath;
    private final String _containerPath;
    private final Access _access;

    public DirectoryMapping(String hostPath, String containerPath, Access access) {
        _hostPath = checkNotNull(hostPath);
        _containerPath = checkNotNull(containerPath);
        _access = checkNotNull(access);
    }

    public String getHostPath() {
        return _hostPath;
    }

    public String getContainerPath() {
        return _containerPath;
    }

    public Access getAccess() {
        return _access;
    }

    public static enum Access {
        READ("ro"),
        READ_WRITE("rw");

        private final String _value;

        Access(String value) {
            _value = value;
        }

        public String value() {
            return _value;
        }
    }

    public static DirectoryMapping parse(String value) {
        checkNotNull(value);

        Matcher match = MAPPING_PATTERN.matcher(value);

        if (!match.matches()) {
            throw new IllegalArgumentException("Invalid directory mapping: " + value);
        }

        return new DirectoryMapping(
                match.group(1),
                match.group(2),
                "rw".equals(match.group(3)) ? Access.READ_WRITE : Access.READ);
    }
}

Fix exception when access is not specified


package openmods.depcheck;

import java.io.File;
import java.util.List;

public class DependencyChecker {

    public static void main(String[] args) {
        final File topDir = new File("data");
        final SourceParser depWalker = new SourceParser(topDir);
        final SourceDependencies availableDependencies = depWalker.collectAvailableDependencies();

        DependencyCollector collector = new DependencyCollector(availableDependencies);
        new TargetParser(topDir).accept(collector);

        final List<DependencyResolveResult> results = collector.getResults();
        new ResultPrinter().print(new File(topDir, "output.html"), availableDependencies, results);
    }
}

package openmods.depcheck;

import java.io.File;
import java.util.List;

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

public class DependencyChecker {

    private static final Logger logger = LoggerFactory.getLogger(DependencyChecker.class);

    public static void main(String[] args) {
        if (args.length == 0)
            args = new String[] { "data" };

        for (String dir : args) {
            final File topDir = new File(dir);
            logger.info("Processing dir: {}", topDir.getAbsolutePath());
            final SourceParser depWalker = new SourceParser(topDir);
            final SourceDependencies availableDependencies = depWalker.collectAvailableDependencies();

            DependencyCollector collector = new DependencyCollector(availableDependencies);
            new TargetParser(topDir).accept(collector);

            final List<DependencyResolveResult> results = collector.getResults();
            new ResultPrinter().print(new File(topDir, "output.html"), availableDependencies, results);
        }
    }
}

Allow to select working dir via program args


package com.gitrekt.resort.model.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "resort.guest_packages")

//Class for a guest's package
public class Package {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "name")
    private String name;

    @Column(name = "price_per_person")
    private double pricePerPerson;

    //The constructor for this class
    public Package(String name, double pricePerPerson){
        this.name = name;
        this.pricePerPerson = pricePerPerson;
    }

    //Returns the name assocociated with the package
    public String getName(){
        return name;
    }

    //Returns the price rate per person for the package
    public double getPricePerPerson(){
        return pricePerPerson;
    }
}

package com.gitrekt.resort.model.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "resort.packages")
public class Package {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "name")
    private String name;

    @Column(name = "price_per_person")
    private double pricePerPerson;

    public Package(String name, double pricePerPerson){
        this.name = name;
        this.pricePerPerson = pricePerPerson;
    }

    public String getName(){
        return name;
    }

    //Returns the price rate per person for the package
    public double getPricePerPerson(){
        return pricePerPerson;
    }
}

Fix minor issues in package class


package stream.flarebot.flarebot.commands;

import net.dv8tion.jda.core.Permission;
import net.dv8tion.jda.core.entities.*;
import stream.flarebot.flarebot.FlareBot;
import stream.flarebot.flarebot.permissions.PerGuildPermissions;

import java.util.EnumSet;

public interface Command {

    void onCommand(User sender, TextChannel channel, Message message, String[] args, Member member);

    String getCommand();

    String getDescription();

    String getUsage();

    CommandType getType();

    default String getPermission() {
        return "flarebot." + getCommand();
    }

    default EnumSet<Permission> getDiscordPermission() {
        return null;
    }

    default String[] getAliases() {
        return new String[]{};
    }

    default PerGuildPermissions getPermissions(MessageChannel chan) {
        return FlareBot.getInstance().getPermissions(chan);
    }

    default boolean isDefaultPermission() {
        return (getPermission() != null && getType() != CommandType.HIDDEN && getType() != CommandType.MODERATION);
    }

    default boolean deleteMessage() {
        return true;
    }

    default char getPrefix(Guild guild) {
        return FlareBot.getPrefix(guild.getId());
    }
}

package stream.flarebot.flarebot.commands;

import net.dv8tion.jda.core.Permission;
import net.dv8tion.jda.core.entities.*;
import stream.flarebot.flarebot.FlareBot;
import stream.flarebot.flarebot.permissions.PerGuildPermissions;

import java.util.EnumSet;

public interface Command {

    void onCommand(User sender, TextChannel channel, Message message, String[] args, Member member);

    String getCommand();

    String getDescription();

    String getUsage();

    CommandType getType();

    default String getPermission() {
        return "flarebot." + getCommand();
    }

    default EnumSet<Permission> getDiscordPermission() {
        return EnumSet.noneOf(Permission.class);
    }

    default String[] getAliases() {
        return new String[]{};
    }

    default PerGuildPermissions getPermissions(MessageChannel chan) {
        return FlareBot.getInstance().getPermissions(chan);
    }

    default boolean isDefaultPermission() {
        return (getPermission() != null && getType() != CommandType.HIDDEN && getType() != CommandType.MODERATION);
    }

    default boolean deleteMessage() {
        return true;
    }

    default char getPrefix(Guild guild) {
        return FlareBot.getPrefix(guild.getId());
    }
}

Remove null for empty set


package fr.insee.rmes.api.codes.cj;

import fr.insee.rmes.api.Configuration;

public class CJQueries {

	public static String getCategorieJuridiqueNiveauIII(String code) {
		return "SELECT ?uri ?intitule WHERE { \n"
				+ "?uri skos:notation '" + code + "' . \n"
				+ "?lastCJThirdLevel skos:member ?uri . \n"
				+ "?uri skos:prefLabel ?intitule  \n"
				+ "FILTER (lang(?intitule) = 'fr') \n"
				+ "{ \n"
				+ "SELECT ?lastCJThirdLevel WHERE { \n"
				+ "?lastCJThirdLevel xkos:organizedBy <" + Configuration.BASE_HOST + "/concepts/cj/cjNiveauIII> . \n"
				+ "BIND(STRBEFORE(STRAFTER(STR(?lastThirdLevel ), '" + Configuration.BASE_HOST + "/codes/cj/cj'), '/niveauIII') AS ?lastCJVersion) \n"
				+ "BIND(xsd:float(?lastCJVersion) AS ?lastCJVersionFloat)"
				+ "} \n"
				+ "ORDER BY DESC (?lastCJVersionFloat) \n"
				+ "LIMIT 1 \n"
				+ "} \n"
				+ "}";
	}

}

package fr.insee.rmes.api.codes.cj;

import fr.insee.rmes.api.Configuration;

public class CJQueries {

	public static String getCategorieJuridiqueNiveauIII(String code) {
		return "SELECT ?uri ?intitule WHERE { \n"
				+ "?uri skos:notation '" + code + "' . \n"
				+ "?lastCJThirdLevel skos:member ?uri . \n"
				+ "?uri skos:prefLabel ?intitule  \n"
				+ "FILTER (lang(?intitule) = 'fr') \n"
				+ "{ \n"
				+ "SELECT ?lastCJThirdLevel WHERE { \n"
				+ "?lastCJThirdLevel xkos:organizedBy <" + Configuration.BASE_HOST + "/concepts/cj/cjNiveauIII> . \n"
				+ "BIND(STRBEFORE(STRAFTER(STR(?lastCJThirdLevel), '" + Configuration.BASE_HOST + "/codes/cj/cj'), '/niveauIII') AS ?lastCJVersion) \n"
				+ "BIND(xsd:float(?lastCJVersion) AS ?lastCJVersionFloat)"
				+ "} \n"
				+ "ORDER BY DESC (?lastCJVersionFloat) \n"
				+ "LIMIT 1 \n"
				+ "} \n"
				+ "}";
	}

}

Fix issue with CJ query


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

package org.gradle.language.java.tasks;

import org.gradle.api.Incubating;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.jvm.platform.JavaPlatform;
import org.gradle.jvm.toolchain.JavaToolChain;

import javax.inject.Inject;

/**
 * A platform-aware Java compile task.
 */
@Incubating
public class PlatformJavaCompile extends JavaCompile {
    private JavaPlatform platform;

    @Override
    public JavaPlatform getPlatform() {
        return platform;
    }

    public void setPlatform(JavaPlatform platform) {
        this.platform = platform;
    }

    @Inject
    @Override
    public JavaToolChain getToolChain() {
        return super.getToolChain();
    }
}

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

package org.gradle.language.java.tasks;

import org.gradle.api.Incubating;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.jvm.platform.JavaPlatform;
import org.gradle.jvm.toolchain.JavaToolChain;

import javax.inject.Inject;

/**
 * A platform-aware Java compile task.
 */
@Incubating
public class PlatformJavaCompile extends JavaCompile {
    private JavaPlatform platform;

    @Override
    public JavaPlatform getPlatform() {
        return platform;
    }

    public void setPlatform(JavaPlatform platform) {
        this.platform = platform;
    }

    @Inject
    @Override
    public JavaToolChain getToolChain() {
        throw new UnsupportedOperationException();
    }
}

Throw exception in to be injected method


package org.freecompany.redline;

import java.io.File;
import org.junit.Test;

public class ScannerTest extends TestBase
{

    @Test
    public void scanNoArchRPMTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-1-1.0-1.noarch.rpm" } );
    }

    @Test(expected = ArrayIndexOutOfBoundsException.class)
    public void scanSomeArchTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-3-1.0-1.somearch.rpm" } );
    }
}

package org.freecompany.redline;

import java.io.File;
import org.junit.Test;

public class ScannerTest extends TestBase
{

    @Test
    public void scanNoArchRPMTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-1-1.0-1.noarch.rpm" } );
    }

    @Test
    public void scanSomeArchTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-3-1.0-1.somearch.rpm" } );
    }
}

Remove AIOOBE assertion on scanSomeArchTest


package net.wayward_realms.waywardcharacters;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;

import java.util.Arrays;

public class InventoryClickListener implements Listener {

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getInventory().getTitle().equalsIgnoreCase("Equipment")) {
            if (event.isShiftClick()) {
                event.setCancelled(true);
                return;
            }
            if (Arrays.asList(0, 1, 2, 3, 4, 5, 9, 12, 13, 14, 18, 19, 20, 21, 22, 23).contains(event.getRawSlot())) {
                event.setCancelled(true);
                return;
            }
            if (Arrays.asList(6, 7, 8, 15, 16, 17, 24, 25, 26).contains(event.getRawSlot())) {
                if (event.getCursor().getType() != Material.PAPER || !event.getCursor().hasItemMeta() || !event.getCursor().getItemMeta().hasDisplayName() || !event.getCursor().getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Scroll")) {
                    event.setCancelled(true);
                    return;
                }
            }
        }
    }

}

package net.wayward_realms.waywardcharacters;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;

import java.util.Arrays;

public class InventoryClickListener implements Listener {

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getInventory().getTitle().equalsIgnoreCase("Equipment")) {
            if (event.isShiftClick()) {
                event.setCancelled(true);
                return;
            }
            if (Arrays.asList(0, 1, 2, 3, 4, 5, 9, 12, 13, 14, 18, 19, 20, 21, 22, 23).contains(event.getRawSlot())) {
                event.setCancelled(true);
                return;
            }
            if (Arrays.asList(6, 7, 8, 15, 16, 17, 24, 25, 26).contains(event.getRawSlot())) {
                if ((event.getCursor().getType() != Material.PAPER || !event.getCursor().hasItemMeta() || !event.getCursor().getItemMeta().hasDisplayName() || !event.getCursor().getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Scroll")) && event.getCursor().getType() != Material.AIR) {
                    event.setCancelled(true);
                    return;
                }
            }
        }
    }

}

Fix removing scrolls from equipment inventory


package edu.drexel.tm.cs338.textacular;

import javax.swing.JFrame;

public class ProjectFrame extends JFrame {
	public ProjectFrame() {
		super("TeXtacular");

		add(new LetterPanel());

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(800, 600);
	}
}

package edu.drexel.tm.cs338.textacular;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import net.miginfocom.swing.MigLayout;

public class ProjectFrame extends JFrame {
	private JTabbedPane tabbedPane;

	private JPanel buttonsPanel;

	private JButton btnCompile;
	private JButton btnClear;

	private TemplatePanel[] panels = { new LetterPanel() };

	public ProjectFrame() {
		super("TeXtacular");

		tabbedPane = new JTabbedPane();
		addTabPanels();

		btnCompile = new JButton("Compile");
		btnClear = new JButton("Clear");

		buttonsPanel = new JPanel(new MigLayout());
		buttonsPanel.add(btnCompile);
		buttonsPanel.add(btnClear);

		add(tabbedPane);
		add(buttonsPanel, BorderLayout.SOUTH);

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(800, 600);
	}

	private void addTabPanels() {
		for (TemplatePanel panel : panels) {
			tabbedPane.add(panel.getTemplateName(), panel);
		}
	}
}

Add JTabbedPane and button panel to main frame


package model;

/**
 * Created by ano on 2016. 5. 13..
 */
public class FileManager {
    private static FileManager instance;
    private static FileModel FileModelL = new FileModel();
    private static FileModel FileModelR = new FileModel();
    private FileManager(){}

    public static FileManager getFileManager() { // 1개의 객체를 유지하기 위한 싱글톤
        if(instance == null)
            instance = new FileManager();
        return instance;
    }

    public static FileModel GetFileModelL()
    {
        return FileModelL;
    }
    public static FileModel GetFileModelR()
    {
        return FileModelR;
    }

}

package model;

/**
 * Created by ano on 2016. 5. 13..
 */
public class FileManager {
    private static FileManager instance;
    private FileModel FileModelL = new FileModel();
    private FileModel FileModelR = new FileModel();
    private FileManager(){}

    public static FileManager getFileManager() { // 1개의 객체를 유지하기 위한 싱글톤
        if(instance == null)
            instance = new FileManager();
        return instance;
    }

    public FileModel GetFileModelL()
    {
        return FileModelL;
    }
    public FileModel GetFileModelR()
    {
        return FileModelR;
    }

}

Add statusString and getStatus method


package com.uwetrottmann.trakt.v2.entities;

import java.util.List;

public abstract class BaseEntity {

    public String title;
    public Images images;
    public List<String> available_translations;

}

package com.uwetrottmann.trakt.v2.entities;

import org.joda.time.DateTime;

import java.util.List;

public abstract class BaseEntity {

    public String title;
    public DateTime updated_at;
    public Images images;
    public List<String> available_translations;

}

Add updated_at property to base entity.


package com.vaguehope.onosendai.util;

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

public class SyncMgr {

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

	public Object getSync (final String key) {
		synchronized (this.locks) {
			MutableInt c = this.locks.get(key);
			if (c == null) {
				c = new MutableInt();
				this.locks.put(key, c);
			}
			c.i++;
			return c;
		}
	}

	public void returnSync (final String key) {
		synchronized (this.locks) {
			MutableInt c = this.locks.get(key);
			if (c != null) {
				c.i--;
				if (c.i < 1) this.locks.remove(key);
			}
		}
	}

	private static class MutableInt {

		volatile int i = 0;

		public MutableInt () {}

	}

}

package com.vaguehope.onosendai.util;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class SyncMgr {

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

	public Object getSync (final String key) {
		synchronized (this.locks) {
			AtomicInteger c = this.locks.get(key);
			if (c == null) {
				c = new AtomicInteger(0);
				this.locks.put(key, c);
			}
			c.incrementAndGet();
			return c;
		}
	}

	public void returnSync (final String key) {
		synchronized (this.locks) {
			final AtomicInteger c = this.locks.get(key);
			if (c != null) {
				c.decrementAndGet();
				if (c.intValue() < 1) this.locks.remove(key);
			}
		}
	}

}

Use AtomicInteger instead of strange int wrapper class.


package me.chriskramp.library;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Path("/members")
@Produces(MediaType.APPLICATION_JSON)
public class MemberResource {

  private MemberDAO memberDAO;

  public MemberResource(MemberDAO memberDAO) {
    this.memberDAO = memberDAO;
  }

  @GET
  public List<Member> getAllMembers() {
    return memberDAO.getAllMembers();
  }

  @GET
  @Path("{id}")
  public Member getMember(@PathParam("id") Long id) {
    return memberDAO.findById(id);
  }

  @POST
  @Path("/create")
  @Consumes(MediaType.APPLICATION_JSON)
  public Member createMember(Member member) {
    return memberDAO.save(member);
  }
}

package me.chriskramp.library;

import com.yammer.dropwizard.hibernate.UnitOfWork;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Path("/members")
@Produces(MediaType.APPLICATION_JSON)
public class MemberResource {

  private MemberDAO memberDAO;

  public MemberResource(MemberDAO memberDAO) {
    this.memberDAO = memberDAO;
  }

  @GET
  @UnitOfWork
  public List<Member> getAllMembers() {
    return memberDAO.getAllMembers();
  }

  @GET
  @UnitOfWork
  @Path("{id}")
  public Member getMember(@PathParam("id") Long id) {
    return memberDAO.findById(id);
  }

  @POST
  @UnitOfWork
  @Path("/create")
  @Consumes(MediaType.APPLICATION_JSON)
  public Member createMember(Member member) {
    return memberDAO.save(member);
  }
}

Annotate MemberDAO DB access methods with @UnitOfWork


package com.pseudo_sudo.openstorage;

import com.pseudo_sudo.openstorage.configuration.ConfigurationController;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid=OpenStorage.ID, name=OpenStorage.NAME, version=OpenStorage.VERSION)
public class OpenStorage {
    public static final String ID = "OpenStorage";
    public static final String ID_LOWER = ID.toLowerCase();
    public static final String NAME = "OpenStorage";
    public static final String VERSION = "1.7.10-0.1";

    private ConfigurationController configurationController;

    @Mod.Instance(OpenStorage.ID)
    public static OpenStorage instance;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        this.configurationController = new ConfigurationController(event.getSuggestedConfigurationFile());
    }
}

package com.pseudo_sudo.openstorage;

import com.pseudo_sudo.openstorage.configuration.ConfigurationController;
import com.pseudo_sudo.openstorage.init.ModBlocks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid=OpenStorage.ID, name=OpenStorage.NAME, version=OpenStorage.VERSION)
public class OpenStorage {
    public static final String ID = "OpenStorage";
    public static final String ID_LOWER = ID.toLowerCase();
    public static final String NAME = "OpenStorage";
    public static final String VERSION = "1.7.10-0.1";

    private ConfigurationController configurationController;

    @Mod.Instance(OpenStorage.ID)
    public static OpenStorage instance;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        this.configurationController = new ConfigurationController(event.getSuggestedConfigurationFile());

        ModBlocks.init();
    }
}

Call init to add blocks.


package seedu.address.model.util;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.model.AddressBook;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.tag.UniqueTagList;
import seedu.utask.model.task.Deadline;
import seedu.utask.model.task.EventTask;
import seedu.utask.model.task.Frequency;
import seedu.utask.model.task.Name;
import seedu.utask.model.task.Task;
import seedu.utask.model.task.Timestamp;
import seedu.utask.model.task.UniqueTaskList.DuplicateTaskException;

public class SampleDataUtil {
    public static Task[] getSamplePersons() {
        try {
            return new Task[] {
                    new EventTask(new Name("My first task"), new Deadline("010117"), new Timestamp("0900 to 1000"),
                    new Frequency("-"),
                    new UniqueTagList("important"))
            };
        } catch (IllegalValueException e) {
            throw new AssertionError("sample data cannot be invalid", e);
        }
    }

    public static ReadOnlyAddressBook getSampleAddressBook() {
        try {
            AddressBook sampleAB = new AddressBook();
            for (Task samplePerson : getSamplePersons()) {
                sampleAB.addPerson(samplePerson);
            }
            return sampleAB;
        } catch (DuplicateTaskException e) {
            throw new AssertionError("sample data cannot contain duplicate persons", e);
        }
    }
}

Fix code quality issues introduced by web editor while correcting conflicts


package prope.executables;

import java.nio.file.Paths;

import org.junit.Test;

public class AnalysisWorkflowTests {

	@Test(expected = IllegalArgumentException.class)
	public void testNonExistingDirectory() {
		@SuppressWarnings("unused")
		AnalysisWorkflow sut = new AnalysisWorkflow(Paths.get("foobar"),
				AnalysisType.DEPLOYABILITY);
	}

}

package prope.executables;

import static org.junit.Assert.assertEquals;

import java.nio.file.Paths;
import java.util.List;

import org.junit.Test;

import prope.reporting.ReportEntry;

public class AnalysisWorkflowTests {

	private AnalysisWorkflow sut;

	private final String deployabilityResourcesPath = "src/test/resources/installability/deployment/";

	@Test(expected = IllegalArgumentException.class)
	public void testNonExistingDirectory() {
		sut = new AnalysisWorkflow(Paths.get("foobar"),
				AnalysisType.DEPLOYABILITY);
	}

	@Test
	public void deployabilityAnalysis(){
		sut = new AnalysisWorkflow(Paths.get(deployabilityResourcesPath + "xmlDescriptorWithText.zip"),
				AnalysisType.DEPLOYABILITY);

		List<ReportEntry> results = sut.start().getEntries();
		assertEquals(results.size(),1);

		ReportEntry entry = results.get(0);
		assertEquals(14, getDeploymentEffort(entry));
		assertEquals(2, getEffortOfPackageConstruction(entry));
		assertEquals(12, getDescriptorComplexity(entry));
	}

	private int getDeploymentEffort(ReportEntry entry) {
		if (entry != null) {
			return Integer.parseInt(entry.getVariableValue("DE"));
		} else {
			return 0;
		}
	}

	private int getEffortOfPackageConstruction(ReportEntry entry) {
		if (entry != null) {
			return Integer.parseInt(entry.getVariableValue("EPC"));
		} else {
			return 0;
		}
	}

	private int getDescriptorComplexity(ReportEntry entry) {
		if (entry != null) {
			return Integer.parseInt(entry.getVariableValue("DDS"));
		} else {
			return 0;
		}
	}
}

Add integration test for deployability analysis


//
// Triple Play - utilities for use in PlayN-based games
// Copyright (c) 2011, Three Rings Design, Inc. - All rights reserved.
// http://github.com/threerings/tripleplay/blob/master/LICENSE

package tripleplay.ui.bgs;

import playn.core.ImmediateLayer;
import playn.core.PlayN;
import playn.core.Surface;
import pythagoras.f.IDimension;
import tripleplay.ui.Background;

/**
 * A background that shows a line around a solid color.
 */
public class BorderedBackground extends Background
{
    public BorderedBackground (int bgColor, int borderColor, int thickness) {
        _bgColor = bgColor;
        _borderColor = borderColor;
        _thickness = thickness;
    }

    @Override
    protected Instance instantiate (final IDimension size) {
        return new LayerInstance(PlayN.graphics().createImmediateLayer(new ImmediateLayer.Renderer() {
            public void render (Surface surf) {
                float width = size.width(), height = size.height();
                float bot = height, right = width;
                surf.setFillColor(_bgColor).fillRect(0, 0, width, height);
                surf.setFillColor(_borderColor).
                    drawLine(0, 0, right, 0, _thickness).
                    drawLine(right, 0, right, bot, _thickness).
                    drawLine(right, bot, 0, bot, _thickness).
                    drawLine(0, bot, 0, 0, _thickness);
            }
        }));
    }

    protected final int _bgColor, _borderColor, _thickness;
}

//
// Triple Play - utilities for use in PlayN-based games
// Copyright (c) 2011, Three Rings Design, Inc. - All rights reserved.
// http://github.com/threerings/tripleplay/blob/master/LICENSE

package tripleplay.ui.bgs;

import playn.core.ImmediateLayer;
import playn.core.PlayN;
import playn.core.Surface;
import pythagoras.f.IDimension;
import tripleplay.ui.Background;

/**
 * A background that shows a line around a solid color.
 */
public class BorderedBackground extends Background
{
    public BorderedBackground (int bgColor, int borderColor, int thickness) {
        _bgColor = bgColor;
        _borderColor = borderColor;
        _thickness = thickness;
    }

    @Override
    protected Instance instantiate (final IDimension size) {
        return new LayerInstance(PlayN.graphics().createImmediateLayer(new ImmediateLayer.Renderer() {
            public void render (Surface surf) {
                float width = size.width(), height = size.height();
                float bot = height-1, right = width-1;
                surf.setFillColor(_bgColor).fillRect(0, 0, width, height);
                surf.setFillColor(_borderColor).
                    drawLine(0, 0, right, 0, _thickness).
                    drawLine(right, 0, right, bot, _thickness).
                    drawLine(right, bot, 0, bot, _thickness).
                    drawLine(0, bot, 0, 0, _thickness);
            }
        }));
    }

    protected final int _bgColor, _borderColor, _thickness;
}

Revert "Fix lines in border backgrounds."


package yanagishima.filter;

import yanagishima.util.Constants;

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class YanagishimaFilter implements Filter {

    private boolean corsEnabled;

    private String auditHttpHeaderName;

    public YanagishimaFilter(boolean corsEnabled, String auditHttpHeaderName) {
        this.corsEnabled = corsEnabled;
        this.auditHttpHeaderName = auditHttpHeaderName;
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        if(corsEnabled) {
            HttpServletResponse res = (HttpServletResponse) response;
            if(auditHttpHeaderName == null) {
                res.setHeader("Access-Control-Allow-Headers", Constants.DATASOURCE_HEADER);
            } else {
                res.setHeader("Access-Control-Allow-Headers", Constants.DATASOURCE_HEADER + ", " + auditHttpHeaderName);
            }
            res.setHeader("Access-Control-Allow-Origin", "*");
        }
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
}

package yanagishima.filter;

import yanagishima.util.Constants;

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class YanagishimaFilter implements Filter {

    private boolean corsEnabled;

    private String auditHttpHeaderName;

    public YanagishimaFilter(boolean corsEnabled, String auditHttpHeaderName) {
        this.corsEnabled = corsEnabled;
        this.auditHttpHeaderName = auditHttpHeaderName;
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        if(corsEnabled) {
            HttpServletResponse res = (HttpServletResponse) response;
            if(auditHttpHeaderName == null) {
                res.setHeader("Access-Control-Allow-Headers", Constants.DATASOURCE_HEADER);
            } else {
                res.setHeader("Access-Control-Allow-Headers", Constants.DATASOURCE_HEADER + ", " + auditHttpHeaderName);
            }
            res.setHeader("Access-Control-Allow-Origin", "*");
            res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, DELETE");
        }
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
}

Add Access-Control-Allow-Methods due to spa delete access


package org.texastorque.texastorque2015.auto;

public class DriveAuto extends AutoMode {

    //test auto to try out commands and raw inputs.

    @Override
    public void run() {
        System.out.println("Starting drive auto!");

        runCommand(new DriveDistance("DriveForward", 6, 0.25, 10));
        runCommand(new DriveDistance("DriveForward", -2, 0.25, 10));

        leftSpeed = -0.5;
        rightSpeed = -0.5;

        wait(0.5);

        leftSpeed = 0;
        rightSpeed = 0;
    }

}

package org.texastorque.texastorque2015.auto;

public class DriveAuto extends AutoMode {

    //test auto to try out commands and raw inputs.

    @Override
    public void run() {
        System.out.println("Starting drive auto!");

        runCommand(new DriveDistance("DriveForward", 10, 0.25, 10));
    }

}

Remove bacward drive form drive auto


import config.ConfigExtractor;
import org.junit.Test;
import static org.junit.Assert.assertTrue;

import java.util.Enumeration;

public class ConfigExtractorTest {

    @Test
    public void getProperties() {
        int propertyCount = 0;
        Enumeration<String> properties = ConfigExtractor.getPropertyList();

        while (properties.hasMoreElements()) {
            properties.nextElement();
            propertyCount++;
        }

        assertTrue(propertyCount > 0);
    }

}

import config.ConfigExtractor;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertTrue;

import java.util.Enumeration;

public class ConfigExtractorTest {

    @Test
    public void getProperties() {
        int propertyCount = 0;
        Enumeration<String> properties = ConfigExtractor.getPropertyList();

        while (properties.hasMoreElements()) {
            properties.nextElement();
            propertyCount++;
        }

        assertTrue(propertyCount > 0);
    }

    @Test
    public void testValueForAllProperties() {
        Enumeration<String> properties = ConfigExtractor.getPropertyList();
        boolean allPropertiesInitialized = true;

        while (properties.hasMoreElements()) {
            String propertyName = properties.nextElement();
            String propertyValue = ConfigExtractor.getProperty(propertyName);
            if (propertyValue ==  null) {
                allPropertiesInitialized = false;
            }
        }

        assertTrue(allPropertiesInitialized);
    }

}

Test value for all properties.


package core.auth;

import controllers.routes;
import static org.junit.Assert.*;
import org.junit.*;
import java.util.*;
import play.mvc.*;
import play.libs.*;
import play.test.*;
import static play.test.Helpers.*;
import com.avaje.ebean.Ebean;
import com.google.common.collect.ImmutableMap;

import java.util.List;

public class AuthenticationTest extends WithApplication {

    @Before
    public void setUp() throws Exception {
        start(fakeApplication(inMemoryDatabase(), fakeGlobal()));
        Ebean.save((List) Yaml.load("initial-data.yml"));
    }

    @Test
    public void testValidate() throws Exception {
        Result result = callAction(
            routes.ref.Application.authenticate(),
            fakeRequest().withFormUrlEncodedBody(
                ImmutableMap.of("username", "Karin", "password", "password")
            )
        );

        assertEquals(303, status(result));
        assertEquals("Karin", session(result).get("username"));

        result = callAction(
                routes.ref.Application.authenticate(),
                fakeRequest().withFormUrlEncodedBody(
                        ImmutableMap.of("username", "Karin", "password", "wrongpassword")
                )
        );

        assertEquals(400, status(result));
        assertNull(session(result).get("username"));
    }
}

package core.auth;

import controllers.routes;
import static org.junit.Assert.*;
import org.junit.*;
import java.util.*;
import play.mvc.*;
import play.libs.*;
import play.test.*;
import static play.test.Helpers.*;
import com.avaje.ebean.Ebean;
import com.google.common.collect.ImmutableMap;

import java.util.List;

public class AuthenticationTest extends WithApplication {

    @Before
    public void setUp() throws Exception {
        start(fakeApplication(inMemoryDatabase(), fakeGlobal()));
        Ebean.save((List) Yaml.load("initial-data.yml"));
    }

    @Test
    public void testValidateSuccess() throws Exception {
        Result result = callAction(
            routes.ref.Application.authenticate(),
            fakeRequest().withFormUrlEncodedBody(
                ImmutableMap.of("username", "Karin", "password", "password")
            )
        );

        assertEquals(303, status(result));
        assertEquals("Karin", session(result).get("username"));
    }

    @Test
    public void testValidateFailure() throws Exception {
        Result result = callAction(
                routes.ref.Application.authenticate(),
                fakeRequest().withFormUrlEncodedBody(
                        ImmutableMap.of("username", "Karin", "password", "wrongpassword")
                )
        );

        assertEquals(400, status(result));
        assertNull(session(result).get("username"));
    }
}

Split auth test into success and failure


package codechicken.lib.asm;

import codechicken.lib.asm.ModularASMTransformer.MethodInjector;
import net.minecraft.launchwrapper.IClassTransformer;

import java.util.Map;

public class RenderHookTransformer implements IClassTransformer
{
    private ModularASMTransformer transformer = new ModularASMTransformer();

    public RenderHookTransformer() {
        Map<String, ASMBlock> blocks = ASMReader.loadResource("/assets/ccl/asm/hooks.asm");
        transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/renderer/entity/RenderItem",
                "renderItem", "(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V"),
                blocks.get("n_IItemRenderer"), blocks.get("IItemRenderer"), true));
    }

    @Override
    public byte[] transform(String name, String tname, byte[] bytes) {
        return transformer.transform(name, bytes);
    }
}

package codechicken.lib.asm;

import codechicken.lib.asm.ModularASMTransformer.MethodInjector;
import net.minecraft.launchwrapper.IClassTransformer;

import java.util.Map;

public class RenderHookTransformer implements IClassTransformer
{
    private ModularASMTransformer transformer = new ModularASMTransformer();

    public RenderHookTransformer() {
        Map<String, ASMBlock> blocks = ASMReader.loadResource("/assets/ccl/asm/hooks.asm");
        transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/renderer/entity/RenderItem",
                "func_180454_a", "(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V"),
                blocks.get("n_IItemRenderer"), blocks.get("IItemRenderer"), true));
    }

    @Override
    public byte[] transform(String name, String tname, byte[] bytes) {
        return transformer.transform(name, bytes);
    }
}

Fix srg mapping in hook


package invtweaks.forge;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import invtweaks.InvTweaks;
import net.minecraft.client.Minecraft;

public class ForgeClientTick {
    private InvTweaks instance;

    public ForgeClientTick(InvTweaks inst) {
        instance = inst;
    }

    @SubscribeEvent
    public void onTick(TickEvent.ClientTickEvent tick) {
        if(tick.phase == TickEvent.Phase.END) {
            Minecraft mc = FMLClientHandler.instance().getClient();
            if(mc.theWorld != null) {
                if(mc.currentScreen != null) {
                    instance.onTickInGUI(mc.currentScreen);
                } else {
                    instance.onTickInGame();
                }
            }
        }
    }
}

package invtweaks.forge;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import invtweaks.InvTweaks;
import net.minecraft.client.Minecraft;

public class ForgeClientTick {
    private InvTweaks instance;

    public ForgeClientTick(InvTweaks inst) {
        instance = inst;
    }

    @SubscribeEvent
    public void onTick(TickEvent.ClientTickEvent tick) {
        if(tick.phase == TickEvent.Phase.START) {
            Minecraft mc = FMLClientHandler.instance().getClient();
            if(mc.theWorld != null) {
                if(mc.currentScreen != null) {
                    instance.onTickInGUI(mc.currentScreen);
                } else {
                    instance.onTickInGame();
                }
            }
        }
    }
}

Use start of tick so that all processing happens before MC.


package fr.aumgn.diamondrush.views;

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

import org.bukkit.ChatColor;

public class MessagesView implements Iterable<String> {

    private List<String> messages;
    private StringBuilder current;

    public MessagesView() {
        this.messages = new ArrayList<String>();
        this.current = new StringBuilder();
    }

    public void append(Object obj) {
        current.append(obj);
    }

    public void nl() {
        messages.add(current.toString());
        current = new StringBuilder();
    }

    public void head(Object obj) {
        append(ChatColor.BOLD);
        append(obj);
    }

    public void headLn(Object obj) {
        head(obj.toString());
        nl();
    }

    public void entry(Object name, Object value) {
        append(ChatColor.BLUE);
        append(name);
        append(" : ");
        append(ChatColor.YELLOW);
        append(value);
    }

    public void entryLn(Object name, Object value) {
        entry(name, value);
        nl();
    }

    public void merge(StatisticsView statisticsView) {
        for (String message : statisticsView) {
            messages.add(message);
        }
    }

    @Override
    public Iterator<String> iterator() {
        return messages.iterator();
    }
}

package fr.aumgn.diamondrush.views;

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

import org.bukkit.ChatColor;

public class MessagesView implements Iterable<String> {

    private List<String> messages;
    private StringBuilder current;

    public MessagesView() {
        this.messages = new ArrayList<String>();
        this.current = new StringBuilder();
    }

    public void append(Object obj) {
        current.append(obj);
    }

    public void nl() {
        messages.add(current.toString());
        current = new StringBuilder();
    }

    public void head(Object obj) {
        append(ChatColor.UNDERLINE);
        append(obj);
    }

    public void headLn(Object obj) {
        head(obj.toString());
        nl();
    }

    public void entry(Object name, Object value) {
        append(ChatColor.BLUE);
        append(name);
        append(" : ");
        append(ChatColor.YELLOW);
        append(value);
    }

    public void entryLn(Object name, Object value) {
        entry(name, value);
        nl();
    }

    public void merge(StatisticsView statisticsView) {
        for (String message : statisticsView) {
            messages.add(message);
        }
    }

    @Override
    public Iterator<String> iterator() {
        return messages.iterator();
    }
}

Remove ugly bold formatting in messages


// Copyright 2011 Denis Stepanov
//
// 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 coffeescript.nb.options;

import java.util.prefs.Preferences;
import org.openide.util.NbPreferences;

/**
 *
 * @author Denis Stepanov
 */
public class CoffeeScriptSettings {

    private static CoffeeScriptSettings INSTANCE;

    private CoffeeScriptSettings() {
    }

    public static synchronized CoffeeScriptSettings get() {
        if (INSTANCE == null) {
            INSTANCE = new CoffeeScriptSettings();
        }
        return INSTANCE;
    }

    private Preferences getPreferences() {
        return NbPreferences.forModule(CoffeeScriptSettings.class).node("settings");
    }

    public boolean isBare() {
        return getPreferences().getBoolean("bare", false);
    }

    public void setBare(boolean bare) {
        getPreferences().put("bare", Boolean.toString(bare));
    }
}

// Copyright 2011 Denis Stepanov
//
// 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 coffeescript.nb.options;

import java.util.prefs.Preferences;
import org.openide.util.NbPreferences;

/**
 *
 * @author Denis Stepanov
 */
public class CoffeeScriptSettings {

    private static CoffeeScriptSettings INSTANCE;

    private CoffeeScriptSettings() {
    }

    public static synchronized CoffeeScriptSettings get() {
        if (INSTANCE == null) {
            INSTANCE = new CoffeeScriptSettings();
        }
        return INSTANCE;
    }

    private Preferences getPreferences() {
        return NbPreferences.forModule(CoffeeScriptSettings.class).node("settings");
    }

    public boolean isBare() {
        return getPreferences().getBoolean("bare", true);
    }

    public void setBare(boolean bare) {
        getPreferences().put("bare", Boolean.toString(bare));
    }
}

Make bare on by default


package org.gluu.demo.rest;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

import org.slf4j.Logger;

@Path("/demo")
public class DemoEndpoint {

	@Inject
	private Logger log;

	@GET
	@Path("/status")
	public Response listClients() {
		log.info("Get request to demo endpoint");
		return Response.ok("success").build();
	}

}

package org.gluu.demo.rest;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

import org.slf4j.Logger;

@Path("/demo")
@ApplicationScoped
public class DemoEndpoint {

	@Inject
	private Logger log;

	@GET
	@Path("/status")
	public Response listClients() {
		log.info("Get request to demo endpoint");
		return Response.ok("success").build();
	}

}

Fix logger injection to demo endpoint


package login;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class PasswordHelper
{
	private static String hashAlgorithm = "MD5";
	private static String stringEncodingFormat = "UTF-8";

	public static String generatePasswordHash(String password)
	{
		//Create instances of digest and password char array
		MessageDigest passDigest;
		byte[] passArray;

		try
		{
			//Create instance of MessageDigest we can use to
			passDigest = MessageDigest.getInstance(hashAlgorithm);

			//Convert password to byte array
			passArray = password.getBytes(stringEncodingFormat);
		}
		catch (NoSuchAlgorithmException e)
		{
			e.printStackTrace();
			return "";
		}
		catch (UnsupportedEncodingException e)
		{
			e.printStackTrace();
			return "";
		}

		//Use digest to get an array of chars as a hash and return it as a string
		byte[] hashArray = passDigest.digest(passArray);
		return new String(hashArray);
	}

}

package login;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.xml.bind.DatatypeConverter;

public class PasswordHelper
{
	private static String hashAlgorithm = "MD5";
	private static String stringEncodingFormat = "UTF-8";

	public static String generatePasswordHash(String password)
	{
		//Create instances of digest and password char array
		MessageDigest passDigest;
		byte[] passArray;

		try
		{
			//Create instance of MessageDigest we can use to
			passDigest = MessageDigest.getInstance(hashAlgorithm);

			//Convert password to byte array
			passArray = password.getBytes(stringEncodingFormat);
		}
		catch (NoSuchAlgorithmException e)
		{
			e.printStackTrace();
			return "";
		}
		catch (UnsupportedEncodingException e)
		{
			e.printStackTrace();
			return "";
		}

		//Use digest to get hash as an array of chars and return it as a hex string
		byte[] hashArray = passDigest.digest(passArray);
		return DatatypeConverter.printHexBinary(hashArray);
	}

}

Change return string type to hex string


package com.archiwise.experiment.cspsudoku.domein;

/**
 * Created by nelis on 24/10/15.
 */
public class Cell {

}

package com.archiwise.experiment.cspsudoku.domein;

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

/**
 * Created by nelis on 24/10/15.
 */
public class Cell {

    private List<Integer> possibleValues = Arrays.asList(1,2,3,4,5,6);

    public List<Integer> getPossibleValues() {
        return possibleValues;
    }

    public int getNumberOfPossibleValues() {
        return possibleValues.size();
    }

}

Add implementation for getting the possible values


package se.ericthelin.fractions;

import static java.util.Objects.requireNonNull;

public class Fraction {

	public static Fraction of(String text) {
		return new Fraction(text);
	}

	private final String text;

	private Fraction(String text) {
		this.text = requireNonNull(text);
	}

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

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Fraction)) {
			return false;
		}

		Fraction other = (Fraction) obj;

		return text.equals(other.text);
	}

	public Fraction plus(Fraction term) {
		throw new UnsupportedOperationException("Not yet implemented");
	}
}

package se.ericthelin.fractions;

import static java.util.Objects.requireNonNull;

public class Fraction {

	public static Fraction of(String text) {
		return new Fraction(text);
	}

	private final String text;

	private Fraction(String text) {
		this.text = requireNonNull(text);
	}

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

	@Override
	public boolean equals(Object obj) {
		if (obj == this) {
			return true;
		}

		if (!(obj instanceof Fraction)) {
			return false;
		}

		Fraction other = (Fraction) obj;

		return text.equals(other.text);
	}

	public Fraction plus(Fraction term) {
		throw new UnsupportedOperationException("Not yet implemented");
	}
}

Optimize equals check for same instance


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

import org.junit.Test;

import static io.motown.domain.api.chargingstation.test.ChargingStationTestUtils.IDENTITY_CONTEXT;

public class AcceptChargingStationCommandTest {

    @Test(expected = NullPointerException.class)
    public void nullPointerExceptionThrownWhenCreatingCommandWithChargingStationIdNull() {
        new AcceptChargingStationCommand(null, IDENTITY_CONTEXT);
    }
}

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

import org.junit.Test;

import static io.motown.domain.api.chargingstation.test.ChargingStationTestUtils.CHARGING_STATION_ID;
import static io.motown.domain.api.chargingstation.test.ChargingStationTestUtils.IDENTITY_CONTEXT;

public class AcceptChargingStationCommandTest {

    @Test(expected = NullPointerException.class)
    public void nullPointerExceptionThrownWhenCreatingCommandWithChargingStationIdNull() {
        new AcceptChargingStationCommand(null, IDENTITY_CONTEXT);
    }

    @Test(expected = NullPointerException.class)
    public void nullPointerExceptionThrownWhenCreatingCommandWithIdentityContextNull() {
        new AcceptChargingStationCommand(CHARGING_STATION_ID, null);
    }
}

Test for null identity context


import com.messagebird.MessageBirdClient;
import com.messagebird.MessageBirdService;
import com.messagebird.MessageBirdServiceImpl;
import com.messagebird.exceptions.GeneralException;
import com.messagebird.exceptions.UnauthorizedException;
import com.messagebird.objects.MessageList;

public class ExampleListMessagesFiltered {
    public static void main(String[] args) {

        if (args.length == 0) {
            System.out.println("Please specify your access key example : java -jar <this jar file> test_accesskey");
            return;
        }

        // First create your service object
        final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]);

        // Add the service to the client
        final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr);

        try {
            // Get list of messages with offset and limit
            System.out.println("Retrieving message list");

            // Create filters
            Map<String, Object> filters = new LinkedHashMap<>();
            filters.put("status", "scheduled");

            final MessageList messageList = messageBirdClient.listMessagesFiltered(3, null, filters);

            // Display messages
            System.out.println(messageList.toString());
        } catch (UnauthorizedException | GeneralException exception) {
            if (exception.getErrors() != null) {
                System.out.println(exception.getErrors().toString());
            }
            exception.printStackTrace();
        }
    }
}

import com.messagebird.MessageBirdClient;
import com.messagebird.MessageBirdService;
import com.messagebird.MessageBirdServiceImpl;
import com.messagebird.exceptions.GeneralException;
import com.messagebird.exceptions.UnauthorizedException;
import com.messagebird.objects.MessageList;
import java.util.LinkedHashMap;
import java.util.Map;

public class ExampleListMessagesFiltered {
    public static void main(String[] args) {

        if (args.length == 0) {
            System.out.println("Please specify your access key example : java -jar <this jar file> test_accesskey");
            return;
        }

        // First create your service object
        final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]);

        // Add the service to the client
        final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr);

        try {
            // Get list of messages with offset and limit
            System.out.println("Retrieving message list");

            // Create filters
            Map<String, Object> filters = new LinkedHashMap<>();
            filters.put("status", "scheduled");

            final MessageList messageList = messageBirdClient.listMessagesFiltered(3, null, filters);

            // Display messages
            System.out.println(messageList.toString());
        } catch (UnauthorizedException | GeneralException exception) {
            if (exception.getErrors() != null) {
                System.out.println(exception.getErrors().toString());
            }
            exception.printStackTrace();
        }
    }
}

Fix imports for the ListMessagesFiltered example.


/*
 * JBoss, Home of Professional Open Source
 * Copyright Red Hat, Inc., and individual contributors
 *
 * 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.jboss.aerogear.webpush;

public final class Example {

    public static void main(String[] args) throws Exception {
        WebPushClient webPushClient = new WebPushClient("https://localhost:8443", true);
        try {
            webPushClient.connect();
            webPushClient.subscribe(subscription -> {
                System.out.println(subscription);
                //check new push messages and close the stream (nowait == true)
                webPushClient.monitor(subscription, true, pushMessage -> {
                    if (pushMessage.isPresent()) {
                        System.out.println(pushMessage.get());
                    } else {    //possible only if nowait == true
                        System.out.println("204 No Content");
                    }
                });
                //monitor all new push messages
                webPushClient.monitor(subscription, System.out::println);
            });
            Thread.sleep(30 * 1000);
        } finally {
            webPushClient.disconnect();
        }
    }
}

/*
 * JBoss, Home of Professional Open Source
 * Copyright Red Hat, Inc., and individual contributors
 *
 * 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.jboss.aerogear.webpush;

final class Example {

    public static void main(String[] args) throws Exception {
        WebPushClient webPushClient = new WebPushClient("https://localhost:8443", true);
        try {
            webPushClient.connect();
            webPushClient.subscribe(subscription -> {
                System.out.println(subscription);
                //check new push messages and close the stream (nowait == true)
                webPushClient.monitor(subscription, true, pushMessage -> {
                    if (pushMessage.isPresent()) {
                        System.out.println(pushMessage.get());
                    } else {    //possible only if nowait == true
                        System.out.println("204 No Content");
                    }
                });
                //monitor all new push messages
                webPushClient.monitor(subscription, System.out::println);
            });
            Thread.sleep(30 * 1000);
        } finally {
            webPushClient.disconnect();
        }
    }
}

Make an example package private


package seedu.task.logic.commands;

/**
 * Lists all tasks in the task manager to the user.
 */
//@@author A0142360U
public class RedoCommand extends Command {

    public static final String COMMAND_WORD = "redo";
    public static final String SHORTCUT = "r";
    public static final String MESSAGE_SUCCESS = "Redo Successful";
    public static final String MESSAGE_FAIL = "Redo Unsuccessful";

    public RedoCommand() {}

    @Override
    public CommandResult execute() {
        boolean success = model.redoTask();
        if (success)
            return new CommandResult(MESSAGE_SUCCESS);
        return new CommandResult(MESSAGE_FAIL);
    }
}

package seedu.task.logic.commands;

/**
 * Lists all tasks in the task manager to the user.
 */
//@@author A0142360U
public class RedoCommand extends Command {

    public static final String COMMAND_WORD = "redo";
    public static final String SHORTCUT = "r";
    public static final String MESSAGE_SUCCESS = "Your Undo command has been reversed.";
    public static final String MESSAGE_FAIL = "No more Undo command can be reversed.";

    public RedoCommand() {}

    @Override
    public CommandResult execute() {
        boolean success = model.redoTask();
        if (success)
            return new CommandResult(MESSAGE_SUCCESS);
        return new CommandResult(MESSAGE_FAIL);
    }
}

Change message of redo command


package controllers;

import io.sphere.sdk.categories.Category;
import io.sphere.sdk.categories.queries.CategoryQuery;
import io.sphere.sdk.queries.PagedQueryResult;
import org.junit.Test;
import testutils.WithPlayJavaClient;

import java.util.Locale;

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

public class ApplicationControllerIntegrationTest extends WithPlayJavaClient {
    @Test
    public void itFindsSomeCategories() throws Exception {
        final PagedQueryResult<Category> queryResult = client.execute(new CategoryQuery()).get(2000);
        final int count = queryResult.size();
        assertThat(count).isGreaterThan(3);
        //this is a project specific assertion as example
        assertThat(queryResult.getResults().get(0).getName().get(Locale.ENGLISH).get()).isEqualTo("Tank tops");
    }
}

package controllers;

import io.sphere.sdk.categories.Category;
import io.sphere.sdk.categories.queries.CategoryQuery;
import io.sphere.sdk.queries.PagedQueryResult;
import org.junit.Test;
import testutils.WithPlayJavaClient;

import java.util.Locale;

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

public class ApplicationControllerIntegrationTest extends WithPlayJavaClient {
    @Test
    public void itFindsSomeCategories() throws Exception {
        final PagedQueryResult<Category> queryResult = client.execute(CategoryQuery.of()).get(2000);
        final int count = queryResult.size();
        assertThat(count).isGreaterThan(3);
        //this is a project specific assertion as example
        assertThat(queryResult.getResults().get(0).getName().get(Locale.ENGLISH).get()).isEqualTo("Tank tops");
    }
}

Update to SDK 1.0.0-M8 in integration test scope.


package at.medunigraz.imi.bst.trec.model;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Metrics {

	private Map<String, Double> metrics = new TreeMap<>();

	public void put(String name, double value) {
		metrics.put(name, value);
	}

	public double getMetric(String name) {
		return metrics.getOrDefault(name, 0d);
	}

	public String getMetricsAsString() {
		StringBuilder sb = new StringBuilder();

		Set<Map.Entry<String, Double>> entries = metrics.entrySet();
		for (Map.Entry<String, Double> entry : entries) {
			sb.append(entry.getKey());
			sb.append("=");
			sb.append(entry.getValue());
			sb.append("\n");
		}

		return sb.toString();
	}
}

package at.medunigraz.imi.bst.trec.model;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Metrics {

	private Map<String, Double> metrics = new TreeMap<>();

	public void put(String name, double value) {
		metrics.put(name, value);
	}

	public double getMetric(String name) {
		return metrics.getOrDefault(name, 0d);
	}

	public String getMetricsAsString() {
		StringBuilder sb = new StringBuilder();

		Set<Map.Entry<String, Double>> entries = metrics.entrySet();
		for (Map.Entry<String, Double> entry : entries) {
			sb.append(entry.getKey());
			sb.append("=");
			sb.append(entry.getValue());
			sb.append("\n");
		}

		return sb.toString();
	}

	public double getNDCG() {
		return getMetric("ndcg");
	}

	public double getRPrec() {
		return getMetric("Rprec");
	}

	public double getInfAP() {
		return getMetric("infAP");
	}

	public double getP10() {
		return getMetric("P_10");
	}

	public double getF() {
		return getMetric("set_F");
	}
}

Add convenient methods to get some common metrics


package hackerrank.ctci;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/ctci-connected-cell-in-a-grid
 */
public class ConnectedCellInAGrid {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int grid[][] = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                grid[i][j] = in.nextInt();
            }
        }
    }
}

package hackerrank.ctci;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/ctci-connected-cell-in-a-grid
 */
public class ConnectedCellInAGrid {
    private static int connectedCell(int[][] grid) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int grid[][] = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                grid[i][j] = in.nextInt();
            }
        }
    }
}

Update Connected Cell In A Grid


package org.apereo.cas.token.config;

import org.apereo.cas.configuration.CasConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * This is {@link TokenCoreConfiguration}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@Configuration("tokenAuthenticationConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class TokenCoreConfiguration {
}

package org.apereo.cas.token.config;

import org.apereo.cas.configuration.CasConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * This is {@link TokenCoreConfiguration}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@Configuration("tokenCoreConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class TokenCoreConfiguration {
}

Fix issue with config wiring


package io.myweb.api;

import org.json.JSONObject;

import java.io.InputStream;

public class HttpResponse {

	private String mimeType;

	private Object body;

	private int statusCode;

	private long contentLength;

	private HttpResponse() {}

	public static HttpResponse create() {
		return new HttpResponse();
	}

	public HttpResponse ok() {
		return withStatusCode(200);
	}

	public String getMimeType() {
		return mimeType;
	}

	public Object getBody() {
		return body;
	}

	public HttpResponse withMimeType(String mimeType) {
		this.mimeType = mimeType;
		return this;
	}

	public HttpResponse withMimeTypeFromFilename(String filename) {
		return withMimeType(MimeTypes.getMimeType(filename));
	}

	public HttpResponse withStatusCode(int code) {
		this.statusCode = code;
		return this;
	}

	public HttpResponse withBody(String s) {
		this.body = s;
		return this;
	}

	public HttpResponse withBody(InputStream is) {
		this.body = is;
		return this;
	}

	public HttpResponse withBody(JSONObject jsonObject) {
		this.body = jsonObject;
		return this;
	}

	public HttpResponse withContentLength(long length) {
		this.contentLength = length;
		return this;
	}

	public int getStatusCode() {
		return statusCode;
	}

	public long getContentLength() {
		return contentLength;
	}
}

package io.myweb.api;

import org.json.JSONObject;

import java.io.InputStream;

public class HttpResponse {

	private String mimeType;

	private Object body;

	private int statusCode;

	private long contentLength;

	private HttpResponse() {}

	public static HttpResponse create() {
		return new HttpResponse();
	}

	public HttpResponse ok() {
		return withStatusCode(200);
	}

	public String getMimeType() {
		return mimeType;
	}

	public Object getBody() {
		return body;
	}

	public HttpResponse withMimeType(String mimeType) {
		this.mimeType = mimeType;
		return this;
	}

	public HttpResponse withMimeTypeFromFilename(String filename) {
		return withMimeType(MimeTypes.getMimeType(filename));
	}

	public HttpResponse withStatusCode(int code) {
		this.statusCode = code;
		return this;
	}

	public HttpResponse withBody(String s) {
		this.body = s;
		return this;
	}

	public HttpResponse withBody(InputStream is) {
		this.body = is;
		return this;
	}

	public HttpResponse withBody(JSONObject jsonObject) {
		this.body = jsonObject;
		return withMimeType(MimeTypes.MIME_APPLICATION_JSON);
	}

	public HttpResponse withContentLength(long length) {
		this.contentLength = length;
		return this;
	}

	public int getStatusCode() {
		return statusCode;
	}

	public long getContentLength() {
		return contentLength;
	}
}

Set application/json content when JSONObject is used body


package net.nanopool;

public class DefaultContentionHandler implements ContentionHandler {

    public void handleContention() {
        System.err.println("PoolingDataSource: contention warning.");
        Thread.yield();
    }
}

package net.nanopool;

public class DefaultContentionHandler implements ContentionHandler {
    private final boolean printWarning;

    public DefaultContentionHandler() {
        this(true);
    }

    public DefaultContentionHandler(boolean printWarning) {
        this.printWarning = printWarning;
    }

    public void handleContention() {
        if (printWarning)
            System.err.println("PoolingDataSource: contention warning.");
        Thread.yield();
    }
}

Allow creating it to not be so talkative about contention.


package net.siciarz.openlaundryapi.client;

import java.net.URL;

import org.codehaus.jackson.map.ObjectMapper;

/**
 * Entry point to the application.
 *
 */
public class App {
    public static void main(String[] args) {
        System.out.println("Open Laundry API Java client");
        URL apiUrl;
        try {
            apiUrl = new URL("http://openlaundryapi.org/api/device/666/");
            ObjectMapper mapper = new ObjectMapper();
            Device device = mapper.readValue(apiUrl, Device.class);
            System.out.println(device.getName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

package net.siciarz.openlaundryapi.client;

import java.net.URL;

import org.codehaus.jackson.map.ObjectMapper;

/**
 * Entry point to the application.
 *
 */
public class App {
    public static void main(String[] args) {
        System.out.println("Open Laundry API Java client");
        String deviceId = "666";
        if (args.length > 0) {
            deviceId = args[0];
        }
        try {
            URL apiUrl = new URL("http://openlaundryapi.org/api/device/"
                            + deviceId + "/");
            ObjectMapper mapper = new ObjectMapper();
            Device device = mapper.readValue(apiUrl, Device.class);
            System.out.println(device.getName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Handle device_id set as commandline argument.


package jenkins.util;

import hudson.slaves.DumbSlave;
import java.io.IOException;
import jenkins.security.MasterToSlaveCallable;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class JenkinsJVMRealTest {

    @ClassRule
    public static JenkinsRule j = new JenkinsRule();

    @Test
    public void isJenkinsJVM() throws Exception {
        assertThat(new IsJenkinsJVM().call(), is(true));
        DumbSlave slave = j.createOnlineSlave();
        assertThat(slave.getChannel().call(new IsJenkinsJVM()), is(false));
    }

    public static class IsJenkinsJVM extends MasterToSlaveCallable<Boolean, IOException> {

        @Override
        public Boolean call() throws IOException {
            return JenkinsJVM.isJenkinsJVM();
        }
    }

}

package jenkins.util;

import hudson.slaves.DumbSlave;
import java.io.IOException;
import jenkins.security.MasterToSlaveCallable;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class JenkinsJVMRealTest {

    @ClassRule
    public static JenkinsRule j = new JenkinsRule();

    @Test
    public void isJenkinsJVM() throws Throwable {
        assertThat(new IsJenkinsJVM().call(), is(true));
        DumbSlave slave = j.createOnlineSlave();
        assertThat(slave.getChannel().call(new IsJenkinsJVM()), is(false));
    }

    public static class IsJenkinsJVM extends MasterToSlaveCallable<Boolean, IOException> {

        @Override
        public Boolean call() throws IOException {
            return JenkinsJVM.isJenkinsJVM();
        }
    }

}

Fix error with 1.8.0_77 in CI, does not happen with 1.8.0_121


package com.google.sps.servlets;

import java.net.*;
import com.google.cloud.language.v1.Document;
import java.io.PrintWriter;
import com.google.appengine.api.datastore.*;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.cloud.language.v1.LanguageServiceClient;
import com.google.cloud.language.v1.Sentiment;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.firebase.auth.FirebaseToken;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthException;
import com.google.firebase.auth.SessionCookieOptions;
import java.util.concurrent.TimeUnit;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import com.google.sps.firebase.FirebaseAppManager;

package com.google.sps.servlets;

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

@WebServlet("/sign-out")
public class Logout extends HttpServlet {
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    final int maxAge = 0;
    Cookie newCookie = new Cookie("session", " ");
    newCookie.setMaxAge(maxAge); // Set the expiration date to immediate deletion
    response.addCookie(newCookie);
    response.sendRedirect("/index.html"); // Go back to the main page
  }
}

Make current cookie expire for logging out.


package nuclibooktest.models;

import org.junit.After;
import org.junit.Before;

import static org.junit.Assert.*;

public class StaffTest {

    @Before
    public void setUp() throws Exception {

    }

    @After
    public void tearDown() throws Exception {

    }
}

package nuclibooktest.models;

import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager;
import com.j256.ormlite.support.ConnectionSource;
import nuclibook.models.CannotHashPasswordException;
import nuclibook.models.Staff;
import nuclibook.models.Tracer;
import nuclibooktest.test_utils.TestSqlServerConnection;
import org.junit.*;

import java.sql.SQLException;

import static org.junit.Assert.*;

public class StaffTest {

    @Test
    public void setAndCheckPasswordTest() throws SQLException, CannotHashPasswordException {
        Staff staff = new Staff();
        staff.setPassword("foobar");
        assertTrue("Password check failed for set password 'foobar'", staff.checkPassword("foobar"));
    }

    @Test
    public void isInLastPasswordsTest() throws CannotHashPasswordException {
        Staff staff = new Staff();

        staff.setPassword("foobar");
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar"));

        staff.setPassword("foobar2");
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar2"));

        staff.setPassword("foobar3");
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar2"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar3"));

        staff.setPassword("foobar4");
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar2"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar3"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar4"));

        staff.setPassword("foobar5");
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar2"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar3"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar4"));
        assertTrue("isInLastPasswords() returned false when it should have returned true", staff.isInLastPasswords("foobar5"));
        assertFalse("isInLastPasswords() returned true when it should have returned false", staff.isInLastPasswords("foobar"));
    }

}

Add password unit tests for staff model


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

/**
 *
 */
package com.vaadin.tests.tb3;

import org.junit.Test;

/**
 * A simple version of {@link MultiBrowserTest} which allows only one test
 * method ({@link #test()}). Uses only the enclosing class name as test
 * identifier (i.e. excludes "-test").
 *
 * This class is only provided as a helper for converting existing TB2 tests
 * without renaming all screenshots. All new TB3+ tests should extend
 * {@link MultiBrowserTest} directly instead of this.
 *
 * @author Vaadin Ltd
 */
public abstract class SimpleMultiBrowserTest extends MultiBrowserTest {

    @Test
    public abstract void test() throws Exception;

    /*
     * (non-Javadoc)
     *
     * @see com.vaadin.tests.tb3.ScreenshotTB3Test#getScreenshotBaseName()
     */
    @Override
    public String getScreenshotBaseName() {
        return super.getScreenshotBaseName().replaceFirst("-test$", "");
    }
}

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

/**
 *
 */
package com.vaadin.tests.tb3;

import org.junit.Test;

/**
 * A simple version of {@link MultiBrowserTest} which allows only one test
 * method ({@link #test()}). Uses only the enclosing class name as test
 * identifier (i.e. excludes "-test").
 *
 * This class is only provided as a helper for converting existing TB2 tests
 * without renaming all screenshots. All new TB3+ tests should extend
 * {@link MultiBrowserTest} directly instead of this.
 *
 * @author Vaadin Ltd
 */
@Deprecated
public abstract class SimpleMultiBrowserTest extends MultiBrowserTest {

    @Test
    public abstract void test() throws Exception;

    /*
     * (non-Javadoc)
     *
     * @see com.vaadin.tests.tb3.ScreenshotTB3Test#getScreenshotBaseName()
     */
    @Override
    public String getScreenshotBaseName() {
        return super.getScreenshotBaseName().replaceFirst("-test$", "");
    }
}

Mark as deprecated to discourage usage for new tests


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

package org.gradle.testfixtures.internal;

import org.gradle.internal.nativeintegration.services.NativeServices;

import java.io.File;

public class NativeServicesTestFixture {
    static NativeServices nativeServices;
    static boolean initialized;

    public static synchronized void initialize() {
        if (!initialized) {
            System.setProperty("org.gradle.native", "true");
            File nativeDir = getNativeServicesDir();
            NativeServices.initialize(nativeDir);
            initialized = true;
        }
    }

    public static synchronized NativeServices getInstance() {
        if (nativeServices == null) {
            initialize();
            nativeServices = NativeServices.getInstance();
        }
        return nativeServices;
    }

    public static File getNativeServicesDir() {
        return new File("build/native-libs");
    }
}

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

package org.gradle.testfixtures.internal;

import org.gradle.internal.nativeintegration.services.NativeServices;

import java.io.File;

public class NativeServicesTestFixture {
    static NativeServices nativeServices;
    static boolean initialized;

    public static synchronized void initialize() {
        if (!initialized) {
            System.setProperty("org.gradle.native", "true");
            File nativeDir = getNativeServicesDir();
            NativeServices.initialize(nativeDir);
            initialized = true;
        }
    }

    public static synchronized NativeServices getInstance() {
        if (nativeServices == null) {
            initialize();
            nativeServices = NativeServices.getInstance();
        }
        return nativeServices;
    }

    public static File getNativeServicesDir() {
        return new File("build/native-libs").getAbsoluteFile();
    }
}

Use same path for native services base dir