package org.certificatetransparency.ctlog;

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

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

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

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

package org.certificatetransparency.ctlog;

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

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

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

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

Use an import for java.util.ArrayList.


package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

  public void gotoGroupPage() {
      click(By.linkText("groups"));
  }

  public void gotoMainPage() {
      click(By.linkText("home"));

  }
}

package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

 // public void gotoGroupPage() { click(By.linkText("groups")); }

/* sprawdzanie elementu na stronie i przejście po linku - wariant 1
  public void gotoGroupPage() {
    if (!isElementPresent(By.tagName("h1"))
            || !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            || !isElementPresent(By.name("new"))) {
      click(By.linkText("groups"));
    }
  }
*/
// sprawdzanie elementu na stronie i przejście po linku - wariant 2 lepszy

  public void gotoGroupPage() {
    if (isElementPresent(By.tagName("h1"))
            && !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            && !isElementPresent(By.name("new"))) {
      return;
    }
      click(By.linkText("groups"));
    }

  public void gotoMainPage() {
    if (isElementPresent(By.id("maintable"))) {
      return;
    }
      click(By.linkText("home"));
  }
}

Revert "Revert "Revert "Revert "optimization of the transition between the pages""""


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

import org.junit.Test;
import org.microworld.mangopay.MangopayClient;
import org.microworld.mangopay.MangopayConnection;
import org.microworld.mangopay.exceptions.MangopayUnauthorizedException;

public class ConnectIT extends AbstractIntegrationTest {
  @Test
  public void anExceptionIsThrownWhenConnectingToMangopayWithInvalidCredentials() {
    thrown.expect(MangopayUnauthorizedException.class);
    thrown.expectMessage("invalid_client: Authentication failed");
    final MangopayConnection connection = MangopayConnection.createDefault("api.sandbox.mangopay.com", "bar", "baz");
    MangopayClient.createDefault(connection).getUserService().get("42");
  }
}

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

import org.junit.Test;
import org.microworld.mangopay.MangopayClient;
import org.microworld.mangopay.MangopayConnection;
import org.microworld.mangopay.exceptions.MangopayUnauthorizedException;

public class ConnectIT extends AbstractIntegrationTest {
  @Test
  public void anExceptionIsThrownWhenConnectingToMangopayWithInvalidCredentials() {
    thrown.expect(MangopayUnauthorizedException.class);
    thrown.expectMessage("invalid_client: Your authorization do not allow you to access to this information");
    final MangopayConnection connection = MangopayConnection.createDefault("api.sandbox.mangopay.com", "bar", "baz");
    MangopayClient.createDefault(connection).getUserService().get("42");
  }
}

Update error message in tests.


/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.fulfillment.service;

import org.apache.commons.lang3.StringUtils;

public class ResourceNames {
  private ResourceNames() {}

  public static final String SEPARATOR = "/";

  public static final String BASE_PATH = "/api";
  public static final String USERS = "users";

  public static String getUsersPath() {
    return getPath(USERS);
  }

  private static String getPath(String resourseName) {
    return StringUtils.joinWith(SEPARATOR, BASE_PATH, resourseName) + SEPARATOR;
  }
}

/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.fulfillment.service;

import org.apache.commons.lang3.StringUtils;

public class ResourceNames {
  public static final String SEPARATOR = "/";
  public static final String BASE_PATH = "/api";
  public static final String USERS = "users";

  private ResourceNames() {}

  public static String getUsersPath() {
    return getPath(USERS);
  }

  private static String getPath(String resourseName) {
    return StringUtils.joinWith(SEPARATOR, BASE_PATH, resourseName) + SEPARATOR;
  }
}

Move variable to comply with Java Code Conventions.


package net.sf.commonclipse;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;

import java.util.regex.Pattern;

/**
 * Tests for CCPluginPreferences.
 * @author fgiust
 * @version $Revision$ ($Author$)
 */
public class CCPluginPreferencesTest
{

    /**
     * test the conversion from an array of strings to a regexp.
     */
    public void testRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("log;test?u?;done*");
        assertThat(regexp.pattern(), equalTo("(^log$)|(^test.u.$)|(^done*$)"));
    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    public void testEmptyRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("");
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());

    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    public void testNullRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp(null);
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());
    }

}

package net.sf.commonclipse;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;

import java.util.regex.Pattern;

import org.junit.Test;

/**
 * Tests for CCPluginPreferences.
 * @author fgiust
 * @version $Revision$ ($Author$)
 */
public class CCPluginPreferencesTest
{

    /**
     * test the conversion from an array of strings to a regexp.
     */
    @Test
    public void testRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("log;test?u?;done*");
        assertThat(regexp.pattern(), equalTo("(^log$)|(^test.u.$)|(^done*$)"));
    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    @Test
    public void testEmptyRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("");
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());

    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    @Test
    public void testNullRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp(null);
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());
    }

}

Fix missing @Test annotations for JUnit tests.


package graphql;

public class GraphQLException extends RuntimeException {

    public GraphQLException() {
    }

    public GraphQLException(String message) {
        super(message);
    }

    public GraphQLException(String message, Throwable cause) {
        super(message, cause);
    }

    public GraphQLException(Throwable cause) {
        super(cause);
    }

}

package graphql;

public class GraphQLException extends RuntimeException {

    public GraphQLException() {
    }

    public GraphQLException(String message) {
        super(message);
    }

    public GraphQLException(String message, Throwable cause) {
        super(message, cause);
    }

    public GraphQLException(Throwable cause) {
        super(cause);
    }

    @Override
    public String toString() {
        return getMessage();
    }

}

Make graphql exception tostring be the message


package com.bradmcevoy.http.values;

import com.bradmcevoy.http.DateUtils;
import com.bradmcevoy.http.DateUtils.DateParseException;
import com.bradmcevoy.http.XmlWriter;
import java.util.Date;
import java.util.Map;

public class DateValueWriter implements ValueWriter {

    public boolean supports( String nsUri, String localName, Class c ) {
        return Date.class.equals( c );
    }

    public void writeValue( XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes ) {
        if( val == null ) {
            writer.writeProperty( prefix, localName );
        } else {
            Date date = (Date) val;
            String s = DateUtils.formatDate( date );
            writer.writeProperty( prefix, localName, s );
        }
    }

    public Object parse( String namespaceURI, String localPart, String value ) {
        if( value == null || value.length() == 0 ) return null;
        Date dt;
        try {
            dt = DateUtils.parseDate( value );
            return dt;
        } catch( DateParseException ex ) {
            throw new RuntimeException( value, ex );
        }
    }
}

package com.bradmcevoy.http.values;

import com.bradmcevoy.http.DateUtils;
import com.bradmcevoy.http.DateUtils.DateParseException;
import com.bradmcevoy.http.XmlWriter;
import java.util.Date;
import java.util.Map;

public class DateValueWriter implements ValueWriter {

	@Override
    public boolean supports( String nsUri, String localName, Class c ) {
        return c.isInstance(Date.class);
    }

	@Override
    public void writeValue( XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes ) {
        if( val == null ) {
            writer.writeProperty( prefix, localName );
        } else {
            Date date = (Date) val;
            String s = DateUtils.formatDate( date );
            writer.writeProperty( prefix, localName, s );
        }
    }

	@Override
    public Object parse( String namespaceURI, String localPart, String value ) {
        if( value == null || value.length() == 0 ) return null;
        Date dt;
        try {
            dt = DateUtils.parseDate( value );
            return dt;
        } catch( DateParseException ex ) {
            throw new RuntimeException( value, ex );
        }
    }
}

Fix so that Timestamp objects get formatted as Date's


package protocolsupport.protocol.packet.middleimpl.writeable.play.v_5_6;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.protocol.packet.Team;
import protocolsupport.protocol.packet.id.LegacyPacketId;
import protocolsupport.protocol.packet.middleimpl.writeable.LegacySingleWriteablePacket;
import protocolsupport.protocol.serializer.StringSerializer;

public class ScoreboardTeamPacket extends LegacySingleWriteablePacket<Team> {

	public ScoreboardTeamPacket() {
		super(LegacyPacketId.Clientbound.PLAY_SCOREBOARD_SCORE);
	}

	@Override
	protected void write(ByteBuf data, Team packet) {
		StringSerializer.writeShortUTF16BEString(data, packet.getName());
		int mode = packet.getMode();
		data.writeByte(mode);
		if ((mode == 0) || (mode == 2)) {
			StringSerializer.writeShortUTF16BEString(data, packet.getDisplayName());
			StringSerializer.writeShortUTF16BEString(data, packet.getPrefix());
			StringSerializer.writeShortUTF16BEString(data, packet.getSuffix());
			data.writeByte(packet.getFriendlyFire());
		}
		if ((mode == 0) || (mode == 3) || (mode == 4)) {
			data.writeShort(packet.getPlayers().length);
			for (String player : packet.getPlayers()) {
				StringSerializer.writeShortUTF16BEString(data, player);
			}
		}
	}

}

package protocolsupport.protocol.packet.middleimpl.writeable.play.v_5_6;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.protocol.packet.Team;
import protocolsupport.protocol.packet.id.LegacyPacketId;
import protocolsupport.protocol.packet.middleimpl.writeable.LegacySingleWriteablePacket;
import protocolsupport.protocol.serializer.StringSerializer;

public class ScoreboardTeamPacket extends LegacySingleWriteablePacket<Team> {

	public ScoreboardTeamPacket() {
		super(LegacyPacketId.Clientbound.PLAY_SCOREBOARD_TEAM);
	}

	@Override
	protected void write(ByteBuf data, Team packet) {
		StringSerializer.writeShortUTF16BEString(data, packet.getName());
		int mode = packet.getMode();
		data.writeByte(mode);
		if ((mode == 0) || (mode == 2)) {
			StringSerializer.writeShortUTF16BEString(data, packet.getDisplayName());
			StringSerializer.writeShortUTF16BEString(data, packet.getPrefix());
			StringSerializer.writeShortUTF16BEString(data, packet.getSuffix());
			data.writeByte(packet.getFriendlyFire());
		}
		if ((mode == 0) || (mode == 3) || (mode == 4)) {
			data.writeShort(packet.getPlayers().length);
			for (String player : packet.getPlayers()) {
				StringSerializer.writeShortUTF16BEString(data, player);
			}
		}
	}

}

Fix scoreboard team using wrong packet idTeam


package com.datatheorem.android.trustkit.pinning;

import android.net.SSLCertificateSocketFactory;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import javax.net.ssl.TrustManager;

public class TrustKitSSLSocketFactory extends SSLCertificateSocketFactory {

    // TODO(ad): Figure this out
    // REVIEW(bj): resolve this TODO or remove it. ;P
    public TrustKitSSLSocketFactory() {
        super(0);
    }

    @Override
    public Socket createSocket(String host, int port, InetAddress localAddr, int localPort)
            throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port, localAddr, localPort);
    }

    @Override
    public Socket createSocket(Socket k, String host, int port, boolean close) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(k, host, port, close);
    }

    @Override
    public Socket createSocket(String host, int port) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port);
    }
}

package com.datatheorem.android.trustkit.pinning;

import android.net.SSLCertificateSocketFactory;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import javax.net.ssl.TrustManager;

public class TrustKitSSLSocketFactory extends SSLCertificateSocketFactory {

    public TrustKitSSLSocketFactory() {
        // Inheritance is the only way to customize the SSLCertificateSocketFactory but it requires
        // calling this deprecated method
        super(0);
    }

    @Override
    public Socket createSocket(String host, int port, InetAddress localAddr, int localPort)
            throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port, localAddr, localPort);
    }

    @Override
    public Socket createSocket(Socket k, String host, int port, boolean close) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(k, host, port, close);
    }

    @Override
    public Socket createSocket(String host, int port) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port);
    }
}

Remove and TODO and add explanation


package uk.co.alynn.games.ld30.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import uk.co.alynn.games.ld30.SpaceHams;
import uk.co.alynn.games.ld30.world.Constants;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.width = Constants.STANDARD_RES_WIDTH;
		config.height = Constants.STANDARD_RES_HEIGHT;
		config.samples = 2;
		config.vSyncEnabled = true;
		config.title = "Border Patrol";
		config.resizable = true;
		config.fullscreen = System.getProperty("os.name").equals("Mac OS X");
		new LwjglApplication(new SpaceHams(), config);
	}
}

package uk.co.alynn.games.ld30.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import uk.co.alynn.games.ld30.SpaceHams;
import uk.co.alynn.games.ld30.world.Constants;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.width = Constants.STANDARD_RES_WIDTH;
		config.height = Constants.STANDARD_RES_HEIGHT;
		config.samples = 2;
		config.vSyncEnabled = true;
		config.title = "Intergalactopol";
		config.resizable = true;
		config.fullscreen = System.getProperty("os.name").equals("Mac OS X");
		new LwjglApplication(new SpaceHams(), config);
	}
}

Switch the name to Intergalactopol


/*
 * Copyright 2012 Artur Dryomov
 *
 * 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 ru.ming13.gambit.local.sqlite;

final class DbFieldParams
{
	private DbFieldParams() {
	}

	public static final String ID = "integer primary key autoincrement not null unique";

	public static final String INDEX = "int not null";

	public static final String DECK_TITLE = "text not null unique";
	public static final String DECK_FOREIGN_ID;

	static {
		final String foreignKeyMask = "integer not null references %s(%s)";

		DECK_FOREIGN_ID = String.format(foreignKeyMask, DbTableNames.DECKS, DbFieldNames.ID);
	}

	public static final String CARD_TEXT = "text not null";
}

/*
 * Copyright 2012 Artur Dryomov
 *
 * 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 ru.ming13.gambit.local.sqlite;

final class DbFieldParams
{
	private DbFieldParams() {
	}

	public static final String ID = "integer primary key autoincrement not null unique";

	public static final String INDEX = "int not null";

	public static final String DECK_TITLE = "text not null unique";
	public static final String DECK_FOREIGN_ID;

	static {
		final String deckForeignKeyMask = "integer not null references %s(%s) on delete cascade";

		DECK_FOREIGN_ID = String.format(deckForeignKeyMask, DbTableNames.DECKS, DbFieldNames.ID);
	}

	public static final String CARD_TEXT = "text not null";
}

Add cascade deletion for deck cards.


package org.jvirtanen.parity.net.poe;

import static org.jvirtanen.parity.net.poe.POE.*;

import com.paritytrading.nassau.MessageListener;
import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * A parser for inbound messages on the server side.
 */
public class POEServerParser implements MessageListener {

    private EnterOrder  enterOrder;
    private CancelOrder cancelOrder;

    private POEServerListener listener;

    /**
     * Create a parser for inbound messages on the server side.
     *
     * @param listener the message listener
     */
    public POEServerParser(POEServerListener listener) {
        this.enterOrder  = new EnterOrder();
        this.cancelOrder = new CancelOrder();

        this.listener = listener;
    }

    @Override
    public void message(ByteBuffer buffer) throws IOException {
        byte messageType = buffer.get();

        switch (messageType) {
        case MESSAGE_TYPE_ENTER_ORDER:
            enterOrder(buffer);
            break;
        case MESSAGE_TYPE_CANCEL_ORDER:
            cancelOrder(buffer);
            break;
        default:
            throw new POEException("Unknown message type: " + (char)messageType);
        }
    }

    private void enterOrder(ByteBuffer buffer) throws IOException {
        enterOrder.get(buffer);

        listener.enterOrder(enterOrder);
    }

    private void cancelOrder(ByteBuffer buffer) throws IOException {
        cancelOrder.get(buffer);

        listener.cancelOrder(cancelOrder);
    }

}

package org.jvirtanen.parity.net.poe;

import static org.jvirtanen.parity.net.poe.POE.*;

import com.paritytrading.nassau.MessageListener;
import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * A parser for inbound messages on the server side.
 */
public class POEServerParser implements MessageListener {

    private EnterOrder  enterOrder;
    private CancelOrder cancelOrder;

    private POEServerListener listener;

    /**
     * Create a parser for inbound messages on the server side.
     *
     * @param listener the message listener
     */
    public POEServerParser(POEServerListener listener) {
        this.enterOrder  = new EnterOrder();
        this.cancelOrder = new CancelOrder();

        this.listener = listener;
    }

    @Override
    public void message(ByteBuffer buffer) throws IOException {
        byte messageType = buffer.get();

        switch (messageType) {
        case MESSAGE_TYPE_ENTER_ORDER:
            enterOrder.get(buffer);
            listener.enterOrder(enterOrder);
            break;
        case MESSAGE_TYPE_CANCEL_ORDER:
            cancelOrder.get(buffer);
            listener.cancelOrder(cancelOrder);
            break;
        default:
            throw new POEException("Unknown message type: " + (char)messageType);
        }
    }

}

Simplify POE server parser in network protocols


package de.codecentric.centerdevice.glass;

import com.sun.glass.ui.Application;

import de.codecentric.centerdevice.util.ReflectionUtils;
import javafx.application.Platform;

public class MacApplicationAdapter {

	private Application app;

	private boolean forceQuitOnCmdQ = true;

	public MacApplicationAdapter() throws ReflectiveOperationException {
		app = Application.GetApplication();
	}

	public void hide() {
		ReflectionUtils.invokeQuietly(app, "_hide");
	}

	public void hideOtherApplications() {
		ReflectionUtils.invokeQuietly(app, "_hideOtherApplications");
	}

	public void unhideAllApplications() {
		ReflectionUtils.invokeQuietly(app, "_unhideAllApplications");
	}

	public void quit() {
		Application.EventHandler eh = app.getEventHandler();
		if (eh != null) {
			eh.handleQuitAction(Application.GetApplication(), System.nanoTime());
		}
		if (forceQuitOnCmdQ) {
			Platform.exit();
		}
	}

	public void setForceQuitOnCmdQ(boolean forceQuit) {
		this.forceQuitOnCmdQ = forceQuit;
	}

}

package de.codecentric.centerdevice.glass;

import com.sun.glass.ui.Application;

import de.codecentric.centerdevice.util.ReflectionUtils;
import javafx.application.Platform;

public class MacApplicationAdapter {

	private Application app;

	private boolean forceQuitOnCmdQ = true;

	public MacApplicationAdapter() {
		app = Application.GetApplication();
	}

	public void hide() {
		ReflectionUtils.invokeQuietly(app, "_hide");
	}

	public void hideOtherApplications() {
		ReflectionUtils.invokeQuietly(app, "_hideOtherApplications");
	}

	public void unhideAllApplications() {
		ReflectionUtils.invokeQuietly(app, "_unhideAllApplications");
	}

	public void quit() {
		Application.EventHandler eh = app.getEventHandler();
		if (eh != null) {
			eh.handleQuitAction(Application.GetApplication(), System.nanoTime());
		}
		if (forceQuitOnCmdQ) {
			Platform.exit();
		}
	}

	public void setForceQuitOnCmdQ(boolean forceQuit) {
		this.forceQuitOnCmdQ = forceQuit;
	}

}

Remove exception from method signature


package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;

import uk.ac.ic.wlgitbridge.util.Util;

/**
 * Created by Winston on 06/11/14.
 */
public class SnapshotInfo implements Comparable<SnapshotInfo> {

    private int versionId;
    private String comment;
    private WLUser user;
    private String createdAt;

    public SnapshotInfo(int versionID, String createdAt, String name, String email) {
        this(versionID, "Update on " + Util.getServiceName() + ".", email, name, createdAt);
    }

    public SnapshotInfo(int versionID, String comment, String email, String name, String createdAt) {
        versionId = versionID;
        this.comment = comment;
        user = new WLUser(name, email);
        this.createdAt = createdAt;
    }

    public int getVersionId() {
        return versionId;
    }

    public String getComment() {
        return comment;
    }

    public WLUser getUser() {
        return user;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof SnapshotInfo)) {
            return false;
        }
        SnapshotInfo that = (SnapshotInfo) obj;
        return versionId == that.versionId;
    }

    @Override
    public int compareTo(SnapshotInfo o) {
        return Integer.compare(versionId, o.versionId);
    }
}

package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;

import uk.ac.ic.wlgitbridge.util.Util;

/**
 * Created by Winston on 06/11/14.
 */
public class SnapshotInfo implements Comparable<SnapshotInfo> {

    private int versionId;
    private String comment;
    private WLUser user;
    private String createdAt;

    public SnapshotInfo(int versionID, String createdAt, String name, String email) {
        this(versionID, "Update on " + Util.getServiceName() + ".", email, name, createdAt);
    }

    public SnapshotInfo(int versionID, String comment, String email, String name, String createdAt) {
        versionId = versionID;
        this.comment = comment;
        user = new WLUser(name, email);
        this.createdAt = createdAt;
    }

    public int getVersionId() {
        return versionId;
    }

    public String getComment() {
        return comment;
    }

    public WLUser getUser() {
        return user != null ? user : new WLUser();
    }

    public String getCreatedAt() {
        return createdAt;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof SnapshotInfo)) {
            return false;
        }
        SnapshotInfo that = (SnapshotInfo) obj;
        return versionId == that.versionId;
    }

    @Override
    public int compareTo(SnapshotInfo o) {
        return Integer.compare(versionId, o.versionId);
    }
}

Support for anonymous saved versions


package com.thomasnyberg.minset;

import android.app.Activity;
import android.os.Bundle;

public class Mindset extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  }
}

package com.thomasnyberg.mindset;

import android.app.Activity;
import android.os.Bundle;

public class Mindset extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  }
}

Fix minset <--> mindset spelling mistake


package io.quarkus.arc.deployment;

import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;

import java.util.List;

import io.quarkus.arc.runtime.ArcRecorder;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ApplicationStartBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;

public class LifecycleEventsBuildStep {

    @BuildStep
    @Record(RUNTIME_INIT)
    ApplicationStartBuildItem startupEvent(ArcRecorder recorder,
            List<ServiceStartBuildItem> startList,
            BeanContainerBuildItem beanContainer,
            ShutdownContextBuildItem shutdown) {
        recorder.handleLifecycleEvents(shutdown, beanContainer.getValue());
        return new ApplicationStartBuildItem();
    }

}

package io.quarkus.arc.deployment;

import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;

import java.util.List;

import io.quarkus.arc.runtime.ArcRecorder;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Consume;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ApplicationStartBuildItem;
import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;

public class LifecycleEventsBuildStep {

    @Consume(RuntimeConfigSetupCompleteBuildItem.class)
    @BuildStep
    @Record(RUNTIME_INIT)
    ApplicationStartBuildItem startupEvent(ArcRecorder recorder,
            List<ServiceStartBuildItem> startList,
            BeanContainerBuildItem beanContainer,
            ShutdownContextBuildItem shutdown) {
        recorder.handleLifecycleEvents(shutdown, beanContainer.getValue());
        return new ApplicationStartBuildItem();
    }

}

Make sure the StartupEvent is fired after the runtime config is set


package gov.nih.nci.cananolab.restful.view.edit;

public class SimpleInstrumentBean {

	String manufacturer;
	String modelName;
	String type;
	public String getManufacturer() {
		return manufacturer;
	}
	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}
	public String getModelName() {
		return modelName;
	}
	public void setModelName(String modelName) {
		this.modelName = modelName;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}

}

package gov.nih.nci.cananolab.restful.view.edit;

public class SimpleInstrumentBean {

	String manufacturer = "";
	String modelName = "";
	String type = "";

	public String getManufacturer() {
		return manufacturer;
	}
	public void setManufacturer(String manufacturer) {
		if (manufacturer != null)
			this.manufacturer = manufacturer;
	}
	public String getModelName() {
		return modelName;
	}
	public void setModelName(String modelName) {
		if (modelName != null)
			this.modelName = modelName;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		if (type != null)
			this.type = type;
	}

}

Make sure type doesn't have null value. Otherwise, got hibernate error


package tars.testutil;

import tars.commons.exceptions.IllegalValueException;
import tars.model.task.*;
import tars.model.tag.Tag;

/**
 *
 */
public class TaskBuilder {

    private TestTask task;

    public TaskBuilder() {
        this.task = new TestTask();
    }

    public TaskBuilder withName(String name) throws IllegalValueException {
        this.task.setName(new Name(name));
        return this;
    }

    public TaskBuilder withTags(String ... tags) throws IllegalValueException {
        for (String tag: tags) {
            task.getTags().add(new Tag(tag));
        }
        return this;
    }

    public TaskBuilder withAddress(String address) throws IllegalValueException {
        this.task.setAddress(new Address(address));
        return this;
    }

    public TaskBuilder withPhone(String phone) throws IllegalValueException {
        this.task.setPhone(new Phone(phone));
        return this;
    }

    public TaskBuilder withEmail(String email) throws IllegalValueException {
        this.task.setEmail(new Email(email));
        return this;
    }

    public TestTask build() {
        return this.task;
    }

}

package tars.testutil;

import tars.commons.exceptions.IllegalValueException;
import tars.model.task.*;
import tars.model.tag.Tag;

/**
 *
 */
public class TaskBuilder {

    private TestTask task;

    public TaskBuilder() {
        this.task = new TestTask();
    }

    public TaskBuilder withName(String name) throws IllegalValueException {
        this.task.setName(new Name(name));
        return this;
    }

    public TaskBuilder withTags(String ... tags) throws IllegalValueException {
        for (String tag: tags) {
            task.getTags().add(new Tag(tag));
        }
        return this;
    }

    public TaskBuilder withDateTime(String dateTime) throws IllegalValueException {
        this.task.setDateTime(new DateTime(dateTime, ""));
        return this;
    }

    public TaskBuilder withPriority(String priority) throws IllegalValueException {
        this.task.setPriority(new Priority(priority));
        return this;
    }

    public TestTask build() {
        return this.task;
    }

}

Add methods withDateTime(String) and withPriority(String)


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

package org.apache.tapestry5.services.compatibility;

import org.apache.tapestry5.internal.services.compatibility.CompatibilityImpl;
import org.apache.tapestry5.internal.services.compatibility.DeprecationWarningImpl;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;

/**
 * Defines services for managing compatibility across releases.
 *
 * @since 5.4
 */
public class CompatibilityModule
{
    public static void bind(ServiceBinder binder)
    {
        binder.bind(Compatibility.class, CompatibilityImpl.class);
        binder.bind(DeprecationWarning.class, DeprecationWarningImpl.class);
    }

    @Contribute(Compatibility.class)
    public void enableAllCompatibilityTemporarily(Configuration<Trait> configuration)
    {
        for (Trait t : Trait.values())
        {
            configuration.add(t);
        }
    }

}

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

package org.apache.tapestry5.services.compatibility;

import org.apache.tapestry5.internal.services.compatibility.CompatibilityImpl;
import org.apache.tapestry5.internal.services.compatibility.DeprecationWarningImpl;
import org.apache.tapestry5.ioc.ServiceBinder;

/**
 * Defines services for managing compatibility across releases.
 *
 * @since 5.4
 */
public class CompatibilityModule
{
    public static void bind(ServiceBinder binder)
    {
        binder.bind(Compatibility.class, CompatibilityImpl.class);
        binder.bind(DeprecationWarning.class, DeprecationWarningImpl.class);
    }
}

Remove broken contribution to Compatibility service


package net.kencochrane.raven;

import com.google.common.collect.Iterators;
import mockit.Injectable;
import mockit.Mocked;
import mockit.NonStrictExpectations;
import mockit.Tested;
import net.kencochrane.raven.dsn.Dsn;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ServiceLoader;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class RavenFactoryTest {
    @Tested
    private RavenFactory ravenFactory;
    @Mocked
    private ServiceLoader mockServiceLoader;

    @BeforeMethod
    public void setUp() throws Exception {
        new NonStrictExpectations() {{
            ServiceLoader.load(RavenFactory.class);
            result = mockServiceLoader;
        }};
    }

    @Test
    public void testGetFactoriesFromServiceLoader(@Injectable final Raven mockRaven,
                                                  @Injectable final Dsn mockDsn) throws Exception {
        new NonStrictExpectations() {{
            mockServiceLoader.iterator();
            result = Iterators.singletonIterator(ravenFactory);
            ravenFactory.createRavenInstance(mockDsn);
            result = mockRaven;
        }};

        Raven raven = RavenFactory.ravenInstance(mockDsn);

        assertThat(raven, is(mockRaven));
    }
}

package net.kencochrane.raven;

import com.google.common.collect.Iterators;
import mockit.Injectable;
import mockit.Mocked;
import mockit.NonStrictExpectations;
import mockit.Tested;
import net.kencochrane.raven.dsn.Dsn;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ServiceLoader;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class RavenFactoryTest {
    @Tested
    private RavenFactory ravenFactory;
    @Mocked
    private ServiceLoader mockServiceLoader;

    @BeforeMethod
    public void setUp() throws Exception {
        new NonStrictExpectations() {{
            ServiceLoader.load(RavenFactory.class);
            result = mockServiceLoader;
        }};
    }

    @Test
    public void testGetFactoriesFromServiceLoader(@Injectable final Raven mockRaven,
                                                  @Injectable final Dsn mockDsn) throws Exception {
        new NonStrictExpectations() {{
            mockServiceLoader.iterator();
            result = Iterators.singletonIterator(ravenFactory);
            ravenFactory.createRavenInstance(mockDsn);
            result = mockRaven;
        }};

        Raven raven = RavenFactory.ravenInstance(mockDsn);

        assertThat(raven, is(mockRaven));
    }

    @Test
    public void testGetFactoriesManuallyAdded(@Injectable final Raven mockRaven,
                                                  @Injectable final Dsn mockDsn) throws Exception {
        new NonStrictExpectations() {{
            RavenFactory.registerFactory(ravenFactory);
            ravenFactory.createRavenInstance(mockDsn);
            result = mockRaven;
        }};

        Raven raven = RavenFactory.ravenInstance(mockDsn);

        assertThat(raven, is(mockRaven));
    }
}

Test that factories can be added manually


package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.KeylessEntryCode;
import com.openxc.units.State;

public class KeylessEntryProgrammingCommand extends BaseMeasurement<
        State<KeylessEntryProgrammingCommand.Command>> {
    public final static String ID = "keyless_entry_command";

    public enum Command {
        ADD,
        ERASE,
        AUTHENTICATE
    }

    public KeylessEntryProgrammingCommand(State<Command> command,
            KeylessEntryCode code) {
        super(command, code);
    }

    public KeylessEntryProgrammingCommand(Command command,
            String code) {
        super(new State<Command>(command), new KeylessEntryCode(code));
    }

    public KeylessEntryProgrammingCommand(Command command) {
        super(new State<Command>(command));
    }

    public KeylessEntryProgrammingCommand(String command, String code) {
        this(Command.valueOf(command.toUpperCase(Locale.US)), code);
    }

    @Override
    public String getSerializedValue() {
        return getValue().enumValue().toString().toLowerCase();
    }

    @Override
    public KeylessEntryCode getEvent() {
        return (KeylessEntryCode) super.getEvent();
    }

    @Override
    public String getSerializedEvent() {
        return getEvent().getSerializedValue();
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.KeylessEntryCode;
import com.openxc.units.State;

public class KeylessEntryProgrammingCommand extends BaseMeasurement<
        State<KeylessEntryProgrammingCommand.Command>> {
    public final static String ID = "keyless_entry_command";

    public enum Command {
        ADD,
        ERASE,
        AUTHENTICATE
    }

    public KeylessEntryProgrammingCommand(State<Command> command,
            KeylessEntryCode code) {
        super(command, code);
    }

    public KeylessEntryProgrammingCommand(Command command,
            String code) {
        super(new State<Command>(command), new KeylessEntryCode(code));
    }

    public KeylessEntryProgrammingCommand(Command command) {
        super(new State<Command>(command));
    }

    public KeylessEntryProgrammingCommand(String command, String code) {
        this(Command.valueOf(command.toUpperCase(Locale.US)), code);
    }

    @Override
    public String getSerializedValue() {
        return getValue().enumValue().toString().toLowerCase();
    }

    @Override
    public KeylessEntryCode getEvent() {
        return (KeylessEntryCode) super.getEvent();
    }

    @Override
    public String getSerializedEvent() {
        return getEvent() != null ? getEvent().getSerializedValue() : null;
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

Allow keyless entry command to have no event.


package de.tum.in.www1.artemis.web.rest;

import java.time.Instant;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TimeResource {

    /**
     * {@code GET /time}:
     * @return the current server time as Instant
     */
    @GetMapping(value = "/time", produces = MediaType.TEXT_PLAIN_VALUE)
    public String time() {
        return Instant.now().toString();
    }
}

package de.tum.in.www1.artemis.web.rest;

import java.time.Instant;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TimeResource {

    /**
     * {@code GET /time}:
     * @return the current server time as Instant
     */
    @GetMapping("/time")
    public ResponseEntity<Instant> time() {
        return ResponseEntity.ok(Instant.now());
    }
}

Fix "/time" not returning JSON string


/*
 * Copyright 2016 higherfrequencytrading.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 net.openhft.chronicle.queue;

import net.openhft.chronicle.wire.MessageHistory;

/**
 * Created by peter on 27/03/16.
 */
public enum NoMessageHistory implements MessageHistory {
    INSTANCE;

    @Override
    public int timings() {
        return 0;
    }

    @Override
    public long timing(int n) {
        return -1;
    }

    @Override
    public int sources() {
        return 0;
    }

    @Override
    public int sourceId(int n) {
        return -1;
    }

    @Override
    public long sourceIndex(int n) {
        return -1;
    }

    @Override
    public void reset(int sourceId, long sourceIndex) {
        // ignored
    }
}

/*
 * Copyright 2016 higherfrequencytrading.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 net.openhft.chronicle.queue;

import net.openhft.chronicle.wire.MessageHistory;

/**
 * Created by peter on 27/03/16.
 */
public enum NoMessageHistory implements MessageHistory {
    INSTANCE;

    @Override
    public int timings() {
        return 0;
    }

    @Override
    public long timing(int n) {
        return -1;
    }

    @Override
    public int sources() {
        return 0;
    }

    @Override
    public int sourceId(int n) {
        return -1;
    }

    @Override
    public long sourceIndex(int n) {
        return -1;
    }

    @Override
    public void reset(int sourceId, long sourceIndex) {
        // ignored
    }

    @Override
    public int lastSourceId() {
        return -1;
    }

    @Override
    public long lastSourceIndex() {
        return -1;
    }

}

Improve logging for unknown/empty messages


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

package com.pushtechnology.diffusion.transform.transformer;

/**
 * A transformer. Converts values of one type into values of a different
 * type. It will not throw an exception.
 *
 * @param <S> the type of the source values
 * @param <T> the type of the transformed values
 * @author Push Technology Limited
 * @deprecated since 2.0.0 in favour of {@link java.util.function.Function}
 */
@SuppressWarnings("deprecation")
@Deprecated
public interface SafeTransformer<S, T> extends Transformer<S, T> {
    @Override
    T transform(S value);
}

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

package com.pushtechnology.diffusion.transform.transformer;

import java.util.function.Function;

/**
 * A transformer. Converts values of one type into values of a different
 * type. It will not throw an exception.
 *
 * @param <S> the type of the source values
 * @param <T> the type of the transformed values
 * @author Push Technology Limited
 * @deprecated since 2.0.0 in favour of {@link java.util.function.Function}
 */
@SuppressWarnings("deprecation")
@Deprecated
public interface SafeTransformer<S, T> extends Transformer<S, T> {
    @Override
    T transform(S value);

    /**
     * Convert the transformer to a function.
     *
     * @return the transformer as a function
     */
    default Function<S, T> asFunction() {
        return this::transform;
    }
}

Add a method to convert a safe transformer to a function.


package com.veyndan.redditclient.api.reddit.network.interceptor;

import com.google.common.base.Preconditions;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public final class UserAgentInterceptor implements Interceptor {
    private static final String USER_AGENT_HEADER_NAME = "User-Agent";
    private final String userAgentHeaderValue;

    public UserAgentInterceptor(final String userAgentHeaderValue) {
        this.userAgentHeaderValue = Preconditions.checkNotNull(userAgentHeaderValue);
    }

    @Override
    public Response intercept(final Chain chain) throws IOException {
        final Request originalRequest = chain.request();
        final Request requestWithUserAgent = originalRequest.newBuilder()
                .header(USER_AGENT_HEADER_NAME, userAgentHeaderValue)
                .build();
        return chain.proceed(requestWithUserAgent);
    }
}

package com.veyndan.redditclient.api.reddit.network.interceptor;

import java.io.IOException;
import java.util.Objects;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public final class UserAgentInterceptor implements Interceptor {
    private static final String USER_AGENT_HEADER_NAME = "User-Agent";
    private final String userAgentHeaderValue;

    public UserAgentInterceptor(final String userAgentHeaderValue) {
        this.userAgentHeaderValue = Objects.requireNonNull(userAgentHeaderValue);
    }

    @Override
    public Response intercept(final Chain chain) throws IOException {
        final Request originalRequest = chain.request();
        final Request requestWithUserAgent = originalRequest.newBuilder()
                .header(USER_AGENT_HEADER_NAME, userAgentHeaderValue)
                .build();
        return chain.proceed(requestWithUserAgent);
    }
}

Replace Preconditions.checkNonNull() from Guava with Java sdks Objects.requireNonNull()


package org.cytoscape.editor.internal;

import java.util.List;

import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableUtil;
import org.cytoscape.task.AbstractNetworkViewTaskFactory;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.work.TaskIterator;

public class CopyTaskFactory extends AbstractNetworkViewTaskFactory {
	final CyNetworkManager netMgr;
	final ClipboardManagerImpl clipMgr;

	public CopyTaskFactory(final ClipboardManagerImpl clipboardMgr, final CyNetworkManager netMgr) {
		this.netMgr = netMgr;
		this.clipMgr = clipboardMgr;
	}

	@Override
	public boolean isReady(CyNetworkView networkView) {
		if (!super.isReady(networkView))
			return false;

		// Make sure we've got something selected
		List<CyNode> selNodes = CyTableUtil.getNodesInState(networkView.getModel(), CyNetwork.SELECTED, true);
		if (selNodes != null && selNodes.size() > 0) return true;

		return false;
	}

	@Override
	public TaskIterator createTaskIterator(CyNetworkView networkView) {
		return new TaskIterator(new CopyTask(networkView, clipMgr));
	}
}

package org.cytoscape.editor.internal;

import java.util.List;

import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableUtil;
import org.cytoscape.task.AbstractNetworkViewTaskFactory;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.work.TaskIterator;

public class CopyTaskFactory extends AbstractNetworkViewTaskFactory {
	final CyNetworkManager netMgr;
	final ClipboardManagerImpl clipMgr;

	public CopyTaskFactory(final ClipboardManagerImpl clipboardMgr, final CyNetworkManager netMgr) {
		this.netMgr = netMgr;
		this.clipMgr = clipboardMgr;
	}

	@Override
	public boolean isReady(CyNetworkView networkView) {
		if (!super.isReady(networkView))
			return false;

		// Make sure we've got something selected
		List<CyNode> selNodes = CyTableUtil.getNodesInState(networkView.getModel(), CyNetwork.SELECTED, true);
		if (selNodes != null && selNodes.size() > 0) return true;

		List<CyEdge> selEdges = CyTableUtil.getEdgesInState(networkView.getModel(), CyNetwork.SELECTED, true);
		if (selEdges != null && selEdges.size() > 0) return true;

		return false;
	}

	@Override
	public TaskIterator createTaskIterator(CyNetworkView networkView) {
		return new TaskIterator(new CopyTask(networkView, clipMgr));
	}
}

Make sure to allow copy if only edges are selected


/**
    ______    _           _
    |  ___|  | |         | |   1.0
    | |_ __ _| |__  _   _| | __ _
    |  _/ _` | '_ \| | | | |/ _` |
    | || (_| | |_) | |_| | | (_| |
    |_| \__,_|_.__/ \__,_|_|\__,_|

    © The Unitry, 2015

**/

package eu.theunitry.fabula;

import eu.theunitry.fabula.UNGameEngine.graphics.UNGameScreen;

public class UNFabula
{
    public static void main(String[] args)
    {
        new UNGameScreen();
    }
}

/**
    ______    _           _
    |  ___|  | |         | |   1.0
    | |_ __ _| |__  _   _| | __ _
    |  _/ _` | '_ \| | | | |/ _` |
    | || (_| | |_) | |_| | | (_| |
    \_| \__,_|_.__/ \__,_|_|\__,_|

    © The Unitry, 2015

**/

package eu.theunitry.fabula;

import eu.theunitry.fabula.UNGameEngine.graphics.UNGameScreen;

public class UNFabula
{
    public static void main(String[] args)
    {
        new UNGameScreen();
    }
}

Fix rounded corner of ASCII art


package org.gitlab4j.api.models;

import org.gitlab4j.api.utils.JacksonJson;

public class ArtifactsFile {

    private String filename;
    private Integer size;

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return (JacksonJson.toJsonString(this));
    }
}

package org.gitlab4j.api.models;

import org.gitlab4j.api.utils.JacksonJson;

public class ArtifactsFile {

    private String filename;
    private Long size;

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return (JacksonJson.toJsonString(this));
    }
}

Support larger file sizes by expanding the size type to a Long.


package io.quarkus.rest.runtime.injection;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.sse.Sse;

import io.quarkus.rest.runtime.core.QuarkusRestRequestContext;
import io.quarkus.rest.runtime.jaxrs.QuarkusRestSse;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;

@Singleton
public class ContextProducers {

    @Inject
    CurrentVertxRequest currentVertxRequest;

    @RequestScoped
    @Produces
    UriInfo uriInfo() {
        return getContext().getUriInfo();
    }

    @RequestScoped
    @Produces
    HttpHeaders headers() {
        return getContext().getHttpHeaders();
    }

    @Singleton
    @Produces
    Sse sse() {
        return QuarkusRestSse.INSTANCE;
    }

    private QuarkusRestRequestContext getContext() {
        return (QuarkusRestRequestContext) currentVertxRequest.getOtherHttpContextObject();
    }
}

package io.quarkus.rest.runtime.injection;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.sse.Sse;

import io.quarkus.rest.runtime.core.QuarkusRestRequestContext;
import io.quarkus.rest.runtime.jaxrs.QuarkusRestSse;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
import io.vertx.core.http.HttpServerRequest;

/**
 * Provides CDI producers for objects that can be injected via @Context
 * In quarkus-rest this works because @Context is considered an alias for @Inject
 * through the use of {@code AutoInjectAnnotationBuildItem}
 */
@Singleton
public class ContextProducers {

    @Inject
    CurrentVertxRequest currentVertxRequest;

    @RequestScoped
    @Produces
    UriInfo uriInfo() {
        return getContext().getUriInfo();
    }

    @RequestScoped
    @Produces
    HttpHeaders headers() {
        return getContext().getHttpHeaders();
    }

    @Singleton
    @Produces
    Sse sse() {
        return QuarkusRestSse.INSTANCE;
    }

    // HttpServerRequest is a Vert.x type so it's not necessary to have it injectable via @Context,
    // however we do use it in the Quickstarts so let's make it work

    @RequestScoped
    @Produces
    HttpServerRequest httpServerRequest() {
        return currentVertxRequest.getCurrent().request();
    }

    private QuarkusRestRequestContext getContext() {
        return (QuarkusRestRequestContext) currentVertxRequest.getOtherHttpContextObject();
    }
}

Add support for doing injecting HttpServerRequest with @Context


package com.pm.server.controller;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.pm.server.datatype.Coordinate;
import com.pm.server.player.Ghost;
import com.pm.server.player.GhostRepository;

@RestController
@RequestMapping("/ghost")
public class GhostControllerImpl implements GhostController {

	@Autowired
	private GhostRepository ghostRepository;

	@Override
	@RequestMapping(
			value="/integer",
			method=RequestMethod.GET
	)
	public int getInteger() {
		return 0;
	}

	// Returns map of ghost id to location
	@Override
	@RequestMapping(
			value="/locations",
			method=RequestMethod.GET
	)
	public Map<Integer, Coordinate> getAllLocations() {

		List<Ghost> ghosts = ghostRepository.getAllGhosts();

		Map<Integer, Coordinate> ghostsLocations =
				new HashMap<Integer, Coordinate>();

		for(Ghost ghost : ghosts) {
			ghostsLocations.put(ghost.getId(), ghost.getLocation());
		}

		return ghostsLocations;
	}

}

package com.pm.server.controller;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.pm.server.datatype.Coordinate;
import com.pm.server.player.Ghost;
import com.pm.server.player.GhostRepository;

@RestController
@RequestMapping("/ghost")
public class GhostControllerImpl implements GhostController {

	@Autowired
	private GhostRepository ghostRepository;

	@Override
	@RequestMapping(
			value="/integer",
			method=RequestMethod.GET
	)
	public int getInteger() {
		return 0;
	}

	// Returns map of ghost id to location
	@Override
	@RequestMapping(
			value="/locations",
			method=RequestMethod.GET,
			produces={ "application/json" }
	)
	public Map<Integer, Coordinate> getAllLocations() {

		List<Ghost> ghosts = ghostRepository.getAllGhosts();

		Map<Integer, Coordinate> ghostsLocations =
				new HashMap<Integer, Coordinate>();

		if(ghosts != null) {
			for(Ghost ghost : ghosts) {
				ghostsLocations.put(ghost.getId(), ghost.getLocation());
			}
		}

		return ghostsLocations;
	}

}

Fix null exception if no ghosts found


package org.jenkinsci.plugins.ghprb;

import hudson.ProxyConfiguration;
import org.kohsuke.github.HttpConnector;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpConnectorWithJenkinsProxy implements HttpConnector {
    public HttpURLConnection connect(URL url) throws IOException {
        return (HttpURLConnection) ProxyConfiguration.open(url);
    }
}

package org.jenkinsci.plugins.ghprb;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import org.kohsuke.github.HttpConnector;

import hudson.ProxyConfiguration;

public class HttpConnectorWithJenkinsProxy implements HttpConnector {
    public HttpURLConnection connect(URL url) throws IOException {
        HttpURLConnection con = (HttpURLConnection) ProxyConfiguration.open(url);

        // Set default timeouts in case there are none
        if (con.getConnectTimeout() == 0) {
            con.setConnectTimeout(10000);
        }
        if (con.getReadTimeout() == 0) {
            con.setReadTimeout(10000);
        }
        return con;
    }
}

Use default timeouts for URLConnections


package BU.transactions;

public class Rule {
	final String TYPE = "operation";

	String softwareService;
	String url;

	public Rule(String softwareService, String url) {
		this.softwareService = softwareService;
		this.url = url;
	}

	public String toString() {
		String res = "";
		String[] ssArray = this.softwareService.replaceAll(" ", "").split("\\|");

		for(int i=0; i < ssArray.length; i++)
		{
			String ss = ssArray[i];

			res += "  - ruletype: software-service" + "\n";
			res += "        softwareService: \"" + ss + "\"\n";
			res += "        type: " + TYPE + "\n";
			res += "        label: " + url + "\n";

			if(i < ssArray.length - 1)
				res += "    ";
		}

		res += "      filtered: true" + "\n";

		return res;
	}
}

package BU.transactions;

public class Rule {
	final String TYPE = "operation";

	String softwareService;
	String url;

	public Rule(String softwareService, String url) {
		this.softwareService = softwareService;
		this.url = url;
	}

	public String toString() {
		String res = "";
		String[] ssArray = this.softwareService.split("\\|");

		for(int i=0; i < ssArray.length; i++)
		{
			String ss = ssArray[i];

			res += "  - ruletype: software-service" + "\n";
			res += "        softwareService: \"" + ss + "\"\n";
			res += "        type: " + TYPE + "\n";
			res += "        label: " + url + "\n";

			if(i < ssArray.length - 1)
				res += "    ";
		}

		res += "      filtered: true" + "\n";

		return res;
	}
}

Fix bug removes spaces from Software Service names


// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;

import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.ReferenceFieldValue;

public class ReferenceDataType extends DataType {

    private final DocumentType targetType;

    public ReferenceDataType(DocumentType targetType, int id) {
        super(buildTypeName(targetType), id);
        this.targetType = targetType;
    }

    private ReferenceDataType(DocumentType targetType) {
        super(buildTypeName(targetType), 0);
        setId(getName().hashCode());
        this.targetType = targetType;
    }

    private static String buildTypeName(DocumentType targetType) {
        return "Reference<" + targetType.getName() + ">";
    }

    // Creates a new type where the numeric ID is based no the hash of targetType
    public static ReferenceDataType createWithInferredId(DocumentType targetType) {
        return new ReferenceDataType(targetType);
    }

    public DocumentType getTargetType() { return targetType; }

    @Override
    public ReferenceFieldValue createFieldValue() {
        return new ReferenceFieldValue(this);
    }

    @Override
    public Class<? extends ReferenceFieldValue> getValueClass() {
        return ReferenceFieldValue.class;
    }

    @Override
    public boolean isValueCompatible(FieldValue value) {
        if (value == null) {
            return false;
        }
        if (!ReferenceFieldValue.class.isAssignableFrom(value.getClass())) {
            return false;
        }
        ReferenceFieldValue rhs = (ReferenceFieldValue)value;
        return rhs.getDataType().equals(this);
    }
}

// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;

import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.ReferenceFieldValue;

public class ReferenceDataType extends DataType {

    private final DocumentType targetType;

    public ReferenceDataType(DocumentType targetType, int id) {
        super(buildTypeName(targetType), id);
        this.targetType = targetType;
    }

    private ReferenceDataType(DocumentType targetType) {
        this(targetType, buildTypeName(targetType).hashCode());
    }

    private static String buildTypeName(DocumentType targetType) {
        return "Reference<" + targetType.getName() + ">";
    }

    // Creates a new type where the numeric ID is based on the hash of targetType
    public static ReferenceDataType createWithInferredId(DocumentType targetType) {
        return new ReferenceDataType(targetType);
    }

    public DocumentType getTargetType() { return targetType; }

    @Override
    public ReferenceFieldValue createFieldValue() {
        return new ReferenceFieldValue(this);
    }

    @Override
    public Class<? extends ReferenceFieldValue> getValueClass() {
        return ReferenceFieldValue.class;
    }

    @Override
    public boolean isValueCompatible(FieldValue value) {
        if (value == null) {
            return false;
        }
        if (!ReferenceFieldValue.class.isAssignableFrom(value.getClass())) {
            return false;
        }
        ReferenceFieldValue rhs = (ReferenceFieldValue)value;
        return rhs.getDataType().equals(this);
    }
}

Delete to existing constructor and fix typo


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

package org.onepf.opfiab.model.event;

import android.support.annotation.NonNull;

public abstract class BillingEvent {

    public static enum Type {
        SETUP,

        CONSUME,
        PURCHASE,
        SKU_DETAILS,
        INVENTORY,
    }

    @NonNull
    private final Type type;

    protected BillingEvent(@NonNull final Type type) {
        this.type = type;
    }

    public abstract int getId();

    @NonNull
    public Type getType() {
        return type;
    }
}

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

package org.onepf.opfiab.model.event;

import android.support.annotation.NonNull;

public abstract class BillingEvent {

    public static enum Type {

        CONSUME,
        PURCHASE,
        SKU_DETAILS,
        INVENTORY,
    }

    @NonNull
    private final Type type;

    protected BillingEvent(@NonNull final Type type) {
        this.type = type;
    }

    public abstract int getId();

    @NonNull
    public Type getType() {
        return type;
    }
}

Change Setup as a standalone Event.


/**
 *
 */
package org.mwc.debrief.core.creators.chartFeatures;

import MWC.GUI.*;
import MWC.GUI.Tools.Palette.CreateVPFLayers;

/**
 * @author ian.mayo
 *
 */
public class InsertVPFLayers extends CoreInsertChartFeature
{

	/**
	 * @return
	 */
	protected Plottable getPlottable(PlainChart theChart)
	{
		return CreateVPFLayers.createMyLibrary(true);
	}

}

/**
 *
 */
package org.mwc.debrief.core.creators.chartFeatures;

import MWC.GUI.*;
import MWC.GUI.Tools.Palette.CreateVPFLayers;

/**
 * @author ian.mayo
 *
 */
public class InsertVPFLayers extends CoreInsertChartFeature
{

	public InsertVPFLayers()
	{
		// tell our parent that we want to be inserted as a top-level layer
		super(false);
	}

	/**
	 * @return
	 */
	protected Plottable getPlottable(PlainChart theChart)
	{
		return CreateVPFLayers.createMyLibrary(true);
	}

}

Stop us going in as top-level layer


/**
 * Copyright 2014 Transmode AB
 *
 * 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 se.transmode.gradle.plugins.docker;

import org.gradle.api.JavaVersion;

/**
 * @author Matthias Grüter, matthias.gruter@transmode.com
 */
public enum JavaBaseImage {
    JAVA6("fkautz/java6-jre", JavaVersion.VERSION_1_6),
    JAVA7("dockerfile/java", JavaVersion.VERSION_1_7),
    JAVA8("aglover/java8-pier", JavaVersion.VERSION_1_8);

    final String imageName;
    final JavaVersion target;

    JavaBaseImage(String imageName, JavaVersion target) {
        this.imageName = imageName;
        this.target = target;
    }

    public static JavaBaseImage imageFor(JavaVersion target) {
        for(JavaBaseImage image: JavaBaseImage.values()) {
            if(image.target == target) {
                return image;
            }
        }
        throw new IllegalArgumentException("No Java base image for the supplied target " + target + " found.");
    }
}

/**
 * Copyright 2014 Transmode AB
 *
 * 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 se.transmode.gradle.plugins.docker;

import org.gradle.api.JavaVersion;

/**
 * @author Matthias Grüter, matthias.gruter@transmode.com
 */
public enum JavaBaseImage {
    JAVA6("java:openjdk-6-jre", JavaVersion.VERSION_1_6),
    JAVA7("java:openjdk-7-jre", JavaVersion.VERSION_1_7),
    JAVA8("java:openjdk-8-jre", JavaVersion.VERSION_1_8);

    final String imageName;
    final JavaVersion target;

    JavaBaseImage(String imageName, JavaVersion target) {
        this.imageName = imageName;
        this.target = target;
    }

    public static JavaBaseImage imageFor(JavaVersion target) {
        for(JavaBaseImage image: JavaBaseImage.values()) {
            if(image.target == target) {
                return image;
            }
        }
        throw new IllegalArgumentException("No Java base image for target " + target + " found.");
    }
}

Use new official java (openjdk-jre) base images


/**
 * Copyright (C) 2014 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.gandalf.joinpoint;

import com.fernandocejas.android10.gandalf.ApplicationTestCase;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class GandalfJoinPointTest extends ApplicationTestCase {

  @Before
  public void setUp() {
  }

  @Test
  public void testDummy() {
    assertThat(true, is(true));
  }
}

/**
 * Copyright (C) 2014 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.gandalf.joinpoint;

import com.fernandocejas.android10.gandalf.ApplicationTestCase;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class GandalfJoinPointTest extends ApplicationTestCase {

  @Rule
  public ExpectedException expectedException = ExpectedException.none();

  @Test
  public void testGandalfJoinPointCreation() {
    expectedException.expect(IllegalArgumentException.class);
    GandalfJoinPoint gandalfJoinPoint = new GandalfJoinPoint(null);
  }
}

Add constructor test to GandalfJoinPoint.


/**
 * Copyright (C) 2009 - 2009 by OpenGamma Inc.
 *
 * Please see distribution for license.
 */

package com.opengamma.engine.view.calcnode.stats;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * Maintains ever increasing tallies of the reported metrics.
 */
public class TotallingStatisticsGatherer implements StatisticsGatherer {

  private final ConcurrentMap<String, CalculationNodeStatistics> _nodeStatistics = new ConcurrentHashMap<String, CalculationNodeStatistics>();

  protected CalculationNodeStatistics getOrCreateNodeStatistics(final String nodeId) {
    CalculationNodeStatistics stats = _nodeStatistics.get(nodeId);
    if (stats == null) {
      stats = new CalculationNodeStatistics(nodeId);
      CalculationNodeStatistics newStats = _nodeStatistics.putIfAbsent(nodeId, stats);
      if (newStats != null) {
        stats = newStats;
      }
    }
    return stats;
  }

  @Override
  public void jobCompleted(String nodeId, long executionTime, long duration) {
    getOrCreateNodeStatistics(nodeId).recordSuccessfulJob(executionTime, duration);
  }

  @Override
  public void jobFailed(String nodeId, long duration) {
    getOrCreateNodeStatistics(nodeId).recordUnsuccessfulJob(duration);
  }

  public Map<String, CalculationNodeStatistics> getNodeStatistics() {
    return _nodeStatistics;
  }

}

/**
 * Copyright (C) 2009 - 2009 by OpenGamma Inc.
 *
 * Please see distribution for license.
 */

package com.opengamma.engine.view.calcnode.stats;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * Maintains ever increasing tallies of the reported metrics.
 */
public class TotallingStatisticsGatherer implements StatisticsGatherer {

  private final ConcurrentMap<String, CalculationNodeStatistics> _nodeStatistics = new ConcurrentHashMap<String, CalculationNodeStatistics>();

  protected CalculationNodeStatistics getOrCreateNodeStatistics(final String nodeId) {
    CalculationNodeStatistics stats = _nodeStatistics.get(nodeId);
    if (stats == null) {
      stats = new CalculationNodeStatistics(nodeId);
      CalculationNodeStatistics newStats = _nodeStatistics.putIfAbsent(nodeId, stats);
      if (newStats != null) {
        stats = newStats;
      }
    }
    return stats;
  }

  @Override
  public void jobCompleted(String nodeId, long executionTime, long duration) {
    getOrCreateNodeStatistics(nodeId).recordSuccessfulJob(executionTime, duration);
  }

  @Override
  public void jobFailed(String nodeId, long duration) {
    getOrCreateNodeStatistics(nodeId).recordUnsuccessfulJob(duration);
  }

  public List<CalculationNodeStatistics> getNodeStatistics() {
    return new ArrayList<CalculationNodeStatistics>(_nodeStatistics.values());
  }

}

Return the statistics set as a list rather than a map


package net.onrc.onos.ofcontroller.linkdiscovery.web;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import net.floodlightcontroller.routing.Link;
import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;

import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

public class LinksResource extends ServerResource {

    @Get("json")
    public Set<LinkWithType> retrieve() {
        ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
                get(ILinkDiscoveryService.class.getCanonicalName());
        Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
        Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();

        if (ld != null) {
            links.putAll(ld.getLinks());
            for (Link link: links.keySet()) {
                LinkInfo info = links.get(link);
                LinkWithType lwt = new LinkWithType(link,
                                                    info.getSrcPortState(),
                                                    info.getDstPortState(),
                                                    ld.getLinkType(link, info));
                returnLinkSet.add(lwt);
            }
        }
        return returnLinkSet;
    }
}

package net.onrc.onos.ofcontroller.linkdiscovery.web;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import net.floodlightcontroller.routing.Link;
import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;

import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

public class LinksResource extends ServerResource {

    @Get("json")
    public Set<LinkWithType> retrieve() {
        ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
                get(ILinkDiscoveryService.class.getCanonicalName());
        Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
        Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();

        if (ld != null) {
            links.putAll(ld.getLinks());
            for(Entry<Link, LinkInfo> e : links.entrySet()) {
                Link link = e.getKey();
                LinkInfo info = e.getValue();
                LinkWithType lwt = new LinkWithType(link,
                                                    info.getSrcPortState(),
                                                    info.getDstPortState(),
                                                    ld.getLinkType(link, info));
                returnLinkSet.add(lwt);
            }
        }
        return returnLinkSet;
    }
}

Fix potential performance issue reported by FindBugs


/*
 * Copyright 2010-2013 Ning, Inc.
 *
 * Ning 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.killbill.billing.osgi.api.config;

import java.io.File;

public interface PluginConfig extends Comparable<PluginConfig> {

    public String getPluginName();

    public PluginType getPluginType();

    public String getVersion();

    public String getPluginVersionnedName();

    /**
     * @return root directory of the deployed plugin
     */
    public File getPluginVersionRoot();

    public PluginLanguage getPluginLanguage();

    public boolean isSelectedForStart();
}

/*
 * Copyright 2010-2013 Ning, Inc.
 *
 * Ning 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.killbill.billing.osgi.api.config;

import java.io.File;

public interface PluginConfig extends Comparable<PluginConfig> {

    public String getPluginName();

    public PluginType getPluginType();

    public String getVersion();

    public String getPluginVersionnedName();

    /**
     * @return root directory of the deployed plugin
     */
    public File getPluginVersionRoot();

    public PluginLanguage getPluginLanguage();

    public boolean isSelectedForStart();

    public boolean isDisabled();
}

Add support for disabled plugin


package com.gemstone.gemfire.test.golden;

import static org.junit.Assert.*;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.gemstone.gemfire.test.process.ProcessWrapper;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;

@Category(IntegrationTest.class)
public class FailWithTimeoutOfWaitForOutputToMatchJUnitTest extends FailOutputTestCase {

  private static final long timeoutMillis = 1000;

  private ProcessWrapper process;

  public void subTearDown() throws Exception {
    this.process.waitFor();
    assertFalse(this.process.isAlive());
  }

  @Override
  String problem() {
    return "This is an extra line";
  }

  @Override
  void outputProblemInProcess(final String message) {
    System.out.println(message);
  }

  /**
   * Process output has an extra line and should fail
   */
  @Test
  public void testFailWithTimeoutOfWaitForOutputToMatch() throws Exception {
    this.process = createProcessWrapper(new ProcessWrapper.Builder().timeoutMillis(timeoutMillis), getClass());
    this.process.execute(createProperties());
    this.process.waitForOutputToMatch("Begin " + name() + "\\.main");

    try {
      this.process.waitForOutputToMatch(problem());
      fail("assertOutputMatchesGoldenFile should have failed due to " + problem());
    } catch (AssertionError expected) {
      assertTrue(expected.getMessage().contains(problem()));
    }
  }

  public static void main(String[] args) throws Exception {
    new FailWithTimeoutOfWaitForOutputToMatchJUnitTest().executeInProcess();
  }
}

package com.gemstone.gemfire.test.golden;

import static org.junit.Assert.*;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.gemstone.gemfire.test.process.ProcessWrapper;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;

@Category(IntegrationTest.class)
public class FailWithTimeoutOfWaitForOutputToMatchJUnitTest extends FailOutputTestCase {

  private static final long timeoutMillis = 1000;

  private ProcessWrapper process;

  public void subTearDown() throws Exception {
    this.process.destroy();
  }

  @Override
  String problem() {
    return "This is an extra line";
  }

  @Override
  void outputProblemInProcess(final String message) {
    System.out.println(message);
  }

  /**
   * Process output has an extra line and should fail
   */
  @Test
  public void testFailWithTimeoutOfWaitForOutputToMatch() throws Exception {
    this.process = createProcessWrapper(new ProcessWrapper.Builder().timeoutMillis(timeoutMillis), getClass());
    this.process.execute(createProperties());
    this.process.waitForOutputToMatch("Begin " + name() + "\\.main");

    try {
      this.process.waitForOutputToMatch(problem());
      fail("assertOutputMatchesGoldenFile should have failed due to " + problem());
    } catch (AssertionError expected) {
      assertTrue(expected.getMessage().contains(problem()));
    }
  }

  public static void main(String[] args) throws Exception {
    new FailWithTimeoutOfWaitForOutputToMatchJUnitTest().executeInProcess();
  }
}

Change subTearDown to destroy process


package ch.rasc.sec.controller;

import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import ch.rasc.sec.security.JpaUserDetails;

@Controller
public class HelloController {

	@RequestMapping(value = "/", method = RequestMethod.GET)
	@ResponseBody
	public String sayHello(@AuthenticationPrincipal JpaUserDetails user) {
		return "Hello " + user.getUsername();
	}

}

package ch.rasc.sec.controller;

import java.util.Date;
import java.util.Map;

import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import ch.rasc.sec.security.JpaUserDetails;

@Controller
public class HelloController {

	@RequestMapping(value = "/sayHello", method = RequestMethod.GET)
	@ResponseBody
	public String sayHello(@AuthenticationPrincipal JpaUserDetails user) {
		return "Hello " + user.getUsername();
	}

	@RequestMapping("/")
	public String home(Map<String, Object> model,
			@AuthenticationPrincipal JpaUserDetails user) {
		model.put("message", "Hello World");
		model.put("title", "Hello Home");
		model.put("date", new Date());
		model.put("user", user.getUsername());
		return "home";
	}
}

Add home request mapping method


package es.tid.cosmos.mobility.aggregatedmatrix.simple;

import java.io.IOException;

import com.twitter.elephantbird.mapreduce.io.ProtobufWritable;
import org.apache.hadoop.mapreduce.Mapper;

import es.tid.cosmos.mobility.data.TwoIntUtil;
import es.tid.cosmos.mobility.data.generated.MobProtocol.ItinRange;
import es.tid.cosmos.mobility.data.generated.MobProtocol.MobData;
import es.tid.cosmos.mobility.data.generated.MobProtocol.TwoInt;

/**
 * Input: <TwoInt, ItinTime>
 * Output: <TwoInt, ItinTime>
 *
 * @author dmicol
 */
public class MatrixSpreadVectorByPairMapper extends Mapper<
        ProtobufWritable<ItinRange>, ProtobufWritable<MobData>,
        ProtobufWritable<TwoInt>, ProtobufWritable<MobData>> {
    @Override
    protected void map(ProtobufWritable<ItinRange> key,
            ProtobufWritable<MobData> value, Context context)
            throws IOException, InterruptedException {
        key.setConverter(ItinRange.class);
        final ItinRange itrang = key.get();
        ItinRange.Builder outItrang = ItinRange.newBuilder(itrang);
        outItrang.setNode(itrang.getPoiSrc() * itrang.getPoiTgt());
        context.write(TwoIntUtil.createAndWrap(itrang.getPoiSrc(),
                                               itrang.getPoiTgt()), value);
    }
}

package es.tid.cosmos.mobility.aggregatedmatrix.simple;

import java.io.IOException;

import com.twitter.elephantbird.mapreduce.io.ProtobufWritable;
import org.apache.hadoop.mapreduce.Mapper;

import es.tid.cosmos.mobility.data.TwoIntUtil;
import es.tid.cosmos.mobility.data.generated.MobProtocol.ItinRange;
import es.tid.cosmos.mobility.data.generated.MobProtocol.MobData;
import es.tid.cosmos.mobility.data.generated.MobProtocol.TwoInt;

/**
 * Input: <ItinRange, ClusterVector>
 * Output: <TwoInt, ClusterVector>
 *
 * @author dmicol
 */
public class MatrixSpreadVectorByPairMapper extends Mapper<
        ProtobufWritable<ItinRange>, ProtobufWritable<MobData>,
        ProtobufWritable<TwoInt>, ProtobufWritable<MobData>> {
    @Override
    protected void map(ProtobufWritable<ItinRange> key,
            ProtobufWritable<MobData> value, Context context)
            throws IOException, InterruptedException {
        key.setConverter(ItinRange.class);
        final ItinRange itrang = key.get();
        ItinRange.Builder outItrang = ItinRange.newBuilder(itrang);
        outItrang.setNode(itrang.getPoiSrc() * itrang.getPoiTgt());
        context.write(TwoIntUtil.createAndWrap(itrang.getPoiSrc(),
                                               itrang.getPoiTgt()), value);
    }
}

Fix wrong input/output drata types.


package com.arondor.common.reflection.reflect.instantiator;

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

public class FastPrimitiveConverter
{
    private interface PrimitiveConverter
    {
        Object convert(String value);
    }

    private final Map<String, PrimitiveConverter> primitiveConverterMap = new HashMap<String, FastPrimitiveConverter.PrimitiveConverter>();

    public FastPrimitiveConverter()
    {
        primitiveConverterMap.put("java.lang.String", new PrimitiveConverter()
        {
            public Object convert(String value)
            {
                return value;
            }
        });
        primitiveConverterMap.put("long", new PrimitiveConverter()
        {
            public Object convert(String value)
            {
                return Long.parseLong(value);
            }
        });
        primitiveConverterMap.put("int", new PrimitiveConverter()
        {
            public Object convert(String value)
            {
                return Integer.parseInt(value);
            }
        });
    }

    public Object convert(String value, String primitiveClass)
    {
        PrimitiveConverter converter = primitiveConverterMap.get(primitiveClass);
        if (converter == null)
        {
            throw new IllegalArgumentException("Not supported : primitiveClass=" + primitiveClass);
        }
        return converter.convert(value);
    }
}

package com.arondor.common.reflection.reflect.instantiator;

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

public class FastPrimitiveConverter
{
    private interface PrimitiveConverter
    {
        Object convert(String value);
    }

    private final Map<String, PrimitiveConverter> primitiveConverterMap = new HashMap<String, FastPrimitiveConverter.PrimitiveConverter>();

    public FastPrimitiveConverter()
    {
        primitiveConverterMap.put("java.lang.String", new PrimitiveConverter()
        {
            public Object convert(String value)
            {
                return value;
            }
        });
        primitiveConverterMap.put("long", new PrimitiveConverter()
        {
            public Object convert(String value)
            {
                return Long.parseLong(value);
            }
        });
        primitiveConverterMap.put("int", new PrimitiveConverter()
        {
            public Object convert(String value)
            {
                return Integer.parseInt(value);
            }
        });
        primitiveConverterMap.put("boolean", new PrimitiveConverter()
        {
            public Object convert(String value)
            {
                return Boolean.parseBoolean(value);
            }
        });
    }

    public Object convert(String value, String primitiveClass)
    {
        PrimitiveConverter converter = primitiveConverterMap.get(primitiveClass);
        if (converter == null)
        {
            throw new IllegalArgumentException("Not supported : primitiveClass=" + primitiveClass);
        }
        return converter.convert(value);
    }
}

Add support for boolean type