package ca.antonious.viewcelladapter.decorators;

import ca.antonious.viewcelladapter.sections.AbstractSection;

/**
 * Created by George on 2016-12-17.
 */

public abstract class SectionDecorator extends AbstractSection {
    private AbstractSection decoratedSection;

    public SectionDecorator(AbstractSection decoratedSection) {
        this.decoratedSection = decoratedSection;
    }

    public AbstractSection getDecoratedSection() {
        return decoratedSection;
    }
}

package ca.antonious.viewcelladapter.decorators;

import ca.antonious.viewcelladapter.internal.SectionObserver;
import ca.antonious.viewcelladapter.sections.AbstractSection;

/**
 * Created by George on 2016-12-17.
 */

public abstract class SectionDecorator extends AbstractSection implements SectionObserver {
    private AbstractSection decoratedSection;

    public SectionDecorator(AbstractSection decoratedSection) {
        this.decoratedSection = decoratedSection;
        this.decoratedSection.addObserver(this);
    }

    public AbstractSection getDecoratedSection() {
        return decoratedSection;
    }

    @Override
    public void onDataChanged() {
        notifyDataChanged();
    }
}

Update section decorator to handle notifications


package com.linkedin.uif.source.extractor.extract.restapi;

import java.io.IOException;

import com.linkedin.uif.configuration.WorkUnitState;
import com.linkedin.uif.source.extractor.Extractor;
import com.linkedin.uif.source.extractor.exception.ExtractPrepareException;
import com.linkedin.uif.source.extractor.extract.BaseSource;

/**
 * An implementation of salesforce source to get work units
 */
public class SalesforceSource<S, D> extends BaseSource<S, D> {

	public Extractor<S, D> getExtractor(WorkUnitState state) throws IOException {
		Extractor<S, D> extractor = null;
		try {
			extractor = new SalesforceExtractor<S, D>(state).build();
		} catch (ExtractPrepareException e) {
			e.printStackTrace();
			throw new IOException("Failed to prepare extractor; error-" + e.getMessage());
		}
		return extractor;
	}
}

package com.linkedin.uif.source.extractor.extract.restapi;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.linkedin.uif.configuration.WorkUnitState;
import com.linkedin.uif.source.extractor.Extractor;
import com.linkedin.uif.source.extractor.exception.ExtractPrepareException;
import com.linkedin.uif.source.extractor.extract.BaseSource;

/**
 * An implementation of salesforce source to get work units
 */
public class SalesforceSource<S, D> extends BaseSource<S, D> {
	private static final Log LOG = LogFactory.getLog(BaseSource.class);

	public Extractor<S, D> getExtractor(WorkUnitState state) throws IOException {
		Extractor<S, D> extractor = null;
		try {
			extractor = new SalesforceExtractor<S, D>(state).build();
		} catch (ExtractPrepareException e) {
			LOG.error("Failed to prepare extractor: error -" + e.getMessage());
			throw new IOException(e);
		}
		return extractor;
	}
}

Use Logging instead of printStackTrace()


package org.jvirtanen.parity.match;

/**
 * MarketListener is the interface for outbound events from the
 * matching engine.
 */
public interface MarketListener {

    /**
     * Match an incoming order to a resting order in the order book. The match
     * occurs at the price of the order in the order book.
     *
     * @param restingOrderId the order identifier of the resting order
     * @param incomingOrderId the order identifier of the incoming order
     * @param incomingSide the side of the incoming order
     * @param price the execution price
     * @param executedQuantity the executed quantity
     * @param remainingQuantity the remaining quantity of the resting order
     */
    void match(long restingOrderId, long incomingOrderId, Side incomingSide, long price, long executedQuantity, long remainingQuantity);

    /**
     * Add an order to the order book.
     *
     * @param orderId the order identifier
     * @param side the side
     * @param price the limit price
     * @param size the size
     */
    void add(long orderId, Side side, long price, long size);

    /**
     * Cancel a quantity of an order.
     *
     * @param orderId the order identifier
     * @param canceledQuantity the canceled quantity
     * @param remainingQuantity the remaining quantity
     */
    void cancel(long orderId, long canceledQuantity, long remainingQuantity);

}

package org.jvirtanen.parity.match;

/**
 * The interface for outbound events from the matching engine.
 */
public interface MarketListener {

    /**
     * Match an incoming order to a resting order in the order book. The match
     * occurs at the price of the order in the order book.
     *
     * @param restingOrderId the order identifier of the resting order
     * @param incomingOrderId the order identifier of the incoming order
     * @param incomingSide the side of the incoming order
     * @param price the execution price
     * @param executedQuantity the executed quantity
     * @param remainingQuantity the remaining quantity of the resting order
     */
    void match(long restingOrderId, long incomingOrderId, Side incomingSide, long price, long executedQuantity, long remainingQuantity);

    /**
     * Add an order to the order book.
     *
     * @param orderId the order identifier
     * @param side the side
     * @param price the limit price
     * @param size the size
     */
    void add(long orderId, Side side, long price, long size);

    /**
     * Cancel a quantity of an order.
     *
     * @param orderId the order identifier
     * @param canceledQuantity the canceled quantity
     * @param remainingQuantity the remaining quantity
     */
    void cancel(long orderId, long canceledQuantity, long remainingQuantity);

}

Tweak documentation for market listener in matching engine


package org.wikipedia.dataclient.mwapi;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

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

@SuppressWarnings("unused")
public class EditorTaskCounts {
    @Nullable private Counts counts;
    @Nullable private List<String> targetsPassed;

    public class Counts {
        @Nullable @SerializedName("app_description_edits") private Map<String, Integer> appDescriptionEdits;
    }
}

package org.wikipedia.dataclient.mwapi;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

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

@SuppressWarnings("unused")
public class EditorTaskCounts {
    @Nullable private Counts counts;
    @Nullable private Targets targetsPassed;

    @Nullable
    public Map<String, Integer> getDescriptionEditsPerLanguage() {
        return counts != null && counts.appDescriptionEdits != null ? counts.appDescriptionEdits : null;
    }

    @Nullable
    public List<Integer> getDescriptionEditTargetsPassed() {
        return targetsPassed != null && targetsPassed.appDescriptionEdits != null ? targetsPassed.appDescriptionEdits : null;
    }

    public class Counts {
        @Nullable @SerializedName("app_description_edits") private Map<String, Integer> appDescriptionEdits;
    }

    public class Targets {
        @Nullable @SerializedName("app_description_edits") private List<Integer> appDescriptionEdits;
    }
}

Complete the model structure of editor task API response.


package backend;

import java.security.interfaces.RSAPrivateKey;

/**
 * Wrapper class for the initial data that is to be sent to the
 * smartcard/terminal upon initialization.
 *
 * TODO/WARNING: values can be null in current implementation
 */
public class InitData {

	public byte[] certificate;
	public byte[] privateKey;
	public byte[] secretKey;
	public byte[] caVerifKey;

	public InitData(byte[] certificate, RSAPrivateKey privateKey) {
		this(certificate, privateKey, null, null);
	}

	public InitData(byte[] certificate, RSAPrivateKey privateKey, byte[] caVerifKey) {
		this(certificate, privateKey, null, caVerifKey);
	}

	public InitData(byte[] certificate, RSAPrivateKey privateKey, byte[] secretKey,
			byte[] caVerifKey) {
		this.certificate = certificate;
		this.privateKey = privateKey;
		this.secretKey = secretKey;
		this.caVerifKey = caVerifKey;
	}
}

package backend;

import java.security.interfaces.RSAPrivateKey;

/**
 * Wrapper class for the initial data that is to be sent to the
 * smartcard/terminal upon initialization.
 *
 * TODO/WARNING: values can be null in current implementation
 */
public class InitData {

	public byte[] certificate;
	public RSAPrivateKey privateKey;
	public byte[] secretKey;
	public byte[] caVerifKey;

	public InitData(byte[] certificate, RSAPrivateKey privateKey) {
		this.certificate = certificate;
		this.privateKey = privateKey;
	}

	public InitData(byte[] certificate, RSAPrivateKey privateKey, byte[] caVerifKey) {
		this.certificate = certificate;
		this.privateKey = privateKey;
		this.caVerifKey = caVerifKey;
	}
}

Change data type of terminal data


/*
 * Copyright 2014 Gabriel Harris-Rouquette
 *
 * 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.afterkraft.kraftrpg.entity.party;

import com.afterkraft.kraftrpg.api.RPGPlugin;
import com.afterkraft.kraftrpg.api.entity.Champion;
import com.afterkraft.kraftrpg.api.entity.party.Party;
import com.afterkraft.kraftrpg.api.entity.party.PartyManager;

public class RPGPartyManager implements PartyManager {

    private final RPGPlugin plugin;

    public RPGPartyManager(RPGPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public Party createParty(Champion partyLeader, Champion... members) {
        return null;
    }

    @Override
    public void initialize() {

    }

    @Override
    public void shutdown() {

    }
}

/*
 * Copyright 2014 Gabriel Harris-Rouquette
 *
 * 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.afterkraft.kraftrpg.entity.party;

import com.afterkraft.kraftrpg.api.RPGPlugin;
import com.afterkraft.kraftrpg.api.entity.PartyMember;
import com.afterkraft.kraftrpg.api.entity.party.Party;
import com.afterkraft.kraftrpg.api.entity.party.PartyManager;

public class RPGPartyManager implements PartyManager {

    private final RPGPlugin plugin;

    public RPGPartyManager(RPGPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public void initialize() {

    }

    @Override
    public void shutdown() {

    }

    @Override
    public Party createParty(PartyMember partyLeader, PartyMember... members) {
        return null;
    }
}

Refactor PartyManager as per API.


package se.christianjensen.maintenance;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.client.JerseyClientConfiguration;
import se.christianjensen.maintenance.representation.config.UserConfiguration;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

public class MaintenanceConfiguration extends Configuration {

    @NotNull
    @JsonProperty
    private String sigarLocation;

    @Valid
    @NotNull
    @JsonProperty
    private UserConfiguration user;

    public String getSigarLocation() {
        return sigarLocation;
    }

    public UserConfiguration getUser() {
        return user;
    }
}

package se.christianjensen.maintenance;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import se.christianjensen.maintenance.representation.config.UserConfiguration;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

public class MaintenanceConfiguration extends Configuration {

    @NotNull
    @JsonProperty
    private String sigarLocation;

    @Valid
    @NotNull
    @JsonProperty
    private UserConfiguration user;

    public String getSigarLocation() {
        return sigarLocation;
    }

    public UserConfiguration getUser() {
        return user;
    }
}

Remove JerseyClientConfig from Config class


package uk.ac.ebi.quickgo.geneproduct.common;

import java.util.function.Supplier;

/**
 * An enumeration of the possible states of proteome membership a gene product can have.
 * @author Tony Wardell
 * Date: 06/03/2018
 * Time: 10:33
 * Created with IntelliJ IDEA.
 */
public enum ProteomeMembership {
    REFERENCE, COMPLETE, NONE, NOT_APPLICABLE;

    /**
     * Define the predicates required and order of importance to work out which Proteome membership category is
     * applicable.
     * @param isProtein is the gene product a protein
     * @param isReferenceProteome is the gene product a reference proteome
     * @param isComplete is the gene product a member of a complete proteome.
     * @return the name of the ProteomeMembership matching the applied constraints
     */
    public static String membership(boolean isProtein, boolean isReferenceProteome, boolean isComplete) {

        if (!isProtein) {
            return NOT_APPLICABLE.name();
        } else if (isReferenceProteome) {
            return REFERENCE.name();
        } else if (isComplete) {
            return COMPLETE.name();
        }
        return NONE.name();
    }
}

package uk.ac.ebi.quickgo.geneproduct.common;

/**
 * An enumeration of the possible states of proteome membership a gene product can have.
 * @author Tony Wardell
 * Date: 06/03/2018
 * Time: 10:33
 * Created with IntelliJ IDEA.
 */
public enum ProteomeMembership {
    REFERENCE("Reference"),
    COMPLETE("Complete"),
    NONE("None"),
    NOT_APPLICABLE("Not-applicable");

    private String value;

    ProteomeMembership(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    /**
     * Define the predicates required and order of importance to work out which Proteome membership category is
     * applicable.
     * @param isProtein is the gene product a protein
     * @param isReferenceProteome is the gene product a reference proteome
     * @param isComplete is the gene product a member of a complete proteome.
     * @return the String representation of the ProteomeMembership matching the applied constraints
     */
    public static String membership(boolean isProtein, boolean isReferenceProteome, boolean isComplete) {

        if (!isProtein) {
            return NOT_APPLICABLE.getValue();
        } else if (isReferenceProteome) {
            return REFERENCE.getValue();
        } else if (isComplete) {
            return COMPLETE.getValue();
        }
        return NONE.getValue();
    }
}

Change the name of the method used to get the string representation of the ProteomeMemberhip emum - we are no longer going to rely on the library generated version. Provide the value to use


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

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation is used to.
 *
 * @author Sébastien Bordes
 */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface RunInto {

    /**
     * Define the RunType value.
     *
     * The default value is RunType.JIT
     */
    RunType value() default RunType.JIT;
}

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

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation is used to.
 *
 * @author Sébastien Bordes
 */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface RunInto {

    /**
     * Define the RunType value.
     *
     * The default value is RunType.JIT
     */
    RunType value() default RunType.JIT;
}

Document and inherit please :D


package com.appyvet.rangebarsample;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

public class RecyclerViewActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Removes title bar and sets content view
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_recyclerview);
        RecyclerView recyclerView = findViewById(R.id.recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(new Adapter());
    }

    public static class Adapter extends RecyclerView.Adapter<VH> {

        @NonNull
        @Override
        public VH onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
            return new VH(LayoutInflater.from(viewGroup.getContext())
                    .inflate(R.layout.recyclerview_item, viewGroup, false));
        }

        @Override
        public void onBindViewHolder(@NonNull VH vh, int i) {

        }

        @Override
        public int getItemCount() {
            return 100;
        }
    }

    public static class VH extends RecyclerView.ViewHolder {

        public VH(@NonNull View itemView) {
            super(itemView);
        }
    }
}

package com.appyvet.rangebarsample;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

public class RecyclerViewActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Removes title bar and sets content view
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_recyclerview);
        RecyclerView recyclerView = findViewById(R.id.recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        Adapter adapter = new Adapter();
        adapter.setHasStableIds(true);
        recyclerView.setAdapter(adapter);
    }

    public static class Adapter extends RecyclerView.Adapter<VH> {

        @NonNull
        @Override
        public VH onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
            return new VH(LayoutInflater.from(viewGroup.getContext())
                    .inflate(R.layout.recyclerview_item, viewGroup, false));
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public int getItemViewType(int position) {
            return position;
        }

        @Override
        public void onBindViewHolder(@NonNull VH vh, int i) {

        }

        @Override
        public int getItemCount() {
            return 50;
        }
    }

    public static class VH extends RecyclerView.ViewHolder {

        public VH(@NonNull View itemView) {
            super(itemView);
        }
    }
}

Use stable ids for the RecyclerView adapter


package net.bourgau.philippe.concurrency.kata;

import org.apache.commons.io.IOUtils;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;

public class TextLineProtocol implements AutoCloseable {
    private final Socket socket;
    private BufferedReader reader;
    private BufferedWriter writer;

    public TextLineProtocol(Socket socket) throws Exception {
        this.socket = socket;
        reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    }

    public void writeMessage(String message) throws Exception {
        writer.write(message + "\n");
        writer.flush();
    }

    public String readMessage() throws Exception {
        return reader.readLine();
    }

    @Override
    public void close() {
        IOUtils.closeQuietly(socket);
    }
}

package net.bourgau.philippe.concurrency.kata;

import org.apache.commons.io.IOUtils;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;

public class TextLineProtocol implements AutoCloseable {
    private final Socket socket;
    private BufferedReader reader;
    private BufferedWriter writer;

    public TextLineProtocol(Socket socket) throws Exception {
        this.socket = socket;
        socket.setSoTimeout(250);
        reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    }

    public void writeMessage(String message) throws Exception {
        writer.write(message + "\n");
        writer.flush();
    }

    public String readMessage() throws Exception {
        String message = null;
        while (!Thread.interrupted()) {
            try {
                message = reader.readLine();
                break;
            } catch (SocketTimeoutException ignoreTimeoutAndRetry) {
                continue;
            }
        }
        if (message == null) {
            throw new SocketException("Socket was closed before a message could be read");
        }
        return message;
    }

    @Override
    public void close() {
        IOUtils.closeQuietly(socket);
    }
}

Make reading from sockets more robust


package org.ratchetrobotics.algorithms.ai.planning;

/**
 * Documentation here.
 *
 * @author Liam Marshall
 * @version 1.0
 */
public class ActionThing {
    public ActionThing(StaticPosition position) {

    }
}

package org.ratchetrobotics.algorithms.ai.planning;

import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;

/**
 * Documentation here.
 *
 * @author Liam Marshall
 * @version 1.0
 */
public class ActionThing {
    public ActionThing(Vector3D position) {

    }
}

Use Vector3D instead of unimplemented custom class


// Copyright 2021 Code Intelligence GmbH
//
// 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.code_intelligence.jazzer.runtime;

import sun.misc.Signal;

public final class SignalHandler {
  static {
    Signal.handle(new Signal("INT"), sig -> handleInterrupt());
  }

  public static void initialize() {
    // Implicitly runs the static initializer.
  }

  private static native void handleInterrupt();
}

// Copyright 2021 Code Intelligence GmbH
//
// 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.code_intelligence.jazzer.runtime;

import sun.misc.Signal;

public final class SignalHandler {
  static {
    System.loadLibrary("jazzer_initialize");
    Signal.handle(new Signal("INT"), sig -> handleInterrupt());
  }

  public static void initialize() {
    // Implicitly runs the static initializer.
  }

  private static native void handleInterrupt();
}

Fix signal handling with --nohooks


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

package com.google.ase.interpreter.sh;

import com.google.ase.AndroidFacade;
import com.google.ase.AndroidProxy;
import com.google.ase.interpreter.AbstractInterpreterProcess;
import com.google.ase.jsonrpc.JsonRpcServer;

public class ShInterpreterProcess extends AbstractInterpreterProcess {

  private final AndroidProxy mAndroidProxy;
  private final int mAndroidProxyPort;

  public ShInterpreterProcess(AndroidFacade facade, String launchScript) {
    super(facade, launchScript);
    mAndroidProxy = new AndroidProxy(facade);
    mAndroidProxyPort = new JsonRpcServer(mAndroidProxy).start();
    buildEnvironment();
  }

  private void buildEnvironment() {
    mEnvironment.put("AP_PORT", Integer.toString(mAndroidProxyPort));
  }
}

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

package com.google.ase.interpreter.sh;

import com.google.ase.AndroidFacade;
import com.google.ase.AndroidProxy;
import com.google.ase.interpreter.AbstractInterpreterProcess;
import com.google.ase.jsonrpc.JsonRpcServer;

public class ShInterpreterProcess extends AbstractInterpreterProcess {

  private final AndroidProxy mAndroidProxy;
  private final int mAndroidProxyPort;

  public ShInterpreterProcess(AndroidFacade facade, String launchScript) {
    super(facade, launchScript);
    mAndroidProxy = new AndroidProxy(facade);
    mAndroidProxyPort = new JsonRpcServer(mAndroidProxy).start();
    buildEnvironment();
  }

  private void buildEnvironment() {
    mEnvironment.put("AP_PORT", Integer.toString(mAndroidProxyPort));
  }

  @Override
  protected void writeInterpreterCommand() {
    if (mLaunchScript != null) {
      print(SHELL_BIN + " " + mLaunchScript + "\n");
    }
  }

}

Add missing call to start shell scripts.


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

package com.example.lit.userprofile;

/**
 * Created by Riley Dixon on 01/12/2017.
 */

class BitmapTooLargeException extends Exception {
    BitmapTooLargeException(){
        super();
    }

    BitmapTooLargeException(String msg){
        super(msg);
    }

}

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

package com.example.lit.userprofile;

/**
 * Created by Riley Dixon on 01/12/2017.
 */

public class BitmapTooLargeException extends Exception {
    BitmapTooLargeException(){
        super();
    }

    BitmapTooLargeException(String msg){
        super(msg);
    }

}

Change visiablity of exception to public


/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2014 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */

package org.geomajas.gwt.example.client.security;

import org.geomajas.gwt.client.command.TokenRequestHandler;
import org.geomajas.gwt.client.command.event.TokenChangedHandler;
import org.geomajas.plugin.staticsecurity.client.util.SsecAccess;

/**
 * {@link org.geomajas.gwt.client.command.TokenRequestHandler} which allows logging in to a specific userId and password.
 *
 * @author Joachim Van der Auwera
 */
public class ShowcaseTokenRequestHandler implements TokenRequestHandler {

	// CHECKSTYLE VISIBILITY MODIFIER: OFF

	/** UserId to use for logging in. */
	public static String userId;
	/** Password to use for logging in. */
	public static String password;

	// CHECKSTYLE VISIBILITY MODIFIER: ON

	@Override
	public void login(TokenChangedHandler tokenChangedHandler) {
		SsecAccess.login(userId, password, tokenChangedHandler);
	}
}

/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2014 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */

package org.geomajas.gwt.example.client.security;

import org.geomajas.gwt.client.command.TokenRequestHandler;
import org.geomajas.gwt.client.command.event.TokenChangedHandler;
import org.geomajas.plugin.staticsecurity.client.util.SsecAccess;

/**
 * {@link org.geomajas.gwt.client.command.TokenRequestHandler} which allows logging in to a specific userId and
 * password.
 *
 * @author Joachim Van der Auwera
 */
public class ShowcaseTokenRequestHandler implements TokenRequestHandler {

	// CHECKSTYLE VISIBILITY MODIFIER: OFF

	/** UserId to use for logging in. */
	public static String userId;
	/** Password to use for logging in. */
	public static String password;

	// CHECKSTYLE VISIBILITY MODIFIER: ON

	@Override
	public void login(TokenChangedHandler tokenChangedHandler) {
		SsecAccess.login(userId, password, tokenChangedHandler);
	}
}

Fix showcase to old (svn) state.


package com.netflix.client.netty.udp;

import io.netty.channel.socket.DatagramPacket;
import io.reactivex.netty.protocol.udp.server.UdpServer;

import java.net.DatagramSocket;
import java.net.SocketException;

import org.junit.rules.ExternalResource;

public class HelloUdpServerExternalResource extends ExternalResource {
    private UdpServer<DatagramPacket, DatagramPacket> server;

    private int timeout = 0;

    public HelloUdpServerExternalResource() {
    }

    private int choosePort() throws SocketException {
        DatagramSocket serverSocket = new DatagramSocket();
        int port = serverSocket.getLocalPort();
        serverSocket.close();
        return port;
    }

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

    protected void before() throws Throwable {
        int port = choosePort();
        server = new HelloUdpServer(port, timeout).createServer();
    }

    public void start() {
        server.start();
    }

    /**
     * Override to tear down your specific external resource.
     */
    protected void after() {
        if (server != null) {
            try {
                server.shutdown();
            } catch (InterruptedException e) {
                System.out.println("Failed to shut down server");
                e.printStackTrace();
            }
        }
    }

    public int getServerPort() {
        return server.getServerPort();
    }
}

package com.netflix.client.netty.udp;

import io.netty.channel.socket.DatagramPacket;
import io.reactivex.netty.protocol.udp.server.UdpServer;

import java.net.DatagramSocket;
import java.net.SocketException;

import org.junit.rules.ExternalResource;

public class HelloUdpServerExternalResource extends ExternalResource {
    private UdpServer<DatagramPacket, DatagramPacket> server;

    private int timeout = 0;

    public HelloUdpServerExternalResource() {
    }

    private int choosePort() throws SocketException {
        DatagramSocket serverSocket = new DatagramSocket();
        int port = serverSocket.getLocalPort();
        serverSocket.close();
        return port;
    }

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

    public void start() {
        int port;
        try {
            port = choosePort();
        } catch (SocketException e) {
            throw new RuntimeException("Error choosing point", e);
        }
        server = new HelloUdpServer(port, timeout).createServer();
        server.start();
    }

    /**
     * Override to tear down your specific external resource.
     */
    protected void after() {
        if (server != null) {
            try {
                server.shutdown();
            } catch (InterruptedException e) {
                System.out.println("Failed to shut down server");
                e.printStackTrace();
            }
        }
    }

    public int getServerPort() {
        return server.getServerPort();
    }
}

Move server config from before() to start()


/**
 * Copyright 2016 Smoke Turner, LLC.
 *
 * 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.smoketurner.notification.application.health;

import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.core.RiakNode;
import com.codahale.metrics.health.HealthCheck;

public class RiakHealthCheck extends HealthCheck {

    private final RiakClient client;

    /**
     * Constructor
     *
     * @param client
     *            Riak client
     */
    public RiakHealthCheck(@Nonnull final RiakClient client) {
        this.client = Objects.requireNonNull(client);
    }

    @Override
    protected Result check() throws Exception {
        final List<RiakNode> nodes = client.getRiakCluster().getNodes();
        if (!nodes.isEmpty()) {
            return Result.healthy();
        }
        return Result.unhealthy("No available Riak nodes");
    }
}

/**
 * Copyright 2016 Smoke Turner, LLC.
 *
 * 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.smoketurner.notification.application.health;

import java.util.Objects;
import javax.annotation.Nonnull;
import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.core.operations.PingOperation;
import com.codahale.metrics.health.HealthCheck;

public class RiakHealthCheck extends HealthCheck {

    private final RiakClient client;

    /**
     * Constructor
     *
     * @param client
     *            Riak client
     */
    public RiakHealthCheck(@Nonnull final RiakClient client) {
        this.client = Objects.requireNonNull(client);
    }

    @Override
    protected Result check() throws Exception {
        final PingOperation ping = new PingOperation();
        client.getRiakCluster().execute(ping);
        ping.await();

        if (ping.isSuccess()) {
            return Result.healthy("Riak is healthly");
        }
        return Result.unhealthy("Riak is down");
    }
}

Add a proper Riak health check


package devopsdistilled.operp.client.items;

import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import devopsdistilled.operp.client.abstracts.SubTaskPane;

public class ListItemPane extends SubTaskPane implements ListItemModelObserver {

	private final ListItemPaneController controller;
	private final ListItemModel model;

	private JPanel pane;
	private JTable table;
	private ItemTableModel tableModel;

	public ListItemPane(ListItemPaneController controller, ListItemModel model) {
		this.controller = controller;

		this.model = model;
		model.registerObserver(this);
	}

	/**
	 * @wbp.parser.entryPoint
	 */
	public void init() {
		pane = new JPanel();
		tableModel = new ItemTableModel();
		table = new JTable(tableModel);
		pane.add(new JScrollPane(table));

		controller.loadData();
	}

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

	}

	@Override
	public JComponent getPane() {
		return pane;
	}

	@Override
	public void updateItemList() {
		tableModel.setItems(model.getItems());
	}

}

package devopsdistilled.operp.client.items;

import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import devopsdistilled.operp.client.abstracts.SubTaskPane;

public class ListItemPane extends SubTaskPane implements ListItemModelObserver {

	private final ListItemPaneController controller;
	private final ListItemModel model;

	private JPanel pane;
	private JTable table;
	private ItemTableModel tableModel;

	public ListItemPane(ListItemPaneController controller, ListItemModel model) {
		this.controller = controller;

		this.model = model;
		model.registerObserver(this);
	}

	/**
	 * @wbp.parser.entryPoint
	 */
	public void init() {

		tableModel = new ItemTableModel();
		table = new JTable(tableModel);
		final JScrollPane scrollPane = new JScrollPane(table,
				JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
				JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

		pane = new JPanel(new BorderLayout());
		pane.setBorder(BorderFactory.createEmptyBorder());

		pane.add(scrollPane);

		controller.loadData();
	}

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

	}

	@Override
	public JComponent getPane() {
		return pane;
	}

	@Override
	public void updateItemList() {
		tableModel.setItems(model.getItems());
	}

}

Add scrollPane to pane with variable declared


package com.codahale.metrics;

import static java.lang.Math.min;

/**
 * A {@link Reservoir} implementation backed by a sliding window that stores the last {@code N}
 * measurements.
 */
public class SlidingWindowReservoir implements Reservoir {
    private final long[] measurements;
    private long count;

    /**
     * Creates a new {@link SlidingWindowReservoir} which stores the last {@code size} measurements.
     *
     * @param size the number of measurements to store
     */
    public SlidingWindowReservoir(int size) {
        this.measurements = new long[size];
        this.count = 0;
    }

    @Override
    public synchronized int size() {
        return (int) min(count, measurements.length);
    }

    @Override
    public synchronized void update(long value) {
        measurements[((int) count++ % measurements.length)] = value;
    }

    @Override
    public Snapshot getSnapshot() {
        final long[] values = new long[size()];
        for (int i = 0; i < values.length; i++) {
            synchronized (this) {
                values[i] = measurements[i];
            }
        }
        return new Snapshot(values);
    }
}

package com.codahale.metrics;

import static java.lang.Math.min;

/**
 * A {@link Reservoir} implementation backed by a sliding window that stores the last {@code N}
 * measurements.
 */
public class SlidingWindowReservoir implements Reservoir {
	private final long[] measurements;
    private boolean fullWindow;
    private long count;

    /**
     * Creates a new {@link SlidingWindowReservoir} which stores the last {@code size} measurements.
     *
     * @param size the number of measurements to store
     */
    public SlidingWindowReservoir(int size) {
        this.measurements = new long[size];
        this.count = 0;
    }

    @Override
    public synchronized int size() {
    	if(fullWindow){
    		return measurements.length;
    	}else{
    		return (int) min(count, measurements.length);
    	}
    }

    @Override
    public synchronized void update(long value) {
        measurements[(int) count++] = value;
    	if(count >= measurements.length){
    		count = 0;
    		fullWindow = true;
    	}
    }

    @Override
    public Snapshot getSnapshot() {
        final long[] values = new long[size()];
        for (int i = 0; i < values.length; i++) {
            synchronized (this) {
                values[i] = measurements[i];
            }
        }
        return new Snapshot(values);
    }
}

Fix for ArrayOutOfBoundsException if reservoir has too many samples and causes integer overflow.


package org.tigris.subversion.svnclientadapter.javahl;

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

import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.LogMessageCallback;
import org.tigris.subversion.javahl.Revision;

public class JhlLogMessageCallback implements LogMessageCallback {

	private List messages = new ArrayList();
	private Stack stack = new Stack();

	public void singleMessage(ChangePath[] changedPaths, long revision,
			String author, long timeMicros, String message, boolean hasChildren) {
		if (revision == Revision.SVN_INVALID_REVNUM) {
			stack.pop();
			return;
		}
		JhlLogMessage msg = new JhlLogMessage(changedPaths, revision, author, timeMicros, message, hasChildren);
		if (stack.empty()) {
				messages.add(msg);
		} else {
			JhlLogMessage current = (JhlLogMessage) stack.peek();
			current.addChild(msg);
		}
		if (hasChildren)
			stack.push(msg);
	}

	public JhlLogMessage[] getLogMessages() {
		JhlLogMessage[] array = new JhlLogMessage[messages.size()];
		return (JhlLogMessage[]) messages.toArray(array);
	}

}

package org.tigris.subversion.svnclientadapter.javahl;

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

import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.LogMessageCallback;
import org.tigris.subversion.javahl.Revision;

public class JhlLogMessageCallback implements LogMessageCallback {

	private List messages = new ArrayList();
	private Stack stack = new Stack();

	public void singleMessage(ChangePath[] changedPaths, long revision,
			String author, long timeMicros, String message, boolean hasChildren) {
		if (revision == Revision.SVN_INVALID_REVNUM) {
			if (!stack.empty())
				stack.pop();
			return;
		}
		JhlLogMessage msg = new JhlLogMessage(changedPaths, revision, author, timeMicros, message, hasChildren);
		if (stack.empty()) {
				messages.add(msg);
		} else {
			JhlLogMessage current = (JhlLogMessage) stack.peek();
			current.addChild(msg);
		}
		if (hasChildren)
			stack.push(msg);
	}

	public JhlLogMessage[] getLogMessages() {
		JhlLogMessage[] array = new JhlLogMessage[messages.size()];
		return (JhlLogMessage[]) messages.toArray(array);
	}

}

Check if stack is empty before popping off a message.


/*
 * Copyright 2018 Google LLC
 *
 * 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
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.gnd.util;

import com.google.common.collect.ImmutableSet;
import java8.util.stream.Collector;
import java8.util.stream.Collectors;

/**
 * Custom collector for compatibility between {@link Collector} compat class and Guava {@link
 * ImmutableSet}.
 */
public abstract class ImmutableSetCollector {
  /** Do not instantiate. */
  private ImmutableSetCollector() {}

  private static final Collector<Object, ?, ImmutableSet<Object>> TO_IMMUTABLE_SET =
      Collectors.of(
          ImmutableSet::builder,
          ImmutableSet.Builder::add,
          (a, b) -> {
            throw new UnsupportedOperationException();
          },
          ImmutableSet.Builder::build);

  /** Returns a {@link Collector} that accumulates the input elements into a new ImmutableSet. */
  public static <E> Collector<E, ?, ImmutableSet<E>> toImmutableSet() {
    return (Collector) TO_IMMUTABLE_SET;
  }
}

/*
 * Copyright 2019 Google LLC
 *
 * 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
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.gnd.util;

import com.google.common.collect.ImmutableSet;
import java8.util.stream.Collector;
import java8.util.stream.Collectors;

/**
 * Custom collector for compatibility between {@link Collector} compat class and Guava {@link
 * ImmutableSet}.
 */
public abstract class ImmutableSetCollector {
  /** Do not instantiate. */
  private ImmutableSetCollector() {}

  private static final Collector<Object, ?, ImmutableSet<Object>> TO_IMMUTABLE_SET =
      Collectors.of(
          ImmutableSet::builder,
          ImmutableSet.Builder::add,
          (a, b) -> {
            throw new UnsupportedOperationException();
          },
          ImmutableSet.Builder::build);

  /** Returns a {@link Collector} that accumulates the input elements into a new ImmutableSet. */
  public static <E> Collector<E, ?, ImmutableSet<E>> toImmutableSet() {
    return (Collector) TO_IMMUTABLE_SET;
  }
}

Fix copyright on new file


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

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

@Component
public class MessageComponent {

    @Autowired
    private MessageService service;

    public String getMessage() {
        return service.getMessage();
    }
}

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

import org.springframework.stereotype.Component;

@Component
public class MessageComponent {

    private MessageService messageService;

    public MessageComponent(MessageService messageService) {
        this.messageService = messageService;
    }

    public String getMessage() {
        return messageService.getMessage();
    }

}

Unify variable names in components(junit5-spring)


package uk.ac.ebi.quickgo.geneproduct.common;

import uk.ac.ebi.quickgo.geneproduct.common.document.GeneProductDocument;

import java.util.List;
import java.util.Optional;
import org.springframework.data.solr.repository.SolrCrudRepository;

/**
 * Gene product repository interface exposing methods for performing searches over its contents.
 * <p>
 * See here how to change:
 * https://github.com/spring-projects/spring-data-solr/blob/master/README.md
 *
 * @author Ricardo Antunes
 */
public interface GeneProductRepository extends SolrCrudRepository<GeneProductDocument, String> {

    Optional<GeneProductDocument> findById(String id);

    List<GeneProductDocument> findCoreAttrByGeneProductId(List<String> ids);
}

package uk.ac.ebi.quickgo.geneproduct.common;

import uk.ac.ebi.quickgo.geneproduct.common.document.GeneProductDocument;

import java.util.List;
import java.util.Optional;
import org.springframework.data.solr.repository.SolrCrudRepository;

/**
 * Gene product repository interface exposing methods for performing searches over its contents.
 * <p>
 * See here how to change:
 * https://github.com/spring-projects/spring-data-solr/blob/master/README.md
 *
 * @author Ricardo Antunes
 */
public interface GeneProductRepository extends SolrCrudRepository<GeneProductDocument, String> {

    Optional<GeneProductDocument> findById(String id);

    List<GeneProductDocument> findById(List<String> ids);
}

Use findById as lookup method name.


package edu.virginia.psyc.r01.persistence;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.mindtrails.domain.questionnaire.LinkedQuestionnaireData;

import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by dan on 8/27/15.
 */
@Entity
@Table(name="AnxietyIdentity")
@EqualsAndHashCode(callSuper = true)
@Data
public class AnxietyIdentity extends LinkedQuestionnaireData {

    private Integer anxietyIdentity;
}

package edu.virginia.psyc.r01.persistence;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.mindtrails.domain.questionnaire.LinkedQuestionnaireData;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 * Created by dan on 8/27/15.
 */
@Entity
@Table(name="AnxietyIdentity")
@EqualsAndHashCode(callSuper = true)
@Data
public class AnxietyIdentity extends LinkedQuestionnaireData {

    @NotNull
    private Integer anxietyIdentity;
}

Add @NotNull validation to the Anxiety Identity java file. Keep the form hydration logic in the HTML, because the radio button options are HTML elements, not Strings. Migrating that logic to the Java file would be a pain.


package com.hypnoticocelot.telemetry.example.sink;

import com.hypnoticocelot.telemetry.tracing.Span;
import com.hypnoticocelot.telemetry.tracing.SpanSink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SLF4JSpanSink implements SpanSink {
    private static final Logger LOG = LoggerFactory.getLogger(SLF4JSpanSink.class);

    @Override
    public void record(Span span) {
        LOG.trace("[TELEMETRY id={}; pid={}; tid={}; name={}; start={}; end={}]",
                span.getId(),
                span.getParentId(),
                span.getTraceId(),
                span.getData().getName(),
                span.getStartTime(),
                span.getEndTime());
    }
}

package com.hypnoticocelot.telemetry.example.sink;

import com.google.common.collect.ImmutableMap;
import com.hypnoticocelot.telemetry.tracing.Span;
import com.hypnoticocelot.telemetry.tracing.SpanSink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class SLF4JSpanSink implements SpanSink {
    private static final Logger LOG = LoggerFactory.getLogger(SLF4JSpanSink.class);

    @Override
    public void record(Span span) {
        LOG.trace("[TELEMETRY id={}; pid={}; tid={}; name={}; start={}; end={}; annotations={}]",
                span.getId(),
                span.getParentId(),
                span.getTraceId(),
                span.getData().getName(),
                span.getStartTime(),
                span.getEndTime(),
                renderAnnotations(span.getData().getAnnotations()));
    }

    private String renderAnnotations(ImmutableMap<String, String> annotations) {
        final StringBuilder builder = new StringBuilder();
        builder.append("{");
        for (Map.Entry<String, String> entry : annotations.entrySet()) {
            builder.append(entry.getKey()).append("=").append(entry.getValue()).append(" ");
        }
        builder.append("}");
        return builder.toString();
    }
}

Include annotations in the SLF4J logged Spans.


package org.springframework.samples.petclinic.system;

import java.util.concurrent.TimeUnit;
import javax.cache.CacheManager;

import org.ehcache.config.CacheConfiguration;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.EntryUnit;
import org.ehcache.expiry.Duration;
import org.ehcache.expiry.Expirations;
import org.ehcache.jsr107.Eh107Configuration;

import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * Cache could be disable in unit test.
 */
@Configuration
@EnableCaching
@Profile("production")
class CacheConfig {

    @Bean
    public JCacheManagerCustomizer cacheManagerCustomizer() {
        return new JCacheManagerCustomizer() {
            @Override
            public void customize(CacheManager cacheManager) {
                CacheConfiguration<Object, Object> config = CacheConfigurationBuilder
                    .newCacheConfigurationBuilder(Object.class, Object.class,
                        ResourcePoolsBuilder.newResourcePoolsBuilder()
                            .heap(100, EntryUnit.ENTRIES))
                    .withExpiry(Expirations.timeToLiveExpiration(Duration.of(60, TimeUnit.SECONDS)))
                    .build();
                cacheManager.createCache("vets", Eh107Configuration.fromEhcacheCacheConfiguration(config));
            }
        };
    }

}

package org.springframework.samples.petclinic.system;

import java.util.concurrent.TimeUnit;
import javax.cache.CacheManager;

import org.ehcache.config.CacheConfiguration;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.EntryUnit;
import org.ehcache.expiry.Duration;
import org.ehcache.expiry.Expirations;
import org.ehcache.jsr107.Eh107Configuration;

import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * Cache could be disable in unit test.
 */
@Configuration
@EnableCaching
@Profile("production")
class CacheConfig {

    @Bean
    public JCacheManagerCustomizer cacheManagerCustomizer() {
        return cacheManager -> {
            CacheConfiguration<Object, Object> config = CacheConfigurationBuilder
                .newCacheConfigurationBuilder(Object.class, Object.class,
                    ResourcePoolsBuilder.newResourcePoolsBuilder()
                        .heap(100, EntryUnit.ENTRIES))
                .withExpiry(Expirations.timeToLiveExpiration(Duration.of(60, TimeUnit.SECONDS)))
                .build();
            cacheManager.createCache("vets", Eh107Configuration.fromEhcacheCacheConfiguration(config));
        };
    }

}

Replace anonymous class with lambda


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

import playn.core.Log;

class IOSLog implements Log
{
  @Override
  public void error(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void error(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void info(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void info(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void debug(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void debug(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void warn(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void warn(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }
}

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

import cli.System.Console;

import playn.core.Log;

class IOSLog implements Log
{
  // TODO: stack traces

  @Override
  public void debug(String msg) {
    Console.WriteLine("DEBUG: " + msg);
  }

  @Override
  public void debug(String msg, Throwable e) {
    debug(msg + ": " + e.getMessage());
  }

  @Override
  public void info(String msg) {
    Console.WriteLine(msg);
  }

  @Override
  public void info(String msg, Throwable e) {
    info(msg + ": " + e.getMessage());
  }

  @Override
  public void warn(String msg) {
    Console.WriteLine("WARN: " + msg);
  }

  @Override
  public void warn(String msg, Throwable e) {
    warn(msg + ": " + e.getMessage());
  }

  @Override
  public void error(String msg) {
    Console.WriteLine("ERROR: " + msg);
  }

  @Override
  public void error(String msg, Throwable e) {
    error(msg + ": " + e.getMessage());
  }
}

Implement simple logging to console.


package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.dashboardrelations.DashboardStore;
import edu.wpi.first.wpilibj.templates.debugging.DebugLevel;
import edu.wpi.first.wpilibj.templates.debugging.DebugOutput;
import edu.wpi.first.wpilibj.templates.debugging.Debuggable;
import edu.wpi.first.wpilibj.templates.debugging.InfoState;
import edu.wpi.first.wpilibj.templates.debugging.RobotDebugger;
import edu.wpi.first.wpilibj.templates.vstj.VstJ;

/**
 * Run Frisbee dumper (For top of pyramid).
 *
 * @author daboross
 */
public class RunFrisbeeDumperSolenoid extends CommandBase implements Debuggable {

    private boolean done;

    public RunFrisbeeDumperSolenoid() {
        requires(frisbeeDumperSolenoid);
    }

    protected void initialize() {
    }

    protected void execute() {
        if (VstJ.getFrisbeeDumpButtonValue() && DashboardStore.getIsClimberEnabled()) {
            frisbeeDumperSolenoid.startExpand();
            done = true;
        }
        RobotDebugger.push(this);
    }

    protected boolean isFinished() {
        return done;
    }

    protected void end() {
    }

    public DebugOutput getStatus() {
        return new InfoState("RunFrisbeeDumper", done ? "Extending" : "Not Extending", DebugLevel.HIGH);
    }
}

package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.dashboardrelations.DashboardStore;
import edu.wpi.first.wpilibj.templates.debugging.DebugLevel;
import edu.wpi.first.wpilibj.templates.debugging.DebugOutput;
import edu.wpi.first.wpilibj.templates.debugging.Debuggable;
import edu.wpi.first.wpilibj.templates.debugging.InfoState;
import edu.wpi.first.wpilibj.templates.debugging.RobotDebugger;
import edu.wpi.first.wpilibj.templates.vstj.VstJ;

/**
 * Run Frisbee dumper (For top of pyramid).
 *
 * @author daboross
 */
public class RunFrisbeeDumperSolenoid extends CommandBase implements Debuggable {

    private boolean done;

    public RunFrisbeeDumperSolenoid() {
        requires(frisbeeDumperSolenoid);
    }

    protected void initialize() {
        frisbeeDumperSolenoid.startExpand();
        RobotDebugger.push(this);
    }

    protected void execute() {
        if (VstJ.getFrisbeeDumpButtonValue() && DashboardStore.getIsClimberEnabled()) {
            frisbeeDumperSolenoid.startRetract();
            done = true;
        }
        RobotDebugger.push(this);
    }

    protected boolean isFinished() {
        return done;
    }

    protected void end() {
    }

    public DebugOutput getStatus() {
        return new InfoState("RunFrisbeeDumper", done ? "Retracting" : "Extending", DebugLevel.HIGH);
    }
}

Use 2 solenoids instead of 1. Also have startExpand and startRetract instead of just one.


package com.welovecoding.nbeditorconfig.processor;

import org.openide.filesystems.FileObject;

public class SmartSkip {

  public static final boolean IS_ON = true;
  static final String[] IGNORED_FILES = {
    ".git",
    ".svn",
    "bower_components",
    "nbproject",
    "node_modules"
  };

  public static boolean skipDirectory(FileObject directory) {
    String fileName = directory.getName();
    boolean skip = false;

    for (String pattern : IGNORED_FILES) {
      if (fileName.startsWith(pattern)) {
        skip = true;
      }
    }

    if (directory.isFolder() && fileName.startsWith(".")) {
      skip = true;
    }

    return skip;
  }
}

package com.welovecoding.nbeditorconfig.processor;

import org.openide.filesystems.FileObject;

public class SmartSkip {

  public static final boolean IS_ON = true;
  static final String[] IGNORED_FILES = {
    ".git",
    ".svn",
    "bower_components",
    "nbproject",
    "node_modules",
    "vendor"
  };

  public static boolean skipDirectory(FileObject directory) {
    String fileName = directory.getName();
    boolean skip = false;

    for (String pattern : IGNORED_FILES) {
      if (fileName.startsWith(pattern)) {
        skip = true;
      }
    }

    if (directory.isFolder() && fileName.startsWith(".")) {
      skip = true;
    }

    return skip;
  }
}

Add PHP Composer vendor exception


/*******************************************************************************
 * This file is part of Pebble.
 *
 * Copyright (c) 2014 by Mitchell Bösecke
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 ******************************************************************************/
package com.mitchellbosecke.pebble.node.expression;

import java.util.Map;

import com.mitchellbosecke.pebble.error.PebbleException;
import com.mitchellbosecke.pebble.extension.LocaleAware;
import com.mitchellbosecke.pebble.extension.Test;
import com.mitchellbosecke.pebble.node.ArgumentsNode;
import com.mitchellbosecke.pebble.node.TestInvocationExpression;
import com.mitchellbosecke.pebble.template.EvaluationContext;
import com.mitchellbosecke.pebble.template.PebbleTemplateImpl;

public class NegativeTestExpression extends BinaryExpression<Object> {

    @Override
    public Object evaluate(PebbleTemplateImpl self, EvaluationContext context) throws PebbleException {

        TestInvocationExpression testInvocation = (TestInvocationExpression) getRightExpression();
        ArgumentsNode args = testInvocation.getArgs();
        String testName = testInvocation.getTestName();

        Map<String, Test> tests = context.getTests();
        Test test = tests.get(testInvocation.getTestName());

        if (test == null) {
            throw new PebbleException(null, String.format("Test [%s] does not exist.", testName));
        }

        if (test instanceof LocaleAware) {
            ((LocaleAware) test).setLocale(context.getLocale());
        }

        Map<String, Object> namedArguments = args.getArgumentMap(self, context, test);

        return !test.apply(getLeftExpression().evaluate(self, context), namedArguments);
    }
}

/*******************************************************************************
 * This file is part of Pebble.
 *
 * Copyright (c) 2014 by Mitchell Bösecke
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 ******************************************************************************/
package com.mitchellbosecke.pebble.node.expression;

import com.mitchellbosecke.pebble.error.PebbleException;
import com.mitchellbosecke.pebble.template.EvaluationContext;
import com.mitchellbosecke.pebble.template.PebbleTemplateImpl;

public class NegativeTestExpression extends PositiveTestExpression {

    @Override
    public Object evaluate(PebbleTemplateImpl self, EvaluationContext context) throws PebbleException {
        return !((Boolean) super.evaluate(self, context));
    }
}

Improve handling negative test expression (reuse the positive expression).


/**
 * 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.
 */

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 11;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

/**
 * 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.
 */

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 12;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

Increment minor version to 2.12 to prepare for a new release.


package gov.samhsa.c2s.c2suiapi.service;

import feign.FeignException;
import gov.samhsa.c2s.c2suiapi.infrastructure.PhrClient;
import gov.samhsa.c2s.c2suiapi.service.exception.NoDocumentsFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PhrServiceImpl implements PhrService{

    private final PhrClient phrClient;

    @Autowired
    public PhrServiceImpl(PhrClient phrClient) {
        this.phrClient = phrClient;
    }

    @Override
    public List<Object> getAllDocumentTypeCodesList(){
        return phrClient.getAllDocumentTypeCodesList();
    }

    @Override
    public List<Object> getPatientDocumentInfoList(String patientMrn){
        try{
            return phrClient.getPatientDocumentInfoList(patientMrn);
        }catch (FeignException fe){
            if(fe.status() == 404){
                throw new NoDocumentsFoundException(fe.getMessage());
            }
        }
        return null;
    }

}

package gov.samhsa.c2s.c2suiapi.service;

import com.netflix.hystrix.exception.HystrixRuntimeException;
import feign.FeignException;
import gov.samhsa.c2s.c2suiapi.infrastructure.PhrClient;
import gov.samhsa.c2s.c2suiapi.service.exception.NoDocumentsFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PhrServiceImpl implements PhrService{

    private final PhrClient phrClient;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    public PhrServiceImpl(PhrClient phrClient) {
        this.phrClient = phrClient;
    }

    @Override
    public List<Object> getAllDocumentTypeCodesList(){
        return phrClient.getAllDocumentTypeCodesList();
    }

    @Override
    public List<Object> getPatientDocumentInfoList(String patientMrn){
        try{
            return phrClient.getPatientDocumentInfoList(patientMrn);
        }catch(HystrixRuntimeException err) {
            Throwable t = err.getCause();
            if(t instanceof FeignException && ((FeignException) t).status() == 404){
                throw new NoDocumentsFoundException(t.getMessage());
            }
        }
        return null;
    }

}

Throw custom error when status code is 404


/*
 *
		Fugerit Java Library is distributed under the terms of :

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

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

	Project site:
		http://www.fugerit.org/java/

	SCM site :
		https://github.com/fugerit79/fj-lib

 *
 */
package org.fugerit.java.core.lang.helpers;

public class ConcatHelper {

	public static final String CONCAT_SEPARATOR_DEFAULT = "/";

	public static String convertNullToBlank( String v ) {
		String r = "";
		if ( v != null ) {
			r = v;
		}
		return r;
	}

	public static String concatWithDefaultSeparator( String... values ) {
		return concat( CONCAT_SEPARATOR_DEFAULT, values );
	}

	public static String concat( String separator, String... values ) {
		StringBuffer buffer = new StringBuffer();
		buffer.append( convertNullToBlank( values[0] ) );
		for ( int k=1; k<values.length; k++ ) {
			buffer.append( CONCAT_SEPARATOR_DEFAULT );
			buffer.append( convertNullToBlank( values[k] ) );
		}
		return buffer.toString();
	}

}

/*
 *
		Fugerit Java Library is distributed under the terms of :

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

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

	Project site:
		http://www.fugerit.org/java/

	SCM site :
		https://github.com/fugerit79/fj-lib

 *
 */
package org.fugerit.java.core.lang.helpers;

public class ConcatHelper {

	public static final String CONCAT_SEPARATOR_DEFAULT = "/";

	public static String convertNullToBlank( String v ) {
		String r = "";
		if ( v != null ) {
			r = v;
		}
		return r;
	}

	public static String concatWithDefaultSeparator( String... values ) {
		return concat( CONCAT_SEPARATOR_DEFAULT, values );
	}

	public static String concat( String separator, String... values ) {
		StringBuffer buffer = new StringBuffer();
		buffer.append( convertNullToBlank( values[0] ) );
		for ( int k=1; k<values.length; k++ ) {
			buffer.append( separator );
			buffer.append( convertNullToBlank( values[k] ) );
		}
		return buffer.toString();
	}

}

Correct concat helper separator handler


package org.elasticsearch.mapping;

import java.beans.IntrospectionException;
import java.io.IOException;

import junit.framework.Assert;

import org.elasticsearch.mapping.model.Person;
import org.junit.Test;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;

/**
 * Test the mappings.
 *
 * @author luc boutier
 */
public class MappingBuilderTest {

    @Test
    public void testSimpleClassMapping() throws IntrospectionException, JsonGenerationException, JsonMappingException,
            IOException {
        MappingBuilder mappingBuilder = new MappingBuilder();
        mappingBuilder.initialize("org.elasticsearch.mapping.model");
        String personMapping = mappingBuilder.getMapping(Person.class);
        Assert.assertEquals(
                "{\"person\":{\"_type\":{\"index\":\"not_analyzed\",\"store\":false},\"_id\":{\"index\":\"no\",\"store\":false,\"path\":\"id\"},\"_source\":{\"enabled\":true},\"properties\":{\"lastname\":{\"include_in_all\":true,\"index\":\"analyzed\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"},\"firstname\":{\"include_in_all\":false,\"index\":\"no\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"}},\"_all\":{\"enabled\":true}}}",
                personMapping);
    }
}

package org.elasticsearch.mapping;

import java.beans.IntrospectionException;
import java.io.IOException;

import junit.framework.Assert;

import org.elasticsearch.mapping.model.Person;
import org.junit.Test;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;

/**
 * Test the mappings.
 *
 * @author luc boutier
 */
public class MappingBuilderTest {

    @Test
    public void testSimpleClassMapping() throws IntrospectionException, JsonGenerationException, JsonMappingException,
            IOException {
        MappingBuilder mappingBuilder = new MappingBuilder();
        mappingBuilder.initialize("org.elasticsearch.mapping.model");
        String personMapping = mappingBuilder.getMapping(Person.class);
        Assert.assertEquals(
                "{\"person\":{\"_type\":{\"index\":\"not_analyzed\",\"store\":false},\"_id\":{\"index\":\"no\",\"store\":false,\"path\":\"id\"},\"_source\":{\"enabled\":true},\"properties\":{\"address\":{\"properties\":{\"city\":{\"include_in_all\":false,\"index\":\"not_analyzed\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"}},\"type\":\"nested\"},\"lastname\":{\"include_in_all\":true,\"index\":\"analyzed\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"},\"firstname\":{\"include_in_all\":false,\"index\":\"no\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"}},\"_all\":{\"enabled\":true}}}",
                personMapping);
    }
}

Fix test as we now have the address mapping (nested type)


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_4__1_5__1_6;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleSpawnPainting;
import protocolsupport.protocol.packet.middleimpl.PacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class SpawnPainting extends MiddleSpawnPainting<RecyclableCollection<PacketData>> {

	@Override
	public RecyclableCollection<PacketData> toData(ProtocolVersion version) {
		switch (direction) {
			case 0: {
				position.modifyZ(-1);
				break;
			}
			case 1: {
				position.modifyX(1);
				break;
			}
			case 2: {
				position.modifyZ(1);
				break;
			}
			case 3: {
				position.modifyX(-1);
				break;
			}
		}
		PacketData serializer = PacketData.create(ClientBoundPacket.PLAY_SPAWN_PAINTING_ID, version);
		serializer.writeInt(entityId);
		serializer.writeString(type);
		serializer.writeLegacyPositionI(position);
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_4__1_5__1_6;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleSpawnPainting;
import protocolsupport.protocol.packet.middleimpl.PacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class SpawnPainting extends MiddleSpawnPainting<RecyclableCollection<PacketData>> {

	@Override
	public RecyclableCollection<PacketData> toData(ProtocolVersion version) {
		switch (direction) {
			case 0: {
				position.modifyZ(-1);
				break;
			}
			case 1: {
				position.modifyX(1);
				break;
			}
			case 2: {
				position.modifyZ(1);
				break;
			}
			case 3: {
				position.modifyX(-1);
				break;
			}
		}
		PacketData serializer = PacketData.create(ClientBoundPacket.PLAY_SPAWN_PAINTING_ID, version);
		serializer.writeInt(entityId);
		serializer.writeString(type);
		serializer.writeLegacyPositionI(position);
		serializer.writeInt(direction);
		return RecyclableSingletonList.create(serializer);
	}

}

Fix spawn painting encode for 1.4.7-1.6.5


package com.zygon.htm.core;

import com.google.common.util.concurrent.AbstractScheduledService;
import java.util.concurrent.TimeUnit;

/**
 *
 * @author zygon
 */
public abstract class AbstractScheduledServiceImpl extends AbstractScheduledService {

    public static final class Settings {

        private long period = 0;
        private TimeUnit timeUnit = TimeUnit.SECONDS;

        public long getPeriod() {
            return period;
        }

        public TimeUnit getTimeUnit() {
            return timeUnit;
        }

        public void setPeriod(long period) {
            this.period = period;
        }

        public void setTimeUnit(TimeUnit timeUnit) {
            this.timeUnit = timeUnit;
        }
    }

    private final Scheduler scheduler;

    protected AbstractScheduledServiceImpl(Settings settings) {
        super();

        if (settings == null) {
            // defaults
            settings = new Settings();
        }

        this.scheduler = Scheduler.newFixedRateSchedule(0, settings.getPeriod(), settings.getTimeUnit());
    }

    protected abstract void doRun() throws Exception;

    @Override
    protected final void runOneIteration() throws Exception {
        try {
            this.doRun();
        } catch (Exception e) {
            // TODO: log?
            e.printStackTrace();
        }
    }

    @Override
    protected final Scheduler scheduler() {
        return this.scheduler;
    }
}

package com.zygon.htm.core;

import com.google.common.util.concurrent.AbstractScheduledService;
import java.util.concurrent.TimeUnit;

/**
 *
 * @author zygon
 */
public abstract class AbstractScheduledServiceImpl extends AbstractScheduledService {

    public static final class Settings {

        public static Settings create(long period, TimeUnit timeUnit) {
            Settings s = new Settings();
            s.setPeriod(period);
            s.setTimeUnit(timeUnit);
            return s;
        }

        private long period = 0;
        private TimeUnit timeUnit = TimeUnit.SECONDS;

        public long getPeriod() {
            return period;
        }

        public TimeUnit getTimeUnit() {
            return timeUnit;
        }

        public void setPeriod(long period) {
            this.period = period;
        }

        public void setTimeUnit(TimeUnit timeUnit) {
            this.timeUnit = timeUnit;
        }
    }

    private final Scheduler scheduler;

    protected AbstractScheduledServiceImpl(Settings settings) {
        super();

        if (settings == null) {
            // defaults
            settings = new Settings();
        }

        this.scheduler = Scheduler.newFixedRateSchedule(0, settings.getPeriod(), settings.getTimeUnit());
    }

    protected abstract void doRun() throws Exception;

    @Override
    protected final void runOneIteration() throws Exception {
        try {
            this.doRun();
        } catch (Exception e) {
            // TODO: log?
            e.printStackTrace();
        }
    }

    @Override
    protected final Scheduler scheduler() {
        return this.scheduler;
    }
}

Add static factory method for settings.


package seedu.ezdo.model.task;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.ezdo.model.todo.StartDate;

public class StartDateTest {

    @Test
    public void isValidStartDate() {
        // invalid dates
        assertFalse(StartDate.isValidTaskDate(" ")); // spaces only
        assertFalse(StartDate.isValidTaskDate("next")); // non-numeric
        assertFalse(StartDate.isValidTaskDate("13 12 1999")); // spaces within
                                                              // digits
        assertFalse(StartDate.isValidTaskDate("05.10.1977")); // fullstops
                                                              // within digits
        assertFalse(StartDate.isValidTaskDate("22/11/q2r1")); // alphabets
                                                              // within digits

        // valid dates
        assertTrue(StartDate.isValidTaskDate("15/12/1992 10:12")); // month with
                                                                   // 31 days
        assertTrue(StartDate.isValidTaskDate("11/02/2014 07:21")); // month with
                                                                   // 30 days
        assertTrue(StartDate.isValidTaskDate("29/02/2003 20:21")); // leap year
    }

}

Remove extra line in line 33


package org.rapidoid.test;

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

import org.junit.Before;
import org.rapidoid.log.Log;
import org.rapidoid.log.LogLevel;
import org.rapidoid.security.Roles;

public abstract class AbstractCommonsTest extends TestCommons {

	@Before
	public void openContext() {
		Roles.resetConfig();
		Log.setLogLevel(LogLevel.INFO);
	}

}

package org.rapidoid.test;

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

import org.junit.Before;
import org.rapidoid.config.Conf;
import org.rapidoid.log.Log;
import org.rapidoid.log.LogLevel;
import org.rapidoid.security.Roles;

public abstract class AbstractCommonsTest extends TestCommons {

	@Before
	public void openContext() {
		Conf.setRootPath(Conf.rootPathDefault());
		Roles.resetConfig();
		Log.setLogLevel(LogLevel.INFO);
	}

}

Reset root path config for each test.


package com.proxerme.library.parameters;

import android.support.annotation.StringDef;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Class containing the the available countries, used for translator groups and industries.
 *
 * @author Ruben Gees
 */
public class CountryParameter {

    public static final String GERMAN = "de";
    public static final String ENGLISH = "en";
    public static final String JAPANESE = "jp";
    public static final String MISCELLANEOUS = "misc";

    private CountryParameter() {
    }

    /**
     * An annotation representing the available countries.
     */
    @StringDef({GERMAN, ENGLISH, JAPANESE, MISCELLANEOUS})
    @Retention(value = RetentionPolicy.SOURCE)
    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
    public @interface Country {
    }
}

package com.proxerme.library.parameters;

import android.support.annotation.StringDef;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Class containing the the available countries, used for translator groups and industries.
 *
 * @author Ruben Gees
 */
public class CountryParameter {

    public static final String GERMAN = "de";
    public static final String ENGLISH = "en";
    public static final String UNITED_STATES = "us";
    public static final String JAPANESE = "jp";
    public static final String MISCELLANEOUS = "misc";

    private CountryParameter() {
    }

    /**
     * An annotation representing the available countries.
     */
    @StringDef({GERMAN, ENGLISH, UNITED_STATES, JAPANESE, MISCELLANEOUS})
    @Retention(value = RetentionPolicy.SOURCE)
    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
    public @interface Country {
    }
}

Add united states to the languages


package com.google.sps.servlets;

import com.google.appengine.api.users.UserServiceFactory;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/user-events")
public class UserProfileEventsServlet extends HttpServlet {
  private static final String email =
      UserServiceFactory.getUserService().getCurrentUser().getEmail();

  /** Gets the current user's corresponding events in DB */
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

  }

  /** Updates the current user's corresponding events in DB */
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {

  }
}

package com.google.sps.servlets;

import com.google.appengine.api.users.UserServiceFactory;
import com.google.sps.data.EventVolunteering;
import com.google.sps.utilities.CommonUtils;
import com.google.sps.utilities.SpannerTasks;
import java.io.IOException;
import java.util.Set;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/user-events")
public class UserProfileEventsServlet extends HttpServlet {
  private static final String EVENT_TYPE = "event-type";
  private static final String VOLUNTEERING = "volunteering";
  private static final String email =
      UserServiceFactory.getUserService().getCurrentUser().getEmail();

  /** Gets the current user's corresponding events in DB */
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String eventType = request.getParameter(EVENT_TYPE);
    if (eventType.equals(VOLUNTEERING)) {
        Set<EventVolunteering> eventsVolunteering = SpannerTasks.getEventsVolunteeringByEmail(email);
        response.getWriter().println(CommonUtils.convertToJson(eventsVolunteering));
    }
  }

  /** Updates the current user's corresponding events in DB */
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {

  }
}

Add servlet functionality to retrieve events volunteering.


package com.github.steveice10.mc.protocol.packet.ingame.server.window;

import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;

import java.io.IOException;

@Data
@Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor
public class ServerSetSlotPacket implements Packet {
    private int windowId;
    private int slot;
    private @NonNull ItemStack item;

    @Override
    public void read(NetInput in) throws IOException {
        this.windowId = in.readUnsignedByte();
        this.slot = in.readShort();
        this.item = ItemStack.read(in);
    }

    @Override
    public void write(NetOutput out) throws IOException {
        out.writeByte(this.windowId);
        out.writeShort(this.slot);
        ItemStack.write(out, this.item);
    }

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

package com.github.steveice10.mc.protocol.packet.ingame.server.window;

import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;

import java.io.IOException;

@Data
@Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor
public class ServerSetSlotPacket implements Packet {
    private int windowId;
    private int slot;
    private ItemStack item;

    @Override
    public void read(NetInput in) throws IOException {
        this.windowId = in.readUnsignedByte();
        this.slot = in.readShort();
        this.item = ItemStack.read(in);
    }

    @Override
    public void write(NetOutput out) throws IOException {
        out.writeByte(this.windowId);
        out.writeShort(this.slot);
        ItemStack.write(out, this.item);
    }

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

Remove @NonNull from a nullable parameter