package com.boundary.plugin.sdk;

public class Dashboard {

}

// Copyright 2014 Boundary, 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.boundary.plugin.sdk;

/**
 * Data structure the represents a dashboard in the plugin.json plugin manifest
 *
 *

 * "dashboards" : [
        { "name": "Plugin Shell", "layout": "d-w=3&d-h=2&d-pad=5&d-bg=none&d-g-BOUNDARY_PORT_AVAILABILITY=0-1-1-1&d-g-BOUNDARY_RANDOM_NUMBER=0-0-1-1&d-g-BOUNDARY_PROCESS_COUNT=1-0-1-1&d-g-BOUNDARY_FILE_SPACE_CAPACITY=2-0-1-1&d-g-BOUNDARY_PORT_RESPONSE=1-1-1-1"},
        { "name": "CPU Load", "layout":"d-w=1&d-h=3&d-pad=5&d-bg=none&d-g-BOUNDARY_CPU_LOAD_1_MINUTE=0-0-1-1&d-g-BOUNDARY_CPU_LOAD_5_MINUTE=0-1-1-1&d-g-BOUNDARY_CPU_LOAD_15_MINUTE=0-2-1-1"}
    ]
 *

 *
 */
public class Dashboard {
	String name;
	String layout;
}

Add fields; license ; and javadoc


package info.u_team.u_team_test2;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.construct.ConstructManager;
import info.u_team.u_team_core.integration.IntegrationManager;
import info.u_team.u_team_core.util.verify.JarSignVerifier;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod2.MODID)
public class TestMod2 {

	public static final String MODID = "uteamtest2";
	public static final Logger LOGGER = LogManager.getLogger("UTeamTest2");

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

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

		ConstructManager.constructConstructs(MODID);
		IntegrationManager.constructIntegrations(MODID);
	}
}

package info.u_team.u_team_test2;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.util.annotation.AnnotationManager;
import info.u_team.u_team_core.util.verify.JarSignVerifier;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod2.MODID)
public class TestMod2 {

	public static final String MODID = "uteamtest2";
	public static final Logger LOGGER = LogManager.getLogger("UTeamTest2");

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

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

		AnnotationManager.callAnnotations(MODID);
	}
}

Update testmod 2 to use the new method


package io.jahed.twitchrobot;

import java.util.List;

import org.pircbotx.PircBotX;
import org.pircbotx.ServerInfo;

public class TwitchServerInfo extends ServerInfo {

	public TwitchServerInfo(PircBotX bot) {
		super(bot);
	}

	@Override
	public void parse(int code, List<String> parsedLine) {
		//Library assumes too much.
		if(code == 4 && parsedLine.size() < 2) {
			System.err.println("TwitchServerInfo - Code 4 with " + parsedLine);
			return;
		}

		super.parse(code, parsedLine);
	}

}

package io.jahed.twitchrobot;

import java.util.List;

import org.pircbotx.PircBotX;
import org.pircbotx.ServerInfo;

public class TwitchServerInfo extends ServerInfo {

	public TwitchServerInfo(PircBotX bot) {
		super(bot);
	}

	@Override
	public void parse(int code, List<String> parsedLine) {
		if(code == 4 && parsedLine.size() < 2) {
			//Twitch IRC Server has an extra Code 4 response containing user's nick.
			return;
		}

		super.parse(code, parsedLine);
	}

}

Remove println for extra IRC handlers


package com.example.rxappfocus;

import android.app.Application;
import android.widget.Toast;

import com.gramboid.rxappfocus.AppFocusProvider;

import rx.functions.Action1;

public class App extends Application {

    private AppFocusProvider focusProvider;

    @Override
    public void onCreate() {
        super.onCreate();
        focusProvider = new AppFocusProvider(this);
        focusProvider
                .getAppFocus()
                .subscribe(new Action1<Boolean>() {
                    @Override
                    public void call(Boolean visible) {
                        Toast.makeText(App.this, visible ? "App visible" : "App hidden", Toast.LENGTH_SHORT).show();
                    }
                });
    }

    public AppFocusProvider getFocusProvider() {
        return focusProvider;
    }
}

package com.example.rxappfocus;

import android.app.Application;
import android.widget.Toast;

import com.gramboid.rxappfocus.AppFocusProvider;

import rx.functions.Action1;

public class App extends Application {

    private AppFocusProvider focusProvider;

    @Override
    public void onCreate() {
        super.onCreate();
        focusProvider = new AppFocusProvider(this);

        // show a toast every time the app becomes visible or hidden
        focusProvider.getAppFocus()
                .subscribe(new Action1<Boolean>() {
                    @Override
                    public void call(Boolean visible) {
                        Toast.makeText(App.this, visible ? "App visible" : "App hidden", Toast.LENGTH_SHORT).show();
                    }
                });
    }

    public AppFocusProvider getFocusProvider() {
        return focusProvider;
    }
}

Tidy up and add comment


package edu.northwestern.bioinformatics.studycalendar.domain;

import javax.persistence.Entity;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Transient;

/**
 * @author Nataliya Shurupova
 */

@Entity
@DiscriminatorValue(value="2")
public class DayOfTheWeek extends Holiday {
    private String dayOfTheWeek;

    @Transient
    public String getDisplayName() {
        return getDayOfTheWeek();
    }

    @Transient
    public int getDayOfTheWeekInteger() {
        return mapDayNameToInteger(getDayOfTheWeek());
    }

    public String getDayOfTheWeek() {
        return this.dayOfTheWeek;
    }

    public void setDayOfTheWeek(String dayOfTheWeek) {
        this.dayOfTheWeek = dayOfTheWeek;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DayOfTheWeek that = (DayOfTheWeek) o;

        if (dayOfTheWeek != null ? !dayOfTheWeek.equals(that.dayOfTheWeek) : that.dayOfTheWeek != null)
            return false;

        return true;
    }

    @Override
    public String toString(){
        StringBuffer sb = new StringBuffer();
        sb.append("Id = ");
        sb.append(getId());
        sb.append(" DayOfTheWeek = ");
        sb.append(getDayOfTheWeek());
        sb.append(super.toString());
        return sb.toString();
    }
}

package edu.northwestern.bioinformatics.studycalendar.domain;

import javax.persistence.Entity;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Transient;

/**
 * @author Nataliya Shurupova
 */

@Entity
@DiscriminatorValue(value="2")
public class DayOfTheWeek extends Holiday {
    // TODO: This ought to be the java.util.Calendar constant for the day, or a custom enum
    private String dayOfTheWeek;

    @Transient
    public String getDisplayName() {
        return getDayOfTheWeek();
    }

    @Transient
    public int getDayOfTheWeekInteger() {
        return mapDayNameToInteger(getDayOfTheWeek());
    }

    public String getDayOfTheWeek() {
        return this.dayOfTheWeek;
    }

    public void setDayOfTheWeek(String dayOfTheWeek) {
        this.dayOfTheWeek = dayOfTheWeek;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DayOfTheWeek that = (DayOfTheWeek) o;

        if (dayOfTheWeek != null ? !dayOfTheWeek.equals(that.dayOfTheWeek) : that.dayOfTheWeek != null)
            return false;

        return true;
    }

    @Override
    public String toString(){
        StringBuffer sb = new StringBuffer();
        sb.append("Id = ");
        sb.append(getId());
        sb.append(" DayOfTheWeek = ");
        sb.append(getDayOfTheWeek());
        sb.append(super.toString());
        return sb.toString();
    }
}

Add TODO about using an enum instead of an unconstrained string


/* Generated By:JJTree: Do not edit this line. ASTJexlScript.java */

package org.apache.commons.jexl.parser;

/**
 * Top of the syntax tree - parsed Jexl code.
 */
public class ASTJexlScript extends SimpleNode {
  public ASTJexlScript(int id) {
    super(id);
  }

  public ASTJexlScript(Parser p, int id) {
    super(p, id);
  }

  /** Accept the visitor. **/
  public Object jjtAccept(ParserVisitor visitor, Object data) {
    return visitor.visit(this, data);
  }
}

/* Generated By:JJTree: Do not edit this line. ASTJexlScript.java */

package org.apache.commons.jexl.parser;

import org.apache.commons.jexl.JexlContext;

/**
 * Top of the syntax tree - parsed Jexl code.
 * @since 1.1
 */
public class ASTJexlScript extends SimpleNode {
  public ASTJexlScript(int id) {
    super(id);
  }

  public ASTJexlScript(Parser p, int id) {
    super(p, id);
  }

  /** Accept the visitor. **/
  public Object jjtAccept(ParserVisitor visitor, Object data) {
    return visitor.visit(this, data);
  }

  public Object value(JexlContext jc) throws Exception
  {
      SimpleNode child = (SimpleNode)jjtGetChild(0);
      return child.value(jc);
  }
}

Add value(context) method to support scripts


package com.nulabinc.zxcvbn.matchers;

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

public class Dictionary {

    private final String name;

    private final List<String> frequencies;

    private final Map<String, Integer> rankedDictionary;

    public Dictionary(String name, List<String> frequencies) {
        this.name = name;
        this.frequencies = frequencies;
        this.rankedDictionary = toRankedDictionary(frequencies);
    }

    private Map<String, Integer> toRankedDictionary(final List<String> frequencies) {
        Map<String, Integer> result = new HashMap<>();
        int i = 1; // rank starts at 1, not 0
        for (String word : frequencies) {
            result.put(word, i);
            i++;
        }
        return result;
    }

    public String getName() {
        return name;
    }

    public List<String> getFrequencies() {
        return frequencies;
    }

    public Map<String, Integer> getRankedDictionary() {
        return rankedDictionary;
    }
}

Add newline to follow a POSIX rule.


package com.xrtb.exchanges;

import java.io.InputStream;
import com.xrtb.pojo.BidRequest;

/**
 * A class to handle Epom ad exchange
 * @author Ben M. Faul
 *
 */

public class Epom extends BidRequest {

        public Epom() {
                super();
                parseSpecial();
        }

        /**
         * Make a Epom bid request using a String.
         * @param in String. The JSON bid request for Epom
         * @throws Exception on JSON errors.
         */
        public Epom(String  in) throws Exception  {
                super(in);
                parseSpecial();
    }

        /**
         * Make a Epom bid request using an input stream.
         * @param in InputStream. The contents of a HTTP post.
         * @throws Exception on JSON errors.
         */
        public Epom(InputStream in) throws Exception {
                super(in);
                parseSpecial();
        }

        /**
         * Process special Epom stuff, sets the exchange name.
         */
        @Override
        public boolean parseSpecial() {
                exchange = "epom";
                return true;
        }
}

package com.xrtb.exchanges;

import java.io.InputStream;
import com.xrtb.pojo.BidRequest;

/**
 * A class to handle Epom ad exchange
 * @author Ben M. Faul
 *
 */

public class Epom extends BidRequest {

        public Epom() {
                super();
                parseSpecial();
        }

        /**
         * Make a Epom bid request using a String.
         * @param in String. The JSON bid request for Epom
         * @throws Exception on JSON errors.
         */
        public Epom(String  in) throws Exception  {
                super(in);
                parseSpecial();
    }

        /**
         * Make a Epom bid request using an input stream.
         * @param in InputStream. The contents of a HTTP post.
         * @throws Exception on JSON errors.
         */
        public Epom(InputStream in) throws Exception {
                super(in);
                parseSpecial();
        }

        /**
         * Process special Epom stuff, sets the exchange name.
         */
        @Override
        public boolean parseSpecial() {
                exchange = "epom";
                usesEncodedAdm = false;
                return true;
        }
}

Fix epom to not use encoded adm


package uk.ac.ebi.biosamples.accession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.stereotype.Service;

@Service
public class AccessionDao {

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

	@Autowired
	@Qualifier("accessionJdbcTemplate")
    protected JdbcTemplate jdbcTemplate;

	public void doAssayAccessionCallback(RowCallbackHandler rch) {
		String sql = "SELECT * FROM SAMPLE_ASSAY";
		jdbcTemplate.query(sql, rch);
	}

	public void doReferenceAccessionCallback(RowCallbackHandler rch) {
		String sql = "SELECT * FROM SAMPLE_REFERENCE";
		jdbcTemplate.query(sql, rch);
	}

	public void doGroupAccessionCallback(RowCallbackHandler rch) {
		String sql = "SELECT * FROM SAMPLE_GROUP";
		jdbcTemplate.query(sql, rch);
	}
}

package uk.ac.ebi.biosamples.accession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.stereotype.Service;

@Service
public class AccessionDao {

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

	@Autowired
	@Qualifier("accessionJdbcTemplate")
    protected JdbcTemplate jdbcTemplate;

	public void doAssayAccessionCallback(RowCallbackHandler rch) {
		String sql = "SELECT * FROM SAMPLE_ASSAY";
		jdbcTemplate.query(sql, rch);
	}

	public void doReferenceAccessionCallback(RowCallbackHandler rch) {
		String sql = "SELECT * FROM SAMPLE_REFERENCE";
		jdbcTemplate.query(sql, rch);
	}

	public void doGroupAccessionCallback(RowCallbackHandler rch) {
		String sql = "SELECT * FROM SAMPLE_GROUPS";
		jdbcTemplate.query(sql, rch);
	}
}

Tweak to fix sql table name


package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import model.Message;
import view.MessageBoard;

public class MessageBoardController implements ActionListener{
	private Controller controller;

	public MessageBoardController(Controller controller) {
		this.controller = controller;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		MessageBoard messageBoard =(MessageBoard)((JButton)e.getSource()).getParent();
		//System.out.println("Send this message: "+messageBoard.getMessage()+" to: "+messageBoard.getUser().getUserName());
		String mess = messageBoard.getMessage();
		System.out.println("in controller "+mess);
		Message messageToServet = new Message(messageBoard.getUser().getUserName(),mess);
		Message messageToDoc = new Message(controller.getModel().getAuthUser().getUserName(),mess);
		messageToDoc.printMessage(messageBoard.getUser().getDoc());
		controller.getServerHandler().sendMessage(messageToServet);
	}

}

package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import model.Message;
import view.MessageBoard;

public class MessageBoardController implements ActionListener{
	private Controller controller;

	public MessageBoardController(Controller controller) {
		this.controller = controller;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		MessageBoard messageBoard =(MessageBoard)((JButton)e.getSource()).getParent();
		//System.out.println("Send this message: "+messageBoard.getMessage()+" to: "+messageBoard.getUser().getUserName());
		String mess = messageBoard.getMessage();
		if(!mess.equals("")){
			System.out.println("in controller "+mess);
			Message messageToServet = new Message(messageBoard.getUser().getUserName(),mess);
			Message messageToDoc = new Message(controller.getModel().getAuthUser().getUserName(),mess);
			messageToDoc.printMessage(messageBoard.getUser().getDoc());
			controller.getServerHandler().sendMessage(messageToServet);
		}
	}

}

Fix Client Send Empty message


package bd.basic.nodes;

import com.oracle.truffle.api.nodes.Node;

/**
 * Dummy Node to work around Truffle's restriction that a node, which is going to
 * be instrumented, needs to have a parent.
 */
public final class DummyParent extends Node {
  @Child public Node child;

  public DummyParent(final Node node) {
    this.child = insert(node);
  }
}

package bd.basic.nodes;

import com.oracle.truffle.api.nodes.Node;

/**
 * Dummy Node to work around Truffle's restriction that a node, which is going to
 * be instrumented, needs to have a parent.
 */
public final class DummyParent extends Node {
  @Child public Node child;

  public DummyParent(final Node node) {
    this.child = insert(node);
  }

  public void notifyInserted() {
    super.notifyInserted(child);
  }
}

Add helper to allow dynamic instrumentation wrappers to be inserted


package seedu.address.commons.events.ui;

import seedu.address.commons.events.BaseEvent;
import seedu.address.model.person.ReadOnlyPerson;

/**
 * Represents a selection change in the Person List Panel
 */
public class PersonPanelSelectionChangedEvent extends BaseEvent {

    private final ReadOnlyPerson newSelection;

    public PersonPanelSelectionChangedEvent(ReadOnlyPerson newSelection){
        this.newSelection = newSelection;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName();
    }

    public ReadOnlyPerson getNewSelection() {
        return newSelection;
    }
}

package seedu.address.commons.events.ui;

import seedu.address.commons.events.BaseEvent;
import seedu.address.model.activity.Activity;
import seedu.address.model.person.ReadOnlyPerson;

/**
 * Represents a selection change in the Person List Panel
 */
public class PersonPanelSelectionChangedEvent extends BaseEvent {

    private final Activity newSelection;

    public PersonPanelSelectionChangedEvent(Activity newValue){
        this.newSelection = newValue;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName();
    }

    public Activity getNewSelection() {
        return newSelection;
    }
}

Update selection event to activity


package org.zeromq.czmq;

public class ZFrame implements AutoCloseable {

    long pointer;

    public ZFrame() {
        pointer = __init();
    }

    public ZFrame(long address) {
        pointer = address;
    }

    public ZFrame(byte[] buf, long size) {
        pointer = __init(buf, size);
    }
    native static long __init();

    native static long __init(byte[] buf, long size);

    native static void __destroy(long pointer);

    @Override
    public void close() {
        __destroy(pointer);
        pointer = 0;
    }
}

package org.zeromq.czmq;

public class ZFrame implements AutoCloseable {

    long pointer;

    public ZFrame() {
        pointer = ZFrame.__init();
    }

    public ZFrame(long address) {
        pointer = address;
    }

    public ZFrame(byte[] buf, long size) {
        pointer = ZFrame.__init(buf, size);
    }

    public long size() {
        return ZFrame.__size(pointer);
    }
    native static long __init();

    native static long __init(byte[] buf, long size);

    native static void __destroy(long pointer);

    native static long __size(long pointer);

    @Override
    public void close() {
        ZFrame.__destroy(pointer);
        pointer = 0;
    }
}

Call from the static context


package com.google.sitebricks.options;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.sitebricks.conversion.MvelTypeConverter;
import com.google.sitebricks.conversion.TypeConverter;

import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * Hacky wrapper of MvelTypeConverter to support sets.
 *
 * @author jochen@pedesis.org (Jochen Bekmann)
 */
public class OptionTypeConverter implements TypeConverter {
  @Inject
  MvelTypeConverter converter;

  @Override
  @SuppressWarnings("unchecked")
  public <T> T convert(Object source, Type type) {
    if (Set.class == type && String.class == source.getClass()) {
      Set<String> set = Sets.newHashSet();
      for (String s : ((String) source).split(","))
        set.add(s.trim());
      return (T) set;
    }
    return converter.convert(source, type);
  }
}

package com.google.sitebricks.options;

import java.lang.reflect.Type;
import java.util.Set;

import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.sitebricks.conversion.MvelTypeConverter;
import com.google.sitebricks.conversion.TypeConverter;

/**
 * Hacky wrapper of MvelTypeConverter to support sets.
 *
 * @author jochen@pedesis.org (Jochen Bekmann)
 */
public class OptionTypeConverter implements TypeConverter {
  @Inject
  MvelTypeConverter converter;

  @Override
  @SuppressWarnings("unchecked")
  public <T> T convert(Object source, Type type) {
    if (Set.class == type && String.class == source.getClass()) {
      Set<String> set = Sets.newHashSet();
      for (String s : ((String) source).split(","))
        set.add(s.trim());
      return (T) set;
    }
    return (T) converter.convert(source, type);
  }
}

Fix compilation issue due to bug in 'old' jdk 'Inference fails for type variable return constraint'


package de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.datatypes;

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Node_Types;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Vowl_Lang;
import de.uni_stuttgart.vis.vowl.owl2vowl.export.JsonGeneratorVisitor;

public class RdfsLiteral extends BaseDatatype {

	public RdfsLiteral() {
		setType(Node_Types.TYPE_LITERAL);
		setID();
		getLabels().put(Vowl_Lang.LANG_DEFAULT, "Literal");
	}

	@Override
	protected void setID() {
		id = "literal" + counterObjects;
		counterObjects++;
	}

	@Override
	public void accept(JsonGeneratorVisitor visitor) {
		super.accept(visitor);
		visitor.visit(this);
	}
}

package de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.datatypes;

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Node_Types;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Standard_Iris;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Vowl_Lang;
import de.uni_stuttgart.vis.vowl.owl2vowl.export.JsonGeneratorVisitor;

public class RdfsLiteral extends BaseDatatype {

	public RdfsLiteral() {
		setType(Node_Types.TYPE_LITERAL);
		setID();
		getLabels().put(Vowl_Lang.LANG_DEFAULT, "Literal");
		setIri(Standard_Iris.GENERIC_LITERAL_URI);
	}

	@Override
	protected void setID() {
		id = "literal" + counterObjects;
		counterObjects++;
	}

	@Override
	public void accept(JsonGeneratorVisitor visitor) {
		super.accept(visitor);
		visitor.visit(this);
	}
}

Set standard iri for literal.


package com.imcode.configuration;

import com.imcode.services.GenericService;
import imcode.services.IvisServiceFactory;
import imcode.services.utils.IvisOAuth2Utils;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebArgumentResolver;
import org.springframework.web.context.request.NativeWebRequest;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by ruslan on 06.12.16.
 */
public class IvisServiceArgumentResolver implements WebArgumentResolver {

    @Override
    public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) throws Exception {
        Class<?> type = methodParameter.getParameterType();
        Object nativeRequest = webRequest.getNativeRequest();
        if (!GenericService.class.isAssignableFrom(type) && !(nativeRequest instanceof HttpServletRequest)) {
            return UNRESOLVED;
        }

        HttpServletRequest request = (HttpServletRequest) nativeRequest;
        IvisServiceFactory ivisServiceFactory = IvisOAuth2Utils.getServiceFactory(request);

        return ivisServiceFactory.getService((Class<? extends GenericService>) type);

    }

}

package imcode.services.argumentresolver;

import com.imcode.services.GenericService;
import imcode.services.IvisServiceFactory;
import imcode.services.utils.IvisOAuth2Utils;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebArgumentResolver;
import org.springframework.web.context.request.NativeWebRequest;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by ruslan on 06.12.16.
 */
public class IvisServiceArgumentResolver implements WebArgumentResolver {

    @Override
    public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) throws Exception {
        Class<?> type = methodParameter.getParameterType();
        Object nativeRequest = webRequest.getNativeRequest();
        if (!GenericService.class.isAssignableFrom(type) && !(nativeRequest instanceof HttpServletRequest)) {
            return UNRESOLVED;
        }

        HttpServletRequest request = (HttpServletRequest) nativeRequest;
        IvisServiceFactory ivisServiceFactory = IvisOAuth2Utils.getServiceFactory(request);

        return ivisServiceFactory.getService((Class<? extends GenericService>) type);

    }

}

Fix package name in argument resolver.


package com.google.sitebricks.persist;

import com.google.inject.AbstractModule;
import com.google.inject.Key;
import com.google.inject.matcher.Matcher;

import java.lang.reflect.AnnotatedElement;

import static com.google.inject.matcher.Matchers.annotatedWith;
import static com.google.inject.matcher.Matchers.any;

/**
 * @author dhanji@gmail.com (Dhanji R. Prasanna)
 */
public final class PersistAopModule extends AbstractModule {
  private final AbstractPersistenceModule module;

  public PersistAopModule(AbstractPersistenceModule module) {
    this.module = module;
  }

  @Override
  protected void configure() {
    Key<Persister> persisterKey = module.selectorKey(Persister.class);
    WorkInterceptor workInterceptor = new WorkInterceptor(persisterKey);
    TransactionInterceptor transactionInterceptor = new TransactionInterceptor(persisterKey);
    requestInjection(workInterceptor);
    requestInjection(transactionInterceptor);

    Matcher<AnnotatedElement> workMatcher = annotatedWith(Work.class);
    Matcher<AnnotatedElement> txnMatcher = annotatedWith(Transactional.class);

    // Visible persistence APIs.
    if (module.selector != null) {
      workMatcher.and(annotatedWith(module.selector));
      txnMatcher.and(annotatedWith(module.selector));
    }

    bindInterceptor(any(), workMatcher, workInterceptor);
    bindInterceptor(any(), txnMatcher, transactionInterceptor);
  }
}

package com.google.sitebricks.persist;

import com.google.inject.AbstractModule;
import com.google.inject.Key;
import com.google.inject.matcher.Matcher;

import java.lang.reflect.AnnotatedElement;

import static com.google.inject.matcher.Matchers.annotatedWith;
import static com.google.inject.matcher.Matchers.any;

/**
 * @author dhanji@gmail.com (Dhanji R. Prasanna)
 */
public final class PersistAopModule extends AbstractModule {
  private final AbstractPersistenceModule module;

  public PersistAopModule(AbstractPersistenceModule module) {
    this.module = module;
  }

  @Override
  protected void configure() {
    Key<Persister> persisterKey = module.selectorKey(Persister.class);
    WorkInterceptor workInterceptor = new WorkInterceptor(persisterKey);
    TransactionInterceptor transactionInterceptor = new TransactionInterceptor(persisterKey);
    requestInjection(workInterceptor);
    requestInjection(transactionInterceptor);

    Matcher<AnnotatedElement> workMatcher = annotatedWith(Work.class);
    Matcher<AnnotatedElement> txnMatcher = annotatedWith(Transactional.class);

    // Visible persistence APIs.
    if (module.selector != null) {
      workMatcher = workMatcher.and(annotatedWith(module.selector));
      txnMatcher = txnMatcher.and(annotatedWith(module.selector));
    }

    bindInterceptor(any(), workMatcher, workInterceptor);
    bindInterceptor(any(), txnMatcher, transactionInterceptor);
  }
}

Fix a bad, silly bug where selectors were not being added to matchers in the Persist AOP module


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

package com.googlesource.gerrit.plugins.reviewers.client;

import com.google.gwt.core.client.JavaScriptObject;

public class ChangeReviewersInput extends JavaScriptObject {
  public static ChangeReviewersInput create() {
    return (ChangeReviewersInput) createObject();
  }

  protected ChangeReviewersInput() {
  }

  final void setAction(Action a) {
    setActionRaw(a.name());
  }

  private final native void setActionRaw(String a)
  /*-{ if(a)this.action=a; }-*/;

  final native void setFilter(String f)
  /*-{ if(f)this.filter=f; }-*/;

  final native void setReviewer(String r)
  /*-{ if(r)this.reviewer=r; }-*/;
}

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

package com.googlesource.gerrit.plugins.reviewers.client;

import com.google.gwt.core.client.JavaScriptObject;

public class ChangeReviewersInput extends JavaScriptObject {
  public static ChangeReviewersInput create() {
    return (ChangeReviewersInput) createObject();
  }

  protected ChangeReviewersInput() {
  }

  final void setAction(Action a) {
    setActionRaw(a.name());
  }

  final native void setActionRaw(String a)
  /*-{ if(a)this.action=a; }-*/;

  final native void setFilter(String f)
  /*-{ if(f)this.filter=f; }-*/;

  final native void setReviewer(String r)
  /*-{ if(r)this.reviewer=r; }-*/;
}

Remove redundant modifier on native method


/*
 * Copyright (c) 2013 Ramon Servadei
 *
 * 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.fimtra.tcpchannel;

import com.fimtra.tcpchannel.TcpServer;
import com.fimtra.tcpchannel.TcpChannel.FrameEncodingFormatEnum;

/**
 * Tests the {@link TcpServer} using {@link FrameEncodingFormatEnum#LENGTH_BASED}
 *
 * @author Ramon Servadei
 */
public class TestTcpServerWithLengthBasedFrameEncodingFormat extends TestTcpServer
{

    public TestTcpServerWithLengthBasedFrameEncodingFormat()
    {
        super();
        this.frameEncodingFormat = FrameEncodingFormatEnum.LENGTH_BASED;
    }

}

/*
 * Copyright (c) 2013 Ramon Servadei
 *
 * 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.fimtra.tcpchannel;

import com.fimtra.tcpchannel.TcpServer;
import com.fimtra.tcpchannel.TcpChannel.FrameEncodingFormatEnum;

/**
 * Tests the {@link TcpServer} using {@link FrameEncodingFormatEnum#LENGTH_BASED}
 *
 * @author Ramon Servadei
 */
public class TestTcpServerWithLengthBasedFrameEncodingFormat extends TestTcpServer
{
    static
    {
        PORT = 14000;
    }

    public TestTcpServerWithLengthBasedFrameEncodingFormat()
    {
        super();
        this.frameEncodingFormat = FrameEncodingFormatEnum.LENGTH_BASED;
    }

}

Use dedicated port range for length-based TcpServer tests


package com.groupon.seleniumgridextras.config;

import com.google.gson.Gson;

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

public class HashMapMerger {

  public static Config merge(Config defaultConfig, Config overwriteConfig){

    Map<String, Object> defaultConfigHash   = new HashMap();
    defaultConfigHash.putAll(convertToHash(convertToString(defaultConfig)));

    Map<String, Object> overwriteConfigHash = convertToHash(convertToString(overwriteConfig));
    Map<String, Object> finalConfig = overwriteMergeStrategy(defaultConfigHash, overwriteConfigHash);

    String finalConfigString = new Gson().toJson(finalConfig);

    return new Gson().fromJson(finalConfigString, Config.class);
  }

  private static Map convertToHash(String json){
    return new Gson().fromJson(json, HashMap.class);
  }

  private static String convertToString(Config config){
    return config.toPrettyJsonString();
  }

  protected static Map overwriteMergeStrategy(Map<String, Object> left, Map<String, Object> right){
    //As desribed in http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.cargo/cargo-core-api-module/0.9/org/codehaus/cargo/module/merge/strategy/MergeStrategy.java
    return mergeCurrentLevel(left, right);
  }

  private static Map mergeCurrentLevel(Map<String, Object> left, Map<String, Object> right){

    for (String key : right.keySet()){

      if (right.get(key) instanceof Map){
        mergeCurrentLevel((Map<String, Object>)left.get(key), (Map<String, Object>)right.get(key));
      } else {
        left.put(key, right.get(key));
      }
    }
    return left;
  }

}

package com.groupon.seleniumgridextras.config;

import java.util.Map;

public class HashMapMerger {

  protected static Map overwriteMergeStrategy(Map<String, Object> left, Map<String, Object> right){
    //As desribed in http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.cargo/cargo-core-api-module/0.9/org/codehaus/cargo/module/merge/strategy/MergeStrategy.java
    return mergeCurrentLevel(left, right);
  }

  private static Map mergeCurrentLevel(Map<String, Object> left, Map<String, Object> right){

    for (String key : right.keySet()){

      if (right.get(key) instanceof Map){
        mergeCurrentLevel((Map<String, Object>)left.get(key), (Map<String, Object>)right.get(key));
      } else {
        left.put(key, right.get(key));
      }
    }
    return left;
  }

}

Delete files that will not be used, simplify the class to bare bones


package utilities;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;

public class IoUtil {

	private static final int INPUT_STREAM_BUFFER_SIZE = 64;

	private IoUtil() {}

	/**
	 * Read all content from an input stream to a byte array.
	 * This does not close the input channel after reading. The caller
	 * is responsible for doing that.
	 */
	public static byte[] streamToBytes(InputStream in) throws IOException {
	    ReadableByteChannel channel = Channels.newChannel(in);
	    ByteBuffer byteBuffer = ByteBuffer.allocate(INPUT_STREAM_BUFFER_SIZE);
	    ByteArrayOutputStream bout = new ByteArrayOutputStream();
	    WritableByteChannel outChannel = Channels.newChannel(bout);
	    while (channel.read(byteBuffer) > 0 || byteBuffer.position() > 0) {
	        byteBuffer.flip();  // Make buffer ready for write.
	        outChannel.write(byteBuffer);
	        byteBuffer.compact(); // Make buffer ready for reading.
	    }
	    outChannel.close();
	    return bout.toByteArray();
	}
}

package utilities;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;

public class IoUtil {

	private static final int INPUT_STREAM_BUFFER_SIZE = 64;

	private IoUtil() {}

	/**
	 * Read all content from an input stream to a byte array.
	 * This does not close the input channel after reading. The caller
	 * is responsible for doing that.
	 */
	public static byte[] streamToBytes(InputStream in) throws IOException {
	    ReadableByteChannel channel = Channels.newChannel(in);
	    ByteBuffer byteBuffer = ByteBuffer.allocate(INPUT_STREAM_BUFFER_SIZE);
	    ByteArrayOutputStream bout = new ByteArrayOutputStream();
	    WritableByteChannel outChannel = Channels.newChannel(bout);
	    while (channel.read(byteBuffer) > 0 || byteBuffer.position() > 0) {
            // Casting is necessary here.
            // Similar fix in https://jira.mongodb.org/browse/JAVA-2559
            // https://community.blynk.cc/t/java-error-on-remote-server-startup/17957/7
	    	((Buffer) byteBuffer).flip();  // Make buffer ready for write.
	        outChannel.write(byteBuffer);
	        byteBuffer.compact(); // Make buffer ready for reading.
	    }
	    outChannel.close();
	    return bout.toByteArray();
	}
}

Fix a backward compatibility bug between Java 10 and Java 8.


package clientAPI;

import clientAPI.impl.BonusCreditStoreConnector;
import clientAPI.impl.CryptoStoreConnector;
import clientAPI.impl.PersonalDataConnector;
import clientAPI.impl.TicketManagerConnector;
import clientAPI.impl.WalletConnector;
import javax.smartcardio.Card;

public class ClientFactory {

	/**
	 *
	 * @return
	 */
	public static TicketManager getTicketManager(Card card) {
		return new TicketManagerConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static Wallet getWallet(Card card) {
		return new WalletConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static BonusCreditStore getBonusCreditStore(Card card) {
		return new BonusCreditStoreConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static PersonalData getCustomerData(Card card) {
		return new PersonalDataConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static CryptoStore getCryptoStore(Card card) {
		return new CryptoStoreConnector(card);
	}
}

package clientAPI;

import clientAPI.impl.BonusCreditStoreConnector;
import clientAPI.impl.CryptoStoreConnector;
import clientAPI.impl.PersonalDataConnector;
import clientAPI.impl.TicketManagerConnector;
import clientAPI.impl.WalletConnector;
import javax.smartcardio.Card;

public class ClientFactory {

	/**
	 *
	 * @return
	 */
	public static TicketManager getTicketManager(Card card) {
		return new TicketManagerConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static Wallet getWallet(Card card) {
		return new WalletConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static BonusCreditStore getBonusCreditStore(Card card) {
		return new BonusCreditStoreConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static PersonalData getPersonalData(Card card) {
		return new PersonalDataConnector(card);
	}

	/**
	 *
	 * @return
	 */
	public static CryptoStore getCryptoStore(Card card) {
		return new CryptoStoreConnector(card);
	}
}

Rename method for getting PersonalData instance


package com.gh4a.loader;

import java.util.HashMap;

import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
import android.util.Log;

import com.bugsense.trace.BugSenseHandler;
import com.gh4a.Constants;
import com.gh4a.Constants.LoaderResult;

public abstract class BaseLoader extends AsyncTaskLoader<HashMap<Integer, Object>> {

    public BaseLoader(Context context) {
        super(context);
    }

    @Override
    public HashMap<Integer, Object> loadInBackground() {
        HashMap<Integer, Object> result = new HashMap<Integer, Object>();
        try {
            doLoadInBackground(result);
            return result;
        } catch (Exception e) {
            result.put(LoaderResult.ERROR, true);
            result.put(LoaderResult.ERROR_MSG, e.getMessage());
            if ("Received authentication challenge is null".equalsIgnoreCase(e.getMessage())) {
                result.put(LoaderResult.AUTH_ERROR, true);
            }
            Log.e(Constants.LOG_TAG, e.getMessage(), e);
            return result;
        }
    }

    public abstract void doLoadInBackground(HashMap<Integer, Object> result) throws Exception;

}

package com.gh4a.loader;

import java.util.HashMap;

import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
import android.util.Log;

import com.gh4a.Constants;
import com.gh4a.Constants.LoaderResult;

public abstract class BaseLoader extends AsyncTaskLoader<HashMap<Integer, Object>> {

    public BaseLoader(Context context) {
        super(context);
    }

    @Override
    public HashMap<Integer, Object> loadInBackground() {
        HashMap<Integer, Object> result = new HashMap<Integer, Object>();
        try {
            doLoadInBackground(result);
            return result;
        } catch (Exception e) {
            result.put(LoaderResult.ERROR, true);
            result.put(LoaderResult.ERROR_MSG, e.getMessage());
            if ("Received authentication challenge is null".equalsIgnoreCase(e.getMessage())
                    || "No authentication challenges found".equalsIgnoreCase(e.getMessage())) {
                result.put(LoaderResult.AUTH_ERROR, true);
            }
            Log.e(Constants.LOG_TAG, e.getMessage(), e);
            return result;
        }
    }

    public abstract void doLoadInBackground(HashMap<Integer, Object> result) throws Exception;

}

Handle auth error on JB


package io.pivotal.portfolio.config;

import org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerExchangeFilterFunction;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository;
import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
public class BeanConfiguration {

    @Bean
    public WebClient webClient(LoadBalancerExchangeFilterFunction eff) {
        return WebClient.builder()
                .filter(eff)
                .build();
    }

}

package io.pivotal.portfolio.config;

import org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerExchangeFilterFunction;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository;
import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
public class BeanConfiguration {

    @Bean
    public WebClient webClient(WebClient.Builder webClientBuilder, LoadBalancerExchangeFilterFunction eff) {
        return  webClientBuilder
                .filter(eff)
                .build();
    }

}

Fix definition of web client builder


package com.uwetrottmann.thetvdb;

import org.junit.BeforeClass;

public abstract class BaseTestCase {

    // Do NOT use this token in your application, for testing purposes only!
    private static final String JSON_WEB_TOKEN = "";

    private static final boolean DEBUG = true;

    private static final TheTvdb theTvdb = new TheTvdb();

    @BeforeClass
    public static void setUpOnce() {
        theTvdb.setJsonWebToken(JSON_WEB_TOKEN);
        theTvdb.setIsDebug(DEBUG);
    }

    protected final TheTvdb getTheTvdb() {
        return theTvdb;
    }

}

package com.uwetrottmann.thetvdb;

import org.junit.BeforeClass;

public abstract class BaseTestCase {

    // Do NOT use this token in your application, for testing purposes only!
    private static final String JSON_WEB_TOKEN = "";

    private static final boolean DEBUG = true;

    private static final TheTvdb theTvdb = new TheTvdb();

    @BeforeClass
    public static void setUpOnce() {
        if (JSON_WEB_TOKEN.length() == 0) {
            System.err.println("No valid JSON Web Token is set. API methods other than /login will fail.");
        }
        theTvdb.setJsonWebToken(JSON_WEB_TOKEN);
        theTvdb.setIsDebug(DEBUG);
    }

    protected final TheTvdb getTheTvdb() {
        return theTvdb;
    }

}

Add warning if no JSON web token is set.


package com.adaptionsoft.games.uglytrivia;

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

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.mock;

public class PlayersTest {

    public static final String PLAYER_ONE = "Thomas";
    public static final String PLAYER_TWO = "Peter";
    public static final String ANY_PLAYER = "Erik";

    // TODO minor duplication in all Player tests for creating the Players instance.
    private PlayerUi ui = mock(PlayerUi.class);
    private Players players = new Players(ui);

    @Before
    public void addPlayers() {
        players.add(PLAYER_ONE);
        players.add(PLAYER_TWO);
    }

    @Test
    public void shouldAddOnePlayer() {
        assertThat(players.size(), is(2));

        players.add(TestPlayer.named(ANY_PLAYER));

        assertThat(players.size(), is(3));
    }

    @Test(expected = IllegalAccessException.class)
    @Ignore("not implemented")
    public void shouldFailForMoreThanSixPlayers() {
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add("one too many");
    }
}

package com.adaptionsoft.games.uglytrivia;

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

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.mock;

public class PlayersTest {

    private static final String PLAYER_ONE = "Thomas";
    private static final String PLAYER_TWO = "Peter";
    private static final String ANY_PLAYER = "Erik";

    // TODO minor duplication in all Player tests for creating the Players instance.
    private PlayerUi ui = mock(PlayerUi.class);
    private Players players = new Players(ui);

    @Before
    public void addPlayers() {
        players.add(PLAYER_ONE);
        players.add(PLAYER_TWO);
    }

    @Test
    public void shouldAddOnePlayer() {
        assertThat(players.size(), is(2));

        players.add(TestPlayer.named(ANY_PLAYER));

        assertThat(players.size(), is(3));
    }

    @Test(expected = IllegalAccessException.class)
    @Ignore("not implemented")
    public void shouldFailForMoreThanSixPlayers() {
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add("one too many");
    }
}

Reduce visibility (as proposed by inspection).


package nl.tudelft.ewi.dea.jaxrs.api;

import javax.ws.rs.GET;
import javax.ws.rs.Path;

import com.google.inject.servlet.RequestScoped;

@RequestScoped
@Path("api/exception")
public class ExceptionAASResource {

	@GET
	public void throwException() {
		throw new RuntimeException("Your Exception-As-A-Service is served!");
	}

}

package nl.tudelft.ewi.dea.jaxrs.api;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

import com.google.inject.servlet.RequestScoped;

@RequestScoped
@Path("api/exception")
public class ExceptionAASResource {

	@GET
	public Response throwException() {
		throw new RuntimeException("Your Exception-As-A-Service is served!");
	}

}

Return Response instead of void as per the spec.


/*
 * This file is part of SpongeAPI, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * 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 org.spongepowered.api.event;

/**
 * Represents a handler accepting events of a specified type.
 *
 * @param <T> The type of the event
 */
public interface EventHandler<T extends Event> {

    /**
     * Called when a event registered to this handler is called.
     *
     * @param event The called event
     */
    void handle(T event);

}

/*
 * This file is part of SpongeAPI, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * 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 org.spongepowered.api.event;

/**
 * Represents a handler accepting events of a specified type.
 *
 * @param <T> The type of the event
 */
public interface EventHandler<T extends Event> {

    /**
     * Called when a event registered to this handler is called.
     *
     * @param event The called event
     * @throws Exception If an error occurs
     */
    void handle(T event) throws Exception;

}

Allow dynamic event handlers to throw checked exceptions


package roycurtis.signshopexport.json;

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

/** Exclusions class for blacklisting objects and fields in Gson */
public class Exclusions implements ExclusionStrategy
{
    @Override
    public boolean shouldSkipField(FieldAttributes f)
    {
        String name = f.getName();

        return
            // Ignore dynamic CraftBukkit handle field
            name.equalsIgnoreCase("handle")
            // Ignore book page contents
            || name.equalsIgnoreCase("pages")
            // Ignore unsupported tags
            || name.equalsIgnoreCase("unhandledTags")
            // Ignore redundant data object
            || name.equalsIgnoreCase("data")
            // Ignore hide flags
            || name.equalsIgnoreCase("hideFlag")
            // Ignore repair costs
            || name.equalsIgnoreCase("repairCost")
            // Ignore skull profiles
            || name.equalsIgnoreCase("profile")
            // Ignore shield patterns
            || name.equalsIgnoreCase("blockEntityTag");
    }

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

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

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

package roycurtis.signshopexport.json;

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

/** Exclusions class for blacklisting objects and fields in Gson */
public class Exclusions implements ExclusionStrategy
{
    @Override
    public boolean shouldSkipField(FieldAttributes f)
    {
        String name = f.getName();

        return
            // Ignore dynamic CraftBukkit handle field
            name.equalsIgnoreCase("handle")
            // Ignore book page contents
            || name.equalsIgnoreCase("pages")
            // Ignore unsupported tags
            || name.equalsIgnoreCase("unhandledTags")
            // Ignore redundant data object
            || name.equalsIgnoreCase("data")
            // Ignore hide flags
            || name.equalsIgnoreCase("hideFlag")
            // Ignore repair costs
            || name.equalsIgnoreCase("repairCost")
            // Ignore skull profiles
            || name.equalsIgnoreCase("profile")
            // Ignore shield patterns
            || name.equalsIgnoreCase("blockEntityTag")
            // Ignore 1.11 unbreakable tag
            || name.equalsIgnoreCase("unbreakable");
    }

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

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

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

Exclude 1.11's "unbreakable" common tag


package openperipheral.addons.glasses;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import openperipheral.addons.OpenPeripheralAddons;
import openperipheral.addons.api.ITerminalItem;
import cpw.mods.fml.common.FMLCommonHandler;

public class ItemKeyboard extends Item {

	public ItemKeyboard() {
		setCreativeTab(OpenPeripheralAddons.tabOpenPeripheralAddons);
		setMaxStackSize(1);
	}

	@Override
	public void registerIcons(IIconRegister register) {
		itemIcon = register.registerIcon("openperipheraladdons:keyboard");
	}

	@Override
	public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
		if (world.isRemote) {
			ItemStack helmet = TerminalUtils.getHeadSlot(player);
			if (helmet != null) {
				Item item = helmet.getItem();
				if (item instanceof ITerminalItem) {
					long guid = ((ITerminalItem)item).getTerminalGuid(helmet);
					FMLCommonHandler.instance().showGuiScreen(new GuiCapture(guid));
				}
			}
		}

		return stack;
	}

}

package openperipheral.addons.glasses;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import openperipheral.addons.OpenPeripheralAddons;
import openperipheral.addons.api.ITerminalItem;
import cpw.mods.fml.common.FMLCommonHandler;

public class ItemKeyboard extends Item {

	public ItemKeyboard() {
		setCreativeTab(OpenPeripheralAddons.tabOpenPeripheralAddons);
		setMaxStackSize(1);
	}

	@Override
	public void registerIcons(IIconRegister register) {
		itemIcon = register.registerIcon("openperipheraladdons:keyboard");
	}

	@Override
	public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
		if (world.isRemote) {
			ItemStack helmet = TerminalUtils.getHeadSlot(player);
			if (helmet != null) {
				Item item = helmet.getItem();
				if (item instanceof ITerminalItem) {
					Long guid = ((ITerminalItem)item).getTerminalGuid(helmet);
					if (guid != null) FMLCommonHandler.instance().showGuiScreen(new GuiCapture(guid));
				}
			}
		}

		return stack;
	}

}

Fix NPE when using keyboard


package com.reactlibrary.linkedinsdk;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class RNLinkedInSessionManagerPackage implements ReactPackage {
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
      return Arrays.<NativeModule>asList(new RNLinkedInSessionManagerModule(reactContext));
    }

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

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

package com.reactlibrary.linkedinsdk;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class RNLinkedInSessionManagerPackage implements ReactPackage {
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
      return Arrays.<NativeModule>asList(new RNLinkedInSessionManagerModule(reactContext));
    }

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

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

Handle Android RN 0.47 breaking change


package de.linkvt.bachelor.features.annotations;

import de.linkvt.bachelor.features.Feature;
import de.linkvt.bachelor.features.FeatureCategory;

import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.springframework.stereotype.Component;

@Component
public class OwlDeprecatedPropertyFeature extends Feature {
  @Override
  public void addToOntology() {
    OWLObjectProperty property = featurePool.getExclusiveProperty("::DeprecatedProperty");
    addToGenericDomainAndNewRange(property, featurePool.getExclusiveClass(":DeprecatedPropertyRange"));

    OWLAnnotation annotation = factory.getOWLAnnotation(factory.getOWLDeprecated(), factory.getOWLLiteral(true));
    OWLAxiom deprecatedAxiom = factory.getOWLAnnotationAssertionAxiom(property.getIRI(), annotation);
    addAxiomToOntology(deprecatedAxiom);
  }

  @Override
  public String getName() {
    return "owl:DeprecatedProperty";
  }

  @Override
  public String getToken() {
    return "deprecatedprop";
  }

  @Override
  public FeatureCategory getCategory() {
    return FeatureCategory.ANNOTATIONS;
  }
}

package de.linkvt.bachelor.features.annotations;

import de.linkvt.bachelor.features.Feature;
import de.linkvt.bachelor.features.FeatureCategory;

import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.springframework.stereotype.Component;

@Component
public class OwlDeprecatedPropertyFeature extends Feature {
  @Override
  public void addToOntology() {
    OWLObjectProperty property = featurePool.getExclusiveProperty(":DeprecatedProperty");
    addToGenericDomainAndNewRange(property, featurePool.getExclusiveClass(":DeprecatedPropertyRange"));

    OWLAnnotation annotation = factory.getOWLAnnotation(factory.getOWLDeprecated(), factory.getOWLLiteral(true));
    OWLAxiom deprecatedAxiom = factory.getOWLAnnotationAssertionAxiom(property.getIRI(), annotation);
    addAxiomToOntology(deprecatedAxiom);
  }

  @Override
  public String getName() {
    return "owl:DeprecatedProperty";
  }

  @Override
  public String getToken() {
    return "deprecatedprop";
  }

  @Override
  public FeatureCategory getCategory() {
    return FeatureCategory.ANNOTATIONS;
  }
}

Fix prefix of deprecated property


package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.PlannedActivity;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Rhett Sutphin
 */
@Transactional (readOnly=true)
public class PlannedActivityDao extends StudyCalendarMutableDomainObjectDao<PlannedActivity> {
    @Override
    public Class<PlannedActivity> domainClass() {
        return PlannedActivity.class;
    }

    @Transactional(readOnly=false)
    public void delete(PlannedActivity event) {
        getHibernateTemplate().delete(event);
    }

    public List<PlannedActivity> getPlannedActivitiesForAcivity(Integer activityId) {

        return (List<PlannedActivity>) getHibernateTemplate().find("select pa from PlannedActivity as pa where pa.activity.id=?",activityId);
    }

}

package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.PlannedActivity;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Rhett Sutphin
 */
@Transactional (readOnly=true)
public class PlannedActivityDao extends StudyCalendarMutableDomainObjectDao<PlannedActivity> {
    @Override
    public Class<PlannedActivity> domainClass() {
        return PlannedActivity.class;
    }

    /**
    * Deletes a planned activity
    *
    * @param  event the planned activity to delete
    */
    @Transactional(readOnly=false)
    public void delete(PlannedActivity event) {
        getHibernateTemplate().delete(event);
    }

    /**
    * Finds all planned activities for a activity id
    *
    * @param  activityId the activity id to search with
    * @return      a list of planned activities with the activity id passed in
    */
    public List<PlannedActivity> getPlannedActivitiesForAcivity(Integer activityId) {
        return (List<PlannedActivity>) getHibernateTemplate().find("select pa from PlannedActivity as pa where pa.activity.id=?",activityId);
    }
}

Add javadoc to planned activity dao.


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

/**
 * Exception thrown by ArchiveStreamFactory if a format is
 * requested/detected that doesn't support streaming.
 * @since 1.8
 */
public class StreamingNotSupportedException extends ArchiveException {
    private final String format;

    /**
     * Creates a new StreamingNotSupportedException.
     * @param format the format that has been requested/detected.
     */
    public StreamingNotSupportedException(String format) {
        super("The " + format + " doesn't support streaming.");
        this.format = format;
    }

    /**
     * Returns the format that has been requested/detected.
     * @return the format that has been requested/detected.
     */
    public String getFormat() {
        return format;
    }

}

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

/**
 * Exception thrown by ArchiveStreamFactory if a format is
 * requested/detected that doesn't support streaming.
 * @since 1.8
 */
public class StreamingNotSupportedException extends ArchiveException {

    private static final long serialVersionUID = 1L;

    private final String format;

    /**
     * Creates a new StreamingNotSupportedException.
     * @param format the format that has been requested/detected.
     */
    public StreamingNotSupportedException(String format) {
        super("The " + format + " doesn't support streaming.");
        this.format = format;
    }

    /**
     * Returns the format that has been requested/detected.
     * @return the format that has been requested/detected.
     */
    public String getFormat() {
        return format;
    }

}

Add missing serial version ID (default).


package com.snowble.android.widget.verticalstepper;

import android.content.res.Resources;
import android.util.TypedValue;

class ThemeUtils {
    public static int getResolvedAttributeData(Resources.Theme theme, int attr, int defaultData) {
        TypedValue value = new TypedValue();
        theme.resolveAttribute(attr, value, false);
        int resolvedAttributeData;
        if (value.type != TypedValue.TYPE_NULL) {
            resolvedAttributeData = value.data;
        } else {
            resolvedAttributeData = defaultData;
        }
        return resolvedAttributeData;
    }
}

package com.snowble.android.widget.verticalstepper;

import android.content.res.Resources;
import android.util.TypedValue;

class ThemeUtils {
    static int getResolvedAttributeData(Resources.Theme theme, int attr, int defaultData) {
        TypedValue value = new TypedValue();
        theme.resolveAttribute(attr, value, false);
        int resolvedAttributeData;
        if (value.type != TypedValue.TYPE_NULL) {
            resolvedAttributeData = value.data;
        } else {
            resolvedAttributeData = defaultData;
        }
        return resolvedAttributeData;
    }
}

Reduce visibility one more time


package referencelibrary;

import org.junit.Before;
import org.junit.Test;
import referencelibrary.data.StubDao;
import referencelibrary.reference.BookReference;
import referencelibrary.reference.Reference;

import java.util.List;

import static org.junit.Assert.*;
import referencelibrary.util.FileUtil;

/**
 * Created by petri on 18.4.2016.
 */
public class AppTest {
    private App app;

    @Before
    public void setUp() {
        app = new App(new StubDao());
    }

    @Test
    public void newReference() {
        app.newReference(new BookReference("REF1"));
        List<Reference> reflist = app.listReferences();
        assertEquals(2, reflist.size());
        assertEquals("REF1", reflist.get(1).getReferenceName());
    }

    @Test
    public void listReferences() {
        List<Reference> reflist = app.listReferences();
        assertEquals("REF", reflist.get(0).getReferenceName());
    }

    @Test
    public void generateBixTexFile() {
        String filename = "test_bibtex.bib";
        app.generateBixTexFile(filename);
        String result = FileUtil.Read(filename);
        assertEquals("@Book{REF,\n}\n\n", result);
    }

}

package referencelibrary;

import java.io.File;
import org.junit.Before;
import org.junit.Test;
import referencelibrary.data.StubDao;
import referencelibrary.reference.BookReference;
import referencelibrary.reference.Reference;

import java.util.List;
import org.junit.After;

import static org.junit.Assert.*;
import referencelibrary.util.FileUtil;

/**
 * Created by petri on 18.4.2016.
 */
public class AppTest {
    private final String filename = "test_bibtex.bib";
    private App app;

    @Before
    public void setUp() {
        app = new App(new StubDao());
        File testFile = new File(filename);
        testFile.delete();
    }

    @After
    public void tearDown() {
        File testFile = new File(filename);
        testFile.delete();
    }

    @Test
    public void newReference() {
        app.newReference(new BookReference("REF1"));
        List<Reference> reflist = app.listReferences();
        assertEquals(2, reflist.size());
        assertEquals("REF1", reflist.get(1).getReferenceName());
    }

    @Test
    public void listReferences() {
        List<Reference> reflist = app.listReferences();
        assertEquals("REF", reflist.get(0).getReferenceName());
    }

    @Test
    public void generateBixTexFile() {
        app.generateBixTexFile(filename);
        String result = FileUtil.Read(filename);
        assertEquals("@Book{REF,\n}\n\n", result);
    }

}

Make BookReference test cleanup test file


package com.uwetrottmann.trakt.v2.entities;

public class Images {

    public MoreImageSizes poster;
    public MoreImageSizes fanart;
    /** A {@link com.uwetrottmann.trakt.v2.entities.Person} has headshots. */
    public MoreImageSizes headshot;
    public ImageSizes banner;
    public ImageSizes logo;
    public ImageSizes clearart;
    public ImageSizes thumb;
    public ImageSizes screenshot;
    public ImageSizes avatar;

}

package com.uwetrottmann.trakt.v2.entities;

public class Images {

    public MoreImageSizes poster;
    public MoreImageSizes fanart;
    public MoreImageSizes screenshot;
    /** A {@link com.uwetrottmann.trakt.v2.entities.Person} has headshots. */
    public MoreImageSizes headshot;
    public ImageSizes banner;
    public ImageSizes logo;
    public ImageSizes clearart;
    public ImageSizes thumb;
    public ImageSizes avatar;

}

Add additional image sizes for screenshots.


package com.uwetrottmann.trakt.v2.entities;

import com.uwetrottmann.trakt.v2.enums.Rating;

public class Season {

    public Integer number;
    public SeasonIds ids;

    public Rating rating;
    public Integer episode_count;
    public Images images;

}

package com.uwetrottmann.trakt.v2.entities;

public class Season {

    public Integer number;
    public SeasonIds ids;

    public Double rating;
    public Integer episode_count;
    public Images images;

}

Make season rating a global rating, so double type.


/*
 * Zorbage: an algebraic data hierarchy for use in numeric processing.
 *
 * Copyright (C) 2016-2019 Barry DeZonia
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package nom.bdezonia.zorbage.type.algebra;

import nom.bdezonia.zorbage.function.Function1;

/**
 *
 * @author Barry DeZonia
 *
 */
public interface EvenOdd<U> {
	Function1<Boolean,U> isEven();
	Function1<Boolean,U> isOdd();
}

Add license header to file that needs it


package commands;

public class RegexConstants
{
    public static final String CHANNEL = "[\\w-_]+";

    private RegexConstants(){}

    public static final String SPACES = "\\s+";
    public static final String CHANGE_ID = "\\d+";
    public static final String PROJECT = "[^@]\\W*";

    public static final String USER_ALIAS = "@\\S*";
    public static final String ANYTHING_ELSE = ".*";
    public static final String COMMENT = ANYTHING_ELSE;

}

package commands;

public class RegexConstants
{
    public static final String CHANNEL = "[\\w-_]+";

    private RegexConstants(){}

    public static final String SPACES = "\\s+";
    public static final String CHANGE_ID = "\\d+";
    public static final String PROJECT = "[^@][\\w|-]+";

    public static final String USER_ALIAS = "@\\S*";
    public static final String ANYTHING_ELSE = ".*";
    public static final String COMMENT = ANYTHING_ELSE;

}

Fix parsing of project name


package com.elmakers.mine.bukkit.api.block;

import java.util.List;

import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;

import com.elmakers.mine.bukkit.api.magic.Mage;

public interface UndoList extends BlockList, Comparable<UndoList> {
    public void commit();
    public void undo();
    public void undo(boolean undoEntityChanges);

    public void setScheduleUndo(int ttl);
    public int getScheduledUndo();
    public boolean bypass();
    public long getCreatedTime();
    public long getModifiedTime();
    public long getScheduledTime();
    public boolean isScheduled();

    public void prune();

    public void add(Entity entity);
    public void remove(Entity entity);
    public void modify(Entity entity);
    public void add(Runnable runnable);

    public void convert(Entity entity, Block block);
    public void fall(Entity entity, Block block);
    public void explode(Entity entity, List<Block> explodedBlocks);
    public void cancelExplosion(Entity entity);

    public boolean contains(Location location, int threshold);

    public String getName();
    public Mage getOwner();
}

package com.elmakers.mine.bukkit.api.block;

import java.util.List;

import com.elmakers.mine.bukkit.api.entity.EntityData;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;

import com.elmakers.mine.bukkit.api.magic.Mage;

public interface UndoList extends BlockList, Comparable<UndoList> {
    public void commit();
    public void undo();
    public void undo(boolean undoEntityChanges);

    public void setScheduleUndo(int ttl);
    public int getScheduledUndo();
    public boolean bypass();
    public long getCreatedTime();
    public long getModifiedTime();
    public long getScheduledTime();
    public boolean isScheduled();

    public void prune();

    public void add(Entity entity);
    public void remove(Entity entity);
    public EntityData modify(Entity entity);
    public void add(Runnable runnable);

    public void convert(Entity entity, Block block);
    public void fall(Entity entity, Block block);
    public void explode(Entity entity, List<Block> explodedBlocks);
    public void cancelExplosion(Entity entity);

    public boolean contains(Location location, int threshold);

    public String getName();
    public Mage getOwner();
}

Return the EntityData on entity undo


/* (c) 2014 LinkedIn Corp. 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.
 */

package com.linkedin.uif.fork;

import org.apache.avro.Schema;

/**
 * A wrapper class for {@link org.apache.avro.Schema} that is also {@link Copyable}.
 *
 * @author ynli
 */
public class CopyableSchema implements Copyable<Schema> {

    private final Schema schema;

    public CopyableSchema(Schema schema) {
        this.schema = schema;
    }

    @Override
    public Schema copy() throws CopyNotSupportedException {
        return new Schema.Parser().parse(this.schema.toString());
    }
}

/* (c) 2014 LinkedIn Corp. 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.
 */

package com.linkedin.uif.fork;

import org.apache.avro.Schema;

/**
 * A wrapper class for {@link org.apache.avro.Schema} that is also {@link Copyable}.
 *
 * @author ynli
 */
public class CopyableSchema implements Copyable<Schema> {

  private final Schema schema;

  public CopyableSchema(Schema schema) {
    this.schema = schema;
  }

  @Override
  public Schema copy()
      throws CopyNotSupportedException {
    return new Schema.Parser().setValidate(false).parse(this.schema.toString());
  }
}

Set validation to false when copying a schema


package fabzo.kraken;

import fabzo.kraken.components.DockerComponent;
import fabzo.kraken.handler.docker.DockerConfiguration;
import fabzo.kraken.handler.docker.DockerLifecycleHandler;
import fabzo.kraken.wait.MySQLWait;
import org.junit.Test;

import java.time.Duration;

public class WaitTest {

    @Test
    public void testDatabaseWait() {
        final Environment environment = Kraken.createEnvironment(new EnvironmentModule() {
            @Override
            public void configure() {
                register(DockerLifecycleHandler.withConfig(
                        DockerConfiguration.create()
                                .withDockerSocket(DockerConfiguration.DOCKER_HOST_UNIX)));

                register(DockerComponent.create()
                        .withName("mariadb")
                        .withImage("fabzo/mariadb-docker", "delivery")
                        .withForcePull()
                        .withFollowLogs()
                        .withPortBinding("db", 3306)
                        .withEnv("MYSQL_DATABASE", "delivery")
                        .withEnv("MYSQL_ALLOW_EMPTY_PASSWORD", "yes")
                        .withWait(new MySQLWait("delivery","db", Duration.ofSeconds(60))));

            }
        });

        try {
            environment.start();
        } catch (final Exception e) {
            e.printStackTrace();
        } finally {
            environment.stop();
        }
    }
}

package fabzo.kraken;

import fabzo.kraken.components.DockerComponent;
import fabzo.kraken.handler.docker.DockerConfiguration;
import fabzo.kraken.handler.docker.DockerLifecycleHandler;
import fabzo.kraken.wait.MySQLWait;
import org.junit.Test;

import java.time.Duration;

public class WaitTest {

    @Test
    public void testDatabaseWait() {
        final Environment environment = Kraken.createEnvironment(new EnvironmentModule() {
            @Override
            public void configure() {
                register(DockerLifecycleHandler.withConfig(
                        DockerConfiguration.create()
                                .withDockerSocket(DockerConfiguration.DOCKER_HOST_UNIX)));

                register(DockerComponent.create()
                        .withName("mariadb")
                        .withImage("fabzo/mariadb-docker", "testdb")
                        .withForcePull()
                        .withFollowLogs()
                        .withPortBinding("db", 3306)
                        .withEnv("MYSQL_DATABASE", "testdb")
                        .withEnv("MYSQL_ALLOW_EMPTY_PASSWORD", "yes")
                        .withWait(new MySQLWait("testdb","db", Duration.ofSeconds(60))));

            }
        });

        try {
            environment.start();
        } catch (final Exception e) {
            e.printStackTrace();
        } finally {
            environment.stop();
        }
    }
}

Use generic test db name


public class Codec {
  private Map<String, String> urlMapper = new HashMap<>();
  private Random rand = new Random();
  private byte[] stringArray = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".getBytes();

  // Encodes a URL to a shortened URL.
  public String encode(String longUrl) {
    String shortened = getShortUrl(longUrl);
    urlMapper.put(shortened, longUrl);
    return shortened;
  }

  // Decodes a shortened URL to its original URL.
  public String decode(String shortUrl) {
    return urlMapper.get(shortUrl);
  }
}

public class Codec {
    private Map<String, String> urlMapper = new HashMap<>();
    private Random rand = new Random();
    private byte[] stringArray = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".getBytes();

    private String getShortUrl() {
      byte[] s = new byte[6];
      for (int i = 0; i < 6; i++) {
        int n = rand.nextInt(62);
        s[i] = stringArray[n];
      }
      return "http://tinyurl.com/" + new String(s);
    }

    // Encodes a URL to a shortened URL.
    public String encode(String longUrl) {
        String shortened = null;
        int count = 0;
        while (count < 10) {
            shortened = getShortUrl();
            if (urlMapper.get(shortened) == null) {
                urlMapper.put(shortened, longUrl);
                break;
            }
            count++;
        }
        return shortened;
    }

    // Decodes a shortened URL to its original URL.
    public String decode(String shortUrl) {
        return urlMapper.get(shortUrl);
    }
}

Update java solution for 'Encode and Decode TinyURL'


/*
 * 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.android.inputmethod.latin;

import android.app.backup.BackupHelperAgent;
import android.app.backup.SharedPreferencesBackupHelper;

/**
 * Backs up the Latin IME shared preferences.
 */
public class LatinIMEBackupAgent extends BackupHelperAgent {

    public void onCreate() {
        addHelper("shared_pref", new SharedPreferencesBackupHelper(this,
                getPackageName() + "_preferences"));
    }
}

/*
 * 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.android.inputmethod.latin;

import android.app.backup.BackupAgentHelper;
import android.app.backup.SharedPreferencesBackupHelper;

/**
 * Backs up the Latin IME shared preferences.
 */
public class LatinIMEBackupAgent extends BackupAgentHelper {

    public void onCreate() {
        addHelper("shared_pref", new SharedPreferencesBackupHelper(this,
                getPackageName() + "_preferences"));
    }
}

Fix build breakage due to api change


package com.twu.biblioteca;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
/**
 * Created by watsonarw on 16/04/15.
 */
public class LibraryTest {

    @Test
    public void testSingleBookLibrary() {
        Library library = new Library();
        library.addBook("The Hobbit", "J.R.R. Tolkien", 1937);
        assertEquals("The Hobbit - J.R.R. Tolkien, 1937\n",library.getBookList());
    }

    @Test
    public void testMultiBookLibrary() {
        Library library = new Library();
        library.addBook("The Hobbit", "J.R.R. Tolkien", 1937);
        library.addBook("Catcher in the Rye", "J.D. Salinger", 1951);
        assertEquals("The Hobbit - J.R.R. Tolkien, 1937\nCatcher in the Rye - J.D. Salinger, 1951\n",library.getBookList());
    }
}

package com.twu.biblioteca;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
/**
 * Created by watsonarw on 16/04/15.
 */
public class LibraryTest {

    @Test
    public void testSingleBookLibrary() {
        Library library = new Library();
        library.addBook("The Hobbit", "J.R.R. Tolkien", 1937);
        assertEquals(" 1 | The Hobbit - J.R.R. Tolkien, 1937\n",library.getBookList());
    }

    @Test
    public void testMultiBookLibrary() {
        Library library = new Library();
        library.addBook("The Hobbit", "J.R.R. Tolkien", 1937);
        library.addBook("Catcher in the Rye", "J.D. Salinger", 1951);
        assertEquals(" 1 | The Hobbit - J.R.R. Tolkien, 1937\n 2 | Catcher in the Rye - J.D. Salinger, 1951\n",library.getBookList());
    }
}

Update Expected Library test responses for numbering books


/**
 * Copyright (c) 2016 Dr. Chris Senior.
 * See LICENSE.txt for licensing terms
 */
package com.asteroid.duck.osgi.example.album;

/**
 * Interface to a service that provides information about Underworld albums
 */
public interface AlbumInfoService {

}

/**
 * Copyright (c) 2016 Dr. Chris Senior.
 * See LICENSE.txt for licensing terms
 */
package com.asteroid.duck.osgi.example.album;

import java.util.List;

/**
 * Interface to a service that provides information about Underworld albums
 */
public interface AlbumInfoService {
    List<Album> getAlbums();
    List<Track> getTracks();
}

Add API for album info service


/*
 * Copyright (C) 2011 Benoit GUEROUT <bguerout at gmail dot com> and Yves AMSELLEM <amsellem dot yves at gmail dot com>
 *
 * 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.jongo.bson;

import com.mongodb.DBObject;
import com.mongodb.LazyDBObject;
import org.bson.LazyBSONCallback;

class RelaxedLazyDBObject extends LazyDBObject implements BsonDocument {

    public RelaxedLazyDBObject(byte[] data, LazyBSONCallback cbk) {
        super(data, cbk);
    }

    public byte[] toByteArray() {
        return _input.array();
    }

    public DBObject toDBObject() {
        return this;
    }

    public int getSize() {
        return getBSONSize();
    }
}

/*
 * Copyright (C) 2011 Benoit GUEROUT <bguerout at gmail dot com> and Yves AMSELLEM <amsellem dot yves at gmail dot com>
 *
 * 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.jongo.bson;

import com.mongodb.DBObject;
import com.mongodb.LazyDBObject;
import org.bson.LazyBSONCallback;

class RelaxedLazyDBObject extends LazyDBObject implements BsonDocument {

    public RelaxedLazyDBObject(byte[] data, LazyBSONCallback cbk) {
        super(data, cbk);
    }

    public byte[] toByteArray() {
        return getBytes();
    }

    public DBObject toDBObject() {
        return this;
    }

    public int getSize() {
        return getBSONSize();
    }
}

Remove the use of a protected deprecated field


/**
 * Created by Nathan_Zeplowitz on 4/14/15.
 */
public class GuessingGame {
}

/**
 * Created by Nathan_Zeplowitz on 4/14/15.
 */
public class GuessingGame {
    public static void main(String[] args) {
        RandomNumber randomNumber = new RandomNumber();
        GameHelper helper = new GameHelper();
        boolean guessCorrect = false;

        while(!guessCorrect){
            String userGuess = helper.getUserInput("Guess a Number Between 1 and 100:");
            String result = randomNumber.checkGuess(userGuess);

            if (result.equals("Correct")) {
                guessCorrect = true;
                System.out.println("Your guess was correct. You Win!");
                break;
            }

            System.out.println(result);

        }
    }

}

Add Main Game With Checks for User Guesses


/**
 * Created by Nathan_Zeplowitz on 4/14/15.
 */
public class RandomNumber {
    private int number;

    public RandomNumber(){
        this.number = (int) (Math.random() * 100);
    }

    public int getNumber() {
        return number;
    }
}

/**
 * Created by Nathan_Zeplowitz on 4/14/15.
 */
public class RandomNumber {
    private int number;

    public RandomNumber(){
        this.number = (int) (Math.random() * 100);
    }

    public int getNumber() {
        return number;
    }

    public String checkGuess(String userGuess) {
        int guess = Integer.parseInt(userGuess);

        if (guess == getNumber()) {
            return "Correct";
        } else if (guess < getNumber()) {
            return "Your guess was too low.";
        } else {
            return "Your guess was too high.";
        }
    }
}

Add CheckGuess Method to Random Number


package de.sormuras.bach.util;

import java.util.Map;
import java.util.NoSuchElementException;
import java.util.ServiceLoader;
import java.util.TreeMap;
import java.util.function.Consumer;
import java.util.spi.ToolProvider;

/** Tool registry. */
public class Tools {

  final Map<String, ToolProvider> map;

  public Tools() {
    this.map = new TreeMap<>();
    ServiceLoader.load(ToolProvider.class).stream()
        .map(ServiceLoader.Provider::get)
        .forEach(provider -> map.putIfAbsent(provider.name(), provider));
  }

  public ToolProvider get(String name) {
    var tool = map.get(name);
    if (tool == null) {
      throw new NoSuchElementException("No such tool: " + name);
    }
    return tool;
  }

  public void forEach(Consumer<ToolProvider> action) {
    map.values().forEach(action);
  }
}

package de.sormuras.bach.util;

import java.util.Map;
import java.util.NoSuchElementException;
import java.util.ServiceLoader;
import java.util.TreeMap;
import java.util.function.Consumer;
import java.util.spi.ToolProvider;

/** Tool registry. */
public class Tools {

  final Map<String, ToolProvider> map;

  public Tools() {
    this.map = new TreeMap<>();
    ServiceLoader.load(ToolProvider.class, ClassLoader.getSystemClassLoader()).stream()
        .map(ServiceLoader.Provider::get)
        .forEach(provider -> map.putIfAbsent(provider.name(), provider));
  }

  public ToolProvider get(String name) {
    var tool = map.get(name);
    if (tool == null) {
      throw new NoSuchElementException("No such tool: " + name);
    }
    return tool;
  }

  public void forEach(Consumer<ToolProvider> action) {
    map.values().forEach(action);
  }
}

Use system (application) class loader to load tool providers


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

package org.cloudfoundry.operations;

import org.junit.Test;

import static org.cloudfoundry.operations.ValidationResult.Status.VALID;
import static org.junit.Assert.assertEquals;

public final class ListRoutesRequestTest {

    @Test
    public void isValid() {
        ValidationResult result = ListRoutesRequest.builder()
                .level(ListRoutesRequest.Level.Organization)
                .build()
                .isValid();

        assertEquals(VALID, result.getStatus());
    }

}

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

package org.cloudfoundry.operations;

import org.junit.Test;

import static org.cloudfoundry.operations.ValidationResult.Status.VALID;
import static org.junit.Assert.assertEquals;

public final class ListRoutesRequestTest {

    @Test
    public void isValid() {
        ValidationResult result = ListRoutesRequest.builder()
                .level(ListRoutesRequest.Level.Organization)
                .build()
                .isValid();

        assertEquals(VALID, result.getStatus());
    }

    @Test
    public void isValidNoLevel() {
        ValidationResult result = ListRoutesRequest.builder()
                .build()
                .isValid();

        assertEquals(VALID, result.getStatus());
    }

}

Add test for level being omitted on Routes operation.