package seedu.watodo.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.watodo.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

    private static final String FXML = "TaskListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label description;
    @FXML
    private Label id;
    @FXML
    private Label startDate;
    @FXML
    private Label endDate;
    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask task, int displayedIndex) {
        super(FXML);
        description.setText(task.getDescription().fullDescription);
        id.setText(displayedIndex + ". ");

        if (task.getStartDate() != null) {
            startDate.setText("Start Task From " + task.getStartDate());
        } else {
            startDate.setText("");
        }

        if (task.getEndDate() != null) {
            endDate.setText("Do Task By " + task.getEndDate());
        } else {
            endDate.setText("");
        }

        initTags(task);
    }

    private void initTags(ReadOnlyTask person) {
        person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

package seedu.watodo.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.watodo.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

    private static final String FXML = "TaskListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label description;
    @FXML
    private Label status;
    @FXML
    private Label id;
    @FXML
    private Label startDate;
    @FXML
    private Label endDate;
    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask task, int displayedIndex) {
        super(FXML);
        description.setText(task.getDescription().fullDescription);
        id.setText(displayedIndex + ". ");

        if (task.getStartDate() != null) {
            startDate.setText("Start Task From " + task.getStartDate());
        } else {
            startDate.setText("");
        }

        if (task.getEndDate() != null) {
            endDate.setText("Do Task By " + task.getEndDate());
        } else {
            endDate.setText("");
        }

        status.setText(task.getStatus().toString());

        initTags(task);
    }

    private void initTags(ReadOnlyTask person) {
        person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

Add set status text to java file


package org.robolectric.shadows;

import android.opengl.GLSurfaceView;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

/** Fake implementation of GLSurfaceView */
@Implements(GLSurfaceView.class)
public class ShadowGLSurfaceView extends ShadowSurfaceView {
  @Implementation
  protected void onPause() {}

  @Implementation
  protected void onResume() {}
}

package org.robolectric.shadows;

import android.opengl.GLSurfaceView;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

/** Fake implementation of GLSurfaceView */
@Implements(GLSurfaceView.class)
public class ShadowGLSurfaceView extends ShadowSurfaceView {
  @Implementation
  protected void onPause() {}

  @Implementation
  protected void onResume() {}

  @Implementation
  protected void queueEvent(Runnable r) {
    r.run();
  }
}

Call queued events on GLSurfaceView shadow.


package replicant.messages;

import javax.annotation.Nonnull;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;

/**
 * The abstract message that messages conform to.
 */
@SuppressWarnings( "NullableProblems" )
@SuppressFBWarnings( "EI_EXPOSE_REP" )
@JsType( isNative = true, namespace = JsPackage.GLOBAL, name = "Object" )
public abstract class AbstractMessage
{
  @Nonnull
  String type;

  /**
   * Return the type of the message.
   *
   * @return the type of the message.
   */
  @Nonnull
  public String getType()
  {
    return type;
  }
}

package replicant.messages;

import javax.annotation.Nonnull;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;

/**
 * The abstract message that messages conform to.
 */
@SuppressWarnings( "NullableProblems" )
@SuppressFBWarnings( "EI_EXPOSE_REP" )
@JsType( isNative = true, namespace = JsPackage.GLOBAL, name = "Object" )
public abstract class AbstractMessage
{
  @Nonnull
  String type;

  /**
   * Return the type of the message.
   *
   * @return the type of the message.
   */
  @Nonnull
  @JsOverlay
  public final String getType()
  {
    return type;
  }
}

Make sure this class complies with JsType restrictions


package org.parallelj.ssh.publickey;

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

public class IO {

	public static byte[] readAsBytes(InputStream in) throws IOException {
		return read(in).toByteArray();
	}

	public static void copy(InputStream in, OutputStream out)
			throws IOException {
		if (in == null) {
			throw new NullPointerException();
		}
		try {
			byte[] buffer = new byte[256];
			for (int l = in.read(buffer); l != -1; l = in.read(buffer)) {
				out.write(buffer, 0, l);
			}
		} finally {
			close(in);
		}
	}

	private static ByteArrayOutputStream read(InputStream in)
			throws IOException {
		if (in == null) {
			throw new NullPointerException();
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		copy(in, baos);
		return baos;
	}

	public static void close(Closeable closeable) {
		if (closeable != null) {
			try {
				closeable.close();
			} catch (IOException ignore) {
			}
		}
	}
}

package org.parallelj.ssh.publickey;

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

public class IO {

	private IO() {
	}

	public static byte[] readAsBytes(InputStream in) throws IOException {
		return read(in).toByteArray();
	}

	public static void copy(InputStream in, OutputStream out)
			throws IOException {
		if (in == null) {
			throw new NullPointerException();
		}
		try {
			byte[] buffer = new byte[256];
			for (int l = in.read(buffer); l != -1; l = in.read(buffer)) {
				out.write(buffer, 0, l);
			}
		} finally {
			close(in);
		}
	}

	private static ByteArrayOutputStream read(InputStream in)
			throws IOException {
		if (in == null) {
			throw new NullPointerException();
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		copy(in, baos);
		return baos;
	}

	public static void close(Closeable closeable) {
		if (closeable != null) {
			try {
				closeable.close();
			} catch (IOException ignore) {
			}
		}
	}
}

Hide constructor for utility class


package models.support;

import models.Milestone;
import models.ModelTest;
import models.enumeration.Direction;
import models.enumeration.Matching;
import org.junit.Test;
import play.db.ebean.Model;

import java.util.List;

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

public class FinderTemplateTest extends ModelTest<Milestone> {

    private static Model.Finder<Long, Milestone> find = new Model.Finder<Long, Milestone>(
            Long.class, Milestone.class);

    @Test
    public void findBy() throws Exception {
        OrderParams orderParams = new OrderParams();
        SearchParams searchParams = new SearchParams();

        orderParams.add("dueDate", Direction.ASC);
        searchParams.add("project.id", 2l, Matching.EQUALS);
        searchParams.add("completionRate", 100, Matching.LT);

        List<Milestone> p2MilestoneList = FinderTemplate.findBy(orderParams, searchParams, find);
        assertThat(p2MilestoneList.get(0).id).isEqualTo(4);

        orderParams.clean();
        searchParams.clean();

        orderParams.add("dueDate", Direction.DESC);
        searchParams.add("project.id", 1l, Matching.EQUALS);
        searchParams.add("completionRate", 50, Matching.EQUALS);

        List<Milestone> p1MilestoneList = FinderTemplate.findBy(orderParams, searchParams, find);
        assertThat(p1MilestoneList.get(0).id).isEqualTo(1);
    }
}

package models.support;

import models.Milestone;
import models.ModelTest;
import models.enumeration.Direction;
import models.enumeration.Matching;
import org.junit.Test;
import play.db.ebean.Model;

import java.util.List;

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

public class FinderTemplateTest extends ModelTest<Milestone> {

    private static Model.Finder<Long, Milestone> find = new Model.Finder<Long, Milestone>(
            Long.class, Milestone.class);

    @Test
    public void findBy() throws Exception {
        OrderParams orderParams = new OrderParams();
        SearchParams searchParams = new SearchParams();

        orderParams.add("dueDate", Direction.ASC);
        searchParams.add("project.id", 2l, Matching.EQUALS);

        List<Milestone> p2MilestoneList = FinderTemplate.findBy(orderParams, searchParams, find);
        assertThat(p2MilestoneList.get(0).id).isEqualTo(3);

        orderParams.clean();
        searchParams.clean();

        orderParams.add("dueDate", Direction.DESC);
        searchParams.add("project.id", 1l, Matching.EQUALS);

        List<Milestone> p1MilestoneList = FinderTemplate.findBy(orderParams, searchParams, find);
        assertThat(p1MilestoneList.get(0).id).isEqualTo(2);
    }
}

Fix test failures caused by 57b8cc7.


package de.oio.spring.config;

import de.oio.service.impl.VaadinAccessDecisionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;

@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true)
public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {

    @Autowired
    private VaadinAccessDecisionManager vaadinAccessDecisionManager;

    @Override
    protected AccessDecisionManager accessDecisionManager() {
        vaadinAccessDecisionManager.setAccessDecisionManager(super.accessDecisionManager());
        return vaadinAccessDecisionManager;
    }
}

package de.oio.spring.config;

import de.oio.service.impl.VaadinAccessDecisionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;

@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true, proxyTargetClass = true)
public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {

    @Autowired
    private VaadinAccessDecisionManager vaadinAccessDecisionManager;

    @Override
    protected AccessDecisionManager accessDecisionManager() {
        vaadinAccessDecisionManager.setAccessDecisionManager(super.accessDecisionManager());
        return vaadinAccessDecisionManager;
    }
}

Add proxyTargetClass=true to @EnableGlobalMethodSecurity to prevent intermittent widgetset errors


package dhbw.pluto.recipes;

import java.util.List;

import org.json.*;

public class Recipe {

	private int id;
	private String title;
	private String author;
	private String text;
	List<Ingredient> ingredients;

	/*
	 * Constructor
	 */

	public Recipe (int id, String title, String author, String text, List<Ingredient> ingredients) {
		this.id = id;
		this.title = title;
		this.author = author;
		this.text = text;
		this.ingredients = ingredients;
	}

	//generate valid JSON
	public JSONObject toJSON() {
	    JSONObject result = new JSONObject();

	    try {
	    	result.put("id", id);
	        result.put("title", title);
	        result.put("text", text);
	        result.put("eMail", author);
	        JSONArray ingredientsArray = new JSONArray();
	        for(int i = 0; i < ingredients.size(); i++) {
	        	ingredientsArray.put(ingredients.get(i).toJSON());
	        }
	        result.put("ingredients", ingredientsArray);
	    } catch (JSONException e) {
	        // put() throws e, if key==null. Since key=<STRING>, this exception should never be thrown.
	        e.printStackTrace();
	    }

	    return result;
	}

	public int getId() {
		return id;
	}

}

package dhbw.pluto.recipes;

import java.util.List;

import org.json.*;

public class Recipe {

	private int id;
	private String title;
	private String author;
	private String text;
	List<Ingredient> ingredients;
	private int score = 100;

	/*
	 * Constructor
	 */

	public Recipe (int id, String title, String author, String text, List<Ingredient> ingredients) {
		this.id = id;
		this.title = title;
		this.author = author;
		this.text = text;
		this.ingredients = ingredients;
	}

	//generate valid JSON
	public JSONObject toJSON() {
	    JSONObject result = new JSONObject();

	    try {
	    	result.put("id", id);
	        result.put("title", title);
	        result.put("text", text);
	        result.put("eMail", author);
	        result.put("score", score);
	        JSONArray ingredientsArray = new JSONArray();
	        for(int i = 0; i < ingredients.size(); i++) {
	        	ingredientsArray.put(ingredients.get(i).toJSON());
	        }
	        result.put("ingredients", ingredientsArray);
	    } catch (JSONException e) {
	        // put() throws e, if key==null. Since key=<STRING>, this exception should never be thrown.
	        e.printStackTrace();
	    }

	    return result;
	}

	public int getId() {
		return id;
	}

	public void setScore(int score) {
		this.score = score;
	}

}

Add score attribute to recipe


package com.veyndan.paper.reddit.post;

import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.auto.value.AutoValue;

@AutoValue
public abstract class Flair {

    public enum Type {
        LINK, UNDEFINED
    }

    @NonNull
    public abstract Type type();

    @Nullable
    public abstract String text();

    @Nullable
    public abstract Drawable icon();

    public abstract int backgroundColor();

    public static Builder builder(@ColorInt final int backgroundColor) {
        return new AutoValue_Flair.Builder()
                .backgroundColor(backgroundColor)
                .type(Type.UNDEFINED);
    }

    @AutoValue.Builder
    public abstract static class Builder {

        public abstract Builder type(Type type);

        public abstract Builder text(String text);

        public abstract Builder icon(Drawable icon);

        public abstract Builder backgroundColor(@ColorInt int backgroundColor);

        public abstract Flair build();
    }
}

package com.veyndan.paper.reddit.post;

import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.auto.value.AutoValue;

@AutoValue
public abstract class Flair {

    public enum Type {
        LINK, UNDEFINED
    }

    @NonNull
    public abstract Type type();

    @Nullable
    public abstract String text();

    @Nullable
    public abstract Drawable icon();

    public abstract int backgroundColor();

    public static Builder builder(@ColorInt final int backgroundColor) {
        return new AutoValue_Flair.Builder()
                .backgroundColor(backgroundColor)
                .type(Type.UNDEFINED);
    }

    @AutoValue.Builder
    public interface Builder {

        Builder type(Type type);

        Builder text(String text);

        Builder icon(Drawable icon);

        Builder backgroundColor(@ColorInt int backgroundColor);

        Flair build();
    }
}

Make @AutoValue.Builder builder an interface


package com.mkl.eu.client.service.vo;

import javax.xml.bind.annotation.XmlID;
import java.io.Serializable;

/**
 * Mother class of all VOs.
 *
 * @author MKL
 */
public abstract class EuObject implements Serializable {
    /** Id of the object. */
    private Long id;

    /** @return the id. */
    public Long getId() {
        return id;
    }

    /** @param id the id to set. */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Method added because jaxb stores all the idRef in the same Map,
     * whatever the class is. So if two different classes have the same id,
     * there will be a collision.
     *
     * @return id for jaxb.
     */
    @XmlID
    public String getIdForJaxb() {
        return getClass().toString() + "_" + getId();
    }

    /**
     * So that jaxb works...
     */
    public void setIdForJaxb(String id) {

    }
}

package com.mkl.eu.client.service.vo;

import javax.xml.bind.annotation.XmlID;
import java.io.Serializable;

/**
 * Mother class of all VOs.
 *
 * @author MKL
 */
public abstract class EuObject implements Serializable {
    /** Id of the object. */
    private Long id;

    /** @return the id. */
    public Long getId() {
        return id;
    }

    /** @param id the id to set. */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Method added because jaxb stores all the idRef in the same Map,
     * whatever the class is. So if two different classes have the same id,
     * there will be a collision.
     *
     * @return id for jaxb.
     */
    @XmlID
    public String getIdForJaxb() {
        return getClass().getSimpleName() + "_" + getId();
    }

    /**
     * So that jaxb works...
     */
    public void setIdForJaxb(String id) {

    }
}

Fix Jaxb bug on XmlIdRef.


package com.alexrnl.commons.database;

import java.util.Enumeration;

/**
 * Interface for the entity columns.

 * This interface should be implemented by the {@link Enumeration} which represent the column of the
 * entity in the database.

 * @author Alex
 */
public interface EntityColumn {

	/**
	 * Return the name of the column field, in the Java code.

	 * This will later be used when dynamically accessing properties.
	 * @return the name of the property in the Java code.
	 */
	String getFieldName ();
}

package com.alexrnl.commons.database;

/**
 * Interface for the entity columns.

 * This interface should be implemented by the {@link java.util.Enumeration} which represent the
 * column of the
 * entity in the database.

 * @author Alex
 */
public interface EntityColumn {

	/**
	 * Return the name of the column field, in the Java code.

	 * This will later be used when dynamically accessing properties.
	 * @return the name of the property in the Java code.
	 */
	String getFieldName ();
}

Remove useless dependancy to java.util.Enumeration


package squeek.wailaharvestability.helpers;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public class OreHelper
{
	public static boolean isBlockAnOre(Block block)
	{
		return isBlockAnOre(block, 0);
	}

	public static boolean isBlockAnOre(Block block, int metadata)
	{
		return isItemAnOre(new ItemStack(block, 1, metadata));
	}

	public static boolean isItemAnOre(ItemStack itemStack)
	{
		// check the ore dictionary to see if it starts with "ore"
		int oreID = -1;
		if ((oreID = OreDictionary.getOreID(itemStack)) != -1 && OreDictionary.getOreName(oreID).startsWith("ore"))
			return true;

		// ore in the display name (but not part of another word)
		if (itemStack.getDisplayName().matches(".*(^|\\s)([oO]re)($|\\s).*"))
			return true;

		// ore as the start of the unlocalized name
		if (itemStack.getUnlocalizedName().startsWith("ore"))
			return true;

		return false;
	}
}

package squeek.wailaharvestability.helpers;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public class OreHelper
{
	public static boolean isBlockAnOre(Block block)
	{
		return isBlockAnOre(block, 0);
	}

	public static boolean isBlockAnOre(Block block, int metadata)
	{
		return isItemAnOre(new ItemStack(block, 1, metadata));
	}

	public static boolean isItemAnOre(ItemStack itemStack)
	{
		// check the ore dictionary to see if it starts with "ore"
		int[] oreIDs = OreDictionary.getOreIDs(itemStack);
		for (int oreID : oreIDs)
		{
			if (OreDictionary.getOreName(oreID).startsWith("ore"))
				return true;
		}

		// ore in the display name (but not part of another word)
		if (itemStack.getDisplayName().matches(".*(^|\\s)([oO]re)($|\\s).*"))
			return true;

		// ore as the start of the unlocalized name
		if (itemStack.getUnlocalizedName().startsWith("ore"))
			return true;

		return false;
	}
}

Fix 'is ore' check not handling multiple oredict registrations properly


package com.github.sherter.googlejavaformatgradleplugin.format;

import com.google.common.collect.ImmutableList;

/** Static factory method for creating new {@link Formatter}s. */
public class Gjf {

  public static final String GROUP_ID = "com.google.googlejavaformat";
  public static final String ARTIFACT_ID = "google-java-format";

  public static final ImmutableList<String> SUPPORTED_VERSIONS =
      ImmutableList.of("1.0", "1.1", "1.2", "1.3");

  /**
   * Constructs a new formatter that delegates to <a
   * href="https://github.com/google/google-java-format">google-java-format</a>.
   *
   * @param classLoader load {@code google-java-format} classes from this {@code ClassLoader}
   * @param config configure the formatter according to this configuration
   * @throws ReflectiveOperationException if the requested {@code Formatter} cannot be constructed
   */
  public static Formatter newFormatter(ClassLoader classLoader, Configuration config)
      throws ReflectiveOperationException {
    return newFormatterFactory(classLoader, config).create();
  }

  private static FormatterFactory newFormatterFactory(
      ClassLoader classLoader, Configuration config) {
    switch (config.version) {
      case "1.0":
        return new OneDotZeroFactory(classLoader, config);
      case "1.1":
        return new OneDotOneFactory(classLoader, config);
      default:
        return new OneDotOneFactory(classLoader, config);
    }
  }
}

package com.github.sherter.googlejavaformatgradleplugin.format;

import com.google.common.collect.ImmutableList;

/** Static factory method for creating new {@link Formatter}s. */
public class Gjf {

  public static final String GROUP_ID = "com.google.googlejavaformat";
  public static final String ARTIFACT_ID = "google-java-format";

  public static final ImmutableList<String> SUPPORTED_VERSIONS =
      ImmutableList.of("1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6");

  /**
   * Constructs a new formatter that delegates to <a
   * href="https://github.com/google/google-java-format">google-java-format</a>.
   *
   * @param classLoader load {@code google-java-format} classes from this {@code ClassLoader}
   * @param config configure the formatter according to this configuration
   * @throws ReflectiveOperationException if the requested {@code Formatter} cannot be constructed
   */
  public static Formatter newFormatter(ClassLoader classLoader, Configuration config)
      throws ReflectiveOperationException {
    return newFormatterFactory(classLoader, config).create();
  }

  private static FormatterFactory newFormatterFactory(
      ClassLoader classLoader, Configuration config) {
    switch (config.version) {
      case "1.0":
        return new OneDotZeroFactory(classLoader, config);
      case "1.1":
        return new OneDotOneFactory(classLoader, config);
      default:
        return new OneDotOneFactory(classLoader, config);
    }
  }
}

Add support for google-java-format versions 1.4, 1.5 and 1.6


package seedu.typed.schedule;

import seedu.typed.model.task.DateTime;
//@@author A0139379M
/**
 * TimeExpression is an expression that specifies
 * a recurring date. All TimeExpression has an individual
 * instance method to work out whether a day lies in the
 * expression.
 * @author: YIM CHIA HUI
 **/
public interface TimeExpression {

    /**
     * Checks if date falls within TimeExpression
     * i.e if 12/12/2017 falls within every Monday
     * or second tuesday of every month etc
     * @params DateTime date
     * @return True if TimeExpression includes date
     **/
    public boolean includes(DateTime date);

}

package seedu.typed.schedule;

import seedu.typed.model.task.DateTime;
//@@author A0139379M
/**
 * TimeExpression is an expression that specifies
 * a recurring date. All TimeExpression has an individual
 * instance method to work out whether a day lies in the
 * expression.
 * @author: YIM CHIA HUI
 **/
public interface TimeExpression {

    /**
     * Checks if date falls within TimeExpression
     * i.e if 12/12/2017 falls within every Monday
     * or second tuesday of every month etc
     * @params date
     * @return True if TimeExpression includes date
     **/
    public boolean includes(DateTime date);

    /**
     * Returns the next DateTime
     * where it falls within the TimeExpression
     * @param date
     * @return the next occurring DateTime object where
     * includes return true
     */
    public DateTime nextDeadlineOccurrence(DateTime date);

}

Add support for recurrence in time expression with time expression to parse recurrence rule


package com.elmakers.mine.bukkit.integration;

import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.Plugin;

import com.elmakers.mine.bukkit.api.magic.MageController;
import com.elmakers.mine.bukkit.utility.ConfigurationUtils;

import me.realized.tokenmanager.api.TokenManager;

public class TokenManagerController {
    private final TokenManager tokenManager;
    private final MageController controller;
    private boolean enabled;

    public TokenManagerController(MageController controller, Plugin tokenManagerPlugin) {
        this.controller = controller;
        tokenManager = tokenManagerPlugin instanceof TokenManager ? (TokenManager)tokenManagerPlugin : null;
    }

    public void load(ConfigurationSection configuration) {
        enabled = configuration.getBoolean("token_manager.enabled", true);
        String statusString;

        if (!enabled) {
            statusString = " but is disabled in Magic's configs";
        } else if (tokenManager == null) {
            statusString = " but integration failed";
        } else {
            statusString = ", registering tokens currency";
        }
        controller.getLogger().info("TokenManager found" + statusString);
    }

    public void register(ConfigurationSection currencyConfiguration) {
        if (enabled && tokenManager != null) {
            ConfigurationSection configuration = currencyConfiguration.getConfigurationSection("tokens");
            if (configuration == null) {
                configuration = ConfigurationUtils.newConfigurationSection();
            }
            controller.register(new TokenManagerCurrency(controller, tokenManager, configuration));
        }
    }
}

package com.elmakers.mine.bukkit.integration;

import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.Plugin;

import com.elmakers.mine.bukkit.api.magic.MageController;
import com.elmakers.mine.bukkit.utility.ConfigurationUtils;

import me.realized.tokenmanager.api.TokenManager;

public class TokenManagerController {
    private final TokenManager tokenManager;
    private final MageController controller;
    private boolean enabled;

    public TokenManagerController(MageController controller, Plugin tokenManagerPlugin) {
        this.controller = controller;
        tokenManager = tokenManagerPlugin instanceof TokenManager ? (TokenManager)tokenManagerPlugin : null;
    }

    public void load(ConfigurationSection configuration) {
        enabled = configuration.getBoolean("enabled", true);
        String statusString;

        if (!enabled) {
            statusString = " but is disabled in Magic's configs";
        } else if (tokenManager == null) {
            statusString = " but integration failed";
        } else {
            statusString = ", registering tokens currency";
        }
        controller.getLogger().info("TokenManager found" + statusString);
    }

    public void register(ConfigurationSection currencyConfiguration) {
        if (enabled && tokenManager != null) {
            ConfigurationSection configuration = currencyConfiguration.getConfigurationSection("tokens");
            if (configuration == null) {
                configuration = ConfigurationUtils.newConfigurationSection();
            }
            controller.register(new TokenManagerCurrency(controller, tokenManager, configuration));
        }
    }
}

Fix not being able to disable TokenManager integration


package com.matao.common.util;

import android.content.Context;
import android.util.DisplayMetrics;

/**
 * Created by matao on 2016-12-11 16:19
 * <p>
 * ScreenUtils提供了获取屏幕宽高以及dp与px相互转换的方法
 */

public class ScreenUtils {
    private ScreenUtils() {
        throw new AssertionError("ScreenUtils cannot be instantiated!");
    }

    public static int getScreenWidth(Context context) {
        if (context == null) {
            throw new NullPointerException("context cannot be null");
        }
        DisplayMetrics dm = context.getResources().getDisplayMetrics();
        return dm.widthPixels;
    }

    public static int getScreenHeight(Context context) {
        if (context == null) {
            throw new NullPointerException("context cannot be null");
        }
        DisplayMetrics dm = context.getResources().getDisplayMetrics();
        return dm.heightPixels;
    }
}

package com.matao.common.util;

import android.content.Context;
import android.util.DisplayMetrics;

/**
 * Created by matao on 2016-12-11 16:19
 * <p>
 * ScreenUtils提供了获取屏幕宽高以及dp与px相互转换的方法
 */

public class ScreenUtils {
    private ScreenUtils() {
        throw new AssertionError("ScreenUtils cannot be instantiated!");
    }

    public static int getScreenWidth(Context context) {
        if (context == null) {
            throw new NullPointerException("context cannot be null");
        }
        DisplayMetrics dm = context.getResources().getDisplayMetrics();
        return dm.widthPixels;
    }

    public static int getScreenHeight(Context context) {
        if (context == null) {
            throw new NullPointerException("context cannot be null");
        }
        DisplayMetrics dm = context.getResources().getDisplayMetrics();
        return dm.heightPixels;
    }

    public static int px2dp(Context context, float px) {
        float density = context.getResources().getDisplayMetrics().density;
        return (int) (px / density + 0.5f);
    }

    public static int dp2px(Context context, float dp) {
        float density = context.getResources().getDisplayMetrics().density;
        return (int) (dp * density + 0.5f);
    }

    public static int px2sp(Context context, float px) {
        float scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
        return (int) (px / scaledDensity + 0.5f);
    }

    public static int sp2px(Context context, float sp) {
        float scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
        return (int) (sp * scaledDensity + 0.5f);
    }
}

Add transformation between dp sp and px


/*
 *
 *  * Copyright 2013 - Elian ORIOU
 *  *
 *  * 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.
 *  *
 *  * 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.vino.domain;

public class WineCellar extends Entity {

    private String name;

    private String description;

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public WineCellar setDescription(final String description) {
        this.description = description;
        return this;
    }

    public WineCellar setName(final String name) {
        this.name = name;
        return this;
    }

    @Override
    public EntityType getType() {
        return EntityType.CELLAR;
    }

    @Override
    public String toString() {
        return "Cellar{" +
                "name='" + name + '\'' +
                ", description='" + description + '\'' +
                '}';
    }
}

/*
 *
 *  * Copyright 2013 - Elian ORIOU
 *  *
 *  * 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.
 *  *
 *  * 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.vino.domain;

public class WineCellar extends Entity {

    private String name;

    private String description;

    private String localization;

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public WineCellar setDescription(final String description) {
        this.description = description;
        return this;
    }

    public WineCellar setName(final String name) {
        this.name = name;
        return this;
    }

    public String getLocalization() {
        return localization;
    }

    public WineCellar setLocalization(final String localization) {
        this.localization = localization;
        return this;
    }

    @Override
    public String toString() {
        return "WineCellar{" +
                "name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", localization='" + localization + '\'' +
                '}';
    }

    @Override
    public EntityType getType() {
        return EntityType.CELLAR;
    }

}

Add localization on wine cellar


package jfdi.test.ui;

import static org.junit.Assert.assertEquals;

import jfdi.ui.Constants;

public class TestSearch extends UiTest {

    TestSearch(TestMain main) {
        super(main);
    }

    @Override
    void run() {
        testSingleSearchDone();
        testMultipleSearchDone();
    }

    /*
     * Test a simple "search" command with one single keyword
     */
    public void testSingleSearchDone() {

        main.addTask("test 1");
        main.addTask("testing 2");
        main.addTask("test 3");
        main.addTask("testing 4");
        main.addTask("test 2");
        main.addTask("testing 3");
        main.addTask("test 4");

        main.execute("search test");

        main.assertResponseMessage(String.format(Constants.CMD_SUCCESS_SEARCH_1, "[test]"));
        assertEquals(4, main.getImportantListSize());
    }

    /*
     * Test a simple "search" command with multiple keywords
     */
    public void testMultipleSearchDone() {

        main.execute("search testing 2");

        main.assertResponseMessage(String.format(Constants.CMD_SUCCESS_SEARCH_2, "2 and testing"));
        assertEquals(1, main.getImportantListSize());

        main.execute("search test testing 2");

        main.assertResponseMessage(String.format(Constants.CMD_SUCCESS_SEARCH_2, "2, test and testing"));
        assertEquals(0, main.getImportantListSize());
    }

}

package jfdi.test.ui;

import static org.junit.Assert.assertEquals;

import jfdi.ui.Constants;

public class TestSearch extends UiTest {

    TestSearch(TestMain main) {
        super(main);
    }

    @Override
    void run() {
        testSingleSearchDone();
        testMultipleSearchDone();
    }

    /*
     * Test a simple "search" command with one single keyword
     */
    public void testSingleSearchDone() {

        main.addTask("test 1");
        main.addTask("testing 2");
        main.addTask("test 3");
        main.addTask("testing 4");
        main.addTask("test 2");
        main.addTask("testing 3");
        main.addTask("test 4");

        main.execute("search test");

        main.assertResponseMessage(String.format(Constants.CMD_SUCCESS_SEARCH_1, "[test]"));
        assertEquals(4, main.getImportantListSize());
    }

    /*
     * Test a simple "search" command with multiple keywords
     */
    public void testMultipleSearchDone() {

        main.execute("search testing 2");

        main.assertResponseMessage(String.format(Constants.CMD_SUCCESS_SEARCH_2, "2 and testing"));
        assertEquals(4, main.getImportantListSize());

        main.execute("search test testing 2");

        main.assertResponseMessage(String.format(Constants.CMD_SUCCESS_SEARCH_2, "2, test and testing"));
        assertEquals(7, main.getImportantListSize());
    }

}

Update UI tests for the `SearchCommand`


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author gjoranv
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
        addDefaultSearchAccessLog();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("*://*/logs");
        addComponent(logHandler);
    }

}

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author gjoranv
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("*://*/logs");
        addComponent(logHandler);
    }

}

Revert "Add access log for logserver container "


package com.enderio.core.common.util;

import java.util.List;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public final class OreDictionaryHelper {

  public static final String INGOT_COPPER = "ingotCopper";
  public static final String INGOT_TIN = "ingotTin";
  public static final String DUST_ENDERPEARL = "dustEnderPearl";
  public static final String INGOT_ENDERIUM = "ingotEnderium";

  public static boolean isRegistered(String name) {
    if(!getOres(name).isEmpty()) {
      return true;
    }
    return false;
  }

  public static List<ItemStack> getOres(String name) {
    return OreDictionary.getOres(name);
  }

  public static boolean hasCopper() {
    return isRegistered(INGOT_COPPER);
  }

  public static boolean hasTin() {
    return isRegistered(INGOT_TIN);
  }

  public static boolean hasEnderPearlDust() {
    return isRegistered(DUST_ENDERPEARL);
  }

  private OreDictionaryHelper() {
  }

  public static boolean hasEnderium() {
    return isRegistered(INGOT_ENDERIUM);
  }

}

package com.enderio.core.common.util;

import java.util.List;

import org.apache.commons.lang3.ArrayUtils;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public final class OreDictionaryHelper {

  public static final String INGOT_COPPER = "ingotCopper";
  public static final String INGOT_TIN = "ingotTin";
  public static final String DUST_ENDERPEARL = "dustEnderPearl";
  public static final String INGOT_ENDERIUM = "ingotEnderium";

  public static boolean isRegistered(String name) {
    if (!getOres(name).isEmpty()) {
      return true;
    }
    return false;
  }

  public static List<ItemStack> getOres(String name) {
    return OreDictionary.getOres(name);
  }

  public static boolean hasCopper() {
    return isRegistered(INGOT_COPPER);
  }

  public static boolean hasTin() {
    return isRegistered(INGOT_TIN);
  }

  public static boolean hasEnderPearlDust() {
    return isRegistered(DUST_ENDERPEARL);
  }

  private OreDictionaryHelper() {
  }

  public static boolean hasEnderium() {
    return isRegistered(INGOT_ENDERIUM);
  }

  public static String[] getOreNames(ItemStack stack) {
    int[] ids = OreDictionary.getOreIDs(stack);
    String[] ret = new String[ids.length];
    for (int i = 0; i < ids.length; i++) {
      ret[i] = OreDictionary.getOreName(ids[i]);
    }
    return ret;
  }

  public static boolean hasName(ItemStack stack, String oreName) {
    return ArrayUtils.contains(getOreNames(stack), oreName);
  }

}

Add some new OreDictionary helpers


package com.sajo.teamkerbell.repository;

import com.sajo.teamkerbell.entity.FileDB;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
 * Created by seongahjo on 2016. 7. 2..
 */
@Repository
public interface FileDBRepository extends JpaRepository<FileDB, Integer> {
    FileDB findByStoredName(String storedName);
}

package com.sajo.teamkerbell.repository;

import com.sajo.teamkerbell.entity.FileDB;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by seongahjo on 2016. 7. 2..
 */
@Repository
public interface FileDBRepository extends JpaRepository<FileDB, Integer> {
    FileDB findByStoredName(String storedName);

    List<FileDB> findByProjectId(Integer projectId, Pageable pageable);

    List<FileDB> findByProjectIdAndFileType(Integer projectId, FileDB.FileType fileType, Pageable pageable);
}

Add find files, images in repository


package org.gwtbootstrap3.extras.slider.client.ui;

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

import org.gwtbootstrap3.extras.slider.client.ui.base.SliderBase;

/**
 * @author Grant Slender
 */
public class Slider extends SliderBase {

    public Slider(float min, float max, float value) {
        super();
        setMin(min);
        setMax(max);
        setValue(value);
    }

    public Slider(int min, int max, int value) {
        this((float)min,(float)max,(float)value);
    }
}

package org.gwtbootstrap3.extras.slider.client.ui;

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

import org.gwtbootstrap3.extras.slider.client.ui.base.SliderBase;

/**
 * @author Grant Slender
 */
public class Slider extends SliderBase {

    public Slider() {
        super();
    }

    public Slider(float min, float max, float value) {
        super();
        setMin(min);
        setMax(max);
        setValue(value);
    }

    public Slider(int min, int max, int value) {
        this((float)min,(float)max,(float)value);
    }
}

Fix for zero arg constructor


package sg.ncl.service.registration.controllers;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import sg.ncl.service.registration.RegistrationService;
import sg.ncl.service.registration.dtos.RegistrationInfo;

import javax.inject.Inject;

/**
 * @author Te Ye & Desmond
 */
@RestController
@RequestMapping(path = "/registrations", produces = MediaType.APPLICATION_JSON_VALUE)
public class RegistrationController {

    private final RegistrationService registrationService;

    @Inject
    protected RegistrationController(final RegistrationService registrationService) {
        this.registrationService = registrationService;
    }

    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    public void register(@RequestBody RegistrationInfo registrationInfo) {
        registrationService.register(registrationInfo.getCredentials(), registrationInfo.getUser(), registrationInfo.getTeam(), registrationInfo.getIsJoinTeam());
    }
}

package sg.ncl.service.registration.controllers;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import sg.ncl.service.registration.RegistrationService;
import sg.ncl.service.registration.dtos.RegistrationData;
import sg.ncl.service.registration.dtos.RegistrationInfo;

import javax.inject.Inject;

/**
 * @author Te Ye & Desmond
 */
@RestController
@RequestMapping(path = "/registrations", produces = MediaType.APPLICATION_JSON_VALUE)
public class RegistrationController {

    private final RegistrationService registrationService;

    @Inject
    protected RegistrationController(final RegistrationService registrationService) {
        this.registrationService = registrationService;
    }

    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    public void register(@RequestBody RegistrationInfo registrationInfo) {
//        System.out.println("User: " + registrationInfo.getUser());
//        System.out.println("Team: " + registrationInfo.getTeam());
//        System.out.println("Registration: " + registrationInfo.getRegistration());
        if (registrationInfo.getIsJoinTeam())
        registrationService.register(registrationInfo.getCredentials(), registrationInfo.getUser(), registrationInfo.getTeam(), registrationInfo.getIsJoinTeam());
    }
}

Revert "remove line to apply for new team"


/*
 * Copyright 2022 Google LLC
 * Copyright 2013-2021 CompilerWorks
 *
 * 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.edwmigration.dumper.application.dumper.connector;

/**
 *
 * @author shevek
 */
public interface LogsConnector extends Connector {

    @Override
    default public String getDefaultFileName() {
        return "dwh-migration-" + getName() + ".zip";
    }
}

/*
 * Copyright 2022 Google LLC
 * Copyright 2013-2021 CompilerWorks
 *
 * 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.edwmigration.dumper.application.dumper.connector;

/**
 *
 * @author shevek
 */
public interface LogsConnector extends Connector {

    @Override
    default public String getDefaultFileName() {
        return "dwh-migration-" + getName() + "-logs.zip";
    }
}

Add `-logs` suffix to default log archive file name


package edu.cmu.sv.trailscribe.tests;

import android.test.ActivityInstrumentationTestCase2;
import edu.cmu.sv.trailscribe.view.SynchronizationCenterActivity;
import edu.cmu.sv.trailscribe.R;
import android.widget.ListView;

public class SynchronizationCenterActivityTest extends ActivityInstrumentationTestCase2<SynchronizationCenterActivity> {
    private SynchronizationCenterActivity syncActivity;

    public SynchronizationCenterActivityTest() {
        super("edu.cmu.sv.trailscribe", SynchronizationCenterActivity.class);
    }

    @Override
    public void setUp() throws Exception {
        super.setUp();

        syncActivity = getActivity();
    }

    public void testPreconditions() {
        assertNotNull("Sync activity not found", syncActivity);
    }

}

package edu.cmu.sv.trailscribe.tests;

import android.test.ActivityInstrumentationTestCase2;
import edu.cmu.sv.trailscribe.view.SynchronizationCenterActivity;
import edu.cmu.sv.trailscribe.R;
import android.widget.ListView;
import java.util.concurrent.TimeUnit;
import android.database.DataSetObserver;
import java.util.concurrent.CountDownLatch;
import android.widget.ArrayAdapter;
import edu.cmu.sv.trailscribe.model.Map;
import android.util.Log;

public class SynchronizationCenterActivityTest extends ActivityInstrumentationTestCase2<SynchronizationCenterActivity> {
    private static final String LOG_TAG = "SynchronizationCenterActivityTest";
    private static final long MAP_LIST_FETCH_TIMEOUT = 50L;
    private SynchronizationCenterActivity syncActivity;

    public SynchronizationCenterActivityTest() {
        super("edu.cmu.sv.trailscribe", SynchronizationCenterActivity.class);
    }

    @Override
    public void setUp() throws Exception {
        super.setUp();

        syncActivity = getActivity();
    }

    public void testPreconditions() {
        assertNotNull("Sync activity not found", syncActivity);
    }

    public void testMapList_fetchMaps() {
        if (syncActivity.areMapsFetched()) {
            Log.d(LOG_TAG, "Map data has already been fetched");
            return;
        }
        final CountDownLatch done = new CountDownLatch(1);
        syncActivity.setMapsFetchedCallback(new Runnable() {
                @Override
                public void run() {
                    done.countDown();
                }
            });
        try {
            final boolean result = done.await(MAP_LIST_FETCH_TIMEOUT, TimeUnit.SECONDS);
            assertTrue("Fetching map list took loo long", result);
        } catch (InterruptedException e) {
            fail("Map fetching interrupted");
        }
    }
}

Add test for map fetching in sync center


/*
 * Copyright © 2013 Sebastian Hoß <mail@shoss.de>
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
 */
package com.github.sebhoss.nullanalysis;

import javax.annotation.Nullable;

/**
 * Utility classes which helps working with legacy (nullable) APIs.
 */
public final class Nullsafe {

    /**
     * @param reference
     *            A possible null reference.
     * @return Either the reference itself, or an {@link NullPointerException}, in case the reference was
     *         null.
     */
    public static <T> T nullsafe(@Nullable final T reference) {
        if (reference != null) {
            return reference;
        }

        throw new NullPointerException(); // NOPMD - we want to throw NPE here
    }

    /**
     * @param reference
     *            A possible null reference.
     * @param message
     *            The exception message to throw.
     * @return Either the reference itself, or an {@link NullPointerException}, in case the reference was
     *         null.
     */
    public static <T> T nullsafe(@Nullable final T reference, final String message) {
        if (reference != null) {
            return reference;
        }

        throw new NullPointerException(message); // NOPMD - we want to throw NPE here
    }

    private Nullsafe() {
        // utility class
    }

}

/*
 * Copyright © 2013 Sebastian Hoß <mail@shoss.de>
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
 */
package com.github.sebhoss.nullanalysis;

import javax.annotation.Nullable;

/**
 * Utility classes which helps working with legacy (nullable) APIs.
 */
public final class Nullsafe {

    private Nullsafe() {
        // utility class
    }

    /**
     * @param reference
     *            A possible null reference.
     * @return Either the reference itself, or an {@link NullPointerException}, in case the reference was
     *         null.
     */
    public static <T> T nullsafe(final @Nullable T reference) {
        if (reference != null) {
            return reference;
        }

        throw new NullPointerException(); // NOPMD - we want to throw NPE here
    }

    /**
     * @param reference
     *            A possible null reference.
     * @param message
     *            The exception message to throw.
     * @return Either the reference itself, or an {@link NullPointerException}, in case the reference was
     *         null.
     */
    public static <T> T nullsafe(final @Nullable T reference, final String message) {
        if (reference != null) {
            return reference;
        }

        throw new NullPointerException(message); // NOPMD - we want to throw NPE here
    }

}

Move annotation type information before final keyword


package net.teamio.taam.content;

import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.MaterialTransparent;

public class MaterialMachinesTransparent extends MaterialTransparent {
	public static final MaterialMachinesTransparent INSTANCE = new MaterialMachinesTransparent(MapColor.ironColor);

	public MaterialMachinesTransparent(MapColor color) {
		super(color);
		this.setRequiresTool();
	}

    @Override
    public boolean isSolid()
    {
        return false;
    }

	@Override
	public boolean blocksLight() {
		return false;
	}

    @Override
    public boolean blocksMovement()
    {
        return false;
    }

    @Override
    public boolean isOpaque() {
    	return false;
    }
}

package net.teamio.taam.content;

import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;

public class MaterialMachinesTransparent extends Material {
	public static final MaterialMachinesTransparent INSTANCE = new MaterialMachinesTransparent(MapColor.ironColor);

	public MaterialMachinesTransparent(MapColor color) {
		super(color);
		this.setRequiresTool();
	}

    @Override
    public boolean isSolid()
    {
        return false;
    }

	@Override
	public boolean blocksLight() {
		return false;
	}

    @Override
    public boolean blocksMovement()
    {
        return false;
    }

    @Override
    public boolean isOpaque() {
    	return false;
    }
}

Fix machines material being replaceable


package squeek.spiceoflife.asm;

import java.util.Map;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;

public class ASMPlugin implements IFMLLoadingPlugin
{
	@Override
	public String[] getASMTransformerClass()
	{
		return new String[]{ClassTransformer.class.getName()};
	}

	@Override
	public String getModContainerClass()
	{
		return null;
	}

	@Override
	public String getSetupClass()
	{
		return null;
	}

	@Override
	public void injectData(Map<String, Object> data)
	{
	}
}

package squeek.spiceoflife.asm;

import java.util.Map;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;

@TransformerExclusions("squeek.spiceoflife.asm")
public class ASMPlugin implements IFMLLoadingPlugin
{
	@Override
	public String[] getASMTransformerClass()
	{
		return new String[]{ClassTransformer.class.getName()};
	}

	@Override
	public String getModContainerClass()
	{
		return null;
	}

	@Override
	public String getSetupClass()
	{
		return null;
	}

	@Override
	public void injectData(Map<String, Object> data)
	{
	}
}

Exclude the ASM package from being transformed


package com.nhl.link.move;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import java.util.Collections;
import java.util.Map;

import org.junit.Test;

import com.nhl.link.move.Execution;

public class ExecutionTest {

	@Test
	public void testCreateReport() {

		Execution execution = new Execution("xsync", Collections.singletonMap("a", 5));

		Map<String, Object> r1 = execution.createReport();
		assertEquals("xsync", r1.get("Task"));
		assertEquals(5, r1.get("Parameter[a]"));
		assertEquals(r1.toString(), 7, r1.size());
		assertEquals("in progress", r1.get("Status"));

		execution.close();

		Map<String, Object> r2 = execution.createReport();
		assertEquals(r2.toString(), 7, r2.size());
		assertEquals("finished", r2.get("Status"));
	}

	@Test
	public void testAttribute() {
		try (Execution execution = new Execution("xsync", Collections.<String, Object> emptyMap())) {
			assertNull(execution.getAttribute("a"));

			execution.setAttribute("a", "MMM");
			assertEquals("MMM", execution.getAttribute("a"));

			execution.setAttribute("a", null);
			assertNull(execution.getAttribute("a"));
		}
	}
}

package com.nhl.link.move;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import java.util.Collections;
import java.util.Map;

import org.junit.Test;

import com.nhl.link.move.Execution;

public class ExecutionTest {

	@Test
	public void testCreateReport() {

		Execution execution = new Execution("xsync", Collections.singletonMap("a", 5));

		Map<String, Object> r1 = execution.createReport();
		assertEquals("xsync", r1.get("Task"));
		assertEquals(5, r1.get("Parameter[a]"));
		assertEquals(r1.toString(), 8, r1.size());
		assertEquals("in progress", r1.get("Status"));

		execution.close();

		Map<String, Object> r2 = execution.createReport();
		assertEquals(r2.toString(), 8, r2.size());
		assertEquals("finished", r2.get("Status"));
	}

	@Test
	public void testAttribute() {
		try (Execution execution = new Execution("xsync", Collections.<String, Object> emptyMap())) {
			assertNull(execution.getAttribute("a"));

			execution.setAttribute("a", "MMM");
			assertEquals("MMM", execution.getAttribute("a"));

			execution.setAttribute("a", null);
			assertNull(execution.getAttribute("a"));
		}
	}
}

Include deleted count into report


package com.phicdy.totoanticipation.model.scheduler;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.util.Log;

import java.util.Calendar;
import java.util.Date;

public class DeadlineAlarm {

    private final Context context;
    static final String ACTION = "deadlineAlarm";

    public DeadlineAlarm(@NonNull Context context) {
        this.context = context;
    }

    public void set5hoursBefore(@NonNull Date deadline) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(deadline);
        calendar.add(Calendar.HOUR_OF_DAY, -5);
        AlarmManager alm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        Log.d("Toto alarm", "Set alarm : " + deadline.toString());
        alm.set(AlarmManager.RTC_WAKEUP, deadline.getTime(), generateIntent());
    }

    public void cancel() {
        AlarmManager alm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        alm.cancel(generateIntent());
    }

    private PendingIntent generateIntent() {
        Intent i = new Intent(context, DeadlineAlarmReceiver.class);
        i.setAction(ACTION);
        return PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
    }
}

package com.phicdy.totoanticipation.model.scheduler;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.util.Log;

import java.util.Calendar;
import java.util.Date;

public class DeadlineAlarm {

    private final Context context;
    static final String ACTION = "deadlineAlarm";

    public DeadlineAlarm(@NonNull Context context) {
        this.context = context;
    }

    public void set5hoursBefore(@NonNull Date deadline) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(deadline);
        calendar.add(Calendar.HOUR_OF_DAY, -5);
        AlarmManager alm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        Log.d("Toto alarm", "Set alarm : " + calendar.getTime().toString());
        alm.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), generateIntent());
    }

    public void cancel() {
        AlarmManager alm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        alm.cancel(generateIntent());
    }

    private PendingIntent generateIntent() {
        Intent i = new Intent(context, DeadlineAlarmReceiver.class);
        i.setAction(ACTION);
        return PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
    }
}

Fix the bug that calendar was not used for alarm


package com.coatedmoose.daggerizedandroid;

import android.app.Application;

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

import dagger.ObjectGraph;

/**
 * Extend this class to have your application inject off of its graph
 */
public class DaggerApplication extends Application implements Injector, GraphHolder {
    private ObjectGraph applicationGraph;

    @Override
    public void onCreate() {
        super.onCreate();

        applicationGraph = createObjectGraph(ObjectGraph.create());
        inject(this);
    }

    @Override
    public <T> T inject(T o) {
        if (applicationGraph == null) {
            throw new IllegalStateException("Application object graph needs to be initialized before calling inject");
        }
        return applicationGraph.inject(o);
    }

    @Override
    public <T> T get(Class<T> classType) {
        return applicationGraph.get(classType);
    }

    @Override
    public List<Object> getModules() {
        List<Object> modules = new ArrayList<>();
        modules.add(new ApplicationModule(this));
        return modules;
    }

    @Override
    public ObjectGraph createObjectGraph(ObjectGraph parentGraph) {
        return applicationGraph.plus(getModules().toArray());
    }

    @Override
    public ObjectGraph getObjectGraph() {
        return applicationGraph;
    }
}

package com.coatedmoose.daggerizedandroid;

import android.app.Application;

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

import dagger.ObjectGraph;

/**
 * Extend this class to have your application inject off of its graph
 */
public class DaggerApplication extends Application implements Injector, GraphHolder {
    private ObjectGraph applicationGraph;

    @Override
    public void onCreate() {
        super.onCreate();

        applicationGraph = createObjectGraph(ObjectGraph.create());
        inject(this);
    }

    @Override
    public <T> T inject(T o) {
        if (applicationGraph == null) {
            throw new IllegalStateException("Application object graph needs to be initialized before calling inject");
        }
        return applicationGraph.inject(o);
    }

    @Override
    public <T> T get(Class<T> classType) {
        return applicationGraph.get(classType);
    }

    @Override
    public List<Object> getModules() {
        List<Object> modules = new ArrayList<>();
        modules.add(new ApplicationModule(this));
        return modules;
    }

    @Override
    public ObjectGraph createObjectGraph(ObjectGraph parentGraph) {
        return parentGraph.plus(getModules().toArray());
    }

    @Override
    public ObjectGraph getObjectGraph() {
        return applicationGraph;
    }
}

Use given parent graph, not stored one.


/*
 * (c) 2015 CenturyLink. 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.centurylink.cloud.sdk.tests.mocks;

import com.centurylink.cloud.sdk.tests.TestModule;
import org.mockito.Spy;

import java.lang.reflect.Field;
import java.util.stream.Stream;

/**
 * @author Ilya Drabenia
 */
public class BindSpiesModule extends TestModule {
    private final Object target;

    public BindSpiesModule(Object target) {
        this.target = target;
    }

    @Override
    protected void configure() {
        overrideSpyBinding();
    }

    private void overrideSpyBinding() {
        Stream
            .of(declaredFields())
            .filter(f -> f.isAnnotationPresent(Spy.class))
            .forEach(f -> bind(f.getType())
                .toProvider(new SpyProvider<>(f.getType()))
        );
    }

    private Field[] declaredFields() {
        return target
            .getClass()
            .getDeclaredFields();
    }

}

/*
 * (c) 2015 CenturyLink. 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.centurylink.cloud.sdk.tests.mocks;

import com.centurylink.cloud.sdk.tests.TestModule;
import org.mockito.Spy;

import java.lang.reflect.Field;
import java.util.stream.Stream;

/**
 * @author Ilya Drabenia
 */
public class BindSpiesModule extends TestModule {
    private final Object target;

    public BindSpiesModule(Object target) {
        this.target = target;
    }

    @Override
    protected void configure() {
        overrideSpyBinding();
    }

    private void overrideSpyBinding() {
        Stream
            .of(declaredFields())
            .filter(f -> f.isAnnotationPresent(Spy.class))
            .forEach(f ->
                bind(f.getType()).toProvider(new SpyProvider(f.getType())
            )
        );
    }

    private Field[] declaredFields() {
        return target
            .getClass()
            .getDeclaredFields();
    }

}

Fix compilation issue on not latest JDKs


package eu.datacron.insitu;

import org.apache.flink.api.common.functions.MapFunction;

import eu.datacron.insitu.maritime.AisMessage;

/**
 * A map operator of AIS messages to CSV format
 *
 * @author ehab.qadah
 *
 */
public class AisMessagesToCsvMapper implements MapFunction<AisMessage, String> {

  private static final long serialVersionUID = 5306666449608883748L;
  private String delimiter;

  public AisMessagesToCsvMapper() {}

  public AisMessagesToCsvMapper(String outputLineDelimiter) {
    this.delimiter = outputLineDelimiter;
  }

  @Override
  public String map(AisMessage value) throws Exception {

    return value.toCsv(delimiter, true);
  }
}

package eu.datacron.insitu;

import org.apache.flink.api.common.functions.MapFunction;

import eu.datacron.insitu.maritime.AisMessage;

/**
 * A map operator of AIS messages to CSV format
 *
 * @author ehab.qadah
 *
 */
public class AisMessagesToCsvMapper implements MapFunction<AisMessage, String> {

  private static final long serialVersionUID = 5306666449608883748L;
  private String delimiter;

  public AisMessagesToCsvMapper() {}

  public AisMessagesToCsvMapper(String outputLineDelimiter) {
    this.delimiter = outputLineDelimiter;
  }

  @Override
  public String map(AisMessage value) throws Exception {

    return value.toCsv(delimiter, false);
  }
}

Remove extra line in csv output


package com.sheepdog.mashmesh.debug;

import com.googlecode.objectify.Objectify;
import com.sheepdog.mashmesh.models.OfyService;
import com.sheepdog.mashmesh.models.RideRecord;
import com.sheepdog.mashmesh.models.UserProfile;
import com.sheepdog.mashmesh.models.VolunteerProfile;

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

public class ResetDatastoreServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        Objectify ofy = OfyService.ofy();

        ofy.delete(ofy.query(UserProfile.class).chunkSize(100));
        ofy.delete(ofy.query(VolunteerProfile.class).chunkSize(100));
        ofy.delete(ofy.query(RideRecord.class).chunkSize(100));

        int documentsDeleted = VolunteerProfile.clearIndex();

        resp.setContentType("text/plain");
        resp.getWriter().println(documentsDeleted + " text search documents deleted");
        resp.getWriter().println("OK");
    }
}

package com.sheepdog.mashmesh.debug;

import com.googlecode.objectify.Objectify;
import com.sheepdog.mashmesh.models.*;

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

public class ResetDatastoreServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        Objectify ofy = OfyService.ofy();

        ofy.delete(ofy.query(UserProfile.class).chunkSize(100));
        ofy.delete(ofy.query(VolunteerProfile.class).chunkSize(100));
        ofy.delete(ofy.query(RideRecord.class).chunkSize(100));
        ofy.delete(ofy.query(RideRequest.class).chunkSize(100));

        int documentsDeleted = VolunteerProfile.clearIndex();

        resp.setContentType("text/plain");
        resp.getWriter().println(documentsDeleted + " text search documents deleted");
        resp.getWriter().println("OK");
    }
}

Make the reset datastore servlet clear ride requests


package router.client.location;

public class TestRegExp
  extends RegExp
{
  private String[] _results;

  public TestRegExp()
  {
    super( new Object() );
  }

  public void setResults( final String[] results )
  {
    _results = results;
  }

  @Override
  public String[] exec( final Object str )
  {
    return _results;
  }
}

package router.client.location;

import javax.annotation.Nonnull;

public class TestRegExp
  extends RegExp
{
  private String[] _resultGroups;

  public TestRegExp( @Nonnull final String[] resultGroups )
  {
    this();
    setResultGroups( resultGroups );
  }

  public TestRegExp()
  {
    super( new Object() );
  }

  public void setResultGroups( final String[] resultGroups )
  {
    _resultGroups = resultGroups;
  }

  @Override
  public String[] exec( final Object str )
  {
    return _resultGroups;
  }
}

Rename the match results so the intent is clearer


package org.intellij.lang.jflex.fileTypes;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import org.jetbrains.annotations.NotNull;

/**
 * JFlex file type factory, tells IDEA about new file type
 *
 * @author Jan Dolecek
 */
public final class JFlexFileTypeFactory extends FileTypeFactory {
    @Override
    public void createFileTypes(@NotNull FileTypeConsumer consumer) {
        consumer.consume(JFlexFileType.FILE_TYPE, JFlexFileType.DEFAULT_EXTENSION);
    }
}

package org.intellij.lang.jflex.fileTypes;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import org.jetbrains.annotations.NotNull;

/**
 * JFlex file type factory, tells IDEA about new file type
 *
 * @author Jan Dolecek
 */
public final class JFlexFileTypeFactory extends FileTypeFactory {
    @Override
    public void createFileTypes(@NotNull FileTypeConsumer consumer) {
        consumer.consume(JFlexFileType.FILE_TYPE, "flex;jflex");
    }
}

Add .jflex as a supported file extension (in addition to .flex).


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

import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class ApiControllerTests {

}

package com.stefanengineering.api;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class ApiControllerTests {

    @Autowired
    private MockMvc mockMvc;

    @Test
    public void usersShouldBeOkAndJson() throws Exception {

        this.mockMvc.perform(get("/api/users")).andDo(print()).andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8));

    }
}

Test if /users route is 200 and is json


package org.eclipse.birt.report.data.adapter.api;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.eclipse.birt.report.model.api.ReportItemHandle;

public class LinkedDataSetUtil
{
	private static String GET_LINKED_DATA_MODEL_METHOD = "getLinkedDataModel";

	public static boolean bindToLinkedDataSet( ReportItemHandle reportItemHandle )
			throws IllegalArgumentException, IllegalAccessException,
			InvocationTargetException
	{
		Method[] methods = reportItemHandle.getClass( ).getMethods( );
		for ( int i = 0; i < methods.length; i++ )
		{
			String name = methods[i].getName( );
			if ( name.equals( GET_LINKED_DATA_MODEL_METHOD ) )
			{
				Object result = methods[i].invoke( reportItemHandle );
				if ( result != null )
					return true;
			}
		}
		return false;
	}
}

package org.eclipse.birt.report.data.adapter.api;

import java.lang.reflect.Method;

import org.eclipse.birt.report.model.api.ReportItemHandle;

public class LinkedDataSetUtil
{
	private static String GET_LINKED_DATA_MODEL_METHOD = "getLinkedDataModel";

	public static boolean bindToLinkedDataSet( ReportItemHandle reportItemHandle )
	{
		Method[] methods = reportItemHandle.getClass( ).getMethods( );
		for ( int i = 0; i < methods.length; i++ )
		{
			String name = methods[i].getName( );
			if ( name.equals( GET_LINKED_DATA_MODEL_METHOD ) )
			{
				Object result = null ;
				try
				{
					result = methods[i].invoke( reportItemHandle );
				}
				catch ( Exception e )
				{
					return false;
				}
				if ( result != null )
					return true;
			}
		}
		return false;
	}
}

Remove the exception lists from the API which judges whether a ReportItemHandle binds to a Linked Data Set


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

import wicket.MarkupContainer;

/**
 * To be implemented by MarkupContainers which wish to implement their own
 * algorithms for the markup cache key.
 *
 * @author Juergen Donnerstag
 */
public interface IMarkupCacheKeyProvider
{
	/**
	 * Provide the markup cache key for the associated Markup resource stream.
	 *
	 * @see IMarkupResourceStreamProvider
	 *
	 * @param container
	 *            The MarkupContainer object requesting the markup cache key
	 * @param containerClass
	 *            The container the markup should be associated with
	 * @return A IResourceStream if the resource was found
	 */
	CharSequence getCacheKey(final MarkupContainer container, Class containerClass);
}

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

import wicket.MarkupContainer;

/**
 * To be implemented by MarkupContainers that wish to implement their own
 * algorithms for the markup cache key.
 *
 * @author Juergen Donnerstag
 */
public interface IMarkupCacheKeyProvider
{
	/**
	 * Provide the markup cache key for the associated Markup resource stream.
	 *
	 * @see IMarkupResourceStreamProvider
	 *
	 * @param container
	 *            The MarkupContainer object requesting the markup cache key
	 * @param containerClass
	 *            The container the markup should be associated with
	 * @return A IResourceStream if the resource was found
	 */
	CharSequence getCacheKey(final MarkupContainer container, Class containerClass);
}

Improve Javadoc (was: typo and typo 2)


package fibonacci;

public class Fibonacci
{
  public static int fibonacci(int n)
  {
    if (n < 2)
      return n;

    return fibonacci(n - 1) + fibonacci(n - 2);
  }

  public static void main(String[] args)
  {
    if (args.length > 0)
    {
      try
      {
        int n = Integer.parseInt(args[0]);

        System.out.println(fibonacci(n));
      }
      catch (NumberFormatException e)
      {
        System.err.printf("Given argument (%s) is not a number!", args[0]);
      }
    }
  }
}

package fibonacci;

public class Fibonacci
{
  public static long fibonacci(long n)
  {
    if (n < 2)
      return n;

    return fibonacci(n - 1) + fibonacci(n - 2);
  }

  public static void main(String[] args)
  {
    if (args.length > 0)
    {
      try
      {
        long n = Long.parseLong(args[0]);

        System.out.println(fibonacci(n));
      }
      catch (NumberFormatException e)
      {
        System.err.printf("Given argument (%s) is not a number!", args[0]);
      }
    }
  }
}

Change from int to long to allow for bigger numbers


/*
 * Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.usu.sdl.openstorefront.service.io.reader;

import edu.usu.sdl.openstorefront.common.exception.OpenStorefrontRuntimeException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class CSVReader
		extends GenericReader<String[]>
{

	private au.com.bytecode.opencsv.CSVReader reader;

	public CSVReader(InputStream in)
	{
		super(in);
		reader = new au.com.bytecode.opencsv.CSVReader(new InputStreamReader(in));
	}

	@Override
	public String[] nextRecord()
	{
		try {
			return reader.readNext();
		} catch (IOException ex) {
			throw new OpenStorefrontRuntimeException(ex);
		}
	}

}

/*
 * Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.usu.sdl.openstorefront.service.io.reader;

import edu.usu.sdl.openstorefront.common.exception.OpenStorefrontRuntimeException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class CSVReader
		extends GenericReader<String[]>
{

	private au.com.bytecode.opencsv.CSVReader reader;

	public CSVReader(InputStream in)
	{
		super(in);
		reader = new au.com.bytecode.opencsv.CSVReader(new InputStreamReader(in));
	}

	@Override
	public String[] nextRecord()
	{
		try {
			currentRecordNumber++;
			return reader.readNext();
		} catch (IOException ex) {
			throw new OpenStorefrontRuntimeException(ex);
		}
	}

}

Fix for attribute import statistics


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

package org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser;

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.plugins.parser.ParserSettings;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
import org.apache.ivy.plugins.repository.Resource;

import java.io.IOException;
import java.net.URL;
import java.text.ParseException;

public class DownloadedIvyModuleDescriptorParser extends XmlModuleDescriptorParser {
    @Override
    public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL xmlURL, Resource res, boolean validate) throws ParseException, IOException {
        DefaultModuleDescriptor descriptor = (DefaultModuleDescriptor) super.parseDescriptor(ivySettings, xmlURL, res, validate);
        descriptor.setDefault(false);
        return descriptor;
    }
}

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

package org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser;

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.plugins.parser.ParserSettings;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
import org.apache.ivy.plugins.repository.Resource;

import java.io.IOException;
import java.net.URL;
import java.text.ParseException;

public class DownloadedIvyModuleDescriptorParser extends XmlModuleDescriptorParser {
    @Override
    synchronized public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL xmlURL, Resource res, boolean validate) throws ParseException, IOException {
        DefaultModuleDescriptor descriptor = (DefaultModuleDescriptor) super.parseDescriptor(ivySettings, xmlURL, res, validate);
        descriptor.setDefault(false);
        return descriptor;
    }
}

Add quickfix for fixing this enough for 1.3.


package com.edinarobotics.zeke.commands;

import com.edinarobotics.zeke.subsystems.Collector;
import com.edinarobotics.zeke.subsystems.Shooter;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.StartCommand;

public class ShootingSequenceCommand extends CommandGroup {

    public ShootingSequenceCommand(boolean lowerAfterShoot) {
        this.setInterruptible(false);
        this.addSequential(new SetCollectorCommand(Collector.CollectorState.RETRACTED,
                Collector.CollectorWheelState.STOPPED));
        this.addSequential(new WaitForCollectorUndeployedCommand());
        this.addSequential(new SetShooterCommand(Shooter.WinchState.FREE));
        if(lowerAfterShoot) {
            this.addSequential(new StartCommand(new LowerShooterAfterWaitCommand()));
        }
    }
}

package com.edinarobotics.zeke.commands;

import com.edinarobotics.zeke.subsystems.Collector;
import com.edinarobotics.zeke.subsystems.Shooter;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.StartCommand;

public class ShootingSequenceCommand extends CommandGroup {

    public ShootingSequenceCommand(boolean lowerAfterShoot) {
        this.setInterruptible(false);
        this.addSequential(new SetCollectorCommand(Collector.CollectorState.RETRACTED,
                Collector.CollectorWheelState.STOPPED));
        this.addSequential(new WaitForCollectorUndeployedCommand());
        this.addSequential(new SetShooterCommand(Shooter.WinchState.FREE));
        if(lowerAfterShoot) {
            this.addSequential(new StartCommand(new LowerShooterAfterWaitCommand(3)));
        }
    }
}

Set Autonomous to maintain its 3 second delay for shooter lowering.


package org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.abruptions;

import org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.StatefulControlFlowException;

public final class AbortedEvaluationException extends StatefulControlFlowException {

	/**
	 *
	 */
	private static final long serialVersionUID = -283186208089661555L;

	public AbortedEvaluationException(Object thrown, Object[] components) {
		super(thrown, components);
	}

}

package org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.abruptions;

import org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.StatefulControlFlowException;

public final class AbortedEvaluationException extends StatefulControlFlowException {

	/**
	 *
	 */
	private static final long serialVersionUID = -283186208089661555L;

	public AbortedEvaluationException(Object thrown, Object[] components) {
		super(thrown, components);
	}

	@Override
	public String getMessage() {
		return "Aborted evaluation: " + getThrown().toString();
	}

}

Implement getMessage for exception trap (to allow error to be presented to user if no handler applies)


/*
 * Copyright 2020 MD Sayem Ahmed
 *
 * 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.sayemahmed.example.springboot;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HealthController {

  @GetMapping("/health")
  public String health() {
    return "up";
  }
}

/*
 * Copyright 2020 MD Sayem Ahmed
 *
 * 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.sayemahmed.example.springboot;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HealthController {

  @GetMapping("/health")
  public String health() {
    return "up";
  }

  @GetMapping("/slower-health")
  public String slowHealth() throws InterruptedException {
    Thread.sleep(5_000L);
    return "up";
  }

  @GetMapping("/slowest-health")
  public String slowestHealth() throws InterruptedException {
    Thread.sleep(20_000L);
    return "up";
  }
}

Add slower and slowest health endpoint


package us.kbase.auth2.lib.exceptions;

/** Thrown when a username and password do not match.
 * @author gaprice@lbl.gov
 */
@SuppressWarnings("serial")
public class PasswordMismatchException extends UnauthorizedException {

	public PasswordMismatchException(final String message) {
		super(ErrorType.PASSWORD_MISMATCH, message);
	}
}

package us.kbase.auth2.lib.exceptions;

/** Thrown when a username and password do not match.
 * @author gaprice@lbl.gov
 */
@SuppressWarnings("serial")
public class PasswordMismatchException extends AuthenticationException {

	public PasswordMismatchException(final String message) {
		super(ErrorType.PASSWORD_MISMATCH, message);
	}
}

Make password login errors 401s vs 403s


package org.rcsb.mmtf.serialization;

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

import org.msgpack.jackson.dataformat.MessagePackFactory;
import org.rcsb.mmtf.dataholders.MmtfStructure;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * A message pack implementation of the {@link MmtfStructure} serializer / deserializer.
 * @author Anthony Bradley
 *
 */
public class MessagePackSerialization implements MmtfStructureSerializationInterface {

	@Override
	public MmtfStructure deserialize(InputStream inputStream){
		MmtfStructure mmtfBean = null;
		try {
			mmtfBean = new ObjectMapper(new MessagePackFactory()).readValue(inputStream, MmtfStructure.class);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return mmtfBean;
	}

	@Override
	public void serialize(MmtfStructure mmtfStructure, OutputStream outputStream) {
		ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
		objectMapper.setSerializationInclusion(Include.NON_NULL);
		try {
			objectMapper.writeValue(outputStream, mmtfStructure);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

package org.rcsb.mmtf.serialization;

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

import org.msgpack.jackson.dataformat.MessagePackFactory;
import org.rcsb.mmtf.dataholders.MmtfStructure;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * A message pack implementation of the {@link MmtfStructure} serializer / deserializer.
 * @author Anthony Bradley
 *
 */
public class MessagePackSerialization implements MmtfStructureSerializationInterface {

	private ObjectMapper objectMapper;

	/**
	 * Constructor for the {@link MessagePackSerialization} class.
	 * Generates {@link ObjectMapper} and sets to include non-null.
	 */
	public MessagePackSerialization() {
		objectMapper = new ObjectMapper(new MessagePackFactory());
		objectMapper.setSerializationInclusion(Include.NON_NULL);
	}

	@Override
	public MmtfStructure deserialize(InputStream inputStream){
		MmtfStructure mmtfBean = null;
		try {
			mmtfBean = objectMapper.readValue(inputStream, MmtfStructure.class);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return mmtfBean;
	}

	@Override
	public void serialize(MmtfStructure mmtfStructure, OutputStream outputStream) {
		try {
			objectMapper.writeValue(outputStream, mmtfStructure);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Update to the serialization module - only construct object mapper once.


package se.soy.gpg;

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

public class GPG {
  // FIXME Remove when done
  static<T> void println(T arg) { System.out.println(arg); }

  public static void main(String[] args) {
    println("main");
    GPG.encrypt().armor().recipient("0xrecipient").output();
    /*
    GPG.decrypt().armor().local-user("0xlocaluser").output("/tmp/a-file");
    GPG.sign().armor().();
    */
  }

  private String mode;
  private boolean armor = false;
  private List<String> recipients = new ArrayList<String>();

  public void output() {
    println("OPTIONS:");
    println(String.format("mode: %s", mode));
    println(String.format("armor?: %s", (armor) ? "true" : "false"));
    println(String.format("recipients?: %s", recipients));
  }

  public static GPG encrypt() {
    GPG gpg = new GPG();
    gpg.mode = "encrypt";
    return gpg;
  }

  public static GPG clearsign() {
    GPG gpg = new GPG();
    gpg.mode = "clearsign";
    return gpg;
  }

  public GPG armor() {
    this.armor = true;
    return this;
  }

  // TODO: Add recipients(List<String> recipients)
  public GPG recipient(String recipient) {
    this.recipients.add(recipient);
    return this;
  }
}

package se.soy.gpg;

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

public class GPG {
  // FIXME Remove when done
  static<T> void println(T arg) { System.out.println(arg); }

  public static void main(String[] args) {
    println("main");
    GPG.encrypt().armor().recipient("0xrecipient").output();
    /*
    GPG.decrypt().armor().local-user("0xlocaluser").output("/tmp/a-file");
    GPG.sign().armor().();
    */
  }

  private String mode;
  private boolean armor = false;
  private List<String> recipients = new ArrayList<String>();

  public void output() {
    println("OPTIONS:");
    println(String.format("mode: %s", mode));
    println(String.format("armor?: %s", (armor) ? "true" : "false"));
    println(String.format("recipients?: %s", recipients));
  }

  public static GPG encrypt() {
    GPG gpg = new GPG();
    gpg.mode = "encrypt";
    return gpg;
  }

    GPG gpg = new GPG();
    gpg.mode = "clearsign";
  public static GPG sign() {
    return gpg;
  }

  public GPG armor() {
    this.armor = true;
    return this;
  }

  // TODO: Add recipients(List<String> recipients)
  public GPG recipient(String recipient) {
    this.recipients.add(recipient);
    return this;
  }
}

Make it a regular sign