package net.rebworks.lunchy.domain.places;

import net.rebworks.lunchy.domain.Place;
import net.rebworks.lunchy.resources.LunchResource;

import javax.inject.Inject;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.SortedSet;
import java.util.TreeSet;

public class BynsBistro implements Place {

    private static final TreeSet<String> ALIASES = new TreeSet<>(Arrays.asList("byns", "bynsbistro"));
    public static final String NAME = ALIASES.first();
    final UriInfo uriInfo;

    @Inject
    public BynsBistro(@Context final UriInfo uriInfo) {
        this.uriInfo = uriInfo;
    }

    @Override
    public String getName() {
        return "Byns Bistro";
    }

    @Override
    public SortedSet<String> getAliases() {
        return ALIASES;
    }

    @Override
    public URI getWebsite() {
        return URI.create("http://www.bynsbistro.nu/veckans-lunch.aspx");
    }

    @Override
    public URI getUri() {
        return LunchResource.getPlaceURI(uriInfo, NAME);
    }

}

package net.rebworks.lunchy.domain.places;

import net.rebworks.lunchy.domain.Place;
import net.rebworks.lunchy.resources.LunchResource;

import javax.inject.Inject;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.SortedSet;
import java.util.TreeSet;

public class BynsBistro implements Place {

    private static final TreeSet<String> ALIASES = new TreeSet<>(Arrays.asList("byns", "bynsbistro"));
    public static final String NAME = ALIASES.first();
    final UriInfo uriInfo;

    @Inject
    public BynsBistro(@Context final UriInfo uriInfo) {
        this.uriInfo = uriInfo;
    }

    @Override
    public String getName() {
        return "Byns Bistro";
    }

    @Override
    public SortedSet<String> getAliases() {
        return ALIASES;
    }

    @Override
    public URI getWebsite() {
        return URI.create("https://www.bynsbistro.se/menyer");
    }

    @Override
    public URI getUri() {
        return LunchResource.getPlaceURI(uriInfo, NAME);
    }

}

Fix the lunch URL for Byns Bistro


package com.khmelenko.lab.travisclient.util;

import android.util.Base64;

/**
 * Provides util methods related with encryption/decryption
 *
 * @author Dmytro Khmelenko
 */
public final class EncryptionUtils {

    // denied constructor
    private EncryptionUtils() {

    }

    /**
     * Encodes input string to Base64
     *
     * @param input Input string
     * @return Base64 string
     */
    public static String toBase64(String input) {
        String base64Str = Base64.encodeToString(input.getBytes(), Base64.DEFAULT);
        return base64Str;
    }

    /**
     * Decodes base64 string to original
     *
     * @param base64 Base64 string
     * @return Original string
     */
    public static String fromBase64(String base64) {
        byte[] data = Base64.decode(base64, Base64.DEFAULT);
        String origin = new String(data);
        return origin;
    }

    /**
     * Generates string for Basic authorization
     *
     * @param username Username
     * @param password Password
     * @return Basic authorization string
     */
    public static String generateBasicAuthorization(String username, String password) {
        String credentials = String.format("%1$s:%2$s", username, password);
        String basic = String.format("Basic %1$s", toBase64(credentials));
        return basic;
    }
}

package com.khmelenko.lab.travisclient.util;

import android.util.Base64;

/**
 * Provides util methods related with encryption/decryption
 *
 * @author Dmytro Khmelenko
 */
public final class EncryptionUtils {

    // denied constructor
    private EncryptionUtils() {

    }

    /**
     * Encodes input string to Base64
     *
     * @param input Input string
     * @return Base64 string
     */
    public static String toBase64(String input) {
        String base64Str = Base64.encodeToString(input.getBytes(), Base64.DEFAULT);
        return base64Str;
    }

    /**
     * Decodes base64 string to original
     *
     * @param base64 Base64 string
     * @return Original string
     */
    public static String fromBase64(String base64) {
        byte[] data = Base64.decode(base64, Base64.DEFAULT);
        String origin = new String(data);
        return origin;
    }

    /**
     * Generates string for Basic authorization
     *
     * @param username Username
     * @param password Password
     * @return Basic authorization string
     */
    public static String generateBasicAuthorization(String username, String password) {
        String credentials = String.format("%1$s:%2$s", username, password);
        String basic = String.format("Basic %1$s", toBase64(credentials)).trim();
        return basic;
    }
}

Remove 0x0a char at the end of authorization header value


package hrv.band.aurora.view.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;

import hrv.band.aurora.R;

/**
 * Created by Julian on 15.11.2016.
 */

public class DisclaimerDialogFragment extends DialogFragment {

    public static final String DISCLAIMER_AGREEMENT = "DisclaimerAgreementAccepted";

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder.setTitle(R.string.disclaimer)
            .setMessage(R.string.disclaimerText)
            .setPositiveButton(R.string.agree, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
                    SharedPreferences.Editor prefsEditor = mPrefs.edit();
                    prefsEditor.putBoolean(DISCLAIMER_AGREEMENT, true);
                    prefsEditor.commit();
                }
            })
            .setNegativeButton(R.string.disagree, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    System.exit(0);
                }
            });

        return builder.create();
    }
}

package hrv.band.aurora.view.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;

import hrv.band.aurora.R;

/**
 * Created by Julian on 15.11.2016.
 */

public class DisclaimerDialogFragment extends DialogFragment {

    public static final String DISCLAIMER_AGREEMENT = "DisclaimerAgreementAccepted";

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder.setTitle(R.string.disclaimer)
            .setMessage(R.string.disclaimerText)
            .setPositiveButton(R.string.agree, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
                    SharedPreferences.Editor prefsEditor = mPrefs.edit();
                    prefsEditor.putBoolean(DISCLAIMER_AGREEMENT, true);
                    prefsEditor.apply();
                }
            })
            .setNegativeButton(R.string.disagree, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    System.exit(0);
                }
            });

        return builder.create();
    }
}

Change commit to apply (SharedPreferences)


package me.st28.flexseries.flexcore.debug;

import me.st28.flexseries.flexcore.message.MessageReference;

/**
 * Represents the output of {@link DebugTest#runTest(org.bukkit.command.CommandSender, String, String[])}.
 */
public final class DebugTestOutput {

    private final boolean isSuccess;
    private final MessageReference message;

    public DebugTestOutput(boolean isSuccess, String message) {
        this(isSuccess, MessageReference.createPlain(message));
    }

    public DebugTestOutput(boolean isSuccess, MessageReference message) {
        this.isSuccess = isSuccess;
        this.message = message;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public MessageReference getMessage() {
        return message;
    }

}

package me.st28.flexseries.flexcore.debug;

import me.st28.flexseries.flexcore.message.MessageReference;

/**
 * Represents the output of {@link DebugTest#runTest(org.bukkit.command.CommandSender, String, String[])}.
 */
public final class DebugTestOutput {

    private final boolean isSuccess;
    private final MessageReference message;

    public DebugTestOutput(boolean isSuccess, String message) {
        this(isSuccess, message == null ? null : MessageReference.createPlain(message));
    }

    public DebugTestOutput(boolean isSuccess, MessageReference message) {
        this.isSuccess = isSuccess;
        this.message = message;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public MessageReference getMessage() {
        return message;
    }

}

Set message to null rather than creating an empty MessageReference. Fixes a NPE.


package sizebay.catalog.client.model;

import lombok.*;

@Getter
@Setter
@EqualsAndHashCode
@ToString
public class ModelingSizeMeasures   {

  String sizeName = null;
  ModelingMeasureRange chest = null;
  ModelingMeasureRange hip = null;
  ModelingMeasureRange waist = null;
  ModelingMeasureRange sleeve = null;
  ModelingMeasureRange length = null;
  ModelingMeasureRange insideLeg = null;
  ModelingMeasureRange biceps = null;
  ModelingMeasureRange height = null;
  ModelingMeasureRange fist = null;
  ModelingMeasureRange neck = null;
  ModelingMeasureRange thigh = null;
  ModelingMeasureRange centralSeam = null;
  ModelingMeasureRange underBust = null;
  ModelingMeasureRange shoulderWidth = null;
  ModelingMeasureRange insoleLength = null;
  ModelingMeasureRange insoleWidth = null;
  ModelingMeasureRange waistUpper = null;
  ModelingMeasureRange waistLower = null;

  ModelingMeasureRange label1 = null;
  ModelingMeasureRange label2 = null;
  ModelingMeasureRange label3 = null;

  ModelingMeasureRange ageChart = null;
  ModelingMeasureRange weightChart = null;
  ModelingMeasureRange equivalence = null;
  ModelingMeasureRange headCircumference = null;

}

package sizebay.catalog.client.model;

import lombok.*;

@Getter
@Setter
@EqualsAndHashCode
@ToString
public class ModelingSizeMeasures   {

  String sizeName = null;
  ModelingMeasureRange chest = null;
  ModelingMeasureRange hip = null;
  ModelingMeasureRange waist = null;
  ModelingMeasureRange sleeve = null;
  ModelingMeasureRange length = null;
  ModelingMeasureRange insideLeg = null;
  ModelingMeasureRange biceps = null;
  ModelingMeasureRange height = null;
  ModelingMeasureRange fist = null;
  ModelingMeasureRange neck = null;
  ModelingMeasureRange thigh = null;
  ModelingMeasureRange centralSeam = null;
  ModelingMeasureRange underBust = null;
  ModelingMeasureRange shoulderWidth = null;
  ModelingMeasureRange insoleLength = null;
  ModelingMeasureRange insoleWidth = null;
  ModelingMeasureRange waistUpper = null;
  ModelingMeasureRange waistLower = null;

  ModelingMeasureRange label1 = null;
  ModelingMeasureRange label2 = null;
  ModelingMeasureRange label3 = null;

  ModelingMeasureRange ageChart = null;
  ModelingMeasureRange weightChart = null;
  ModelingMeasureRange equivalence = null;

}

Revert "Fix: Add new measure -> headCircumference"


package org.ovirt.engine.core.bll.network.dc;

import org.ovirt.engine.core.bll.validator.NetworkValidator;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters;
import org.ovirt.engine.core.common.errors.VdcBllMessages;

public class RemoveNetworkCommand<T extends AddNetworkStoragePoolParameters> extends NetworkCommon<T> {
    public RemoveNetworkCommand(T parameters) {
        super(parameters);
    }

    @Override
    protected void executeCommand() {
        getNetworkDAO().remove(getNetwork().getId());
        setSucceeded(true);
    }

    @Override
    protected void setActionMessageParameters() {
        super.setActionMessageParameters();
        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE);
    }

    @Override
    protected boolean canDoAction() {
        NetworkValidator validator = new NetworkValidator(getNetworkDAO().get(getNetwork().getId()));
        return validate(validator.networkIsSet())
                && validate(validator.notManagementNetwork())
                && validate(validator.networkNotUsedByVms())
                && validate(validator.networkNotUsedByTemplates());
    }

    @Override
    public AuditLogType getAuditLogTypeValue() {
        return getSucceeded() ? AuditLogType.NETWORK_REMOVE_NETWORK : AuditLogType.NETWORK_REMOVE_NETWORK_FAILED;
    }
}

package org.ovirt.engine.core.bll.network.dc;

import org.ovirt.engine.core.bll.validator.NetworkValidator;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters;
import org.ovirt.engine.core.common.errors.VdcBllMessages;

public class RemoveNetworkCommand<T extends AddNetworkStoragePoolParameters> extends NetworkCommon<T> {
    public RemoveNetworkCommand(T parameters) {
        super(parameters);
    }

    @Override
    protected void executeCommand() {
        removeVnicProfiles();
        getNetworkDAO().remove(getNetwork().getId());
        setSucceeded(true);
    }

    @Override
    protected void setActionMessageParameters() {
        super.setActionMessageParameters();
        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE);
    }

    @Override
    protected boolean canDoAction() {
        NetworkValidator validator = new NetworkValidator(getNetworkDAO().get(getNetwork().getId()));
        return validate(validator.networkIsSet())
                && validate(validator.notManagementNetwork())
                && validate(validator.networkNotUsedByVms())
                && validate(validator.networkNotUsedByTemplates());
    }

    @Override
    public AuditLogType getAuditLogTypeValue() {
        return getSucceeded() ? AuditLogType.NETWORK_REMOVE_NETWORK : AuditLogType.NETWORK_REMOVE_NETWORK_FAILED;
    }
}

Delete vnic profiles when removing a network


/*
 * Copyright 2016, The Android Open Source Project
 *
 * 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.akexorcist.mvpsimple.common;

public interface BasePresenter {

    void start();

}

/*
 * Copyright 2016, The Android Open Source Project
 *
 * 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.akexorcist.mvpsimple.common;

public interface BasePresenter {

    void start();

    void stop();

}

Add stop for unregister event bus


package net.contargo.iris.config;

import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
import com.mangofactory.swagger.models.dto.ApiInfo;
import com.mangofactory.swagger.plugin.EnableSwagger;
import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.ui.Model;

/**
 * @author  Sandra Thieme - thieme@synyx.de
 */
@Configuration
@EnableSwagger
public class SwaggerConfig {

    private SpringSwaggerConfig springSwaggerConfig;

    @Autowired
    public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig) {

        this.springSwaggerConfig = springSwaggerConfig;
    }

    @Bean
    public SwaggerSpringMvcPlugin customImplementation() {

        this.springSwaggerConfig.defaultSwaggerPathProvider().setApiResourcePrefix("api");

        return new SwaggerSpringMvcPlugin(this.springSwaggerConfig).apiInfo(apiInfo()).ignoredParameterTypes(
                Model.class);
    }

    private ApiInfo apiInfo() {

        return new ApiInfo("IRIS Backend Api", null, null, null, null, null);
    }
}

package net.contargo.iris.config;

import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
import com.mangofactory.swagger.models.dto.ApiInfo;
import com.mangofactory.swagger.plugin.EnableSwagger;
import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.ui.Model;

/**
 * @author  Sandra Thieme - thieme@synyx.de
 * @author  David Schilling - schilling@synyx.de
 */
@Configuration
@EnableSwagger
public class SwaggerConfig {

    private String[] includePattern = new String[] {
        "\\/geocodes.*", "\\/osmaddresses.*", "\\/places.*", "\\/reversegeocode.*", "\\/airlineDistance.*",
        "\\/countries.*", "\\/distancecloudaddress.*", "\\/connections.*", "\\/routedetails.*", "\\/routerevisions.*",
        "\\/routes.*", "\\/seaports.*", "\\/staticaddresses.*", "\\/terminals.*", "\\/simplegeocodes.*"
    };

    private SpringSwaggerConfig springSwaggerConfig;

    @Autowired
    public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig) {

        this.springSwaggerConfig = springSwaggerConfig;
    }

    @Bean
    public SwaggerSpringMvcPlugin customImplementation() {

        springSwaggerConfig.defaultSwaggerPathProvider().setApiResourcePrefix("api");

        return new SwaggerSpringMvcPlugin(springSwaggerConfig).apiInfo(apiInfo())
            .includePatterns(includePattern)
            .ignoredParameterTypes(Model.class);
    }

    private ApiInfo apiInfo() {

        return new ApiInfo("IRIS Backend Api", null, null, null, null, null);
    }
}

Use include patterns for swagger to avoid unintended includes


package org.jusecase.properties.ui;

import javax.swing.*;

public class KeyListMenu extends JPopupMenu {
    public KeyListMenu() {
        JMenuItem newKey = new JMenuItem("New");
        add(newKey);

        JMenuItem duplicateKey = new JMenuItem("Duplicate");
        add(duplicateKey);
    }
}

package org.jusecase.properties.ui;

import javax.swing.*;

public class KeyListMenu extends JPopupMenu {
    public KeyListMenu() {
        JMenuItem newKey = new JMenuItem("New");
        add(newKey);

        JMenuItem duplicateKey = new JMenuItem("Duplicate");
        add(duplicateKey);

        JMenuItem renameKey = new JMenuItem("Rename");
        add(renameKey);
    }
}

Add rename key option so that its not forgotten later


package com.zyeeda.framework.cxf;

import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.SerializationConfig.Feature;

public class JacksonJsonProvider extends JacksonJaxbJsonProvider {

	public JacksonJsonProvider() {
		ObjectMapper m = this._mapperConfig.getConfiguredMapper();
		if (m == null) {
			m = this._mapperConfig.getDefaultMapper();
		}
		m.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
		m.configure(Feature.FAIL_ON_EMPTY_BEANS, false);
	}

}

package com.zyeeda.framework.cxf;

import java.text.SimpleDateFormat;

import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.SerializationConfig.Feature;

public class JacksonJsonProvider extends JacksonJaxbJsonProvider {

	public JacksonJsonProvider() {
		ObjectMapper m = this._mapperConfig.getConfiguredMapper();
		if (m == null) {
			m = this._mapperConfig.getDefaultMapper();
		}
		SerializationConfig sc = m.getSerializationConfig().withDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
		sc.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
		sc.set(Feature.FAIL_ON_EMPTY_BEANS, false);
		m.setSerializationConfig(sc);
		/*
		m.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
		m.configure(Feature.FAIL_ON_EMPTY_BEANS, false);
		m.setSerializationConfig(m.getSerializationConfig().withDateFormat(new SimpleDateFormat("yyyy-MM-dd")));
		*/
	}

}

Make CXF serialize date type in pre-defined format.


package ru.nsu.ccfit.bogush.factory.thing.periodical;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class SimplePeriodical implements Periodical {
	private long period;

	private static final String LOGGER_NAME = "SimplePeriodical";
	private static final Logger logger = LogManager.getLogger(LOGGER_NAME);

	public SimplePeriodical(long period) {
		this.period = period;
	}

	private final Object lock = new Object();

	@Override
	public void setPeriod(long period) {
		logger.trace("set period " + period + " milliseconds");
		if (period < 0) {
			logger.error("period < 0");
			throw new IllegalArgumentException("period must be greater than or equal to 0");
		}
		this.period = period;
	}

	@Override
	public void waitPeriod() {
		long timeToWait = period;
		long time = System.currentTimeMillis();
		try {
			synchronized (lock) {
				while (timeToWait > 0) {
					lock.wait(timeToWait);
					long newTime = System.currentTimeMillis();
					timeToWait -= newTime - time;
					time = newTime;
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
			logger.error(e);
			System.exit(1);
		}
	}

	@Override
	public long getPeriod() {
		return period;
	}
}

package ru.nsu.ccfit.bogush.factory.thing.periodical;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class SimplePeriodical implements Periodical {
	private long period;

	private static final String LOGGER_NAME = "SimplePeriodical";
	private static final Logger logger = LogManager.getLogger(LOGGER_NAME);

	public SimplePeriodical(long period) {
		this.period = period;
	}

	private final Object lock = new Object();

	@Override
	public void setPeriod(long period) {
		logger.trace("set period " + period + " milliseconds");
		if (period < 0) {
			logger.error("period < 0");
			throw new IllegalArgumentException("period must be greater than or equal to 0");
		}
		this.period = period;
		lock.notifyAll();
	}

	@Override
	public void waitPeriod() {
		long timeToWait = period;
		long time = System.currentTimeMillis();
		try {
			synchronized (lock) {
				while (timeToWait > 0) {
					lock.wait(timeToWait);
					long newTime = System.currentTimeMillis();
					timeToWait -= newTime - time;
					time = newTime;
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
			logger.error(e);
			System.exit(1);
		}
	}

	@Override
	public long getPeriod() {
		return period;
	}
}

Use notifyAll() to update the period in blocked waitPeriod


package com.hubspot.mesos.protos;

public enum  MesosTaskStatusReason {
  REASON_COMMAND_EXECUTOR_FAILED, REASON_CONTAINER_LAUNCH_FAILED, REASON_CONTAINER_LIMITATION, REASON_CONTAINER_LIMITATION_DISK,
  REASON_CONTAINER_LIMITATION_MEMORY, REASON_CONTAINER_PREEMPTED, REASON_CONTAINER_UPDATE_FAILED, REASON_EXECUTOR_REGISTRATION_TIMEOUT,
  REASON_EXECUTOR_REREGISTRATION_TIMEOUT, REASON_EXECUTOR_TERMINATED, REASON_EXECUTOR_UNREGISTERED, REASON_FRAMEWORK_REMOVED, REASON_GC_ERROR,
  REASON_INVALID_FRAMEWORKID, REASON_INVALID_OFFERS, REASON_IO_SWITCHBOARD_EXITED, REASON_MASTER_DISCONNECTED, REASON_RECONCILIATION,
  REASON_RESOURCES_UNKNOWN, REASON_SLAVE_DISCONNECTED, REASON_SLAVE_REMOVED, REASON_SLAVE_REMOVED_BY_OPERATOR, REASON_SLAVE_RESTARTED,
  REASON_SLAVE_UNKNOWN, REASON_TASK_CHECK_STATUS_UPDATED, REASON_TASK_GROUP_INVALID, REASON_TASK_GROUP_UNAUTHORIZED,
  REASON_TASK_HEALTH_CHECK_STATUS_UPDATED, REASON_TASK_INVALID, REASON_TASK_KILLED_DURING_LAUNCH, REASON_TASK_UNAUTHORIZED,
  REASON_TASK_UNKNOWN
}

package com.hubspot.mesos.protos;

public enum  MesosTaskStatusReason {
  REASON_COMMAND_EXECUTOR_FAILED,
  REASON_CONTAINER_LAUNCH_FAILED,
  REASON_CONTAINER_LIMITATION,
  REASON_CONTAINER_LIMITATION_DISK,
  REASON_CONTAINER_LIMITATION_MEMORY,
  REASON_CONTAINER_PREEMPTED,
  REASON_CONTAINER_UPDATE_FAILED,
  REASON_EXECUTOR_REGISTRATION_TIMEOUT,
  REASON_EXECUTOR_REREGISTRATION_TIMEOUT,
  REASON_EXECUTOR_TERMINATED,
  REASON_EXECUTOR_UNREGISTERED,
  REASON_FRAMEWORK_REMOVED,
  REASON_GC_ERROR,
  REASON_INVALID_FRAMEWORKID,
  REASON_INVALID_OFFERS,
  REASON_IO_SWITCHBOARD_EXITED,
  REASON_MASTER_DISCONNECTED,
  REASON_RECONCILIATION,
  REASON_RESOURCES_UNKNOWN,
  REASON_SLAVE_DISCONNECTED,
  REASON_SLAVE_REMOVED,
  REASON_SLAVE_REMOVED_BY_OPERATOR,
  REASON_SLAVE_RESTARTED,
  REASON_SLAVE_UNKNOWN,
  REASON_AGENT_DISCONNECTED,
  REASON_AGENT_REMOVED,
  REASON_AGENT_REMOVED_BY_OPERATOR,
  REASON_AGENT_RESTARTED,
  REASON_AGENT_UNKNOWN,
  REASON_TASK_KILLED_DURING_LAUNCH,
  REASON_TASK_CHECK_STATUS_UPDATED,
  REASON_TASK_HEALTH_CHECK_STATUS_UPDATED,
  REASON_TASK_GROUP_INVALID,
  REASON_TASK_GROUP_UNAUTHORIZED,
  REASON_TASK_INVALID,
  REASON_TASK_UNAUTHORIZED,
  REASON_TASK_UNKNOWN
}

Add REASON_AGENT status update reasons


package com.alapshin.arctor.delegate;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.alapshin.arctor.presenter.Presenter;
import com.alapshin.arctor.view.MvpView;

import javax.annotation.Nonnull;

public interface FragmentMvpDelegate<V extends MvpView, P extends Presenter<V>> {
    public void onCreate(@Nonnull P presenter, @Nullable Bundle savedInstanceState);
    public void onViewCreated(V view, @Nullable Bundle savedInstanceState);
    public void onStart();
    public void onResume();
    public void onPause();
    public void onSaveInstanceState(Bundle outState);
    public void onStop();
    public void onDestroyView();
    public void onDestroy();
}

package com.alapshin.arctor.delegate;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.alapshin.arctor.presenter.Presenter;
import com.alapshin.arctor.view.MvpView;

import javax.annotation.Nonnull;

public interface FragmentMvpDelegate<V extends MvpView, P extends Presenter<V>> {
    public void onCreate(@Nullable Bundle savedInstanceState);
    public void onViewCreated(@Nullable Bundle savedInstanceState);
    public void onStart();
    public void onResume();
    public void onPause();
    public void onSaveInstanceState(Bundle outState);
    public void onStop();
    public void onDestroyView();
    public void onDestroy();
}

Remove unused parameters from FramgentMvpDelegate


package nl.gmta.btrfs.structure.stream;

enum BtrfsValueType {
    BTRFS_TLV_U8       (0x00),
    BTRFS_TLV_U16      (0x01),
    BTRFS_TLV_U32      (0x02),
    BTRFS_TLV_U64      (0x03),
    BTRFS_TLV_BINARY   (0x04),
    BTRFS_TLV_STRING   (0x05),
    BTRFS_TLV_UUID     (0x06),
    BTRFS_TLV_TIMESPEC (0x07);

    private int value;

    BtrfsValueType(int value) {
        this.value = value;
    }

    public int getValue() {
        return this.value;
    }
}

package nl.gmta.btrfs.structure.stream;

enum BtrfsValueType {
    U8       (0x00),
    U16      (0x01),
    U32      (0x02),
    U64      (0x03),
    BINARY   (0x04),
    STRING   (0x05),
    UUID     (0x06),
    TIMESPEC (0x07);

    private int value;

    BtrfsValueType(int value) {
        this.value = value;
    }

    public int getValue() {
        return this.value;
    }
}

Remove common prefix from value type enum values


package org.opennms.netmgt.dao.support;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import org.opennms.netmgt.rrd.RrdConfig;
import org.opennms.netmgt.rrd.RrdException;
import org.opennms.netmgt.rrd.RrdUtils;
import org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy;

public class RrdTestUtils {
    // Reference the class name this way so that it is refactoring resistant
    private static final String RRD_CONFIG = "org.opennms.rrd.strategyClass=" + JRobinRrdStrategy.class.getName();

    /**
     * This class cannot be instantiated.  Use static methods.
     */
    private RrdTestUtils() {

    }

    public static void initialize() throws IOException, RrdException {
        RrdConfig.loadProperties(new ByteArrayInputStream(RRD_CONFIG.getBytes()));
        RrdUtils.initialize();
    }
}

package org.opennms.netmgt.dao.support;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import org.opennms.netmgt.rrd.RrdConfig;
import org.opennms.netmgt.rrd.RrdException;
import org.opennms.netmgt.rrd.RrdUtils;
import org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy;

public class RrdTestUtils {
    // Reference the class name this way so that it is refactoring resistant
    private static final String RRD_CONFIG = "org.opennms.rrd.strategyClass=" + JRobinRrdStrategy.class.getName()
        + "\norg.opennms.rrd.usequeue=false";

    /**
     * This class cannot be instantiated.  Use static methods.
     */
    private RrdTestUtils() {

    }

    public static void initialize() throws IOException, RrdException {
        RrdConfig.loadProperties(new ByteArrayInputStream(RRD_CONFIG.getBytes()));
        RrdUtils.initialize();
    }
}

Disable RRD queue feature when testing so files are actually written when we write to them. :-)


package io.dropwizard.views;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

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

/**
 * An {@link ExceptionMapper} that returns a 500 error response with a generic
 * HTML error page when a {@link ViewRenderException} is thrown.
 *
 * @since 1.1.0
 */
@Provider
public class ViewRenderExceptionMapper implements ExceptionMapper<WebApplicationException> {

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

    /**
     * The generic HTML error page template.
     */
    public static final String TEMPLATE_ERROR_MSG =
            "" +
                "<title>Template Error</title>" +
                "
Template Error

Something went wrong rendering the page
" +
            "";

    @Override
    public Response toResponse(WebApplicationException exception) {
        Throwable cause = exception.getCause();
        if (cause instanceof ViewRenderException) {
            LOGGER.error("Template Error", cause);
            return Response.serverError()
                    .type(MediaType.TEXT_HTML_TYPE)
                    .entity(TEMPLATE_ERROR_MSG)
                    .build();
        }
        return exception.getResponse();
    }

}

package io.dropwizard.views;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.glassfish.jersey.spi.ExtendedExceptionMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * An {@link ExtendedExceptionMapper} that returns a 500 error response with a generic
 * HTML error page when a {@link ViewRenderException} is the cause.
 *
 * @since 1.1.0
 */
@Provider
public class ViewRenderExceptionMapper implements ExtendedExceptionMapper<WebApplicationException> {

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

    /**
     * The generic HTML error page template.
     */
    public static final String TEMPLATE_ERROR_MSG =
            "" +
                "<title>Template Error</title>" +
                "
Template Error

Something went wrong rendering the page
" +
            "";

    @Override
    public Response toResponse(WebApplicationException exception) {
        LOGGER.error("Template Error", exception);
        return Response.serverError()
                .type(MediaType.TEXT_HTML_TYPE)
                .entity(TEMPLATE_ERROR_MSG)
                .build();
    }

    @Override
    public boolean isMappable(WebApplicationException e) {
        return ExceptionUtils.indexOfThrowable(e, ViewRenderException.class) != -1;
    }
}

Move ViewExceptionMapper to an ExtendedExceptionMapper


package com.bignerdranch.android.photogallery;

import android.os.HandlerThread;
import android.util.Log;

public class ThumbnailDownloader<T> extends HandlerThread {

    private static final String TAG = "ThumbnailDownloader";

    public ThumbnailDownloader() {
        super(TAG);
    }

    public void queueThumbnail(T target, String url) {
        Log.i(TAG, "Gor a URL: " + url);
    }
}

package com.bignerdranch.android.photogallery;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;

import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class ThumbnailDownloader<T> extends HandlerThread {

    private static final String TAG = "ThumbnailDownloader";

    private static final int MESSAGE_DOWNLOAD = 0;

    private Handler mRequestHandler;
    private ConcurrentMap<T, String> mRequestMap = new ConcurrentHashMap<T, String>();
    private Handler mResponseHandler;
    private ThumbnailDownloadListener<T> mThumbnailDownloadListener;

    public interface ThumbnailDownloadListener<T> {
        void onThumbnailDownload(T target, Bitmap thumbnail);
    }

    public void setThumbnailDownloadListener(ThumbnailDownloadListener<T> listener) {
        mThumbnailDownloadListener = listener;
    }

    public ThumbnailDownloader(Handler responseHandler) {
        super(TAG);
        mRequestHandler = responseHandler;
    }

    public void queueThumbnail(T target, String url) {
        Log.i(TAG, "Gor a URL: " + url);

        if (url == null) {
            mRequestMap.remove(target);
        }
        else {
            mRequestMap.put(target, url);
            mRequestHandler.obtainMessage(MESSAGE_DOWNLOAD, target).sendToTarget();
        }
    }

    private void handleRequest(final T target) {
        try {
            final String url = mRequestMap.get(target);

            if (url == null) {
                return;
            }

            byte[] bitmapBytes = new FlickrFetcher().getUrlBytes(url);

            final Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapBytes, 0, bitmapBytes.length);
            Log.i(TAG, "Bitmap created");

            mResponseHandler.post(new Runnable() {
                @Override
                public void run() {
                    if (mRequestMap.get(target) != url) {
                        return;
                    }

                    mRequestMap.remove(target);
                    mThumbnailDownloadListener.onThumbnailDownload(target, bitmap);
                }
            });

        }
        catch (IOException ioe) {
            Log.e(TAG, "Error downloading image", ioe);
        }
    }

    public void clearQueue() {
        mRequestHandler.removeMessages(MESSAGE_DOWNLOAD);
    }
}

Complete the implementation of the Downloader, what a horrible thing :facepalm:


package io.tjeubaoit.android.mvc.annotation;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

import io.tjeubaoit.android.mvc.message.Message;

/**
 * TODO: Class description here.
 *
 * @author tjeubaoit
 */
public class OnActionScanner {

    public static Map<String, Method> getMethodsAnnotatedAsAction(Object obj) {
        Message msg = new Message.Builder().build();
        Map<String, Method> methodMap = new HashMap<>();

        // scan methods for mapping
        for (Method method : obj.getClass().getDeclaredMethods()) {
            if (!method.isAnnotationPresent(OnAction.class)) continue;

            Class<?>[] paramTypes = method.getParameterTypes();
            if (paramTypes.length != 1 || !paramTypes[0].isInstance(msg)) continue;

            for (String action : method.getAnnotation(OnAction.class).value()) {
                methodMap.put(action, method);
            }
        }

        return methodMap;
    }
}

package io.tjeubaoit.android.mvc.annotation;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

import io.tjeubaoit.android.mvc.message.Message;
import io.tjeubaoit.android.mvc.util.Logger;

/**
 * TODO: Class description here.
 *
 * @author tjeubaoit
 */
public class OnActionScanner {

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

    public static Map<String, Method> getMethodsAnnotatedAsAction(Object obj) {
        Message msg = new Message.Builder().build();
        Map<String, Method> methodMap = new HashMap<>();

        // scan methods for mapping
        for (Method method : obj.getClass().getDeclaredMethods()) {
            if (!method.isAnnotationPresent(OnAction.class)) continue;

            Class<?>[] paramTypes = method.getParameterTypes();
            if (paramTypes.length == 0 || (paramTypes.length == 1 && paramTypes[0].isInstance(msg))) {
                for (String action : method.getAnnotation(OnAction.class).value()) {
                    methodMap.put(action, method);
                    LOGGER.debug(String.format("Map action %s with method %s", action, method.getName()));
                }
            } else {
                throw new RuntimeException("Parameters invalid for method: " + method);
            }
        }

        return methodMap;
    }
}

Throw exception if target method marked with OnAction has invalid parameters


package org.synyx.urlaubsverwaltung.calendar;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.NullSource;
import org.junit.jupiter.params.provider.ValueSource;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import java.util.Set;
import java.util.stream.Stream;

import static org.assertj.core.api.Assertions.assertThat;

class CalendarPropertiesTest {

    private Validator validator;

    @BeforeEach
    void setUp() {
        validator = Validation.buildDefaultValidatorFactory().getValidator();
    }

    @Test
    void organizerIsAnEmail() {
        final CalendarProperties calendarProperties = new CalendarProperties();
        calendarProperties.setOrganizer("email@example.org");
        final Set<ConstraintViolation<CalendarProperties>> violations = validator.validate(calendarProperties);

        assertThat(violations.size()).isZero();
    }

    static Stream<String> organizerStrings() {
        return Stream.of("", "NotAnEmail", null);
    }

    @ParameterizedTest
    @MethodSource("organizerStrings")
    void organizerIsWrong(String input) {
        final CalendarProperties calendarProperties = new CalendarProperties();
        calendarProperties.setOrganizer(input);
        final Set<ConstraintViolation<CalendarProperties>> violations = validator.validate(calendarProperties);

        assertThat(violations.size()).isOne();
    }
}

package org.synyx.urlaubsverwaltung.calendar;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.NullSource;
import org.junit.jupiter.params.provider.ValueSource;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import java.util.Set;

import static org.assertj.core.api.Assertions.assertThat;

class CalendarPropertiesTest {

    private Validator validator;

    @BeforeEach
    void setUp() {
        validator = Validation.buildDefaultValidatorFactory().getValidator();
    }

    @Test
    void organizerIsAnEmail() {
        final CalendarProperties calendarProperties = new CalendarProperties();
        calendarProperties.setOrganizer("email@example.org");
        final Set<ConstraintViolation<CalendarProperties>> violations = validator.validate(calendarProperties);

        assertThat(violations.size()).isZero();
    }

    @ParameterizedTest
    @ValueSource(strings = {"", " ", "NotAnEmail"})
    @NullSource
    void organizerIsWrong(String input) {
        final CalendarProperties calendarProperties = new CalendarProperties();
        calendarProperties.setOrganizer(input);
        final Set<ConstraintViolation<CalendarProperties>> violations = validator.validate(calendarProperties);

        assertThat(violations.size()).isOne();
    }
}

Improve parameterized test with sources


package org.camunda.bpm.demo.orderconfirmation.config;

import org.camunda.bpm.demo.orderconfirmation.bean.RuleEntryDAO;
import org.camunda.bpm.demo.orderconfirmation.model.DiscountRuleEntry;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import java.util.List;
import java.util.logging.Logger;

/*
 * Helper class to create an initial set of discount rules
 */
@Singleton
@Startup
public class DiscountRuleEntryConfig {

  private final static Logger log = Logger.getLogger(DiscountRuleEntryConfig.class.getCanonicalName());

  @Inject
  private RuleEntryDAO rulesDAO;

  /*
   * If no discount rules are present in the database, we create some initial ones
   */
  @PostConstruct
  public void initializeDiscountRules() {
    List<DiscountRuleEntry> rules = rulesDAO.findAllDiscountRuleEntries();
    if ((rules == null) || (rules.size() == 0)) {
      log.info("Creating initial sample discount rules: ...");
      rulesDAO.save(new DiscountRuleEntry("Small orders", 100, 500, 5));
      rulesDAO.save(new DiscountRuleEntry("Mediun orders", 501, 1000, 7));
      rulesDAO.save(new DiscountRuleEntry("Big orders", 1001, 5000, 10));
    }
  }
}

package org.camunda.bpm.demo.orderconfirmation.config;

import org.camunda.bpm.demo.orderconfirmation.bean.RuleEntryDAO;
import org.camunda.bpm.demo.orderconfirmation.model.DiscountRuleEntry;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import java.util.List;
import java.util.logging.Logger;

/*
 * Helper class to create an initial set of discount rules
 */
@Singleton
@Startup
public class DiscountRuleEntryConfig {

  private final static Logger log = Logger.getLogger(DiscountRuleEntryConfig.class.getCanonicalName());

  @Inject
  private RuleEntryDAO rulesDAO;

  /*
   * If no discount rules are present in the database, we create some initial ones
   */
  @PostConstruct
  public void initializeDiscountRules() {
    List<DiscountRuleEntry> rules = rulesDAO.findAllDiscountRuleEntries();
    if ((rules == null) || (rules.size() == 0)) {
      log.info("Creating initial sample discount rules: ...");
      rulesDAO.save(new DiscountRuleEntry("Small orders", 0, 500, 5));
      rulesDAO.save(new DiscountRuleEntry("Mediun orders", 501, 1000, 7));
      rulesDAO.save(new DiscountRuleEntry("Big orders", 1001, 5000, 10));
    }
  }
}

Fix "amount from" for "Small orders"


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

package com.adaptris.util.text;

/**
 * Interface for handling null parameters.
 *
 * @author lchan
 *
 */
public interface NullConverter {

  /**
   * Convert a null into something more meaningful.
   *
   */
  <T> T convert(T t);
}

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

package com.adaptris.util.text;

/**
 * Interface for handling null parameters.
 *
 * @author lchan
 *
 */
@FunctionalInterface
public interface NullConverter {

  /**
   * Convert a null into something more meaningful.
   *
   */
  <T> T convert(T t);
}

Make NC a functional interface.


package org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons;

import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

import java.util.ArrayList;

/**
 * @author Ruben Bermudez
 * @version 1.0
 * @brief Row for ReplyKeyBoardMarkup
 * @date 10 of April of 2016
 */
public class KeyboardRow extends ArrayList<KeyboardButton> implements Validable {
    public boolean add(String text) {
        return super.add(new KeyboardButton(text));
    }

    public void add(int index, String text) {
        super.add(index, new KeyboardButton(text));
    }

    public boolean contains(String text) {
        return super.contains(new KeyboardButton(text));
    }

    public int lastIndexOf(String text) {
        return super.lastIndexOf(new KeyboardButton(text));
    }

    public int indexOf(String text) {
        return super.indexOf(new KeyboardButton(text));
    }

    public KeyboardButton set(int index, String text) {
        return super.set(index, new KeyboardButton(text));
    }

    public boolean remove(String text) {
        return super.remove(new KeyboardButton(text));
    }

    @Override
    public void validate() throws TelegramApiValidationException {
        for (KeyboardButton keyboardButton : this) {
            keyboardButton.validate();
        }
    }
}

package org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons;

import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

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

/**
 * @author Ruben Bermudez
 * @version 1.0
 * @brief Row for ReplyKeyBoardMarkup
 * @date 10 of April of 2016
 */
public class KeyboardRow extends ArrayList<KeyboardButton> implements Validable {
    public boolean add(String text) {
        return super.add(new KeyboardButton(text));
    }

    public void add(int index, String text) {
        super.add(index, new KeyboardButton(text));
    }

    public void addAll(List<String> buttonNames) {
        buttonNames.forEach(KeyboardButton::new);
    }

    public boolean contains(String text) {
        return super.contains(new KeyboardButton(text));
    }

    public int lastIndexOf(String text) {
        return super.lastIndexOf(new KeyboardButton(text));
    }

    public int indexOf(String text) {
        return super.indexOf(new KeyboardButton(text));
    }

    public KeyboardButton set(int index, String text) {
        return super.set(index, new KeyboardButton(text));
    }

    public boolean remove(String text) {
        return super.remove(new KeyboardButton(text));
    }

    @Override
    public void validate() throws TelegramApiValidationException {
        for (KeyboardButton keyboardButton : this) {
            keyboardButton.validate();
        }
    }
}

Add addAll method for keyboardrow


/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
package com.facebook.imagepipeline.memory;

import android.graphics.Bitmap;
import com.facebook.common.memory.MemoryTrimType;
import com.facebook.imageutils.BitmapUtil;

public class DummyBitmapPool implements BitmapPool {

  @Override
  public void trim(MemoryTrimType trimType) {
    // nop
  }

  @Override
  public Bitmap get(int size) {
    return Bitmap.createBitmap(
        1,
        (int) Math.ceil(size / (double) BitmapUtil.RGB_565_BYTES_PER_PIXEL),
        Bitmap.Config.RGB_565);
  }

  @Override
  public void release(Bitmap value) {
    value.recycle();
  }
}

/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
package com.facebook.imagepipeline.memory;

import android.graphics.Bitmap;
import com.facebook.common.internal.Preconditions;
import com.facebook.common.memory.MemoryTrimType;
import com.facebook.imageutils.BitmapUtil;

public class DummyBitmapPool implements BitmapPool {

  @Override
  public void trim(MemoryTrimType trimType) {
    // nop
  }

  @Override
  public Bitmap get(int size) {
    return Bitmap.createBitmap(
        1,
        (int) Math.ceil(size / (double) BitmapUtil.RGB_565_BYTES_PER_PIXEL),
        Bitmap.Config.RGB_565);
  }

  @Override
  public void release(Bitmap value) {
    Preconditions.checkNotNull(value);
    value.recycle();
  }
}

Add Preconditions NPE check to pool release method


package com.wkovacs64.mtorch;

import android.app.Application;

import timber.log.Timber;

public class CustomApplication extends Application {

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

        if (BuildConfig.DEBUG) {
            // Initialize Timber logging library
            Timber.plant(new Timber.DebugTree());
        }
    }
}

package com.wkovacs64.mtorch;

import android.app.Application;
import android.os.Build;
import android.os.StrictMode;

import timber.log.Timber;

public class CustomApplication extends Application {

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

        if (BuildConfig.DEBUG) {
            // Initialize Timber logging library
            Timber.plant(new Timber.DebugTree());

            // Enable StrictMode for debug builds
            enabledStrictMode();
        }
    }

    private void enabledStrictMode() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDialog()
                    .build());
        }
    }
}

Enable StrictMode for debug builds


package cgeo.geocaching.connector.trackable;

import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;

import org.eclipse.jdt.annotation.NonNull;

public enum TrackableBrand {
    TRAVELBUG(1, R.drawable.trackable_travelbug, R.string.trackable_travelbug),
    GEOKRETY(2, R.drawable.trackable_geokrety, R.string.trackable_geokrety),
    SWAGGIE(2, R.drawable.trackable_swaggie, R.string.trackable_swaggie),
    UNKNOWN(0, R.drawable.trackable_all, R.string.trackable_unknown); // Trackable not initialized yet

    private final int id;
    private final int stringId;
    private final int markerId;

    TrackableBrand(final int id, final int markerId, final int stringId) {
        this.id = id;
        this.markerId = markerId;
        this.stringId = stringId;
    }

    public int getId() {
        return id;
    }

    public int getIconResource() {
        return markerId;
    }

    public String getLabel() {
        return CgeoApplication.getInstance().getString(stringId);
    }

    @NonNull
    public static TrackableBrand getById(final int id) {
        for (final TrackableBrand brand : values()) {
            if (brand.id == id) {
                return brand;
            }
        }
        return UNKNOWN;
    }

}

package cgeo.geocaching.connector.trackable;

import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;

import org.eclipse.jdt.annotation.NonNull;

public enum TrackableBrand {
    TRAVELBUG(1, R.drawable.trackable_travelbug, R.string.trackable_travelbug),
    GEOKRETY(2, R.drawable.trackable_geokrety, R.string.trackable_geokrety),
    SWAGGIE(3, R.drawable.trackable_swaggie, R.string.trackable_swaggie),
    UNKNOWN(0, R.drawable.trackable_all, R.string.trackable_unknown); // Trackable not initialized yet

    private final int id;
    private final int stringId;
    private final int markerId;

    TrackableBrand(final int id, final int markerId, final int stringId) {
        this.id = id;
        this.markerId = markerId;
        this.stringId = stringId;
    }

    public int getId() {
        return id;
    }

    public int getIconResource() {
        return markerId;
    }

    public String getLabel() {
        return CgeoApplication.getInstance().getString(stringId);
    }

    @NonNull
    public static TrackableBrand getById(final int id) {
        for (final TrackableBrand brand : values()) {
            if (brand.id == id) {
                return brand;
            }
        }
        return UNKNOWN;
    }

}

Set a unique id to each Trackable Brand


/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 */

package com.microsoft.azure;

import com.microsoft.azure.annotations.AzureHost;
import com.microsoft.rest.annotations.GET;
import com.microsoft.rest.annotations.HostParam;
import com.microsoft.rest.annotations.PathParam;

public class AzureTests {

    @AzureHost("{vaultBaseUrl}")
    public interface HttpBinService {
        @GET("secrets/{secretName}")
        String getSecret(@HostParam String vaultBaseUrl, @PathParam("secretName") String secretName);
    }

// @AzureHost not yet supported.
//    @Test
//    public void getBytes() throws Exception {
//        RestClient client = new RestClient.Builder()
//                .withBaseUrl("http://localhost")
//                .withSerializerAdapter(new JacksonAdapter())
//                .withResponseBuilderFactory(new ServiceResponseBuilder.Factory())
//                .build();
//        HttpBinService service = RestProxy.create(HttpBinService.class, client);
//
//        Assert.assertEquals("http://vault1.vault.azure.net/secrets/{secretName}", service.getSecret("http://vault1.vault.azure.net", "secret1"));
//    }
}

/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 */

package com.microsoft.azure;

import com.microsoft.azure.annotations.AzureHost;
import com.microsoft.rest.annotations.GET;
import com.microsoft.rest.annotations.HostParam;
import com.microsoft.rest.annotations.PathParam;

public class AzureTests {

    @AzureHost("{vaultBaseUrl}")
    public interface HttpBinService {
        @GET("secrets/{secretName}")
        String getSecret(@HostParam("vaultBaseUrl") String vaultBaseUrl, @PathParam("secretName") String secretName);
    }

// @AzureHost not yet supported.
//    @Test
//    public void getBytes() throws Exception {
//        RestClient client = new RestClient.Builder()
//                .withBaseUrl("http://localhost")
//                .withSerializerAdapter(new JacksonAdapter())
//                .withResponseBuilderFactory(new ServiceResponseBuilder.Factory())
//                .build();
//        HttpBinService service = RestProxy.create(HttpBinService.class, client);
//
//        Assert.assertEquals("http://vault1.vault.azure.net/secrets/{secretName}", service.getSecret("http://vault1.vault.azure.net", "secret1"));
//    }
}

Fix build error in test


package authoring.data;

import com.syntacticsugar.vooga.util.ResourceManager;

public class TileData {

	private static final String PATH = ResourceManager.getString("Path_name");
	private static final String SCENERY = ResourceManager.getString("Scenery_name");

	private String myImagePath;
	private String myImplementation;
	private boolean isDestination;

	public TileData(String imagePath) {
		setImagePath(imagePath);
		setImplementation(PATH);
		setDestination(false);
	}

	public void setImagePath(String path) {
		this.myImagePath = path;
	}

	public void setImplementation(String impl) {
		this.myImplementation = (impl.equals("Path")) ? PATH : SCENERY;
	}

	public void setDestination(boolean isDestination) {
		this.isDestination = isDestination;
	}

	public String getImagePath() {
		return this.myImagePath;
	}

	public String getImplementation() {
		return this.myImplementation;
	}

	public boolean isDestination() {
		return this.isDestination;
	}
}

package authoring.data;

import com.syntacticsugar.vooga.util.ResourceManager;

public class TileData {

	private static final String PATH = ResourceManager.getString("Path_name");
	private static final String SCENERY = ResourceManager.getString("Scenery_name");

	private String myImagePath;
	private String myImplementation;
	private boolean isDestination;

	public TileData(String imagePath) {
		setImagePath(imagePath);
		setImplementation("Path");
		setDestination(false);
	}

	public void setImagePath(String path) {
		this.myImagePath = path;
	}

	public void setImplementation(String impl) {
		this.myImplementation = (impl.equals("Path")) ? PATH : SCENERY;
	}

	public void setDestination(boolean isDestination) {
		this.isDestination = isDestination;
	}

	public String getImagePath() {
		return this.myImagePath;
	}

	public String getImplementation() {
		return this.myImplementation;
	}

	public boolean isDestination() {
		return this.isDestination;
	}
}

Change the implementation string to "Path"


package com.paritytrading.philadelphia.hotspot;

/**
 * Enumerations for Bats Hotspot FIX Proxy 4.0.
 */
public class HotspotEnumerations {

    /**
     * Values for CxlRejReason(102).
     */
    public static class HotspotCxlRejReasonValues {

        public static final int TooLateToCancel             =  0;
        public static final int UnknownOrder                =  1;
        public static final int OrderAlreadyInPendingStatus =  3;
        public static final int DuplicateClOrdID            =  6;
        public static final int Other                       = 99;

        private HotspotCxlRejReasonValues() {
        }

    }

    /**
     * Values for ExecType(150).
     */
    public static class HotspotExecTypeValues {

        public static final char New                = '0';
        public static final char DoneForDay         = '3';
        public static final char Canceled           = '4';
        public static final char Replace            = '5';
        public static final char PendingCancel      = '6';
        public static final char Rejected           = '8';
        public static final char Expired            = 'C';
        public static final char AcceptedForPidding = 'D';
        public static final char PendingReplace     = 'E';
        public static final char Trade              = 'F';
        public static final char Status             = 'I';

        private HotspotExecTypeValues() {
        }

    }

}

package com.paritytrading.philadelphia.hotspot;

/**
 * Enumerations for Bats Hotspot FIX Proxy 4.0.
 */
public class HotspotEnumerations {

    /**
     * Values for CxlRejReason(102).
     */
    public static class HotspotCxlRejReasonValues {

        public static final int TooLateToCancel             =  0;
        public static final int UnknownOrder                =  1;
        public static final int OrderAlreadyInPendingStatus =  3;
        public static final int DuplicateClOrdID            =  6;
        public static final int Other                       = 99;

        private HotspotCxlRejReasonValues() {
        }

    }

    /**
     * Values for ExecType(150).
     */
    public static class HotspotExecTypeValues {

        public static final char New                = '0';
        public static final char DoneForDay         = '3';
        public static final char Canceled           = '4';
        public static final char Replace            = '5';
        public static final char PendingCancel      = '6';
        public static final char Rejected           = '8';
        public static final char Expired            = 'C';
        public static final char AcceptedForPidding = 'D';
        public static final char PendingReplace     = 'E';
        public static final char Trade              = 'F';
        public static final char Status             = 'I';

        private HotspotExecTypeValues() {
        }

    }

    private HotspotEnumerations() {
    }

}

Clean up enumerations in Bats Hotspot FIX Proxy 4.0


package org.broadinstitute.sting.gatk.refdata;

import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;

public class CleanedOutSNPROD extends TabularROD {

    private static final String REAL_SNP_STRING = "SAME_SNP";
    private static final String FALSE_SNP_STRING = "NOT_SNP";

    public CleanedOutSNPROD(String name) {
        super(name);
    }

    public GenomeLoc getLocation() {
        return GenomeLocParser.parseGenomeLoc(this.get("0"));
    }

    public boolean isRealSNP() { return this.get("1").equals(REAL_SNP_STRING); }
 }

package org.broadinstitute.sting.gatk.refdata;

import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;

public class CleanedOutSNPROD extends TabularROD {

    private static final String REAL_SNP_STRING = "SAME_SNP";
    private static final String FALSE_SNP_STRING = "NOT_SNP";

    public CleanedOutSNPROD(String name) {
        super(name);
    }

    public GenomeLoc getLocation() {
        return GenomeLocParser.parseGenomeLoc(this.get("0"));
    }

    public boolean isRealSNP() {
        String s = this.get("1");
        return s != null && s.equals(REAL_SNP_STRING);
    }
 }

Allow this ROD to consist of just the positions


package com.jamesisaac.rnbackgroundtask;

import android.app.Application;
import com.evernote.android.job.JobManager;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class BackgroundTaskPackage implements ReactPackage {
    /**
     * android-job needs to be set up with the Application context, so provide a convenience method
     * which users can add to the Application.onCreate.
     */
    public static void useContext(Application context) {
        JobManager.create(context).addJobCreator(new RNJobCreator());
    }

    @Override
    public List<NativeModule> createNativeModules(
            ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new BackgroundTaskModule(reactContext));

        return modules;
    }

    @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }
}

package com.jamesisaac.rnbackgroundtask;

import android.app.Application;
import com.evernote.android.job.JobManager;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class BackgroundTaskPackage implements ReactPackage {
    /**
     * android-job needs to be set up with the Application context, so provide a convenience method
     * which users can add to the Application.onCreate.
     */
    public static void useContext(Application context) {
        JobManager.create(context).addJobCreator(new RNJobCreator());
    }

    @Override
    public List<NativeModule> createNativeModules(
            ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new BackgroundTaskModule(reactContext));

        return modules;
    }

    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }
}

Fix breaking change in RN 0.47


import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Partitioner;

public class PARMPartitioner implements Partitioner<IntWritable, Text> {
	@Override
	public void configure(JobConf job) {}

	@Override
	public int getPartition(IntWritable key, Text value, int numPartitions) {
		return key.get();
	}
}

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Partitioner;

public class FIMPartitioner implements Partitioner<IntWritable, Text> {
	@Override
	public void configure(JobConf job) {}

	@Override
	public int getPartition(IntWritable key, Text value, int numPartitions) {
		return key.get();
	}
}

Complete the renaming by renaming the class, not just the file.


package org.openmrs.reference.page;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

public class TestProperties {
    private Properties properties;

    public TestProperties() {
        properties = new Properties();
        try {
            InputStream input = Thread.currentThread().getContextClassLoader()
                    .getResourceAsStream("org/openmrs/reference/test.properties");
            properties.load(new InputStreamReader(input, "UTF-8"));
        }
        catch (IOException ioException) {
            throw new RuntimeException("test.properties not found. Error: ", ioException);
        }
    }

    public String getWebAppUrl() {
        return properties.getProperty("webapp.url", "http://localhost:8080/openmrs");
    }

    public String getDatabaseUrl() {
        return properties.getProperty("database.url", "jdbc:mysql://localhost:3306/openmrs");
    }

    public String getDatabaseUsername() {
        return properties.getProperty("database.username", "");
    }

    public String getDatabasePassword() {
        return properties.getProperty("database.password", "");
    }

}

package org.openmrs.reference.page;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

public class TestProperties {
    private Properties properties;

    public TestProperties() {
        properties = new Properties();
        try {
            InputStream input = Thread.currentThread().getContextClassLoader()
                    .getResourceAsStream("org/openmrs/reference/test.properties");
            properties.load(new InputStreamReader(input, "UTF-8"));
        }
        catch (IOException ioException) {
            throw new RuntimeException("test.properties not found. Error: ", ioException);
        }
    }

    public String getWebAppUrl() {
        return properties.getProperty("webapp.url");
    }
}

Clean local db and webapp references


package org.irmacard.cardemu.preferences;

import android.preference.PreferenceFragment;

import org.irmacard.cardemu.R;

public class ScreenshotPreferenceFragment extends PreferenceFragment {
	@Override
	public void onResume() {
		super.onResume();

		addPreferencesFromResource(R.xml.preferences_screenshots);
	}
}

package org.irmacard.cardemu.preferences;

import android.os.Bundle;
import android.preference.PreferenceFragment;

import org.irmacard.cardemu.R;

public class ScreenshotPreferenceFragment extends PreferenceFragment {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.preferences_screenshots);
	}
}

Fix double screenshot preference when switching apps


package com.salesforce.storm.spout.sideline;

import com.salesforce.storm.spout.sideline.config.SidelineSpoutConfig;
import com.salesforce.storm.spout.sideline.handler.SidelineSpoutHandler;
import com.salesforce.storm.spout.sideline.handler.SidelineVirtualSpoutHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * Spout instance.
 */
public class SidelineSpout extends DynamicSpout {

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

    /**
     * Used to overload and modify settings before passing them to the constructor.
     * @param config Supplied configuration.
     * @return Resulting configuration.
     */
    private static Map getConfig(Map config) {
        config.put(SidelineSpoutConfig.SPOUT_HANDLER_CLASS, SidelineSpoutHandler.class.getName());
        config.put(SidelineSpoutConfig.VIRTUAL_SPOUT_HANDLER_CLASS, SidelineVirtualSpoutHandler.class.getName());
        return config;
    }

    public SidelineSpout(Map config) {
        super(getConfig(config));
    }
}

package com.salesforce.storm.spout.sideline;

import com.salesforce.storm.spout.sideline.config.SidelineSpoutConfig;
import com.salesforce.storm.spout.sideline.handler.SidelineSpoutHandler;
import com.salesforce.storm.spout.sideline.handler.SidelineVirtualSpoutHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * Spout that supports sidelining messages by filters.
 */
public class SidelineSpout extends DynamicSpout {

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

    /**
     * Used to overload and modify settings before passing them to the constructor.
     * @param config Supplied configuration.
     * @return Resulting configuration.
     */
    private static Map<String, Object> modifyConfig(Map<String, Object> _config) {
        final Map<String, Object> config = Tools.immutableCopy(_config);
        config.put(SidelineSpoutConfig.SPOUT_HANDLER_CLASS, SidelineSpoutHandler.class.getName());
        config.put(SidelineSpoutConfig.VIRTUAL_SPOUT_HANDLER_CLASS, SidelineVirtualSpoutHandler.class.getName());
        return config;
    }

    /**
     * Spout that supports sidelining messages by filters.
     * @param config Spout configuration.
     */
    public SidelineSpout(Map config) {
        super(modifyConfig(config));
    }
}

Rename config method and make an immutable copy


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

/**
 * Defines the keys for the well known labels used by the cloud debugger.
 *
 * DO NOT EDIT - This file is auto-generated
 */
package com.google.devtools.clouddebugger.v2;

public final class Labels {
  public static final class Debuggee {

    public static final String DOMAIN = "domain";
    public static final String PROJECT_ID = "projectid";
    public static final String MODULE = "module";
    public static final String MINOR_VERSION = "minorversion";
    public static final String VERSION = "version";

    private Debuggee() {}
  }

  public static final class Breakpoint {

    public static final String REQUEST_LOG_ID = "requestlogid";

    private Breakpoint() {}
  }

  private Labels() {}
}

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

/**
 * Defines the keys for the well known labels used by the cloud debugger.
 *
 * DO NOT EDIT - This file is auto-generated
 */
package com.google.devtools.clouddebugger.v2;

public final class Labels {
  public static final class Breakpoint {

    public static final String REQUEST_LOG_ID = "requestlogid";

    private Breakpoint() {}
  }

  public static final class Debuggee {

    public static final String DOMAIN = "domain";
    public static final String PROJECT_ID = "projectid";
    public static final String MODULE = "module";
    public static final String VERSION = "version";
    public static final String MINOR_VERSION = "minorversion";

    private Debuggee() {}
  }

  private Labels() {}
}

Set compatible_with=appengine on targets depended on by App Engine apps or by the App Engine runtime itself.


package org.rhq.metrics.restServlet;

/**
 * Just a simple representation of a Link
 * @author Heiko W. Rupp
 */
public class SimpleLink {
    private final String rel;
    private final String href;
    private final String title;

    public SimpleLink(String rel, String href, String title) {
        this.rel = rel;
        this.href = href;
        this.title = title;
    }

    public String getRel() {
        return rel;
    }

    public String getHref() {
        return href;
    }

    public String getTitle() {
        return title;
    }
}

package org.rhq.metrics.restServlet;

import javax.xml.bind.annotation.XmlRootElement;

import com.wordnik.swagger.annotations.ApiClass;
import com.wordnik.swagger.annotations.ApiProperty;

/**
 * Just a simple representation of a Link
 * @author Heiko W. Rupp
 */
@SuppressWarnings("unused")
@ApiClass("A simple representation of a link.")
@XmlRootElement
public class SimpleLink {
    private String rel;
    private String href;
    private String title;

    public SimpleLink() {
    }

    public SimpleLink(String rel, String href, String title) {
        this.rel = rel;
        this.href = href;
        this.title = title;
    }

    @ApiProperty("Name of the relation")
    public String getRel() {
        return rel;
    }

    @ApiProperty("Href to target entity")
    public String getHref() {
        return href;
    }

    @ApiProperty("Name of the target")
    public String getTitle() {
        return title;
    }

    public void setRel(String rel) {
        this.rel = rel;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}

Add stuff to make the xml body writer happy.


package info.elexis.server.core.redmine.internal;

public class Constants {

	/**
	 * Expected environment variable containing the api key to use for the redmine connection
	 */
	public static final String ENV_VAR_REDMINE_API_KEY = "redmine.apikey";

	/**
	 * Optional environment variable containing the redmine base url to use, defaults to
	 * https://redmine.medelexis.ch
	 */
	public static final String ENV_VAR_REDMINE_BASE_URL = "redmine.baseurl";

	public static final String DEFAULT_REDMINE_BASE_URL = "https://redmine.medelexis.ch";
	public static final String DEFAULT_REDMINE_PROJECT = "qfeedback3";

}

package info.elexis.server.core.redmine.internal;

public class Constants {

	/**
	 * Expected environment variable containing the api key to use for the redmine connection
	 */
	public static final String ENV_VAR_REDMINE_API_KEY = "REDMINE_APIKEY";

	/**
	 * Optional environment variable containing the redmine base url to use, defaults to
	 * https://redmine.medelexis.ch
	 */
	public static final String ENV_VAR_REDMINE_BASE_URL = "REDMINE_BASEURL";

	public static final String DEFAULT_REDMINE_BASE_URL = "https://redmine.medelexis.ch";
	public static final String DEFAULT_REDMINE_PROJECT = "qfeedback3";

}

Refactor Redmine env constant names


package org.talend.dataprep.dataset.configuration;

import java.util.UUID;

import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty("dataset.spark.master")
public class Spark {

    @Value("dataset.spark.master")
    private String sparkMasterUrl;

    @Bean
    public SparkContext getSparkContext() {
        SparkConf conf = new SparkConf();
        conf.set("spark.ui.enabled", "false"); //$NON-NLS-1$ //$NON-NLS-2$
        return new SparkContext(sparkMasterUrl, UUID.randomUUID().toString(), conf);
    }
}

package org.talend.dataprep.dataset.configuration;

import java.util.UUID;

import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty("dataset.spark.master")
public class Spark {

    @Value("${dataset.spark.master}")
    private String sparkMasterUrl;

    @Bean
    public SparkContext getSparkContext() {
        SparkConf conf = new SparkConf();
        conf.set("spark.ui.enabled", "false"); //$NON-NLS-1$ //$NON-NLS-2$
        return new SparkContext(sparkMasterUrl, UUID.randomUUID().toString(), conf);
    }
}

Fix wrong @Value for spark context configuration.


package org.openqa.selenium.testing.drivers;

import com.google.common.base.Supplier;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;

public class SauceBackedDriverSupplier implements Supplier<WebDriver> {

  private final Capabilities capabilities;

  public SauceBackedDriverSupplier(Capabilities caps) {
    this.capabilities = caps;
  }

  public WebDriver get() {
    if (!SauceDriver.shouldUseSauce()) {
      return null;
    }

    return new SauceDriver(capabilities);
  }
}

package org.openqa.selenium.testing.drivers;

import com.google.common.base.Supplier;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.LocalFileDetector;

public class SauceBackedDriverSupplier implements Supplier<WebDriver> {

  private final Capabilities capabilities;

  public SauceBackedDriverSupplier(Capabilities caps) {
    this.capabilities = caps;
  }

  public WebDriver get() {
    if (!SauceDriver.shouldUseSauce()) {
      return null;
    }

    SauceDriver driver = new SauceDriver(capabilities);
    driver.setFileDetector(new LocalFileDetector());
    return driver;
  }
}

Use a file detector for Sauce tests


/*
 * (C) Copyright 2016 Boni Garcia (http://bonigarcia.github.io/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
package io.github.bonigarcia.wdm.test;

import org.junit.Before;

import io.github.bonigarcia.wdm.MarionetteDriverManager;
import io.github.bonigarcia.wdm.base.BaseVersionTst;

/**
 * Test asserting Marionette versions.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.4.0
 */
public class MarionetteVersionTest extends BaseVersionTst {

	@Before
	public void setup() {
		browserManager = MarionetteDriverManager.getInstance();
		specificVersions = new String[] { "0.6.2", "0.5.0", "0.4.0", "0.3.0" };
	}

}

/*
 * (C) Copyright 2016 Boni Garcia (http://bonigarcia.github.io/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
package io.github.bonigarcia.wdm.test;

import org.junit.Before;

import io.github.bonigarcia.wdm.MarionetteDriverManager;
import io.github.bonigarcia.wdm.base.BaseVersionTst;

/**
 * Test asserting Marionette versions.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.4.0
 */
public class MarionetteVersionTest extends BaseVersionTst {

	@Before
	public void setup() {
		browserManager = MarionetteDriverManager.getInstance();
		specificVersions = new String[] { "0.9.0", "0.8.0", "0.6.2", "0.5.0",
				"0.4.0", "0.3.0" };
	}

}

Add new versions of Marionette for specific version test


package org.concord.datagraph.analysis;

import java.awt.Component;
import java.util.ArrayList;

import org.concord.data.state.OTDataStore;
import org.concord.datagraph.analysis.rubric.GraphRubric;
import org.concord.datagraph.analysis.rubric.ResultSet;
import org.concord.datagraph.state.OTDataCollector;
import org.concord.datagraph.state.OTDataGraphable;
import org.concord.framework.otrunk.OTObjectList;
import org.concord.graph.util.state.OTHideableAnnotation;

public interface GraphAnalyzer {
    public enum AnnotationStyle { ONE, TWO, THREE }
    public Graph getSegments(OTDataStore dataStore, int xChannel, int yChannel, double tolerance) throws IndexOutOfBoundsException;
    public GraphRubric buildRubric(OTObjectList rubric);
    public ResultSet compareGraphs(GraphRubric expected, Graph received);
    public String getHtmlReasons(ResultSet results);
    public void displayHtmlReasonsPopup(Component parent, ResultSet results);
    public ArrayList<OTHideableAnnotation> annotateResults(OTDataCollector dataCollector, ResultSet scoreResults, AnnotationStyle style);
    public ArrayList<OTDataGraphable> drawSegmentResults(OTDataCollector dataCollector, Graph graph);
}

package org.concord.datagraph.analysis;

import java.awt.Component;
import java.util.ArrayList;

import org.concord.data.state.OTDataStore;
import org.concord.datagraph.analysis.rubric.GraphRubric;
import org.concord.datagraph.analysis.rubric.ResultSet;
import org.concord.datagraph.state.OTDataCollector;
import org.concord.datagraph.state.OTDataGraphable;
import org.concord.framework.otrunk.OTObjectList;
import org.concord.graph.util.state.OTHideableAnnotation;

public interface GraphAnalyzer {
    public enum AnnotationStyle { ONE, TWO, THREE, FOUR }
    public Graph getSegments(OTDataStore dataStore, int xChannel, int yChannel, double tolerance) throws IndexOutOfBoundsException;
    public GraphRubric buildRubric(OTObjectList rubric);
    public ResultSet compareGraphs(GraphRubric expected, Graph received);
    public String getHtmlReasons(ResultSet results);
    public void displayHtmlReasonsPopup(Component parent, ResultSet results);
    public ArrayList<OTHideableAnnotation> annotateResults(OTDataCollector dataCollector, ResultSet scoreResults, AnnotationStyle style);
    public ArrayList<OTDataGraphable> drawSegmentResults(OTDataCollector dataCollector, Graph graph);
}

Add a fourth graph annotation style which highlights optional segments in blue.


package org.cryptonit.cloud.timestamping;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import org.bouncycastle.tsp.TSPException;
import org.bouncycastle.tsp.TimeStampRequest;
import org.bouncycastle.tsp.TimeStampResponse;
import org.cryptonit.cloud.interfaces.TimestampingAuthority;
import org.cryptonit.cloud.interfaces.TimestampingAuthorityFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Mathias Brossard
 */
@Path("/timestamp")
public class Application {
    private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
    private static TimestampingAuthorityFactory tsaFactory = null;

    @POST
    public Response timestamp(@Context HttpServletRequest request,
            @Context HttpHeaders headers) throws IOException, TSPException {
        TimeStampRequest tsq = new TimeStampRequest(request.getInputStream());

        TimestampingAuthority tsa = tsaFactory.getTimestampingAuthority(request.getServerName());
        TimeStampResponse tsr = tsa.timestamp(tsq);

        return Response.ok(tsr.getEncoded()).build();
    }

    public static void setTimestampingAuthorityFactory(TimestampingAuthorityFactory factory) {
        tsaFactory = factory;
    }
}

package org.cryptonit.cloud.timestamping;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import org.bouncycastle.tsp.TSPException;
import org.bouncycastle.tsp.TimeStampRequest;
import org.bouncycastle.tsp.TimeStampResponse;
import org.cryptonit.cloud.interfaces.TimestampingAuthority;
import org.cryptonit.cloud.interfaces.TimestampingAuthorityFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Mathias Brossard
 */
@Path("/timestamp")
public class Application {
    private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
    private static TimestampingAuthorityFactory tsaFactory = null;

    @POST
    @Consumes("application/timestamp-query")
    @Produces("application/timestamp-reply")
    public Response timestamp(@Context HttpServletRequest request,
            @Context HttpHeaders headers) throws IOException, TSPException {
        TimeStampRequest tsq = new TimeStampRequest(request.getInputStream());

        TimestampingAuthority tsa = tsaFactory.getTimestampingAuthority(request.getServerName());
        TimeStampResponse tsr = tsa.timestamp(tsq);

        return Response.ok(tsr.getEncoded()).build();
    }

    public static void setTimestampingAuthorityFactory(TimestampingAuthorityFactory factory) {
        tsaFactory = factory;
    }
}

Add content types to POST


package com.naijab.nextzytimeline.utility;

import android.content.Context;
import android.support.annotation.NonNull;

import com.naijab.nextzytimeline.R;

public class StringUtility {

    @NonNull
    public static String getHomeString(Context context) {
        return context.getResources().getString(R.string.tab_home);
    }

    @NonNull
    public static String getAboutString(Context context) {
        return context.getResources().getString(R.string.tab_about);
    }

    @NonNull
    public static String getContactString(Context context) {
        return context.getResources().getString(R.string.tab_contact);
    }

    @NonNull
    public static String getSaveSuccess(Context context) {
        return context.getResources().getString(R.string.save_success);
    }

    @NonNull
    public static String getDeleteSuccess(Context context){
        return context.getResources().getString(R.string.delete_success);
    }

}

package com.naijab.nextzytimeline.utility;

import android.content.Context;
import android.support.annotation.NonNull;

import com.naijab.nextzytimeline.R;

public class StringUtility {

    @NonNull
    public static String getSaveSuccess(Context context) {
        return context.getResources().getString(R.string.save_success);
    }

    @NonNull
    public static String getSaveError(Context context) {
        return context.getResources().getString(R.string.save_error);
    }

    @NonNull
    public static String getDeleteSuccess(Context context){
        return context.getResources().getString(R.string.delete_success);
    }

    @NonNull
    public static String getDeleteError(Context context){
        return context.getResources().getString(R.string.delete_error);
    }

}

Add get String from resource


package de.craften.plugins.educraft.luaapi.functions;

import de.craften.plugins.educraft.luaapi.EduCraftApiFunction;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;

import java.util.Collection;

/**
 * Lua API function to move one block forward.
 */
public class MoveForwardFunction extends EduCraftApiFunction {
    @Override
    public Varargs execute(Varargs varargs) {
        Block blockAhead = getApi().getBlockAhead();
        Location locationAhead = blockAhead.getLocation();
        Collection<Entity> entities = getApi().getEntitiesAhead();

        if (!blockAhead.getType().isSolid()
                && !blockAhead.getRelative(BlockFace.UP).getType().isSolid()
                && getApi().getEnvironment().getSheepAt(locationAhead) == null
                && getApi().getEnvironment().contains(locationAhead)) {
            getApi().moveTo(locationAhead, false);
        }

        return LuaValue.NIL;
    }
}

package de.craften.plugins.educraft.luaapi.functions;

import de.craften.plugins.educraft.luaapi.EduCraftApiFunction;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;

/**
 * Lua API function to move one block forward.
 */
public class MoveForwardFunction extends EduCraftApiFunction {
    @Override
    public Varargs execute(Varargs varargs) {
        Block blockAhead = getApi().getBlockAhead();
        Location locationAhead = blockAhead.getLocation();

        if (!blockAhead.getType().isSolid()
                && !blockAhead.getRelative(BlockFace.UP).getType().isSolid()
                && getApi().getEnvironment().getSheepAt(locationAhead) == null
                && getApi().getEnvironment().contains(locationAhead)) {
            getApi().moveTo(locationAhead, false);
        }

        while (!blockAhead.getRelative(BlockFace.DOWN).getType().isSolid() && blockAhead.getY() > 0) {
            blockAhead = blockAhead.getRelative(BlockFace.DOWN);
        }
        getApi().moveTo(blockAhead.getLocation(), false);

        return LuaValue.NIL;
    }
}

Make entity fall if there is no solid block below it.


package org.nibor.autolink;

import org.junit.Test;

import java.util.Iterator;
import java.util.NoSuchElementException;

import static org.junit.Assert.*;

public class LinkExtractorIterableTest {

    @Test
    public void iteratorIsNew() {
        Iterable<LinkSpan> iterable = getSingleElementIterable();
        assertEquals(LinkType.URL, iterable.iterator().next().getType());
        assertEquals(LinkType.URL, iterable.iterator().next().getType());
    }

    @Test
    public void hasNextOnlyAdvancesOnce() {
        Iterable<LinkSpan> iterable = getSingleElementIterable();
        Iterator<LinkSpan> iterator = iterable.iterator();
        assertTrue(iterator.hasNext());
        assertTrue(iterator.hasNext());
        assertNotNull(iterator.next());
        assertFalse(iterator.hasNext());
        assertFalse(iterator.hasNext());
    }

    @Test(expected = NoSuchElementException.class)
    public void nextThrowsNoSuchElementException() {
        Iterable<LinkSpan> iterable = getSingleElementIterable();
        Iterator<LinkSpan> iterator = iterable.iterator();
        assertNotNull(iterator.next());
        iterator.next();
    }

    private Iterable<LinkSpan> getSingleElementIterable() {
        String input = "foo http://example.com";
        return LinkExtractor.builder().build().extractLinks(input);
    }
}

package org.nibor.autolink;

import org.junit.Test;

import java.util.Iterator;
import java.util.NoSuchElementException;

import static org.junit.Assert.*;

public class LinkExtractorIterableTest {

    @Test
    public void iteratorIsNew() {
        Iterable<LinkSpan> iterable = getSingleElementIterable();
        assertEquals(LinkType.URL, iterable.iterator().next().getType());
        assertEquals(LinkType.URL, iterable.iterator().next().getType());
    }

    @Test
    public void hasNextOnlyAdvancesOnce() {
        Iterable<LinkSpan> iterable = getSingleElementIterable();
        Iterator<LinkSpan> iterator = iterable.iterator();
        assertTrue(iterator.hasNext());
        assertTrue(iterator.hasNext());
        assertNotNull(iterator.next());
        assertFalse(iterator.hasNext());
        assertFalse(iterator.hasNext());
    }

    @Test(expected = NoSuchElementException.class)
    public void nextThrowsNoSuchElementException() {
        Iterable<LinkSpan> iterable = getSingleElementIterable();
        Iterator<LinkSpan> iterator = iterable.iterator();
        assertNotNull(iterator.next());
        iterator.next();
    }

    @Test(expected = UnsupportedOperationException.class)
    public void removeUnsupported() {
        Iterable<LinkSpan> iterable = getSingleElementIterable();
        iterable.iterator().remove();
    }

    private Iterable<LinkSpan> getSingleElementIterable() {
        String input = "foo http://example.com";
        return LinkExtractor.builder().build().extractLinks(input);
    }
}

Add test for unsupported remove method


/*******************************************************************************
 * Copyright (c) 2015-2016 Oak Ridge National Laboratory.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.csstudio.javafx;

import java.util.logging.Logger;

/** Plugin information
 *  @author Kay Kasemir
 */
@SuppressWarnings("nls")
public class Activator // Could become plugin activator
{
    /** Plugin ID */
    public static final String ID = "org.csstudio.javafx";

    /** Logger for plugin */
    public static final Logger logger = Logger.getLogger(ID);

    /** @param base_name Icon base name (no path, no extension)
     *  @return Icon path
     */
    public static String getIcon(final String base_name)
    {
        return "platform:/plugin/org.csstudio.javafx/icons/" + base_name + ".png";
    }
}

/*******************************************************************************
 * Copyright (c) 2015-2016 Oak Ridge National Laboratory.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.csstudio.javafx;

import java.util.logging.Logger;

import org.csstudio.display.builder.util.ResourceUtil;

import javafx.scene.image.Image;

/** Plugin information
 *  @author Kay Kasemir
 */
@SuppressWarnings("nls")
public class Activator // Could become plugin activator
{
    /** Plugin ID */
    public static final String ID = "org.csstudio.javafx";

    /** Logger for plugin */
    public static final Logger logger = Logger.getLogger(ID);

    /** @param base_name Icon base name (no path, no extension)
     *  @return Image
     *  @throws Exception on error
     */
    public static Image getIcon(final String base_name) throws Exception
    {
        String path = "platform:/plugin/org.csstudio.javafx/icons/" + base_name + ".png";
        return new Image(ResourceUtil.openPlatformResource(path));
    }
}

Revert to using ResourceUtil to load icons