// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.domokit.vsync;

import android.view.Choreographer;

import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojo.system.MojoException;
import org.chromium.mojom.vsync.VSyncProvider;

/**
 * Android implementation of VSyncProvider.
 */
public class VSyncProviderImpl implements VSyncProvider, Choreographer.FrameCallback {
    private Choreographer mChoreographer;
    private AwaitVSyncResponse mCallback;
    private MessagePipeHandle mPipe;

    public VSyncProviderImpl(MessagePipeHandle pipe) {
        mPipe = pipe;
        mChoreographer = Choreographer.getInstance();
    }

    @Override
    public void close() {}

    @Override
    public void onConnectionError(MojoException e) {}

    @Override
    public void awaitVSync(final AwaitVSyncResponse callback) {
        if (mCallback != null) {
            mPipe.close();
            return;
        }
        mCallback = callback;
        mChoreographer.postFrameCallback(this);
    }

    @Override
    public void doFrame(long frameTimeNanos) {
        mCallback.call(frameTimeNanos / 1000);
        mCallback = null;
    }
}

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.domokit.vsync;

import android.view.Choreographer;

import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojo.system.MojoException;
import org.chromium.mojom.vsync.VSyncProvider;

import java.util.ArrayList;

/**
 * Android implementation of VSyncProvider.
 */
public class VSyncProviderImpl implements VSyncProvider, Choreographer.FrameCallback {
    private Choreographer mChoreographer;
    private ArrayList<AwaitVSyncResponse> mCallbacks = new ArrayList<AwaitVSyncResponse>();
    private MessagePipeHandle mPipe;

    public VSyncProviderImpl(MessagePipeHandle pipe) {
        mPipe = pipe;
        mChoreographer = Choreographer.getInstance();
    }

    @Override
    public void close() {}

    @Override
    public void onConnectionError(MojoException e) {}

    @Override
    public void awaitVSync(final AwaitVSyncResponse callback) {
        mCallbacks.add(callback);
        if (mCallbacks.size() == 1) {
            mChoreographer.postFrameCallback(this);
        }
    }

    @Override
    public void doFrame(long frameTimeNanos) {
        long frameTimeMicros = frameTimeNanos / 1000;
        for (AwaitVSyncResponse callback : mCallbacks) {
            callback.call(frameTimeMicros);
        }
        mCallbacks.clear();
    }
}

Allow multiple callbacks in the VSyncProvider


package org.msf.records.net.model;

/**
 * Created by Gil on 11/10/2014.
 */
public class PatientLocation {

    public String uuid;
    public String zone;
    public String tent;
    public String bed;
}

package org.msf.records.net.model;

/**
 * Created by Gil on 11/10/2014.
 */
public class PatientLocation {

    public String uuid;
    public String parent_uuid;

    public String zone;
    public String tent;
    public String bed;
}

Add parent_uuid to the representation of location for patients.


package leetcode;

/**
 * https://leetcode.com/problems/nth-digit/
 */
public class Problem400 {
    public int findNthDigit(int n) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem400 prob = new Problem400();
        System.out.println(prob.findNthDigit(3)); // 3
        System.out.println(prob.findNthDigit(11)); // 0
    }
}

package leetcode;

/**
 * https://leetcode.com/problems/nth-digit/
 */
public class Problem400 {
    public int findNthDigit(int n) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem400 prob = new Problem400();
        System.out.println(prob.findNthDigit(3)); // 3
        System.out.println(prob.findNthDigit(11)); // 0
        System.out.println(prob.findNthDigit(15)); // 2
    }
}

Add test cases for problem 400


/* Copyright (C) 2005-2011 Fabio Riccardi */

package com.lightcrafts.utils.awt;

import java.awt.EventQueue;
import java.util.EmptyStackException;
import java.lang.reflect.InvocationTargetException;

/**
 * A PoppableEventQueue is-an {@link EventQueue} that merely
 * makes the ordinarily protected method pop()
 * public.
 *
 * @author Paul J. Lucas [paul@lightcrafts.com]
 */
public class PoppableEventQueue extends EventQueue {

    /**
     * {@inheritDoc}
     */
    public void pop() throws EmptyStackException {
        super.pop();
    }

    // Enqueue a placeholder task and wait until it (and all preceding tasks)
    // are dequeued.  This helps prevent tasks from running after the pop().
    public static void drain() {
        if (EventQueue.isDispatchThread()) {
            String msg = "Can't drain the event queue from the event thread.";
            // throw new IllegalThreadStateException(msg);
            System.err.println(msg);
            return;
        }
        try {
            EventQueue.invokeAndWait(
                new Runnable() {
                    public void run() {
                        // do nothing
                    }
                }
            );
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }
        catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

}
/* vim:set et sw=4 ts=4: */

/* Copyright (C) 2005-2011 Fabio Riccardi */

package com.lightcrafts.utils.awt;

import java.awt.EventQueue;
import java.util.EmptyStackException;
import java.lang.reflect.InvocationTargetException;

/**
 * A PoppableEventQueue is-an {@link EventQueue} that merely
 * makes the ordinarily protected method pop()
 * public.
 *
 * @author Paul J. Lucas [paul@lightcrafts.com]
 */
public class PoppableEventQueue extends EventQueue {

    /**
     * {@inheritDoc}
     */
    public void pop() throws EmptyStackException {
        super.pop();
    }

    // Enqueue a placeholder task and wait until it (and all preceding tasks)
    // are dequeued.  This helps prevent tasks from running after the pop().
    public static void drain() {
        if (EventQueue.isDispatchThread()) {
            throw new IllegalThreadStateException(
                "Can't drain the event queue from the event thread."
            );
        }
        try {
            EventQueue.invokeAndWait(
                new Runnable() {
                    public void run() {
                        // do nothing
                    }
                }
            );
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }
        catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

}
/* vim:set et sw=4 ts=4: */

Revert "MacOSX - Suppress EDT exception in NoInputEventQueue.drain()"


package som.interpreter.actors;

import som.vmobjects.SAbstractObject;
import som.vmobjects.SClass;
import som.vmobjects.SSymbol;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;

public final class SFarReference extends SAbstractObject {
  @CompilationFinal private static SClass farReferenceClass;

  private final Actor  actor;
  private final Object value;

  public SFarReference(final Actor actor, final Object value) {
    this.actor = actor;
    this.value = value;
  }

  public Actor getActor() {
    return actor;
  }

  public Object getValue() {
    return value;
  }

  @Override
  public SClass getSOMClass() {
    return farReferenceClass;
  }

  @Override
  public String toString() {
    return "FarRef[" + value.toString() + ", " + actor.toString() + "]";
  }

  @Override
  public boolean isValue() {
    return true;
  }

  public static void setSOMClass(final SClass cls) {
    assert farReferenceClass == null || cls == null;
    farReferenceClass = cls;
  }

  public SPromise eventualSend(final Actor currentActor, final SSymbol selector,
      final Object[] args) {
    return actor.eventualSend(currentActor, selector, args);
  }
}

package som.interpreter.actors;

import som.vmobjects.SAbstractObject;
import som.vmobjects.SClass;
import som.vmobjects.SSymbol;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;

public final class SFarReference extends SAbstractObject {
  @CompilationFinal private static SClass farReferenceClass;

  private final Actor  actor;
  private final Object value;

  public SFarReference(final Actor actor, final Object value) {
    this.actor = actor;
    this.value = value;
    assert !(value instanceof SFarReference);
  }

  public Actor getActor() {
    return actor;
  }

  public Object getValue() {
    return value;
  }

  @Override
  public SClass getSOMClass() {
    return farReferenceClass;
  }

  @Override
  public String toString() {
    return "FarRef[" + value.toString() + ", " + actor.toString() + "]";
  }

  @Override
  public boolean isValue() {
    return true;
  }

  public static void setSOMClass(final SClass cls) {
    assert farReferenceClass == null || cls == null;
    farReferenceClass = cls;
  }

  public SPromise eventualSend(final Actor currentActor, final SSymbol selector,
      final Object[] args) {
    return actor.eventualSend(currentActor, selector, args);
  }
}

Make sure we never construct a far ref for a far ref


import com.google.sps.data.Book;
import com.google.sps.data.BookServiceClient;
import java.text.ParseException;
import java.lang.IllegalAccessException;
import java.lang.NullPointerException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
   This is a test class for BookServiceClient.java
    Tests the implementations ability to call the
    Book API, given the title, and return the book's information.
*/

@RunWith(JUnit4.class)
public final class BookServiceClientTest {

  @Test
  public void getTopResult(){
    //calls the API with the title and checks to make sure it only returns one item
    String title = "A Court of Wings and Ruin";
    String bookInfo = "";
    try{
        bookInfo = BookServiceClient.getBookInfo(title);
    }catch(Exception e){
        String failureMessage = "Was not able to query the Book API. \n"+e;
        Assert.fail(failureMessage);
    }
    JSONObject jsonObject = new JSONObject(bookInfo);
    Assert.assertEquals(true,jsonObject.has("volumeInfo"));
    Assert.assertEquals(false,jsonObject.has("items"));
  }

  @Test(expected = NullPointerException.class)
  public void queryNull() throws Exception{
      //attempts to query a null value
      BookServiceClient.getBookInfo(null);
  }

  @Test(expected = NullPointerException.class)
  public void queryEmpty() throws Exception{
      //attempts to query an empty value
      BookServiceClient.getBookInfo("");
  }
}

import com.google.sps.data.Book;
import com.google.sps.data.BookServiceClient;
import java.text.ParseException;
import java.lang.IllegalAccessException;
import java.lang.NullPointerException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
   This is a test class for BookServiceClient.java
    Tests the implementations ability to call the
    Book API, given the title, and return the book's information.
*/

@RunWith(JUnit4.class)
public final class BookServiceClientTest {

  @Test(expected = NullPointerException.class)
  public void queryNull() throws Exception{
      //attempts to query a null value
      BookServiceClient.getBookInfo(null);
  }

  @Test(expected = NullPointerException.class)
  public void queryEmpty() throws Exception{
      //attempts to query an empty value
      BookServiceClient.getBookInfo("");
  }
}

Remove test that calls api


package com.annimon.stream.operator;

import com.annimon.stream.iterator.LsaExtIterator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class ObjDistinct<T> extends LsaExtIterator<T> {

    private final Iterator<? extends T> iterator;
    private final Set<T> set;

    public ObjDistinct(Iterator<? extends T> iterator) {
        this.iterator = iterator;
        set = new HashSet<T>();
    }

    @Override
    protected void nextIteration() {
        while (hasNext = iterator.hasNext()) {
            next = iterator.next();
            if (!set.contains(next)) {
                set.add(next);
                return;
            }
        }
    }
}

package com.annimon.stream.operator;

import com.annimon.stream.iterator.LsaExtIterator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class ObjDistinct<T> extends LsaExtIterator<T> {

    private final Iterator<? extends T> iterator;
    private final Set<T> set;

    public ObjDistinct(Iterator<? extends T> iterator) {
        this.iterator = iterator;
        set = new HashSet<T>();
    }

    @Override
    protected void nextIteration() {
        while (hasNext = iterator.hasNext()) {
            next = iterator.next();
            if (set.add(next)) {
                return;
            }
        }
    }
}

Remove unnecessary check in distinct operator


package com.ushahidi.android.data.entity;

import com.google.gson.annotations.SerializedName;

/**
 * @author Ushahidi Team <team@ushahidi.com>
 */
public class Data {

    @SerializedName("id")
    public Long _id;
}

package com.ushahidi.android.data.entity;

import com.google.gson.annotations.SerializedName;

/**
 * @author Ushahidi Team <team@ushahidi.com>
 */
public abstract class Data {

    @SerializedName("id")
    public Long _id;
}

Make data entity abstract so it should be extended and not instantiated


package Test;

/**
 * Created by Lukas on 16.10.2017.
 */

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HelloWorldTest {
    HelloWorld greeter = new HelloWorld();

    @Test
    public void test() {
        assertEquals("Hello World! ", greeter.greetings(""));
    }
}

package Test;

/**
 * Created by Lukas on 16.10.2017.
 */

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HelloWorldTest {
    HelloWorld greeter = new HelloWorld();

    @Test
    public void test() {
        assertEquals("Hello World! ", greeter.greetings(""));
    }
    public void test2(){}
    }
}

Revert "Revert "intellij commit 2""


package com.twu.biblioteca;

import com.twu.biblioteca.menu.MainMenu;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BibliotecaApp {

    private static MainMenu menu = MainMenu.instance;

    public static boolean testing = false; //Used to prevent infinite loop during unit tests

    public static void main(String[] args) {
        displayWelcomeMessage();
        menu.loop();
    }

    public static String readLine() throws IOException {
        return new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    private static void displayWelcomeMessage() {
        print("Welcome to Biblioteca.\n");
    }

    public static void print(String str) {
        System.out.print(str);
    }

    public static void setTesting(boolean testing) {
        BibliotecaApp.testing = testing;
    }
}

package com.twu.biblioteca;

import com.twu.biblioteca.menu.MainMenu;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BibliotecaApp {

    private MainMenu menu = MainMenu.instance;

    public static boolean testing = false; //Used to prevent infinite loop during unit tests

    public static void main(String[] args) {
        BibliotecaApp app = new BibliotecaApp();
        app.run();
    }

    private void run() {
        displayWelcomeMessage();
        menu.loop();
    }

    public static String readLine() throws IOException {
        return new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    private void displayWelcomeMessage() {
        print("Welcome to Biblioteca.\n");
    }

    public static void print(String str) {
        System.out.print(str);
    }

    public static void setTesting(boolean testing) {
        BibliotecaApp.testing = testing;
    }
}

Make Biblioteca methods non static


package com.dev.pygmy;

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

public class GameBoardInterfaceActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new GameBoardView(getApplicationContext()));;
    }
}

package com.dev.pygmy;

import android.annotation.SuppressLint;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.FrameLayout;

@SuppressLint("ResourceAsColor")
public class GameBoardInterfaceActivity extends Activity {

	static final String TAG = "Pygmy";

	private GameBoardView gameBoardView = null;
	private EntityView entityView = null;

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

		FrameLayout mainLayout = createMainLayout();
		setContentView(mainLayout);

		gameBoardView = new GameBoardView(getApplicationContext());
		mainLayout.addView(gameBoardView);

		entityView = new EntityView(this);
		mainLayout.addView(entityView);
	}

	private FrameLayout createMainLayout() {
		FrameLayout mainLayout = new FrameLayout(this);
		LayoutParams gerenalLayoutParams = new LayoutParams(
				ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.MATCH_PARENT);
		mainLayout.setLayoutParams(gerenalLayoutParams);
		mainLayout.setBackgroundColor(R.color.blue);

		return mainLayout;
	}
}

Put GameBoardView and EntityView in the same layout


package sagan.renderer;

import javax.validation.constraints.Pattern;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

/**
 * Configuration properties for the Sagan Renderer application
 */
@ConfigurationProperties("sagan.renderer")
@Validated
public class RendererProperties {

	private final Github github = new Github();

	private final Guides guides = new Guides();

	public Github getGithub() {
		return this.github;
	}

	public Guides getGuides() {
		return this.guides;
	}

	public static class Github {

		/**
		 * Access token to query public github endpoints.
		 * https://developer.github.com/v3/auth/#authenticating-for-saml-sso
		 */
		@Pattern(regexp = "([0-9a-z]*)?")
		private String token;

		public String getToken() {
			return this.token;
		}

		public void setToken(String token) {
			this.token = token;
		}

	}

	public static class Guides {

		/**
		 * Name of the Github organization to fetch guides from.
		 */
		private String organization = "spring-guides";

		public String getOrganization() {
			return this.organization;
		}

		public void setOrganization(String organization) {
			this.organization = organization;
		}
	}
}

package sagan.renderer;

import javax.validation.constraints.Pattern;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

/**
 * Configuration properties for the Sagan Renderer application
 */
@ConfigurationProperties("sagan.renderer")
@Validated
public class RendererProperties {

	private final Github github = new Github();

	private final Guides guides = new Guides();

	public Github getGithub() {
		return this.github;
	}

	public Guides getGuides() {
		return this.guides;
	}

	public static class Github {

		/**
		 * Access token to query public github endpoints.
		 * https://developer.github.com/v3/auth/#authenticating-for-saml-sso
		 */
		@Pattern(regexp = "([0-9a-zA-Z_]*)?")
		private String token;

		public String getToken() {
			return this.token;
		}

		public void setToken(String token) {
			this.token = token;
		}

	}

	public static class Guides {

		/**
		 * Name of the Github organization to fetch guides from.
		 */
		private String organization = "spring-guides";

		public String getOrganization() {
			return this.organization;
		}

		public void setOrganization(String organization) {
			this.organization = organization;
		}
	}
}

Allow new GitHub token format


package com.gentics.mesh.test;

import javax.annotation.PostConstruct;

import org.elasticsearch.node.Node;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.gentics.mesh.cli.Mesh;
import com.gentics.mesh.etc.config.MeshOptions;
import com.gentics.mesh.graphdb.OrientDBDatabaseProviderImpl;

@Configuration
@ComponentScan(basePackages = { "com.gentics.mesh" })
public class SpringTestConfiguration {

	@Bean
	public String graphProviderClassname() {
		// return TinkerGraphDatabaseProviderImpl.class.getName();
		return OrientDBDatabaseProviderImpl.class.getName();
		// return TitanDBDatabaseProviderImpl.class.getName();
	}

	@Bean
	public Node elasticSearchNode() {
		// For testing it is not needed to start ES in most cases. This will speedup test execution since ES does not need to initialize.
		return null;
	}

	@PostConstruct
	public void setup() {
		MeshOptions options = new MeshOptions();
		options.setDatabaseProviderClass(graphProviderClassname());
		options.setHttpPort(TestUtil.getRandomPort());
		Mesh.initalize(options);
	}

}

package com.gentics.mesh.test;

import javax.annotation.PostConstruct;

import org.elasticsearch.node.Node;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.gentics.mesh.cli.Mesh;
import com.gentics.mesh.etc.config.MeshOptions;
import com.gentics.mesh.graphdb.TinkerGraphDatabaseProviderImpl;

@Configuration
@ComponentScan(basePackages = { "com.gentics.mesh" })
public class SpringTestConfiguration {

	@Bean
	public String graphProviderClassname() {
		return TinkerGraphDatabaseProviderImpl.class.getName();
		//return OrientDBDatabaseProviderImpl.class.getName();
		// return TitanDBDatabaseProviderImpl.class.getName();
	}

	@Bean
	public Node elasticSearchNode() {
		// For testing it is not needed to start ES in most cases. This will speedup test execution since ES does not need to initialize.
		return null;
	}

	@PostConstruct
	public void setup() {
		MeshOptions options = new MeshOptions();
		options.setDatabaseProviderClass(graphProviderClassname());
		options.setHttpPort(TestUtil.getRandomPort());
		Mesh.initalize(options);
	}

}

Switch tests back to tinkerpop graph api


package no.stelar7.api.l4j8.basic.constants.types;

import java.util.*;
import java.util.stream.*;

public enum TeamType implements CodedEnum
{

    BLUE(100),
    RED(200);

    private final Integer code;

    TeamType(final int code)
    {
        this.code = code;
    }

    public Optional<TeamType> getFromCode(final String teamId)
    {
        return Stream.of(TeamType.values()).filter(t -> t.code.equals(Integer.valueOf(teamId))).findFirst();
    }

    public Integer getValue()
    {
        return this.code;
    }
}

package no.stelar7.api.l4j8.basic.constants.types;

import java.util.*;
import java.util.stream.*;

public enum TeamType implements CodedEnum
{

    BLUE(100),
    RED(200),
    AI(300);

    private final Integer code;

    TeamType(final int code)
    {
        this.code = code;
    }

    public Optional<TeamType> getFromCode(final String teamId)
    {
        return Stream.of(TeamType.values()).filter(t -> t.code.equals(Integer.valueOf(teamId))).findFirst();
    }

    public Integer getValue()
    {
        return this.code;
    }
}

Add AI team (only found in cdragon atm)


package monoxide.forgebackup.coremod.asm;

import java.util.Map;

import monoxide.forgebackup.BackupLog;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.MethodNode;

import com.google.common.collect.Maps;

public class EssentialsBackupTransformer extends AsmTransformer {
	public EssentialsBackupTransformer() {
		Map<String, String> tmp;
		// MCP/obfuscated version. Nothing needs to change in a live MC instance.
		tmp = Maps.newHashMap();
		mappings.put("com.ForgeEssentials.backup.ModuleBackup", tmp);
	}

	@Override
	protected void doTransform(ClassNode classNode, Map<String, String> mapping) {
		BackupLog.info("Mangling ForgeEssentials for its own good. Their Backups module was not actually loaded.");

		classNode.fields.clear();
		for (int i = 0; i < classNode.methods.size();) {
			MethodNode node = (MethodNode)classNode.methods.get(i);

			BackupLog.info("Inspecting method: %s", node.name);
			if (!node.name.equals("<init>")) {
				classNode.methods.remove(i);
			} else {
				i++;
			}
		}
	}
}

package monoxide.forgebackup.coremod.asm;

import java.util.Map;

import monoxide.forgebackup.BackupLog;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.MethodNode;

import com.google.common.collect.Maps;

public class EssentialsBackupTransformer extends AsmTransformer {
	public EssentialsBackupTransformer() {
		Map<String, String> tmp;
		// MCP/obfuscated version. Nothing needs to change in a live MC instance.
		tmp = Maps.newHashMap();
		mappings.put("com.ForgeEssentials.backup.ModuleBackup", tmp);
	}

	@Override
	protected void doTransform(ClassNode classNode, Map<String, String> mapping) {
		BackupLog.info("Mangling ForgeEssentials for its own good. Their Backups module was not actually loaded.");

		classNode.fields.clear();
		for (int i = 0; i < classNode.methods.size();) {
			MethodNode node = (MethodNode)classNode.methods.get(i);

			BackupLog.fine("Inspecting method: %s", node.name);
			if (!node.name.equals("<init>")) {
				classNode.methods.remove(i);
			} else {
				i++;
			}
		}
	}
}

Adjust logging level while removing Backups module


package tk.martijn_heil.kingdomessentials.signs;

import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

public class Signs
{
    public static boolean isKingdomEssSign(@NotNull Sign s)
    {
        Preconditions.checkNotNull(s, "s can not be null.");
        return s.getLine(0).equals(ChatColor.YELLOW + "[KingdomKits]");
    }

    @Contract(pure = true)
    public static boolean isKingdomEssSign(@NotNull String firstLine)
    {
        Preconditions.checkNotNull(firstLine, "firstLine can not be null.");

        return firstLine.equals(ChatColor.YELLOW + "[KingdomEss]");
    }

    @Contract(pure = true)
    public static String getKingdomEssPrefix()
    {
        return ChatColor.YELLOW + "[KingdomEss]";
    }
}

package tk.martijn_heil.kingdomessentials.signs;

import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

public class Signs
{
    public static boolean isKingdomEssSign(@NotNull Sign s)
    {
        Preconditions.checkNotNull(s, "s can not be null.");
        return s.getLine(0).equals(ChatColor.YELLOW + "[KingdomEss]");
    }

    @Contract(pure = true)
    public static boolean isKingdomEssSign(@NotNull String firstLine)
    {
        Preconditions.checkNotNull(firstLine, "firstLine can not be null.");

        return firstLine.equals(ChatColor.YELLOW + "[KingdomEss]");
    }

    @Contract(pure = true)
    public static String getKingdomEssPrefix()
    {
        return ChatColor.YELLOW + "[KingdomEss]";
    }
}

Fix another issue with signs


package jfdi.logic;

import jfdi.logic.commands.InvalidCommand;
import jfdi.logic.interfaces.Command;
import jfdi.logic.interfaces.ILogic;
import jfdi.parser.InputParser;
import jfdi.parser.exceptions.InvalidInputException;
import jfdi.storage.apis.MainStorage;
import jfdi.storage.exceptions.FilesReplacedException;

/**
 * @author Liu Xinan
 */
public class ControlCenter implements ILogic {

    private static ControlCenter ourInstance = new ControlCenter();

    private ControlCenter() {
        try {
            MainStorage.getInstance().initialize();
        } catch (FilesReplacedException e) {
            e.printStackTrace();
        }
    }

    public static ControlCenter getInstance() {
        return ourInstance;
    }

    @Override
    public void handleInput(String input) {
        InputParser parser = InputParser.getInstance();
        Command command;
        try {
            command = parser.parse(input);
        } catch (InvalidInputException e) {
            command = new InvalidCommand.Builder().build();
        }
        command.execute();
    }
}

package jfdi.logic;

import jfdi.logic.commands.InvalidCommand;
import jfdi.logic.interfaces.Command;
import jfdi.logic.interfaces.ILogic;
import jfdi.parser.InputParser;
import jfdi.parser.exceptions.InvalidInputException;
import jfdi.storage.apis.AliasDb;
import jfdi.storage.apis.MainStorage;
import jfdi.storage.exceptions.FilesReplacedException;

/**
 * @author Liu Xinan
 */
public class ControlCenter implements ILogic {

    private static ControlCenter ourInstance = new ControlCenter();

    private ControlCenter() {
        initStorage();
        initParser();
    }

    public static ControlCenter getInstance() {
        return ourInstance;
    }

    @Override
    public void handleInput(String input) {
        InputParser parser = InputParser.getInstance();
        Command command;
        try {
            command = parser.parse(input);
        } catch (InvalidInputException e) {
            command = new InvalidCommand.Builder().build();
        }
        command.execute();
    }

    private void initStorage() {
        try {
            MainStorage.getInstance().initialize();
        } catch (FilesReplacedException e) {
            e.printStackTrace();
        }
    }

    private void initParser() {
        InputParser.getInstance().setAliases(AliasDb.getInstance().getAll());
    }
}

Initialize Parser with aliases at startup


package net.elprespufferfish.rssreader;

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

public class RssReaderApplication extends Application {

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

        Feeds.initialize();

        if (BuildConfig.DEBUG) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());

        }
    }
}

package net.elprespufferfish.rssreader;

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

public class RssReaderApplication extends Application {

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

        Feeds.initialize();

        if (BuildConfig.DEBUG) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                WebView.setWebContentsDebuggingEnabled(true);
            }
        }
    }
}

Enable chrome://inspect on debug builds


package org.xbean.jmx;

import junit.framework.TestCase;
import org.xbean.spring.context.ClassPathXmlApplicationContext;

/**
 * $Rev$
 */
public class JMXTest extends TestCase {
    public void testSimple() throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/xbean/jmx/jmx-simple.xml");
        try {
            Object jmxService = context.getBean("jmxService");
            assertNotNull(jmxService);

            Object jmxExporter = context.getBean("jmxExporter");
            assertNotNull(jmxExporter);
        } finally {
            context.destroy();
        }
    }
}

package org.xbean.jmx;

import junit.framework.TestCase;
import org.xbean.spring.context.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * $Rev$
 */
public class JMXTest extends TestCase {
    public void testSimple() throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/xbean/jmx/jmx-simple.xml");
        try {
            Object jmxService = context.getBean("jmxService");
            assertNotNull(jmxService);

            Object jmxExporter = context.getBean("jmxExporter");
            assertNotNull(jmxExporter);
            assertTrue(jmxExporter instanceof MBeanExporter);
            List mbeans = ((MBeanExporter) jmxExporter).getMBeans();
            assertNotNull(mbeans);
            assertEquals(2, mbeans.size());
            assertSame(jmxService, mbeans.get(0));
            assertSame(jmxService, mbeans.get(1));
        } finally {
            context.destroy();
        }
    }
}

Add a few asserts to the test


package info.u_team.u_team_core.data;

import java.nio.file.Path;

import net.minecraft.block.Block;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;

public abstract class CommonBlockTagsProvider extends CommonTagsProvider<Block> {

	@SuppressWarnings("deprecation")
	public CommonBlockTagsProvider(GenerationData data) {
		super(data, Registry.BLOCK);
	}

	@Override
	protected Path makePath(ResourceLocation location) {
		return resolveData(location).resolve("tags").resolve("blocks").resolve(location.getPath() + ".json");
	}

	@Override
	public String getName() {
		return "Block-Tags";
	}
}

package info.u_team.u_team_core.data;

import java.nio.file.Path;

import net.minecraft.block.Block;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;

public abstract class CommonBlockTagsProvider extends CommonTagsProvider<Block> {

	@SuppressWarnings("deprecation")
	public CommonBlockTagsProvider(GenerationData data) {
		super(data, Registry.BLOCK);
	}

	@Override
	protected String getTagFolder() {
		return "blocks";
	}

	@Override
	protected Path makePath(ResourceLocation location) {
		return resolveData(location).resolve("tags").resolve(getTagFolder()).resolve(location.getPath() + ".json");
	}

	@Override
	public String getName() {
		return "Block-Tags";
	}
}

Implement the getTagFolder in the common block tags provider


package foundation.stack.datamill.security;

import org.jose4j.jwk.*;
import org.jose4j.keys.HmacKey;
import org.jose4j.lang.ByteUtil;

/**
 * @author Ravi Chodavarapu (rchodava@gmail.com)
 */
public interface KeyGenerators {
    class Symmetric {
        private Symmetric() {
        }

        public static void main(String[] arguments) throws Exception {
            byte[] bytes = ByteUtil.randomBytes(ByteUtil.byteLength(512));
            OctetSequenceJsonWebKey key = new OctetSequenceJsonWebKey(new HmacKey(bytes));
            key.setKeyId("k" + System.currentTimeMillis());
            System.out.println(new JsonWebKeySet(key).toJson(JsonWebKey.OutputControlLevel.INCLUDE_SYMMETRIC));
        }
    }

    class RSA {
        private RSA() {
        }

        public static void main(String[] arguments) throws Exception {
            RsaJsonWebKey key = RsaJwkGenerator.generateJwk(2048);
            key.setKeyId("k" + System.currentTimeMillis());

            System.out.println("Public & Private:");
            System.out.println(new JsonWebKeySet(key).toJson(JsonWebKey.OutputControlLevel.INCLUDE_PRIVATE));

            System.out.println();

            System.out.println("Only Public:");
            System.out.println(new JsonWebKeySet(key).toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY));
        }
    }
}

package foundation.stack.datamill.security;

import org.jose4j.jwk.*;
import org.jose4j.keys.HmacKey;
import org.jose4j.lang.ByteUtil;

/**
 * @author Ravi Chodavarapu (rchodava@gmail.com)
 */
public interface KeyGenerators {
    class Symmetric {
        private Symmetric() {
        }

        public static void generate() throws Exception {
            byte[] bytes = ByteUtil.randomBytes(ByteUtil.byteLength(512));
            OctetSequenceJsonWebKey key = new OctetSequenceJsonWebKey(new HmacKey(bytes));
            key.setKeyId("k" + System.currentTimeMillis());
            System.out.println(new JsonWebKeySet(key).toJson(JsonWebKey.OutputControlLevel.INCLUDE_SYMMETRIC));
        }
    }

    class RSA {
        private RSA() {
        }

        public static void generate() throws Exception {
            RsaJsonWebKey key = RsaJwkGenerator.generateJwk(2048);
            key.setKeyId("k" + System.currentTimeMillis());

            System.out.println("Public & Private:");
            System.out.println(new JsonWebKeySet(key).toJson(JsonWebKey.OutputControlLevel.INCLUDE_PRIVATE));

            System.out.println();

            System.out.println("Only Public:");
            System.out.println(new JsonWebKeySet(key).toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY));
        }
    }
}

Change main method by generate.


package arez.dom;

/**
 * A class containing width and height dimensions.
 */
public final class Dimension
{
  private final int _width;
  private final int _height;

  /**
   * Create the dimension object.
   *
   * @param width  the width.
   * @param height the height.
   */
  public Dimension( final int width, final int height )
  {
    _width = width;
    _height = height;
  }

  /**
   * Return the width.
   *
   * @return the width.
   */
  public int getWidth()
  {
    return _width;
  }

  /**
   * Return the height.
   *
   * @return the height.
   */
  public int getHeight()
  {
    return _height;
  }

  @Override
  public boolean equals( final Object o )
  {
    if ( o instanceof Dimension )
    {
      final Dimension other = (Dimension) o;
      return other._width == _width && other._height == _height;
    }
    else
    {
      return false;
    }
  }
}

package arez.dom;

import java.util.Objects;

/**
 * A class containing width and height dimensions.
 */
public final class Dimension
{
  private final int _width;
  private final int _height;

  /**
   * Create the dimension object.
   *
   * @param width  the width.
   * @param height the height.
   */
  public Dimension( final int width, final int height )
  {
    _width = width;
    _height = height;
  }

  /**
   * Return the width.
   *
   * @return the width.
   */
  public int getWidth()
  {
    return _width;
  }

  /**
   * Return the height.
   *
   * @return the height.
   */
  public int getHeight()
  {
    return _height;
  }

  @Override
  public boolean equals( final Object o )
  {
    if ( o instanceof Dimension )
    {
      final Dimension other = (Dimension) o;
      return other._width == _width && other._height == _height;
    }
    else
    {
      return false;
    }
  }

  @Override
  public int hashCode()
  {
    return Objects.hash( _width, _height );
  }
}

IMplement hashCode to eliminate warning


package co.phoenixlab.common.localization;

public interface LocaleStringProvider {

    String get(String key);

    boolean contains(String key);

}

package co.phoenixlab.common.localization;

import java.util.Locale;

public interface LocaleStringProvider {

    void setActiveLocale(Locale locale);

    String get(String key);

    boolean contains(String key);

}

Add active locale to provider


package com.github.jmchilton.blend4j.galaxy;

import com.github.jmchilton.blend4j.galaxy.beans.TabularToolDataTable;
import com.sun.jersey.api.client.ClientResponse;
import org.codehaus.jackson.type.TypeReference;

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

public class ToolDataClientImpl extends Client implements ToolDataClient {

    ToolDataClientImpl(GalaxyInstanceImpl galaxyInstance) {
        super(galaxyInstance, "tool_data");
    }

    public ClientResponse showDataTableRequest(String dataTableId) {
        return super.show(dataTableId, ClientResponse.class);
    }

    public ClientResponse deleteDataTableRequest(final String dataTableId, final List<String> values) {
        Map<String,String> requestEntity = new HashMap<String,String>();

        String joinedValues = null;
        if (values != null && values.size() > 0) {
	        joinedValues = values.get(0);
	        for (int i = 1; i < values.size(); i++) {
	        	joinedValues += "\t" + values.get(i);
	        }
        }

        requestEntity.put("values", joinedValues);
        return deleteResponse(getWebResource(dataTableId), requestEntity);
    }

    public List<TabularToolDataTable> getDataTables() {
        return get(new TypeReference<List<TabularToolDataTable>>() {});
    }

    public ClientResponse reloadDataTableRequest(final String dataTableId) {
        return getResponse(getWebResource(dataTableId).path("reload"));
    }

    public TabularToolDataTable showDataTable(final String dataTableId) {
        return super.show(dataTableId, TabularToolDataTable.class);
    }
}

package com.github.jmchilton.blend4j.galaxy;

import com.github.jmchilton.blend4j.galaxy.beans.TabularToolDataTable;
import com.sun.jersey.api.client.ClientResponse;
import org.codehaus.jackson.type.TypeReference;

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

public class ToolDataClientImpl extends Client implements ToolDataClient {

    ToolDataClientImpl(GalaxyInstanceImpl galaxyInstance) {
        super(galaxyInstance, "tool_data");
    }

    public ClientResponse showDataTableRequest(String dataTableId) {
        return super.show(dataTableId, ClientResponse.class);
    }

    public ClientResponse deleteDataTableRequest(final String dataTableId, final List<String> values) {
        Map requestEntity = new HashMap();
        requestEntity.put("values", String.join("\t", values));
        return deleteResponse(getWebResource(dataTableId), requestEntity);
    }

    public List<TabularToolDataTable> getDataTables() {
        return get(new TypeReference<List<TabularToolDataTable>>() {});
    }

    public ClientResponse reloadDataTableRequest(final String dataTableId) {
        return getResponse(getWebResource(dataTableId).path("reload"));
    }

    public TabularToolDataTable showDataTable(final String dataTableId) {
        return super.show(dataTableId, TabularToolDataTable.class);
    }
}

Revert "Updated code to work with Java 6"


package org.dummy.load;

/**
 * Created by baardl on 26.07.15.
 */
public class LoadThread implements Runnable {

    private final int sleepMillis;

    public LoadThread(int sleepMillis) {
        this.sleepMillis = sleepMillis;
    }

    @Override
    public void run() {
        do {
            performVisibleLoad();
            try {
                Thread.sleep(sleepMillis);
            } catch (InterruptedException e) {
                //sleep interupted
            }
        } while (true);
    }

    public void performVisibleLoad() {
        System.out.println("Hello You at " + System.currentTimeMillis());
    }
}

package org.dummy.load;

import org.slf4j.Logger;

import static org.slf4j.LoggerFactory.getLogger;

/**
 * Created by baardl on 26.07.15.
 */
public class LoadThread implements Runnable {
    private static final Logger log = getLogger(LoadThread.class);

    private final int sleepMillis;

    public LoadThread(int sleepMillis) {
        this.sleepMillis = sleepMillis;
    }

    @Override
    public void run() {
        do {
            performVisibleLoad();
            try {
                Thread.sleep(sleepMillis);
            } catch (InterruptedException e) {
                //sleep interupted
            }
        } while (true);
    }

    public void performVisibleLoad() {
        log.trace("Hello You at " + System.currentTimeMillis());
    }
}

Use log to show messages, not System out.


package guitests;

import javafx.scene.input.KeyCode;
import org.junit.Test;
import ui.listpanel.ListPanelCell;

import static org.junit.Assert.assertEquals;
import static org.loadui.testfx.Assertions.assertNodeExists;
import static org.loadui.testfx.controls.Commons.hasText;

public class LabelPickerTests extends UITest {

    public static final int EVENT_DELAY = 500;

    @Test
    public void showLabelPickerTest() {
        click("#dummy/dummy_col0_9");
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        assertNodeExists(hasText("Issue #9: Issue 9"));
        push(KeyCode.ENTER);
    }

    @Test
    public void addAndRemoveLabelTest() {
        ListPanelCell listPanelCell = find("#dummy/dummy_col0_9");
        click(listPanelCell);
        assertEquals(1, listPanelCell.getIssueLabels().size());
        sleep(EVENT_DELAY);
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        type("3 ");
        sleep(EVENT_DELAY);
        push(KeyCode.ENTER);
        sleep(EVENT_DELAY);
        assertEquals(2, listPanelCell.getIssueLabels().size());
        sleep(EVENT_DELAY);
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        type("3 ");
        sleep(EVENT_DELAY);
        push(KeyCode.ENTER);
        sleep(EVENT_DELAY);
        assertEquals(1, listPanelCell.getIssueLabels().size());
    }

}

package guitests;

import javafx.scene.input.KeyCode;
import org.junit.Test;
import ui.listpanel.ListPanelCell;

import static org.junit.Assert.assertEquals;
import static org.loadui.testfx.Assertions.assertNodeExists;
import static org.loadui.testfx.controls.Commons.hasText;

public class LabelPickerTests extends UITest {

    public static final int EVENT_DELAY = 500;

    @Test
    public void showLabelPickerTest() {
        click("#dummy/dummy_col0_9");
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        assertNodeExists(hasText("Issue #9: Issue 9"));
        push(KeyCode.ENTER);
    }

    @Test
    public void addAndRemoveLabelTest() {
        ListPanelCell listPanelCell = find("#dummy/dummy_col0_9");
        click(listPanelCell);
        assertEquals(1, listPanelCell.getIssueLabels().size());
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        type("3 ");
        push(KeyCode.ENTER);
        listPanelCell = find("#dummy/dummy_col0_9");
        sleep(EVENT_DELAY);
        assertEquals(2, listPanelCell.getIssueLabels().size());
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        type("3 ");
        push(KeyCode.ENTER);
        listPanelCell = find("#dummy/dummy_col0_9");
        sleep(EVENT_DELAY);
        assertEquals(1, listPanelCell.getIssueLabels().size());
    }

}

Revert "Added more event delays"


package com.faforever.api.data.listeners;

import com.faforever.api.config.FafApiProperties;
import com.faforever.api.data.domain.Avatar;
import org.springframework.stereotype.Component;

import javax.inject.Inject;
import javax.persistence.PostLoad;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

@Component
public class AvatarEnricherListener {

  private static FafApiProperties fafApiProperties;

  @Inject
  public void init(FafApiProperties fafApiProperties) {
    AvatarEnricherListener.fafApiProperties = fafApiProperties;
  }

  @PostLoad
  public void enrich(Avatar avatar) throws UnsupportedEncodingException {
    String encodedFileName = URLEncoder.encode(avatar.getFilename(), StandardCharsets.UTF_8.toString());
    String url = String.format(fafApiProperties.getAvatar().getDownloadUrlFormat(), encodedFileName);
    avatar.setUrl(url);
  }

}

package com.faforever.api.data.listeners;

import com.faforever.api.config.FafApiProperties;
import com.faforever.api.data.domain.Avatar;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriUtils;

import javax.inject.Inject;
import javax.persistence.PostLoad;
import java.nio.charset.StandardCharsets;

@Component
public class AvatarEnricherListener {

  private static FafApiProperties fafApiProperties;

  @Inject
  public void init(FafApiProperties fafApiProperties) {
    AvatarEnricherListener.fafApiProperties = fafApiProperties;
  }

  @PostLoad
  public void enrich(Avatar avatar) {
    String url = String.format(fafApiProperties.getAvatar().getDownloadUrlFormat(), avatar.getFilename());
    avatar.setUrl(UriUtils.encodePath(url, StandardCharsets.UTF_8));
  }

}

Fix avatar url encoding (whitespace was encoded with + rather than %20)


package com.choonster.testmod3.command;

import net.minecraft.command.server.CommandBlockLogic;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class SurvivalCommandBlockLogic extends CommandBlockLogic {
	private final Type type;

	public SurvivalCommandBlockLogic(Type type) {
		this.type = type;
	}

	public Type getType() {
		return type;
	}

	@SideOnly(Side.CLIENT)
	@Override
	public int func_145751_f() {
		return type.ordinal();
	}

	public enum Type {
		BLOCK,
		MINECART
	}
}

package com.choonster.testmod3.command;

import net.minecraft.command.server.CommandBlockLogic;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class SurvivalCommandBlockLogic extends CommandBlockLogic {
	private final Type type;

	public SurvivalCommandBlockLogic(Type type) {
		this.type = type;
		setName("Server");
	}

	public Type getType() {
		return type;
	}

	@SideOnly(Side.CLIENT)
	@Override
	public int func_145751_f() {
		return type.ordinal();
	}

	public enum Type {
		BLOCK,
		MINECART
	}
}

Set default name of Survival Command Block to Server


package com.kolinkrewinkel.BitLimitTweaks;

import org.bukkit.plugin.Plugin;
import java.util.*;

import org.bukkit.event.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.event.player.*;

public class BitLimitTweaksListener implements Listener {
    private final BitLimitTweaks plugin; // Reference main plugin

    /******************************************
    Initialization: BitLimitTweaksListener(plugin)
    --------- Designated Initializer ----------
    ******************************************/

    public BitLimitTweaksListener(BitLimitTweaks plugin) {
        // Notify plugin manager that this plugin handles implemented events (block place, etc.)
        plugin.getServer().getPluginManager().registerEvents(this, plugin);
        this.plugin = plugin;
    }

    @EventHandler
    public void onPlayerBedEnterEvent(PlayerBedEnterEvent event) {
        Player player = event.getPlayer();
        int x = player.getLocation().getBlockX();
        int z = player.getLocation().getBlockZ();
        player.sendMessage(Double.toString(player.getWorld().getHumidity(x, z)));
    }

    @EventHandler
    public void onPlayerBedLeaveEvent(PlayerBedLeaveEvent event) {
        Player player = event.getPlayer();
        int x = player.getLocation().getBlockX();
        int z = player.getLocation().getBlockZ();
        player.sendMessage(Double.toString(player.getWorld().getHumidity(x, z)));
    }
}

package com.kolinkrewinkel.BitLimitTweaks;

import org.bukkit.plugin.Plugin;
import java.util.*;

import org.bukkit.event.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.event.player.*;

public class BitLimitTweaksListener implements Listener {
    private final BitLimitTweaks plugin; // Reference main plugin

    /******************************************
    Initialization: BitLimitTweaksListener(plugin)
    --------- Designated Initializer ----------
    ******************************************/

    public BitLimitTweaksListener(BitLimitTweaks plugin) {
        // Notify plugin manager that this plugin handles implemented events (block place, etc.)
        plugin.getServer().getPluginManager().registerEvents(this, plugin);
        this.plugin = plugin;
    }

    @EventHandler
    public void onPlayerBedEnterEvent(PlayerBedEnterEvent event) {
        Player player = event.getPlayer();
        player.sendMessage(Integer.toString(player.getWorld().getWeatherDuration()));
    }

    @EventHandler
    public void onPlayerBedLeaveEvent(PlayerBedLeaveEvent event) {
        Player player = event.getPlayer();
        player.sendMessage(Integer.toString(player.getWorld().getWeatherDuration()));
    }
}

Modify to check weather duration


/* $This file is distributed under the terms of the license in /doc/license.txt$ */

package edu.cornell.mannlib.vitro.webapp.servlet.setup;

import javax.servlet.ServletContext;

public class AbortStartup {

    private static final String ATTRIBUTE_NAME = AbortStartup.class.getName();

    /**
     * Sets a context attribute to prevent other context listeners from running.
     */
    public static void abortStartup(ServletContext context) {
        context.setAttribute(ATTRIBUTE_NAME, new Boolean(true));
    }

    /**
     * Checks whether a previous context listener has caused startup to be aborted.
     */
    public static boolean isStartupAborted(ServletContext context) {
        return (context.getAttribute(ATTRIBUTE_NAME) != null);
    }

}

/* $This file is distributed under the terms of the license in /doc/license.txt$ */

package edu.cornell.mannlib.vitro.webapp.servlet.setup;

import javax.servlet.ServletContext;

/**
 * Provide a mechanism so a ServletContextListener can set a flag that tells
 * other ServletContextListeners not to run.
 *
 * The listener that detects a problem should still throw an exception, so
 * Tomcat will declare that the startup has failed and mark the application as
 * not runnable. However, Tomcat will still run the other listeners before
 * giving up. Hence, the need for this flag.
 *
 * If the other listeners are looking for this flag, they can (and should)
 * decide to simply exit rather than attempting to initialize.
 */
public class AbortStartup {

    private static final String ATTRIBUTE_NAME = AbortStartup.class.getName();

    /**
     * Sets a context attribute to prevent other context listeners from running.
     */
    public static void abortStartup(ServletContext context) {
        context.setAttribute(ATTRIBUTE_NAME, new Boolean(true));
    }

    /**
     * Checks whether a previous context listener has caused startup to be aborted.
     */
    public static boolean isStartupAborted(ServletContext context) {
        return (context.getAttribute(ATTRIBUTE_NAME) != null);
    }

}

Add a comment for the slow learners like me.


/*
 * This program was produced for the U.S. Agency for International Development. It was prepared by the USAID | DELIVER PROJECT, Task Order 4. It is part of a project which utilizes code originally licensed under the terms of the Mozilla Public License (MPL) v2 and therefore is licensed under MPL v2 or later.
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the Mozilla Public License as published by the Mozilla Foundation, either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License for more details.
 *
 * You should have received a copy of the Mozilla Public License along with this program. If not, see http://www.mozilla.org/MPL/
 */

package org.openlmis.rnr.domain;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@EqualsAndHashCode
public class FormulaOption {

  private List<Formula> formulas;

  public FormulaOption(String options){
    if(options != "DEFAULT"){
      ObjectMapper mapper = new ObjectMapper();
      try{
        formulas = mapper.readValue(options, new TypeReference(){}  );
      } catch(Exception exp){

      }
    }
  }

}

/*
 * This program was produced for the U.S. Agency for International Development. It was prepared by the USAID | DELIVER PROJECT, Task Order 4. It is part of a project which utilizes code originally licensed under the terms of the Mozilla Public License (MPL) v2 and therefore is licensed under MPL v2 or later.
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the Mozilla Public License as published by the Mozilla Foundation, either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License for more details.
 *
 * You should have received a copy of the Mozilla Public License along with this program. If not, see http://www.mozilla.org/MPL/
 */

package org.openlmis.rnr.domain;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@EqualsAndHashCode
public class FormulaOption {

  private List<Formula> formulas;

  public FormulaOption(String options){
    if(options != "DEFAULT"){
      ObjectMapper mapper = new ObjectMapper();
      try{
        formulas = mapper.readValue(options, new TypeReference<List<Formula>>(){}  );
      } catch(Exception exp){

      }
    }
  }

}

Fix mapper to convert json to formula options. fixes the custom formula to be selected on rnr template.


package com.iselsoft.ptest.runLineMarker;

import com.intellij.execution.lineMarker.RunLineMarkerContributor;
import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.iselsoft.ptest.runConfiguration.PTestConfigurationProducer;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.Nullable;

public class PTestRunLineMarkerContributor extends RunLineMarkerContributor {
    private static final PTestConfigurationProducer CONFIG_PRODUCER = new PTestConfigurationProducer();
    private static final Function<PsiElement, String> TOOLTIP_PROVIDER = new Function<PsiElement, String>() {
        @Override
        public String fun(PsiElement psiElement) {
            return "Run ptest";
        }
    };

    @Nullable
    @Override
    public Info getInfo(PsiElement psiElement) {
        if (psiElement instanceof PyFunction && CONFIG_PRODUCER.isPTestMethod(psiElement, null)) {
            return new Info(AllIcons.RunConfigurations.TestState.Run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());
        } else if (psiElement instanceof PyClass && CONFIG_PRODUCER.isPTestClass(psiElement, null)) {
            return new Info(AllIcons.RunConfigurations.TestState.Run_run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());
        }
        return null;
    }
}

package com.iselsoft.ptest.runLineMarker;

import com.intellij.execution.lineMarker.RunLineMarkerContributor;
import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.iselsoft.ptest.runConfiguration.PTestConfigurationProducer;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.Nullable;

public class PTestRunLineMarkerContributor extends RunLineMarkerContributor {
    private static final PTestConfigurationProducer CONFIG_PRODUCER = new PTestConfigurationProducer();
    private static final Function<PsiElement, String> TOOLTIP_PROVIDER = new Function<PsiElement, String>() {
        @Override
        public String fun(PsiElement psiElement) {
            return "Run ptest";
        }
    };

    @Nullable
    @Override
    public Info getInfo(PsiElement psiElement) {
        if (psiElement instanceof PyFunction && CONFIG_PRODUCER.isPTestMethod(psiElement, null)) {
            return new Info(AllIcons.RunConfigurations.TestState.Run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());
        } else if (psiElement instanceof PyClass && CONFIG_PRODUCER.isPTestClass(psiElement, null)) {
            try {
                return new Info(AllIcons.RunConfigurations.TestState.Run_run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());
            } catch (NoSuchFieldError e) {
                return new Info(AllIcons.RunConfigurations.TestState.Run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());
            }
        }
        return null;
    }
}

Fix no run_run icon in old pycharm version.


package org.pdxfinder.services.search;

import org.pdxfinder.services.ds.ModelForQuery;

import java.util.HashSet;
import java.util.Set;

/*
 * Created by csaba on 20/11/2018.
 */
public class OneParamSearch extends GeneralSearch{

    Set<ModelForQuery> models;

    public OneParamSearch(String name, String urlParam, Set<ModelForQuery> models) {
        super(name, urlParam);
        this.models = models;
    }

    public Set<ModelForQuery> getModels() {
        return models;
    }

    public void setModels(Set<ModelForQuery> models) {
        this.models = models;
    }

    public Set<Long> search(String param1){

        //TODO: Implement search logic on single selected parameter
        return new HashSet<>();
    }

}

package org.pdxfinder.services.search;

import org.pdxfinder.services.ds.ModelForQuery;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Function;

/*
 * Created by csaba on 20/11/2018.
 */
public class OneParamSearch extends GeneralSearch{

    //static Function a = ModelForQuery::getPatientAge;

    public OneParamSearch(String name, String urlParam) {
        super(name, urlParam);
    }

    public Set<ModelForQuery> search(List<String> param, List<ModelForQuery> mfq, Function searchFunc){

        //TODO: Implement search logic on single selected parameter
        return new HashSet<>();
    }

}

Remove MFQ from search object


/*
 *
 * 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.ohdsi.webapi.cohortdefinition;

import java.io.Serializable;
import javax.transaction.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 *
 * @author cknoll1
 */
public interface CohortDefinitionRepository extends CrudRepository<CohortDefinition, Integer> {
  Page<CohortDefinition> findAll(Pageable pageable);

  // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
  // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
  @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
  @Transactional
  CohortDefinition findById(Integer id);

}

/*
 *
 * 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.ohdsi.webapi.cohortdefinition;

import java.io.Serializable;
import javax.transaction.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 *
 * @author cknoll1
 */
public interface CohortDefinitionRepository extends CrudRepository<CohortDefinition, Integer> {
  Page<CohortDefinition> findAll(Pageable pageable);

  // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
  // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
  @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
  CohortDefinition findById(Integer id);
}

Revert @Transactional annotation on findById(). The hint @Type(type = "org.hibernate.type.TextType") eliminates need for transactions on postgres when dealing with TEXT columns.


package com.auth0.android.request.internal;

import org.robolectric.android.util.concurrent.RoboExecutorService;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

/**
 * Shadow that makes use of the {@link RoboExecutorService} to run background threads
 * as soon as they are posted (synchronously). Used only when classes or methods
 * are annotated with @Config(shadows = ThreadSwitcherShadow.class)
 *
 * @see https://github.com/robolectric/robolectric/issues/5645#issuecomment-627512678
 * @see http://robolectric.org/javadoc/4.3/org/robolectric/android/util/concurrent/RoboExecutorService.html
 */
@Implements(ThreadSwitcher.class)
@SuppressWarnings({"unused", "RedundantSuppression"})
public class ThreadSwitcherShadow {

    private final RoboExecutorService executor;

    public ThreadSwitcherShadow() {
        this.executor = new RoboExecutorService();
    }

    @Implementation
    public void backgroundThread(Runnable runnable) {
        executor.execute(runnable);
    }
}

package com.auth0.android.request.internal;

import org.robolectric.android.util.concurrent.InlineExecutorService;
import org.robolectric.android.util.concurrent.RoboExecutorService;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

/**
 * Shadow that makes use of the {@link RoboExecutorService} to run background threads
 * as soon as they are posted (synchronously). Used only when classes or methods
 * are annotated with @Config(shadows = ThreadSwitcherShadow.class)
 *
 * @see https://github.com/robolectric/robolectric/issues/5645#issuecomment-627512678
 * @see http://robolectric.org/javadoc/4.3/org/robolectric/android/util/concurrent/RoboExecutorService.html
 */
@Implements(ThreadSwitcher.class)
@SuppressWarnings({"unused", "RedundantSuppression"})
public class ThreadSwitcherShadow {

    private final InlineExecutorService executor;

    public ThreadSwitcherShadow() {
        this.executor = new InlineExecutorService();
    }

    @Implementation
    public void backgroundThread(Runnable runnable) {
        executor.execute(runnable);
    }
}

Stop using RoboExecutorService for background threads


package org.ovirt.mobile.movirt.ui.dashboard;

import android.os.Handler;
import android.util.Log;
import android.view.WindowManager;
import android.widget.ProgressBar;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import org.ovirt.mobile.movirt.R;
import org.ovirt.mobile.movirt.ui.MoVirtActivity;

@EActivity(R.layout.activity_dashboard)
public class DashboardActivity extends MoVirtActivity {
    private static final String TAG = DashboardActivity.class.getSimpleName();

    private static final long SYNC_PERIOD_MILLIS = 3 * 60 * 1000;

    @ViewById
    ProgressBar progress;

    private Handler handler = new Handler();

    @AfterViews
    void init() {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

        setProgressBar(progress);
    }

    @Override
    protected void onResume() {
        super.onResume();

        handler.post(syncRunnable);
    }

    @Override
    protected void onPause() {
        super.onPause();

        handler.removeCallbacks(syncRunnable);
    }

    private Runnable syncRunnable = new Runnable( ) {
        public void run ( ) {
            Log.d(TAG, "Sync data");

            onRefresh();

            handler.postDelayed(syncRunnable, SYNC_PERIOD_MILLIS);
        }
    };
}

package org.ovirt.mobile.movirt.ui.dashboard;

import android.os.Handler;
import android.util.Log;
import android.view.WindowManager;
import android.widget.ProgressBar;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import org.ovirt.mobile.movirt.R;
import org.ovirt.mobile.movirt.ui.MovirtActivity;

@EActivity(R.layout.activity_dashboard)
public class DashboardActivity extends MovirtActivity {
    private static final String TAG = DashboardActivity.class.getSimpleName();

    private static final long SYNC_PERIOD_MILLIS = 3 * 60 * 1000;

    @ViewById
    ProgressBar progress;

    private Handler handler = new Handler();

    @AfterViews
    void init() {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

        setProgressBar(progress);
    }

    @Override
    protected void onResume() {
        super.onResume();

        handler.post(syncRunnable);
    }

    @Override
    protected void onPause() {
        super.onPause();

        handler.removeCallbacks(syncRunnable);
    }

    private Runnable syncRunnable = new Runnable( ) {
        public void run ( ) {
            Log.d(TAG, "Sync data");

            onRefresh();

            handler.postDelayed(syncRunnable, SYNC_PERIOD_MILLIS);
        }
    };
}

Fix compile error after rebase


package com.intellij.jps.cache;

import com.intellij.openapi.components.ProjectComponent;

public class JpsCachesDummyProjectComponent implements ProjectComponent {
}

package com.intellij.jps.cache;

import com.intellij.compiler.CompilerWorkspaceConfiguration;
import com.intellij.compiler.server.BuildManager;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationAction;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

import static com.intellij.jps.cache.ui.JpsLoaderNotifications.STICKY_NOTIFICATION_GROUP;

public class JpsCachesDummyProjectComponent implements ProjectComponent {
  private static final String NOT_ASK_AGAIN = "JpsCaches.NOT_ASK_AGAIN";
  private final Project myProject;
  private final PropertiesComponent myPropertiesComponent;
  private final CompilerWorkspaceConfiguration myWorkspaceConfiguration;

  public JpsCachesDummyProjectComponent(@NotNull Project project) {
    myProject = project;
    myPropertiesComponent = PropertiesComponent.getInstance(project);
    myWorkspaceConfiguration = CompilerWorkspaceConfiguration.getInstance(myProject);
  }

  @Override
  public void projectOpened() {
    if (myWorkspaceConfiguration.MAKE_PROJECT_ON_SAVE && !myPropertiesComponent.getBoolean(NOT_ASK_AGAIN, false)) {
      Notification notification = STICKY_NOTIFICATION_GROUP.createNotification("Automatic project build enabled",
                                                                               "Make project automatically enabled, it can affect portable caches",
                                                                               NotificationType.WARNING, null);
      notification.addAction(NotificationAction.createSimple("Disable Property", () -> {
        myWorkspaceConfiguration.MAKE_PROJECT_ON_SAVE = false;
        BuildManager.getInstance().clearState(myProject);
        notification.expire();
      }));
      notification.addAction(NotificationAction.createSimple("Don't ask again", () -> {
        myPropertiesComponent.setValue(NOT_ASK_AGAIN, true);
        notification.expire();
      }));
      Notifications.Bus.notify(notification, myProject);
    }
  }
}

Add notification if automatic project build property enabled


package com.box.l10n.mojito.cli.command;

import com.box.l10n.mojito.cli.CLITestBase;
import org.junit.Test;

public class SimpleFileEditorCommandTest extends CLITestBase {

    @Test
    public void jsonIndent() {
        getL10nJCommander().run("simple-file-editor",
                "-i", getInputResourcesTestDir().getAbsolutePath(),
                "-o", getTargetTestDir().getAbsolutePath(),
                 "--json-indent");

        checkExpectedGeneratedResources();
    }

    @Test
    public void poRemoveUsages() {
        getL10nJCommander().run("simple-file-editor",
                "-i", getInputResourcesTestDir().getAbsolutePath(),
                "-o", getTargetTestDir().getAbsolutePath(),
                "--po-remove-usages"
                );

        checkExpectedGeneratedResources();
    }

    @Test
    public void macStringsRemoveUsages() {

        System.setProperty("overrideExpectedTestFiles", "true");

        getL10nJCommander().run("simple-file-editor",
                "-i", getInputResourcesTestDir().getAbsolutePath(),
                "-o", getTargetTestDir().getAbsolutePath(),
                "--macstrings-remove-usages"
        );

        checkExpectedGeneratedResources();
    }
}

package com.box.l10n.mojito.cli.command;

import com.box.l10n.mojito.cli.CLITestBase;
import org.junit.Test;

public class SimpleFileEditorCommandTest extends CLITestBase {

    @Test
    public void jsonIndent() {
        getL10nJCommander().run("simple-file-editor",
                "-i", getInputResourcesTestDir().getAbsolutePath(),
                "-o", getTargetTestDir().getAbsolutePath(),
                 "--json-indent");

        checkExpectedGeneratedResources();
    }

    @Test
    public void poRemoveUsages() {
        getL10nJCommander().run("simple-file-editor",
                "-i", getInputResourcesTestDir().getAbsolutePath(),
                "-o", getTargetTestDir().getAbsolutePath(),
                "--po-remove-usages"
                );

        checkExpectedGeneratedResources();
    }

    @Test
    public void macStringsRemoveUsages() {

        getL10nJCommander().run("simple-file-editor",
                "-i", getInputResourcesTestDir().getAbsolutePath(),
                "-o", getTargetTestDir().getAbsolutePath(),
                "--macstrings-remove-usages"
        );

        checkExpectedGeneratedResources();
    }
}

Remove expected file override in test


/****************************************************************************
 * Copyright (C) 2019 ecsec GmbH.
 * All rights reserved.
 * Contact: ecsec GmbH (info@ecsec.de)
 *
 * This file is part of the Open eCard App.
 *
 * GNU General Public License Usage
 * This file may be used under the terms of the GNU General Public
 * License version 3.0 as published by the Free Software Foundation
 * and appearing in the file LICENSE.GPL included in the packaging of
 * this file. Please review the following information to ensure the
 * GNU General Public License version 3.0 requirements will be met:
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Other Usage
 * Alternatively, this file may be used in accordance with the terms
 * and conditions contained in a signed written agreement between
 * you and ecsec GmbH.
 *
 ***************************************************************************/
package org.openecard.ios.activation;

import org.openecard.mobile.activation.NFCCapabilities;
import org.openecard.mobile.activation.NfcCapabilityResult;

/**
 *
 * @author Neil Crossley
 */
public class IOSNFCCapabilities implements NFCCapabilities {

    @Override
    public boolean isAvailable() {
	return true;
    }

    @Override
    public boolean isEnabled() {
	return true;
    }

    @Override
    public NfcCapabilityResult checkExtendedLength() {
	return NfcCapabilityResult.QUERY_NOT_ALLOWED;
    }

}

/****************************************************************************
 * Copyright (C) 2019 ecsec GmbH.
 * All rights reserved.
 * Contact: ecsec GmbH (info@ecsec.de)
 *
 * This file is part of the Open eCard App.
 *
 * GNU General Public License Usage
 * This file may be used under the terms of the GNU General Public
 * License version 3.0 as published by the Free Software Foundation
 * and appearing in the file LICENSE.GPL included in the packaging of
 * this file. Please review the following information to ensure the
 * GNU General Public License version 3.0 requirements will be met:
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Other Usage
 * Alternatively, this file may be used in accordance with the terms
 * and conditions contained in a signed written agreement between
 * you and ecsec GmbH.
 *
 ***************************************************************************/
package org.openecard.ios.activation;

import org.openecard.mobile.activation.NFCCapabilities;
import org.openecard.mobile.activation.NfcCapabilityResult;
import org.robovm.apple.corenfc.NFCReaderSession;

/**
 *
 * @author Neil Crossley
 */
public class IOSNFCCapabilities implements NFCCapabilities {

    @Override
    public boolean isAvailable() {
	return NFCReaderSession.isReadingAvailable();
    }

    @Override
    public boolean isEnabled() {
	return true;
    }

    @Override
    public NfcCapabilityResult checkExtendedLength() {
	return NfcCapabilityResult.QUERY_NOT_ALLOWED;
    }

}

Add iOS specific check for NFC capabilities.


package se.soy.gpg;

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

public class GPG {
  // FIXME Remove when done
  static<T> void println(T arg) { System.out.println(arg); }

  public static void main(String[] args) {
    println("main");
    GPG.encrypt().armor().recipient("0xrecipient").output();
    /*
    GPG.encrypt().armor().recipient("0xrecipient").output();
    GPG.decrypt().armor().local-user("0xlocaluser").output("/tmp/a-file");
    GPG.sign().armor().();
    */
  }

  private boolean armor = false;
  private List<String> recipients = new ArrayList<String>();

  public void output() {
    println("OPTIONS:");
    println(String.format("armor?: %s", (armor) ? "true" : "false"));
    println(String.format("recipients?: %s", recipients));
  }

  public static GPG encrypt() {
    GPG gpg = new GPG();
    println("encrypt()");
    return gpg;
  }

  public GPG armor() {
    this.armor = true;
    return this;
  }

  public GPG recipient(String recipient) {
    this.recipients.add(recipient);
    return this;
  }
}

package se.soy.gpg;

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

public class GPG {
  // FIXME Remove when done
  static<T> void println(T arg) { System.out.println(arg); }

  public static void main(String[] args) {
    println("main");
    GPG.encrypt().armor().recipient("0xrecipient").output();
    /*
    GPG.encrypt().armor().recipient("0xrecipient").output();
    GPG.decrypt().armor().local-user("0xlocaluser").output("/tmp/a-file");
    GPG.sign().armor().();
    */
  }

  private String mode;
  private boolean armor = false;
  private List<String> recipients = new ArrayList<String>();

  public void output() {
    println("OPTIONS:");
    println(String.format("mode: %s", mode));
    println(String.format("armor?: %s", (armor) ? "true" : "false"));
    println(String.format("recipients?: %s", recipients));
  }

  public static GPG encrypt() {
    GPG gpg = new GPG();
    gpg.mode = "encrypt";
    return gpg;
  }

  public GPG armor() {
    this.armor = true;
    return this;
  }

  public GPG recipient(String recipient) {
    this.recipients.add(recipient);
    return this;
  }
}

Set a mode instead of prining it


package org.eclipse.scanning.api.scan.rank;

import org.eclipse.scanning.api.points.AbstractPosition;
import org.eclipse.scanning.api.points.IPosition;

/**
 *
 * Please use this class to figure out the correct slice
 * from a position in a scan.
 *
 * @author Matthew Gerring
 *
 */
class ScanRankService implements IScanRankService {

	public IScanSlice createScanSlice(IPosition position, int... datashape) {

		final int scanRank = position.getScanRank();
		if (scanRank==0) throw new IllegalArgumentException("A zero scan rank is not allowed");

		final int[] start = new int[scanRank+datashape.length];
		final int[] stop  = new int[scanRank+datashape.length];

		for (int dim = 0; dim < scanRank; dim++) {
			start[dim] = position.getIndex(dim);
			stop[dim]  = position.getIndex(dim)+1;
		}

		int index = 0;
		for (int i = datashape.length; i>0; i--) {
			start[start.length-i] = 0;
			stop[stop.length-i]  = datashape[index];
			index++;
		}

		return new ScanSlice(start, stop, null);
	}

}

package org.eclipse.scanning.api.scan.rank;

import org.eclipse.scanning.api.points.IPosition;

/**
 *
 * Please use this class to figure out the correct slice
 * from a position in a scan.
 *
 * @author Matthew Gerring
 *
 */
class ScanRankService implements IScanRankService {

	public IScanSlice createScanSlice(IPosition position, int... datashape) {

		final int scanRank = position.getScanRank();
		final int[] start = new int[scanRank+datashape.length];
		final int[] stop  = new int[scanRank+datashape.length];

		for (int dim = 0; dim < scanRank; dim++) {
			start[dim] = position.getIndex(dim);
			stop[dim]  = position.getIndex(dim)+1;
		}

		int index = 0;
		for (int i = datashape.length; i>0; i--) {
			start[start.length-i] = 0;
			stop[stop.length-i]  = datashape[index];
			index++;
		}

		return new ScanSlice(start, stop, null);
	}

}

Revert "Added exception is scan rank is 0 which it is when scanning broken."


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

package com.lambdasoup.appbarsyncedfabSample;

import android.view.View;

public class ComplexAppBarActivity extends BaseAppBarActivity {

    @Override
    protected void onBeforeInflateAppBarLayout() {
        View coordinatorLayout = findViewById(R.id.coordinator_layout);
        // Because we're using a single base layout, for proper appearance
        // of the collapsing toolbar layout, we need to do this programmatically.
        // Waiting for https://code.google.com/p/android/issues/detail?id=212720 to get resolved
        // so this has a chance to work; until then this is a reminder for users of CollapsingToolbarLayout.
        //noinspection ConstantConditions
        coordinatorLayout.setFitsSystemWindows(true);
    }

    @Override
    protected int getAppBarLayoutResource() {
        return R.layout.app_bar_complex_collapsing_app_bar;
    }

    @Override
    protected int getNavId() {
        return R.id.nav_complex_app_bar;
    }
}

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

package com.lambdasoup.appbarsyncedfabSample;

import android.view.View;

public class ComplexAppBarActivity extends BaseAppBarActivity {

    @Override
    protected void onBeforeInflateAppBarLayout() {
        View coordinatorLayout = findViewById(R.id.coordinator_layout);
        // Because we're using a single base layout, for proper appearance
        // of the collapsing toolbar layout, we need to do this programmatically.
        //noinspection ConstantConditions
        coordinatorLayout.setFitsSystemWindows(true);
    }

    @Override
    protected int getAppBarLayoutResource() {
        return R.layout.app_bar_complex_collapsing_app_bar;
    }

    @Override
    protected int getNavId() {
        return R.id.nav_complex_app_bar;
    }
}

Remove comment superseded by support library changes


package com.github.steveice10.mc.protocol.data.game.world.particle;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;

@Data
@AllArgsConstructor
public class Particle {
    private final @NonNull ParticleType type;
    private final @NonNull ParticleData data;
}

package com.github.steveice10.mc.protocol.data.game.world.particle;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;

@Data
@AllArgsConstructor
public class Particle {
    private final @NonNull ParticleType type;
    private final ParticleData data;
}

Fix particle data being marked as non-null.


package io.iron.ironmq;

import java.io.IOException;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

public class IronMQTest {
    private String projectId;
    private String token;

    @Before public void setup() {
        projectId = System.getenv("IRON_PROJECT_ID");
        token = System.getenv("IRON_TOKEN");
        Assume.assumeTrue(projectId != null && token != null);
    }

    @Test public void testClient() throws IOException {
        Client c = new Client(projectId, token, Cloud.ironAWSUSEast);
        Queue q = c.queue("test-queue");

        q.clear();

        Assert.assertEquals(0, q.getSize());

        final String body = "Hello, IronMQ!";

        String id = q.push(body);

        Assert.assertEquals(1, q.getSize());

        Message msg = q.get();
        Assert.assertEquals(body, msg.getBody());
        Assert.assertEquals(id, msg.getId());
        q.deleteMessage(msg);
    }

    @Test(expected=HTTPException.class) public void testErrorResponse() throws IOException {
        // intentionally invalid project/token combination
        Client c = new Client("4444444444444", "aaaaaa", Cloud.ironAWSUSEast);
        Queue q = c.queue("test-queue");

        q.push("test");
    }
}

package io.iron.ironmq;

import java.io.IOException;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

public class IronMQTest {
    @Test public void testClient() throws IOException {
        Client c = new Client();
        Queue q = c.queue("test-queue");

        q.clear();

        Assert.assertEquals(0, q.getSize());

        final String body = "Hello, IronMQ!";

        String id = q.push(body);

        Assert.assertEquals(1, q.getSize());

        Message msg = q.get();
        Assert.assertEquals(body, msg.getBody());
        Assert.assertEquals(id, msg.getId());
        q.deleteMessage(msg);
    }

    @Test(expected=HTTPException.class) public void testErrorResponse() throws IOException {
        // intentionally invalid project/token combination
        Client c = new Client("4444444444444", "aaaaaa", Cloud.ironAWSUSEast);
        Queue q = c.queue("test-queue");

        q.push("test");
    }
}

Make test use configuration logic


package com.gildedrose;

import com.gildedrose.handler.FactoryHandler;
import com.gildedrose.handler.ItemHandler;

import static com.gildedrose.ItemOperations.decreaseSellin;

class GildedRose {

    public static final String SULFURAS = "Sulfuras, Hand of Ragnaros";

    public static final int MAX_QUALITY = 50;

    Item[] items;

    public GildedRose(Item[] items) {
        this.items = items;
    }

    public void updateQuality() {

        for (int i = 0; i < items.length; i++) {

            Item item = items[i];

            ItemHandler handler = FactoryHandler.getHandler(item);

            if (null != handler){
                handler.update(item);
            } else if (item.name.equals(SULFURAS)) {
                updateQualitySulfuras(item);
            } else {
                decreaseSellin(item);
                updateQualityOther(item);
            }
        }
    }

    private void updateQualityOther(Item item) {
        ItemOperations.decreaseQuality(item, item1 -> item1.quality >0);
        ItemOperations.decreaseQuality(item, item1 -> item1.sellIn<0 && item1.quality>0);
    }

    private void updateQualitySulfuras(Item item) {

    }

}

package com.gildedrose;

import com.gildedrose.handler.FactoryHandler;
import com.gildedrose.handler.ItemHandler;

import static com.gildedrose.ItemOperations.decreaseSellin;

class GildedRose {

    public static final int MAX_QUALITY = 50;

    Item[] items;

    public GildedRose(Item[] items) {
        this.items = items;
    }

    public void updateQuality() {

        for (int i = 0; i < items.length; i++) {

            Item item = items[i];

            ItemHandler handler = FactoryHandler.getHandler(item);

            if (null != handler){
                handler.update(item);
            } else {
                decreaseSellin(item);
                updateQualityOther(item);
            }
        }
    }

    private void updateQualityOther(Item item) {
        ItemOperations.decreaseQuality(item, item1 -> item1.quality >0);
        ItemOperations.decreaseQuality(item, item1 -> item1.sellIn<0 && item1.quality>0);
    }

}

Use sulfuras handler in main class


package rod;

public class DummyAnalyzer implements Analyzer {

    private ObservationToCommandMapping observationToCommand;

    public void setObservationToCommand(ObservationToCommandMapping observationToCommand) {
        this.observationToCommand = observationToCommand;
    }

    @Override
    public Command analyze(Observation observation) throws UnrecognizableObservationException {
        if (observationToCommand.containsKey(observation.getClass())) {
            return observationToCommand.get(observation.getClass()).build();
        } else {
            throw new UnrecognizableObservationException(observation);
        }
    }

}

package rod;

public class DummyAnalyzer implements Analyzer {

    private ObservationToCommandMapping observationToCommand;

    public void setObservationToCommand(final ObservationToCommandMapping observationToCommand) {
        this.observationToCommand = observationToCommand;
    }

    @Override
    public Command analyze(final Observation observation) throws UnrecognizableObservationException {
        if (observationToCommand.containsKey(observation.getClass())) {
            return observationToCommand.get(observation.getClass()).build();
        } else {
            throw new UnrecognizableObservationException(observation);
        }
    }

}

Add final to method parameters


package kawa.lang;

/**
 * Class used to mark an erroreous expression
 * @author	Per Bothner
 */

public class ErrorExp extends Expression
{
  String message;
  public ErrorExp (String message)
  {
    this.message = message;
  }

  public Object eval (Environment env)
       throws UnboundSymbol, WrongArguments, WrongType, GenericError
  {
    // Should not happen
    throw new GenericError ("evaluated erroreous expression: " + message);
  }

  public void print (java.io.PrintWriter ps)
  {
    ps.print ("(%error ");
    ps.print (message);
    ps.print (")");
  }

  public void compile (Compilation comp, Target target)
  {
    // Should never happen!
  }
}

package kawa.lang;

/**
 * Class used to mark an erroneous expression
 * @author	Per Bothner
 */

public class ErrorExp extends Expression
{
  String message;
  public ErrorExp (String message)
  {
    this.message = message;
  }

  public Object eval (Environment env)
       throws UnboundSymbol, WrongArguments, WrongType, GenericError
  {
    // Should not happen
    throw new GenericError ("evaluated erroneous expression: " + message);
  }

  public void print (java.io.PrintWriter ps)
  {
    ps.print ("(%error ");
    ps.print (message);
    ps.print (")");
  }

  public void compile (Compilation comp, Target target)
  {
    // Should never happen!
  }
}

Fix typo "erroreous" -> "erroneous" (twice)s.


package sbt_inc;

import org.apache.maven.plugin.logging.Log;
import sbt.util.Level;
import sbt.util.Logger;
import scala.Enumeration;
import scala.Function0;

public class SbtLogger extends Logger {

    private final Log log;

    SbtLogger(Log l) {
        this.log = l;
    }

    @Override
    public void trace(Function0<Throwable> t) {
        if (log.isDebugEnabled()) {
            log.debug(t.apply());
        }
    }

    @Override
    public void success(Function0<String> message) {
        if (log.isInfoEnabled()) {
            log.info("Success: " + message.apply());
        }
    }

    @Override
    public void log(Enumeration.Value level, Function0<String> message) {
        if (level.equals(Level.Error())) {
            log.error(message.apply());
        } else if (level.equals(Level.Warn())) {
            log.warn(message.apply());
        } else if (level.equals(Level.Info())) {
            log.info(message.apply());
        } else if (level.equals(Level.Debug())) {
            log.debug(message.apply());
        }
    }
}

package sbt_inc;

import org.apache.maven.plugin.logging.Log;
import sbt.util.Level;
import sbt.util.Logger;
import scala.Enumeration;
import scala.Function0;

public class SbtLogger extends Logger {

    private final Log log;

    SbtLogger(Log l) {
        this.log = l;
    }

    @Override
    public void trace(Function0<Throwable> t) {
        if (log.isDebugEnabled()) {
            log.debug(t.apply());
        }
    }

    @Override
    public void success(Function0<String> message) {
        if (log.isInfoEnabled()) {
            log.info("Success: " + message.apply());
        }
    }

    @Override
    public void log(Enumeration.Value level, Function0<String> message) {
        String s = message.apply();
        String prefix = "[" + level.toString() + "] ";
        if (s.regionMatches(true, 0, prefix, 0, prefix.length())) {
            s = s.substring(prefix.length());
        }
        if (level.equals(Level.Error())) {
            log.error(s);
        } else if (level.equals(Level.Warn())) {
            log.warn(s);
        } else if (level.equals(Level.Info())) {
            log.info(s);
        } else if (level.equals(Level.Debug())) {
            log.debug(s);
        }
    }
}

Remove log-level prefix from incoming Sbt log messages


package com.rmd.personal.projecteuler;

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

public final class Common {

    private static final int MAX_PRIME_VALUE = 20000000;

    private Common() {

    }

    private static List<Long> primes;

    static {
        primes = new LinkedList<Long>();
        populatePrimesUpTo(MAX_PRIME_VALUE);
    }

    protected static List<Long> getPrimes() {
        return primes;
    }

    private static void populatePrimesUpTo(int end) {
        System.out.println("populating primes up to: " + end);
        Date startTime = new Date();

        boolean[] values = new boolean[end];

        for (int i = 2; i < end; i++) {
            if (!values[i]) {
                primes.add((long) i);
                for (int j = i; j < end; j += i) {
                    values[j] = true;
                }
            }
        }
        Date endTime = new Date();

        System.out.println("done - took " + (endTime.getTime() - startTime.getTime()) + " ms.");
    }

    protected static long sumPrimesUpTo(int end) {
        boolean[] values = new boolean[end];

        long sum = 0;

        for (int i = 2; i < end; i++) {
            if (!values[i]) {
                primes.add((long) i);
                sum += i;
                for (int j = i; j < end; j += i) {
                    values[j] = true;
                }
            }
        }
        return sum;
    }

    protected static long sum(long n) {
        return (n * (n + 1)) / 2;
    }
}

package com.rmd.personal.projecteuler;

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

public final class Common {

    private static final int MAX_PRIME_VALUE = 10000000;

    private Common() {

    }

    private static List<Long> primes;

    static {
        primes = new LinkedList<Long>();
        populatePrimesUpTo(MAX_PRIME_VALUE);
    }

    protected static List<Long> getPrimes() {
        return primes;
    }

    private static void populatePrimesUpTo(int end) {
        System.out.println("populating primes up to: " + end);
        Date startTime = new Date();

        boolean[] values = new boolean[end];

        for (int i = 2; i < end; i++) {
            if (!values[i]) {
                primes.add((long) i);
                for (int j = i; j < end; j += i) {
                    values[j] = true;
                }
            }
        }
        Date endTime = new Date();

        System.out.println("done - took " + (endTime.getTime() - startTime.getTime()) + " ms.");
    }

    protected static long sum(long n) {
        return (n * (n + 1)) / 2;
    }
}

Reduce primes calculated by a factor of ten.