package org.knowm.xchange.examples.gdax;

import java.io.IOException;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.marketdata.Ticker;
import org.knowm.xchange.gdax.GDAXExchange;
import org.knowm.xchange.gdax.dto.marketdata.GDAXProductTicker;
import org.knowm.xchange.gdax.service.GDAXMarketDataServiceRaw;
import org.knowm.xchange.service.marketdata.MarketDataService;

public class GDAXTickerDemo {

  public static void main(String[] args) throws IOException {

    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(GDAXExchange.class.getName());
    MarketDataService marketDataService = exchange.getMarketDataService();

    generic(marketDataService);
    raw((GDAXMarketDataServiceRaw) marketDataService);
  }

  private static void generic(MarketDataService marketDataService) throws IOException {

    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);

    System.out.println(ticker.toString());
  }

  private static void raw(GDAXMarketDataServiceRaw marketDataService) throws IOException {

    GDAXProductTicker bitstampTicker = marketDataService.getCoinbaseExProductTicker(CurrencyPair.BTC_USD);

    System.out.println(bitstampTicker.toString());
  }

}

package org.knowm.xchange.examples.gdax;

import java.io.IOException;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.marketdata.Ticker;
import org.knowm.xchange.gdax.GDAXExchange;
import org.knowm.xchange.gdax.dto.marketdata.GDAXProductTicker;
import org.knowm.xchange.gdax.service.GDAXMarketDataServiceRaw;
import org.knowm.xchange.service.marketdata.MarketDataService;

public class GDAXTickerDemo {

  public static void main(String[] args) throws IOException {

    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(GDAXExchange.class.getName());
    MarketDataService marketDataService = exchange.getMarketDataService();

    generic(marketDataService);
    raw((GDAXMarketDataServiceRaw) marketDataService);
  }

  private static void generic(MarketDataService marketDataService) throws IOException {

    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);

    System.out.println(ticker.toString());
  }

  private static void raw(GDAXMarketDataServiceRaw marketDataService) throws IOException {

    GDAXProductTicker gdaxTicker = marketDataService.getCoinbaseExProductTicker(CurrencyPair.BTC_USD);

    System.out.println(gdaxTicker.toString());
  }

}

Update GDAXProductTicker obj name from bitstampTicker to gdaxTicker


package com.github.arteam.simplejsonrpc.core.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ValueNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Date: 07.06.14
 * Time: 12:24
 *
Representation of a JSON-RPC request

 */
public class Request {

    @Nullable
    private final String jsonrpc;

    @Nullable
    private final String method;

    @NotNull
    private final JsonNode params;

    @Nullable
    private final ValueNode id;

    public Request(@JsonProperty("jsonrpc") @Nullable String jsonrpc,
                   @JsonProperty("method") @Nullable String method,
                   @JsonProperty("params") @NotNull JsonNode params,
                   @JsonProperty("id") @Nullable ValueNode id) {
        this.jsonrpc = jsonrpc;
        this.method = method;
        this.id = id;
        this.params = params;
    }

    @Nullable
    public String getJsonrpc() {
        return jsonrpc;
    }

    @Nullable
    public String getMethod() {
        return method;
    }

    @NotNull
    public ValueNode getId() {
        return id != null ? id : NullNode.getInstance();
    }

    @NotNull
    public JsonNode getParams() {
        return params;
    }

    @Override
    public String toString() {
        return "Request{jsonrpc=" + jsonrpc + ", method=" + method + ", id=" + id + ", params=" + params + "}";
    }
}

package com.github.arteam.simplejsonrpc.core.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ValueNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Date: 07.06.14
 * Time: 12:24
 *
Representation of a JSON-RPC request

 */
public class Request {

    @Nullable
    private final String jsonrpc;

    @Nullable
    private final String method;

    @Nullable
    private final JsonNode params;

    @Nullable
    private final ValueNode id;

    public Request(@JsonProperty("jsonrpc") @Nullable String jsonrpc,
                   @JsonProperty("method") @Nullable String method,
                   @JsonProperty("params") @Nullable JsonNode params,
                   @JsonProperty("id") @Nullable ValueNode id) {
        this.jsonrpc = jsonrpc;
        this.method = method;
        this.id = id;
        this.params = params;
    }

    @Nullable
    public String getJsonrpc() {
        return jsonrpc;
    }

    @Nullable
    public String getMethod() {
        return method;
    }

    @NotNull
    public ValueNode getId() {
        return id != null ? id : NullNode.getInstance();
    }

    @NotNull
    public JsonNode getParams() {
        return params != null ? params : NullNode.getInstance();
    }

    @Override
    public String toString() {
        return "Request{jsonrpc=" + jsonrpc + ", method=" + method + ", id=" + id + ", params=" + params + "}";
    }
}

Check that params can be null


package org.puller;

public class Comic {
    private final String title;
    private final String price;

    public Comic(final String title, final String price) {
        this.title = title;
        this.price = price;
    }

    @Override
    public String toString() {
        return String.format("%s - %s", title, price);
    }
}

package org.puller;

public class Comic implements Comparable<Comic> {
    private static final String DOLLAR_SYMBOL = "\\$";

    private final String title;
    private final String price;

    public Comic(final String title, final String price) {
        this.title = title;
        this.price = price;
    }

    public String getRawPrice() {
        return price.replaceAll(DOLLAR_SYMBOL, "");
    }

    @Override
    public String toString() {
        return String.format("%s - %s", title, price);
    }

    @Override
    public int compareTo(Comic comic) {
        return title.compareTo(comic.title);
    }
}

Add method to obtain raw comic price


package io.vertx.example.core.eventbus.pointtopoint;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.example.util.Runner;

/*
 * @author Tim Fox
 */
public class Sender extends AbstractVerticle {

  // Convenience method so you can run it in your IDE
  public static void main(String[] args) {
    Runner.runClusteredExample(Sender.class);
  }

  @Override
  public void start() throws Exception {
    EventBus eb = vertx.eventBus();

    // Send a message every second

    vertx.setPeriodic(1000, v -> {

      eb.send("ping-address", "ping!", reply -> {
        System.out.println("Received reply " + reply.result().body());
      });

    });
  }
}

package io.vertx.example.core.eventbus.pointtopoint;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.example.util.Runner;

/*
 * @author Tim Fox
 */
public class Sender extends AbstractVerticle {

  // Convenience method so you can run it in your IDE
  public static void main(String[] args) {
    Runner.runClusteredExample(Sender.class);
  }

  @Override
  public void start() throws Exception {
    EventBus eb = vertx.eventBus();

    // Send a message every second

    vertx.setPeriodic(1000, v -> {

      eb.send("ping-address", "ping!", reply -> {
        if (reply.succeeded()) {
          System.out.println("Received reply " + reply.result().body());
        } else {
          System.out.println("No reply");
        }
      });

    });
  }
}

Improve reply handler in pointtopoint examples


package com.io7m.jcanephora;

import javax.media.opengl.GLContext;

import org.junit.After;
import org.junit.Before;

import com.io7m.jaux.Constraints.ConstraintError;
import com.io7m.jcanephora.contracts.FramebuffersContract;
import com.io7m.jlog.Log;

public final class JOGL30RenderbuffersTest extends FramebuffersContract
{
  private GLContext context;

  @Override public GLInterface getGL()
    throws GLException,
      ConstraintError
  {
    return new GLInterfaceJOGL30(this.context, JOGL30TestLog.getLog());
  }

  @Override public Log getLog()
  {
    return JOGL30TestLog.getLog();
  }

  @Before public void setUp()
    throws Exception
  {
    this.context = JOGL30.createOffscreenDisplay(640, 480);
  }

  @After public void tearDown()
    throws Exception
  {
    JOGL30.destroyDisplay(this.context);
  }
}

package com.io7m.jcanephora;

import javax.media.opengl.GLContext;

import org.junit.After;
import org.junit.Before;

import com.io7m.jaux.Constraints.ConstraintError;
import com.io7m.jcanephora.contracts.RenderbuffersContract;
import com.io7m.jlog.Log;

public final class JOGL30RenderbuffersTest extends RenderbuffersContract
{
  private GLContext context;

  @Override public GLInterface getGL()
    throws GLException,
      ConstraintError
  {
    return new GLInterfaceJOGL30(this.context, JOGL30TestLog.getLog());
  }

  @Override public Log getLog()
  {
    return JOGL30TestLog.getLog();
  }

  @Before public void setUp()
    throws Exception
  {
    this.context = JOGL30.createOffscreenDisplay(640, 480);
  }

  @After public void tearDown()
    throws Exception
  {
    JOGL30.destroyDisplay(this.context);
  }
}

Correct extends statement; Renderbuffers, not Framebuffers


package co.phoenixlab.discord.commands.tempstorage;

import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.Future;

public class ServerTimeout {

    private final String serverId;
    private final String userId;
    private final Instant startTime;
    private final Duration duration;
    private final Instant endTime;
    private final String issuedByUserId;
    private final Future<Void> timerFuture;

    public ServerTimeout(Duration duration, Instant startTime, String userId, String serverId, String issuedByUserId,
                         Future<Void> timerFuture) {
        this.duration = duration;
        this.startTime = startTime;
        this.userId = userId;
        this.serverId = serverId;
        this.timerFuture = timerFuture;
        this.endTime = startTime.plus(duration);
        this.issuedByUserId = issuedByUserId;
    }

    public String getServerId() {
        return serverId;
    }

    public String getUserId() {
        return userId;
    }

    public Instant getStartTime() {
        return startTime;
    }

    public Duration getDuration() {
        return duration;
    }

    public Instant getEndTime() {
        return endTime;
    }

    public String getIssuedByUserId() {
        return issuedByUserId;
    }

    public Future<Void> getTimerFuture() {
        return timerFuture;
    }
}

package co.phoenixlab.discord.commands.tempstorage;

import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.Future;

public class ServerTimeout {

    private final String serverId;
    private final String userId;
    private final Instant startTime;
    private final Duration duration;
    private final Instant endTime;
    private final String issuedByUserId;
    private final transient Future<Void> timerFuture;

    public ServerTimeout(Duration duration, Instant startTime, String userId, String serverId, String issuedByUserId,
                         Future<Void> timerFuture) {
        this.duration = duration;
        this.startTime = startTime;
        this.userId = userId;
        this.serverId = serverId;
        this.timerFuture = timerFuture;
        this.endTime = startTime.plus(duration);
        this.issuedByUserId = issuedByUserId;
    }

    public String getServerId() {
        return serverId;
    }

    public String getUserId() {
        return userId;
    }

    public Instant getStartTime() {
        return startTime;
    }

    public Duration getDuration() {
        return duration;
    }

    public Instant getEndTime() {
        return endTime;
    }

    public String getIssuedByUserId() {
        return issuedByUserId;
    }

    public Future<Void> getTimerFuture() {
        return timerFuture;
    }
}

Make the Future transient so not serialized


package com.ferreusveritas.dynamictrees.compat;

import java.util.List;

import com.ferreusveritas.dynamictrees.blocks.BlockRooty;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;

public class WailaRootyHandler implements IWailaDataProvider {

	@Override
	public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
		IBlockState state = accessor.getWorld().getBlockState(accessor.getPosition());
		if(state.getBlock() instanceof BlockRooty) {
			BlockRooty rooty = (BlockRooty) state.getBlock();
			int life = rooty.getSoilLife(state, accessor.getWorld(), accessor.getPosition());
			tooltip.add("Soil Life: " + MathHelper.floor(life / 16.0) + "%");
		}

		return tooltip;
	}
}

package com.ferreusveritas.dynamictrees.compat;

import java.util.List;

import com.ferreusveritas.dynamictrees.blocks.BlockRooty;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;

public class WailaRootyHandler implements IWailaDataProvider {

	@Override
	public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
		IBlockState state = accessor.getWorld().getBlockState(accessor.getPosition());
		if(state.getBlock() instanceof BlockRooty) {
			BlockRooty rooty = (BlockRooty) state.getBlock();
			int life = rooty.getSoilLife(state, accessor.getWorld(), accessor.getPosition());
			tooltip.add("Soil Life: " + MathHelper.floor(life * 6.25f) + "%");
		}

		return tooltip;
	}
}

Fix waila rooty dirt life calculation


package com.alorma.github.sdk.services.pullrequest;

import com.alorma.github.sdk.bean.dto.response.Commit;
import com.alorma.github.sdk.bean.info.IssueInfo;
import com.alorma.github.sdk.services.client.GithubListClient;
import java.util.List;
import retrofit.RestAdapter;

/**
 * Created by Bernat on 17/06/2015.
 */
public class GetPullRequestCommits extends GithubListClient<List<Commit>> {

  private IssueInfo info;
  private int page;

  public GetPullRequestCommits(IssueInfo info) {
    this(info, 0);
  }

  public GetPullRequestCommits(IssueInfo info, int page) {
    super();
    this.info = info;
    this.page = page;
  }

  @Override
  protected ApiSubscriber getApiObservable(RestAdapter restAdapter) {
    return new ApiSubscriber() {
      @Override
      protected void call(RestAdapter restAdapter) {
        PullRequestsService pullRequestsService = restAdapter.create(PullRequestsService.class);
        if (page == 0) {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, this);
        } else {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, nextPage,
              this);
        }
      }
    };
  }
}

package com.alorma.github.sdk.services.pullrequest;

import com.alorma.github.sdk.bean.dto.response.Commit;
import com.alorma.github.sdk.bean.info.IssueInfo;
import com.alorma.github.sdk.services.client.GithubListClient;
import java.util.List;
import retrofit.RestAdapter;

public class GetPullRequestCommits extends GithubListClient<List<Commit>> {

  private IssueInfo info;
  private int page;

  public GetPullRequestCommits(IssueInfo info) {
    this(info, 0);
  }

  public GetPullRequestCommits(IssueInfo info, int page) {
    super();
    this.info = info;
    this.page = page;
  }

  @Override
  protected ApiSubscriber getApiObservable(RestAdapter restAdapter) {
    return new ApiSubscriber() {
      @Override
      protected void call(RestAdapter restAdapter) {
        PullRequestsService pullRequestsService = restAdapter.create(PullRequestsService.class);
        if (page == 0) {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, this);
        } else {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, nextPage,
              this);
        }
      }
    };
  }

  @Override
  public String getAcceptHeader() {
    return "application/vnd.github.cryptographer-preview+sha.json";
  }
}

Update PullRequest commits to verification preview


package codechicken.lib.render;

import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;

public class PlaceholderTexture extends TextureAtlasSprite
{
    protected PlaceholderTexture(String par1)
    {
        super(par1);
    }

    @Override
    public boolean load(IResourceManager manager, ResourceLocation location)
    {
        return false;
    }
}

package codechicken.lib.render;

import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;

public class PlaceholderTexture extends TextureAtlasSprite
{
    protected PlaceholderTexture(String par1) {
        super(par1);
    }

    @Override
    public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) {
        return true;
    }

    @Override
    public boolean load(IResourceManager manager, ResourceLocation location) {
        return true;
    }
}

Fix texture not found exceptions in console when using placeholder texture


package de.abas.examples.inputbox;

import de.abas.erp.api.gui.InputBox;
import de.abas.erp.db.DbContext;
import de.abas.examples.common.AbstractAjoAccess;

public class InputBoxExample extends AbstractAjoAccess {

	DbContext ctx;

	@Override
	public int run(String[] args) {
		ctx = getDbContext();

		InputBox inputBox = new InputBox(ctx, "Normal Text goes here:");
		String input = inputBox.read();
		ctx.out().println("You entered: " + input);

		InputBox viewProtectedInputBox = new InputBox(ctx, "View Protected Text goes here:");
		String viewProtectedInput = viewProtectedInputBox.read(true);
		ctx.out().println("It was view protected, but I can still read it. You entered: " + viewProtectedInput);

		return 0;
	}

}

package de.abas.examples.inputbox;

import de.abas.erp.api.gui.InputBox;
import de.abas.erp.db.DbContext;
import de.abas.examples.common.AbstractAjoAccess;

public class InputBoxExample extends AbstractAjoAccess {

	@Override
	public int run(String[] args) {
		DbContext ctx = getDbContext();

		InputBox inputBox = new InputBox(ctx, "Normal Text goes here:");
		String input = inputBox.read();
		ctx.out().println("You entered: " + input);

		InputBox viewProtectedInputBox = new InputBox(ctx, "View Protected Text goes here:");
		String viewProtectedInput = viewProtectedInputBox.read(true);
		ctx.out().println("It was view protected, but I can still read it. You entered: " + viewProtectedInput);

		return 0;
	}

}

Refactor InputBox example: make DbContext local to method


package com.pm.server.player;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;

import com.pm.server.datatype.Coordinate;
import com.pm.server.datatype.PlayerState;
import com.pm.server.utils.JsonUtils;

@Component
public abstract class PlayerImpl implements Player {

	protected Integer id = 0;
	protected Coordinate location;
	protected PlayerState state = PlayerState.UNINITIALIZED;

	private final static Logger log =
			LogManager.getLogger(PlayerImpl.class.getName());

	public void setId(Integer id) {

		log.trace("Setting id to {}", id);

		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setLocation(Coordinate location) {

		String locationString = JsonUtils.objectToJson(location);
		if(locationString != null) {
			log.trace("Setting location to {}", locationString);
		}

		this.location = location;
	}

	public Coordinate getLocation() {
		return location;
	}

	public void setState(PlayerState state) throws NullPointerException {

		if(state == null) {
			String errorMessage = "setState() was given a null state.";
			log.warn(errorMessage);
			throw new NullPointerException(errorMessage);
		}
		this.state = state;

	}

	public PlayerState getState() {
		return state;
	}

}

package com.pm.server.player;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;

import com.pm.server.datatype.Coordinate;
import com.pm.server.datatype.PlayerState;
import com.pm.server.utils.JsonUtils;

@Component
public abstract class PlayerImpl implements Player {

	protected Integer id = 0;
	protected Coordinate location;
	protected PlayerState state = PlayerState.UNINITIALIZED;

	private final static Logger log =
			LogManager.getLogger(PlayerImpl.class.getName());

	public void setId(Integer id) {

		log.trace("Setting id to {}", id);

		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setLocation(Coordinate location) {

		String locationString = JsonUtils.objectToJson(location);
		if(locationString != null) {
			log.trace("Setting location to {}", locationString);
		}

		this.location = location;
	}

	public Coordinate getLocation() {
		return location;
	}

	public void setState(PlayerState state) throws NullPointerException {

		if(state == null) {
			String errorMessage = "setState() was given a null state.";
			log.warn(errorMessage);
			throw new NullPointerException(errorMessage);
		}

		log.trace("Setting location to {}", state);
		this.state = state;

	}

	public PlayerState getState() {
		return state;
	}

}

Add additional log message to Player setState


package net.rdrei.android.wakimail;

import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;

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

/**
 * Sets up settings that are required for the application to run.
 *
 * @author pascal
 */
@ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=2b0a6e7c", formKey = "")
public class WAKiMailApplication extends Application {
	@Override
	public void onCreate() {
		super.onCreate();

		if (BuildConfig.DEBUG) {
			enableStrictMode();
		} else {
			// Only if DEBUG is disabled.
			ACRA.init(this);
		}
	}

	private void enableStrictMode() {
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
				.detectAll().penaltyLog().build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
				.detectLeakedSqlLiteObjects()
				// Only on 11+ if I'm not mistaken.
				.detectLeakedClosableObjects().penaltyLog().penaltyDeath()
				.build());
	}
}

package net.rdrei.android.wakimail;

import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;

import android.app.Application;
import android.content.pm.ApplicationInfo;
import android.os.StrictMode;

/**
 * Sets up settings that are required for the application to run.
 *
 * @author pascal
 */
@ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=2b0a6e7c", formKey = "")
public class WAKiMailApplication extends Application {
	@Override
	public void onCreate() {
		super.onCreate();

		if (isDebuggable()) {
			enableStrictMode();
		} else {
			// Only if DEBUG is disabled.
			ACRA.init(this);
		}
	}

	private boolean isDebuggable() {
		final int applicationFlags = this.getApplicationInfo().flags;
		return (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
	}

	private void enableStrictMode() {
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
				.detectAll().penaltyLog().build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
				.detectLeakedSqlLiteObjects()
				// Only on 11+ if I'm not mistaken.
				.detectLeakedClosableObjects().penaltyLog().penaltyDeath()
				.build());
	}
}

Use portable way to detect DEBUG mode


package com.tozny.sdk;

import com.google.api.client.http.GenericUrl;
import com.google.api.client.util.Key;

/**
 * A parent class for Realm and User API urls to extend.
 * All Tozny API calls have a required 'method' property.
 */
public class ToznyApiUrl extends GenericUrl {
    public static final String TOZNY_PRODUCTION_API_URL = "https://api.tozny.com";

    public ToznyApiUrl(String toznyApiUrl, String method) {
        super(toznyApiUrl);
        this.method = method;
    }

    @Key
    public String method;
}

package com.tozny.sdk;

import com.google.api.client.http.GenericUrl;
import com.google.api.client.util.Key;

/**
 * A parent class for Realm and User API urls to extend.
 * All Tozny API calls have a required 'method' property.
 */
public class ToznyApiUrl extends GenericUrl {
    public static final String TOZNY_PRODUCTION_API_URL = "https://api.tozny.com/";

    public ToznyApiUrl(String toznyApiUrl, String method) {
        super(toznyApiUrl);
        this.method = method;
    }

    @Key
    public String method;
}

Add trailing slash to Tozny API URL.


package protocolsupport.protocol.utils.spoofedata;

import java.lang.reflect.Type;
import java.util.Collection;
import java.util.function.Function;

import org.bukkit.Bukkit;

import com.destroystokyo.paper.event.player.PlayerHandshakeEvent;
import com.destroystokyo.paper.profile.ProfileProperty;
import com.google.gson.reflect.TypeToken;

import protocolsupport.utils.Utils;

public class PaperSpoofedDataParser implements Function<String, SpoofedData> {

	protected static final Type properties_type = new TypeToken<Collection<ProfileProperty>>() {}.getType();

	@Override
	public SpoofedData apply(String hostname) {
		if (PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) {
			PlayerHandshakeEvent handshakeEvent = new PlayerHandshakeEvent(hostname, false);
			Bukkit.getPluginManager().callEvent(handshakeEvent);
			if (!handshakeEvent.isCancelled()) {
				if (handshakeEvent.isFailed()) {
					return new SpoofedData(handshakeEvent.getFailMessage());
				}
				return new SpoofedData(
					handshakeEvent.getServerHostname(),
					handshakeEvent.getSocketAddressHostname(),
					handshakeEvent.getUniqueId(),
					Utils.GSON.fromJson(handshakeEvent.getPropertiesJson(), properties_type)
				);
			}
		}
		return null;
	}

}

package protocolsupport.protocol.utils.spoofedata;

import java.lang.reflect.Type;
import java.util.Collection;
import java.util.function.Function;

import org.bukkit.Bukkit;

import com.destroystokyo.paper.event.player.PlayerHandshakeEvent;
import com.google.gson.reflect.TypeToken;

import protocolsupport.api.utils.ProfileProperty;
import protocolsupport.utils.Utils;

public class PaperSpoofedDataParser implements Function<String, SpoofedData> {

	protected static final Type properties_type = new TypeToken<Collection<ProfileProperty>>() {}.getType();

	@Override
	public SpoofedData apply(String hostname) {
		if (PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) {
			PlayerHandshakeEvent handshakeEvent = new PlayerHandshakeEvent(hostname, false);
			Bukkit.getPluginManager().callEvent(handshakeEvent);
			if (!handshakeEvent.isCancelled()) {
				if (handshakeEvent.isFailed()) {
					return new SpoofedData(handshakeEvent.getFailMessage());
				}
				return new SpoofedData(
					handshakeEvent.getServerHostname(),
					handshakeEvent.getSocketAddressHostname(),
					handshakeEvent.getUniqueId(),
					Utils.GSON.fromJson(handshakeEvent.getPropertiesJson(), properties_type)
				);
			}
		}
		return null;
	}

}

Fix wrong properties type used


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

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

/**
 * Test for data binding and Ajax which is run in gwt
 */
public class AjaxTestGwt extends AjaxTests {

  @Override
  public String getModuleName() {
    return "com.google.gwt.query.QueryTest";
  }

  public AjaxTestGwt() {
    echoUrl = (GWT.isClient() ? GWT.getHostPageBaseURL() : "http://localhost:3333/") + servletPath;
    echoUrlCORS = echoUrl.replaceFirst("http://[\\d\\.]+:", "http://localhost:") + "?cors=true";
  }
}

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

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

/**
 * Test for data binding and Ajax which is run in gwt
 */
public class AjaxTestGwt extends AjaxTests {

  @Override
  public String getModuleName() {
    return "com.google.gwt.query.QueryTest";
  }

  protected void gwtSetUp() throws Exception {
    echoUrl = GWT.getHostPageBaseURL() + servletPath;
    echoUrlCORS = echoUrl.replaceFirst("http://[\\d\\.]+:", "http://localhost:") + "?cors=true";
  }
}

Use gwtSetup instead of constructor in gwt test


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

package com.google.samples.apps.iosched.server.userdata;

/**
 * API keys.
 */
public class Ids {
    public static final String ANDROID_CLIENT_ID = "237695054204-m87hbqe20bqpib715p3hiddpjjfih2l9"
            + ".apps.googleusercontent.com";
    public static final String IOS_CLIENT_ID = "237695054204-pjm3begvj1k28pg88ncnacdi6gl5nbcf"
            + ".apps.googleusercontent.com";
    public static final String WEB_CLIENT_ID = "596109260910-n1vrfjs8d7105jh5j7qf42ph32sltjp0"
            + ".apps.googleusercontent.com";
    public static final String ANDROID_AUDIENCE = ANDROID_CLIENT_ID;
}

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

package com.google.samples.apps.iosched.server.userdata;

/**
 * API keys.
 */
public class Ids {
    public static final String ANDROID_CLIENT_ID = "237695054204-m87hbqe20bqpib715p3hiddpjjfih2l9"
            + ".apps.googleusercontent.com";
    public static final String IOS_CLIENT_ID = "596109260910-n1vrfjs8d7105jh5j7qf42ph32sltjp0"
            + ".apps.googleusercontent.com";
    public static final String WEB_CLIENT_ID = "755839215930-ctkg839m67rtqmgm55c6eg1j7cvu5mmf"
            + ".apps.googleusercontent.com";
    public static final String ANDROID_AUDIENCE = ANDROID_CLIENT_ID;
}

Fix client IDs for Web/iOS clients.


package com.bungleton.yarrgs.parser;

import java.lang.reflect.Field;

public class FlagParser extends OptionParser
{
    public FlagParser (Field field)
    {
        super(field);
    }

    @Override
    public String getBasic ()
    {
        return shortArg;
    }

    @Override
    public String getDetail ()
    {
        return String.format("  %s ,%-10s %s", shortArg, longArg, getUsage());
    }

}

package com.bungleton.yarrgs.parser;

import java.lang.reflect.Field;

public class FlagParser extends OptionParser
{
    public FlagParser (Field field)
    {
        super(field);
    }

    @Override
    public String getBasic ()
    {
        return shortArg;
    }

    @Override
    public String getDetail ()
    {
        return String.format("  %s, %-10s %s", shortArg, longArg, getUsage());
    }

}

Correct comma spacing for flag detail


/**
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
 *
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
 * graphic logo is a trademark of OpenMRS Inc.
 */
package org.openmrs.web.controller;

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

/**
 * Controller to display the uncaughtException page and ensure that it always displays
 * via the spring dispatcherServlet.
 */
@Controller
public class UncaughtExceptionController {

	private static final long serialVersionUID = 1L;

	@RequestMapping(value = "/uncaughtException", method = RequestMethod.POST)
	public void displayUncaughtException() {

	}
}

/**
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
 *
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
 * graphic logo is a trademark of OpenMRS Inc.
 */
package org.openmrs.web.controller;

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

/**
 * Controller to display the uncaughtException page and ensure that it always displays
 * via the spring dispatcherServlet.
 */
@Controller
public class UncaughtExceptionController {

	private static final long serialVersionUID = 1L;

	@RequestMapping(value = "/uncaughtException", method = {RequestMethod.POST,RequestMethod.GET})
	public void displayUncaughtException() {

	}
}

Change Logging Advice so that it doesn't log all exceptions


package io.openvidu.server.utils;

import io.openvidu.java.client.Recording.OutputMode;
import io.openvidu.java.client.RecordingProperties;
import io.openvidu.server.core.Session;

public final class RecordingUtils {

	public final static boolean IS_COMPOSED(OutputMode outputMode) {
		return (OutputMode.COMPOSED.equals(outputMode) || OutputMode.COMPOSED_QUICK_START.equals(outputMode));
	}

	public final static RecordingProperties RECORDING_PROPERTIES_WITH_MEDIA_NODE(Session session) {
		RecordingProperties recordingProperties = session.getSessionProperties().defaultRecordingProperties();
		if (recordingProperties.mediaNode() == null) {
			recordingProperties = new RecordingProperties.Builder(recordingProperties)
					.mediaNode(session.getMediaNodeId()).build();
		}
		return recordingProperties;
	}

}

package io.openvidu.server.utils;

import io.openvidu.java.client.Recording.OutputMode;
import io.openvidu.java.client.RecordingProperties;
import io.openvidu.server.core.Session;

public final class RecordingUtils {

	public final static boolean IS_COMPOSED(OutputMode outputMode) {
		return (OutputMode.COMPOSED.equals(outputMode) || OutputMode.COMPOSED_QUICK_START.equals(outputMode));
	}

	public final static RecordingProperties RECORDING_PROPERTIES_WITH_MEDIA_NODE(Session session) {
		RecordingProperties recordingProperties = session.getSessionProperties().defaultRecordingProperties();
		if (recordingProperties.mediaNode() == null || recordingProperties.mediaNode().isEmpty()) {
			recordingProperties = new RecordingProperties.Builder(recordingProperties)
					.mediaNode(session.getMediaNodeId()).build();
		}
		return recordingProperties;
	}

}

Check if mediaNode property is empty


package com.bendb.dropwizard.redis;

import com.bendb.dropwizard.redis.jersey.JedisPoolBinder;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import redis.clients.jedis.JedisPool;

public abstract class JedisBundle<C extends Configuration>
        implements ConfiguredBundle<C>, JedisConfiguration<C> {
    private JedisPool pool;

    public JedisPool getPool() {
        return pool;
    }

    @Override
    public void initialize(Bootstrap<?> bootstrap) {
    }

    @Override
    public void run(C configuration, Environment environment) throws Exception {
        pool = getJedisFactory(configuration).build(environment);

        environment.healthChecks().register("redis", new JedisHealthCheck(pool));
        environment.jersey().register(new JedisPoolBinder(pool));
    }
}

package com.bendb.dropwizard.redis;

import com.bendb.dropwizard.redis.jersey.JedisPoolBinder;
import com.codahale.metrics.Gauge;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import redis.clients.jedis.JedisPool;

public abstract class JedisBundle<C extends Configuration>
        implements ConfiguredBundle<C>, JedisConfiguration<C> {
    private JedisPool pool;

    public JedisPool getPool() {
        return pool;
    }

    @Override
    public void initialize(Bootstrap<?> bootstrap) {
    }

    @Override
    public void run(C configuration, Environment environment) throws Exception {
        pool = getJedisFactory(configuration).build(environment);

        environment.metrics().register("redis.connection.idle", (Gauge) () -> pool.getNumIdle());
        environment.metrics().register("redis.connection.active", (Gauge) () -> pool.getNumActive());
        environment.metrics().register("redis.connection.wait", (Gauge) () -> pool.getNumWaiters());

        environment.healthChecks().register("redis", new JedisHealthCheck(pool));
        environment.jersey().register(new JedisPoolBinder(pool));
    }
}

Add metrics to monitor Redis connections


package org.synyx.urlaubsverwaltung.core.startup;

import org.apache.log4j.Logger;

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

import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * This service is executed every time the application is started.
 *
 * @author  Aljona Murygina - murygina@synyx.de
 */
@Service
public class StartupService {

    private static final Logger LOG = Logger.getLogger(StartupService.class);

    @Value("${db.username}")
    private String dbUser;

    @Value("${db.url}")
    private String dbUrl;

    @Value("${email.boss}")
    private String emailBoss;

    @Value("${email.office}")
    private String emailOffice;

    @Value("${email.all}")
    private String emailAll;

    @Value("${email.manager}")
    private String emailManager;

    @PostConstruct
    public void logStartupInfo() {

        LOG.info("Using database " + dbUrl + " with user " + dbUser);

        LOG.info("Using following email addresses for notification:");
        LOG.info("Email boss: " + emailBoss);
        LOG.info("Email office: " + emailOffice);
        LOG.info("Email all: " + emailAll);
        LOG.info("Email manager: " + emailManager);
    }
}

package org.synyx.urlaubsverwaltung.core.startup;

import org.apache.log4j.Logger;

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

import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * This service is executed every time the application is started.
 *
 * @author  Aljona Murygina - murygina@synyx.de
 */
@Service
public class StartupService {

    private static final Logger LOG = Logger.getLogger(StartupService.class);

    @Value("${db.username}")
    private String dbUser;

    @Value("${db.url}")
    private String dbUrl;

    @Value("${email.manager}")
    private String emailManager;

    @PostConstruct
    public void logStartupInfo() {

        LOG.info("Using database " + dbUrl + " with user " + dbUser);
        LOG.info("Using following email address for technical notification: " + emailManager);
    }
}

Adjust start up service: remove obsolete mail addresses


package to.etc.domui.server;

import org.eclipse.jdt.annotation.NonNull;

import javax.servlet.FilterConfig;
import java.io.File;
import java.net.URL;

public class FilterConfigParameters implements ConfigParameters {
	@NonNull
	private FilterConfig m_fc;

	@NonNull
	private File m_webFileRoot;

	public FilterConfigParameters(@NonNull FilterConfig fc, @NonNull File webFileRoot) {
		m_fc = fc;
		m_webFileRoot = webFileRoot;
	}

	@Override
	public String getString(@NonNull String name) {
		return m_fc.getInitParameter(name);
	}

	@NonNull
	@Override
	public File getWebFileRoot() {
		return m_webFileRoot;
	}

	@NonNull
	@Override
	public URL getResourcePath(@NonNull String path) throws Exception {
		URL url = m_fc.getServletContext().getResource(path);
		return url;
	}
}

package to.etc.domui.server;

import org.eclipse.jdt.annotation.NonNull;

import javax.servlet.FilterConfig;
import java.io.File;
import java.net.URL;

public class FilterConfigParameters implements ConfigParameters {
	@NonNull
	private FilterConfig m_fc;

	@NonNull
	private File m_webFileRoot;

	public FilterConfigParameters(@NonNull FilterConfig fc, @NonNull File webFileRoot) {
		m_fc = fc;
		m_webFileRoot = webFileRoot;
	}

	@Override
	public String getString(@NonNull String name) {
		return m_fc.getInitParameter(name);
	}

	@NonNull
	@Override
	public File getWebFileRoot() {
		return m_webFileRoot;
	}

	@NonNull
	@Override
	public URL getResourcePath(@NonNull String path) throws Exception {
		if(path.startsWith("/"))
			return m_fc.getServletContext().getResource(path);
		return m_fc.getServletContext().getResource("/" + path);		// Always nice to have a relative path start with /. Morons.
	}
}

Make sure the relative path passed to getResource() starts with a /, sigh. Very bad design.


package org.openlmis.report.mapper.lookup;

import org.apache.ibatis.annotations.Select;
import org.openlmis.report.model.dto.Regimen;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: hassan
 * Date: 11/21/13
 * Time: 12:03 PM
 * To change this template use File | Settings | File Templates.
 */

@Repository
public interface RegimenReportMapper{

     @Select("SELECT * FROM regimens R INNER JOIN regimen_categories RC ON R.categoryId = RC.id\n" +
             "         ORDER BY RC.displayOrder,R.displayOrder")

    List<Regimen> getByProgram();

    @Select("SELECT * FROM regimen ORDER BY displayOrder, name")
    List<Regimen> getAll();

   @Select("SELECT * FROM regimens R INNER JOIN regimen_categories RC ON R.categoryId = RC.id\n" +
           "  where categoryid = #{categoryid} ORDER BY RC.displayOrder,R.displayOrder")
    List<Regimen>getRegimenByCategory(Long id);

}

package org.openlmis.report.mapper.lookup;

import org.apache.ibatis.annotations.Select;
import org.openlmis.report.model.dto.Regimen;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: hassan
 * Date: 11/21/13
 * Time: 12:03 PM
 * To change this template use File | Settings | File Templates.
 */

@Repository
public interface RegimenReportMapper{

     @Select("SELECT * FROM regimens R INNER JOIN regimen_categories RC ON R.categoryId = RC.id\n" +
             "         ORDER BY RC.displayOrder,R.displayOrder")

    List<Regimen> getByProgram();

    @Select("SELECT * FROM regimens ORDER BY displayOrder, name")
    List<Regimen> getAll();

   @Select("SELECT * FROM regimens R INNER JOIN regimen_categories RC ON R.categoryId = RC.id\n" +
           "  where categoryid = #{categoryid} ORDER BY RC.displayOrder,R.displayOrder")
    List<Regimen>getRegimenByCategory(Long id);

}

Fix Regimen Summary Report Mapper Regimen Query


/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package com.skelril.skree.content.registry.item.currency;

import com.skelril.nitro.registry.item.CraftableItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class CondensedCofferItem extends CofferItem implements CraftableItem {

    private CofferItem parent;

    public CondensedCofferItem(String ID, CofferItem parent) {
        super(ID, parent.getCofferValue() * 9);
        this.parent = parent;
    }

    public CofferItem getParent() {
        return parent;
    }

    @Override
    public void registerRecipes() {
        GameRegistry.addRecipe(
                new ItemStack(this),
                "AAA",
                "AAA",
                "AAA",
                'A', new ItemStack(parent)
        );
    }
}

/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package com.skelril.skree.content.registry.item.currency;

import com.skelril.nitro.registry.item.CraftableItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class CondensedCofferItem extends CofferItem implements CraftableItem {

    private CofferItem parent;

    public CondensedCofferItem(String ID, CofferItem parent) {
        super(ID, parent.getCofferValue() * 9);
        this.parent = parent;
    }

    public CofferItem getParent() {
        return parent;
    }

    @Override
    public void registerRecipes() {
        GameRegistry.addRecipe(
                new ItemStack(this),
                "AAA",
                "AAA",
                "AAA",
                'A', new ItemStack(parent)
        );
        GameRegistry.addShapelessRecipe(
                new ItemStack(parent, 9),
                new ItemStack(this)
        );
    }
}

Add a recipe for making the parent item from the created currency item


package com.timgroup.eventsubscription;

import com.timgroup.eventstore.api.Position;
import com.timgroup.eventstore.api.ResolvedEvent;
import org.joda.time.DateTime;

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

final class BroadcastingEventHandler implements EventHandler {
    private final List<EventHandler> handlers;

    BroadcastingEventHandler(List<? extends EventHandler> handlers) {
        this.handlers = new ArrayList<>(handlers);
    }

    @Override
    public void apply(ResolvedEvent resolvedEvent, Event deserializedEvent, boolean endOfBatch) {
        for (EventHandler handler : handlers) {
            handler.apply(resolvedEvent, deserializedEvent, endOfBatch);
        }
    }

    @Override
    public void apply(Position position, DateTime timestamp, Event deserialized, boolean endOfBatch) {
        for (EventHandler handler : handlers) {
            handler.apply(position, timestamp, deserialized, endOfBatch);
        }
    }

    @Override
    public void apply(Event deserialized) {
        for (EventHandler handler : handlers) {
            handler.apply(deserialized);
        }
    }
}

package com.timgroup.eventsubscription;

import com.timgroup.eventstore.api.Position;
import com.timgroup.eventstore.api.ResolvedEvent;
import org.joda.time.DateTime;

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

final class BroadcastingEventHandler implements EventHandler {
    private final List<EventHandler> handlers;

    BroadcastingEventHandler(List<? extends EventHandler> handlers) {
        this.handlers = new ArrayList<>(handlers);
    }

    @Override
    public void apply(ResolvedEvent resolvedEvent, Event deserializedEvent, boolean endOfBatch) {
        for (EventHandler handler : handlers) {
            handler.apply(resolvedEvent, deserializedEvent, endOfBatch);
        }
    }

    @Override
    public void apply(Position position, Event deserialized) {
        for (EventHandler handler : handlers) {
            handler.apply(position, deserialized);
        }
    }

    @Override
    public void apply(Position position, DateTime timestamp, Event deserialized, boolean endOfBatch) {
        for (EventHandler handler : handlers) {
            handler.apply(position, timestamp, deserialized, endOfBatch);
        }
    }

    @Override
    public void apply(Event deserialized) {
        for (EventHandler handler : handlers) {
            handler.apply(deserialized);
        }
    }
}

Add new method to broadcast for consistency


package org.ethereum.validator;

import org.slf4j.Logger;

import java.util.LinkedList;
import java.util.List;

/**
 * Holds errors list to share between all rules
 *
 * @author Mikhail Kalinin
 * @since 02.09.2015
 */
public abstract class AbstractValidationRule implements ValidationRule {

    protected List<String> errors = new LinkedList<>();

    @Override
    public List<String> getErrors() {
        return errors;
    }

    public void logErrors(Logger logger) {
        if (logger.isErrorEnabled())
            for (String msg : errors) {
                logger.error("{} invalid: {}", getEntityClass().getSimpleName(), msg);
            }
    }

    abstract public Class getEntityClass();
}

package org.ethereum.validator;

import org.slf4j.Logger;

import java.util.LinkedList;
import java.util.List;

/**
 * Holds errors list to share between all rules
 *
 * @author Mikhail Kalinin
 * @since 02.09.2015
 */
public abstract class AbstractValidationRule implements ValidationRule {

    protected List<String> errors = new LinkedList<>();

    @Override
    public List<String> getErrors() {
        return errors;
    }

    public void logErrors(Logger logger) {
        if (logger.isErrorEnabled())
            for (String msg : errors) {
                logger.warn("{} invalid: {}", getEntityClass().getSimpleName(), msg);
            }
    }

    abstract public Class getEntityClass();
}

Reduce logger from ERROR to WARN for Validators - we can receive invalid blocks and this doesn't mean program malfunction


/*
 *  Copyright (C) 2008 Pingtel Corp., certain elements licensed under a Contributor Agreement.
 *  Contributors retain copyright to elements licensed under a Contributor Agreement.
 *  Licensed to the User under the LGPL license.
 *
 */

package org.sipfoundry.sipxbridge;

import gov.nist.javax.sip.ListeningPointExt;

import java.net.InetAddress;
import java.util.TimerTask;

import javax.sip.SipProvider;

import org.apache.log4j.Logger;

/**
 * Sends out a CRLF to keep the NAT pinhole open.
 *
 * @author mranga
 *
 */
class CrLfTimerTask extends TimerTask {
    private static Logger logger = Logger.getLogger(CrLfTimerTask.class);
    private ItspAccountInfo accountInfo;
    private SipProvider provider;

    CrLfTimerTask(SipProvider provider, ItspAccountInfo accountInfo) {
        this.provider = provider;
        this.accountInfo  = accountInfo;
    }

    @Override
    public void run() {
        try {
            ListeningPointExt listeningPoint = (ListeningPointExt) provider.getListeningPoint("udp");
            listeningPoint.sendHeartbeat
                (InetAddress.getByName(accountInfo.getInboundProxy()).getHostAddress(),
                    Gateway.getSipKeepaliveSeconds());
        } catch (Exception ex) {
            logger.error("Unexpected parse exception",ex);
        }

    }

}

/*
 *  Copyright (C) 2008 Pingtel Corp., certain elements licensed under a Contributor Agreement.
 *  Contributors retain copyright to elements licensed under a Contributor Agreement.
 *  Licensed to the User under the LGPL license.
 *
 */

package org.sipfoundry.sipxbridge;

import gov.nist.javax.sip.ListeningPointExt;

import java.net.InetAddress;
import java.util.TimerTask;

import javax.sip.SipProvider;

import org.apache.log4j.Logger;

/**
 * Sends out a CRLF to keep the NAT pinhole open.
 *
 * @author mranga
 *
 */
class CrLfTimerTask extends TimerTask {
    private static Logger logger = Logger.getLogger(CrLfTimerTask.class);
    private ItspAccountInfo accountInfo;
    private SipProvider provider;

    CrLfTimerTask(SipProvider provider, ItspAccountInfo accountInfo) {
        this.provider = provider;
        this.accountInfo  = accountInfo;
    }

    @Override
    public void run() {
        try {
            ListeningPointExt listeningPoint = (ListeningPointExt) provider.getListeningPoint("udp");
            listeningPoint.sendHeartbeat
                (InetAddress.getByName(accountInfo.getInboundProxy()).getHostAddress(),
                    accountInfo.getInboundProxyPort());
        } catch (Exception ex) {
            logger.error("Unexpected parse exception",ex);
        }

    }

}

Fix port for Sip Heartbeat.


package org.apache.poi.benchmark.util;

import com.google.common.collect.EvictingQueue;
import org.apache.commons.lang3.StringUtils;
import org.dstadler.commons.exec.BufferingLogOutputStream;

import java.util.Collection;
import java.util.Queue;

/**
 * An extension to {@link BufferingLogOutputStream} which additionally
 * keeps the last few lines of output in a buffer so they can be retrieved
 * even when all the lines were sent to the logging system already and thus
 * cannot be retrieved any more.
 */
public class TailLogOutputStream extends BufferingLogOutputStream {
    private final Queue<String> lastLines;

    public TailLogOutputStream(int capacity) {
        //noinspection UnstableApiUsage
        lastLines = EvictingQueue.create(capacity);
    }

    @Override
    protected void processLine(String line, int level) {
        synchronized (lastLines) {
            // silently ignore null and empty lines here as the queue does not accept this value
            if (StringUtils.isNotEmpty(line)) {
                lastLines.add(line);
            }
        }

        super.processLine(line, level);
    }

    /**
     * Return the last lines that were sent to the logging system
     *
     * @return A collection of log-lines up to the limit
     *      that is specified in the constructor.
     */
    public Collection<String> getLines() {
        return lastLines;
    }
}

package org.apache.poi.benchmark.util;

import com.google.common.collect.EvictingQueue;
import org.apache.commons.lang3.StringUtils;
import org.dstadler.commons.exec.BufferingLogOutputStream;

import java.util.Collection;
import java.util.Queue;

/**
 * An extension to {@link BufferingLogOutputStream} which additionally
 * keeps the last few lines of output in a buffer so they can be retrieved
 * even when all the lines were sent to the logging system already and thus
 * cannot be retrieved any more.
 */
public class TailLogOutputStream extends BufferingLogOutputStream {
    private final Queue<String> lastLines;

    public TailLogOutputStream(int capacity) {
        //noinspection UnstableApiUsage
        lastLines = EvictingQueue.create(capacity);
    }

    @Override
    protected void processLine(String line, int level) {
        synchronized (lastLines) {
            // silently ignore null and empty lines here as the queue does not accept this value
            if (StringUtils.isNotEmpty(line)) {
                lastLines.add("Log: " + line);
            }
        }

        super.processLine(line, level);
    }

    /**
     * Return the last lines that were sent to the logging system
     *
     * @return A collection of log-lines up to the limit
     *      that is specified in the constructor.
     */
    public Collection<String> getLines() {
        return lastLines;
    }
}

Add marker for log-lines that are printed to stdout


package com.mygdx.game;

/**
 * Created by esso on 18.03.15.
 */
public class Constants {
    public static final int REGULAR_REQUEST_TIME = 10000;
}

package com.mygdx.game;

/**
 * Created by esso on 18.03.15.
 */
public class Constants {
    public static final int REGULAR_REQUEST_TIME = 5000;
}

Change request time to 5000 ms


package ca.corefacility.bioinformatics.irida.model;

import java.util.Date;
import java.util.UUID;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * A password reset object.
 *
 * @author Josh Adam <josh.adam@phac-aspc.gc.ca>
 */
@Entity
@Table(name = "password_reset")
public class PasswordReset implements Comparable<PasswordReset> {

	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdDate;

	@OneToOne
	@NotNull
	private User user;

	@Id
	@NotNull
	private String id;

	protected PasswordReset() {}

	public PasswordReset(User user) {
		this.createdDate = new Date();
		this.user = user;
		this.id = UUID.randomUUID().toString();
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public User getUser() {
		return user;
	}

	public String getId() {
		return this.id;
	}

	@Override
	public int compareTo(PasswordReset passwordReset) {
		return createdDate.compareTo(passwordReset.createdDate);
	}
}

package ca.corefacility.bioinformatics.irida.model;

import java.util.Date;
import java.util.Objects;
import java.util.UUID;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * A password reset object.
 *
 * @author Josh Adam <josh.adam@phac-aspc.gc.ca>
 */
@Entity
@Table(name = "password_reset")
public class PasswordReset implements Comparable<PasswordReset> {

	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdDate;

	@OneToOne
	@NotNull
	private User user;

	@Id
	@NotNull
	private String id;

	protected PasswordReset() {
	}

	public PasswordReset(User user) {
		this.createdDate = new Date();
		this.user = user;
		this.id = UUID.randomUUID().toString();
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public User getUser() {
		return user;
	}

	public String getId() {
		return this.id;
	}

	@Override
	public int compareTo(PasswordReset passwordReset) {
		return createdDate.compareTo(passwordReset.createdDate);
	}

	@Override
	public int hashCode() {
		return Objects.hash(createdDate, user, id);
	}

	@Override
	public boolean equals(Object other) {
		if (other instanceof Project) {
			PasswordReset p = (PasswordReset) other;
			return Objects.equals(createdDate, p.createdDate) && Objects.equals(user, p.user)
					&&					Objects.equals(id, p.id);
		}

		return false;
	}
}

Add hashCode and equals methods.


package info.u_team.u_team_core.util.registry;

import java.util.*;
import java.util.function.Supplier;

import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.*;

public class CommonDeferredRegister<R extends IForgeRegistryEntry<R>> implements Iterable<RegistryObject<R>> {

	public static <C extends IForgeRegistryEntry<C>> CommonDeferredRegister<C> create(IForgeRegistry<C> registry, String modid) {
		return new CommonDeferredRegister<C>(registry, modid);
	}

	private final String modid;

	private final DeferredRegister<R> register;

	public CommonDeferredRegister(IForgeRegistry<R> registry, String modid) {
		this.modid = modid;
		register = DeferredRegister.create(registry, modid);
	}

	public <E extends R> RegistryObject<E> register(String name, Supplier<? extends E> supplier) {
		return register.register(name, supplier);
	}

	public void register(IEventBus bus) {
		register.register(bus);
	}

	public Collection<RegistryObject<R>> getEntries() {
		return register.getEntries();
	}

	@Override
	public Iterator<RegistryObject<R>> iterator() {
		return register.getEntries().iterator();
	}

}

package info.u_team.u_team_core.util.registry;

import java.util.*;
import java.util.function.*;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.*;

public class CommonDeferredRegister<R extends IForgeRegistryEntry<R>> implements Iterable<RegistryObject<R>> {

	public static <C extends IForgeRegistryEntry<C>> CommonDeferredRegister<C> create(IForgeRegistry<C> registry, String modid) {
		return new CommonDeferredRegister<C>(registry, modid);
	}

	private final String modid;

	private final DeferredRegister<R> register;

	public CommonDeferredRegister(IForgeRegistry<R> registry, String modid) {
		this.modid = modid;
		register = DeferredRegister.create(registry, modid);
	}

	public <E extends R> RegistryObject<E> register(String name, Function<ResourceLocation, ? extends E> function) {
		return register(name, () -> function.apply(new ResourceLocation(modid, name)));
	}

	public <E extends R> RegistryObject<E> register(String name, Supplier<? extends E> supplier) {
		return register.register(name, supplier);
	}

	public void register(IEventBus bus) {
		register.register(bus);
	}

	public Collection<RegistryObject<R>> getEntries() {
		return register.getEntries();
	}

	@Override
	public Iterator<RegistryObject<R>> iterator() {
		return register.getEntries().iterator();
	}

}

Add function method that gives the resource location of the registry name. Can be used for sound events etc


/**
 * @file TreeStory.java
 * @author Valery Samovich
 * @version 1
 * @date 2015/05/11
 */

package com.samovich.basics.concepts.strings.treehouse;

import java.io.Console;
import java.util.Scanner;

public class TreeStory {

    public static void main(String[] args) {
        // Console console = System.console();
        // String name = console.readLine("Enter your name: ");
        // String adjective = console.readLine("Enter an adjective: ");
        // console.printf("%s is very %s", name, adjective);
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter your name: ");
        String name = scanner.nextLine();
        System.out.println("Enter an adjective: ");
        String adjective = scanner.nextLine();
        System.out.println(name + " is very " + adjective + "!");
    }
}

Add Multiple Strings Example for Console and Scanner prototype


package com.fewlaps.quitnowsleepingtime;

import org.junit.Test;

import java.util.Locale;

import static org.junit.Assert.assertEquals;

public class DefaultValuesTest {

    @Test
    public void shouldUseLocalLocaleByDefault() {
        SleepingTime defaultLocaleST = new SleepingTime();
        SleepingTime localLocaleST = new SleepingTime(Locale.getDefault().getCountry());

        assertEquals(localLocaleST.getBedtime(), defaultLocaleST.getBedtime());
        assertEquals(localLocaleST.getWakeUp(), defaultLocaleST.getWakeUp());
    }
}

package com.fewlaps.quitnowsleepingtime;

import org.junit.Test;

import java.util.Locale;

import static com.fewlaps.quitnowsleepingtime.SleepingZone.DEFAULT_COUNTRY_CODE;
import static org.junit.Assert.assertEquals;

public class DefaultValuesTest {

    @Test
    public void shouldUseLocalLocaleByDefault() {
        SleepingTime defaultLocaleST = new SleepingTime();
        SleepingTime localLocaleST = new SleepingTime(Locale.getDefault().getCountry());

        assertEquals(localLocaleST.getBedtime(), defaultLocaleST.getBedtime());
        assertEquals(localLocaleST.getWakeUp(), defaultLocaleST.getWakeUp());
    }

    @Test
    public void shouldUseDefaultCountryCodeIfNotExistingLocale() {
        SleepingTime defaultCountryCodeSleepingTime = new SleepingTime(DEFAULT_COUNTRY_CODE);
        SleepingTime wrongLocaleSleepingTime = new SleepingTime("XX");

        assertEquals(wrongLocaleSleepingTime.getBedtime(), defaultCountryCodeSleepingTime.getBedtime());
        assertEquals(wrongLocaleSleepingTime.getWakeUp(), defaultCountryCodeSleepingTime.getWakeUp());
    }
}

Add tests for not existing contry codes


package com.izforge.izpack.compiler.packager.impl;

import static org.junit.Assert.fail;

import java.io.IOException;

import org.junit.Test;

import com.izforge.izpack.api.adaptator.IXMLElement;
import com.izforge.izpack.compiler.resource.ResourceFinder;

public class PackagerTest {

	@Test
	public void testWritePacks() throws IOException {
		final ResourceFinder resourceFinder = new ResourceFinder(null, null,
				null, null) {
			@Override
			public IXMLElement getXMLTree() throws IOException {
				return super.getXMLTree();
			}
		};
		final Packager packager = new Packager(null, null, null, null, null,
				null, null, null, null, null, null, resourceFinder);
		packager.writeManifest();
		fail("Not yet implemented");
	}

}

package com.izforge.izpack.compiler.packager.impl;

import static org.junit.Assert.fail;

import java.io.IOException;

import org.dom4j.dom.DOMElement;
import org.junit.Test;

import com.izforge.izpack.api.adaptator.IXMLElement;
import com.izforge.izpack.api.adaptator.impl.XMLElementImpl;
import com.izforge.izpack.compiler.resource.ResourceFinder;

public class PackagerTest {

	@Test
	public void testWritePacks() throws IOException {
		final ResourceFinder resourceFinder = new ResourceFinder(null, null,
				null, null) {
			@Override
			public IXMLElement getXMLTree() throws IOException {
				final DOMElement rootNode = new DOMElement("installation");
				final DOMElement guiPrefsNode = new DOMElement("guiprefs");
				rootNode.add(guiPrefsNode);
				return new XMLElementImpl(rootNode);
			}
		};
		final Packager packager = new Packager(null, null, null, null, null,
				null, null, null, null, null, null, resourceFinder);
		packager.writeManifest();
		fail("Not yet implemented");
	}

}

Add installation/guiprefs XML node w/o splash child


package cecs564_p1;

public class Utils {

}

package cecs564_p1;

public class Utils
{
	private static final int X0 = 0;
	private static final int Y0 = 0;
}

Add constants for boundary values of cipher.


/**
 * This package contains annotations used by the annotation processor to generate model elements.
 */
package arez.annotations;

/**
 * This package contains annotations used by the annotation processor to generate model elements.
 */
@OmitPattern
package arez.annotations;

import grim.annotations.OmitPattern;

Make sure package is never output to Javascript


package nodomain.freeyourgadget.gadgetbridge.model;

/**
 * For every supported device, a device type constant must exist.
 *
 * Note: they key of every constant is stored in the DB, so it is fixed forever,
 * and may not be changed.
 */
public enum DeviceType {
    UNKNOWN(-1),
    PEBBLE(1),
    MIBAND(10),
    MIBAND2(11),
    VIBRATISSIMO(20),
    LIVEVIEW(30),
    HPLUS(40),
    MAKIBESF68(50),
    TEST(1000);

    private final int key;

    DeviceType(int key) {
        this.key = key;
    }

    public int getKey() {
        return key;
    }

    public boolean isSupported() {
        return this != UNKNOWN;
    }

    public static DeviceType fromKey(int key) {
        for (DeviceType type : values()) {
            if (type.key == key) {
                return type;
            }
        }
        return DeviceType.UNKNOWN;
    }
}

package nodomain.freeyourgadget.gadgetbridge.model;

/**
 * For every supported device, a device type constant must exist.
 *
 * Note: they key of every constant is stored in the DB, so it is fixed forever,
 * and may not be changed.
 */
public enum DeviceType {
    UNKNOWN(-1),
    PEBBLE(1),
    MIBAND(10),
    MIBAND2(11),
    VIBRATISSIMO(20),
    LIVEVIEW(30),
    HPLUS(40),
    MAKIBESF68(41),
    TEST(1000);

    private final int key;

    DeviceType(int key) {
        this.key = key;
    }

    public int getKey() {
        return key;
    }

    public boolean isSupported() {
        return this != UNKNOWN;
    }

    public static DeviceType fromKey(int key) {
        for (DeviceType type : values()) {
            if (type.key == key) {
                return type;
            }
        }
        return DeviceType.UNKNOWN;
    }
}

Change Makibes F68 device type


/*
 *
 *  Copyright 2012-2014 Eurocommercial Properties NV
 *
 *
 *  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.estatio.dom.asset;

import org.estatio.dom.TitledEnum;
import org.estatio.dom.utils.StringUtils;

public enum UnitType implements TitledEnum {

    BOUTIQUE,
    STORAGE,
    MEDIUM,
    HYPERMARKET,
    EXTERNAL,
    DEHOR,
    CINEMA,
    SERVICES,
    VIRTUAL;

    public String title() {
        return StringUtils.enumTitle(name());
    }

}

/*
 *
 *  Copyright 2012-2014 Eurocommercial Properties NV
 *
 *
 *  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.estatio.dom.asset;

import org.estatio.dom.TitledEnum;
import org.estatio.dom.utils.StringUtils;

public enum UnitType implements TitledEnum {

    BOUTIQUE,
    CINEMA,
    DEHOR,
    EXTERNAL,
    HYPERMARKET,
    MEDIUM,
    OFFICE,
    SERVICES,
    STORAGE,
    TECHNICAL_ROOM,
    VIRTUAL;

    public String title() {
        return StringUtils.enumTitle(name());
    }

}

Add Office and Technical Room to unit type


package uk.gov.register.providers;

import org.glassfish.jersey.server.ParamException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.gov.register.views.ViewFactory;
import uk.gov.register.views.representations.ExtraMediaType;

import javax.inject.Inject;
import javax.ws.rs.ClientErrorException;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Provider
public class ThrowableExceptionMapper implements ExceptionMapper<Throwable> {

    public static final Logger LOGGER = LoggerFactory.getLogger(ThrowableExceptionMapper.class);

    private ViewFactory viewFactory;

    @Inject
    public ThrowableExceptionMapper(ViewFactory viewFactory) {
        this.viewFactory = viewFactory;
    }

    @Override
    public Response toResponse(Throwable exception) {
        if (exception instanceof ClientErrorException) {
            throw (ClientErrorException) exception;
        }

        if (exception instanceof ParamException.PathParamException) {
            return Response.status(Response.Status.NOT_FOUND)
                    .header(HttpHeaders.CONTENT_TYPE, ExtraMediaType.TEXT_HTML)
                    .entity(viewFactory.exceptionNotFoundView())
                    .build();        }

        LOGGER.error("Uncaught exception: {}", exception);

        return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                .header(HttpHeaders.CONTENT_TYPE, ExtraMediaType.TEXT_HTML)
                .entity(viewFactory.exceptionServerErrorView())
                .build();
    }
}

package uk.gov.register.providers;

import org.glassfish.jersey.server.ParamException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.gov.register.views.ViewFactory;
import uk.gov.register.views.representations.ExtraMediaType;

import javax.inject.Inject;
import javax.ws.rs.ClientErrorException;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Provider
public class ThrowableExceptionMapper implements ExceptionMapper<Throwable> {

    public static final Logger LOGGER = LoggerFactory.getLogger(ThrowableExceptionMapper.class);

    private ViewFactory viewFactory;

    @Inject
    public ThrowableExceptionMapper(ViewFactory viewFactory) {
        this.viewFactory = viewFactory;
    }

    @Override
    public Response toResponse(Throwable exception) {
        if (exception instanceof ParamException.PathParamException) {
            return Response.status(Response.Status.NOT_FOUND)
                    .header(HttpHeaders.CONTENT_TYPE, ExtraMediaType.TEXT_HTML)
                    .entity(viewFactory.exceptionNotFoundView())
                    .build();        }

        LOGGER.error("Uncaught exception: {}", exception);

        return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                .header(HttpHeaders.CONTENT_TYPE, ExtraMediaType.TEXT_HTML)
                .entity(viewFactory.exceptionServerErrorView())
                .build();
    }
}

Remove redundant ClientException handling from generic throwable handler


package org.zanata.rest.client;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Produces;

import org.jboss.resteasy.client.ClientResponse;
import org.zanata.rest.MediaTypes;
import org.zanata.rest.dto.Project;
import org.zanata.rest.service.ProjectResource;

//@Path("/projects/p/{projectSlug}")
public interface IProjectResource extends ProjectResource
{

   @GET
   @Produces( { MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON })
   public ClientResponse<Project> get();

   @PUT
   @Consumes( { MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON })
   public ClientResponse put(Project project);

}

package org.zanata.rest.client;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
import javax.ws.rs.PUT;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.jboss.resteasy.client.ClientResponse;
import org.zanata.rest.MediaTypes;
import org.zanata.rest.dto.Project;
import org.zanata.rest.service.ProjectResource;

//@Path("/projects/p/{projectSlug}")
public interface IProjectResource extends ProjectResource
{

   @HEAD
   @Produces({ MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
   public ClientResponse head();

   @GET
   @Produces( { MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON })
   public ClientResponse<Project> get();

   @PUT
   @Consumes( { MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON })
   public ClientResponse put(Project project);

}

Add Rest API restrictions to Project Iterations.


package ee.ria.DigiDoc.android.utils.widget;

import android.app.Dialog;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;

import androidx.annotation.NonNull;

import ee.ria.DigiDoc.R;
import ee.ria.DigiDoc.android.Activity;

public class NotificationDialog extends Dialog {

    public NotificationDialog(@NonNull Activity context) {
        super(context);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        setContentView(R.layout.success_notification_dialog);
        Button okButton = findViewById(R.id.okButton);
        okButton.setOnClickListener(v -> {
            CheckBox checkBox = (CheckBox) findViewById(R.id.successNotificationDontShowAgain);
            if (checkBox.isChecked()) {
                context.getSettingsDataStore().setShowSuccessNotification(false);
            }
            dismiss();
        });
    }

}

package ee.ria.DigiDoc.android.utils.widget;

import android.app.Dialog;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;

import androidx.annotation.NonNull;

import ee.ria.DigiDoc.R;
import ee.ria.DigiDoc.android.Activity;
import ee.ria.DigiDoc.android.utils.SecureUtil;

public class NotificationDialog extends Dialog {

    public NotificationDialog(@NonNull Activity context) {
        super(context);
        SecureUtil.markAsSecure(getWindow());
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        setContentView(R.layout.success_notification_dialog);
        Button okButton = findViewById(R.id.okButton);
        okButton.setOnClickListener(v -> {
            CheckBox checkBox = (CheckBox) findViewById(R.id.successNotificationDontShowAgain);
            if (checkBox.isChecked()) {
                context.getSettingsDataStore().setShowSuccessNotification(false);
            }
            dismiss();
        });
    }

}

Hide decryption success dialog from screen recorders


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

import java.io.IOException;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

public class ExceptionTest {

    @RegisterExtension
    static IgnoreIOExceptionExtension ignoreIOExceptionExtension = new IgnoreIOExceptionExtension();

    @Test
    public void firstTest() throws IOException {
        throw new IOException("IO Exception");
    }

    @Test
    public void secondTest() throws IOException {
        throw new IOException("My IO Exception");
    }

}

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

import java.io.IOException;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

public class ExceptionTest {

    @RegisterExtension
    IgnoreIOExceptionExtension ignoreIOExceptionExtension = new IgnoreIOExceptionExtension();

    @Test
    public void firstTest() throws IOException {
        throw new IOException("IO Exception");
    }

    @Test
    public void secondTest() throws IOException {
        throw new IOException("My IO Exception");
    }

}

Remove static when using @RegisterExtension


package controllers.api;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Helper methods for writing REST API routines
 * @author mattwigway
 *
 */
public class JsonManager<T> {
    private static ObjectMapper om = new ObjectMapper();

    private Class<T> theClass;

    /**
     * Convert an object to its JSON representation
     * @param o the object to convert
     * @return the JSON string
     * @throws JsonProcessingException
     */
    public String write (T o) throws JsonProcessingException {
        return om.writeValueAsString(o);
    }

    public T read (String s) throws JsonParseException, JsonMappingException, IOException {
        return om.readValue(s, theClass);
    }

    public T read (JsonParser p) throws JsonParseException, JsonMappingException, IOException {
        return om.readValue(p, theClass);
    }
}

package controllers.api;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Helper methods for writing REST API routines
 * @author mattwigway
 *
 */
public class JsonManager<T> {
    private static ObjectMapper om = new ObjectMapper();

    private Class<T> theClass;

    /**
     * Convert an object to its JSON representation
     * @param o the object to convert
     * @return the JSON string
     * @throws JsonProcessingException
     */
    public JsonNode write (T o) throws JsonProcessingException {
        return om.valueToTree(o);
    }

    public T read (String s) throws JsonParseException, JsonMappingException, IOException {
        return om.readValue(s, theClass);
    }

    public T read (JsonParser p) throws JsonParseException, JsonMappingException, IOException {
        return om.readValue(p, theClass);
    }
}

Return a JsonNode not a String from the serializer so that Play sends the correct headers.


package water.webserver.jetty9;

import org.eclipse.jetty.client.HttpExchange;
import org.eclipse.jetty.proxy.ProxyServlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.api.Request;

/**
 * Transparent proxy that automatically adds authentication to each request
 */
public class TransparentProxyServlet extends ProxyServlet.Transparent {
  private String _basicAuth;

  @Override
  public void init(ServletConfig config) throws ServletException {
    super.init(config);
    _basicAuth = config.getInitParameter("BasicAuth");
  }

  @Override
  protected void addProxyHeaders(HttpServletRequest clientRequest,
                                 Request proxyRequest) {
    proxyRequest.getHeaders().remove("Authorization");
    proxyRequest.header("Authorization", _basicAuth);
  }
}

package water.webserver.jetty9;

import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpExchange;
import org.eclipse.jetty.proxy.ProxyServlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.util.ssl.SslContextFactory;

/**
 * Transparent proxy that automatically adds authentication to each request
 */
public class TransparentProxyServlet extends ProxyServlet.Transparent {
  private String _basicAuth;

  @Override
  public void init(ServletConfig config) throws ServletException {
    super.init(config);
    _basicAuth = config.getInitParameter("BasicAuth");
  }

  @Override
  protected HttpClient newHttpClient() {
    final SslContextFactory sslContextFactory = new SslContextFactory(true);
    return new HttpClient(sslContextFactory);
  }

  @Override
  protected void addProxyHeaders(HttpServletRequest clientRequest,
                                 Request proxyRequest) {
    proxyRequest.getHeaders().remove("Authorization");
    proxyRequest.header("Authorization", _basicAuth);
  }
}

Enable HTTPS between Hadoop proxy and H2O Node


package ru.nixan.android.requestloaders;

import android.content.Context;

/**
 * Created by nixan on 11/26/13.
 */
public interface IRequest {

    /**
     * Executes the request. In case of any error in implemented protocol or actual implementation
     * of network stack please throw an exception.
     */
    public void execute(Context context);

    /**
     * Cancel the executing request
     */
    public void cancel();

    /**
     * @return if the instance of this request class have already been executed
     */
    public boolean wasExecuted();

    /**
     * Set the result of the request
     */
    public void setException(Exception exception);

    /**
     * @return the exception that occured during excecution.
     */
    public Exception getException();

    /**
     * @return if the request was succesfull
     */
    public boolean isSuccesfull();
}

package ru.nixan.android.requestloaders;

import android.content.Context;

/**
 * Created by nixan on 11/26/13.
 */
public interface IRequest {

    /**
     * Executes the request.
     */
    public void execute(Context context);

    /**
     * Cancel the executing request
     */
    public void cancel();

    /**
     * @return if the instance of this request class have already been executed
     */
    public boolean wasExecuted();

    /**
     * Set the result of the request
     */
    public void setException(Exception exception);

    /**
     * @return the exception that occured during excecution.
     */
    public Exception getException();

    /**
     * @return if the request was succesfull
     */
    public boolean isSuccesfull();
}

Change comment about Exceptions in execute


/*
 * Copyright 2015 Matthew Aguirre
 *
 * 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.l2fprod.common.beans.editor;

import com.l2fprod.common.annotations.EditorRegistry;
import javax.swing.JComboBox;

/**
 *
 * @author matta
 */
@EditorRegistry(type = Enum.class)
public class EnumerationPropertyEditor extends ComboBoxPropertyEditor {

    private Class<?> baseType;

    public EnumerationPropertyEditor() {
        super();

    }

    @Override
    public Object getValue() {
        JComboBox e = (JComboBox) editor;
        return e.getSelectedItem();
    }

    @Override
    public void setValue(Object value) {
        if (this.baseType == null) {
            this.baseType = value.getClass();
            setAvailableValues(baseType.getEnumConstants());
        }

        JComboBox e = (JComboBox) editor;

        for (int ii = 0; ii < e.getItemCount(); ii++) {
            if (value != null && e.getItemAt(ii).equals(value.getClass().getCanonicalName())) {
                e.setSelectedIndex(ii);
                break;
            }
        }
    }
}

/*
 * Copyright 2015 Matthew Aguirre
 *
 * 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.l2fprod.common.beans.editor;

import com.l2fprod.common.annotations.EditorRegistry;
import javax.swing.JComboBox;

/**
 *
 * @author matta
 */
@EditorRegistry(type = Enum.class)
public class EnumerationPropertyEditor extends ComboBoxPropertyEditor {

    private Class<?> baseType;

    public EnumerationPropertyEditor() {
        super();

    }

    @Override
    public Object getValue() {
        JComboBox e = (JComboBox) editor;
        return e.getSelectedItem();
    }

    @Override
    public void setValue(Object value) {
        if (this.baseType == null) {
            this.baseType = value.getClass();
            setAvailableValues(baseType.getEnumConstants());
        }

        JComboBox e = (JComboBox) editor;
        e.getModel().setSelectedItem(value);
    }
}

Fix item selection in enum property editor.


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

package com.google.gerrit.client.dashboards;

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

public class DashboardInfo extends JavaScriptObject {
  public final native String id() /*-{ return this.id; }-*/;
  public final native String name() /*-{ return this.dashboard_name; }-*/;
  public final native String refName() /*-{ return this.ref_name; }-*/;
  public final native String projectName() /*-{ return this.project_name; }-*/;
  public final native String description() /*-{ return this.description; }-*/;
  public final native String parameters() /*-{ return this.parameters; }-*/;
  public final native boolean isDefault() /*-{ return this.isDefault ? true : false; }-*/;

  protected DashboardInfo() {
  }
}

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

package com.google.gerrit.client.dashboards;

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

public class DashboardInfo extends JavaScriptObject {
  public final native String id() /*-{ return this.id; }-*/;
  public final native String name() /*-{ return this.dashboard_name; }-*/;
  public final native String refName() /*-{ return this.ref_name; }-*/;
  public final native String projectName() /*-{ return this.project_name; }-*/;
  public final native String description() /*-{ return this.description; }-*/;
  public final native String parameters() /*-{ return this.parameters; }-*/;
  public final native boolean isDefault() /*-{ return this.is_default ? true : false; }-*/;

  protected DashboardInfo() {
  }
}

Fix retrieving of the projects default dashboard


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

/**
 * An abstraction of a secret store for e.g passwords.
 * Implementations can be plugged in to provide passwords for various keys.
 *
 * @author bratseth
 * @author bjorncs
 * @deprecated Use com.yahoo.container.jdisc.secretstore.SecretStore
 */
@Deprecated
public interface SecretStore {

    /** Returns the secret for this key */
    String getSecret(String key);

    /** Returns the secret for this key and version */
    default String getSecret(String key, int version) {
        throw new UnsupportedOperationException("SecretStore implementation does not support versioned secrets");
    }

}

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

/**
 * An abstraction of a secret store for e.g passwords.
 * Implementations can be plugged in to provide passwords for various keys.
 *
 * @author bratseth
 * @author bjorncs
 * @deprecated Use com.yahoo.container.jdisc.secretstore.SecretStore
 */
@Deprecated // Vespa 8
public interface SecretStore {

    /** Returns the secret for this key */
    String getSecret(String key);

    /** Returns the secret for this key and version */
    default String getSecret(String key, int version) {
        throw new UnsupportedOperationException("SecretStore implementation does not support versioned secrets");
    }

}

Clarify that deprecation will be removed for Vespa 8


// Copyright 2013 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.modules;

import org.apache.tapestry5.internal.services.dashboard.DashboardManagerImpl;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.services.dashboard.DashboardManager;
import org.apache.tapestry5.services.dashboard.DashboardTab;

public class DashboardModule
{
    public static void bind(ServiceBinder binder)
    {
        binder.bind(DashboardManager.class, DashboardManagerImpl.class);
    }

    @Contribute(DashboardManager.class)
    public static void defaultTabs(OrderedConfiguration<DashboardTab> configuration)
    {
        configuration.add("Pages", new DashboardTab("Pages", "core/PageCatalog"));
        configuration.add("Metrics", new DashboardTab("Metrics", "core/AppMetrics"));
        configuration.add("Services", new DashboardTab("Services", "core/ServiceStatus"));
    }
}

// Copyright 2013 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.modules;

import org.apache.tapestry5.internal.services.dashboard.DashboardManagerImpl;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.services.dashboard.DashboardManager;
import org.apache.tapestry5.services.dashboard.DashboardTab;

public class DashboardModule
{
    public static void bind(ServiceBinder binder)
    {
        binder.bind(DashboardManager.class, DashboardManagerImpl.class);
    }

    @Contribute(DashboardManager.class)
    public static void defaultTabs(OrderedConfiguration<DashboardTab> configuration)
    {
        configuration.add("Pages", new DashboardTab("Pages", "core/PageCatalog"));
        configuration.add("Services", new DashboardTab("Services", "core/ServiceStatus"));
    }
}

Remove the "Metrics" tab from the Dashboard, as the page no longer exists