package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("FishingState")
public enum MCFishingState {
	CAUGHT_ENTITY,
	CAUGHT_FISH,
	FAILED_ATTEMPT,
	FISHING,
	IN_GROUND
}

package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("FishingState")
public enum MCFishingState {
	CAUGHT_ENTITY,
	CAUGHT_FISH,
	FAILED_ATTEMPT,
	FISHING,
	IN_GROUND,
	BITE
}

Add ENUM type FishingState.BITE for MC 1.9


package seedu.bulletjournal.logic.parser;

/**
 * Provides variations of commands Note: hard-coded for v0.2, will implement nlp
 * for future versions
 * @author A0127826Y
 */

public class FlexibleCommand {
    private String commandFromUser = "";
    private String[] commandGroups = new String[] { "add a adds create creates new", "clear clr c clears empty empties",
        "delete d deletes del remove removes rm", "edit edits e change changes",
        "exit exits close closes logout logouts quit q", "find finds f search searches lookup", "show showall",
        "help helps h manual instruction instructions", "list lists l ls display displays",
        "select selects s choose chooses" };

    /**
     * Constructor must take in a valid string input
     * @param cfu
     */
    public FlexibleCommand(String cfu) {
        commandFromUser = cfu;
    }

    /**
     * @return the correct command string that matches COMMAND_WORD of command
     *         classes
     */
    public String getCommandWord() {
        for (String commandGroup : commandGroups) {
            for (String command : commandGroup.split(" ")) {
                if (commandFromUser.equals(command)) {
                    return commandGroup.split(" ")[0];
                }
            }
        }
        return commandFromUser;
    }

    public boolean isValidCommand() {
        for (String commandGroup : commandGroups) {
            for (String command : commandGroup.split(" ")) {
                if (commandFromUser.equals(command)) {
                    return true;
                }
            }
        }
        return false;
    }
}

package seedu.bulletjournal.logic.parser;

/**
 * Provides variations of commands Note: hard-coded for v0.2, will implement nlp
 * for future versions
 * @@author A0127826Y
 */

public class FlexibleCommand {
    private String commandFromUser = "";
    private String[] commandGroups = new String[] { "add a adds create creates new", "clear clr c clears empty empties",
        "delete d deletes del remove removes rm", "edit edits e change changes",
        "exit exits close closes logout logouts quit q", "find finds f search searches lookup", "show showall",
        "help helps h manual instruction instructions", "list lists l ls display displays",
        "select selects s choose chooses" };

    /**
     * Constructor must take in a valid string input
     *
     * @param cfu
     */
    public FlexibleCommand(String cfu) {
        commandFromUser = cfu;
    }

    /**
     * @return the correct command string that matches COMMAND_WORD of command
     *         classes
     */
    public String getCommandWord() {
        for (String commandGroup : commandGroups) {
            for (String command : commandGroup.split(" ")) {
                if (commandFromUser.equals(command)) {
                    return commandGroup.split(" ")[0];
                }
            }
        }
        return commandFromUser;
    }

    public boolean isValidCommand() {
        for (String commandGroup : commandGroups) {
            for (String command : commandGroup.split(" ")) {
                if (commandFromUser.equals(command)) {
                    return true;
                }
            }
        }
        return false;
    }
}

Update contribution comment for collate


package org.jusecase.properties.ui;

import org.jusecase.properties.entities.Key;
import org.jusecase.properties.entities.KeyPopulation;

import javax.swing.*;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;

public class KeyListCellRenderer extends DefaultListCellRenderer {
    Map<KeyPopulation, Color> backgroundColorForPopulation = new HashMap<>();

    public KeyListCellRenderer() {
        backgroundColorForPopulation.put(KeyPopulation.Sparse, new Color(231, 211, 186));
    }

    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        Key key = (Key) value;
        JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

        if (!isSelected) {
            Color color = backgroundColorForPopulation.get(key.getPopulation());
            if (color != null) {
                label.setBackground(color);
            }
        }

        return label;
    }
}

package org.jusecase.properties.ui;

import org.jusecase.properties.entities.Key;
import org.jusecase.properties.entities.KeyPopulation;

import javax.swing.*;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;

public class KeyListCellRenderer extends DefaultListCellRenderer {
    Map<KeyPopulation, Color> backgroundColorForPopulation = new HashMap<>();

    public KeyListCellRenderer() {
        backgroundColorForPopulation.put(KeyPopulation.Sparse, new Color(255, 250, 227));
    }

    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        Key key = (Key) value;
        JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

        if (!isSelected) {
            Color color = backgroundColorForPopulation.get(key.getPopulation());
            if (color != null) {
                label.setBackground(color);
            }
        }

        return label;
    }
}

Reduce contrast of sparse keys


package org.ligoj.app.plugin.prov;

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

import org.ligoj.app.api.SubscriptionStatusWithData;
import org.ligoj.app.model.Node;
import org.ligoj.app.plugin.prov.model.ProvInstancePrice;
import org.ligoj.app.plugin.prov.model.ProvInstancePriceTerm;
import org.ligoj.app.plugin.prov.model.ProvInstanceType;
import org.ligoj.app.plugin.prov.model.ProvStorageType;
import org.ligoj.app.resource.plugin.AbstractToolPluginResource;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * The base class for provisioning tool. There is complete quote configuration
 * along the subscription.
 */
public abstract class AbstractProvResource extends AbstractToolPluginResource implements ProvisioningService {

	@Autowired
	protected ProvResource provResource;

	@Override
	public SubscriptionStatusWithData checkSubscriptionStatus(final int subscription, final String node,
			final Map<String, String> parameters) throws Exception {
		final SubscriptionStatusWithData status = super.checkSubscriptionStatus(subscription, node, parameters);

		// Complete the tool status with the generic quote data
		status.put("quote", provResource.getSusbcriptionStatus(subscription));
		return status;
	}

	@Override
	public List<Class<?>> getInstalledEntities() {
		return Arrays.asList(Node.class, ProvInstancePriceTerm.class, ProvInstanceType.class, ProvInstancePrice.class,
				ProvStorageType.class);
	}
}

package org.ligoj.app.plugin.prov;

import java.util.Map;

import org.ligoj.app.api.SubscriptionStatusWithData;
import org.ligoj.app.resource.node.NodeResource;
import org.ligoj.app.resource.plugin.AbstractToolPluginResource;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * The base class for provisioning tool. There is complete quote configuration along the subscription.
 */
public abstract class AbstractProvResource extends AbstractToolPluginResource implements ProvisioningService {

	@Autowired
	protected ProvResource provResource;

	@Autowired
	protected NodeResource nodeResource;

	@Override
	public SubscriptionStatusWithData checkSubscriptionStatus(final int subscription, final String node,
			final Map<String, String> parameters) {
		final SubscriptionStatusWithData status = new SubscriptionStatusWithData();

		// Complete the tool status with the generic quote data
		status.put("quote", provResource.getSusbcriptionStatus(subscription));
		return status;
	}
}

Add "nodeResource" to base Provisioning plugin


package ui;

import rgb.InvertRGBStrategy;
import rgb.RGBStrategy;

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * Created by nick on 10/22/15.
 */
public class RGBPanel extends JPanel {

    private BufferedImage image;
    private RGBStrategy converter;

    public RGBPanel(){
        this(new InvertRGBStrategy());
    }

    public RGBPanel(RGBStrategy converter){
        super();
        this.converter = converter;
        setPreferredSize(new Dimension(600, 400));
        image = new BufferedImage(100, 100, BufferedImage.TYPE_3BYTE_BGR);
    }

    public void setRGBStrategy(RGBStrategy strategy){
        this.converter = strategy;
    }

    public void convert(){
        for(int i = 0; i < image.getWidth(); i++){
            for(int j = 0; j < image.getHeight(); j++){
                Color color = new Color(image.getRGB(i, j));
                color = converter.convert(color);
                image.setRGB(i, j, color.getRGB());
            }
        }
        invalidate();
        repaint();
    }

    public void setImage(BufferedImage img){
        this.image = img;
        setPreferredSize(new Dimension(img.getWidth(), img.getHeight()));
        invalidate();
        repaint();
    }

    @Override
    public void paintComponent(Graphics g){
        super.paintComponent(g);
        g.drawImage(image, 0, 0, null);
    }

}

package ui;

import rgb.InvertRGBStrategy;
import rgb.RGBStrategy;

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * Created by nick on 10/22/15.
 */
public class RGBPanel extends JPanel {

    private BufferedImage originalImage;
    private BufferedImage image;
    private RGBStrategy converter;

    public RGBPanel(){
        this(new InvertRGBStrategy());
    }

    public RGBPanel(RGBStrategy converter){
        super();
        this.converter = converter;
        setPreferredSize(new Dimension(600, 400));
        image = new BufferedImage(100, 100, BufferedImage.TYPE_3BYTE_BGR);
        originalImage = image;
    }

    public void setRGBStrategy(RGBStrategy strategy){
        this.converter = strategy;
    }

    public void convert(){
        BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
        for(int i = 0; i < originalImage.getWidth(); i++){
            for(int j = 0; j < originalImage.getHeight(); j++){
                Color color = new Color(originalImage.getRGB(i, j));
                color = converter.convert(color);
                newImage.setRGB(i, j, color.getRGB());
            }
        }
        image = newImage;
        invalidate();
        repaint();
    }

    public void setImage(BufferedImage img){
        this.originalImage = img;
        this.image = img;
        setPreferredSize(new Dimension(img.getWidth(), img.getHeight()));
        invalidate();
        repaint();
    }

    @Override
    public void paintComponent(Graphics g){
        super.paintComponent(g);
        g.drawImage(image, 0, 0, null);
    }

}

Reset image when choosing new filter


package fr.tvbarthel.apps.devredpe2014.ui;

import android.app.ActionBar;
import android.content.Context;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.TypefaceSpan;

import fr.tvbarthel.apps.devredpe2014.R;

public class ActionBarHelper {

    public static void setDevredTitle(Context context, ActionBar actionBar) {
        if (actionBar != null) {
            SpannableString title = new SpannableString(context.getString(R.string.app_name).toUpperCase());
            TypefaceSpan typefaceSpanLight = new TypefaceSpan("sans-serif-light");
            ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(context.getResources().getColor(android.R.color.holo_red_dark));
            title.setSpan(typefaceSpanLight, 0, title.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            title.setSpan(foregroundColorSpan, title.length() - 4, title.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            actionBar.setTitle(title);
        }
    }
}

package fr.tvbarthel.apps.devredpe2014.ui;

import android.app.ActionBar;
import android.content.Context;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.TypefaceSpan;

import fr.tvbarthel.apps.devredpe2014.R;

public final class ActionBarHelper {

    public static void setDevredTitle(Context context, ActionBar actionBar) {
        if (actionBar != null) {
            SpannableString title = new SpannableString(context.getString(R.string.app_name).toUpperCase());
            TypefaceSpan typefaceSpanLight = new TypefaceSpan("sans-serif-light");
            ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(context.getResources().getColor(android.R.color.holo_red_dark));
            title.setSpan(typefaceSpanLight, 0, title.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            title.setSpan(foregroundColorSpan, title.length() - 4, title.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            actionBar.setTitle(title);
        }
    }

    // Non instantiable class.
    private ActionBarHelper() {
    }
}

Make helper class final and non-instantiable


package seedu.address.logic;

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.address.commons.core.ComponentManager;
import seedu.address.commons.core.LogsCenter;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.Parser;
import seedu.address.model.Model;
import seedu.address.model.task.ReadOnlyTask;
import seedu.address.storage.Storage;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;

    public LogicManager(Model model, Storage storage) {
        this.model = model;
        this.parser = new Parser();
    }

    @Override
    public CommandResult execute(String commandText) throws CommandException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }
}

package seedu.address.logic;

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.address.commons.core.ComponentManager;
import seedu.address.commons.core.LogsCenter;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.DateTimeParser;
import seedu.address.logic.parser.DateTimeParserManager;
import seedu.address.logic.parser.Parser;
import seedu.address.model.Model;
import seedu.address.model.task.ReadOnlyTask;
import seedu.address.storage.Storage;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;
    private final DateTimeParser dtParser;
    public static UndoManager undoCommandHistory = new UndoManager();

    public LogicManager(Model model, Storage storage) {
        this.model = model;
        this.parser = new Parser();
        dtParser = new DateTimeParserManager();
    }

    @Override
    public CommandResult execute(String commandText) throws CommandException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        command.setDateParser(dtParser);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }
}

Add undo manager initialisation in Logic Manager class


package hudson.plugins.s3;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class BucketnameTest {

  @Test
  public void testAnythingAfterSlashInBucketNameIsPrependedToObjectName() {

    // Assertions based on the behaviour of toString is maybe fragile but I think
    // reasonably readable.

    assertEquals( "Destination [bucketName=my-bucket-name, objectName=test.txt]",
        new Destination("my-bucket-name", "test.txt").toString() );

    assertEquals( "Destination [bucketName=my-bucket-name, objectName=foo/test.txt]",
        new Destination("my-bucket-name/foo", "test.txt").toString() );

    assertEquals( "Destination [bucketName=my-bucket-name, objectName=foo/baz/test.txt]",
        new Destination("my-bucket-name/foo/baz", "test.txt").toString() );

    // Unclear if this is the desired behaviour or not:
    assertEquals( "Destination [bucketName=my-bucket-name, objectName=/test.txt]",
        new Destination("my-bucket-name/", "test.txt").toString() );

  }

}

package hudson.plugins.s3;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class BucketnameTest {

  @Test
  public void testAnythingAfterSlashInBucketNameIsPrependedToObjectName() {

    // Assertions based on the behaviour of toString is maybe fragile but I think
    // reasonably readable.

    assertEquals( "Destination [bucketName=my-bucket-name, objectName=test.txt]",
        new Destination("my-bucket-name", "test.txt").toString() );

    assertEquals( "Destination [bucketName=my-bucket-name, objectName=foo/test.txt]",
        new Destination("my-bucket-name/foo", "test.txt").toString() );

    assertEquals( "Destination [bucketName=my-bucket-name, objectName=foo/baz/test.txt]",
        new Destination("my-bucket-name/foo/baz", "test.txt").toString() );

    // Unclear if this is the desired behaviour or not:
    assertEquals( "Destination [bucketName=my-bucket-name, objectName=/test.txt]",
        new Destination("my-bucket-name/", "test.txt").toString() );

  }

  @Test
  public void testWindowsPathsConvertingToS3CompatiblePaths() {
    assertEquals("Destination [bucketName=my-bucket, objectName=with-some/subfolder//path-from/windows.txt]",
            new Destination("my-bucket/with-some/subfolder/", "path-from\\windows.txt").toString() );
  }

}

Test to verify changes to Destination in regard to Windows backslash cleaning


/*
 * Copyright 2016 requery.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.requery.test.modelautovalue;

import com.google.auto.value.AutoValue;

import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;

@Entity
@AutoValue
public abstract class Phone {

    public static Phone create(int id, String phoneNumber, boolean normalized, int ownerId) {
        return new AutoValue_Phone(id, phoneNumber, normalized, ownerId);
    }

    @Id @GeneratedValue
    public abstract int getId();
    public abstract String getPhoneNumber();
    public abstract boolean isNormalized();

    @JoinColumn(foreignKey = @ForeignKey, table = "Person")
    public abstract int getOwnerId();
}

/*
 * Copyright 2016 requery.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.requery.test.modelautovalue;

import com.google.auto.value.AutoValue;

import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;

@Entity
@AutoValue
public abstract class Phone {

    public static Phone create(int id, String phoneNumber, boolean normalized, int ownerId) {
        return new AutoValue_Phone(id, phoneNumber, normalized, ownerId);
    }

    @Id @GeneratedValue
    public abstract int getId();
    public abstract String getPhoneNumber();
    public abstract boolean isNormalized();

    @JoinColumn(foreignKey = @ForeignKey, table = "Person")
    public abstract int getOwnerId();

    // this method should not be processed
    public boolean isValid() {
        return getPhoneNumber() != null && isNormalized();
    }
}

Add non-processable method for testing


package whelk.gui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class RunOrCreatePanel extends WizardCard implements ActionListener
{
    private JRadioButton rCreate;
    private JRadioButton rRun;

    public RunOrCreatePanel(Wizard wizard)
    {
        super(wizard);

        this.setLayout(new GridBagLayout());

        Box vbox = Box.createVerticalBox();
        rCreate = new JRadioButton("Skapa en körning.");
        rCreate.addActionListener(this);
        rRun = new JRadioButton("Kör en tidigare skapad körning.");
        rRun.addActionListener(this);

        rCreate.setSelected(true);

        ButtonGroup group = new ButtonGroup();
        group.add(rCreate);
        group.add(rRun);

        vbox.add(rCreate);
        vbox.add(rRun);
        this.add(vbox);
    }

    @Override
    void onShow(Object parameterFromPreviousCard)
    {
        chooseNextCard();
    }

    @Override
    public void actionPerformed(ActionEvent actionEvent)
    {
        chooseNextCard();
    }

    private void chooseNextCard()
    {
        if (! rRun.isSelected())
            setNextCard(Wizard.CREATE_WHAT);
        else
            setNextCard(Wizard.SELECT_SCRIPT);
    }
}

package whelk.gui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class RunOrCreatePanel extends WizardCard implements ActionListener
{
    private JRadioButton rCreate;
    private JRadioButton rRun;

    public RunOrCreatePanel(Wizard wizard)
    {
        super(wizard);

        this.setLayout(new GridBagLayout());

        boolean creationForbidden = System.getProperty("creationForbidden") != null &&
                System.getProperty("creationForbidden").equals("true");

        Box vbox = Box.createVerticalBox();
        if (creationForbidden)
        {
            rCreate = new JRadioButton("Skapa en körning (ej tillåtet i denna miljö).");
            rCreate.setEnabled(false);
        }
        else
        {
            rCreate = new JRadioButton("Skapa en körning.");
            rCreate.addActionListener(this);
            rCreate.setSelected(true);
        }
        rRun = new JRadioButton("Kör en tidigare skapad körning.");
        rRun.addActionListener(this);

        ButtonGroup group = new ButtonGroup();
        group.add(rCreate);
        group.add(rRun);

        vbox.add(rCreate);
        vbox.add(rRun);
        this.add(vbox);
    }

    @Override
    void onShow(Object parameterFromPreviousCard)
    {
        chooseNextCard();
    }

    @Override
    public void actionPerformed(ActionEvent actionEvent)
    {
        chooseNextCard();
    }

    private void chooseNextCard()
    {
        if (! rRun.isSelected())
            setNextCard(Wizard.CREATE_WHAT);
        else
            setNextCard(Wizard.SELECT_SCRIPT);
    }
}

Disable the creation of new scripts in certain environments (prod).


package com.humbughq.android;

import android.util.Log;
import android.widget.TextView;

class AsyncLogin extends HumbugAsyncPushTask {
    HumbugActivity that;

    public AsyncLogin(HumbugActivity humbugActivity, String username,
            String password) {
        super(humbugActivity);
        that = humbugActivity;
        this.that.email = username;
        this.setProperty("username", username);
        this.setProperty("password", password);
    }

    public final void execute() {
        execute("api/v1/fetch_api_key");
    }

    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);

        if (result != null) {
            this.that.api_key = result.toString();
            Log.i("login", "Logged in as " + this.that.api_key);

            this.that.openLogin();
        } else {
            TextView errorText = (TextView) this.that
                    .findViewById(R.id.error_text);
            errorText.setText("Login failed");
        }
    }
}

package com.humbughq.android;

import android.util.Log;
import android.widget.TextView;

class AsyncLogin extends HumbugAsyncPushTask {

    public AsyncLogin(HumbugActivity humbugActivity, String username,
            String password) {
        super(humbugActivity);
        that = humbugActivity;
        this.that.email = username;
        this.setProperty("username", username);
        this.setProperty("password", password);
    }

    public final void execute() {
        execute("api/v1/fetch_api_key");
    }

    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);

        if (result != null) {
            this.that.api_key = result.toString();
            Log.i("login", "Logged in as " + this.that.api_key);

            this.that.openLogin();
        } else {
            TextView errorText = (TextView) this.that
                    .findViewById(R.id.error_text);
            errorText.setText("Login failed");
        }
    }
}

Remove duplicate definition of reference.


package org.irmacard.cardemu.selfenrol.mno;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

public class MockupSubscriberDatabase implements SubscriberDatabase {
    private  Map<String, SubscriberInfo> subscriberDatabase = null;
    private SimpleDateFormat iso = null;

    public MockupSubscriberDatabase() {
        this.subscriberDatabase = new HashMap<String, SubscriberInfo>();
        SimpleDateFormat iso = new SimpleDateFormat ("yyyyMMddZ");

        /* Example */
        addSubscriber ("IMSI_01234567890abcdef", "19001231", "20251231", "PPNUMMER0");
    }

    private void addSubscriber (String subscriberIdentity, String dob, String exp, String pp) {
        try {
            subscriberDatabase.put(subscriberIdentity,
                    new SubscriberInfo(iso.parse(dob), iso.parse(exp), pp));
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }

    @Override
    public SubscriberInfo getSubscriber(String subscriberIdentity) {
        return subscriberDatabase.get (subscriberIdentity);
    }

}

package org.irmacard.cardemu.selfenrol.mno;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

public class MockupSubscriberDatabase implements SubscriberDatabase {
    private  Map<String, SubscriberInfo> subscriberDatabase = new HashMap<String, SubscriberInfo>();
    private SimpleDateFormat iso = new SimpleDateFormat ("yyyyMMdd");

    public MockupSubscriberDatabase() {
        /* Example */
        addSubscriber ("IMSI_01234567890abcdef", "19001231", "20251231", "PPNUMMER0");
    }

    private void addSubscriber (String subscriberIdentity, String dob, String exp, String pp) {
        try {
            subscriberDatabase.put(subscriberIdentity,
                    new SubscriberInfo(iso.parse(dob), iso.parse(exp), pp));
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }

    @Override
    public SubscriberInfo getSubscriber(String subscriberIdentity) {
        return subscriberDatabase.get (subscriberIdentity);
    }

}

Fix initialisation of ISO formatter.


/*
 * Copyright 2009-2014 Marcelo Guimarães
 *
 * 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 tools.devnull.trugger;

import java.util.function.Predicate;

/**
 * Interface that maps something to a predicate inside a fluent interface.
 *
 * @since 5.0
 */
public interface PredicateMapper<T, R> {

  /**
   * Use the given condition to map the value.
   *
   * @param condition the condition to use
   * @return a reference to the object for doing other mappings.
   */
  R when(Predicate<T> condition);

}

/*
 * Copyright 2009-2014 Marcelo Guimarães
 *
 * 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 tools.devnull.trugger;

import java.util.function.Predicate;

/**
 * Interface that maps something to a predicate inside a fluent interface.
 *
 * @since 5.0
 */
public interface PredicateMapper<T, R> {

  /**
   * Use the given condition to map the value.
   *
   * @param condition the condition to use
   * @return a reference to the object for doing other mappings.
   */
  R when(Predicate<T> condition);

  /**
   * Uses the mapped value as the default.
   *
   * @return a reference to the object for doing other mappings.
   * @since 5.2
   */
  R byDefault();

}

Add a default option to predicate mapper


package com.ingotpowered.api.world;

public interface World {

    public Chunk getChunkAt(ChunkPosition position);

    public Chunk getChunkAt(int x, int z);

}

package com.ingotpowered.api.world;

import com.ingotpowered.api.definitions.Difficulty;
import com.ingotpowered.api.definitions.Dimension;
import com.ingotpowered.api.definitions.LevelType;

public interface World {

    public LevelType getType();

    public Dimension getDimension();

    public Difficulty getDifficulty();

    public void setDifficulty(Difficulty difficulty);

    public Chunk getChunkAt(ChunkPosition position);

    public Chunk getChunkAt(int x, int z);

}

Add type, dimension, and difficulty definitions to world


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

package com.google.bitcoin.core;

import java.util.List;

/**
 * Convenience implementation of {@link PeerEventListener}.
 */
public class AbstractPeerEventListener implements PeerEventListener {
    public void onBlocksDownloaded(Peer peer, Block block, int blocksLeft) {
    }

    public void onChainDownloadStarted(Peer peer, int blocksLeft) {
    }

    public void onPeerConnected(Peer peer, int peerCount) {
    }

    public void onPeerDisconnected(Peer peer, int peerCount) {
    }

    public Message onPreMessageReceived(Peer peer, Message m) {
        // Just pass the message right through for further processing.
        return m;
    }

    public void onTransaction(Peer peer, Transaction t) {
    }

    public List<Message> getData(Peer peer, GetDataMessage m) {
        return null;
    }

    @Override
    public void onException(Throwable throwable) {
    }
}

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

package com.google.bitcoin.core;

import java.util.List;

/**
 * Convenience implementation of {@link PeerEventListener}.
 */
public class AbstractPeerEventListener implements PeerEventListener {
    @Override
    public void onBlocksDownloaded(Peer peer, Block block, int blocksLeft) {
    }

    @Override
    public void onChainDownloadStarted(Peer peer, int blocksLeft) {
    }

    @Override
    public void onPeerConnected(Peer peer, int peerCount) {
    }

    @Override
    public void onPeerDisconnected(Peer peer, int peerCount) {
    }

    @Override
    public Message onPreMessageReceived(Peer peer, Message m) {
        // Just pass the message right through for further processing.
        return m;
    }

    @Override
    public void onTransaction(Peer peer, Transaction t) {
    }

    @Override
    public List<Message> getData(Peer peer, GetDataMessage m) {
        return null;
    }

    @Override
    public void onException(Throwable throwable) {
    }
}

Add @Override annotations to PeerEventListener.


package examples.helloworld;

import com.vtence.molecule.WebServer;

import java.io.IOException;

public class HelloWorldExample {

    public void run(WebServer server) throws IOException {
        server.start((request, response) -> response.done("Hello, World!"));
    }

    public static void main(String[] args) throws IOException {
        HelloWorldExample example = new HelloWorldExample();
        // Run the default web server
        WebServer webServer = WebServer.create();
        example.run(webServer);
        System.out.println("Access at " + webServer.uri());
    }
}

package examples.helloworld;

import com.vtence.molecule.WebServer;

import java.io.IOException;

/**
 * In this example, we run a single application that responds <i>Hello, World!</i> to all incoming requests.
 * This is as simple as it can get.
 */
public class HelloWorldExample {

    public void run(WebServer server) throws IOException {
        // Start the default web server and provide a single application, which
        // responds to all incoming requests.
        server.start((request, response) -> response.done("Hello, World!"));
    }

    public static void main(String[] args) throws IOException {
        HelloWorldExample example = new HelloWorldExample();
        // Run the default web server
        WebServer webServer = WebServer.create();
        example.run(webServer);
        System.out.println("Access at " + webServer.uri());
    }
}

Add inline doc for the helloworld example


/*
Copyright 2012 Selenium committers
Copyright 2012 Software Freedom Conservancy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.thoughtworks.selenium.thirdparty;

import com.thoughtworks.selenium.InternalSelenseTestBase;

import org.testng.annotations.Test;

public class YahooHttpsTest extends InternalSelenseTestBase {

  @Test(dataProvider = "system-properties")
  public void testYahoo() throws Exception {
    // this site has **two** HTTPS hosts (akamai and yahoo), so it's a good test of the new
    // multi-domain keystore support we just added
    selenium
        .open("https://login11.marketingsolutions.yahoo.com/adui/signin/loadSignin.do?d=U2FsdGVkX1_evOPYuoCCKbeDENMTzoQ6O.oTzifl7TwsO8IqXh6duToE2tI2&p=11&s=21");
  }

}

/*
Copyright 2012 Selenium committers
Copyright 2012 Software Freedom Conservancy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.thoughtworks.selenium.thirdparty;

import com.thoughtworks.selenium.InternalSelenseTestBase;

import org.junit.After;
import org.junit.Test;

public class YahooHttpsTest extends InternalSelenseTestBase {

  @After
  public void resetTimeout() {
    selenium.setTimeout("30000");
  }

  @Test
  public void testYahoo() throws Exception {
    selenium.setTimeout("120000");

    // this site has **two** HTTPS hosts (akamai and yahoo), so it's a good test of the new
    // multi-domain keystore support we just added
    selenium
        .open(
            "https://login11.marketingsolutions.yahoo.com/adui/signin/loadSignin.do?d=U2FsdGVkX1_evOPYuoCCKbeDENMTzoQ6O.oTzifl7TwsO8IqXh6duToE2tI2&p=11&s=21");
  }

}

Convert the https test that we never run to use junit.


package participants;

import dices.DiceCollection;

public class Defender extends BattleParticipant {

    private static final int MIN_ARMY_SIZE = 1;
    private static final int MAX_DICES_NUM = 2;

    public Defender(int armySize) {
        super(armySize);
    }

    @Override
    public int getMinArmySize() {
        return 1;
    }

    @Override
    protected void setDiceCollection(final int armySize) {
        int effectiveArmySize = armySize;
        diceCollection = new DiceCollection((armySize < MAX_DICES_NUM) ?
                armySize : MAX_DICES_NUM, DICE_FACES_NUM);
    }
}

package participants;

import dices.DiceCollection;

public class Defender extends BattleParticipant {

    private static final int MIN_ARMY_SIZE = 1;
    private static final int MAX_DICES_NUM = 2;

    public Defender(int armySize) {
        super(armySize);
    }

    @Override
    public int getMinArmySize() {
        return 1;
    }

    @Override
    protected void setDiceCollection(final int armySize) {
        int effectiveArmySize = armySize;
        diceCollection = new DiceCollection((effectiveArmySize < MAX_DICES_NUM) ?
                effectiveArmySize : MAX_DICES_NUM, DICE_FACES_NUM);
    }
}

Use effective army size when creating dice collection


package de.philipphager.disclosure.feature.analyser.app;

import dalvik.system.DexFile;
import de.philipphager.disclosure.database.app.model.App;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import rx.Observable;
import timber.log.Timber;

public class Apk {
  private static final int MIN_INDEX = 0;
  private final App app;
  private List<String> sortedClassNames;

  public Apk(App app) throws IOException {
    this.app = app;
    load();
  }

  private void load() throws IOException {
    DexFile dexFile = new DexFile(app.sourceDir());
    List<String> classNames = Collections.list(dexFile.entries());

    sortedClassNames = Observable.from(classNames)
        .distinct()
        .toSortedList()
        .toBlocking()
        .first();
  }

  public boolean containsPackage(String packageName) {
    String currentThread = Thread.currentThread().getName();
    Timber.d("%s : Searching for package %s in app %s", currentThread, packageName, app.label());

    int index = Collections.binarySearch(sortedClassNames, packageName, (currentItem, key) -> {
      if(currentItem.startsWith(key)) {
        return 0;
      }
      return currentItem.compareTo(key);
    });
    return index >= MIN_INDEX;
  }
}

package de.philipphager.disclosure.feature.analyser.app;

import dalvik.system.DexFile;
import de.philipphager.disclosure.database.app.model.App;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import rx.Observable;
import timber.log.Timber;

public class Apk {
  private static final int MIN_INDEX = 0;
  private final App app;
  private List<String> sortedClassNames;

  public Apk(App app) throws IOException {
    this.app = app;
    load();
  }

  private void load() throws IOException {
    File file = new File(app.sourceDir());
    List<String> classNames = new ArrayList<>();

    if (file.exists()) {
      DexFile dexFile = new DexFile(app.sourceDir());
      classNames.addAll(Collections.list(dexFile.entries()));
    }

    sortedClassNames = Observable.from(classNames)
        .distinct()
        .toSortedList()
        .toBlocking()
        .first();
  }

  public boolean containsPackage(String packageName) {
    String currentThread = Thread.currentThread().getName();
    Timber.d("%s : Searching for package %s in app %s", currentThread, packageName, app.label());

    int index = Collections.binarySearch(sortedClassNames, packageName, (currentItem, key) -> {
      if (currentItem.startsWith(key)) {
        return 0;
      }
      return currentItem.compareTo(key);
    });
    return index >= MIN_INDEX;
  }
}

Fix not existing .apks failing


/*
 * 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.cassandra.gms;

public enum ApplicationState
{
    STATUS,
    LOAD,
    SCHEMA,
    DC,
    RACK,
    RELEASE_VERSION,
    REMOVAL_COORDINATOR,
    X_11_PADDING, // padding specifically for 1.1
    INTERNAL_IP,
    RPC_ADDRESS,
    SEVERITY,
    NET_VERSION,
    // pad to allow adding new states to existing cluster
    X1,
    X2,
    X3,
    X4,
    X5,
}

/*
 * 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.cassandra.gms;

public enum ApplicationState
{
    STATUS,
    LOAD,
    SCHEMA,
    DC,
    RACK,
    RELEASE_VERSION,
    REMOVAL_COORDINATOR,
    X_11_PADDING, // padding specifically for 1.1
    INTERNAL_IP,
    RPC_ADDRESS,
    SEVERITY,
    NET_VERSION,
    // pad to allow adding new states to existing cluster
    X1,
    X2,
    X3,
    X4,
    X5,
    X6,
    X7,
    X8,
    X9,
    X10,
}

Add more padding to in case of gossipocalypse.


package seedu.address.logic.parser;

import java.util.regex.Pattern;

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

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

    /* Prefix definitions */
    public static final Prefix PREFIX_BOOK_DATE = new Prefix("on ");
    public static final Prefix PREFIX_BOOK_DATE_DELIMITER = new Prefix(",");
    public static final Prefix PREFIX_DEADLINE = new Prefix("by ");
    public static final Prefix PREFIX_TIMEINTERVAL_END = new Prefix("to ");
    public static final Prefix PREFIX_TIMEINTERVAL_START = new Prefix("from ");
    public static final Prefix PREFIX_LABEL = new Prefix("#");
    public static final Prefix PREFIX_STATUS_COMPLETED = new Prefix("COMPLETED");
    public static final Prefix PREFIX_STATUS_INCOMPLETE = new Prefix("INCOMPLETE");

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

}

package seedu.address.logic.parser;

import java.util.regex.Pattern;

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

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

    /* Prefix definitions */
    public static final Prefix PREFIX_BOOK_DATE = new Prefix("on ");
    public static final Prefix PREFIX_BOOK_DATE_DELIMITER = new Prefix(",");
    public static final Prefix PREFIX_DEADLINE = new Prefix("by ");
    public static final Prefix PREFIX_TIMEINTERVAL_END = new Prefix("to ");
    public static final Prefix PREFIX_TIMEINTERVAL_START = new Prefix("from ");
    public static final Prefix PREFIX_LABEL = new Prefix("#");
    public static final Prefix PREFIX_STATUS_COMPLETED = new Prefix("completed");
    public static final Prefix PREFIX_STATUS_INCOMPLETE = new Prefix("incomplete");

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

}

Change keyword from CAPS to small letter


package tools.devnull.trugger;

import org.mockito.stubbing.Answer;
import tools.devnull.trugger.reflection.Reflection;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.List;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * @author Marcelo Guimarães
 */
public class AnnotationMock {

  private static final Answer returnType(Class annotationType) {
    return (i) -> annotationType;
  }

  public static <T extends Annotation> T mockAnnotation(Class<T> annotationType) {
    T annotation = mock(annotationType);
    when(annotation.annotationType()).then(returnType(annotationType));
    List<Method> methods = Reflection.reflect().methods()
        .filter(method -> method.getDefaultValue() != null)
        .in(annotationType);
    // maps the methods with default value
    for (Method method : methods) {
      when(Reflection.invoke(method).in(annotation).withoutArgs())
          .thenReturn(method.getDefaultValue());
    }
    return annotation;
  }

}

package tools.devnull.trugger;

import tools.devnull.trugger.reflection.Reflection;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.List;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * @author Marcelo Guimarães
 */
public class AnnotationMock {

  public static <T extends Annotation> T mockAnnotation(Class<T> annotationType) {
    T annotation = mock(annotationType);
    when(annotation.annotationType()).then(invocation -> annotationType);
    List<Method> methods = Reflection.reflect().methods()
        .filter(method -> method.getDefaultValue() != null)
        .in(annotationType);
    // maps the methods with default value
    methods.forEach(method ->
        when(Reflection.invoke(method).in(annotation).withoutArgs())
            .thenReturn(method.getDefaultValue()));
    return annotation;
  }

}

Improve code for annotation mock


package com.xxzhwx.core.runs;

import com.xxzhwx.core.net.Cmd;
import com.xxzhwx.core.queue.BaseQueue;

import java.util.concurrent.TimeUnit;

public abstract class AbstractCmdRunnable implements Runnable {
    private BaseQueue<Cmd> cmdQueue;

    public AbstractCmdRunnable(BaseQueue<Cmd> cmdQueue) {
        this.cmdQueue = cmdQueue;
    }

    public void run() {
        for (;;) {
            Cmd cmd;
            while (cmdQueue.size() > 0) {
                cmd = cmdQueue.poll();
                if (cmd != null) {
                    handleCmd(cmd);
                }
            }

            try {
                TimeUnit.MILLISECONDS.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public abstract  void handleCmd(Cmd cmd);
}

package com.xxzhwx.core.runs;

import com.xxzhwx.core.net.Cmd;
import com.xxzhwx.core.queue.BaseQueue;

import java.util.concurrent.TimeUnit;

public abstract class AbstractCmdRunnable implements Runnable {
    private BaseQueue<Runnable> taskQueue;
    private BaseQueue<Cmd> cmdQueue;

    public AbstractCmdRunnable(BaseQueue<Cmd> cmdQueue) {
        this.taskQueue = new BaseQueue<>();
        this.cmdQueue = cmdQueue;
    }

    public void submitTask(Runnable task) {
        taskQueue.put(task);
    }

    public void run() {
        for (;;) {
            Runnable task;
            while (taskQueue.size() > 0) {
                task = taskQueue.poll();
                if (task != null) {
                    task.run();
                }
            }

            Cmd cmd;
            while (cmdQueue.size() > 0) {
                cmd = cmdQueue.poll();
                if (cmd != null) {
                    handleCmd(cmd);
                }
            }

            try {
                TimeUnit.MILLISECONDS.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public abstract  void handleCmd(Cmd cmd);
}

Support executing tasks in the main loop(Command Runnable).


package nl.pdok.catalog.featured;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class DatabaseMapping {

    private String[] array;

    public String[] getArray() {
        return array;
    }

    public void setArray(String[] array) {
        this.array = array;
    }
}

package nl.pdok.catalog.featured;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class DatabaseMapping {

    private String[] array;

    private String[] unnest;

    public String[] getArray() {
        return array;
    }

    public void setArray(String[] array) {
        this.array = array;
    }

    public String[] getUnnest() {
        return unnest;
    }

    public void setUnnest(String[] unnest) {
        this.unnest = unnest;
    }
}

Add support for 'unnest' in featured database mapping


package roycurtis.signshopexport.json;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

public class Exclusions implements ExclusionStrategy
{
    @Override
    public boolean shouldSkipField(FieldAttributes f)
    {
        String name = f.getName();

        // Ignore book page contents
        return name.equalsIgnoreCase("pages")
            // Ignore unsupported tags
            || name.equalsIgnoreCase("unhandledTags")
            // Ignore redundant data object
            || name.equalsIgnoreCase("data")
            // Ignore hide flags
            || name.equalsIgnoreCase("hideFlag")
            // Ignore shield patterns
            || name.equalsIgnoreCase("blockEntityTag");
    }

    @Override
    public boolean shouldSkipClass(Class<?> clazz)
    {
        String name = clazz.getSimpleName();
        return name.equalsIgnoreCase("ChatComponentText");
    }
}

package roycurtis.signshopexport.json;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

public class Exclusions implements ExclusionStrategy
{
    @Override
    public boolean shouldSkipField(FieldAttributes f)
    {
        String name = f.getName();

        // Ignore book page contents
        return name.equalsIgnoreCase("pages")
            // Ignore unsupported tags
            || name.equalsIgnoreCase("unhandledTags")
            // Ignore redundant data object
            || name.equalsIgnoreCase("data")
            // Ignore hide flags
            || name.equalsIgnoreCase("hideFlag")
            // Ignore shield patterns
            || name.equalsIgnoreCase("blockEntityTag");
    }

    @Override
    public boolean shouldSkipClass(Class<?> clazz)
    {
        String name = clazz.getSimpleName();

        if ( name.equalsIgnoreCase("ItemStack") )
        if ( clazz.getTypeName().startsWith("net.minecraft.server") )
            return true;

        return name.equalsIgnoreCase("ChatComponentText");
    }
}

Fix Minecraft ItemStacks being serialized


package com.grayben.riskExtractor.htmlScorer;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static junit.framework.TestCase.fail;

/**
 * Created by beng on 28/11/2015.
 */
@RunWith(MockitoJUnitRunner.class)
public class TreeHtmlScorerTest
        extends HtmlScorerTest {

    @Before
    public void setUp() throws Exception {
        super.setUp();
        setHtmlScorer(new TreeHtmlScorer());
    }

    @After
    public void tearDown() throws Exception {
        setHtmlScorer(null);
    }

    @Override
    @Test
    public void test_ScoreHtmlReturnsExpected_WhenTextInputIsSimple
            () throws Exception {
        fail("Test not implemented");
    }

    @Override
    @Test
    public void test_ScoreHtmlReturnsExpected_WhenTextInputIsComplicated
            () throws Exception {
        fail("Test not implemented");
    }
}

package com.grayben.riskExtractor.htmlScorer;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static junit.framework.TestCase.fail;

/**
 * Created by beng on 28/11/2015.
 */
@RunWith(MockitoJUnitRunner.class)
public class TreeHtmlScorerTest
        extends HtmlScorerTest {

    @Before
    public void setUp() throws Exception {
        super.setUp();
        setHtmlScorer(new TreeHtmlScorer());
    }

    @After
    public void tearDown() throws Exception {
        setHtmlScorer(null);
    }

    @Override
    @Test
    public void
    test_ScoreHtmlReturnsExpected_WhenTextInputIsSimple
            () throws Exception {
        fail("Test not implemented");
    }

    @Override
    @Test
    public void
    test_ScoreHtmlReturnsExpected_WhenTextInputIsComplicated
            () throws Exception {
        fail("Test not implemented");
    }

    @Test
    public void
    test_ScoreHtmlThrowsNullPointerException_WhenUrlIsNull
            () throws Exception {
        fail("Test not implemented");
    }

    @Test
    public void
    test_ScoreHtmlThrowsNullPointerException_WhenHtmlFileIsNull
            () throws Exception {
        fail("Test not implemented");
    }

    @Test
    public void
    test_ScoreHtmlThrowsNullPointerException_WhenCharsetNameIsNull
            () throws Exception {
        fail("Test not implemented");
    }
}

Add tests for null check


package org.realityforge.gwt.eventsource.client;

import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
import javax.annotation.Nonnull;

final class TestEventSource
  extends EventSource
{
  static class Factory
    implements EventSource.Factory
  {
    @Override
    public EventSource newEventSource()
    {
      return new TestEventSource( new SimpleEventBus() );
    }
  }

  TestEventSource( final EventBus eventBus )
  {
    super( eventBus );
  }

  @Override
  public void open( @Nonnull final String url, final boolean withCredentials )
  {
  }

  @Override
  public boolean subscribeTo( @Nonnull final String messageType )
    throws IllegalStateException
  {
    return false;
  }

  @Override
  public boolean unsubscribeFrom( @Nonnull final String messageType )
    throws IllegalStateException
  {
    return false;
  }

  @Override
  @Nonnull
  public String getURL()
  {
    return "";
  }

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

  @Override
  public void close()
  {
  }

  @Nonnull
  @Override
  public ReadyState getReadyState()
  {
    return ReadyState.CLOSED;
  }
}

package org.realityforge.gwt.eventsource.client;

import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
import javax.annotation.Nonnull;

public final class TestEventSource
  extends EventSource
{
  static class Factory
    implements EventSource.Factory
  {
    @Override
    public EventSource newEventSource()
    {
      return new TestEventSource( new SimpleEventBus() );
    }
  }

  public TestEventSource( final EventBus eventBus )
  {
    super( eventBus );
  }

  @Override
  public void open( @Nonnull final String url, final boolean withCredentials )
  {
  }

  @Override
  public boolean subscribeTo( @Nonnull final String messageType )
    throws IllegalStateException
  {
    return false;
  }

  @Override
  public boolean unsubscribeFrom( @Nonnull final String messageType )
    throws IllegalStateException
  {
    return false;
  }

  @Override
  @Nonnull
  public String getURL()
  {
    return "";
  }

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

  @Override
  public void close()
  {
  }

  @Nonnull
  @Override
  public ReadyState getReadyState()
  {
    return ReadyState.CLOSED;
  }
}

Make the class public to use from other packages


package com.fns.xlator.client.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.metrics.CounterService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;

@Service
public class CacheService {

    private final Logger log = LoggerFactory.getLogger(getClass());

    private CounterService counterService;

    @Autowired
    public CacheService(CounterService counterService) {
        this.counterService = counterService;
    }

    @CacheEvict("translations")
    public void evictTranslation(String source, String target, String text) {
        counterService.increment("services.frengly.cacheKey.eviction");
        log.info("Key w/ source [{}], target [{}], and text [{}] removed from cache!");
    }

}

package com.fns.xlator.client.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.metrics.CounterService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;

@Service
public class CacheService {

    private final Logger log = LoggerFactory.getLogger(getClass());

    private CounterService counterService;

    @Autowired
    public CacheService(CounterService counterService) {
        this.counterService = counterService;
    }

    @CacheEvict("translations")
    public void evictTranslation(String source, String target, String text) {
        counterService.increment("services.cache.key.eviction");
        log.info("Key w/ source [{}], target [{}], and text [{}] removed from cache!", source, target, text);
    }

}

Fix cache key eviction counter and log output


//
// $Id: ShadowTile.java,v 1.1 2001/10/13 01:08:59 shaper Exp $

package com.threerings.miso.tile;

import java.awt.Graphics2D;
import java.awt.Shape;

/**
 * The shadow tile extends miso tile to provide an always-impassable
 * tile that has no display image.  Shadow tiles are intended for
 * placement in the footprint of {@link ObjectTile} objects.
 */
public class ShadowTile extends MisoTile
{
    /** Single instantiation of shadow tile for re-use in scenes. */
    public static ShadowTile TILE = new ShadowTile();

    /**
     * Constructs a shadow tile.
     */
    public ShadowTile ()
    {
        super(SHADOW_TSID, SHADOW_TID);

        // shadow tiles are always impassable
        passable = false;
    }

    // documentation inherited
    public void paint (Graphics2D gfx, Shape dest)
    {
        // paint nothing as we're naught but a measly shadow of a tile
    }

    /** The shadow tile set id. */
    protected static final int SHADOW_TSID = -1;

    /** The shadow tile id. */
    protected static final int SHADOW_TID = -1;
}

//
// $Id: ShadowTile.java,v 1.2 2001/10/17 22:22:03 shaper Exp $

package com.threerings.miso.tile;

import java.awt.Graphics2D;
import java.awt.Shape;

/**
 * The shadow tile extends miso tile to provide an always-impassable
 * tile that has no display image.  Shadow tiles are intended for
 * placement in the footprint of {@link
 * com.threerings.media.tile.ObjectTile} objects.
 */
public class ShadowTile extends MisoTile
{
    /** The scene coordinates of the shadow tile's parent object tile. */
    public int ox, oy;

    /**
     * Constructs a shadow tile.
     */
    public ShadowTile (int x, int y)
    {
        super(SHADOW_TSID, SHADOW_TID);

        // save the coordinates of our parent object tile
        ox = x;
        oy = y;

        // shadow tiles are always impassable
        passable = false;
    }

    // documentation inherited
    public void paint (Graphics2D gfx, Shape dest)
    {
        // paint nothing as we're naught but a measly shadow of a tile
    }

    /** The shadow tile set id. */
    protected static final int SHADOW_TSID = -1;

    /** The shadow tile id. */
    protected static final int SHADOW_TID = -1;
}

Store and make available the parent object associated with the shadow tile.


package spark.elastic;

import static org.elasticsearch.spark.rdd.api.java.JavaEsSpark.esRDD;

import java.util.Map;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

public class ReadingFromES {

	private static final String es_nodes = "localhost";
	private static final String es_port = "9200";
	private static final String index = "spark";
	private static final String mapping = "json";

	public static void main(String[] args) {

		// Create Spark configuration
		SparkConf conf = new SparkConf();
		conf.setAppName("ReadingFromES");
		conf.setMaster("local[2]");
		conf.set("es.nodes", es_nodes);
		conf.set("es.port", es_port);

		JavaSparkContext context = new JavaSparkContext(conf);

		// Keys: fieldName, values: fieldValue
		JavaRDD<Map<String, Object>> javaRDD = esRDD(context, index + "/" + mapping).values();
		javaRDD.foreach(rdd -> System.out.println(rdd.values()));
	}

}

package spark.elastic;

import static org.elasticsearch.spark.rdd.api.java.JavaEsSpark.esRDD;

import java.util.Map;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

public class ReadingFromES {

	private static final String es_nodes = "localhost";
	private static final String es_port = "9200";
	private static final String index = "spark";
	private static final String mapping = "json";

	public static void main(String[] args) {

		// Create Spark configuration
		SparkConf conf = new SparkConf();
		conf.setAppName("ReadingFromES");
		conf.setMaster("local[2]");
		conf.set("es.nodes", es_nodes);
		conf.set("es.port", es_port);

		JavaSparkContext context = new JavaSparkContext(conf);

		// Keys: fieldName, values: fieldValue
		JavaRDD<Map<String, Object>> javaRDD = esRDD(context, index + "/" + mapping).values();
		javaRDD.foreach(rdd -> System.out.println(rdd.values()));

		context.stop();
	}

}

Add context.stop() and the end of the class.


package com.example.activity;

import com.example.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertTrue;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 18)
public class DeckardActivityTest {

    @Test
    public void testSomething() throws Exception {
        assertTrue(Robolectric.buildActivity(DeckardActivity.class).create().get() != null);
    }
}

package com.example.activity;

import com.example.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertTrue;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 18)
public class DeckardActivityTest {

    @Test
    public void testSomething() throws Exception {
        assertTrue(Robolectric.setupActivity(DeckardActivity.class) != null);
    }
}

Use setup instead of build for activity test


package edu.stuy.starlorn.upgrades;

public class DoubleShotUpgrade extends GunUpgrade {
    private int _shotNum;

    public DoubleShotUpgrade() {
        super();
        _shotNum = 0;
    }

    @Override
    public int getNumShots() {
        return 2;
    }

    @Override
    public double getAimAngle() {
        if (_shotNum == 0) {
            _shotNum++;
            return Math.PI/8;
        } else if (_shotNum == 1) {
            _shotNum--;
            return -Math.PI/8;
        } else { // If those failed, something weird is going on, reset and aim straight.
            _shotNum = 0;
            return 0;
        }
    }
}

package edu.stuy.starlorn.upgrades;

public class DoubleShotUpgrade extends GunUpgrade {
    private boolean _shotNum;

    public DoubleShotUpgrade() {
        super();
        _shotNum = false;
    }

    @Override
    public int getNumShots() {
        return 2;
    }

    @Override
    public double getAimAngle() {
        int direction = 0;
        if (_shotNum) {
            _shotNum = !_shotNum;
            direction = 1;
        } else if (!_shotNum) {
            _shotNum = !_shotNum;
            direction = -1;
        }
        return direction * Math.PI/8;
    }
}

Change DoubleShot to use a boolean


package org.jctools.queues;

import org.jctools.queues.spec.ConcurrentQueueSpec;
import org.jctools.queues.spec.Ordering;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.ArrayList;
import java.util.Collection;

import static org.jctools.util.PortableJvmInfo.CPUs;

@RunWith(Parameterized.class)
public class MpqSanityTestMpscCompound extends MpqSanityTest
{
    public MpqSanityTestMpscCompound(ConcurrentQueueSpec spec, MessagePassingQueue<Integer> queue)
    {
        super(spec, queue);
    }

    @Parameterized.Parameters
    public static Collection<Object[]> parameters()
    {
        ArrayList<Object[]> list = new ArrayList<Object[]>();
        list.add(makeMpq(0, 1, CPUs, Ordering.NONE, null));// MPSC size 1
        list.add(makeMpq(0, 1, SIZE, Ordering.NONE, null));// MPSC size SIZE
        return list;
    }
}

package org.jctools.queues;

import org.jctools.queues.spec.ConcurrentQueueSpec;
import org.jctools.queues.spec.Ordering;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.ArrayList;
import java.util.Collection;

import static org.jctools.util.PortableJvmInfo.CPUs;

@RunWith(Parameterized.class)
@Ignore
public class MpqSanityTestMpscCompound extends MpqSanityTest
{
    public MpqSanityTestMpscCompound(ConcurrentQueueSpec spec, MessagePassingQueue<Integer> queue)
    {
        super(spec, queue);
    }

    @Parameterized.Parameters
    public static Collection<Object[]> parameters()
    {
        ArrayList<Object[]> list = new ArrayList<Object[]>();
        list.add(makeMpq(0, 1, CPUs, Ordering.NONE, null));// MPSC size 1
        list.add(makeMpq(0, 1, SIZE, Ordering.NONE, null));// MPSC size SIZE
        return list;
    }
}

Disable test until bug fixed.


package com.intellij.debugger.streams.trace.smart;

import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public class TraceElementImpl implements TraceElement {
  private final int myTime;
  private final Value myValue;

  public TraceElementImpl(int time, @NotNull Value value) {
    myTime = time;
    myValue = value;
  }

  @Override
  public int getTime() {
    return myTime;
  }

  @NotNull
  @Override
  public Value getValue() {
    return myValue;
  }
}

package com.intellij.debugger.streams.trace.smart;

import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
 * @author Vitaliy.Bibaev
 */
public class TraceElementImpl implements TraceElement {
  private final int myTime;
  private final Value myValue;

  public TraceElementImpl(int time, @NotNull Value value) {
    myTime = time;
    myValue = value;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj instanceof TraceElement) {
      final int time = ((TraceElement)obj).getTime();
      final Value value = ((TraceElement)obj).getValue();
      return time == myTime && myValue.equals(value);
    }

    return false;
  }

  @Override
  public int hashCode() {
    return Objects.hash(myTime, myValue);
  }

  @Override
  public int getTime() {
    return myTime;
  }

  @NotNull
  @Override
  public Value getValue() {
    return myValue;
  }
}

Add equals/hashCode into TraceElement implementation


package edu.washington.escience.myria.operator;

import java.util.Objects;

import com.google.common.base.Preconditions;

import edu.washington.escience.myria.Schema;

public abstract class NAryOperator extends Operator {

  /**
   * The children of the n-ary operator.
   * */
  protected Operator[] children;

  public NAryOperator() {
    super();
  }

  @Override
  public Operator[] getChildren() {
    return children;
  }

  @Override
  public void setChildren(final Operator[] children) {
    Objects.requireNonNull(children);
    Preconditions.checkArgument(children.length > 0);
    this.children = children;
  }

  @Override
  public Schema getSchema() {
    return children[0].getSchema();
  }

  /**
   * @return number of children
   */
  protected int numChildren() {
    return children.length;
  }

}

package edu.washington.escience.myria.operator;

import java.util.Objects;

import com.google.common.base.Preconditions;

import edu.washington.escience.myria.Schema;

/**
 *
 * @author dominik
 *
 */
public abstract class NAryOperator extends Operator {

  /** Required for Java serialization. */
  private static final long serialVersionUID = 1L;

  /**
   * The children of the n-ary operator.
   * */
  protected Operator[] children;

  /**
   * Default, empty constructor.
   */
  public NAryOperator() {
    super();
  }

  @Override
  public Operator[] getChildren() {
    return children;
  }

  @Override
  public void setChildren(final Operator[] children) {
    Objects.requireNonNull(children);
    Preconditions.checkArgument(children.length > 0);
    this.children = children;
  }

  @Override
  public Schema getSchema() {
    return children[0].getSchema();
  }

  /**
   * @return number of children
   */
  protected int numChildren() {
    return children.length;
  }

}

Write comments in n-ary operator


package org.monospark.actioncontrol;

import java.nio.file.Path;

import org.monospark.actioncontrol.config.ConfigParseException;
import org.monospark.actioncontrol.group.Group;
import org.monospark.actioncontrol.handler.ActionHandler;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.event.Event;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameInitializationEvent;
import org.spongepowered.api.plugin.Plugin;

import com.google.inject.Inject;

@Plugin(id = "actionpermissions", name = "ActionPermissions", version = "1.0")
public class ActionControl {

	@Inject
	@ConfigDir(sharedRoot = false)
	private Path privateConfigDir;

	@Listener
	public void onServerInit(GameInitializationEvent event) {
		for(ActionHandler<?, ?> handler : ActionHandler.ALL) {
			registerActionHandler(handler);
		}

		try {
			Group.getRegistry().loadGroups(privateConfigDir);
		} catch (ConfigParseException e) {
			e.printStackTrace();
		}
	}

	private <E extends Event> void registerActionHandler(ActionHandler<E, ?> handler) {
		Sponge.getGame().getEventManager().registerListener(this, handler.getEventClass(), handler);
	}
}

package org.monospark.actioncontrol;

import java.nio.file.Path;

import org.monospark.actioncontrol.config.ConfigParseException;
import org.monospark.actioncontrol.group.Group;
import org.monospark.actioncontrol.handler.ActionHandler;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.event.Event;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameInitializationEvent;
import org.spongepowered.api.plugin.Plugin;

import com.google.inject.Inject;

@Plugin(id = "actioncontrol", name = "ActionControl", version = "1.0")
public class ActionControl {

	@Inject
	@ConfigDir(sharedRoot = false)
	private Path privateConfigDir;

	@Listener
	public void onServerInit(GameInitializationEvent event) {
		for(ActionHandler<?, ?> handler : ActionHandler.ALL) {
			registerActionHandler(handler);
		}

		try {
			Group.getRegistry().loadGroups(privateConfigDir);
		} catch (ConfigParseException e) {
			e.printStackTrace();
		}
	}

	private <E extends Event> void registerActionHandler(ActionHandler<E, ?> handler) {
		Sponge.getGame().getEventManager().registerListener(this, handler.getEventClass(), handler);
	}
}

Rename plugin id as well


package com.blocksolid.okrello;

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

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

package com.blocksolid.okrello;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.ProgressBar;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    public static ProgressBar progressBar;
    public static Button getListsBtn;
    public static ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        progressBar = (ProgressBar) findViewById(R.id.main_progress);
        progressBar.setVisibility(View.INVISIBLE);

        getListsBtn = (Button) findViewById(R.id.main_btn_get_lists);
        listView = (ListView) findViewById(R.id.main_list_lists);

        getListsBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getLists();
            }
        });
    }

    private void getLists() {
        // Show progress indicator while working
        progressBar.setVisibility(View.VISIBLE);

        // TODO make retrofit call to capture Lists to an array
        // TODO get list names to an array of strings
        // Manually created array for the purpose of testing

        // Populate list view with strings from array
        ArrayList<String> trelloListsArray = new ArrayList<>();
        trelloListsArray.add(0, "Q1 2015");
        trelloListsArray.add(1, "Q2 2015");
        trelloListsArray.add(2, "Q3 2015");
        trelloListsArray.add(3, "Q4 2015");

        listView.setAdapter(new ArrayAdapter<>(MainActivity.this, android.R.layout.simple_list_item_1, trelloListsArray));

        // Hide progress indicator when done
        progressBar.setVisibility(View.INVISIBLE);

    }
}

Add button to app that displays list populated from dummy array


// Copyright (c) 2014, Christopher "blay09" Baker
// All rights reserved.

package net.blay09.mods.eirairc.config.base;

public class ServiceSettings {

	private final String identifyCMD;
	private final String ghostCMD;

	public ServiceSettings(String identifyCMD, String ghostCMD) {
		this.identifyCMD = identifyCMD;
		this.ghostCMD = ghostCMD;
	}

	public String getIdentifyCommand(String username, String password) {
		return identifyCMD.replace("\\{USER\\}", username).replaceAll("\\{PASS\\}", password);
	}

	public String getGhostCommand(String nick, String password) {
		return ghostCMD.replace("\\{NICK\\}", nick).replaceAll("\\{PASS\\}", password);
	}

	public boolean hasGhostCommand() {
		return ghostCMD != null && !ghostCMD.isEmpty();
	}

}

// Copyright (c) 2014, Christopher "blay09" Baker
// All rights reserved.

package net.blay09.mods.eirairc.config.base;

public class ServiceSettings {

	private final String identifyCMD;
	private final String ghostCMD;

	public ServiceSettings(String identifyCMD, String ghostCMD) {
		this.identifyCMD = identifyCMD;
		this.ghostCMD = ghostCMD;
	}

	public String getIdentifyCommand(String username, String password) {
		return identifyCMD.replace("{USER}", username).replace("{PASS}", password);
	}

	public String getGhostCommand(String nick, String password) {
		return ghostCMD.replace("{NICK}", nick).replace("{PASS}", password);
	}

	public boolean hasGhostCommand() {
		return ghostCMD != null && !ghostCMD.isEmpty();
	}

}

Fix Nickserv Authentication being broken.


package org.ligoj.bootstrap.core;

import java.io.Serializable;

/**
 * A named and identified bean
 *
 * @param <K>
 *            The type of the identifier
 */
public interface INamableBean<K extends Serializable> extends Comparable<INamableBean<K>> {

	/**
	 * Bean name.
	 *
	 * @return human readable name.
	 */
	String getName();

	/**
	 * Bean identifier.
	 *
	 * @return identifier.
	 */
	K getId();

	/**
	 * Set the bean name.
	 *
	 * @param name
	 *            The new name.
	 */
	void setName(String name);

	/**
	 * Set the bean identifier.
	 *
	 * @param id
	 *            The new identifier.
	 */
	void setId(K id);

	@Override
	default int compareTo(final INamableBean<K> o) {
		return getName().compareToIgnoreCase(o.getName());
	}
}

package org.ligoj.bootstrap.core;

import java.io.Serializable;

/**
 * A named and identified bean
 *
 * @param <K>
 *            The type of the identifier
 */
public interface INamableBean<K extends Serializable> extends Comparable<INamableBean<K>>, Serializable {

	/**
	 * Bean name.
	 *
	 * @return human readable name.
	 */
	String getName();

	/**
	 * Bean identifier.
	 *
	 * @return identifier.
	 */
	K getId();

	/**
	 * Set the bean name.
	 *
	 * @param name
	 *            The new name.
	 */
	void setName(String name);

	/**
	 * Set the bean identifier.
	 *
	 * @param id
	 *            The new identifier.
	 */
	void setId(K id);

	@Override
	default int compareTo(final INamableBean<K> o) {
		return getName().compareToIgnoreCase(o.getName());
	}
}

Make serializable the named beans


package com.paritytrading.parity.util;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * This class contains utility methods for working with timestamps.
 */
public class Timestamps {

    private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss.SSS");

    private Timestamps() {
    }

    /**
     * Format a timestamp as a string.
     *
     * @param timestampMillis a timestamp in milliseconds
     * @return the timestamp as a string
     */
    public static String format(long timestampMillis) {
        return FORMATTER.format(LocalTime.ofNanoOfDay(timestampMillis % (24 * 60 * 60 * 1000) * 1000 * 1000));
    }

}

package com.paritytrading.parity.util;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * This class contains utility methods for working with timestamps.
 */
public class Timestamps {

    private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss.SSS");

    private Timestamps() {
    }

    /**
     * Format a timestamp as a string.
     *
     * @param timestampMillis a timestamp in milliseconds
     * @return the timestamp as a string
     */
    public static String format(long timestampMillis) {
        return FORMATTER.format(LocalTime.ofNanoOfDay(timestampMillis % (24 * 60 * 60 * 1000) * 1_000_000));
    }

}

Clean up integer literals in utilities


package org.certificatetransparency.ctlog;

import java.util.List;
import org.certificatetransparency.ctlog.PreCert;

public class PrecertChainEntry {
  // The chain certifying the precertificate, as submitted by the CA.
  public List<byte[]> precertificateChain;

  // PreCert input to the SCT. Can be computed from the above.
  // Store it alongside the entry data so that the signers don't have to
  // parse certificates to recompute it.
  public PreCert preCert;

  public PrecertChainEntry() {
    precertificateChain = new java.util.ArrayList<byte[]>();
  }
}

package org.certificatetransparency.ctlog;

import java.util.ArrayList;
import java.util.List;
import org.certificatetransparency.ctlog.PreCert;

public class PrecertChainEntry {
  // The chain certifying the precertificate, as submitted by the CA.
  public List<byte[]> precertificateChain;

  // PreCert input to the SCT. Can be computed from the above.
  // Store it alongside the entry data so that the signers don't have to
  // parse certificates to recompute it.
  public PreCert preCert;

  public PrecertChainEntry() {
    precertificateChain = new ArrayList<byte[]>();
  }
}

Use an import for java.util.ArrayList.


package org.nextrtc.signalingserver;

public interface Names {
    String EVENT_BUS = "nextRTCEventBus";
    String EVENT_DISPATCHER = "nextRTCEventDispatcher";

    String SCHEDULER_SIZE = "${nextrtc.scheduler_size:10}";
    String SCHEDULER_NAME = "nextRTCPingScheduler";
    String SCHEDULED_PERIOD = "${nextrtc.ping_period:3}";
    String MAX_CONNECTION_SETUP_TIME = "${nextrtc.max_connection_setup_time:30}";
}

package org.nextrtc.signalingserver;

public interface Names {
    String EVENT_BUS = "nextRTCEventBus";
    String EVENT_DISPATCHER = "nextRTCEventDispatcher";

    String SCHEDULER_SIZE = "${nextrtc.scheduler_size:50}";
    String SCHEDULER_NAME = "nextRTCPingScheduler";
    String SCHEDULED_PERIOD = "${nextrtc.ping_period:20}";
    String MAX_CONNECTION_SETUP_TIME = "${nextrtc.max_connection_setup_time:30}";
}

Increase ping interval and scheduler size


package com.sheepdog.mashmesh.models;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyFactory;
import com.googlecode.objectify.ObjectifyService;

public class OfyService {
    static {
        factory().register(UserProfile.class);
        factory().register(VolunteerProfile.class);
    }

    public static Objectify ofy() {
        return ObjectifyService.begin();
    }

    public static ObjectifyFactory factory() {
        return ObjectifyService.factory();
    }
}

package com.sheepdog.mashmesh.models;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyFactory;
import com.googlecode.objectify.ObjectifyService;

public class OfyService {
    static {
        factory().register(UserProfile.class);
        factory().register(VolunteerProfile.class);
        factory().register(RideRecord.class);
    }

    public static Objectify ofy() {
        return ObjectifyService.begin();
    }

    public static ObjectifyFactory factory() {
        return ObjectifyService.factory();
    }
}

Fix datastore access: RideRecord was unregistered


package me.nallar.javatransformer.api;

import java.util.*;

public interface Annotated {
	public List<Annotation> getAnnotations();
}

package me.nallar.javatransformer.api;

import java.util.*;

public interface Annotated {
	List<Annotation> getAnnotations();
}

Remove pointless public on interface method


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

 package org.apache.commons.logging;

import org.apache.commons.logging.impl.SimpleLog;

/**
 *
 *
 *
 *
 *
 *
 */
public class SimpleLogTestCase extends AbstractLogTest
{
	/**
	 *
	 *
	 *
	 */
    public Log getLogObject()
    {
        return (Log) new SimpleLog(this.getClass().getName());
    }

    public static void main(String[] args) {
        String[] testCaseName = { SimpleLogTestCase.class.getName() };
        junit.textui.TestRunner.main(testCaseName);
    }
}

Remove whitespace before package declaration.


/*
 * (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;

import org.junit.Before;
import org.junit.BeforeClass;
import org.openqa.selenium.chrome.ChromeDriver;

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

/**
 * Test with Google Chrome browser.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.0.0
 */
public class ChromeTest extends BrowserTestParent {

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

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

}

/*
 * (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;

import org.junit.Before;
import org.junit.BeforeClass;
import org.openqa.selenium.chrome.ChromeDriver;

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

/**
 * Test with Google Chrome browser.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.0.0
 */
public class ChromeTest extends BrowserTestParent {

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

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

}

Clear preferences first in Chrome test


package com.tmitim.twittercli;

import com.github.rvesse.airline.annotations.Cli;
import com.github.rvesse.airline.help.Help;
import com.tmitim.twittercli.commands.DirectMessage;
import com.tmitim.twittercli.commands.Favorite;
import com.tmitim.twittercli.commands.Location;
import com.tmitim.twittercli.commands.TimeLineCommand;
import com.tmitim.twittercli.commands.Trend;
import com.tmitim.twittercli.commands.Tweet;
import com.tmitim.twittercli.commands.Search;

@Cli(
		name = "twitter",
		description = "Provides a basic example CLI",
		defaultCommand = Help.class,
		commands = { Tweet.class, TimeLineCommand.class, Location.class, Trend.class, Search.class, DirectMessage.class,
				Favorite.class, Help.class }
	)
public class TwitterCli {
	public static void main(String[] args) {

		com.github.rvesse.airline.Cli<Runnable> cli = new com.github.rvesse.airline.Cli<>(TwitterCli.class);
		try {
			Runnable cmd = cli.parse(args);
			cmd.run();
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
}

package com.tmitim.twittercli;

import com.github.rvesse.airline.annotations.Cli;
import com.github.rvesse.airline.help.Help;
import com.tmitim.twittercli.commands.DirectMessage;
import com.tmitim.twittercli.commands.Favorite;
import com.tmitim.twittercli.commands.Location;
import com.tmitim.twittercli.commands.TimeLineCommand;
import com.tmitim.twittercli.commands.Trend;
import com.tmitim.twittercli.commands.Tweet;
import com.tmitim.twittercli.commands.Search;

@Cli(
		name = "twitter",
		description = "Twitter CLI", defaultCommand = TimeLineCommand.class,
		commands = { Tweet.class, TimeLineCommand.class, Location.class, Trend.class, Search.class, DirectMessage.class,
				Favorite.class, Help.class }
	)
public class TwitterCli {
	public static void main(String[] args) {

		com.github.rvesse.airline.Cli<Runnable> cli = new com.github.rvesse.airline.Cli<>(TwitterCli.class);
		try {
			Runnable cmd = cli.parse(args);
			cmd.run();
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
}

Change default command to timeline


package io.collap.bryg.compiler.ast;

import io.collap.bryg.compiler.context.Context;

import java.io.PrintStream;

public abstract class Node {

    protected Context context;
    private int line = 0;

    protected Node (Context context) {
        this.context = context;
    }

    /**
     * IMPORTANT NOTE: All (named) variables *must* be resolved in the Node constructors. Using any "current" Scope in the `compile`
     * method yields undefined behaviour! The root scope can be used to allocate space for anonymous temporal variables.
     */
    public abstract void compile ();

    public void print (PrintStream out, int depth) {
        /* Print line number with indent. */
        String lineStr;
        if (line > 0) {
            lineStr = line + ":  ";
        }else {
            lineStr = "   ";
        }
        for (int i = lineStr.length (); i < 7; ++i) {
            out.print (' ');
        }
        out.print (lineStr);

        /* Print depth node indent. */
        for (int i = 0; i < depth; ++i) {
            out.print ("  ");
        }

        /* Print class name. */
        out.println (getClass ().getSimpleName ());
    }

    public int getLine () {
        return line;
    }

    protected void setLine (int line) {
        this.line = line;
    }

}

package io.collap.bryg.compiler.ast;

import io.collap.bryg.compiler.context.Context;

import java.io.PrintStream;

public abstract class Node {

    protected Context context;

    /**
     * A line of -1 indicates that the line has not been set!
     */
    private int line = -1;

    protected Node (Context context) {
        this.context = context;
    }

    /**
     * IMPORTANT NOTE: All (named) variables *must* be resolved in the Node constructors. Using any "current" Scope in the `compile`
     * method yields undefined behaviour! The root scope can be used to allocate space for anonymous temporal variables.
     */
    public abstract void compile ();

    public void print (PrintStream out, int depth) {
        /* Print line number with indent. */
        String lineStr;
        if (line > 0) {
            lineStr = line + ":  ";
        }else {
            lineStr = "   ";
        }
        for (int i = lineStr.length (); i < 7; ++i) {
            out.print (' ');
        }
        out.print (lineStr);

        /* Print depth node indent. */
        for (int i = 0; i < depth; ++i) {
            out.print ("  ");
        }

        /* Print class name. */
        out.println (getClass ().getSimpleName ());
    }

    public int getLine () {
        return line;
    }

    protected void setLine (int line) {
        this.line = line;
    }

}

Set default invalid/unset line to -1, to reduce confusion with 0 being interpreted as the first line.


package org.yecht.ruby;

import org.yecht.Parser;
import org.yecht.ErrorHandler;

import org.jruby.Ruby;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.builtin.IRubyObject;

public class RubyErrHandler implements ErrorHandler {
    private Ruby runtime;

    public RubyErrHandler(Ruby runtime) {
        this.runtime = runtime;
    }

    // rb_syck_err_handler
    public void handle(Parser p, String msg) {
        int endl = p.cursor;
        while(p.buffer.buffer[endl] != 0 && p.buffer.buffer[endl] != '\n') {
            endl++;
        }
        try {
            int lp = p.lineptr;
            if(lp < 0) {
                lp = 0;
            }
            String line = new String(p.buffer.buffer, lp, endl-lp, "ISO-8859-1");
            String m1 = msg + " on line " + p.linect + ", col " + (p.cursor-lp) + ": `" + line + "'";
            throw runtime.newArgumentError(m1);
        } catch(java.io.UnsupportedEncodingException e) {
        }

    }
}

package org.yecht.ruby;

import org.yecht.Parser;
import org.yecht.ErrorHandler;

import org.jruby.Ruby;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.builtin.IRubyObject;

public class RubyErrHandler implements ErrorHandler {
    private Ruby runtime;

    public RubyErrHandler(Ruby runtime) {
        this.runtime = runtime;
    }

    // rb_syck_err_handler
    public void handle(Parser p, String msg) {
        int endl = p.cursor;
        while(p.buffer.buffer[endl] != 0 && p.buffer.buffer[endl] != '\n') {
            endl++;
        }
        try {
            int lp = p.lineptr;
            if(lp < 0) {
                lp = 0;
            }
            int len = endl-lp;
            if(len < 0) {
                len = 0;
            }
            String line = new String(p.buffer.buffer, lp, len, "ISO-8859-1");
            String m1 = msg + " on line " + p.linect + ", col " + (p.cursor-lp) + ": `" + line + "'";
            throw runtime.newArgumentError(m1);
        } catch(java.io.UnsupportedEncodingException e) {
        }

    }
}

Fix an IOOBE - JRUBY-4254


package rox.warpstone.proxy;

import com.google.inject.Inject;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import pnb.utils.services.ItemService;

public class ClientProxy extends CommonProxy{

	@Inject
	ItemService is;

	@Override
	//This method is run in the Core class.
	public void setRenders(){
		//Render items and blocks here using Methods.renderItem() and Methods.renderBlock().
		//This should only be client-side.

		//Rendering the Warp Stone.
		Item warpStone = is.getItem("warp_stone");
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(
				warpStone,
				0,
				new ModelResourceLocation("warpstone:" + warpStone.getUnlocalizedName().substring(5), "inventory"));
	}
}

package rox.warpstone.proxy;

import com.google.inject.Inject;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import pnb.utils.services.ItemService;

public class ClientProxy extends CommonProxy{

	@Inject
	private ItemService is;

	@Override
	//This method is run in the Core class.
	public void setRenders(){
		//Render items and blocks here using Methods.renderItem() and Methods.renderBlock().
		//This should only be client-side.

		//Rendering the Warp Stone.
		Item warpStone = is.getItem("warp_stone");
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(
				warpStone,
				0,
				new ModelResourceLocation("warpstone:" + warpStone.getUnlocalizedName().substring(5), "inventory"));
	}
}

Make the instance variable private


package com.brogrammers.agora.model;

import android.widget.EditText;

public class SimpleLocation {
	private double lat;
	private double lon;

	public SimpleLocation(double d, double e){
		this.lat = d;
		this.lon = e;
	}

	public SimpleLocation(String setLocation) {
		this.locationName = setLocation;
	}

	public double getLat() {
		return lat;
	}

	public double getLon() {
		return lon;
	}
}

package com.brogrammers.agora.model;

import android.widget.EditText;

public class SimpleLocation {
	private double lat;
	private double lon;

	public SimpleLocation(double d, double e){
		this.lat = d;
		this.lon = e;
	}

	public double getLat() {
		return lat;
	}

	public double getLon() {
		return lon;
	}
}

Exclude location name in location object