package oasis.model.directory;

import javax.annotation.Nonnull;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.wordnik.swagger.annotations.ApiModelProperty;

import oasis.model.annotations.Id;

@JsonRootName("organization")
public class Organization {

  @Id
  @ApiModelProperty(required = true)
  private String id;

  @JsonProperty
  @ApiModelProperty(required = true)
  private String name;

  public Organization() {
  }

  /**
   * Copy constructor.
   * <p>
   * Does not copy {@link #id} field.
   */
  public Organization(@Nonnull Organization other) {
    this.name = other.getName();
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

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

}

package oasis.model.directory;

import javax.annotation.Nonnull;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.wordnik.swagger.annotations.ApiModelProperty;

import oasis.model.annotations.Id;

@JsonRootName("organization")
public class Organization {

  @Id
  @ApiModelProperty(required = true)
  private String id;

  @JsonProperty
  @ApiModelProperty(required = true)
  private String name;

  @JsonProperty
  @ApiModelProperty(required = true)
  private Type type;

  public Organization() {
  }

  /**
   * Copy constructor.
   * <p>
   * Does not copy {@link #id} field.
   */
  public Organization(@Nonnull Organization other) {
    this.name = other.getName();
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

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

  public Type getType() {
    return type;
  }

  public void setType(Type type) {
    this.type = type;
  }

  public enum Type {
    PUBLIC_BODY,
    COMPANY
  }
}

Add a "type" field to organizations


package org.amc.servlet.model;

public class PartSearchForm implements WebPageForm
{
	private String part;
	private String qSSNumber;
	private String company;
	/**
	 * @return the part
	 */
	public String getPart()
	{
		return part;
	}
	/**
	 * @return the qSSNumber
	 */
	public String getQSSNumber()
	{
		return qSSNumber;
	}
	/**
	 * @return the company
	 */
	public String getCompany()
	{
		return company;
	}
	/**
	 * @param part the part to set
	 */
	public void setPart(String part)
	{
		this.part = part;
	}

	/**
	 * @param qSSNumber the qSSNumber to set
	 */
	public void setQSSNumber(String qSSNumber)
	{
		this.qSSNumber = qSSNumber;
	}
	/**
	 * @param company the company to set
	 */
	public void setCompany(String company)
	{
		this.company = company;
	}
}

package org.amc.servlet.model;

public class PartSearchForm implements WebPageForm
{
	private String partName;
	private String qSSNumber;
	private String company;
	/**
	 * @return the part
	 */
	public String getPartName()
	{
		return partName;
	}
	/**
	 * @return the qSSNumber
	 */
	public String getQSSNumber()
	{
		return qSSNumber;
	}
	/**
	 * @return the company
	 */
	public String getCompany()
	{
		return company;
	}
	/**
	 * @param part the part to set
	 */
	public void setPartName(String part)
	{
		this.partName = part;
	}

	/**
	 * @param qSSNumber the qSSNumber to set
	 */
	public void setQSSNumber(String qSSNumber)
	{
		this.qSSNumber = qSSNumber;
	}
	/**
	 * @param company the company to set
	 */
	public void setCompany(String company)
	{
		this.company = company;
	}
}

Rename Part to PartName to mirror PartSearch getters/setters


package io.github.bobdesaunois.amazighvillagegame;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;

public class Render
{

    public Render ()
    {

        // Insert initialization code

    }

    public void render () {

        // Clear the screen
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // Insert render code

    }

}

package io.github.bobdesaunois.amazighvillagegame;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class Render
{

    public Render ()
    {

        // Insert initialization code

    }

    public void render () {

        // Clear the screen
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        ///////////////////////////// TESTING CODE /////////////////////////////

        SpriteBatch testBatch = new SpriteBatch();
        Texture texture = new Texture ("badlogic.jpg");
        testBatch.begin();
        testBatch.draw (texture, 0, 0);
        testBatch.end();

        ///////////////////////////// TESTING CODE /////////////////////////////

        // Insert render code

    }

}

Test rendering for camera translation


package com.minecraftedu.students;

import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class BlockBreakMessage {

	@SubscribeEvent
	public void sendMessage(BreakEvent event) {
		event.getPlayer()
				.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + getCustomMessage()));
	}

	public String getCustomMessage() {
		  String message = "My first minecraft mod";
		  return message;
	}

}

package com.minecraftedu.students;

import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class BlockBreakMessage {

	@SubscribeEvent
	public void sendMessage(BreakEvent event) {
		event.getPlayer()
				.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + getCustomMessage()));
	}

	public String getCustomMessage() {
		  String message = "My first minecraft mod again";
		  return message;
	}

}

Test changes to see if codeship builds


package de.bettinggame.adapter;

import de.bettinggame.domain.Game;
import de.bettinggame.domain.TournamentLevel;
import de.bettinggame.domain.repository.GameRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Controller
public class GameController implements AbstractController {

    @Autowired
    private GameRepository gameRepository;

    @GetMapping("/game")
    public ModelAndView list() {
        ModelAndView mav = new ModelAndView("game/all-games");
        List<Game> games = gameRepository.findByOrderByStarttime();
        Map<TournamentLevel, List<Game>> matchesByLevel = games.stream()
                .collect(Collectors.groupingBy(Game::getLevel));
        mav.addObject("gamesByLevel", matchesByLevel);
        return mav;
    }
}

package de.bettinggame.adapter;

import de.bettinggame.domain.Game;
import de.bettinggame.domain.TournamentLevel;
import de.bettinggame.domain.repository.GameRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.Function;
import java.util.stream.Collectors;

@Controller
public class GameController implements AbstractController {

    @Autowired
    private GameRepository gameRepository;

    @GetMapping("/game")
    public ModelAndView list() {
        ModelAndView mav = new ModelAndView("game/all-games");
        List<Game> games = gameRepository.findByOrderByStarttime();
        Map<TournamentLevel, List<Game>> matchesByLevel = games.stream()
                .collect(Collectors.groupingBy(Game::getLevel, TreeMap::new,
                        Collectors.mapping(Function.identity(), Collectors.toList())));
        mav.addObject("gamesByLevel", matchesByLevel);
        return mav;
    }
}

Fix order of TournamentLevel on games site


package me.nallar.modpatcher;

import me.nallar.javatransformer.api.JavaTransformer;

class ModPatcherLoadHook {
	private static final int API_VERSION = 1; //Keep in sync with version in ModPatcher.java
	private static final String VERSION = "@MOD_VERSION@".replace("-SNAPSHOT", "");

	static void loadHook(ModPatcher.Version requiredVersion, String modPatcherRelease, int apiVersion) {
		PatcherLog.info("Loaded ModPatcher. Version: @MOD_VERSION@ API version: " + API_VERSION);

		if (API_VERSION != apiVersion) {
			PatcherLog.warn("API version mismatch. Expected " + API_VERSION + ", got " + apiVersion);
			PatcherLog.warn("API was loaded from: " + JavaTransformer.pathFromClass(ModPatcher.class));
		}

		ModPatcher.Version current = ModPatcher.Version.of(VERSION);

		if (requiredVersion != ModPatcher.Version.LATEST && current.compareTo(requiredVersion) < 0) {
			String autoUpdate = "\nWill auto-update on next start.";

			if (ModPatcher.neverUpdate())
				autoUpdate = "";
			else
				JavaTransformer.pathFromClass(ModPatcherTransformer.class).toFile().deleteOnExit();

			throw new RuntimeException("ModPatcher outdated. Have version: " + VERSION + ", requested version: " + requiredVersion + autoUpdate);
		}
	}
}

package me.nallar.modpatcher;

import me.nallar.javatransformer.api.JavaTransformer;

class ModPatcherLoadHook {
	private static final int API_VERSION = 1; //Keep in sync with version in ModPatcher.java
	private static final String VERSION = "@MOD_VERSION@";

	static void loadHook(ModPatcher.Version requiredVersion, String modPatcherRelease, int apiVersion) {
		PatcherLog.info("Loaded ModPatcher. Version: @MOD_VERSION@ API version: " + API_VERSION);

		if (API_VERSION != apiVersion) {
			PatcherLog.warn("API version mismatch. Expected " + API_VERSION + ", got " + apiVersion);
			PatcherLog.warn("API was loaded from: " + JavaTransformer.pathFromClass(ModPatcher.class));
		}

		ModPatcher.Version current = ModPatcher.Version.of(VERSION);

		if (requiredVersion != ModPatcher.Version.LATEST && current.compareTo(requiredVersion) < 0) {
			String autoUpdate = "\nWill auto-update on next start.";

			if (ModPatcher.neverUpdate())
				autoUpdate = "";
			else
				JavaTransformer.pathFromClass(ModPatcherTransformer.class).toFile().deleteOnExit();

			throw new RuntimeException("ModPatcher outdated. Have version: " + VERSION + ", requested version: " + requiredVersion + autoUpdate);
		}
	}
}

Fix LoadHook dropping snapshot incorrectly.


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

import model.job.PiazzaJobType;
import model.service.metadata.Service;

/**
 * Represents the JSON Model for ingesting service metadata into Piazza for subsequent query,
 * e.g. used when registering a service.  This ingest allows subsequent searches for services.
 *
 *

 *
 */
public class ServiceMetadataIngestJob  implements PiazzaJobType {

	public final String type = "servicemetadata-ingest";
	public Service data;

	public ServiceMetadataIngestJob() {

	}
	@Override
	public String getType() {
		return type;
	}
	public Service getData() {
		return data;
	}
	public void setData(Service data) {
		this.data = data;
	}

}

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

import model.job.PiazzaJobType;
import model.service.metadata.Service;

/**
 * Represents the JSON Model for ingesting service metadata into Piazza for
 * subsequent query, e.g. used when registering a service. This ingest allows
 * subsequent searches for services.
 *
 *
 *
 *
 */
public class ServiceMetadataIngestJob implements PiazzaJobType {

	public final String type = "servicemetadata-ingest";
	public Service data;

	public ServiceMetadataIngestJob() {

	}

	public String getType() {
		return type;
	}

	public Service getData() {
		return data;
	}

	public void setData(Service data) {
		this.data = data;
	}

}

Fix compilation error on interface method override tag


package org.hummingbirdlang.types.concrete;

import org.hummingbirdlang.nodes.builtins.BuiltinNodes;
import org.hummingbirdlang.types.MethodProperty;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.UnknownType;
import org.hummingbirdlang.types.realize.Index.Module;

public final class IntegerType extends BootstrappableConcreteType {
  public static String BUILTIN_NAME = "Integer";

  private MethodType toString;

  @Override
  public String getBootstrapName() {
    return IntegerType.BUILTIN_NAME;
  }

  @Override
  public void bootstrapBuiltins(BuiltinNodes builtins) {
    this.toString = new MethodType(this, new UnknownType(), "toString", builtins.getCallTarget("Integer", "toString"));
  }

  @Override
  public void bootstrapTypes(Module indexModule) {
    this.toString = this.toString.cloneWithReturnType(indexModule.get(StringType.BUILTIN_NAME));
  }

  @Override
  public Property getProperty(String name) throws PropertyNotFoundException {
    switch (name) {
      case "toString":
        return MethodProperty.fromType(this.toString);
      default:
        throw new PropertyNotFoundException(this, name);
    }
  }
}

package org.hummingbirdlang.types.concrete;

import org.hummingbirdlang.nodes.builtins.BuiltinNodes;
import org.hummingbirdlang.types.MethodProperty;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.UnknownType;
import org.hummingbirdlang.types.realize.Index.Module;

public final class IntegerType extends BootstrappableConcreteType {
  public static String BUILTIN_NAME = "Integer";

  private MethodType toString;

  @Override
  public String getBootstrapName() {
    return IntegerType.BUILTIN_NAME;
  }

  @Override
  public void bootstrapBuiltins(BuiltinNodes builtins) {
    this.toString = new MethodType(this, new UnknownType(), "toString", builtins.getCallTarget("Integer", "toString"));
  }

  @Override
  public void bootstrapTypes(Module indexModule) {
    this.toString = this.toString.cloneWithReturnType(indexModule.get(StringType.BUILTIN_NAME));
  }

  @Override
  public Property getProperty(String name) throws PropertyNotFoundException {
    switch (name) {
      case "toString":
        return MethodProperty.fromType(this.toString);
      default:
        throw new PropertyNotFoundException(this, name);
    }
  }

  @Override
  public String toString() {
    return "$Integer";
  }
}

Add debug string representation of integer concrete type


package com.netflix.recipes.rss;

public class RSSVersion {
	private static String version = "0.2";

	public static String getVersion() {
		return RSSVersion.version;
	}
}

package com.netflix.recipes.rss;

public class RSSVersion {
	private final static String RSS_VERSION = "0.3";

	public static String getVersion() {
		return RSSVersion.RSS_VERSION;
	}
}

Change version number from 0.2 to 0.3


package main.java.engine.objects.tower;

import main.java.engine.EnvironmentKnowledge;

abstract class TowerBehaviorDecorator implements ITower {
    /**
     * The base tower will have behaviors added to it ("decorations")
     */
    protected ITower baseTower;

    public TowerBehaviorDecorator (ITower baseTower) {
        this.baseTower = baseTower;
    }

    @Override
    public boolean atInterval (int intervalFrequency) {
        return baseTower.atInterval(intervalFrequency);
    }

    @Override
    public double getXCoordinate () {
        return baseTower.getXCoordinate();
    }

    @Override
    public double getYCoordinate () {
        return baseTower.getYCoordinate();
    }

    @Override
    public double getCost () {
        return baseTower.getCost();
    }

    @Override
    public void remove () {
        baseTower.remove();
    }

    @Override
    public boolean callTowerActions (EnvironmentKnowledge environ) {
        if (baseTower.callTowerActions(environ)) {
            // in addition to base tower's behavior, also do additional behavior
            doDecoratedBehavior(environ);
        }
        return true;
    }

    abstract void doDecoratedBehavior (EnvironmentKnowledge environ);
}

package main.java.engine.objects.tower;

import main.java.engine.EnvironmentKnowledge;

abstract class TowerBehaviorDecorator implements ITower {
    /**
     * The base tower will have behaviors added to it ("decorations")
     */
    protected ITower baseTower;

    public TowerBehaviorDecorator (ITower baseTower) {
        this.baseTower = baseTower;
    }

    @Override
    public boolean atInterval (int intervalFrequency) {
        return baseTower.atInterval(intervalFrequency);
    }

    @Override
    public double getXCoordinate () {
        return baseTower.getXCoordinate();
    }

    @Override
    public double getYCoordinate () {
        return baseTower.getYCoordinate();
    }

    @Override
    public double getCost () {
        return baseTower.getCost();
    }

    @Override
    public void remove () {
        baseTower.remove();
    }

    @Override
    public boolean callTowerActions (EnvironmentKnowledge environ) {
        if (baseTower.callTowerActions(environ)) {
            // in addition to base tower's behavior, also do additional behavior
            doDecoratedBehavior(environ);
            return true;
        }
        return false;
    }

    abstract void doDecoratedBehavior (EnvironmentKnowledge environ);
}

Make decorators obey base tower's build up time


package jamex.link;

import java.util.Collection;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import javax.jms.Message;
import javax.jms.MessageListener;
import static org.junit.Assert.*;

final class MessageCollector
  implements MessageListener
{
  private static final int MAX_MESSAGE_COUNT = 10;

  private final LinkedBlockingQueue<Message> m_messages = new LinkedBlockingQueue<Message>( MAX_MESSAGE_COUNT );

  @Override
  public void onMessage( final Message message )
  {
    m_messages.add( message );
  }

  Collection<Message> expectMessageCount( final int expectedMessageCount,
                                          final long maxWait )
    throws InterruptedException
  {
    final LinkedList<Message> results = new LinkedList<Message>();
    final long start = System.currentTimeMillis();
    long now;
    while( results.size() < expectedMessageCount &&
           ( ( now = System.currentTimeMillis() ) < start + maxWait ) )
    {
      final long waitTime = Math.max( 1, start + maxWait - now );
      final Message message = m_messages.poll( waitTime, TimeUnit.MILLISECONDS );
      results.add( message );
    }

    assertEquals( "Expected message count", expectedMessageCount, results.size() );
    return results;
  }
}

package jamex.link;

import java.util.Collection;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import javax.jms.Message;
import javax.jms.MessageListener;
import static org.junit.Assert.*;

final class MessageCollector
  implements MessageListener
{
  private static final int MAX_MESSAGE_COUNT = 10;
  private static final long DEFAULT_WAIT = 100L;

  private final LinkedBlockingQueue<Message> m_messages = new LinkedBlockingQueue<Message>( MAX_MESSAGE_COUNT );

  @Override
  public void onMessage( final Message message )
  {
    m_messages.add( message );
  }

  Collection<Message> expectMessageCount( final int expectedMessageCount )
    throws InterruptedException
  {
    return expectMessageCount( expectedMessageCount, DEFAULT_WAIT );
  }

  Collection<Message> expectMessageCount( final int expectedMessageCount, final long maxWait )
    throws InterruptedException
  {
    final LinkedList<Message> results = new LinkedList<Message>();
    final long start = System.currentTimeMillis();
    long now;
    while( results.size() < expectedMessageCount &&
           ( ( now = System.currentTimeMillis() ) < start + maxWait ) )
    {
      final long waitTime = Math.max( 1, start + maxWait - now );
      final Message message = m_messages.poll( waitTime, TimeUnit.MILLISECONDS );
      results.add( message );
    }

    assertEquals( "Expected message count", expectedMessageCount, results.size() );
    return results;
  }
}

Update so collector has a default wait if unspecified


package cucumber.runtime.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

class FileResource implements Resource {
    private final File root;
    private final File file;
    private final boolean classpathFileResource;

    static FileResource createFileResource(File root, File file) {
        return new FileResource(root, file, false);
    }

    static FileResource createClasspathFileResource(File root, File file) {
        return new FileResource(root, file, true);
    }

    private FileResource(File root, File file, boolean classpathFileResource) {
        this.root = root;
        this.file = file;
        this.classpathFileResource = classpathFileResource;
        if (!file.getAbsolutePath().startsWith(root.getAbsolutePath())) {
            throw new IllegalArgumentException(file.getAbsolutePath() + " is not a parent of " + root.getAbsolutePath());
        }
    }

    @Override
    public String getPath() {
        if (classpathFileResource) {
            return file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
        } else {
            return file.getPath();
        }
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return new FileInputStream(file);
    }

}

package cucumber.runtime.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

class FileResource implements Resource {
    private final File root;
    private final File file;
    private final boolean classpathFileResource;

    static FileResource createFileResource(File root, File file) {
        return new FileResource(root, file, false);
    }

    static FileResource createClasspathFileResource(File root, File file) {
        return new FileResource(root, file, true);
    }

    private FileResource(File root, File file, boolean classpathFileResource) {
        this.root = root;
        this.file = file;
        this.classpathFileResource = classpathFileResource;
        if (!file.getAbsolutePath().startsWith(root.getAbsolutePath())) {
            throw new IllegalArgumentException(file.getAbsolutePath() + " is not a parent of " + root.getAbsolutePath());
        }
    }

    @Override
    public String getPath() {
        if (classpathFileResource) {
            String relativePath = file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
            return relativePath.replace(File.separatorChar, '/');
        } else {
            return file.getPath();
        }
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return new FileInputStream(file);
    }

}

Fix class loading on Windows


package devopsdistilled.operp.client;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.client.context.AppContext;
import devopsdistilled.operp.client.main.MainWindow;

public class ClientApp {

	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		MainWindow window = context.getBean(MainWindow.class);
		window.init();

		System.out.println(context);
	}
}

package devopsdistilled.operp.client;

import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.client.context.AppContext;
import devopsdistilled.operp.client.main.MainWindow;

public class ClientApp {

	public static void main(String[] args) {
		try {
			for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (Exception e) {
			System.err
					.println("Nimbus Look and Feel not available.\nReverting to default");
		}

		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		MainWindow window = context.getBean(MainWindow.class);
		window.init();

		System.out.println(context);
	}
}

Set Nimbus as LAF for Client-App


/*
 *
 * Copyright (c) 2006-2019, Speedment, Inc. All Rights Reserved.
 *
 * 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.speedment.common.function;

import java.util.function.Consumer;

/**
 * Represents a consumer that accepts three arguments. This is the three-arity
 * specialization of {@link java.util.function.Consumer}.
 *
 * @param <T>  the type of the first argument to the consumer
 * @param <U>  the type of the second argument to the consumer
 * @param <V>  the type of the third argument to the consumer
 *
 * @see Consumer
 */
@FunctionalInterface
public interface TriConsumer<T, U, V> {

    /**
     * Performs this operation on the given argument.
     *
     * @param t  the first consumer argument
     * @param u  the second consumer argument
     * @param v  the third consumer argument
     */
    void apply(T t, U u, V v);
}

/*
 *
 * Copyright (c) 2006-2019, Speedment, Inc. All Rights Reserved.
 *
 * 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.speedment.common.function;

import java.util.function.Consumer;

/**
 * Represents a consumer that accepts three arguments. This is the three-arity
 * specialization of {@link java.util.function.Consumer}.
 *
 * @param <T>  the type of the first argument to the consumer
 * @param <U>  the type of the second argument to the consumer
 * @param <V>  the type of the third argument to the consumer
 *
 * @see Consumer
 */
@FunctionalInterface
public interface TriConsumer<T, U, V> {

    /**
     * Performs this operation on the given argument.
     *
     * @param t  the first consumer argument
     * @param u  the second consumer argument
     * @param v  the third consumer argument
     */
    void accept(T t, U u, V v);
}

Rename method to std name


package bramble.webserver;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.http.HttpStatus;

public class TotalJobSlotsHandler extends HttpServlet {

	private static final long serialVersionUID = 5414855470057516723L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		resp.addHeader("Access-Control-Allow-Origin", "*");
		resp.setStatus(HttpStatus.OK_200);
		resp.getWriter().println(WebAPI.getTotalJobSlots());
	}
}

package bramble.webserver;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.http.HttpStatus;

public class TotalJobSlotsHandler extends HttpServlet {

	private static final long serialVersionUID = 5414855470057516723L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		resp.addHeader("Access-Control-Allow-Origin", "*");
		resp.setStatus(HttpStatus.OK_200);
		resp.getWriter().print(WebAPI.getTotalJobSlots());
	}
}

Change println() to print() to avoid superfluous newline


/**
 *
 */
package com.boundary.sdk;

import java.util.Date;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.component.syslog.SyslogMessage;
import org.apache.camel.component.syslog.SyslogSeverity;

import com.boundary.sdk.RawEvent;
import com.boundary.sdk.Severity;

/**
 * @author davidg
 *
 */
public class SNMPToEventProcessor implements Processor {

	private boolean debug = false;
	/**
	 *
	 */

	public SNMPToEventProcessor() {
		this(false);
	}
	public SNMPToEventProcessor(boolean debug) {
		// TODO Auto-generated constructor stub
	}

	private final String CAMEL_SYSLOG_HOSTNAME = "CamelSyslogHostname";
	private final String CAMEL_SYSLOG_SEVERITY = "CamelSyslogSeverity";

	@Override
	public void process(Exchange exchange) throws Exception {
		// Get the CamelContext and Message
		CamelContext context = exchange.getContext();
		Message message = exchange.getIn();

		// Create our event so that we can populate with the Syslog data
		RawEvent event = new RawEvent();
		event = event.getDefaultEvent();
		Date dt = new java.util.Date();
		event.setTitle("SNMP TRAP " + dt);
		event.setSeverity(Severity.CRITICAL);

		// Delegate to member method call to perform the translation
		//this.translateSyslogMessage(message, event);
		message.setBody(event, RawEvent.class);
	}
}

/**
 *
 */
package com.boundary.sdk;

import java.util.Date;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.boundary.sdk.RawEvent;
import com.boundary.sdk.Severity;

/**
 * @author davidg
 *
 */
public class SNMPToEventProcessor implements Processor {

    private static final Logger LOG = LoggerFactory.getLogger(SNMPToEventProcessor.class);

	public SNMPToEventProcessor() {
	}

	@Override
	public void process(Exchange exchange) throws Exception {
		Message message = exchange.getIn();
		LOG.debug("class: {}",message.getBody().getClass().toString());

		// Create our event so that we can populate with the Syslog data
		RawEvent event = new RawEvent();
		Date dt = new java.util.Date();

		event.setTitle("SNMP TRAP " + dt);
		event.setStatus(Status.OPEN);
		event.setSeverity(Severity.WARN);
		event.getSource().setRef("localhost");
		event.getSource().setType("host");
//		event.setMessage(message.getBody().toString());
//		event.putProperty("message",message.getBody().toString());
		event.putFingerprintField("@title");

		message.setBody(event, RawEvent.class);
	}
}

Remove dead code from SNMP event processing


package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {

    public Result index() {
        return ok(index.render("Your new application is ready."));
    }

}

package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {

    public Result index() {
        return ok("Welcome to Breakout API. Nothing to see here by now").as("text/plain");
    }

}

Add custom greeting for index


package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.entity.*;
import org.springframework.security.access.prepost.*;
import org.springframework.stereotype.*;

import java.util.*;

@Service
public interface GradeService {

    @PreAuthorize("hasRole('LECTURER')")
    Grade getDefaultGradeForStudentAndCourse(Long studentId, Long courseId);

    @PreAuthorize("hasRole('LECTURER')")
    Grade saveNewGradeForStudentAndCourse(Grade grade);

    @PreAuthorize("hasRole('LECTURER')")
    List<Grade> getGradesForCourseOfLoggedInLecturer(Long courseId);

    @PreAuthorize("hasRole('STUDENT')")
    List<Grade> getGradesForLoggedInStudent();

    Grade getForValidation(String identifier);

    @PreAuthorize("isAuthenticated()")
    List<Grade> findAllOfStudent(Student student);
}

package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.controller.lecturer.GradeAuthorizationDTO;
import at.ac.tuwien.inso.entity.*;
import org.springframework.security.access.prepost.*;
import org.springframework.stereotype.*;

import java.util.*;

@Service
public interface GradeService {

    @PreAuthorize("hasRole('LECTURER')")
    GradeAuthorizationDTO getDefaultGradeAuthorizationDTOForStudentAndCourse(Long studentId, Long courseId);

    @PreAuthorize("hasRole('LECTURER')")
    Grade saveNewGradeForStudentAndCourse(GradeAuthorizationDTO grade);

    @PreAuthorize("hasRole('LECTURER')")
    List<Grade> getGradesForCourseOfLoggedInLecturer(Long courseId);

    @PreAuthorize("hasRole('STUDENT')")
    List<Grade> getGradesForLoggedInStudent();

    Grade getForValidation(String identifier);

    @PreAuthorize("isAuthenticated()")
    List<Grade> findAllOfStudent(Student student);

    @PreAuthorize("isAuthenticated()")
    List<Mark> getMarkOptions();
}

Refactor for two factor authentification


package io.github.likcoras.asuka;

import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.pircbotx.User;
import lombok.Cleanup;

public class IgnoreManager {

	private Set<String> ignored;
	private Path ignoreFile;

	public IgnoreManager() {
		ignored = Collections.synchronizedSet(new HashSet<String>());
		ignoreFile = Paths.get("ignore.txt");
	}

	public void addIgnored(User user) {
		addIgnored(BotUtil.getId(user));
	}

	public void addIgnored(String user) {
		ignored.add(user);
	}

	public void removeIgnored(User user) {
		removeIgnored(BotUtil.getId(user));
	}

	public void removeIgnored(String user) {
		ignored.remove(user);
	}

	public boolean isIgnored(User user) {
		return ignored.contains(BotUtil.getId(user));
	}

	public void writeFile() throws IOException {
		@Cleanup
		BufferedWriter write = Files.newBufferedWriter(ignoreFile);
		synchronized(ignored) {
			for (String user : ignored)
				write.write(user + "\n");
		}
		write.flush();
	}

}

package io.github.likcoras.asuka;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.pircbotx.User;
import lombok.Cleanup;

public class IgnoreManager {

	private Set<String> ignored;

	public IgnoreManager() {
		ignored = Collections.synchronizedSet(new HashSet<String>());
	}

	public void addIgnored(User user) {
		addIgnored(BotUtil.getId(user));
	}

	public void addIgnored(String user) {
		ignored.add(user);
	}

	public void removeIgnored(User user) {
		removeIgnored(BotUtil.getId(user));
	}

	public void removeIgnored(String user) {
		ignored.remove(user);
	}

	public boolean isIgnored(User user) {
		return ignored.contains(BotUtil.getId(user));
	}

	public void readFile(Path ignoreFile) throws IOException {
		@Cleanup
		BufferedReader read = Files.newBufferedReader(ignoreFile);
		synchronized (ignored) {
			String line;
			while ((line = read.readLine()) != null)
				ignored.add(line);
		}
	}

	public void writeFile(Path ignoreFile) throws IOException {
		@Cleanup
		BufferedWriter write = Files.newBufferedWriter(ignoreFile);
		synchronized (ignored) {
			for (String user : ignored)
				write.write(user + "\n");
		}
		write.flush();
	}

}

Allow reading and writing from a specified Path


package pokefenn.totemic.ceremony;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import pokefenn.totemic.api.ceremony.CeremonyEffectContext;
import pokefenn.totemic.api.ceremony.CeremonyInstance;

public class CeremonyRain extends CeremonyInstance {
    private final boolean doRain;

    public CeremonyRain(boolean doRain) {
        this.doRain = doRain;
    }

    @Override
    public void effect(Level level, BlockPos pos, CeremonyEffectContext context) {
        if(level.isRaining() != doRain) {
            level.getLevelData().setRaining(doRain);
            level.setRainLevel(doRain ? 1.0F : 0.0F);
        }
    }
}

package pokefenn.totemic.ceremony;

import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import pokefenn.totemic.api.ceremony.CeremonyEffectContext;
import pokefenn.totemic.api.ceremony.CeremonyInstance;

public class CeremonyRain extends CeremonyInstance {
    private final boolean doRain;

    public CeremonyRain(boolean doRain) {
        this.doRain = doRain;
    }

    @Override
    public void effect(Level level, BlockPos pos, CeremonyEffectContext context) {
        if(level instanceof ServerLevel slevel && slevel.isRaining() != doRain) {
            slevel.setWeatherParameters(
                    doRain ? 0 : 6000, //Clear weather time
                    doRain ? 6000 : 0, //Rain time
                    doRain, //raining
                    false); //thundering
        }
    }
}

Fix rain ceremony not working correctly


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

import static java.util.Locale.US;
import android.text.TextUtils;

/**
 * Utilities for dealing with Markdown files
 */
public class MarkdownUtils {

  private static final String[] MARKDOWN_EXTENSIONS = { ".md", ".mkdn",
          ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron" };

  /**
   * Is the the given file name a Markdown file?
   *
   * @param name
   * @return true if the name has a markdown extension, false otherwise
   */
  public static boolean isMarkdown(String name) {
      if (TextUtils.isEmpty(name))
          return false;

      name = name.toLowerCase(US);
      for (String extension : MARKDOWN_EXTENSIONS)
          if (name.endsWith(extension))
              return true;

      return false;
  }
}

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

import static java.util.Locale.US;
import android.text.TextUtils;

/**
 * Utilities for dealing with Markdown files
 */
public class MarkdownUtils {

    // List of officially supported markup formats: https://github.com/github/markup
    private static final String[] MARKDOWN_EXTENSIONS = {
            ".markdown", ".mdown", ".mkdn", ".md",
            ".textile",
            ".rdoc",
            ".org",
            ".creole",
            ".mediawiki", ".wiki ",
            ".rst",
            ".asciidoc", ".adoc", ".asc",
            ".pod"
    };

    /**
     * Is the the given file name a Markdown file?
     *
     * @param name
     * @return true if the name has a markdown extension, false otherwise
     */
    public static boolean isMarkdown(String name) {
        if (TextUtils.isEmpty(name))
            return false;

        name = name.toLowerCase(US);
        for (String extension : MARKDOWN_EXTENSIONS)
            if (name.endsWith(extension))
                return true;

        return false;
    }
}

Update the list of supported markup formats


package com.ternaryop.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.RelativeLayout;

/**
 * Used to select items in listView
 * @author dave
 *
 */
public class CheckableRelativeLayout extends RelativeLayout implements Checkable {
	private boolean isChecked;

	public CheckableRelativeLayout(Context context, AttributeSet attrs,
			int defStyle) {
		super(context, attrs, defStyle);
	}

	public CheckableRelativeLayout(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public CheckableRelativeLayout(Context context, int checkableId) {
		super(context);
	}

	public boolean isChecked() {
		return isChecked;
	}

	public void setChecked(boolean isChecked) {
		this.isChecked = isChecked;
		setSelected(isChecked);
	}

	public void toggle() {
		setChecked(!isChecked);
	}
}

package com.ternaryop.widget;

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

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.RelativeLayout;

/**
 * Used to select items in listView
 *
 * @author dave
 *
 */
public class CheckableRelativeLayout extends RelativeLayout implements Checkable {
    private boolean isChecked;
    private List<Checkable> checkableViews;

    public CheckableRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    public CheckableRelativeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public CheckableRelativeLayout(Context context, int checkableId) {
        super(context);
        init();
    }

    private void init() {
        checkableViews = new ArrayList<Checkable>();
    }

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
        setSelected(isChecked);
        for (Checkable c : checkableViews) {
            c.setChecked(checked);
        }
    }

    public void toggle() {
        isChecked = !isChecked;
        setSelected(isChecked);
        for (Checkable c : checkableViews) {
            c.toggle();
        }
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        final int childCount = this.getChildCount();
        for (int i = 0; i < childCount; ++i) {
            findCheckableChildren(this.getChildAt(i));
        }
    }

    private void findCheckableChildren(View v) {
        if (v instanceof Checkable) {
            checkableViews.add((Checkable) v);
        }
        if (v instanceof ViewGroup) {
            final ViewGroup vg = (ViewGroup) v;
            final int childCount = vg.getChildCount();
            for (int i = 0; i < childCount; ++i) {
                findCheckableChildren(vg.getChildAt(i));
            }
        }
    }
}

Set checked state for Checkable children


/*
 * 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.facebook.presto.orc;

import java.io.Closeable;
import java.io.File;

import static com.google.common.io.Files.createTempDir;
import static io.airlift.testing.FileUtils.deleteRecursively;

class TempFile
        implements Closeable
{
    private final File tempDir;
    private final File file;

    public TempFile()
    {
        tempDir = createTempDir();
        tempDir.mkdirs();
        file = new File(tempDir, "data.rcfile");
    }

    public File getFile()
    {
        return file;
    }

    @Override
    public void close()
    {
        // hadoop creates crc files that must be deleted also, so just delete the whole directory
        deleteRecursively(tempDir);
    }
}

/*
 * 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.facebook.presto.orc;

import java.io.Closeable;
import java.io.File;

import static com.google.common.io.Files.createTempDir;
import static io.airlift.testing.FileUtils.deleteRecursively;

class TempFile
        implements Closeable
{
    private final File tempDir;
    private final File file;

    public TempFile()
    {
        tempDir = createTempDir();
        tempDir.mkdirs();
        file = new File(tempDir, "data.orc");
    }

    public File getFile()
    {
        return file;
    }

    @Override
    public void close()
    {
        // hadoop creates crc files that must be deleted also, so just delete the whole directory
        deleteRecursively(tempDir);
    }
}

Fix typo in test ORC temp file name


package com.ippon.jug.slip;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.nio.file.Paths;

@RestController
public class SlipController {

    @RequestMapping(value = "/request")
    public String getRequest() throws InterruptedException, UnknownHostException {
        this.doSlip();

        StringBuilder builder = new StringBuilder()
                .append("Hello I'm ")
                .append(InetAddress.getLocalHost().getHostName())
                .append(". My little secret is ... ");
        try {
            Files.readAllLines(Paths.get("/run/secrets/bdx"))
                    .forEach(builder::append);
        } catch (IOException e) {
            // No secret here
            builder.append(" UNKNOWN !");
        }
        return builder.toString();
    }

    private static final int SLEEP_MILLIS = 50;

    private synchronized void doSlip() throws InterruptedException {
        Thread.sleep(SLEEP_MILLIS);
    }

    @RequestMapping(value = "/dockerHealth")
    public ResponseEntity<Void> getHealth() {
        return new ResponseEntity<Void>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

package com.ippon.jug.slip;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.nio.file.Paths;

@RestController
public class SlipController {

    @RequestMapping(value = "/request")
    public String getRequest() throws InterruptedException, UnknownHostException {
        this.doSlip();

        StringBuilder builder = new StringBuilder()
                .append("Hello I'm ")
                .append(InetAddress.getLocalHost().getHostName())
                .append(". My little secret is ... ");
        try {
            Files.readAllLines(Paths.get("/run/secrets/bdx"))
                    .forEach(builder::append);
        } catch (IOException e) {
            // No secret here
            builder.append(" UNKNOWN !");
        }
        return builder.toString();
    }

    private static final int SLEEP_MILLIS = 50;

    private synchronized void doSlip() throws InterruptedException {
        Thread.sleep(SLEEP_MILLIS);
    }

    @RequestMapping(value = "/dockerHealth")
    public ResponseEntity<Void> getHealth() {
        return new ResponseEntity<Void>(HttpStatus.OK);
    }
}

Set to OK the answer of docker health endpoint


package com.github.solairerove.woodstock.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

/**
 * Created by krivitski-no on 10/1/16.
 */
@Data
@Document
public class Task implements Serializable {

    @Id
    private String id;

    private String question;
    private Boolean enable;
    private Boolean correct;
    private Collection<? extends Ticket> tickets = new ArrayList<>();

    public Task() {
    }

    public Task(String question, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = true;
        this.correct = false;
        this.tickets = tickets;
    }

    public Task(String question, Boolean enable, Boolean correct, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = enable;
        this.correct = correct;
        this.tickets = tickets;
    }
}

package com.github.solairerove.woodstock.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

/**
 * Created by krivitski-no on 10/1/16.
 */
@Data
@Document
public class Task implements Serializable {

    @Id
    private String id;

    private String question;
    private Boolean enable;
    private Boolean correct;
    private Collection<? extends Ticket> tickets = new ArrayList<>();

    public Task() {
    }

    public Task(String question, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = Boolean.TRUE;
        this.correct = Boolean.FALSE;
        this.tickets = tickets;
    }

    public Task(String question, Boolean enable, Boolean correct, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = enable;
        this.correct = correct;
        this.tickets = tickets;
    }
}

Change primitive to object in task model


package info.u_team.u_team_core.data;

import java.util.function.*;

import net.minecraft.data.*;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;

public class GenerationData {

	private final String modid;
	private final DataGenerator generator;
	private final ExistingFileHelper existingFileHelper;

	private CommonBlockTagsProvider blockTagsProvider;

	public GenerationData(String modid, GatherDataEvent event) {
		this(modid, event.getGenerator(), event.getExistingFileHelper());
	}

	public GenerationData(String modid, DataGenerator generator, ExistingFileHelper existingFileHelper) {
		this.modid = modid;
		this.generator = generator;
		this.existingFileHelper = existingFileHelper;
	}

	public String getModid() {
		return modid;
	}

	public DataGenerator getGenerator() {
		return generator;
	}

	public ExistingFileHelper getExistingFileHelper() {
		return existingFileHelper;
	}

	public void addProvider(Function<GenerationData, IDataProvider> function) {
		final IDataProvider provider = function.apply(this);
		if (provider instanceof CommonBlockTagsProvider) {
			blockTagsProvider = (CommonBlockTagsProvider) provider;
		}
		generator.addProvider(provider);
	}

	public void addProvider(BiFunction<GenerationData, CommonBlockTagsProvider, IDataProvider> function) {
		generator.addProvider(function.apply(this, blockTagsProvider));
	}

}

package info.u_team.u_team_core.data;

import java.util.function.*;

import net.minecraft.data.*;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;

public class GenerationData {

	private final String modid;
	private final DataGenerator generator;
	private final ExistingFileHelper existingFileHelper;

	private CommonBlockTagsProvider blockTagsProvider;

	public GenerationData(String modid, GatherDataEvent event) {
		this(modid, event.getGenerator(), new ExistingFileHelperWithForge(event.getExistingFileHelper()));
	}

	public GenerationData(String modid, DataGenerator generator, ExistingFileHelper existingFileHelper) {
		this.modid = modid;
		this.generator = generator;
		this.existingFileHelper = existingFileHelper;
	}

	public String getModid() {
		return modid;
	}

	public DataGenerator getGenerator() {
		return generator;
	}

	public ExistingFileHelper getExistingFileHelper() {
		return existingFileHelper;
	}

	public void addProvider(Function<GenerationData, IDataProvider> function) {
		final IDataProvider provider = function.apply(this);
		if (provider instanceof CommonBlockTagsProvider) {
			blockTagsProvider = (CommonBlockTagsProvider) provider;
		}
		generator.addProvider(provider);
	}

	public void addProvider(BiFunction<GenerationData, CommonBlockTagsProvider, IDataProvider> function) {
		generator.addProvider(function.apply(this, blockTagsProvider));
	}

}

Use the new existing file helper with forge in the generation data now


package com.mapswithme.maps.api;

import android.content.Context;
import android.content.Intent;

// TODO add javadoc for public interface
public class MWMResponse
{
  private MWMPoint mPoint;

  public MWMPoint getPoint()     { return mPoint; }
  public boolean  hasPoint()     { return mPoint != null; }

  @Override
  public String toString()
  {
    return "MWMResponse [mSelectedPoint=" + mPoint + "]";
  }

  static MWMResponse extractFromIntent(Context context, Intent intent)
  {
    final MWMResponse response = new MWMResponse();
    // parse status
    // parse point
    final double lat = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, 0);
    final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, 0);
    final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME);
    final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID);
    response.mPoint = new MWMPoint(lat, lon, name, id);

    return response;
  }

  private MWMResponse() {}
}

package com.mapswithme.maps.api;

import android.content.Context;
import android.content.Intent;

// TODO add javadoc for public interface
public class MWMResponse
{
  private MWMPoint mPoint;

  public MWMPoint getPoint()     { return mPoint; }
  public boolean  hasPoint()     { return mPoint != null; }

  @Override
  public String toString()
  {
    return "MWMResponse [mSelectedPoint=" + mPoint + "]";
  }

  public static MWMResponse extractFromIntent(Context context, Intent intent)
  {
    final MWMResponse response = new MWMResponse();
    // parse status
    // parse point
    final double lat = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, 0);
    final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, 0);
    final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME);
    final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID);
    response.mPoint = new MWMPoint(lat, lon, name, id);

    return response;
  }

  private MWMResponse() {}
}

Access modifier fix for android API


package org.irmacard.api.common;

public class ClientRequest<T> {
	private int timeout = 0;
	private String data;
	private T request;

	public ClientRequest() {}

	public ClientRequest(String data, T request) {
		this.request = request;
		this.data = data;
	}

	public ClientRequest(String data, T request, int timeout) {
		this.timeout = timeout;
		this.request = request;
		this.data = data;
	}

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}

	public T getRequest() {
		return request;
	}

	public String getData() {
		return data;
	}
}

package org.irmacard.api.common;

public class ClientRequest<T> {
	private int timeout = 0;
	private String data;
	private T request;
	private String callbackUrl;

	public ClientRequest() {}

	public ClientRequest(String data, T request) {
		this.request = request;
		this.data = data;
	}

	public ClientRequest(String data, T request, int timeout) {
		this.timeout = timeout;
		this.request = request;
		this.data = data;
	}

	public ClientRequest(String data, T request, int timeout, String callbackUrl) {
		this(data, request, timeout);
		this.callbackUrl = callbackUrl;
	}

	public String getCallbackUrl() {
		return callbackUrl;
	}

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}

	public T getRequest() {
		return request;
	}

	public String getData() {
		return data;
	}
}

Add support for callback urls


// Copyright 2018 The Nomulus Authors. All Rights Reserved.
//
// 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 google.registry.tools;

import com.beust.jcommander.Parameters;
import google.registry.beam.spec11.Spec11Pipeline;
import javax.inject.Inject;

/** Nomulus command that deploys the {@link Spec11Pipeline} template. */
@Parameters(commandDescription = "Deploy the invoicing pipeline to GCS.")
public class DeploySpec11PipelineCommand implements Command {

  @Inject Spec11Pipeline spec11Pipeline;

  @Override
  public void run() {
    spec11Pipeline.deploy();
  }
}

// Copyright 2018 The Nomulus Authors. All Rights Reserved.
//
// 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 google.registry.tools;

import com.beust.jcommander.Parameters;
import google.registry.beam.spec11.Spec11Pipeline;
import javax.inject.Inject;

/** Nomulus command that deploys the {@link Spec11Pipeline} template. */
@Parameters(commandDescription = "Deploy the Spec11 pipeline to GCS.")
public class DeploySpec11PipelineCommand implements Command {

  @Inject Spec11Pipeline spec11Pipeline;

  @Override
  public void run() {
    spec11Pipeline.deploy();
  }
}

Correct wrong description of command


package org.bouncycastle.asn1;

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

class DefiniteLengthInputStream
        extends LimitedInputStream
{
    private int               _length;

    DefiniteLengthInputStream(
        InputStream in,
        int         length)
    {
        super(in);

        if (length < 0)
        {
            throw new IllegalArgumentException("negative lengths not allowed");
        }

        this._length = length;
    }

    public int read()
        throws IOException
    {
        if (_length > 0)
        {
            int b = _in.read();

            if (b < 0)
            {
                throw new EOFException();
            }

            --_length;
            return b;
        }

        setParentEofDetect(true);

        return -1;
    }

    byte[] toByteArray()
        throws IOException
    {
        byte[] bytes = new byte[_length];

        if (_length > 0)
        {
            int pos = 0;
            do
            {
                int read = _in.read(bytes, pos, _length - pos);

                if (read < 0)
                {
                    throw new EOFException();
                }

                pos += read;
            }
            while (pos < _length);

            _length = 0;
        }

        setParentEofDetect(true);

        return bytes;
    }
}

package org.bouncycastle.asn1;

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

class DefiniteLengthInputStream
        extends LimitedInputStream
{
    private int               _length;

    DefiniteLengthInputStream(
        InputStream in,
        int         length)
    {
        super(in);

        if (length < 0)
        {
            throw new IllegalArgumentException("negative lengths not allowed");
        }

        this._length = length;
    }

    public int read()
        throws IOException
    {
        if (_length > 0)
        {
            int b = _in.read();

            if (b < 0)
            {
                throw new EOFException();
            }

            --_length;
            return b;
        }

        setParentEofDetect(true);

        return -1;
    }

    public int read(byte[] buf, int off, int len)
        throws IOException
    {
        if (_length > 0)
        {
            int toRead = Math.min(len, _length);
            int numRead = _in.read(buf, off, toRead);

            if (numRead < 0)
                throw new EOFException();

            _length -= numRead;
            return numRead;
        }

        setParentEofDetect(true);

        return -1;
    }

    byte[] toByteArray()
        throws IOException
    {
        byte[] bytes = new byte[_length];

        if (_length > 0)
        {
            int pos = 0;
            do
            {
                int read = _in.read(bytes, pos, _length - pos);

                if (read < 0)
                {
                    throw new EOFException();
                }

                pos += read;
            }
            while (pos < _length);

            _length = 0;
        }

        setParentEofDetect(true);

        return bytes;
    }
}

Add extra read(...) method for performance


package org.myrobotlab.document.transformer;

import org.myrobotlab.document.transformer.StageConfiguration;

import java.util.List;

import org.myrobotlab.document.Document;

/**
 * This stage will rename the field on a document.
 * @author kwatters
 *
 */
public class RenameField extends AbstractStage {

	private String oldName = "fielda";
	private String newName = "fieldb";
	@Override
	public void startStage(StageConfiguration config) {
		// TODO Auto-generated method stub
		if (config != null) {
			oldName = config.getProperty("oldName");
			newName = config.getProperty("newName");
		}
	}

	@Override
	public List<Document> processDocument(Document doc) {
		if (!doc.hasField(oldName)) {
			return null;
		}
		doc.addToField(newName, doc.getField(oldName));
		doc.removeField(oldName);
		return null;
	}

	@Override
	public void stopStage() {
		// TODO Auto-generated method stub

	}

	@Override
	public void flush() {
		// TODO Auto-generated method stub

	}

}

package org.myrobotlab.document.transformer;

import org.myrobotlab.document.transformer.StageConfiguration;

import java.util.List;

import org.myrobotlab.document.Document;

/**
 * This stage will rename the field on a document.
 * @author kwatters
 *
 */
public class RenameField extends AbstractStage {

	private String oldName = "fielda";
	private String newName = "fieldb";
	@Override
	public void startStage(StageConfiguration config) {
		// TODO Auto-generated method stub
		if (config != null) {
			oldName = config.getProperty("oldName");
			newName = config.getProperty("newName");
		}
	}

	@Override
	public List<Document> processDocument(Document doc) {
		if (!doc.hasField(oldName)) {
			return null;
		}
		for (Object o : doc.getField(oldName)) {
			doc.addToField(newName, o);
		}
		doc.removeField(oldName);
		return null;
	}

	@Override
	public void stopStage() {
		// TODO Auto-generated method stub

	}

	@Override
	public void flush() {
		// TODO Auto-generated method stub

	}

}

Add values to new field one at a time to avoid adding an ArrayList object.


package de.mvitz.jprops.core.api;

import static org.mockito.BDDMockito.given;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class PropertiesInjectorTest {

    @Mock
    private PropertyProvider provider;
    @InjectMocks
    private PropertiesInjector injector;

    @SuppressWarnings("unused")
    private UnknownType unknownType;

    @Test(expected = InvalidPropertiesException.class)
    public void shouldThrowExceptionForUnknownType() throws Exception {
        given(provider.get("unknownType")).willReturn("foo");
        injector.injectInto(this);
    }

    public interface UnknownType {
    }

}

package de.mvitz.jprops.core.api;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
import static org.mockito.BDDMockito.given;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class PropertiesInjectorTest {

    @Mock
    private PropertyProvider provider;
    @InjectMocks
    private PropertiesInjector injector;

    private UnknownType unknownType;

    @Test
    public void shouldThrowExceptionForUnknownType() throws Exception {
        given(provider.get("unknownType")).willReturn("foo");
        try {
            injector.injectInto(this);
            failBecauseExceptionWasNotThrown(InvalidPropertiesException.class);
        } catch (final InvalidPropertiesException e) {
            assertThat(e).hasNoCause().hasMessage("No converter found for type: UnknownType");
            assertThat(unknownType).isNull();
        }
    }

    public interface UnknownType {
    }

}

Use AssertJ instead of JUnit expected to assert thrown exception.


/*
 * Copyright 2015-2018 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v20.html
 */

package example;

// tag::user_guide[]
import java.util.HashMap;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestReporter;

class TestReporterDemo {

	@Test
	void reportSingleValue(TestReporter testReporter) {
		testReporter.publishEntry("a key", "a value");
	}

	@Test
	void reportSeveralValues(TestReporter testReporter) {
		HashMap<String, String> values = new HashMap<>();
		values.put("user name", "dk38");
		values.put("award year", "1974");

		testReporter.publishEntry(values);
	}

}
// end::user_guide[]

/*
 * Copyright 2015-2018 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v20.html
 */

package example;

// tag::user_guide[]
import java.util.HashMap;
import java.util.Map;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestReporter;

class TestReporterDemo {

	@Test
	void reportSingleValue(TestReporter testReporter) {
		testReporter.publishEntry("a key", "a value");
	}

	@Test
	void reportSeveralValues(TestReporter testReporter) {
		Map<String, String> values = new HashMap<>();
		values.put("user name", "dk38");
		values.put("award year", "1974");

		testReporter.publishEntry(values);
	}

}
// end::user_guide[]

Use interface instead of implementation class


package b_stream;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.stream.Stream;

class LongestWordInFile {

    public static void main(String[] args) throws IOException {
        Stream<String> lines = Files.lines(Paths.get("frankenstein.txt"));
        System.out.println(lines.flatMap(l -> Arrays.stream(l.split("[\\P{L}]+")))
                .max((lhs, rhs) -> Integer.compare(lhs.length(), rhs.length())).get());
    }
}

package b_stream;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.regex.Pattern;
import java.util.stream.Stream;

class LongestWordInFile {

    public static void main(String[] args) throws IOException {
        Pattern wordSeparator = Pattern.compile("[\\P{L}]+");

        try(Stream<String> lines = Files.lines(Paths.get("frankenstein.txt"))) {
            System.out.println(lines.flatMap(l -> wordSeparator.splitAsStream(l))
                    .max((lhs, rhs) -> Integer.compare(lhs.length(), rhs.length())).get());
        }

    }
}

Work with files in close with resources. Extract pattern for better readablity.


package org.aksw.kbox.kibe;

import java.net.MalformedURLException;
import java.net.URL;

import org.aksw.kbox.kns.CustomKNSServerList;
import org.aksw.kbox.kns.KNSServerListVisitor;

public class DefaultKNSServerList extends URLKNSServerList {

	// Default KNS table URL
	private final static String DEFAULT_KNS_TABLE_URL = "https://raw.githubusercontent.com/AKSW/KBox/master/kns/2.0/";

	private CustomKNSServerList customKNSServerList = new CustomKNSServerList();

	public DefaultKNSServerList() throws MalformedURLException {
		super(new URL(DEFAULT_KNS_TABLE_URL));
	}

	@Override
	public boolean visit(KNSServerListVisitor visitor) throws Exception {
		boolean next = super.visit(visitor);
		if(next) {
			next = customKNSServerList.visit(visitor);
		}
		return next;
	}
}

package org.aksw.kbox.kibe;

import java.net.MalformedURLException;
import java.net.URL;

import org.aksw.kbox.kns.CustomKNSServerList;
import org.aksw.kbox.kns.KNSServerListVisitor;

public class DefaultKNSServerList extends URLKNSServerList {

	// Default KNS table URL
//	private final static String DEFAULT_KNS_TABLE_URL = "https://raw.githubusercontent.com/AKSW/KBox/master/kns/2.0/";
	private final static String DEFAULT_KNS_TABLE_URL = "https://raw.githubusercontent.com/sahandilshan/KBox/dev/kns/2.0/";

	private CustomKNSServerList customKNSServerList = new CustomKNSServerList();

	public DefaultKNSServerList() throws MalformedURLException {
		super(new URL(DEFAULT_KNS_TABLE_URL));
	}

	@Override
	public boolean visit(KNSServerListVisitor visitor) throws Exception {
		boolean next = super.visit(visitor);
		if(next) {
			next = customKNSServerList.visit(visitor);
		}
		return next;
	}
}

Add temporary default KNS table URL


package seedu.taskmanager.logic.parser;

import java.util.regex.Pattern;

import seedu.taskmanager.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_STARTDATE = new Prefix("s/");
    public static final Prefix PREFIX_ENDDATE = new Prefix("e/");
    public static final Prefix PREFIX_DESCRIPTION = new Prefix("d/");
    public static final Prefix PREFIX_TAG = new Prefix("#");

    /* Alternative prefix definitions for natural variations of user input*/
//    public static final Prefix ALTERNATIVE_PREFIX_STARTDATE = new Prefix("start on ");
//    public static final Prefix ALTERNATIVE_PREFIX_ENDDATE = new Prefix("end on ");
//    public static final Prefix ALTERNATIVE_PREFIX_DESCRIPTION = new Prefix("with description ");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

    // File Path allows numbers, "/.-", space, lowercase and uppercase letters
    public static final Pattern FILEPATH_ARGS_FORMAT = Pattern.compile("([ 0-9a-zA-Z/.-])+");
}

package seedu.taskmanager.logic.parser;

import java.util.regex.Pattern;

import seedu.taskmanager.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_STARTDATE = new Prefix("s/");
    public static final Prefix PREFIX_ENDDATE = new Prefix("e/");
    public static final Prefix PREFIX_DESCRIPTION = new Prefix("d/");
    public static final Prefix PREFIX_TAG = new Prefix("#");

    /* Alternative prefix definitions for natural variations of user input*/
//    public static final Prefix ALTERNATIVE_PREFIX_STARTDATE = new Prefix("start on ");
//    public static final Prefix ALTERNATIVE_PREFIX_ENDDATE = new Prefix("end on ");
//    public static final Prefix ALTERNATIVE_PREFIX_DESCRIPTION = new Prefix("with description ");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

    // File Path allows numbers, "/.-", space, lowercase and uppercase letters
    public static final Pattern FILEPATH_ARGS_FORMAT = Pattern.compile("([ 0-9a-zA-Z/_.-])+");
}

Fix to allow “_” (underline) in file path name


// Copyright 2016 The Bazel Authors. All rights reserved.
//
// 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.google.devtools.build.lib.ssd;

import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;

/**
 * Options that tune Bazel's performance in order to increase performance on workstations with an
 * SSD.
 */
public class SsdOptions extends OptionsBase {
  @Option(
    name = "experimental_multi_threaded_digest",
    defaultValue = "false",
    documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
    effectTags = {OptionEffectTag.UNKNOWN},
    help =
        "Whether to always compute MD5 digests of files with multiple threads. Might improve "
            + "performance when using an SSD."
  )
  public boolean experimentalMultiThreadedDigest;
}

// Copyright 2016 The Bazel Authors. All rights reserved.
//
// 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.google.devtools.build.lib.ssd;

import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;

/**
 * Options that tune Bazel's performance in order to increase performance on workstations with an
 * SSD.
 */
public class SsdOptions extends OptionsBase {
  @Option(
      name = "experimental_multi_threaded_digest",
      defaultValue = "true",
      documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
      effectTags = {OptionEffectTag.UNKNOWN},
      help =
          "Whether to always compute MD5 digests of files with multiple threads. Setting this to "
              + "false may improve performance when using a spinning platter.")
  public boolean experimentalMultiThreadedDigest;
}

Switch the default for --experimental_multi_threaded_digest


package net.hillsdon.reviki.jira.renderer;

import net.hillsdon.reviki.vc.PageReference;
import net.hillsdon.reviki.wiki.renderer.creole.LinkParts;
import net.hillsdon.reviki.wiki.renderer.creole.LinkResolutionContext;
import net.hillsdon.reviki.wiki.renderer.creole.SimpleLinkHandler;

public class JiraLinkHandler extends SimpleLinkHandler {

  public JiraLinkHandler(String fmat, LinkResolutionContext context) {
    super(fmat, context);
  }

  /**
   * Allow all LinkParts to be links, non-JIRA issues have been filtered
   * by JiraInternalLinker
   */
  @Override
  public boolean isAcronymNotLink(PageReference page, LinkParts parts) {
    return false;
  }
}

package net.hillsdon.reviki.jira.renderer;

import net.hillsdon.reviki.wiki.renderer.creole.LinkParts;
import net.hillsdon.reviki.wiki.renderer.creole.LinkResolutionContext;
import net.hillsdon.reviki.wiki.renderer.creole.SimpleLinkHandler;

public class JiraLinkHandler extends SimpleLinkHandler {

  public JiraLinkHandler(String fmat, LinkResolutionContext context) {
    super(fmat, context);
  }

  /**
   * Allow all LinkParts to be links, non-JIRA issues have been filtered
   * by JiraInternalLinker
   */
  @Override
  public boolean isAcronymNotLink(LinkParts parts) {
    return false;
  }
}

Correct method signature to match changes to Reviki.


package com.hamishrickerby.http_server;

import java.util.*;

/**
 * Created by rickerbh on 18/08/2016.
 */
public class Headers {
    private static String HEADER_SEPARATOR = ": ";

    Map<String, String> headers;

    public Headers() {
        headers = new HashMap<>();
    }

    public List<String> list() {
        List<String> headerList = new ArrayList<>();
        for (String key : headers.keySet()) {
            headerList.add(key + HEADER_SEPARATOR + headers.get(key));
        }
        return headerList;
    }

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

    public void parse(String headerString) {
        String[] lines = headerString.split("\r\n");
        for (String line : Arrays.asList(lines)) {
            String[] components = line.split(":");
            put(components[0].trim(), components[1].trim());
        }
    }

    public String get(String key) {
        return headers.getOrDefault(key, "");
    }

}

package com.hamishrickerby.http_server;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * Created by rickerbh on 18/08/2016.
 */
public class Headers {
    private static String HEADER_SEPARATOR = ": ";

    Map<String, String> headers;

    public Headers() {
        headers = new HashMap<>();
    }

    public List<String> list() {
        return headers.keySet().stream()
                .map(key -> key + HEADER_SEPARATOR + headers.get(key))
                .collect(Collectors.toList());
    }

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

    public void parse(String headerString) {
        String[] lines = headerString.split("\r\n");
        for (String line : Arrays.asList(lines)) {
            String[] components = line.split(":");
            put(components[0].trim(), components[1].trim());
        }
    }

    public String get(String key) {
        return headers.getOrDefault(key, "");
    }

}

Refactor headers list() with map/collect


package com.royalrangers.dto.structure;

import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public class PlatoonDto {
    private Long id;
    private Integer name;
    private Long cityId;
    private String history;
    private String logoUrl;
    private String address;
    private Date meetTime;
}

package com.royalrangers.dto.structure;

import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public class PlatoonDto {
    private Integer name;
    private Long cityId;
    private String history;
    private String logoUrl;
    private String address;
    private Date meetTime;
}

Remove unused id in Platoon Dto


package io.github.trevornelson.service;

import com.google.devrel.training.conference.domain.Profile;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyFactory;
import com.googlecode.objectify.ObjectifyService;

/**
 * Custom Objectify Service that this application should use.
 */
public class OfyService {
    /**
     * This static block ensure the entity registration.
     */
    static {
        factory().register(Profile.class);
    }

    /**
     * Use this static method for getting the Objectify service object in order to make sure the
     * above static block is executed before using Objectify.
     * @return Objectify service object.
     */
    public static Objectify ofy() {
        return ObjectifyService.ofy();
    }

    /**
     * Use this static method for getting the Objectify service factory.
     * @return ObjectifyFactory.
     */
    public static ObjectifyFactory factory() {
        return ObjectifyService.factory();
    }
}

package io.github.trevornelson.service;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyFactory;
import com.googlecode.objectify.ObjectifyService;
import io.github.trevornelson.Account;

/**
 * Custom Objectify Service that this application should use.
 */
public class OfyService {
    /**
     * This static block ensure the entity registration.
     */
    static {
        factory().register(Account.class);
    }

    /**
     * Use this static method for getting the Objectify service object in order to make sure the
     * above static block is executed before using Objectify.
     * @return Objectify service object.
     */
    public static Objectify ofy() {
        return ObjectifyService.ofy();
    }

    /**
     * Use this static method for getting the Objectify service factory.
     * @return ObjectifyFactory.
     */
    public static ObjectifyFactory factory() {
        return ObjectifyService.factory();
    }
}

Create ofy objectify service for persisting entities


package org.bouncycastle.crypto.tls;

/**
 * RFC 4366 2.3
 */
public class ExtensionType
{
    public static final int server_name = 0;
    public static final int max_fragment_length = 1;
    public static final int client_certificate_url = 2;
    public static final int trusted_ca_keys = 3;
    public static final int truncated_hmac = 4;
    public static final int status_request = 5;

    /*
     * RFC 4492
     */
    public static final int elliptic_curves = 10;
    public static final int ec_point_formats = 11;

    /*
     * RFC 5054 2.8.1
     */
    public static final int srp = 12;

    /*
     * RFC 5746 6
     */
    public static final int renegotiation_info = 0xff01;
}

package org.bouncycastle.crypto.tls;

public class ExtensionType
{
    /*
     * RFC 6066 1.1.
     */
    public static final int server_name = 0;
    public static final int max_fragment_length = 1;
    public static final int client_certificate_url = 2;
    public static final int trusted_ca_keys = 3;
    public static final int truncated_hmac = 4;
    public static final int status_request = 5;

    /*
     * RFC 4492 5.1.
     */
    public static final int elliptic_curves = 10;
    public static final int ec_point_formats = 11;

    /*
     * RFC 5054 2.8.1.
     */
    public static final int srp = 12;

    /*
     * RFC 5246 7.4.1.4.
     */
    public static final int signature_algorithms = 13;

    /*
     * RFC 5746 3.2.
     */
    public static final int renegotiation_info = 0xff01;
}

Add extension type from RFC 5246


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

import <%=packageName%>.security.AuthoritiesConstants;
import <%=packageName%>.service.AuditEventService;
import <%=packageName%>.web.propertyeditors.LocaleDateTimeEditor;
import org.joda.time.LocalDateTime;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import java.util.List;

/**
 * REST controller for getting the audit events.
 */
@RestController
@RequestMapping("/app")
public class AuditResource {

    @Inject
    private AuditEventService auditEventService;

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(LocalDateTime.class, new LocaleDateTimeEditor("MM/dd/yyyy", false));
    }

    @RequestMapping(value = "/rest/audits/all",
            method = RequestMethod.GET,
            produces = "application/json")
    @RolesAllowed(AuthoritiesConstants.ADMIN)
    public List<AuditEvent> findAll() {
        return auditEventService.findAll();
    }

    @RequestMapping(value = "/rest/audits/byDates",
            method = RequestMethod.GET,
            produces = "application/json")
    @RolesAllowed(AuthoritiesConstants.ADMIN)
    public List<AuditEvent> findByDates(@RequestParam(value = "fromDate") LocalDateTime fromDate,
                                    @RequestParam(value = "toDate") LocalDateTime toDate) {
        return auditEventService.findBetweenDates(fromDate, toDate);
    }
}

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

import <%=packageName%>.security.AuthoritiesConstants;
import <%=packageName%>.service.AuditEventService;
import <%=packageName%>.web.propertyeditors.LocaleDateTimeEditor;
import org.joda.time.LocalDateTime;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import java.util.List;

/**
 * REST controller for getting the audit events.
 */
@RestController
@RequestMapping("/app")
public class AuditResource {

    @Inject
    private AuditEventService auditEventService;

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(LocalDateTime.class, new LocaleDateTimeEditor("MM/dd/yyyy hh:mm:ss a", false));
    }

    @RequestMapping(value = "/rest/audits/all",
            method = RequestMethod.GET,
            produces = "application/json")
    @RolesAllowed(AuthoritiesConstants.ADMIN)
    public List<AuditEvent> findAll() {
        return auditEventService.findAll();
    }

    @RequestMapping(value = "/rest/audits/byDates",
            method = RequestMethod.GET,
            produces = "application/json")
    @RolesAllowed(AuthoritiesConstants.ADMIN)
    public List<AuditEvent> findByDates(@RequestParam(value = "fromDate") LocalDateTime fromDate,
                                    @RequestParam(value = "toDate") LocalDateTime toDate) {
        return auditEventService.findBetweenDates(fromDate, toDate);
    }
}

Add the time to the format of the date


package com.github.hisaichi5518.kise;

public interface UnitActions<ACTION_PARAM> {
    void customAction(ACTION_PARAM actionParam);

    void defaultAction(ACTION_PARAM actionParam);
}

package com.github.hisaichi5518.kise;

public interface UnitActions<ACTION_PARAM> {
    void customAction(ACTION_PARAM actionParam) throws Exception;

    void defaultAction(ACTION_PARAM actionParam);
}

Add "throws Exception" to customAction method.


package annotator.find;

import com.sun.source.tree.*;
import com.sun.source.util.TreePath;

/**
 * Represents the criterion that a program element is not enclosed by any
 * method (i.e. it's a field, class type parameter, etc.).
 */
final class NotInMethodCriterion implements Criterion {

  /**
   * {@inheritDoc}
   */
  public Kind getKind() {
    return Kind.NOT_IN_METHOD;
  }

  /** {@inheritDoc} */
  @Override
  public boolean isSatisfiedBy(TreePath path, Tree leaf) {
    assert path == null || path.getLeaf() == leaf;
    return isSatisfiedBy(path);
  }

  /** {@inheritDoc} */
  @Override
  public boolean isSatisfiedBy(TreePath path) {
    do {
      Tree tree = path.getLeaf();
      if (tree.getKind() == Tree.Kind.METHOD)
        return false;
      if (tree.getKind() == Tree.Kind.CLASS || tree.getKind() == Tree.Kind.NEW_CLASS) {
        return true;
      }
      path = path.getParentPath();
    } while (path != null && path.getLeaf() != null);

    return true;
  }

  /**
   * {@inheritDoc}
   */
  public String toString() {
    return "not in method";
  }

}

package annotator.find;

import com.sun.source.tree.*;
import com.sun.source.util.TreePath;

/**
 * Represents the criterion that a program element is not enclosed by any
 * method (i.e. it's a field, class type parameter, etc.).
 */
final class NotInMethodCriterion implements Criterion {

  /**
   * {@inheritDoc}
   */
  @Override
  public Kind getKind() {
    return Kind.NOT_IN_METHOD;
  }

  /** {@inheritDoc} */
  @Override
  public boolean isSatisfiedBy(TreePath path, Tree leaf) {
    assert path == null || path.getLeaf() == leaf;
    return isSatisfiedBy(path);
  }

  /** {@inheritDoc} */
  @Override
  public boolean isSatisfiedBy(TreePath path) {
    do {
      Tree tree = path.getLeaf();
      if (tree.getKind() == Tree.Kind.METHOD)
        return false;
      if (Criteria.isClassEquiv(tree)) {
        return true;
      }
      path = path.getParentPath();
    } while (path != null && path.getLeaf() != null);

    return true;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public String toString() {
    return "not in method";
  }

}

Call helper method instead of hard-coding class-equivalent structures here.


/**
 * The Totemic API.
 * This should provide some functionality for extending Totemic.
 */
@API(apiVersion = "2.1.0", owner = Totemic.MOD_ID, provides = "totemic|API")
package totemic_commons.pokefenn.api;

import net.minecraftforge.fml.common.API;
import totemic_commons.pokefenn.Totemic;

/**
 * The Totemic API.
 * This should provide some functionality for extending Totemic.
 */
@net.minecraftforge.fml.common.API(apiVersion = "2.1.1", owner = "totemic", provides = "totemic|API")
package totemic_commons.pokefenn.api;

Fix API not being compilable by itself


package io.github.arpankapoor.country;

import com.google.i18n.phonenumbers.PhoneNumberUtil;

import java.util.Locale;

public class Country {
    private String name;
    private String isoCode;
    private int callingCode;

    public Country(String isoCode) {
        this.isoCode = isoCode.toUpperCase();
        this.name = new Locale("", this.isoCode).getDisplayCountry();
        this.callingCode = PhoneNumberUtil.getInstance().getCountryCodeForRegion(this.isoCode);
    }

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

    public int getCallingCode() {
        return callingCode;
    }

    public void setCallingCode(int callingCode) {
        this.callingCode = callingCode;
    }

    public String getName() {
        return name;
    }

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

    public String getIsoCode() {
        return isoCode;
    }

    public void setIsoCode(String isoCode) {
        this.isoCode = isoCode;
    }
}

package io.github.arpankapoor.country;

import android.support.annotation.NonNull;

import com.google.i18n.phonenumbers.PhoneNumberUtil;

import java.io.Serializable;
import java.util.Locale;

public class Country implements Comparable<Country>, Serializable {
    private static final long serialVersionUID = 8116297477768564397L;
    private String name;
    private String isoCode;
    private int callingCode;

    public Country(String isoCode) {
        setIsoCode(isoCode.toUpperCase());
        setName(new Locale("", getIsoCode()).getDisplayCountry());
        setCallingCode(PhoneNumberUtil.getInstance().getCountryCodeForRegion(getIsoCode()));
    }

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

    public int getCallingCode() {
        return callingCode;
    }

    public void setCallingCode(int callingCode) {
        this.callingCode = callingCode;
    }

    public String getName() {
        return name;
    }

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

    public String getIsoCode() {
        return isoCode;
    }

    public void setIsoCode(String isoCode) {
        this.isoCode = isoCode;
    }

    @Override
    public int compareTo(@NonNull Country another) {
        return this.name.compareTo(another.name);
    }
}

Implement Serializable and Comparable interfaces


/*
 * SafeUriStringImpl.java
 *
 * Copyright (C) 2009-11 by RStudio, Inc.
 *
 * This program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */
package org.rstudio.core.client;

import com.google.gwt.safehtml.shared.SafeUri;

public class SafeUriStringImpl implements SafeUri
{
   public SafeUriStringImpl(String value)
   {
      value_ = value;
   }

   @Override
   public String asString()
   {
      return value_;
   }

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

   @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
   @Override
   public boolean equals(Object o)
   {
      if (o == null ^ value_ == null)
         return false;
      if (value_ == null)
         return false;
      return value_.equals(o.toString());
   }

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

   private final String value_;
}

/*
 * SafeUriStringImpl.java
 *
 * Copyright (C) 2009-11 by RStudio, Inc.
 *
 * This program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */
package org.rstudio.core.client;

import com.google.gwt.safehtml.shared.SafeUri;

public class SafeUriStringImpl implements SafeUri
{
   public SafeUriStringImpl(String value)
   {
      value_ = value;
   }

   @Override
   public String asString()
   {
      return value_;
   }

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

   @Override
   public boolean equals(Object o)
   {
      if (o == null ^ value_ == null)
         return false;
      if (value_ == null)
         return false;
      return value_.equals(o.toString());
   }

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

   private final String value_;
}

Remove warning suppression that Eclipse doesn't like


package cpw.mods.fml.common.event;

import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.LoaderState.ModState;

public class FMLServerStartingEvent extends FMLStateEvent
{

    private MinecraftServer server;

    public FMLServerStartingEvent(Object... data)
    {
        super(data);
        this.server = (MinecraftServer) data[0];
    }
    @Override
    public ModState getModState()
    {
        return ModState.AVAILABLE;
    }

    public MinecraftServer getServer()
    {
        return server;
    }
}

package cpw.mods.fml.common.event;

import net.minecraft.server.MinecraftServer;
import net.minecraft.src.CommandHandler;
import net.minecraft.src.ICommand;
import cpw.mods.fml.common.LoaderState.ModState;

public class FMLServerStartingEvent extends FMLStateEvent
{

    private MinecraftServer server;

    public FMLServerStartingEvent(Object... data)
    {
        super(data);
        this.server = (MinecraftServer) data[0];
    }
    @Override
    public ModState getModState()
    {
        return ModState.AVAILABLE;
    }

    public MinecraftServer getServer()
    {
        return server;
    }

    public void registerServerCommand(ICommand command)
    {
        CommandHandler ch = (CommandHandler) getServer().func_71187_D();
        ch.func_71560_a(command);
    }
}

Add in a helper on the server start event for adding commands to the server.