package jannotate.domain;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Annotation {
	@Id
	int id;
	String name;
	String api;
	String use;

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getApi() {
		return api;
	}
	public void setApi(String api) {
		this.api = api;
	}
	public String getUse() {
		return use;
	}
	public void setUse(String use) {
		this.use = use;
	}
}

package jannotate.domain;

import java.lang.annotation.RetentionPolicy;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;

@Entity
public class Annotation {
	@Id
	int id;
	String api;
	String name;
	RetentionPolicy retention;
	String use;

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getApi() {
		return api;
	}
	public void setApi(String api) {
		this.api = api;
	}

	@Enumerated(EnumType.ORDINAL)
	public RetentionPolicy getRetention() {
		return retention;
	}
	public void setRetention(RetentionPolicy retention) {
		this.retention = retention;
	}
	public String getUse() {
		return use;
	}
	public void setUse(String use) {
		this.use = use;
	}
}

Add field for retention policy.


/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2019 Vladimir
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.devproserv.courses.model;

/**
 * Deals with admins.
 *
 * @since 0.5.0
 */
public final class NestAdmins implements Nest {
    @Override
    public Responsible makeUser() {
        return null;
    }
}

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2019 Vladimir
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.devproserv.courses.model;

/**
 * Deals with admins.
 *
 * @since 0.5.0
 */
public final class NestAdmins implements Nest {
    @Override
    public Responsible makeUser() {
        return new Admin(new User(-1, "no login", "no pass"));
    }
}

Fix null in admin account


package org.jenkinsci.plugins.p4.scm;

import jenkins.scm.api.SCMRevision;
import org.jenkinsci.plugins.p4.changes.P4Ref;

import java.util.Objects;

public class P4Revision extends SCMRevision {
	private final P4Ref ref;

	P4Revision(P4Head branch, P4Ref ref) {
		super(branch);
		this.ref = ref;
	}

	public P4Ref getRef() {
		return ref;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		P4Revision that = (P4Revision) o;
		boolean c = ref == that.ref;
		boolean h = getHead().equals(that.getHead());
		return c && h;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		return Objects.hashCode(ref);
	}

	@Override
	public String toString() {
		return ref.toString();
	}
}

package org.jenkinsci.plugins.p4.scm;

import jenkins.scm.api.SCMRevision;
import org.jenkinsci.plugins.p4.changes.P4Ref;

import java.util.Objects;

public class P4Revision extends SCMRevision {
	private final P4Ref ref;

	P4Revision(P4Head branch, P4Ref ref) {
		super(branch);
		this.ref = ref;
	}

	public P4Ref getRef() {
		return ref;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		P4Revision that = (P4Revision) o;
		boolean c = ref.equals(that.ref);
		boolean h = getHead().equals(that.getHead());
		return c && h;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		return Objects.hashCode(ref);
	}

	@Override
	public String toString() {
		if (ref == null) {
			return "undefined";
		}
		return ref.toString();
	}
}

Fix equals used in comparable check and null check.


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

package org.apache.hadoop.hbase.stargate.util;

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

/**
 * Generic storage for per user information.
 */
public class UserData {

  public static final int TOKENBUCKET = 1;

  Map<Integer,Object> data = new HashMap<Integer,Object>(1);

  public synchronized boolean has(final int sel) {
    return data.get(sel) != null;
  }

  public synchronized Object get(final int sel) {
    return data.get(sel);
  }

  public synchronized Object put(final int sel, final Object o) {
    return data.put(sel, o);
  }

  public synchronized Object remove(int sel) {
    return remove(sel);
  }

}

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

package org.apache.hadoop.hbase.stargate.util;

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

/**
 * Generic storage for per user information.
 */
public class UserData {

  public static final int TOKENBUCKET = 1;

  Map<Integer,Object> data = new HashMap<Integer,Object>(1);

  public synchronized boolean has(final int sel) {
    return data.get(sel) != null;
  }

  public synchronized Object get(final int sel) {
    return data.get(sel);
  }

  public synchronized Object put(final int sel, final Object o) {
    return data.put(sel, o);
  }

  public synchronized Object remove(int sel) {
    return data.remove(sel);
  }

}

Fix infinite recursive loop bug


package org.jfree.chart.axis.junit;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.jfree.chart.axis.CompassFormat;

/**
 * Tests for the {@link CompassFormat} class.
 */
public class CompassFormatTest extends TestCase {

    /**
     * Returns the tests as a test suite.
     *
     * @return The test suite.
     */
    public static Test suite() {
        return new TestSuite(CompassFormatTest.class);
    }

    /**
     * Constructs a new set of tests.
     *
     * @param name  the name of the tests.
     */
    public CompassFormatTest(String name) {
        super(name);
    }

    public void testDefaultConstructor() {
        final CompassFormat fmt = new CompassFormat();
        assert("N".equals(fmt.getDirectionCode(0)));
        assert("N".equals(fmt.getDirectionCode(360)));
    }

    public void testCustomFormat() {
        final CompassFormat fmt = new CompassFormat();
        final CompassFormat fmtCustom = new CompassFormat("N", "O", "S", "W");
        assert("E".equals(fmt.getDirectionCode(90)));
        assert("O".equals(fmtCustom.getDirectionCode(90)));
        assert("NNO".equals(fmtCustom.getDirectionCode(22.5)));
    }

}

package org.jfree.chart.axis.junit;

import org.jfree.chart.axis.CompassFormat;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Tests for the {@link CompassFormat} class.
 */
public class CompassFormatTest {

    @Test
    public void testDefaultConstructor() {
        final CompassFormat fmt = new CompassFormat();
        assertEquals("N", fmt.getDirectionCode(0));
        assertEquals("N", fmt.getDirectionCode(360));
    }

    @Test
    public void testCustomFormat() {
        final CompassFormat fmt = new CompassFormat();
        final CompassFormat fmtCustom = new CompassFormat("N", "O", "S", "W");
        assertEquals("E", fmt.getDirectionCode(90));
        assertEquals("O", fmtCustom.getDirectionCode(90));
        assertEquals("NNO", fmtCustom.getDirectionCode(22.5));
    }

}

Convert new test to Junit4 style


package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;
import org.adaptlab.chpir.android.survey.R;

import android.text.Editable;
import android.text.TextWatcher;
import android.view.ViewGroup;
import android.widget.EditText;

public class FreeResponseQuestionFragment extends QuestionFragment {
    private String mText = "";
    private EditText mFreeText;

    // This is used to restrict allowed input in subclasses.
    protected void beforeAddViewHook(EditText editText) {
    }

    @Override
	public void createQuestionComponent(ViewGroup questionComponent) {
        mFreeText = new EditText(getActivity());
        beforeAddViewHook(mFreeText);
        mFreeText.setHint(R.string.free_response_edittext);
        mFreeText.addTextChangedListener(new TextWatcher() {
            public void onTextChanged(CharSequence s, int start, int before,
                    int count) {
                mText = s.toString();
                saveResponse();
            }

            // Required by interface
            public void beforeTextChanged(CharSequence s, int start,
                    int count, int after) { }
            public void afterTextChanged(Editable s) { }
        });
        questionComponent.addView(mFreeText);
    }

    @Override
    protected String serialize() {
        return mText;
    }

    @Override
    protected void deserialize(String responseText) {
        mFreeText.setText(responseText);
    }

}

package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;
import org.adaptlab.chpir.android.survey.R;

import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.EditText;

public class FreeResponseQuestionFragment extends QuestionFragment {
    private String mText = "";
    private EditText mFreeText;

    // This is used to restrict allowed input in subclasses.
    protected void beforeAddViewHook(EditText editText) {
    }

    @Override
	public void createQuestionComponent(ViewGroup questionComponent) {
        mFreeText = new EditText(getActivity());
        beforeAddViewHook(mFreeText);
        mFreeText.setHint(R.string.free_response_edittext);
        mFreeText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
        mFreeText.addTextChangedListener(new TextWatcher() {
            public void onTextChanged(CharSequence s, int start, int before,
                    int count) {
                mText = s.toString();
                saveResponse();
            }

            // Required by interface
            public void beforeTextChanged(CharSequence s, int start,
                    int count, int after) { }
            public void afterTextChanged(Editable s) { }
        });
        questionComponent.addView(mFreeText);
    }

    @Override
    protected String serialize() {
        return mText;
    }

    @Override
    protected void deserialize(String responseText) {
        mFreeText.setText(responseText);
    }

}

Fix rotation doubles text for free response bug


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

import net.kuujo.copycat.log.Log;

/**
 * Log compaction strategy.
 *
 * @author Jordan Halterman
 */
public interface CompactionStrategy {

  /**
   * Compacts the given log.
   *
   * @param log The log to compact.
   */
  void compact(Log log);

}

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

import net.kuujo.copycat.CopycatContext;
import net.kuujo.copycat.log.Log;
import net.kuujo.copycat.log.SnapshotManager;

/**
 * Log compaction strategy.
 *
 * @author Jordan Halterman
 */
public interface CompactionStrategy {

  /**
   * Compacts the given log.
   *
   * @param log The log to compact.
   * @param manager The Copycat snapshot manager.
   * @param context The current Copycat context.
   */
  void compact(Log log, SnapshotManager manager, CopycatContext context);

  /**
   * Recovers the given log.
   *
   * @param log The log to recover.
   * @param manager The Copycat snapshot manager.
   * @param context The current Copycat context.
   */
  void recover(Log log, SnapshotManager manager, CopycatContext context);

}

Refactor compaction strategy to use snapshot API.


package co.phoenixlab.discord.commands;

import co.phoenixlab.discord.MessageContext;
import co.phoenixlab.discord.api.entities.Channel;
import co.phoenixlab.discord.api.entities.Message;
import co.phoenixlab.discord.api.entities.User;

public class CommandUtil {

    static User findUser(MessageContext context, String username) {
        Message message = context.getMessage();
        User user;
        Channel channel = context.getApiClient().getChannelById(message.getChannelId());
        //  Attempt to find the given user
        //  If the user is @mentioned, try that first
        if (message.getMentions() != null && message.getMentions().length > 0) {
            user = message.getMentions()[0];
        } else {
            user = context.getApiClient().findUser(username, channel.getParent());
        }
        //  Try matching by ID
        if (user == null) {
            user = context.getApiClient().getUserById(username);
        }
        return user;
    }
}

package co.phoenixlab.discord.commands;

import co.phoenixlab.discord.MessageContext;
import co.phoenixlab.discord.api.DiscordApiClient;
import co.phoenixlab.discord.api.entities.Channel;
import co.phoenixlab.discord.api.entities.Message;
import co.phoenixlab.discord.api.entities.User;

public class CommandUtil {

    static User findUser(MessageContext context, String username) {
        Message message = context.getMessage();
        User user;
        Channel channel = context.getApiClient().getChannelById(message.getChannelId());
        //  Attempt to find the given user
        //  If the user is @mentioned, try that first
        if (message.getMentions() != null && message.getMentions().length > 0) {
            user = message.getMentions()[0];
        } else {
            user = context.getApiClient().findUser(username, channel.getParent());
        }
        //  Try matching by ID
        if (user == DiscordApiClient.NO_USER) {
            user = context.getApiClient().getUserById(username);
        }
        return user;
    }
}

Fix checking against null, supposed to be NO_USER


package com.xtremelabs.robolectric.shadows;

import com.xtremelabs.robolectric.util.Implementation;
import com.xtremelabs.robolectric.util.Implements;

import android.media.AudioManager;

@SuppressWarnings({"UnusedDeclaration"})
@Implements(AudioManager.class)
public class ShadowAudioManager {

	private int streamMaxVolume = 15;
	private int streamVolume = 7;

	private int flags;

	@Implementation
	public int getStreamMaxVolume(int streamType) {
		return streamMaxVolume;
	}

	@Implementation
	int getStreamVolume(int streamType) {
		return streamVolume;
	}

	@Implementation
	void setStreamVolume(int streamType, int index, int flags) {
		this.streamVolume = index;
		this.flags = flags;
	}

	public int getStreamMaxVolume() {
		return streamMaxVolume;
	}

	public void setStreamMaxVolume(int streamMaxVolume) {
		this.streamMaxVolume = streamMaxVolume;
	}

	public int getStreamVolume() {
		return streamVolume;
	}

	public void setStreamVolume(int streamVolume) {
		this.streamVolume = streamVolume;
	}

	public int getFlags() {
		return flags;
	}

	public void setFlags(int flags) {
		this.flags = flags;
	}

}

package com.xtremelabs.robolectric.shadows;

import com.xtremelabs.robolectric.util.Implementation;
import com.xtremelabs.robolectric.util.Implements;

import android.media.AudioManager;

@SuppressWarnings({"UnusedDeclaration"})
@Implements(AudioManager.class)
public class ShadowAudioManager {

	private int streamMaxVolume = 15;
	private int streamVolume = 7;

	private int flags;

	@Implementation
	public int getStreamMaxVolume(int streamType) {
		return streamMaxVolume;
	}

	@Implementation
	public int getStreamVolume(int streamType) {
		return streamVolume;
	}

	@Implementation
	public void setStreamVolume(int streamType, int index, int flags) {
		this.streamVolume = index;
		this.flags = flags;
	}

	public int getStreamMaxVolume() {
		return streamMaxVolume;
	}

	public void setStreamMaxVolume(int streamMaxVolume) {
		this.streamMaxVolume = streamMaxVolume;
	}

	public int getStreamVolume() {
		return streamVolume;
	}

	public void setStreamVolume(int streamVolume) {
		this.streamVolume = streamVolume;
	}

	public int getFlags() {
		return flags;
	}

	public void setFlags(int flags) {
		this.flags = flags;
	}

}

Fix missing public decls that were breaking tests


package com.agricraft.agricore.plant;

import com.google.gson.annotations.SerializedName;

public enum AgriRenderType {

    @SerializedName(value = "hash", alternate = {"HASH", "#"})
    HASH('#'),
    @SerializedName(value = "cross", alternate = {"CROSS", "x", "X"})
    CROSS('X'),
    @SerializedName(value = "plus", alternate = {"PLUS", "+"})
    PLUS('+'),
    @SerializedName(value = "rhombus", alternate = {"RHOMBUS", "⬦", "◇"})
    RHOMBUS('◇');

    private final char id;

    AgriRenderType(char id) {
        this.id = id;
    }

    public char id() {
        return id;
    }

    @Override
    public String toString() {
        return String.format("Render Type: %s (\'%c\')\n", name(), id());
    }

}

package com.agricraft.agricore.plant;

import com.google.gson.annotations.SerializedName;

public enum AgriRenderType {

    @SerializedName(value = "hash", alternate = {"HASH", "#"})
    HASH('#'),
    @SerializedName(value = "cross", alternate = {"CROSS", "x", "X"})
    CROSS('X'),
    @SerializedName(value = "plus", alternate = {"PLUS", "+"})
    PLUS('+', 0.75F),
    @SerializedName(value = "rhombus", alternate = {"RHOMBUS", "⬦", "◇"})
    RHOMBUS('◇');

    private final char id;
    private final float heightModifier;

    AgriRenderType(char id) {
        this(id, 1.0F);
    }

    AgriRenderType(char id, float heightModifier) {
        this.id = id;
        this.heightModifier = heightModifier;
    }

    public char id() {
        return id;
    }

    public float getHeightModifier() {
        return this.heightModifier;
    }

    @Override
    public String toString() {
        return String.format("Render Type: %s (\'%c\')\n", name(), id());
    }

}

Add height modifier to plant render types


package refinedstorage.tile;

import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.inventory.InventorySimple;
import refinedstorage.item.ItemUpgrade;

public class TileWirelessTransmitter extends TileMachine {
    public static final int RANGE_PER_UPGRADE = 8;

    private InventorySimple inventory = new InventorySimple("upgrades", 4, this);

    @Override
    public int getEnergyUsage() {
        return 8 + RefinedStorageUtils.getUpgradeEnergyUsage(inventory);
    }

    @Override
    public void updateMachine() {
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt) {
        super.readFromNBT(nbt);

        RefinedStorageUtils.restoreInventory(inventory, 0, nbt);
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);

        RefinedStorageUtils.saveInventory(inventory, 0, nbt);
    }

    public int getRange() {
        return 16 + (RefinedStorageUtils.getUpgradeCount(inventory, ItemUpgrade.TYPE_RANGE) * RANGE_PER_UPGRADE);
    }

    @Override
    public Class<? extends Container> getContainer() {
        return null;
    }

    @Override
    public IInventory getDroppedInventory() {
        return inventory;
    }
}

package refinedstorage.tile;

import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.container.ContainerWirelessTransmitter;
import refinedstorage.inventory.InventorySimple;
import refinedstorage.item.ItemUpgrade;

public class TileWirelessTransmitter extends TileMachine {
    public static final int RANGE_PER_UPGRADE = 8;

    private InventorySimple inventory = new InventorySimple("upgrades", 4, this);

    @Override
    public int getEnergyUsage() {
        return 8 + RefinedStorageUtils.getUpgradeEnergyUsage(inventory);
    }

    @Override
    public void updateMachine() {
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt) {
        super.readFromNBT(nbt);

        RefinedStorageUtils.restoreInventory(inventory, 0, nbt);
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);

        RefinedStorageUtils.saveInventory(inventory, 0, nbt);
    }

    public int getRange() {
        return 16 + (RefinedStorageUtils.getUpgradeCount(inventory, ItemUpgrade.TYPE_RANGE) * RANGE_PER_UPGRADE);
    }

    @Override
    public Class<? extends Container> getContainer() {
        return ContainerWirelessTransmitter.class;
    }

    @Override
    public IInventory getDroppedInventory() {
        return inventory;
    }
}

Fix wireless transmitter not sending container updates


package polyglot.ext.jl.ast;

import polyglot.ast.*;
import polyglot.types.*;
import polyglot.visit.*;
import polyglot.util.*;

/**
 * An integer literal: longs, ints, shorts, bytes, and chars.
 */
public abstract class NumLit_c extends Lit_c implements NumLit
{
    protected long value;

    public NumLit_c(Position pos, long value) {
	super(pos);
	this.value = value;
    }

    /** Get the value of the expression. */
    public long longValue() {
	return this.value;
    }

    /** Get the value of the expression, as an object. */
    public Object objValue() {
        return new Long(this.value);
    }
}

package polyglot.ext.jl.ast;

import polyglot.ast.*;
import polyglot.types.*;
import polyglot.visit.*;
import polyglot.util.*;

/**
 * An integer literal: longs, ints, shorts, bytes, and chars.
 */
public abstract class NumLit_c extends Lit_c implements NumLit
{
    protected long value;

    public NumLit_c(Position pos, long value) {
	super(pos);
	this.value = value;
    }

    /** Get the value of the expression. */
    public long longValue() {
	return this.value;
    }

    /** Get the value of the expression, as an object. */
    public Object objValue() {
        return new Long(this.value);
    }

    public void dump(CodeWriter w) {
        super.dump(w);

	w.allowBreak(4, " ");
	w.begin(0);
	w.write("(value " + value + ")");
	w.end();
    }
}

Include value of numerical literals in AST dumps.


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

import org.junit.Before;
import org.junit.BeforeClass;
import org.openqa.selenium.edge.EdgeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;
import io.github.bonigarcia.wdm.test.base.BrowserTestParent;

/**
 * Test with Microsoft Edge.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.3.0
 */
public class EdgeTest extends BrowserTestParent {

    @BeforeClass
    public static void setupClass() {
        WebDriverManager.edgedriver().setup();
    }

    @Before
    public void setupTest() {
        driver = new EdgeDriver();
    }

}

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

import org.junit.Before;
import org.junit.BeforeClass;
import org.openqa.selenium.edge.EdgeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;
import io.github.bonigarcia.wdm.test.base.BrowserTestParent;

/**
 * Test with Microsoft Edge.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.3.0
 */
@Ignore("Edge not available in CI for all operating systems")
public class EdgeTest extends BrowserTestParent {

    @BeforeClass
    public static void setupClass() {
        WebDriverManager.edgedriver().setup();
    }

    @Before
    public void setupTest() {
        driver = new EdgeDriver();
    }

}

Disable Edge test (not available in all operating systems in CI)


package net.simpvp.Misc;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.Location;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerRespawnEvent;

/**
 * Ensures players respawn at the exact spawn location
 */
public class ExactSpawn implements Listener {

	@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled=false)
	public void onPlayerLogin(PlayerLoginEvent event) {
		if (event.getResult() != PlayerLoginEvent.Result.ALLOWED)
			return;

		if (event.getPlayer().hasPlayedBefore())
			return;

		Location loc = Misc.instance.getServer().getWorld("world").getSpawnLocation();
		loc.setX(loc.getX() + 0.5);
		loc.setZ(loc.getZ() + 0.5);

		event.getPlayer().teleport(loc);

	}

	@EventHandler(priority = EventPriority.LOW, ignoreCancelled=false)
	public void onPlayerRespawn(PlayerRespawnEvent event) {
		if (event.isBedSpawn())
			return;

		Location loc = Misc.instance.getServer().getWorld("world").getSpawnLocation();
		loc.setX(loc.getX() + 0.5);
		loc.setZ(loc.getZ() + 0.5);

		event.setRespawnLocation(loc);

	}

}

package net.simpvp.Misc;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.Location;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;

/**
 * Ensures players respawn at the exact spawn location
 */
public class ExactSpawn implements Listener {

	@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled=false)
	public void onPlayerLogin(PlayerJoinEvent event) {

		if (event.getPlayer().hasPlayedBefore())
			return;

		Misc.instance.getLogger().info(event.getPlayer().getName()
				+ " joined for first time. Porting to spawn.");

		Location loc = Misc.instance.getServer().getWorld("world").getSpawnLocation();
		loc.setX(loc.getX() + 0.5);
		loc.setZ(loc.getZ() + 0.5);

		event.getPlayer().teleport(loc);

	}

	@EventHandler(priority = EventPriority.LOW, ignoreCancelled=false)
	public void onPlayerRespawn(PlayerRespawnEvent event) {
		if (event.isBedSpawn())
			return;

		Location loc = Misc.instance.getServer().getWorld("world").getSpawnLocation();
		loc.setX(loc.getX() + 0.5);
		loc.setZ(loc.getZ() + 0.5);

		event.setRespawnLocation(loc);

	}

}

Fix bug with new players not properly spawning at exact world spawn


package com.moac.android.opensecretsanta.util;

import com.moac.android.opensecretsanta.database.DatabaseManager;
import com.moac.android.opensecretsanta.model.ContactMode;
import com.moac.android.opensecretsanta.model.Member;

import java.util.List;

public class NotifyUtils {

    public static boolean containsSendableEntry(List<Member> _members) {
        for(Member member : _members) {
            if(member.getContactMode().isSendable()) {
                return true;
            }
        }
        return false;
    }

    public static boolean containsEmailSendableEntry(List<Member> _members) {
        for(Member member : _members) {
            if(member.getContactMode() == ContactMode.EMAIL) {
                return true;
            }
        }
        return false;
    }

    public static boolean containsEmailSendableEntry(DatabaseManager db, long[] _memberIds) {
        for(long id : _memberIds) {
            Member member = db.queryById(id, Member.class);
            if(member.getContactMode() == ContactMode.EMAIL) {
                return true;
            }
        }
        return false;
    }

    private boolean isSendable(Member member) {
        return (member != null && member.getContactMode() != null) && member.getContactMode().isSendable();
    }

    public static int getShareableCount(List<Member> _members) {
        int count = 0;
        for(Member member : _members) {
            if(member.getContactMode().isSendable()) {
                count++;
            }
        }
        return count;
    }
}

package com.moac.android.opensecretsanta.util;

import com.moac.android.opensecretsanta.database.DatabaseManager;
import com.moac.android.opensecretsanta.model.ContactMethod;
import com.moac.android.opensecretsanta.model.Member;

import java.util.List;

public class NotifyUtils {

    public static boolean containsSendableEntry(List<Member> _members) {
        for(Member member : _members) {
            if(member.getContactMethod().isSendable()) {
                return true;
            }
        }
        return false;
    }

    public static boolean containsEmailSendableEntry(List<Member> _members) {
        for(Member member : _members) {
            if(member.getContactMethod() == ContactMethod.EMAIL) {
                return true;
            }
        }
        return false;
    }

    public static boolean containsEmailSendableEntry(DatabaseManager db, long[] _memberIds) {
        for(long id : _memberIds) {
            Member member = db.queryById(id, Member.class);
            if(member.getContactMethod() == ContactMethod.EMAIL) {
                return true;
            }
        }
        return false;
    }

    private boolean isSendable(Member member) {
        return (member != null && member.getContactMethod() != null) && member.getContactMethod().isSendable();
    }

    public static int getShareableCount(List<Member> _members) {
        int count = 0;
        for(Member member : _members) {
            if(member.getContactMethod().isSendable()) {
                count++;
            }
        }
        return count;
    }
}

Add missing file from merge


package com.mithrilclient.module;

import com.mithrilclient.config.ConfigManager;
import com.mithrilclient.reflection.ReflectionHooks;

public final class LoginDetailsModule extends Module {
	@Override
	public void init() {
		String username = ConfigManager.CONFIG.getDefaultUsername();

		if (username == null) return;
		if (username.isEmpty()) return;

		ReflectionHooks.setUsername(username);
		ReflectionHooks.setLoginState(2);
		ReflectionHooks.setLoginCursorField(1);
		ReflectionHooks.setLoginMessage("Enter your username/email & password.");
	}
}

package com.mithrilclient.module;

import com.mithrilclient.config.ConfigManager;
import com.mithrilclient.reflection.ReflectionHooks;

public final class LoginDetailsModule extends Module {
	private int lastLoginState = 0;

	@Override
	public void tick() {
		int loginState = ReflectionHooks.getLoginState();

		if (loginState == 2 && lastLoginState == 0) {
			init();
		}

		lastLoginState = loginState;
	}

	@Override
	public void init() {
		String username = ConfigManager.CONFIG.getDefaultUsername();

		if (username == null) return;
		if (username.isEmpty()) return;

		ReflectionHooks.setUsername(username);
		ReflectionHooks.setLoginState(2);
		ReflectionHooks.setLoginCursorField(1);
		ReflectionHooks.setLoginMessage("Enter your username/email & password.");
	}
}

Add login detail filling after previous logout.


package heroku.template.controller;

import heroku.template.model.Person;
import heroku.template.service.PersonService;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class PersonController {

	@Autowired
	private PersonService personService;

	@RequestMapping("/")
	public String listPeople(Map<String, Object> map) {

		map.put("person", new Person());
		map.put("peopleList", personService.listPeople());

		return "people";
	}

	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public String addPerson(@ModelAttribute("person")
	Person person, BindingResult result) {

		personService.addPerson(person);

		return "redirect:/people/";
	}

	@RequestMapping("/delete/{personId}")
	public String deletePerson(@PathVariable("personId")
	Integer personId) {

		personService.removePerson(personId);

		return "redirect:/people/";
	}
}

package heroku.template.controller;

import heroku.template.model.Person;
import heroku.template.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Map;

@Controller
public class PersonController {

	@Autowired
	private PersonService personService;

	@RequestMapping("/")
	public String listPeople(Map<String, Object> map) {

		map.put("person", new Person());
		map.put("peopleList", personService.listPeople());

		return "people";
	}

	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public String addPerson(@ModelAttribute("person") Person person, BindingResult result) {

		personService.addPerson(person);

		return "redirect:/people/";
	}

	@RequestMapping("/delete/{personId}")
	public String deletePerson(@PathVariable("personId") Integer personId) {

		personService.removePerson(personId);

		return "redirect:/people/";
	}
}

Remove line breaks from method signatures


package org.apollo.game.model.event.impl;

import org.apollo.game.model.Position;
import org.apollo.game.model.entity.Mob;
import org.apollo.game.model.event.Event;

/**
 * An {@link Event} created when a Mob's Position is being updated.
 * <p>
 * This Event intentionally ignores the result of execution - it should not be possible for a plugin to prevent this
 * Event from happening, only to listen for it.
 *
 * @author Major
 */
public final class MobPositionUpdateEvent extends Event {

	/**
	 * The Mob whose position is being updated.
	 */
	private final Mob mob;

	/**
	 * The next Position of the Mob.
	 */
	private final Position next;

	/**
	 * Creates the MobPositionUpdateEvent.
	 *
	 * @param mob The {@link Mob} whose Position is being updated.
	 * @param next The next {@link Position} of the Mob.
	 */
	public MobPositionUpdateEvent(Mob mob, Position next) {
		this.mob = mob;
		this.next = next;
	}

	/**
	 * Gets the {@link Mob} being moved.
	 *
	 * @return The Mob.
	 */
	public Mob getMob() {
		return mob;
	}

	/**
	 * Gets the {@link Position} this {@link Mob} is being moved to.
	 *
	 * @return The Position.
	 */
	public Position getNext() {
		return next;
	}

}

package org.apollo.game.model.event.impl;

import org.apollo.game.model.Position;
import org.apollo.game.model.entity.Mob;
import org.apollo.game.model.event.Event;

/**
 * An {@link Event} created when a Mob's Position is being updated.
 *
 * @author Major
 */
public final class MobPositionUpdateEvent extends Event {

	/**
	 * The Mob whose position is being updated.
	 */
	private final Mob mob;

	/**
	 * The next Position of the Mob.
	 */
	private final Position next;

	/**
	 * Creates the MobPositionUpdateEvent.
	 *
	 * @param mob The {@link Mob} whose Position is being updated.
	 * @param next The next {@link Position} of the Mob.
	 */
	public MobPositionUpdateEvent(Mob mob, Position next) {
		this.mob = mob;
		this.next = next;
	}

	/**
	 * Gets the {@link Mob} being moved.
	 *
	 * @return The Mob.
	 */
	public Mob getMob() {
		return mob;
	}

	/**
	 * Gets the {@link Position} this {@link Mob} is being moved to.
	 *
	 * @return The Position.
	 */
	public Position getNext() {
		return next;
	}

}

Remove irrelevant documentation from MopPositionUpdateEvent


package com.bignerdranch.expandablerecyclerview;

import android.database.Observable;
import android.support.v7.widget.RecyclerView;

import java.lang.reflect.Field;
import java.util.ArrayList;

import static org.mockito.Mockito.mock;

public final class TestUtils {

    private TestUtils() {}

    /**
     * Fixes internal dependencies to android.database.Observable so that a RecyclerView.Adapter can be tested using regular unit tests while
     * observing changes to the data setIsTypingRepository.
     */
    public static RecyclerView.AdapterDataObserver fixAdapterForTesting(RecyclerView.Adapter adapter) throws NoSuchFieldException, IllegalAccessException {
        // Observables are not mocked by default so we need to hook the adapter up to an observer so we can track changes
        Field observableField = RecyclerView.Adapter.class.getDeclaredField("mObservable");
        observableField.setAccessible(true);
        Object observable = observableField.get(adapter);
        Field observersField = Observable.class.getDeclaredField("mObservers");
        observersField.setAccessible(true);
        final ArrayList<Object> observers = new ArrayList<>();
        RecyclerView.AdapterDataObserver dataObserver = mock(RecyclerView.AdapterDataObserver.class);
        observers.add(dataObserver);
        observersField.set(observable, observers);
        return dataObserver;
    }
}

package com.bignerdranch.expandablerecyclerview;

import android.database.Observable;
import android.support.v7.widget.RecyclerView;

import java.lang.reflect.Field;
import java.util.ArrayList;

import static org.mockito.Mockito.mock;

public final class TestUtils {

    private TestUtils() {}

    /**
     * Fixes internal dependencies to android.database.Observable so that a RecyclerView.Adapter
     * can be tested using regular unit tests while verifying changes to the data.
     *
     * Pulled from: https://github.com/badoo/Chateau/blob/master/ExampleApp/src/test/java/com/badoo/chateau/example/ui/utils/TestUtils.java
     */
    public static RecyclerView.AdapterDataObserver fixAdapterForTesting(RecyclerView.Adapter adapter) throws NoSuchFieldException, IllegalAccessException {
        // Observables are not mocked by default so we need to hook the adapter up to an observer so we can track changes
        Field observableField = RecyclerView.Adapter.class.getDeclaredField("mObservable");
        observableField.setAccessible(true);
        Object observable = observableField.get(adapter);
        Field observersField = Observable.class.getDeclaredField("mObservers");
        observersField.setAccessible(true);
        final ArrayList<Object> observers = new ArrayList<>();
        RecyclerView.AdapterDataObserver dataObserver = mock(RecyclerView.AdapterDataObserver.class);
        observers.add(dataObserver);
        observersField.set(observable, observers);
        return dataObserver;
    }
}

Update documentation of testutils method


package com.formulasearchengine.mathosphere.mlp;

import com.formulasearchengine.mathosphere.mlp.cli.TagsCommandConfig;
import com.formulasearchengine.mathosphere.mlp.contracts.TagExtractionMapper;
import com.formulasearchengine.mathosphere.mlp.contracts.TextExtractorMapper;
import com.formulasearchengine.mathosphere.mlp.pojos.MathTag;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;

public class WikiTagExtractor {

    public static void run(TagsCommandConfig config) throws Exception {
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        final DataSource<String> dump = FlinkMlpRelationFinder.readWikiDump(config, env);
        dump
                .flatMap(new TextExtractorMapper())
                .flatMap(new TagExtractionMapper(config))
                .distinct(MathTag::getContentHash)
                .map(MathTag::toJson)
                .writeAsText(config.getOutputDir() + "/formulae.txt");
        env.execute();
    }
}

package com.formulasearchengine.mathosphere.mlp;

import com.formulasearchengine.mathosphere.mlp.cli.TagsCommandConfig;
import com.formulasearchengine.mathosphere.mlp.contracts.TagExtractionMapper;
import com.formulasearchengine.mathosphere.mlp.contracts.TextExtractorMapper;
import com.formulasearchengine.mathosphere.mlp.pojos.MathTag;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;

public class WikiTagExtractor {

    public static void run(TagsCommandConfig config) throws Exception {
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        final DataSource<String> dump = FlinkMlpRelationFinder.readWikiDump(config, env);
        //DataSet<String> text = env.fromElements("[ ");
        dump
                .flatMap(new TextExtractorMapper())
                .flatMap(new TagExtractionMapper(config))
                .distinct(MathTag::getContentHash)
                .map(MathTag::toJson)
                .writeAsFormattedText(config.getOutputDir() + "/formulae.txt", s -> s + ",")
                .setParallelism(1);
        env.execute();
    }
}

Add commas to JSON object list


package com.ksoichiro.task.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.NestedRuntimeException;
import org.springframework.stereotype.Component;

import java.sql.SQLException;

@Component
@Aspect
@Slf4j
public class ServiceAdvice {
    @Pointcut("@within(org.springframework.stereotype.Service)")
    public void service() {
    }

    @Around("service() && execution(* com.ksoichiro.task.service.*.*(..))")
    public Object execution(ProceedingJoinPoint pjp) throws Throwable {
        try {
            return pjp.proceed();
        } catch (NestedRuntimeException e) {
            if (e.contains(SQLException.class)) {
                // If needed, we can handle specific SQL error codes.
                SQLException cause = getCause(e, SQLException.class);
                log.warn("SQL Error: {}, SQLState: {}", cause.getErrorCode(), cause.getSQLState());
            }
            // Rethrow it to delegate handling
            throw e;
        }
    }

    @SuppressWarnings("unchecked")
    <T> T getCause(NestedRuntimeException e, Class<T> exceptionClass) {
        Throwable cause = e.getCause();
        while (cause != null) {
            if (exceptionClass.isAssignableFrom(cause.getClass())) {
                break;
            }
            cause = cause.getCause();
        }
        return (T) cause;
    }
}

package com.ksoichiro.task.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.NestedRuntimeException;
import org.springframework.stereotype.Component;

import java.sql.SQLException;

@Component
@Aspect
@Slf4j
public class ServiceAdvice {
    @Pointcut("@within(org.springframework.stereotype.Service)")
    public void service() {
    }

    @Around("service() && execution(* com.ksoichiro.task.service.*.*(..))")
    public Object execution(ProceedingJoinPoint pjp) throws Throwable {
        try {
            return pjp.proceed();
        } catch (NestedRuntimeException e) {
            if (e.contains(SQLException.class)) {
                // If needed, we can handle specific SQL error codes.
                SQLException cause = getCause(e, SQLException.class);
                log.warn("SQL Error: {}, SQLState: {}, message: {}", cause.getErrorCode(), cause.getSQLState(), cause.getMessage());
            }
            // Rethrow it to delegate handling
            throw e;
        }
    }

    @SuppressWarnings("unchecked")
    <T> T getCause(NestedRuntimeException e, Class<T> exceptionClass) {
        Throwable cause = e.getCause();
        while (cause != null) {
            if (exceptionClass.isAssignableFrom(cause.getClass())) {
                break;
            }
            cause = cause.getCause();
        }
        return (T) cause;
    }
}

Add SQL error message to log


package umm3601.digitalDisplayGarden.Authentication;

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

import java.security.NoSuchAlgorithmException;

import static java.lang.Thread.sleep;
import static org.junit.Assert.*;

public class TestAuthorizedCookieBody {

    Auth auth;

    @Before
    public void setup() throws NoSuchAlgorithmException{
        auth = new Auth("fakeID", "fakeSecret", "callback");
    }

    @Test
    public void testThatCookieBodyIsAuthorizable(){
        String cookieBody = auth.generateCookieBody(120);
        assertNotNull(cookieBody);
        assertNotEquals("",cookieBody);

        boolean authorized = auth.authorized(cookieBody);
        assertTrue(authorized);
    }

    @Test
    public void testThatCookieBodyIsExpired(){
        String cookieBody = auth.generateCookieBody(0);
        boolean authorized = auth.authorized(cookieBody);
        assertFalse(authorized);
    }

    @Test
    public void testThatInvalidCookieBodyIsNotAuthorized(){
        boolean authorized = auth.authorized("SWvvnS4x1qPOQRUHbuX6s//TrXTk/ir74LDBp");
        assertFalse(authorized);
    }

}

package umm3601.digitalDisplayGarden.Authentication;

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

import java.security.NoSuchAlgorithmException;

import static java.lang.Thread.sleep;
import static org.junit.Assert.*;

public class TestAuthorizedCookieBody {

    Auth auth;

    @Before
    public void setup() throws NoSuchAlgorithmException{
        auth = new Auth("fakeID", "fakeSecret", "callback");
    }

    @Test
    public void testThatCookieBodyIsAuthorizable(){
        String cookieBody = auth.generateCookieBody(120);
        assertNotNull(cookieBody);
        assertNotEquals("",cookieBody);

        boolean authorized = auth.authorized(cookieBody);
        assertTrue(authorized);
    }

    @Test
    public void testThatCookieBodyIsExpired(){
        String cookieBody = auth.generateCookieBody(0);
        boolean authorized = auth.authorized(cookieBody);
        assertFalse(authorized);
    }

    @Test
    public void testThatInvalidCookieBodyIsNotAuthorized(){
        boolean authorized = auth.authorized("SWvvnS4x1qPOQRUHbuX6s//TrXTk/ir74LDBp");
        assertFalse(authorized);
    }

    @Test
    public void testGenerateAndUnpackSecretSuccess(){
        String secret = auth.generateSharedGoogleSecret("someURL");
        RedirectToken redToken = auth.unpackSharedGoogleSecret(secret);
        assertEquals("someURL", redToken.originatingURL);
    }

    @Test
    public void testGenerateAndUnpackSecretFailure(){
        String secret = auth.generateSharedGoogleSecret("someURL");
        secret = secret + "fasd";
        RedirectToken redToken = auth.unpackSharedGoogleSecret(secret);
        assertNull(redToken);

    }
}

Test generating a secret that can be unpacked with the correct URL.


package com.kryptnostic.sharing.v1;

import java.io.IOException;
import java.util.Set;
import java.util.UUID;

import com.google.common.base.Optional;
import com.kryptnostic.kodex.v1.exceptions.types.ResourceNotFoundException;
import com.kryptnostic.kodex.v1.exceptions.types.SecurityConfigurationException;

public interface SharingClient {
    void unshareObjectWithUsers( String objectId, Set<UUID> users );

    int processIncomingShares() throws IOException, SecurityConfigurationException;

    int getIncomingSharesCount();

    void shareObjectWithUsers( String objectId, Set<UUID> users ) throws ResourceNotFoundException;

    Optional<byte[]> getIndexPair( String objectId ) throws ResourceNotFoundException;

    byte[] getSharingPair( String objectId ) throws ResourceNotFoundException;
}

package com.kryptnostic.sharing.v1;

import java.io.IOException;
import java.util.Set;
import java.util.UUID;

import com.google.common.base.Optional;
import com.kryptnostic.kodex.v1.exceptions.types.ResourceNotFoundException;
import com.kryptnostic.kodex.v1.exceptions.types.SecurityConfigurationException;

public interface SharingClient {
    void unshareObjectWithUsers( String objectId, Set<UUID> users );

    Set<String> processIncomingShares() throws IOException, SecurityConfigurationException;

    int getIncomingSharesCount();

    void shareObjectWithUsers( String objectId, Set<UUID> users ) throws ResourceNotFoundException;

    Optional<byte[]> getIndexPair( String objectId ) throws ResourceNotFoundException;

    byte[] getSharingPair( String objectId ) throws ResourceNotFoundException;
}

Make process incoming shares return processed share ids.


package pl.openrest.generator.commons.type;

import java.io.File;
import java.io.IOException;

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

import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;

public class TypeFileWriter {

    private final File outputDirectory;

    private static final Logger LOGGER = LoggerFactory.getLogger(TypeFileWriter.class);

    public TypeFileWriter(File outputDirectory) {
        this.outputDirectory = outputDirectory;
    }

    public void write(TypeSpec typeSpec, String packageName) {
        JavaFile file = JavaFile.builder(packageName, typeSpec).build();
        try {
            file.writeTo(outputDirectory);
        } catch (IOException e) {
            LOGGER.error(String.format("Error while writing %s", typeSpec.name), e);
        }
    }
}

package pl.openrest.generator.commons.type;

import java.io.File;
import java.io.IOException;

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

import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;

public class TypeFileWriter {

    private final File outputDirectory;

    private static final Logger LOGGER = LoggerFactory.getLogger(TypeFileWriter.class);

    public TypeFileWriter(File outputDirectory) {
        this.outputDirectory = outputDirectory;
    }

    public void write(TypeSpec typeSpec, String packageName) {
        JavaFile file = JavaFile.builder(packageName, typeSpec).skipJavaLangImports(true).build();
        try {
            file.writeTo(outputDirectory);
        } catch (IOException e) {
            LOGGER.error(String.format("Error while writing %s", typeSpec.name), e);
        }
    }
}

Set skipJavaLangImports flag to true


package com.danisola.bandit;

public class Ucb1Algorithm extends AbstractBanditAlgorithm {

    public Ucb1Algorithm(int numArms, UpdateStrategy updateStrategy) {
        super(numArms, updateStrategy);
    }

    @Override
    public int selectArm() {
        int totalCount = 0;
        for (int i = 0; i < counts.length; i++) {
            int count = counts[i];
            if (count == 0) {
                return i;
            }
            totalCount += count;
        }

        double[] ucbValues = new double[numArms];
        for (int i = 0; i < numArms; i++) {
            double bonus = Math.sqrt(2 * Math.log(totalCount / counts[i]));
            ucbValues[i] = values[i] + bonus;
        }

        int maxIndex = 0;
        for (int i = 1; i < ucbValues.length; i++) {
            double newValue = ucbValues[i];
            if (newValue > ucbValues[maxIndex]) {
                maxIndex = i;
            }
        }
        return maxIndex;
    }

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

package com.danisola.bandit;

public class Ucb1Algorithm extends AbstractBanditAlgorithm {

    public Ucb1Algorithm(int numArms, UpdateStrategy updateStrategy) {
        super(numArms, updateStrategy);
    }

    @Override
    public int selectArm() {
        int totalCount = 0;
        for (int i = 0; i < counts.length; i++) {
            int count = counts[i];
            if (count == 0) {
                return i;
            }
            totalCount += count;
        }

        double[] ucbValues = new double[numArms];
        for (int i = 0; i < numArms; i++) {
            double bonus = Math.sqrt((2 * Math.log(totalCount)) / counts[i]);
            ucbValues[i] = values[i] + bonus;
        }

        int maxIndex = 0;
        for (int i = 1; i < ucbValues.length; i++) {
            double newValue = ucbValues[i];
            if (newValue > ucbValues[maxIndex]) {
                maxIndex = i;
            }
        }
        return maxIndex;
    }

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

Fix error in UCB1 algorithm


/*******************************************************************************
 * Copyright (c) 2016-2017 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.bosh;

import java.io.IOException;

import org.springframework.ide.vscode.bosh.models.BoshCommandCloudConfigProvider;
import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp;

public class Main {
	public static void main(String[] args) throws IOException, InterruptedException {
		LaunguageServerApp.start(() -> new BoshLanguageServer(
				new BoshCommandCloudConfigProvider(),
				(dc) -> null //TODO: real model provider here!
		));
	}
}

/*******************************************************************************
 * Copyright (c) 2016-2017 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.bosh;

import java.io.IOException;

import org.springframework.ide.vscode.bosh.models.BoshCommandCloudConfigProvider;
import org.springframework.ide.vscode.bosh.models.BoshCommandStemcellsProvider;
import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp;

public class Main {
	public static void main(String[] args) throws IOException, InterruptedException {
		LaunguageServerApp.start(() -> new BoshLanguageServer(
				new BoshCommandCloudConfigProvider(),
				new BoshCommandStemcellsProvider()
		));
	}
}

Add BoshCommandStemcellsProvider properly to Bosh language server


package com.nigorojr.typebest;

import java.util.ArrayList;

import javax.swing.JPanel;

public class Word extends JPanel {
    private ArrayList<Letter> letters = new ArrayList<Letter>();
    private String rawWord;

    /**
     * Accepts a String which is what will be shown in this JPanel.
     * The constructor will then split the word into letters and create a Letter
     * object for each letter. After that, Letter objects are added to the
     * this JPanel.
     *
     * @param word
     *            The word that will be shown as a collection of "Letter" class.
     */
    public Word(String word) {
        rawWord = word;
        letterCount = 0;

        split(word);
        for (int i = 0; i < letters.size(); i++)
            this.add(letters.get(i));
    }

    /**
     * Splits up the word into letters and add them to an ArrayList.
     */
    private void split(String word) {
        for (int i = 0; i < rawWord.length(); i++) {
            Letter letter = new Letter(rawWord.charAt(i));
            letters.add(letter);
        }
    }
}

package com.nigorojr.typebest;

import java.util.ArrayList;

import javax.swing.JPanel;

public class Word extends JPanel {
    private ArrayList<Letter> letters = new ArrayList<Letter>();
    private String rawWord;
    private int letterCount;

    /**
     * Accepts a String which is what will be shown in this JPanel.
     * The constructor will then split the word into letters and create a Letter
     * object for each letter. After that, Letter objects are added to the
     * this JPanel.
     *
     * @param word
     *            The word that will be shown as a collection of "Letter" class.
     */
    public Word(String word) {
        rawWord = word;
        letterCount = 0;

        split(word);
        for (int i = 0; i < letters.size(); i++)
            this.add(letters.get(i));
    }

    /**
     * Splits up the word into letters and add them to an ArrayList.
     */
    private void split(String word) {
        for (int i = 0; i < rawWord.length(); i++) {
            Letter letter = new Letter(rawWord.charAt(i));
            letters.add(letter);
        }
    }

    /**
     * Checks whether the given letter is the correct letter to be typed.
     *
     * @param letter
     *            A one-letter character to be checked if it's the correct
     *            letter.
     * @return True if the given letter is correct, false if not.
     */
    public boolean isCorrectLetter(char letter) {
        return letters.get(letterCount).getRawLetter() == letter;
    }
}

Implement method that checks whether the given character is correct


package ru.sfwt.mt.sandbox;

public class MyFirstProgram {

  public static void main(String[] args) {
    System.out.println("Hell, world!");

  }
}

package ru.sfwt.mt.sandbox;

public class MyFirstProgram {

  public static void main(String[] args) {
    hello("word");
    hello("user");
    hello("Marina");

    double len = 5;
    System.out.println("S квадрата со стороной " + len + " = " + area(len));

    double a = 5;
    double b = 6;
    System.out.println("S прямоугольника со сторонами " + a + " и " + b + " = " + area(a,b));
  }

  public static void hello(String somebody) {
    System.out.println("Hell, " + somebody + "!");
  }

  public static double area(double l) {
    return l * l;
  }

  public static double area(double a, double b) {
    return a * b;
  }
}

Add functions for the area of a square and a rectangle


package models;

import play.data.validation.Constraints;
import play.db.ebean.Model;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.util.ArrayList;
import java.util.List;

@Entity
public class Powerup extends Model {
    public static Model.Finder<Long, models.Powerup> find = new Model.Finder<>(Long.class, models.Powerup.class);

    @Id
    public Long id;

    @Constraints.Required
    public String className;

    @Constraints.Required
    public String friendlyName;

    @Constraints.Required
    public boolean isMandatory;

    @OneToMany(cascade = CascadeType.PERSIST)
    public List<Activation> activations = new ArrayList<>();

}

package models;

import play.data.validation.Constraints;
import play.db.ebean.Model;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Entity
public class Powerup extends Model {
    public static Model.Finder<Long, models.Powerup> find = new Model.Finder<>(Long.class, models.Powerup.class);

    @Id
    public Long id;

    @Constraints.Required
    public String className;

    @Constraints.Required
    public String friendlyName;

    @Constraints.Required
    public boolean isMandatory;

    @Basic(optional = true)
    public boolean hasMenuEntry;

    @OneToMany(cascade = CascadeType.PERSIST)
    public List<Activation> activations = new ArrayList<>();

}

Add field to indicate whether or not the powerup should be listed in menu.


package org.jboss.as.modcluster;

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

import org.jboss.as.controller.OperationFailedException;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.Property;

public class ContextHost {
    String webcontext = null;
    String webhost = null;
    int waittime = 10;

    public ContextHost(ModelNode operation) throws OperationFailedException {
        List<Property> list = operation.asPropertyList();
        Iterator<Property> it= list.iterator();
        webcontext = null;
        webhost = null;
        while(it.hasNext()) {
            Property prop= it.next();
            if (prop.getName().equals("context")) {
                webcontext = prop.getValue().toString();
            }
            if (prop.getName().equals("virtualhost")) {
                webhost = prop.getValue().toString();
            }
            if (prop.getName().equals("waittime")) {
                waittime = Integer.parseInt(RemoveQuotes(prop.getValue().toString()));
            }
        }
        if (webcontext == null || webhost == null)
            throw new OperationFailedException(new ModelNode().set("need context and host"));

        webcontext = RemoveQuotes(webcontext);
        webhost = RemoveQuotes(webhost);
        if (webcontext.equals("/"))
            webcontext = "";
    }

    public static String RemoveQuotes(String string) {
        if (string.endsWith("\"") && string.startsWith("\""))
            return string.substring(1, string.length() -1);
        return null;
    }
}

package org.jboss.as.modcluster;

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

import org.jboss.as.controller.OperationFailedException;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.Property;

public class ContextHost {
    String webcontext = null;
    String webhost = null;
    int waittime = 10;

    public ContextHost(ModelNode operation) throws OperationFailedException {
        List<Property> list = operation.asPropertyList();
        Iterator<Property> it= list.iterator();
        webcontext = null;
        webhost = null;
        while(it.hasNext()) {
            Property prop= it.next();
            if (prop.getName().equals("context")) {
                webcontext = prop.getValue().toString();
            }
            if (prop.getName().equals("virtualhost")) {
                webhost = prop.getValue().toString();
            }
            if (prop.getName().equals("waittime")) {
                waittime = Integer.parseInt(RemoveQuotes(prop.getValue().toString()));
            }
        }
        if (webcontext == null || webhost == null)
            throw new OperationFailedException(new ModelNode().set("need context and host"));

        webcontext = RemoveQuotes(webcontext);
        webhost = RemoveQuotes(webhost);
        if (webcontext.equals("/"))
            webcontext = "";
    }

    public static String RemoveQuotes(String string) {
        if (string.endsWith("\"") && string.startsWith("\""))
            return string.substring(1, string.length() -1);
        return string;
    }
}

Allow quoted and not quotes strings.


package com.cisco.trex.stateless.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class L2Configuration {
    @JsonProperty("dst")
    private String dst;

    @JsonProperty("src")
    private String src;

    @JsonProperty("status")
    private String state;

    @JsonProperty("dst")
    public String getDst() {
        return dst;
    }

    @JsonProperty("dst")
    public void setDst(String dst) {
        this.dst = dst;
    }

    @JsonProperty("src")
    public String getSrc() {
        return src;
    }

    @JsonProperty("src")
    public void setSrc(String src) {
        this.src = src;
    }

    @JsonProperty("status")
    public String getStatus() {
        return state;
    }

    @JsonProperty("state")
    public void setStatus(String status) {
        this.state = status;
    }
}

package com.cisco.trex.stateless.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class L2Configuration {
    @JsonProperty("dst")
    private String dst;

    @JsonProperty("src")
    private String src;

    @JsonProperty("status")
    private String state;

    @JsonProperty("dst")
    public String getDst() {
        return dst;
    }

    @JsonProperty("dst")
    public void setDst(String dst) {
        this.dst = dst;
    }

    @JsonProperty("src")
    public String getSrc() {
        return src;
    }

    @JsonProperty("src")
    public void setSrc(String src) {
        this.src = src;
    }

    @JsonProperty("status")
    public String getStatus() {
        return state;
    }

    @JsonProperty("status")
    public void setStatus(String status) {
        this.state = status;
    }
}

Fix typo @JsonProperty(state) -> @JsonProperty(status)


package com.forgeessentials.afterlife;

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

import net.minecraft.inventory.InventoryBasic;
import net.minecraft.item.ItemStack;

public class InventoryGrave extends InventoryBasic {
    private Grave grave;

    public InventoryGrave(Grave grave)
    {
        super(grave.owner + "'s grave.", false, grave.getSize());
        this.grave = grave;
    }

    @Override
    public void openInventory()
    {
        for (int i = 0; i < getSizeInventory(); i++)
        {
            setInventorySlotContents(i, (ItemStack) null);
        }

        for (int i = 0; i < grave.inv.length; i++)
        {
            if (grave.inv[i] != null)
            {
                setInventorySlotContents(i, grave.inv[i].copy());
            }
        }

        super.openInventory();
    }

    @Override
    public void closeInventory()
    {
        List<ItemStack> list = new ArrayList<ItemStack>();
        for (int i = 0; i < getSizeInventory(); i++)
        {
            ItemStack is = getStackInSlot(i);
            if (is != null)
            {
                list.add(is);
            }
        }
        grave.inv = list.toArray(new ItemStack[list.size()]);

        grave.checkGrave();
        grave.setOpen(false);
        super.closeInventory();
    }
}

package com.forgeessentials.afterlife;

import com.forgeessentials.util.UserIdent;
import net.minecraft.inventory.InventoryBasic;
import net.minecraft.item.ItemStack;

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

public class InventoryGrave extends InventoryBasic {
    private Grave grave;

    public InventoryGrave(Grave grave)
    {
        super(new UserIdent(grave.owner).getUsername() + "'s grave.", false, grave.getSize());
        this.grave = grave;
    }

    @Override
    public void openInventory()
    {
        for (int i = 0; i < getSizeInventory(); i++)
        {
            setInventorySlotContents(i, (ItemStack) null);
        }

        for (int i = 0; i < grave.inv.length; i++)
        {
            if (grave.inv[i] != null)
            {
                setInventorySlotContents(i, grave.inv[i].copy());
            }
        }

        super.openInventory();
    }

    @Override
    public void closeInventory()
    {
        List<ItemStack> list = new ArrayList<ItemStack>();
        for (int i = 0; i < getSizeInventory(); i++)
        {
            ItemStack is = getStackInSlot(i);
            if (is != null)
            {
                list.add(is);
            }
        }
        grave.inv = list.toArray(new ItemStack[list.size()]);

        grave.checkGrave();
        grave.setOpen(false);
        super.closeInventory();
    }
}

Fix showing UUIDs instead of player names in the grave inventory


package nl.vpro.poel.controller;

import nl.vpro.poel.UserUtil;
import nl.vpro.poel.domain.CurrentUser;
import nl.vpro.poel.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import java.security.Principal;

/**
 * This class adds model attributes that are common to all controllers.
 */
@ControllerAdvice
public class PoelControllerAdvice {

    private final MessageService messageService;

    private final String title;

    @Autowired
    public PoelControllerAdvice(MessageService messageService, @Value("${poel.title}") String title) {
        this.messageService = messageService;
        this.title = title;
    }

    @ModelAttribute("user")
    public CurrentUser user(Principal principal) {
        return UserUtil.getCurrentUser(principal).orElse(null);
    }

    @ModelAttribute("message")
    public String message(HttpServletRequest request) {
        String key = request.getRequestURI();
        return messageService.getText(key).orElse("");
    }

    @ModelAttribute("title")
    public String title() {
        return title;
    }
}

package nl.vpro.poel.controller;

import nl.vpro.poel.UserUtil;
import nl.vpro.poel.domain.CurrentUser;
import nl.vpro.poel.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import java.security.Principal;

/**
 * This class sets configuration and model attributes for all controllers.
 */
@ControllerAdvice
public class PoelControllerAdvice {

    private final MessageService messageService;

    private final String title;

    @Autowired
    public PoelControllerAdvice(MessageService messageService, @Value("${poel.title}") String title) {
        this.messageService = messageService;
        this.title = title;
    }

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.setAutoGrowCollectionLimit(1024); // By default 256 is the max and we might get a POST with more users than that
    }

    @ModelAttribute("user")
    public CurrentUser user(Principal principal) {
        return UserUtil.getCurrentUser(principal).orElse(null);
    }

    @ModelAttribute("message")
    public String message(HttpServletRequest request) {
        String key = request.getRequestURI();
        return messageService.getText(key).orElse("");
    }

    @ModelAttribute("title")
    public String title() {
        return title;
    }
}

Allow posting collections with more than 256 items, Luke!


package com.github.ferstl.depgraph;

import java.util.Objects;

import org.apache.maven.shared.dependency.graph.DependencyNode;

class Edge {
  final DependencyNode from;
  final DependencyNode to;

  public Edge(DependencyNode from, DependencyNode to) {
    this.from = from;
    this.to = to;
  }

  @Override
  public int hashCode() {
    return Objects.hash(this.from.getArtifact(), this.to.getArtifact());
  }

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

    Edge other = (Edge) obj;

    return Objects.equals(this.from.getArtifact(), other.from.getArtifact())
        && Objects.equals(this.to.getArtifact(), other.to.getArtifact());
  }

  @Override
  public String toString() {
    return "\"" + this.from + "\" -> \"" + this.to + "\";";
  }
}

package com.github.ferstl.depgraph;

import java.util.Objects;

import org.apache.maven.shared.dependency.graph.DependencyNode;

class Edge {
  final DependencyNode from;
  final DependencyNode to;

  public Edge(DependencyNode from, DependencyNode to) {
    this.from = from;
    this.to = to;
  }

  @Override
  public int hashCode() {
    return Objects.hash(this.from.getArtifact(), this.to.getArtifact());
  }

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

    Edge other = (Edge) obj;

    return Objects.equals(this.from.getArtifact(), other.from.getArtifact())
        && Objects.equals(this.to.getArtifact(), other.to.getArtifact());
  }

  @Override
  public String toString() {
    return "Edge[" + this.from + ", " + this.to + "]";
  }
}

Rewrite toString() to avoid confusion with edges in "dot" foramt


package io.hawt.embedded;

import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

public class MainTest {

    @Test
    public void run() throws Exception {
        System.setProperty("hawtio.authenticationEnabled", "false");

        Main main = new Main();
        main.setWarLocation("../hawtio-default/target/");
        main.run();

        HttpResponse response = Request.Get("http://localhost:8080/hawtio/jolokia/version")
            .execute().returnResponse();
        assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
    }

}

package io.hawt.embedded;

import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

public class MainTest {

    @Test
    public void run() throws Exception {
        System.setProperty("hawtio.authenticationEnabled", "false");
        int port = 12345;

        Main main = new Main();
        main.setWarLocation("../hawtio-default/target/");
        main.setPort(port);
        main.run();

        HttpResponse response = Request.Get(String.format("http://localhost:%s/hawtio/jolokia/version", port))
            .execute().returnResponse();
        assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
    }

}

Change port number in hawtio-embedded test from 8080 to avoid potential port conflicts


package com.sandjelkovic.dispatchd.gateway.api.resource;

import com.sandjelkovic.dispatchd.gateway.api.link.PageLinksAssembler;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.hateoas.ResourceSupport;

@Getter
@RequiredArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class PageableListResource extends ResourceSupport {
	private final PageLinksAssembler linksAssembler;
}

package com.sandjelkovic.dispatchd.gateway.api.resource;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sandjelkovic.dispatchd.gateway.api.link.PageLinksAssembler;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.hateoas.ResourceSupport;

@Getter
@RequiredArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class PageableListResource extends ResourceSupport {
	@JsonIgnore
	private final PageLinksAssembler linksAssembler;
}

Fix linkAssembler being sent in responses


/*
 * 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 net.revelc.code.formatter.html;

import net.revelc.code.formatter.Formatter;
import net.revelc.code.formatter.LineEnding;
import net.revelc.code.formatter.jsoup.JsoupBasedFormatter;

/**
 * @author yoshiman
 *
 */
public class HTMLFormatter extends JsoupBasedFormatter implements Formatter {

    @Override
    public String doFormat(String code, LineEnding ending) {
        return super.doFormat(code, ending);
    }

}

/*
 * 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 net.revelc.code.formatter.html;

import net.revelc.code.formatter.Formatter;
import net.revelc.code.formatter.jsoup.JsoupBasedFormatter;

/**
 * @author yoshiman
 */
public class HTMLFormatter extends JsoupBasedFormatter implements Formatter {

    // Nothing more necessary

}

Fix issue with class just calling super (just inherit it)


package org.texastorque.texastorque20145.subsystem;

import edu.wpi.first.wpilibj.Victor;
import org.texastorque.texastorque20145.constants.Constants;
import org.texastorque.texastorque20145.torquelib.Motor;

public class FrontIntake extends Subsystem {

    public final static int DOWN = 0;
    public final static int INTAKE = 1;
    public final static int OUTTAKE = 2;
    public final static int UP = 3;
    public final static int MANUAL = 4;

    private Motor angleMotor;
    private Motor rollerMotor;

    public FrontIntake()
    {
        angleMotor = new Motor(new Victor(Constants.frontIntakeAnglePort.getInt()), false);
        rollerMotor = new Motor(new Victor(Constants.frontIntakeRollerPort.getInt()), false);
    }

    public void update()
    {
        state = input.getFrontIntakeState();
    }
}

package org.texastorque.texastorque20145.subsystem;

import edu.wpi.first.wpilibj.Victor;
import org.texastorque.texastorque20145.constants.Constants;
import org.texastorque.texastorque20145.torquelib.Motor;

public class FrontIntake extends Subsystem {

    public final static int DOWN = 0;
    public final static int INTAKE = 1;
    public final static int OUTTAKE = 2;
    public final static int UP = 3;
    public final static int MANUAL = 4;

    private double targetAngle;
    private double currentAngle;

    private Motor angleMotor;
    private Motor rollerMotor;

    public FrontIntake()
    {
        angleMotor = new Motor(new Victor(Constants.frontIntakeAnglePort.getInt()), false);
        rollerMotor = new Motor(new Victor(Constants.frontIntakeRollerPort.getInt()), false);
    }

    public void update()
    {
        state = input.getFrontIntakeState();

        switch (state)
        {
            case DOWN:
                targetAngle = Constants.downAngle.getDouble();
                break;
            case INTAKE:
                targetAngle = Constants.intakeFrontAngle.getDouble();
                break;
            case OUTTAKE:
                targetAngle = Constants.outtakeFrontAngle.getDouble();
                break;
            case UP:
                targetAngle = Constants.upAngle.getDouble();
                break;
            default:
                targetAngle = Constants.downAngle.getDouble();
                break;
        }
    }
}

Add states to front intake


package info.u_team.u_team_test;

import info.u_team.u_team_core.util.verify.JarSignVerifier;
import info.u_team.u_team_test.init.*;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";

	public TestMod() {
		JarSignVerifier.checkSigned(MODID);

		System.out.println("--------------------------------------- LOADING TEST MOD ---------------------------------------");

		TestCommonBusRegister.register();
		DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> TestClientBusRegister::register);
	}
}

package info.u_team.u_team_test;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.util.verify.JarSignVerifier;
import info.u_team.u_team_test.init.*;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";
	public static final Logger LOGGER = LogManager.getLogger("UTeamTest");

	public TestMod() {
		JarSignVerifier.checkSigned(MODID);

		LOGGER.info("--------------------------------------- LOADING TEST MOD ---------------------------------------");

		TestCommonBusRegister.register();
		DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> TestClientBusRegister::register);
	}
}

Replace the system out with a proper logger in the test mod


package aQute.lib.deployer.obr;

import java.util.*;

import aQute.bnd.service.*;
import aQute.lib.deployer.repository.*;

@SuppressWarnings("deprecation")
public class Conversions {

	public static final Map<String,String> convertConfig(Map<String,String> map) {
		if (!map.containsKey(AbstractIndexedRepo.PROP_REPO_TYPE))
			map.put(AbstractIndexedRepo.PROP_REPO_TYPE, AbstractIndexedRepo.REPO_TYPE_OBR);

		String location = map.get("location");
		if (location != null)
			map.put(FixedIndexedRepo.PROP_LOCATIONS, location);

		return map;
	}

	public static final Set<OBRResolutionMode> convertResolutionPhases(Collection<ResolutionPhase> phases) {
		Set<OBRResolutionMode> modes = new HashSet<OBRResolutionMode>();
		for (ResolutionPhase phase : phases) {
			OBRResolutionMode mode;
			switch (phase) {
				case build :
					mode = OBRResolutionMode.build;
					break;
				case runtime :
					mode = OBRResolutionMode.runtime;
					break;
				default :
					throw new IllegalArgumentException("");
			}
			modes.add(mode);
		}
		return modes;
	}
}

package aQute.lib.deployer.obr;

import java.util.*;

import aQute.bnd.service.*;
import aQute.lib.deployer.repository.*;

@SuppressWarnings("deprecation")
public class Conversions {

	public static final Map<String,String> convertConfig(Map<String,String> map) {
		if (!map.containsKey(AbstractIndexedRepo.PROP_REPO_TYPE))
			map.put(AbstractIndexedRepo.PROP_REPO_TYPE, AbstractIndexedRepo.REPO_TYPE_OBR);

		String location = map.get("location");
		if (location != null)
			map.put(FixedIndexedRepo.PROP_LOCATIONS, location);

		String mode = map.get("mode");
		if (mode != null)
			map.put(AbstractIndexedRepo.PROP_RESOLUTION_PHASE, mode);

		return map;
	}

	public static final Set<OBRResolutionMode> convertResolutionPhases(Collection<ResolutionPhase> phases) {
		Set<OBRResolutionMode> modes = new HashSet<OBRResolutionMode>();
		for (ResolutionPhase phase : phases) {
			OBRResolutionMode mode;
			switch (phase) {
				case build :
					mode = OBRResolutionMode.build;
					break;
				case runtime :
					mode = OBRResolutionMode.runtime;
					break;
				default :
					throw new IllegalArgumentException("");
			}
			modes.add(mode);
		}
		return modes;
	}
}

Convert legacy property "mode" to "phase" in OBR & LocalOBR plugins


package com.example.android.miwok;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

public class NumbersActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_numbers);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

    }

}

package com.example.android.miwok;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

public class NumbersActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_numbers);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        /**
         * Create a String array with 10 indices containing the words for the numbers 1-10
         */
        String words[] = new String[10];
        words[0] = "one";
        words[1] = "two";
        words[2] = "three";
        words[3] = "four";
        words[4] = "five";
        words[5] = "six";
        words[6] = "seven";
        words[7] = "eight";
        words[8] = "nine";
        words[9] = "ten";

    }

}

Create an array for number words 1-10


package com.hewgill.android.nzsldict;

import android.content.Context;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;

import io.github.inflationx.viewpump.ViewPumpContextWrapper;

public class BaseActivity extends AppCompatActivity {

    protected void setupAppToolbar() {
        Toolbar appToolbar = (Toolbar) findViewById(R.id.app_toolbar);
        setSupportActionBar(appToolbar);
        // add back arrow to toolbar
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            // Respond to the toolbar's NavigationIcon as up/home button
            case android.R.id.home:
                finish();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
    }
}

package com.hewgill.android.nzsldict;

import android.content.Context;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;

import io.github.inflationx.viewpump.ViewPumpContextWrapper;

public class BaseActivity extends AppCompatActivity {

    protected void setupAppToolbar() {
        Toolbar appToolbar = (Toolbar) findViewById(R.id.app_toolbar);
        setSupportActionBar(appToolbar);
        // add back arrow to toolbar
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            // Respond to the toolbar's NavigationIcon as up/home button
            case android.R.id.home:
                finish();
                return true;
            case R.id.action_vocab_sheet:
                startActivity(new Intent(this, VocabSheetActivity.class));
                break;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
    }
}

Add menu item handler to base activity to launch vocab sheet


package com.aragaer.jtt.graphics;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.view.View;

public class ArrowView extends View {
	private final Paints paints;
	private final Path path = new Path();
	public ArrowView(Context context) {
		super(context);
		paints = Paints.getInstance(context);
	}

	protected void onSizeChanged(int w, int h, int oldw, int oldh) {
		path.reset();
		path.moveTo(0, 0);
		path.rLineTo(w, 0);
		path.rLineTo(-w / 2, h);
		path.close();
	}

	protected void onDraw(Canvas canvas) {
		canvas.drawPath(path, paints.solid1);
		canvas.drawPath(path, paints.stroke1);
	}
}

package com.aragaer.jtt.graphics;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.view.View;

public class ArrowView extends View {
	private final Paints paints;
	private final Path path = new Path();
	public ArrowView(Context context) {
		super(context);
		paints = Paints.getInstance(context);
	}

	protected void onSizeChanged(int w, int h, int oldw, int oldh) {
		path.reset();
		path.moveTo(0, 1);
		path.rLineTo(w, 1);
		path.rLineTo(-w / 2, h);
		path.close();
	}

	protected void onDraw(Canvas canvas) {
		canvas.drawPath(path, paints.solid1);
		canvas.drawPath(path, paints.stroke1);
	}
}

Fix the arrow being shaven on top


package org.pdxfinder.dataloaders.updog;

import com.ibm.icu.impl.LocaleDisplayNamesImpl;
import org.hibernate.sql.Template;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class Updog {

    private String provider;

    public Updog(String provider) {
        this.provider = provider;
    }

    private static final Logger log = LoggerFactory.getLogger(Updog.class);

    private Map<String, PdxDataTable> pdxDataTables;
    private Map<String, Object> domainObjects;

    private void readPdxDataTable() {

        PdxDataTable pdxDataTables = new PdxDataTable(provider);
        pdxDataTables.readData();
    }

    public boolean validateTemplate(){

        //instantiate a validator class
        TemplateValidator templateValidator = new TemplateValidator();
        return true;
    }

    public void load(){

        //create domain objects database nodes
        DomainObjectCreator doc = new DomainObjectCreator();
        //save db

    }

}

package org.pdxfinder.dataloaders.updog;

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

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

public class Updog {

    private String provider;

    public Updog(String provider) {
        this.provider = provider;
    }

    private static final Logger log = LoggerFactory.getLogger(Updog.class);

    private Map<String, PdxDataTable> pdxDataTables;
    private Map<String, Set<Object>> domainObjects;

    private void readPdxDataTable() {

        PdxDataTable pdxDataTables = new PdxDataTable(provider);
        pdxDataTables.readData();
    }

    public boolean validateTemplate(){

        //instantiate a validator class
        TemplateValidator templateValidator = new TemplateValidator();
        return true;
    }

    public void load(){

        //create domain objects database nodes
        DomainObjectCreator doc = new DomainObjectCreator(pdxDataTables);
        //save db

    }

}

Update skeleton for new updog


package org.jpos.util;

import com.vaadin.data.converter.StringToBigDecimalConverter;

import java.text.NumberFormat;
import java.util.Locale;

public class AmountConverter extends StringToBigDecimalConverter {

    public AmountConverter(String errorMessage) {
        super(errorMessage);
    }

    @Override
    protected NumberFormat getFormat(Locale locale) {
        NumberFormat amountFormat = NumberFormat.getInstance();
        amountFormat.setGroupingUsed(true);
        amountFormat.setMinimumFractionDigits(2);
        return amountFormat;
    }

}

package org.jpos.util;

import com.vaadin.data.converter.StringToBigDecimalConverter;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;

public class AmountConverter extends StringToBigDecimalConverter {

    public AmountConverter(String errorMessage) {
        super(errorMessage);
    }

    @Override
    protected NumberFormat getFormat(Locale locale) {
        NumberFormat amountFormat = NumberFormat.getInstance();
        amountFormat.setGroupingUsed(true);
        amountFormat.setMinimumFractionDigits(2);
        if (amountFormat instanceof DecimalFormat) {
            ((DecimalFormat) amountFormat).setParseBigDecimal(true);
        }
        return amountFormat;
    }

}

Make parse method of NumberFormat always return a BigDecimal


package network.thunder.core.communication.processor.interfaces;

import network.thunder.core.communication.processor.Processor;
import network.thunder.core.communication.processor.implementations.gossip.NodeObserver;

/**
 * Created by matsjerratsch on 01/12/2015.
 */
public abstract class GossipProcessor extends Processor implements NodeObserver {
    public final static int OBJECT_AMOUNT_TO_SEND = 10;

}

package network.thunder.core.communication.processor.interfaces;

import network.thunder.core.communication.processor.Processor;
import network.thunder.core.communication.processor.implementations.gossip.NodeObserver;

/**
 * Created by matsjerratsch on 01/12/2015.
 */
public abstract class GossipProcessor extends Processor implements NodeObserver {
    public final static int OBJECT_AMOUNT_TO_SEND = 0;

}

Change gossip to send objects immediately without waiting for more