package com.gdxjam.base.android;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.gdxjam.Main;

public class AndroidLauncher extends AndroidApplication {
	@Override
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
		config.useImmersiveMode = true;
		initialize(new Main(), config);
	}
}

package com.gdxjam.base.android;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.gdxjam.Main;

public class AndroidLauncher extends AndroidApplication {
	@Override
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
		initialize(new Main(), config);
	}
}

Revert "Android build now uses immersive mode."

This reverts commit fee8b18cf00d8d566e35ae2d97d413d1f15c36af.


package com.github.aureliano.verbum_domini.domain.bean;

import java.io.Serializable;

public interface IBean extends Serializable {

	public abstract <T extends Object> T toResource();
}

package com.github.aureliano.verbum_domini.domain.bean;

import java.io.Serializable;

public interface IBean extends Serializable {

	public abstract Integer getId();

	public abstract <T extends Object> T toResource();
}

Define id reader as contract method.

Define id reader as contract method.


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

package com.skelril.skree.content.world;

import com.flowpowered.math.vector.Vector3i;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.world.World;
import org.spongepowered.api.world.extent.ImmutableBiomeArea;
import org.spongepowered.api.world.extent.MutableBlockVolume;
import org.spongepowered.api.world.gen.GenerationPopulator;

public class VoidTerrainGenerator implements GenerationPopulator {
    @Override
    public void populate(World world, MutableBlockVolume buffer, ImmutableBiomeArea biomes) {
        Vector3i min = buffer.getBlockMin();
        Vector3i max = buffer.getBlockMax();
        for (int x = min.getX(); x <= max.getX(); ++x) {
            for (int z = min.getZ(); z <= max.getZ(); ++z) {
                buffer.setBlockType(x, 0, z, BlockTypes.BEDROCK);
                buffer.setBlockType(x, 1, z, BlockTypes.STONE);
                buffer.setBlockType(x, 5, z, BlockTypes.STONE);
            }
        }
    }
}

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

package com.skelril.skree.content.world;

import org.spongepowered.api.world.World;
import org.spongepowered.api.world.extent.ImmutableBiomeArea;
import org.spongepowered.api.world.extent.MutableBlockVolume;
import org.spongepowered.api.world.gen.GenerationPopulator;

public class VoidTerrainGenerator implements GenerationPopulator {
    @Override
    public void populate(World world, MutableBlockVolume buffer, ImmutableBiomeArea biomes) {

    }
}

Revert changes to the Void Terrain Generator


package com.alexrnl.commons.utils.object;

import static org.junit.Assert.fail;

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

/**
 * Test suite for the {@link ComparisonError} class.
 * @author Alex
 */
public class ComparisonErrorTest {

	/**
	 * Set up attributes.
	 */
	@Before
	public void setUp () {
	}

	/**
	 * Test method for {@link java.lang.Throwable#getMessage()}.
	 */
	@Test
	public void testGetMessage () {
		fail("Not yet implemented"); // TODO
	}

	/**
	 * Test method for {@link java.lang.Throwable#getCause()}.
	 */
	@Test
	public void testGetCause () {
		fail("Not yet implemented"); // TODO
	}
}

package com.alexrnl.commons.utils.object;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import org.junit.Test;

/**
 * Test suite for the {@link ComparisonError} class.
 * @author Alex
 */
public class ComparisonErrorTest {
	/** A blank error */
	private final ComparisonError	blank			= new ComparisonError();
	/** An error with a message */
	private final ComparisonError	message			= new ComparisonError("Error while comparing Integer");
	/** An error with a code */
	private final ComparisonError	cause			= new ComparisonError(new RuntimeException());
	/** An error with a message and a code */
	private final ComparisonError	messageAndCause	= new ComparisonError("Error while comparing Dummy", new NullPointerException());

	/**
	 * Test method for {@link java.lang.Throwable#getMessage()}.
	 */
	@Test
	public void testGetMessage () {
		assertNull(blank.getMessage());
		assertEquals("Error while comparing Integer", message.getMessage());
		assertEquals(RuntimeException.class.getName(), cause.getMessage());
		assertEquals("Error while comparing Dummy", messageAndCause.getMessage());
	}

	/**
	 * Test method for {@link java.lang.Throwable#getCause()}.
	 */
	@Test
	public void testGetCause () {
		assertNull(blank.getCause());
		assertNull(message.getCause());
		assertEquals(RuntimeException.class, cause.getCause().getClass());
		assertEquals(NullPointerException.class, messageAndCause.getCause().getClass());
	}
}

Implement tests of ComparisonError class


package cpw.mods.fml.common.event;

import cpw.mods.fml.common.LoaderState.ModState;

public class FMLPostInitializationEvent extends FMLStateEvent
{
    public FMLPostInitializationEvent(Object... data)
    {
        super(data);
    }

    @Override
    public ModState getModState()
    {
        return ModState.POSTINITIALIZED;
    }

}

package cpw.mods.fml.common.event;

import com.google.common.base.Throwables;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderState.ModState;

public class FMLPostInitializationEvent extends FMLStateEvent
{
    public FMLPostInitializationEvent(Object... data)
    {
        super(data);
    }

    @Override
    public ModState getModState()
    {
        return ModState.POSTINITIALIZED;
    }

    public Object buildSoftDependProxy(String modId, String className)
    {
        if (Loader.isModLoaded(modId))
        {
            try
            {
                Class<?> clz = Class.forName(className,true,Loader.instance().getModClassLoader());
                return clz.newInstance();
            }
            catch (Exception e)
            {
                Throwables.propagateIfPossible(e);
                return null;
            }
        }
        return null;
    }
}

Add in a convenience method for getting a class instance based on existence of another Mod. Useful for soft dependencies.


package org.vovkasm.WebImage;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.Collections;
import java.util.List;

public class WebImagePackage implements ReactPackage {

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

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

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

package org.vovkasm.WebImage;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.Collections;
import java.util.List;

public class WebImagePackage implements ReactPackage {

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

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

Fix for RN 0.47 breaking change.

Fix for RN 0.47 breaking change.


package com.xmartlabs.template.module;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.Date;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Created by santiago on 23/10/15.
 */
@Module
public class GsonModule {
  @Provides
  @Singleton
  public Gson provideGson() {
    return new GsonBuilder()
        .registerTypeAdapter(Date.class, new GsonUtcDateAdapter())
        .create();
  }
}

package com.xmartlabs.template.module;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.xmartlabs.template.BuildConfig;

import java.util.Date;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Created by santiago on 23/10/15.
 */
@Module
public class GsonModule {
  @Provides
  @Singleton
  public Gson provideGson() {
    GsonBuilder gsonBuilder = new GsonBuilder()
        .registerTypeAdapter(Date.class, new GsonUtcDateAdapter());

    if (BuildConfig.DEBUG) {
      gsonBuilder.setPrettyPrinting();
    }

    return gsonBuilder
        .create();
  }
}

Enable pretty printing of JSON in logs

Enable pretty printing of JSON in logs


package modules.storage;

import com.google.inject.AbstractModule;
import play.Configuration;
import play.Environment;

public class StorageModule extends AbstractModule {
    private final Environment environment;
    private final Configuration configuration;

    public StorageModule(Environment environment, Configuration configuration) {
        this.environment = environment;
        this.configuration = configuration;
    }

    @Override
    protected void configure() {
        String storageType = configuration.getString("storage.type", "mock");

        switch (storageType) {
            case "mock" :
                bind (Storage.class).to(MockStorage.class);
                break;
            case "local" :
                bind (Storage.class).to(LocalFilesystemStorage.class);
                break;
            case "s3" :
                bind (Storage.class).to(AmazonS3Storage.class);
                break;
        }
    }
}

package modules.storage;

import com.google.inject.AbstractModule;
import play.Configuration;
import play.Environment;

public class StorageModule extends AbstractModule {
    private final Environment environment;
    private final Configuration configuration;

    public StorageModule(Environment environment, Configuration configuration) {
        this.environment = environment;
        this.configuration = configuration;
    }

    @Override
    protected void configure() {
        String storageType = configuration.getString("storage.type", "local");

        switch (storageType) {
            case "mock" :
                bind (Storage.class).to(MockStorage.class);
                break;
            case "local" :
                bind (Storage.class).to(LocalFilesystemStorage.class);
                break;
            case "s3" :
                bind (Storage.class).to(AmazonS3Storage.class);
                break;
        }
    }
}

Set local storage as default storage type


package br.com.bloder.blormlib;

import android.view.View;

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

import br.com.bloder.blormlib.validation.Validate;
import br.com.bloder.blormlib.validation.Validation;

/**
 * Created by bloder on 05/06/16.
 */
public class Blorm {

  public static class Builder {

    private List<Validate> validations;
    private View field;

    public Builder() {
      validations = new ArrayList<>();
    }

    public Builder field(View field) {
      this.field = field;
      return this;
    }

    public Builder is(Validate validation) {
      this.validations.add(validation);
      return this;
    }

    public Builder is(Validation validation) {
      validation.field = this.field;
      this.validations.add(validation.validate());
      return this;
    }

    public Builder is(String errorMessgae, Validation validation) {
      validation.field = this.field;
      validation.errorMessage = errorMessgae;
      this.validations.add(validation.validate());
      return this;
    }

    public void onSubmit(View submittedItem) {
      new Blorm(this.validations).onSubmitted();
    }
  }

  private List<Validate> validations;

  public Blorm(List<Validate> validations) {
    this.validations = validations;
  }

  private void onSubmitted() {
    for(Validate validate : validations) {
      if(!validate.validate()) {
        validate.onError();
      }
    }
  }
}

package br.com.bloder.blormlib;

import android.view.View;

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

import br.com.bloder.blormlib.validation.Validate;
import br.com.bloder.blormlib.validation.Validation;

/**
 * Created by bloder on 05/06/16.
 */
public class Blorm {

  public static class Builder {

    private List<Validate> validations;
    private View field;

    public Builder() {
      validations = new ArrayList<>();
    }

    public Builder field(View field) {
      this.field = field;
      return this;
    }

    public Builder is(Validate validation) {
      this.validations.add(validation);
      return this;
    }

    public Builder is(Validation validation) {
      validation.field = this.field;
      this.validations.add(validation.validate());
      return this;
    }

    public Builder is(String errorMessgae, Validation validation) {
      validation.field = this.field;
      validation.errorMessage = errorMessgae;
      this.validations.add(validation.validate());
      return this;
    }

    public void onSubmit(View submittedItem) {
      submittedItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          new Blorm(validations).onSubmitted();
        }
      });
    }
  }

  private List<Validate> validations;

  public Blorm(List<Validate> validations) {
    this.validations = validations;
  }

  private void onSubmitted() {
    for(Validate validate : validations) {
      if(!validate.validate()) {
        validate.onError();
      }
    }
  }
}

Add on click listener in on submit function


package com.mooo.aimmac23.hub.proxy;

import java.util.Map;

import org.openqa.grid.internal.utils.CapabilityMatcher;

public class ReliableCapabilityMatcher implements CapabilityMatcher {

	private CapabilityMatcher innerMatcher;
	private ReliableProxy proxy;

	public ReliableCapabilityMatcher(ReliableProxy proxy, CapabilityMatcher innerMatcher) {
		this.proxy = proxy;
		this.innerMatcher = innerMatcher;
	}

	@Override
	public boolean matches(Map<String, Object> currentCapability,
			Map<String, Object> requestedCapability) {

		// to allow the node to be tested
		if(requestedCapability.containsKey("proxyId")) {
			return innerMatcher.matches(currentCapability, requestedCapability);
		}

		// check to see if we're allowed to use that config
		if(!proxy.isCapabilityWorking(currentCapability)) {
			return false;
		}

		// otherwise, match on the capabilities
		return innerMatcher.matches(currentCapability, requestedCapability);
	}
}

package com.mooo.aimmac23.hub.proxy;

import java.util.Map;

import org.openqa.grid.internal.utils.CapabilityMatcher;

public class ReliableCapabilityMatcher implements CapabilityMatcher {

	private CapabilityMatcher innerMatcher;
	private ReliabilityAwareProxy proxy;

	public ReliableCapabilityMatcher(ReliabilityAwareProxy proxy, CapabilityMatcher innerMatcher) {
		this.proxy = proxy;
		this.innerMatcher = innerMatcher;
	}

	@Override
	public boolean matches(Map<String, Object> currentCapability,
			Map<String, Object> requestedCapability) {

		// to allow the node to be tested - we're calling enough internal
		// methods to ensure that we're calling this on the correct node
		if(requestedCapability.containsKey("proxyId")) {
			return innerMatcher.matches(currentCapability, requestedCapability);
		}

		// check to see if we're allowed to use that config
		if(!proxy.isCapabilityWorking(currentCapability)) {
			return false;
		}

		// otherwise, match on the capabilities
		return innerMatcher.matches(currentCapability, requestedCapability);
	}
}

Use the interface for this

Use the interface for this


package net.aeten.core.spi.factory;

import java.util.concurrent.atomic.AtomicInteger;

import net.aeten.core.spi.SpiFactory;

class ThreadFactory implements
		SpiFactory <java.util.concurrent.ThreadFactory, String> {
	private static final AtomicInteger threadCount = new AtomicInteger (0);

	@Override
	public java.util.concurrent.ThreadFactory create (String prefix) {
		final String name = prefix + "-" + threadCount.incrementAndGet ();
		return new java.util.concurrent.ThreadFactory () {
			@Override
			public Thread newThread (Runnable runnable) {
				return new Thread (runnable, name);
			}
		};
	}

	@Override
	public Class <?>[] getTypes () {
		return new Class[] {
			java.util.concurrent.ThreadFactory.class
		};
	}

	@Override
	public Class <String> getParameterType () {
		return String.class;
	}
}

package net.aeten.core.spi.factory;

import java.util.concurrent.atomic.AtomicInteger;

import net.aeten.core.spi.SpiFactory;

public class ThreadFactory implements
		SpiFactory <java.util.concurrent.ThreadFactory, String> {
	private static final AtomicInteger threadCount = new AtomicInteger (0);

	@Override
	public java.util.concurrent.ThreadFactory create (String prefix) {
		final String name = prefix + "-" + threadCount.incrementAndGet ();
		return new java.util.concurrent.ThreadFactory () {
			@Override
			public Thread newThread (Runnable runnable) {
				return new Thread (runnable, name);
			}
		};
	}

	@Override
	public Class <?>[] getTypes () {
		return new Class[] {
			java.util.concurrent.ThreadFactory.class
		};
	}

	@Override
	public Class <String> getParameterType () {
		return String.class;
	}
}

Increase to public visibility (better for use)


package io.github.jordao76.quotes;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.*;
import org.junit.runner.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.boot.test.*;
import org.springframework.test.context.junit4.*;
import org.springframework.test.context.web.*;
import org.springframework.test.web.servlet.*;
import org.springframework.test.web.servlet.setup.*;
import org.springframework.web.context.*;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = QuoteApplication.class)
@WebAppConfiguration
public class QuoteControllerTest {

  @Autowired
  private WebApplicationContext wac;

  private MockMvc client;

  @Before
  public void setup() {
    client = MockMvcBuilders.webAppContextSetup(wac).build();
  }

  @Test
  public void getQuotes() throws Exception {
    client
      .perform(get("/quotes"))
      .andExpect(status().isOk())
      .andExpect(content().contentType("application/json;charset=UTF-8"));
  }

}

package io.github.jordao76.quotes;

import static org.hamcrest.Matchers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.*;
import org.junit.runner.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.boot.test.*;
import org.springframework.test.context.junit4.*;
import org.springframework.test.context.web.*;
import org.springframework.test.web.servlet.*;
import org.springframework.test.web.servlet.setup.*;
import org.springframework.web.context.*;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = QuoteApplication.class)
@WebAppConfiguration
public class QuoteControllerTest {

  @Autowired
  private WebApplicationContext wac;

  private MockMvc client;

  @Before
  public void setup() {
    client = MockMvcBuilders.webAppContextSetup(wac).build();
  }

  @Test
  public void getQuotes() throws Exception {
    client
      .perform(get("/quotes"))
      .andExpect(status().isOk())
      .andExpect(content().contentType("application/json;charset=UTF-8"))
      .andExpect(content().string(containsString("Any sufficiently advanced technology is indistinguishable from magic.")));
  }

}

Check for some JSON content in the test

Check for some JSON content in the test


package org.usfirst.frc.team2503.r2016.component;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.SpeedController;

public class Intake extends SpeedControllerComponent {

	public enum IntakeMode {
		UNKNOWN,
		STOPPED,
		INBOUND,
		OUTBOUND,
		FIRE
	}

	public DigitalInput limitSwitch;

	private IntakeMode mode = IntakeMode.UNKNOWN;

	public void setMode(IntakeMode mode) { this.mode = mode; }
	public IntakeMode getMode() { return this.mode; }

	public void tick() {
		switch(mode) {
		case STOPPED:
			this.controller.set(0.0);
			break;

		case INBOUND:
			if(limitSwitch.get()) {
				this.controller.set(0.0);
			} else {
				this.controller.set(1.0);
			}

			break;

		case OUTBOUND:
			this.controller.set(-1.0);
			break;

		case FIRE:
			this.controller.set(1.0);
			break;

		case UNKNOWN:
		default:
			break;
		}
	}

	public Intake(SpeedController controller, DigitalInput limitSwitch) {
		super(controller);

		this.limitSwitch = limitSwitch;
	}

}

package org.usfirst.frc.team2503.r2016.component;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.SpeedController;

public class Intake extends SpeedControllerComponent {

	public enum IntakeMode {
		UNKNOWN,
		STOPPED,
		INBOUND,
		OUTBOUND,
		FIRE
	}

	public DigitalInput limitSwitch;

	private IntakeMode mode = IntakeMode.UNKNOWN;

	public void setMode(IntakeMode mode) { this.mode = mode; }
	public IntakeMode getMode() { return this.mode; }

	public void tick() {
		switch(this.mode) {
		case STOPPED:
			this.controller.set(0.0);
			break;

		case INBOUND:
			if(this.limitSwitch.get()) {
				this.controller.set(0.0);
			} else {
				this.controller.set(1.0);
			}

			break;

		case OUTBOUND:
			this.controller.set(-1.0);
			break;

		case FIRE:
			this.controller.set(1.0);
			break;

		case UNKNOWN:
		default:
			break;
		}
	}

	public Intake(SpeedController controller, DigitalInput limitSwitch) {
		super(controller);

		this.limitSwitch = limitSwitch;
	}

}

Use this. notation instead of expecting things to autocomplete to ivs


package com.digistratum.microhost;

import com.digistratum.microhost.Process.MHRunnable;

/**
 * @TODO Add support for receiving, starting, and monitoring multiple MHRunnable's
 */
public class MicroHostApp {

	/**
	 * Constructor
	 *
	 * This should be called from the application main() with an instance of the RestApi; we will
	 * put the RestApi into its own thread and let it run while we monitor. This gives us the
	 * ability to potentially spawn more threads and/or perform additional work as needed while the
	 * RestApi service does its job.
	 *
	 * @param mHRunnable RestApi RestApi instance
	 */
	public MicroHostApp(MHRunnable mHRunnable) {
		// Start and monitor...
		Thread t = new Thread(mHRunnable, "MHRunnable Instance");
		t.start();
		while (mHRunnable.isRunning()) {
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// Restore the interrupted status
				Thread.currentThread().interrupt();
			}
		}
	}
}

package com.digistratum.microhost;

import com.digistratum.microhost.Process.MHRunnable;

/**
 * @TODO Add support for receiving, starting, and monitoring multiple MHRunnable's
 */
abstract public class MicroHostApp {

	/**
	 * Constructor
	 *
	 * This should be called from the application main() with an instance of the RestApi; we will
	 * put the RestApi into its own thread and let it run while we monitor. This gives us the
	 * ability to potentially spawn more threads and/or perform additional work as needed while the
	 * RestApi service does its job.
	 *
	 * @param mHRunnable RestApi RestApi instance
	 */
	public MicroHostApp(MHRunnable mHRunnable) {
		// Start and monitor...
		Thread t = new Thread(mHRunnable, "MHRunnable Instance");
		t.start();
		while (mHRunnable.isRunning()) {
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// Restore the interrupted status
				Thread.currentThread().interrupt();
			}
		}
	}
}

Make MHRunnableImpl abstract to force subclassing

... don't want to encourage direct instantiation... at least not until the pattern emerges clearly and we can see a reason to do so.


package com.devinhartzell.chess.gui;

import javax.swing.JFrame;

public class PawnPromotionWindow extends JFrame {

	private static final long serialVersionUID = -1686304609750241736L;

	public PawnPromotionWindow() {
		getContentPane().setLayout(null);
		setSize(400, 200);
	}

}

package com.devinhartzell.chess.gui;

import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JTextArea;

public class PawnPromotionWindow extends JFrame {

	private static final long serialVersionUID = -1686304609750241736L;

	public PawnPromotionWindow() {
		super("Pawn Promotion");
		getContentPane().setLayout(null);

		JButton btnKnight = new JButton("Knight");
		btnKnight.setBounds(6, 6, 117, 29);
		getContentPane().add(btnKnight);

		JButton btnBishop = new JButton("Bishop");
		btnBishop.setBounds(6, 35, 117, 29);
		getContentPane().add(btnBishop);

		JButton btnRook = new JButton("Rook");
		btnRook.setBounds(6, 63, 117, 29);
		getContentPane().add(btnRook);

		JButton btnQueen = new JButton("Queen");
		btnQueen.setBounds(6, 92, 117, 29);
		getContentPane().add(btnQueen);

		JTextArea info = new JTextArea();
		info.setOpaque(false);
		info.setLineWrap(true);
		info.setText("Since your pawn reached the far end of the board, you may upgrade it to a better piece.");
		info.setBounds(135, 11, 159, 67);
		getContentPane().add(info);
		setSize(315, 155);
		setVisible(true);
	}
}

Add a pawn promotion window with no functionality


//
// $Id: SafeScrollPane.java,v 1.6 2002/11/05 21:03:31 mdb Exp $

package com.threerings.media;

import java.awt.Component;
import java.awt.Point;

import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JViewport;

/**
 * A scroll pane that is safe to use in frame managed views.
 */
public class SafeScrollPane extends JScrollPane
{
    public SafeScrollPane ()
    {
    }

    public SafeScrollPane (Component view)
    {
        super(view);
    }

    protected JViewport createViewport ()
    {
        JViewport vp = new JViewport() {
            public void setViewPosition (Point p) {
                super.setViewPosition(p);
                // simple scroll mode results in setViewPosition causing
                // our view to become invalid, but nothing ever happens to
                // queue up a revalidate for said view, so we have to do
                // it here
                Component c = getView();
                if (c instanceof JComponent) {
                    ((JComponent)c).revalidate();
                }
            }
        };
        vp.setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
        return vp;
    }
}

//
// $Id: SafeScrollPane.java,v 1.7 2003/03/22 01:56:09 mdb Exp $

package com.threerings.media;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;

import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JViewport;

/**
 * A scroll pane that is safe to use in frame managed views.
 */
public class SafeScrollPane extends JScrollPane
{
    public SafeScrollPane ()
    {
    }

    public SafeScrollPane (Component view)
    {
        super(view);
    }

    public SafeScrollPane (Component view, int owidth, int oheight)
    {
        super(view);
        if (owidth != 0 || oheight != 0) {
            _override = new Dimension(owidth, oheight);
        }
    }

    // documentation inherited
    public Dimension getPreferredSize ()
    {
        Dimension d = super.getPreferredSize();
        if (_override != null) {
            if (_override.width != 0) {
                d.width = _override.width;
            }
            if (_override.height != 0) {
                d.height = _override.height;
            }
        }
        return d;
    }

    protected JViewport createViewport ()
    {
        JViewport vp = new JViewport() {
            public void setViewPosition (Point p) {
                super.setViewPosition(p);
                // simple scroll mode results in setViewPosition causing
                // our view to become invalid, but nothing ever happens to
                // queue up a revalidate for said view, so we have to do
                // it here
                Component c = getView();
                if (c instanceof JComponent) {
                    ((JComponent)c).revalidate();
                }
            }
        };
        vp.setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
        return vp;
    }

    protected Dimension _override;
}

Allow preferred width or height to be overridden since it seems that
JScrollPane will happily return some insane value when it's wrapping an
empty JList.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@2314 542714f4-19e9-0310-aa3c-eee0fc999fb1


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

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

/**
 * The Generated annotation is used to mark members that have been generated.
 *
 * @author Andres Almiray
 * @author Jochen Theodorou
 * @author Mark Hoffmann
 */
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Generated {
}

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

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

/**
 * The Generated annotation is used to mark members that have been generated.
 */
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Generated {
}

Remove author tags from javadoc

Remove author tags from javadoc


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

package org.apache.jorphan.test;

/**
 * Implement this interface to work with the AllTests class. This interface
 * allows AllTests to pass a configuration file to your application before
 * running the junit unit tests.
 *
 * @see AllTests
 * @author Michael Stover (mstover at apache.org)
 * @version $Revision$
 */
public interface UnitTestManager {
	/**
	 * Your implementation will be handed the filename that was provided to
	 * AllTests as a configuration file. It can hold whatever properties you
	 * need to configure your system prior to the unit tests running.
	 *
	 * @param filename
	 */
	public void initializeProperties(String filename);
}

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

package org.apache.jorphan.test;

/**
 * Implement this interface to work with the AllTests class. This interface
 * allows AllTests to pass a configuration file to your application before
 * running the junit unit tests.
 *
 * @see AllTests
 *
 * N.B. This must be in the main src/ tree (not test/) because it is
 * implemented by JMeterUtils
 */
public interface UnitTestManager {
	/**
	 * Your implementation will be handed the filename that was provided to
	 * AllTests as a configuration file. It can hold whatever properties you
	 * need to configure your system prior to the unit tests running.
	 *
	 * @param filename
	 */
	public void initializeProperties(String filename);
}

Document that this part of the unit test code must remain in src/

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/trunk@602096 13f79535-47bb-0310-9956-ffa450edef68

Former-commit-id: cc2bf2cbe435b46f10d576d25c73048cd4ac9736


package sizebay.catalog.client.model;

import java.util.*;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.*;

@Getter
@Setter
public class Modeling   {

  private Long id;
  private String name;

  private Gender gender;
  private String gMerchantBrandName;
  private String gMerchantAgeGroup;
  private String gMerchantSizeType;

  private TypeEnum type;
  private Long brandId;
  private Long categoryId;
  private List<ModelingSizeMeasures> measures = new ArrayList<>();

  @Getter
  @RequiredArgsConstructor
  public enum TypeEnum {
    PRODUCT("product"),
    BODY("body");

    final private String value;

    @Override
    @JsonValue
    public String toString() {
      return value;
    }
  }

  @Getter
  @RequiredArgsConstructor
  public enum Gender {
    M("M"), F("F"), U("U");

    final private String value;

    @Override
    @JsonValue
    public String toString() {
      return value;
    }
  }
}

package sizebay.catalog.client.model;

import java.util.*;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.*;

@Getter
@Setter
public class Modeling   {

  private Long id;
  private String name;

  private Gender gender;
  private String gMerchantBrandName;
  private String gMerchantAgeGroup;
  private String gMerchantSizeType;

  private TypeEnum type;
  private Long brandId;
  private Long categoryId;
  private List<ModelingSizeMeasures> measures = new ArrayList<>();

  private Integer strongCategoryTypeId;
  private String strongCategoryTypeName;

  @Getter
  @RequiredArgsConstructor
  public enum TypeEnum {
    PRODUCT("product"),
    BODY("body");

    final private String value;

    @Override
    @JsonValue
    public String toString() {
      return value;
    }
  }

  @Getter
  @RequiredArgsConstructor
  public enum Gender {
    M("M"), F("F"), U("U");

    final private String value;

    @Override
    @JsonValue
    public String toString() {
      return value;
    }
  }
}

Add type id attribute in modeling

Fix: Add type id attribute in modeling


package com.kii.thingif.command;

/**
 * Marks a class as group of actions of command. The class implements Acton defines single actions
 * as fields of the class.
 *
The class must define {@link ActionAnnotation} for each field of the class, SDK uses the
 * defined annotations to serialize the class to json data or deserialize json data to a instance
 * of the class.
 *
 *
Serialize Principles

 *

 *
Name of action after serialized.
 *

 *

 *             If value of actionName of {@link ActionAnnotation} is not an empty string, SDK uses
 *             this value as key of action in serialized json object.
 *

 *

 *             If value of actionName annotation is empty string, SDK will name of attribute of
 *             the class as key of action in serialized json object.
 *

 *

 *

 *
Value of action is serialized with Gson.
 *

 *

 *             If action value is null, SDK does not include the action into serialized json data.
 *

 *

 *             If action value is primitive type(like int, boolean, float, double), SDK serializes
 *             it by its type.
 *

 *

 *             If action value is simple data type(like String, Number or subclass of Number(Integer,
 *             Float, etc.)), SDK serializes it by its type.
 *

 *

 *             If action value is customized object defined by developer, SDK serializes it using Gson.
 *

 *

 *            If action value is Collection type, SDK serializes it using Gson.
 *

 *

 *            If action value is array(like int[]), SDK serialized it using Gson.
 *

 *

 *

 *

 */
public interface Action {
}

package com.kii.thingif.command;

/**
 * Represents base cass of Action.
 */
public interface Action{
}

Revert "Add description of serialize and deserialize(not completed)"

This reverts commit d8f815db25d72e626d93953dae220a99d8510daa.


package net.pdp7.v2f.core;

import junit.framework.TestCase;
import net.pdp7.v2f.core.Router.ListTableRoute;

public class RouterTest extends TestCase {

	public void testRouter() {
		ListTableRoute route = (ListTableRoute) new Router(null, null).findRoute("/table_name/");
		assertEquals("table_name", route.table);
	}

	public void testDetailRoute() {
		assertFalse(new Router(null, null).getDetailRoute("table", "funky/id").contains("funky/id"));
	}
}

package net.pdp7.v2f.core;

import junit.framework.TestCase;
import net.pdp7.v2f.core.Router.ListTableRoute;

public class RouterTest extends TestCase {

	public void testRouter() {
		ListTableRoute route = (ListTableRoute) new Router(null, null, null).findRoute("/table_name/");
		assertEquals("table_name", route.table);
	}

	public void testDetailRoute() {
		assertFalse(new Router(null, null, null).getDetailRoute("table", "funky/id").contains("funky/id"));
	}
}

Fix broken build due to not running tests before committing :(


/*
 The caLAB Software License, Version 0.5

 Copyright 2006 SAIC. This software was developed in conjunction with the National
 Cancer Institute, and so to the extent government employees are co-authors, any
 rights in such works shall be subject to Title 17 of the United States Code,
 section 105.

 */
package gov.nih.nci.calab.ui.core;

/**
 * This class calls the Struts ForwardAction to forward to a page, aslo
 * extends AbstractBaseAction to inherit the user authentication features.
 *
 * @author pansu
 */

/* CVS $Id: BaseForwardAction.java,v 1.3 2006-08-02 21:27:59 pansu Exp $ */

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.ForwardAction;

public class BaseForwardAction extends AbstractBaseAction {
	public ActionForward executeTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ForwardAction forwardAction = new ForwardAction();
		return forwardAction.execute(mapping, form, request, response);
	}

	public boolean loginRequired() {
		return true;
	}

	public boolean canUserExecute(HttpSession session) {
		return true;
	}
}

/*
 The caLAB Software License, Version 0.5

 Copyright 2006 SAIC. This software was developed in conjunction with the National
 Cancer Institute, and so to the extent government employees are co-authors, any
 rights in such works shall be subject to Title 17 of the United States Code,
 section 105.

 */
package gov.nih.nci.calab.ui.core;

/**
 * This class calls the Struts ForwardAction to forward to a page, aslo
 * extends AbstractBaseAction to inherit the user authentication features.
 *
 * @author pansu
 */

/* CVS $Id: BaseForwardAction.java,v 1.4 2007-10-25 20:56:51 cais Exp $ */

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.ForwardAction;

public class BaseForwardAction extends AbstractBaseAction {
	public ActionForward executeTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ForwardAction forwardAction = new ForwardAction();
		return forwardAction.execute(mapping, form, request, response);
	}

	public boolean loginRequired() {
		//return true;
		return false;
	}

	public boolean canUserExecute(HttpSession session) {
		return true;
	}
}

Set loginRequired to false. For users without login, this is required for "back" link on some pages to function.

SVN-Revision: 10730


package com.andela.webservice;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

package com.andela.webservice;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    private TextView output;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        output = (TextView) findViewById(R.id.textView);
        output.setMovementMethod(new ScrollingMovementMethod());

        for(int i = 0; i<100; i++) {
            updateDisplay("Task " + i);
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if(item.getItemId() == R.id.action_do_task) {
            updateDisplay("Task done!");
        }
        return true;
    }

    private void updateDisplay(String s) {
        output.append(s + "\n");
    }
}

Inflate the Menu, set the textView to scroll vertically


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

import java.io.Closeable;

import org.apache.jmeter.report.core.Sample;

/**
 * Describes sample writer basic operations.

 *

 * Basically a sample writer is able to write samples to an unknown destination
 * and close itself.

 *
 * @since 2.14
 */
abstract public class SampleWriter implements Closeable {

    /**
     * Write a sample to the underlying destination
     *
     * @param s
     *            The sample to be written
     * @return The number of samples written at this time to the undernlying
     *         destination
     */
    abstract public long write(Sample s);
}

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

import java.io.Closeable;

import org.apache.jmeter.report.core.Sample;

/**
 * Describes sample writer basic operations.

 *

 * Basically a sample writer is able to write samples to an unknown destination
 * and close itself.

 *
 * @since 2.14
 */
abstract public class SampleWriter implements Closeable {

    /**
     * Write a sample to the underlying destination
     *
     * @param sample
     *            The sample to be written (Must not be {@code null})
     * @return The number of samples written at this time to the underlying
     *         destination
     */
    abstract public long write(Sample sample);
}

Use a more descriptive variable name and point out, that the parameter must not be null.

git-svn-id: 5ccfe34f605a6c2f9041ff2965ab60012c62539a@1721006 13f79535-47bb-0310-9956-ffa450edef68


package net.piemaster.jario.systems;

import net.piemaster.jario.components.CollisionMesh;
import net.piemaster.jario.components.Transform;

import com.artemis.ComponentMapper;
import com.artemis.Entity;
import com.artemis.EntityProcessingSystem;

public class CollisionMeshSystem extends EntityProcessingSystem
{
	private ComponentMapper<Transform> transformMapper;
	private ComponentMapper<CollisionMesh> meshMapper;

	@SuppressWarnings("unchecked")
	public CollisionMeshSystem()
	{
		super(Transform.class, CollisionMesh.class);
	}

	@Override
	public void initialize()
	{
		transformMapper = new ComponentMapper<Transform>(Transform.class, world.getEntityManager());
		meshMapper = new ComponentMapper<CollisionMesh>(CollisionMesh.class, world.getEntityManager());
	}

	@Override
	protected void process(Entity e)
	{
		CollisionMesh mesh = meshMapper.get(e);
		if(mesh != null)
		{
			Transform t = transformMapper.get(e);
			meshMapper.get(e).setLocation((int)t.getX(), (int)t.getY());
		}
	}
}

package net.piemaster.jario.systems;

import net.piemaster.jario.components.CollisionMesh;
import net.piemaster.jario.components.Transform;

import com.artemis.ComponentMapper;
import com.artemis.Entity;
import com.artemis.EntityProcessingSystem;

public class CollisionMeshSystem extends EntityProcessingSystem
{
	private ComponentMapper<Transform> transformMapper;
	private ComponentMapper<CollisionMesh> meshMapper;

	@SuppressWarnings("unchecked")
	public CollisionMeshSystem()
	{
		super(Transform.class, CollisionMesh.class);
	}

	@Override
	public void initialize()
	{
		transformMapper = new ComponentMapper<Transform>(Transform.class, world.getEntityManager());
		meshMapper = new ComponentMapper<CollisionMesh>(CollisionMesh.class, world.getEntityManager());
	}

	@Override
	protected void process(Entity e)
	{
		CollisionMesh mesh = meshMapper.get(e);
		if(mesh != null)
		{
			Transform t = transformMapper.get(e);
			meshMapper.get(e).setLocation(t.getX(), t.getY());
		}
	}
}

Debug update continued: Removed the cost of mesh position to ints.


package com.genymobile.scrcpy;

import android.util.Log;

/**
 * Log both to Android logger (so that logs are visible in "adb logcat") and standard output/error (so that they are visible in the terminal
 * directly).
 */
public final class Ln {

    private static final String TAG = "scrcpy";

    private Ln() {
        // not instantiable
    }

    public static void d(String message) {
        Log.d(TAG, message);
        System.out.println("DEBUG: " + message);
    }

    public static void i(String message) {
        Log.i(TAG, message);
        System.out.println("INFO: " + message);
    }

    public static void w(String message) {
        Log.w(TAG, message);
        System.out.println("WARN: " + message);
    }

    public static void e(String message, Throwable throwable) {
        Log.e(TAG, message, throwable);
        System.out.println("ERROR: " + message);
        throwable.printStackTrace();
    }
}

package com.genymobile.scrcpy;

import android.util.Log;

/**
 * Log both to Android logger (so that logs are visible in "adb logcat") and standard output/error (so that they are visible in the terminal
 * directly).
 */
public final class Ln {

    private static final String TAG = "scrcpy";

    enum Level {
        DEBUG,
        INFO,
        WARN,
        ERROR;
    }

    private static final Level THRESHOLD = BuildConfig.DEBUG ? Level.DEBUG : Level.INFO;

    private Ln() {
        // not instantiable
    }

    public static boolean isEnabled(Level level) {
        return level.ordinal() >= THRESHOLD.ordinal();
    }

    public static void d(String message) {
        if (isEnabled(Level.DEBUG)) {
            Log.d(TAG, message);
            System.out.println("DEBUG: " + message);
        }
    }

    public static void i(String message) {
        if (isEnabled(Level.INFO)) {
            Log.i(TAG, message);
            System.out.println("INFO: " + message);
        }
    }

    public static void w(String message) {
        if (isEnabled(Level.WARN)) {
            Log.w(TAG, message);
            System.out.println("WARN: " + message);
        }
    }

    public static void e(String message, Throwable throwable) {
        if (isEnabled(Level.ERROR)) {
            Log.e(TAG, message, throwable);
            System.out.println("ERROR: " + message);
            throwable.printStackTrace();
        }
    }
}

Enable debug logs only for debug builds on server

Print the logs only if their level is not under the threshold, which is
defined to INFO in release mode and DEBUG in debug mode.


package com.github.sbugat.samplerest.web.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse;

@WebFilter(
		urlPatterns = "/*")
public class ApiOriginFilter implements Filter {

	@Override
	public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
		final HttpServletResponse res = (HttpServletResponse) response;
		res.addHeader("Access-Control-Allow-Origin", "*");
		res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
		res.addHeader("Access-Control-Allow-Headers", "Content-Type");
		chain.doFilter(request, response);
	}

	@Override
	public void destroy() {
	}

	@Override
	public void init(final FilterConfig filterConfig) throws ServletException {
	}
}

package com.github.sbugat.samplerest.web.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse;

@WebFilter(
		urlPatterns = "/*")
public class ApiOriginFilter implements Filter {

	@Override
	public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
		final HttpServletResponse httpServletResponse = (HttpServletResponse) response;
		httpServletResponse.addHeader("Access-Control-Allow-Origin", "*");
		httpServletResponse.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
		httpServletResponse.addHeader("Access-Control-Allow-Headers", "Content-Type, api_key, Authorization");
		chain.doFilter(request, response);
	}

	@Override
	public void destroy() {
	}

	@Override
	public void init(final FilterConfig filterConfig) throws ServletException {
	}
}

Add api-key and authorisation in http header


import arez.annotations.Action;
import arez.annotations.ArezComponent;
import arez.annotations.Memoize;
import arez.annotations.Observable;
import javax.annotation.Nonnull;

@ArezComponent
public abstract class AnnotationsOnModel
{
  @Observable
  @Nonnull
  @SuppressWarnings( "ThisANnotationShouldNotBeCopied" )
  public String getTime()
  {
    return "";
  }

  @Observable
  @SuppressWarnings( "ThisANnotationShouldNotBeCopied" )
  public void setTime( @Nonnull @SuppressWarnings( "ThisANnotationShouldNotBeCopied" ) final String time )
  {
  }

  @Action
  @SuppressWarnings( "ThisANnotationShouldNotBeCopied" )
  public void doStuff( @Nonnull @SuppressWarnings( "ThisANnotationShouldNotBeCopied" ) final String time )
  {
  }

  @Memoize
  @Nonnull
  @SuppressWarnings( "ThisANnotationShouldNotBeCopied" )
  public Integer someValue()
  {
    return 0;
  }
}

import arez.annotations.Action;
import arez.annotations.ArezComponent;
import arez.annotations.Memoize;
import arez.annotations.Observable;
import javax.annotation.Nonnull;

@ArezComponent
public abstract class AnnotationsOnModel
{
  public @interface DoNotCopyThisAnnotation
  {
  }

  @Observable
  @Nonnull
  @DoNotCopyThisAnnotation
  public String getTime()
  {
    return "";
  }

  @Observable
  @DoNotCopyThisAnnotation
  public void setTime( @Nonnull @DoNotCopyThisAnnotation final String time )
  {
  }

  @Action
  @DoNotCopyThisAnnotation
  public void doStuff( @Nonnull @DoNotCopyThisAnnotation final String time )
  {
  }

  @Memoize
  @Nonnull
  @DoNotCopyThisAnnotation
  public Integer someValue()
  {
    return 0;
  }
}

Use an explicit annotation in test for non copying annotation


package cl.fatman.capital.fund;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import java.time.LocalDate;

@Entity
@Table(name = "foment_unit")
public class FomentUnit {

	@Id
	@GeneratedValue(generator = "increment")
	@GenericGenerator(name = "increment", strategy = "increment")
	private int id;
	private double value;
	@Column(unique = true)
	private LocalDate date;

	public FomentUnit() {
		super();
	}

	public FomentUnit(double value, LocalDate date) {
		super();
		this.value = value;
		this.date = date;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public double getValue() {
		return value;
	}

	public void setValue(double value) {
		this.value = value;
	}

	public LocalDate getDate() {
		return date;
	}

	public void setDate(LocalDate date) {
		this.date = date;
	}
}

package cl.fatman.capital.fund;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import java.time.LocalDate;

@Entity
@Table(name = "foment_unit")
public class FomentUnit {

	@Id
	private String id;
	private double value;
	@Column(unique = true)
	private LocalDate date;

	public FomentUnit() {
		super();
	}

	public FomentUnit(double value, LocalDate date) {
		super();
		this.id = date.toString();
		this.value = value;
		this.date = date;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public double getValue() {
		return value;
	}

	public void setValue(double value) {
		this.value = value;
	}

	public LocalDate getDate() {
		return date;
	}

	public void setDate(LocalDate date) {
		this.date = date;
	}
}

Change id to String type to avoid data duplication.


package org.commcare.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.provider.Settings;

/**
 * @author Phillip Mates (pmates@dimagi.com)
 */
public class ConnectivityStatus {
    public static boolean isAirplaneModeOn(Context context) {
        if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return Settings.Global.getInt(context.getApplicationContext().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
        } else {
            return Settings.System.getInt(context.getApplicationContext().getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0;
        }
    }

    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager connectivityManager
                = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }
}

package org.commcare.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.provider.Settings;

/**
 * @author Phillip Mates (pmates@dimagi.com)
 */
public class ConnectivityStatus {
    public static boolean isAirplaneModeOn(Context context) {
        if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return Settings.Global.getInt(context.getApplicationContext().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
        } else {
            return Settings.System.getInt(context.getApplicationContext().getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0;
        }
    }

    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager connectivityManager
                = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
    }
}

Fix for Connectivity status check

Fix for Connectivity status check

Updates connectivity status check to match best practice from

https://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html#DetermineType


package xyz.upperlevel.uppercore.util;

import java.io.File;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

public final class ExternalJarUtil {
    private static final MethodHandle addPath;

    static {//void addURL(URL var1)

        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        try {
            Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
            method.setAccessible(true);
            MethodHandle tmp = MethodHandles.lookup().unreflect(method);
            addPath = tmp.bindTo(classLoader);
        } catch (NoSuchMethodException e) {
            throw new IllegalStateException("Unsupported class loader: " + classLoader.getClass().getName(), e);
        } catch (IllegalAccessException e) {
            throw new IllegalStateException("Cannot get addUrl method", e);
        }
    }

    public static void addUrl(URL url) {
        try {
            addPath.invoke(url);
        } catch (Throwable t) {
            throw new RuntimeException("Error while loading external jar", t);
        }
    }

    public static void addUrl(File file) throws MalformedURLException {
        addUrl(file.toURI().toURL());
    }

    private ExternalJarUtil() {
    }
}

package xyz.upperlevel.uppercore.util;

import java.io.File;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

public final class ExternalJarUtil {
    private static final MethodHandle addPath;

    static {//void addURL(URL var1)
        ClassLoader classLoader = ExternalJarUtil.class.getClassLoader();
        try {
            Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
            method.setAccessible(true);
            MethodHandle tmp = MethodHandles.lookup().unreflect(method);
            addPath = tmp.bindTo(classLoader);
        } catch (NoSuchMethodException e) {
            throw new IllegalStateException("Unsupported class loader: " + classLoader.getClass().getName(), e);
        } catch (IllegalAccessException e) {
            throw new IllegalStateException("Cannot get addUrl method", e);
        }
    }

    public static void addUrl(URL url) {
        try {
            addPath.invoke(url);
        } catch (Throwable t) {
            throw new RuntimeException("Error while loading external jar", t);
        }
    }

    public static void addUrl(File file) throws MalformedURLException {
        addUrl(file.toURI().toURL());
    }

    private ExternalJarUtil() {
    }
}

Add semi-compatibility with Java 9+

Add semi-compatibility with Java 9+


package org.ohdsi.webapi.util;

import org.apache.commons.lang3.RandomStringUtils;

/**
 *
 */
public final class SessionUtils {
    public static final String sessionId(){
        return RandomStringUtils.randomAlphanumeric(10);
    }
}

package org.ohdsi.webapi.util;

import org.ohdsi.sql.SqlTranslate;

/**
 *
 */
public final class SessionUtils {

    public static final String sessionId() {
        return SqlTranslate.generateSessionId();
    }
}

Use SqlTranslate to generate random since there is some additional logic involved (e.g. non-numeric initial character)


package com.bigcommerce.api.resources;

import java.util.List;

import com.bigcommerce.api.Filter;
import com.bigcommerce.api.Response;

public interface Resource {
	public List<? extends Response> listAll();
	public List<? extends Response> listAll(Filter filter);
	public Response getOne(Integer Id);
}

package com.bigcommerce.api.resources;

import java.util.List;

import com.bigcommerce.api.Filter;
import com.bigcommerce.api.Form;
import com.bigcommerce.api.Response;

public interface Resource {
	public List<? extends Response> listAll();
	public List<? extends Response> listAll(Filter filter);
	public Response getOne(Integer Id);
	public Boolean update(Integer Id, Form data);
}

Update (PUT) a resource API call is added.


package com.nincraft.ninbot.command;

import com.nincraft.ninbot.util.MessageUtils;
import lombok.val;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

public class DabCommand extends AbstractCommand {

    public DabCommand() {
        length = 3;
        name = "dab";
        description = "Adds all dab emojis to the last message of the user named";
    }

    @Override
    public void executeCommand(MessageReceivedEvent event) {
        val content = event.getMessage().getContent();
        if (isCommandLengthCorrect(content)) {
            val channel = event.getChannel();
            val dabUser = content.split(" ")[2].replaceFirst("@", "");
            int count = 0;
            int maxDab = 10;
            for (Message message : channel.getIterableHistory()) {
                if (message.getAuthor().getName().equalsIgnoreCase(dabUser)) {
                    dabOnMessage(message);
                    break;
                }
                if (count >= maxDab) {
                    MessageUtils.reactUnsuccessfulResponse(event.getMessage());
                    break;
                }
                count++;
            }
        } else {
            MessageUtils.reactUnsuccessfulResponse(event.getMessage());
        }
    }

    private void dabOnMessage(Message message) {
        val guild = message.getGuild();

        for (val emote : guild.getEmotes()) {
            if (emote.getName().contains("dab")) {
                MessageUtils.addReaction(message, emote);
            }
        }
    }
}

package com.nincraft.ninbot.command;

import com.nincraft.ninbot.util.MessageUtils;
import lombok.val;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

public class DabCommand extends AbstractCommand {

    public DabCommand() {
        length = 3;
        name = "dab";
        description = "Adds all dab emojis to the last message of the user named";
    }

    @Override
    public void executeCommand(MessageReceivedEvent event) {
        val content = event.getMessage().getContent();
        if (isCommandLengthCorrect(content)) {
            val channel = event.getChannel();
            val dabUser = content.substring(12).replaceFirst("@", "");
            int count = 0;
            int maxDab = 10;
            for (Message message : channel.getIterableHistory()) {
                if (message.getAuthor().getName().equalsIgnoreCase(dabUser)) {
                    dabOnMessage(message);
                    break;
                }
                if (count >= maxDab) {
                    MessageUtils.reactUnsuccessfulResponse(event.getMessage());
                    break;
                }
                count++;
            }
        } else {
            MessageUtils.reactUnsuccessfulResponse(event.getMessage());
        }
    }

    private void dabOnMessage(Message message) {
        val guild = message.getGuild();

        for (val emote : guild.getEmotes()) {
            if (emote.getName().contains("dab")) {
                MessageUtils.addReaction(message, emote);
            }
        }
    }

    @Override
    boolean isCommandLengthCorrect(String content) {
        return content.split(" ").length >= length;
    }
}

Fix dab command failing on users with multiple words in their name

Closes #22


package de.st_ddt.crazyutil.geo.block;

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

import de.st_ddt.crazyutil.geo.location.GeoLocation;

public class GeoBlock extends GeoLocation
{

	protected int material;
	protected byte data;

	// protected BlockState state;
	public GeoBlock(final Block block)
	{
		super(block.getX(), block.getY(), block.getZ());
		material = block.getTypeId();
		data = block.getData();
		// state = block.getState();
	}

	public void apply(final Location target, final boolean physics)
	{
		final Block block = target.clone().add(x, y, z).getBlock();
		block.setTypeIdAndData(material, data, physics);
	}
}

package de.st_ddt.crazyutil.geo.block;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;

import de.st_ddt.crazyutil.geo.location.GeoLocation;

public class GeoBlock extends GeoLocation
{

	protected Material material;
	protected byte data;

	// protected BlockState state;
	public GeoBlock(final Block block)
	{
		super(block.getX(), block.getY(), block.getZ());
		material = block.getType();
		data = block.getData();
		// state = block.getState();
	}

	public void apply(final Location target, final boolean physics)
	{
		final Block block = target.clone().add(x, y, z).getBlock();
		block.setTypeIdAndData(material.getId(), data, physics);
	}
}

Store Material instead of materialid

Store Material instead of materialid


package org.vaadin.viritin.layouts;

import com.vaadin.shared.ui.MarginInfo;

public class MMarginInfo extends MarginInfo {

    private static final long serialVersionUID = -3559703824387291269L;

    public MMarginInfo(boolean enabled) {
        super(enabled);
    }

    public MMarginInfo(int bitMask) {
        super(bitMask);
    }

    public MMarginInfo(boolean top, boolean right, boolean bottom, boolean left) {
        super(top, right, bottom, left);
    }

    public MMarginInfo(boolean vertical, boolean horizontal) {
        super(vertical, horizontal, vertical, horizontal);
    }

}

package org.vaadin.viritin.layouts;

import com.vaadin.shared.ui.MarginInfo;

public class MMarginInfo extends MarginInfo {

    private static final long serialVersionUID = -3559703824387291269L;

    public MMarginInfo(boolean enabled) {
        super(enabled);
    }

    @Deprecated
    public MMarginInfo(int bitMask) {
        super(bitMask);
    }

    public MMarginInfo(boolean top, boolean right, boolean bottom, boolean left) {
        super(top, right, bottom, left);
    }

    public MMarginInfo(boolean vertical, boolean horizontal) {
        super(vertical, horizontal, vertical, horizontal);
    }

}

Mark overriden deprecated method as deprected


package com.elmakers.mine.bukkit.action.builtin;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.block.MaterialBrush;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import org.bukkit.block.Block;

public class CheckBlockAction extends BaseSpellAction {
    @SuppressWarnings("deprecation")
    @Override
    public SpellResult perform(CastContext context) {
        MaterialBrush brush = context.getBrush();
        Block block = context.getTargetBlock();
        if (brush != null && brush.isErase()) {
            if (!context.hasBreakPermission(block)) {
                return SpellResult.CANCELLED;
            }
        } else {
            if (!context.hasBuildPermission(block)) {
                return SpellResult.CANCELLED;
            }
        }
        if (!context.isDestructible(block)) {
            return SpellResult.CANCELLED;
        }
        return SpellResult.CAST;
    }

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

package com.elmakers.mine.bukkit.action.builtin;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.block.MaterialBrush;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import org.bukkit.block.Block;

public class CheckBlockAction extends BaseSpellAction {
    @SuppressWarnings("deprecation")
    @Override
    public SpellResult perform(CastContext context) {
        MaterialBrush brush = context.getBrush();
        Block block = context.getTargetBlock();
        if (brush != null && brush.isErase()) {
            if (!context.hasBreakPermission(block)) {
                return SpellResult.STOP;
            }
        } else {
            if (!context.hasBuildPermission(block)) {
                return SpellResult.STOP;
            }
        }
        if (!context.isDestructible(block)) {
            return SpellResult.STOP;
        }
        return SpellResult.CAST;
    }

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

Use STOP instead of CANCELLED to cancel an action stack


package scalac.transformer.matching ;

import scalac.ast.Tree;
import scalac.util.Name;
import scalac.symtab.Symbol ;
import scalac.ast.Traverser ;

import Tree.Ident;
import Tree.Bind;

public class TestRegTraverser extends Traverser {

    boolean result;

    public TestRegTraverser() {
	super();
	result = false;
    }

    public void traverse(Tree tree) {
	switch (tree) {
	case Alternative(Tree[] ts):
	case Bind(_, _):
	    result = true;
	    break;
	default:
	    super.traverse( tree );
	}
    }

    public static boolean apply( Tree t ) {
	TestRegTraverser trt = new TestRegTraverser();
	trt.traverse( t );
	//System.err.println("TestRegTraverser says "+t+" -> "+trt.result);
	return trt.result;
    }

}

/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
**                                                                      **
** $Id$
\*                                                                      */

package scalac.transformer.matching;

import scalac.ast.*;
import scalac.util.*;
import scalac.symtab.*;
import java.util.*;

public class TestRegTraverser extends Traverser {
    boolean result = false;
	Set variables = new HashSet();

    public void traverse(Tree tree) {
    	if (!result)
			switch (tree) {
				case Alternative(Tree[] ts):
					result = true;
					break;
				case Bind(_, Tree pat):
					variables.add(tree.symbol());
					traverse(pat);
					break;
				case Ident(_):
					if (variables.contains(tree.symbol()))
						result = true;
					break;
				default:
					super.traverse( tree );
			}
    }

    public static boolean apply(Tree t) {
        TestRegTraverser trt = new TestRegTraverser();
        trt.traverse(t);
        //System.err.println("TestRegTraverser says "+t+" -> "+trt.result);
        return trt.result;
    }
}

Allow non-recursive bindings for the "old" patt...

Allow non-recursive bindings for the "old" pattern matcher.


package com.freak.asteroid.randomiser;

import android.app.Activity;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import java.io.File;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void onResume() {
        super.onResume();
        File root = new File(Environment.getExternalStorageDirectory() + "/Music");
        RandomiseThread randomiser = new RandomiseThread(root);
        randomiser.start();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

package com.freak.asteroid.randomiser;

import android.app.Activity;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import java.io.File;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void onResume() {
        super.onResume();
        File root = new File(Environment.getExternalStorageDirectory() + "/Musique");
        RandomiseThread randomiser = new RandomiseThread(root);
        randomiser.start();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

Fix issue on root directory

[FIX] Fix issue on root directory


package pt.fccn.mobile.arquivo.suite;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

import pt.fccn.mobile.arquivo.tests.FullTextSearchTest;
import pt.fccn.mobile.arquivo.tests.URLSearchTest;
import pt.fccn.mobile.arquivo.tests.imagesearch.ImageAdvancedSearchTest;
import pt.fccn.mobile.arquivo.tests.imagesearch.ImageSearchDirectUrlTest;
import pt.fccn.mobile.arquivo.tests.imagesearch.ImageSearchTest;

/**
 *
 * @author João Nobre
 *
 */
@RunWith(Suite.class)
@SuiteClasses({ FullTextSearchTest.class, URLSearchTest.class, ImageAdvancedSearchTest.class,
		ImageSearchDirectUrlTest.class, ImageSearchTest.class })
public class TestSuite {

}

//package pt.fccn.mobile.arquivo.suite;
//
//import org.junit.runner.RunWith;
//import org.junit.runners.Suite;
//import org.junit.runners.Suite.SuiteClasses;
//
//import pt.fccn.mobile.arquivo.tests.FullTextSearchTest;
//import pt.fccn.mobile.arquivo.tests.URLSearchTest;
//import pt.fccn.mobile.arquivo.tests.imagesearch.ImageAdvancedSearchTest;
//import pt.fccn.mobile.arquivo.tests.imagesearch.ImageSearchDirectUrlTest;
//import pt.fccn.mobile.arquivo.tests.imagesearch.ImageSearchTest;
//import pt.fccn.mobile.arquivo.tests.menu.MenuAboutTest;
//import pt.fccn.mobile.arquivo.tests.menu.MenuImagesAdvancedSearchTest;
//import pt.fccn.mobile.arquivo.tests.menu.MenuImagesNewSearchTest;
//import pt.fccn.mobile.arquivo.tests.menu.MenuPagesNewAvancedSearchTest;
//import pt.fccn.mobile.arquivo.tests.menu.MenuPagesNewSearchTest;
//import pt.fccn.mobile.arquivo.tests.menu.MenuReportBugTest;
//
///**
// *
// * @author João Nobre
// *
// */
//@RunWith(Suite.class)
//@SuiteClasses({ FullTextSearchTest.class, URLSearchTest.class, ImageAdvancedSearchTest.class,
//		ImageSearchDirectUrlTest.class, ImageSearchTest.class,
//
//		MenuAboutTest.class,
//
//		MenuImagesAdvancedSearchTest.class,
//
//		MenuImagesNewSearchTest.class,
//
//		MenuPagesNewAvancedSearchTest.class,
//
//		MenuPagesNewSearchTest.class,
//
//		MenuReportBugTest.class })
//public class TestSuite {
//
//}

Remove mobile test suite because tests can be executed with wildcard.


package uk.co.alynn.games.ld30;

import java.util.List;
import uk.co.alynn.games.ld30.world.Planet;
import uk.co.alynn.games.ld30.world.Adversary;

public class SuperimposedWave extends Wave {

    private final Wave m_left;
    private final Wave m_right;

    public SuperimposedWave(Wave left, Wave right) {
        m_left = left;
        m_right = right;
    }

    @Override
    public boolean dispatch(List<Planet> planets, List<Adversary> adversaries, int tickID) {
        boolean ok = true;
        ok = ok && m_left.dispatch(planets, adversaries, tickID);
        ok = ok && m_right.dispatch(planets, adversaries, tickID);
        return ok;
    }

    @Override
    protected boolean tick(int tick) {
        throw new RuntimeException("Cannot tick a superwave");
    }
}

package uk.co.alynn.games.ld30;

import java.util.List;
import uk.co.alynn.games.ld30.world.Planet;
import uk.co.alynn.games.ld30.world.Adversary;

public class SuperimposedWave extends Wave {

    private final Wave m_left;
    private final Wave m_right;

    public SuperimposedWave(Wave left, Wave right) {
        m_left = left;
        m_right = right;
    }

    @Override
    public boolean dispatch(List<Planet> planets, List<Adversary> adversaries, int tickID) {
        boolean ok = true;
        ok = m_left.dispatch(planets, adversaries, tickID) && ok;
        ok = m_right.dispatch(planets, adversaries, tickID) && ok;
        return ok;
    }

    @Override
    protected boolean tick(int tick) {
        throw new RuntimeException("Cannot tick a superwave");
    }
}

Fix the spawning bug with autogenerated levels


package main;
/**
 * @author XYLau
 */
import edu.dynamic.dynamiz.UI.*;

public class Dynamiz {
	public static void main() {
		UI sc = new UI();
	}
}

package main;
/**
 * @author XYLau
 */
import edu.dynamic.dynamiz.UI.*;

public class Dynamiz {
	public static void main() {
		new UI();
	}
}

Update main driver using UI()

Update main driver using UI()


package org.bouncycastle.asn1;

import java.io.InputStream;
import java.io.IOException;

class ConstructedOctetStream
    extends InputStream
{
    private final ASN1ObjectParser _parser;

    private boolean                _first = true;
    private InputStream            _currentStream;

    ConstructedOctetStream(
        ASN1ObjectParser parser)
    {
        _parser = parser;
    }

    public int read()
        throws IOException
    {
        if (_first)
        {
            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();

            if (s == null)
            {
                return -1;
            }

            _first = false;
            _currentStream = s.getOctetStream();
        }
        else if (_currentStream == null)
        {
            return -1;
        }

        int b = _currentStream.read();

        if (b < 0)
        {
            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();

            if (s == null)
            {
                _currentStream = null;

                return -1;
            }

            _currentStream = s.getOctetStream();

            return _currentStream.read();
        }
        else
        {
            return b;
        }
    }
}

package org.bouncycastle.asn1;

import java.io.InputStream;
import java.io.IOException;

class ConstructedOctetStream
    extends InputStream
{
    private final ASN1ObjectParser _parser;

    private boolean                _first = true;
    private InputStream            _currentStream;

    ConstructedOctetStream(
        ASN1ObjectParser parser)
    {
        _parser = parser;
    }

    public int read(byte[] b, int off, int len) throws IOException
    {
        if (_currentStream == null)
        {
            if (!_first)
            {
                return -1;
            }

            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();

            if (s == null)
            {
                return -1;
            }

            _first = false;
            _currentStream = s.getOctetStream();
        }

        for (;;)
        {
            int numRead = _currentStream.read(b, off, len);

            if (numRead >= 0)
            {
                return numRead;
            }

            ASN1OctetStringParser aos = (ASN1OctetStringParser)_parser.readObject();

            if (aos == null)
            {
                _currentStream = null;
                return -1;
            }

            _currentStream = aos.getOctetStream();
        }
    }

    public int read()
        throws IOException
    {
        if (_currentStream == null)
        {
            if (!_first)
            {
                return -1;
            }

            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();

            if (s == null)
            {
                return -1;
            }

            _first = false;
            _currentStream = s.getOctetStream();
        }

        for (;;)
        {
            int b = _currentStream.read();

            if (b >= 0)
            {
                return b;
            }

            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();

            if (s == null)
            {
                _currentStream = null;
                return -1;
            }

            _currentStream = s.getOctetStream();
        }
    }
}

Handle empty "component" streams Implement read(byte[],int,int) as optimisation


package org.hyperledger.indy.sdk.pool;

import org.hyperledger.indy.sdk.IndyException;
import org.hyperledger.indy.sdk.IndyIntegrationTest;
import org.hyperledger.indy.sdk.utils.PoolUtils;
import org.junit.Test;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

import static org.junit.Assert.assertNotNull;

public class ClosePoolTest extends IndyIntegrationTest {

	@Test
	public void testClosePoolWorks() throws IndyException, ExecutionException, InterruptedException, IOException {
		Pool pool = PoolUtils.createAndOpenPoolLedger();
		assertNotNull(pool);
		openedPools.add(pool);

		pool.closePoolLedger().get();
		openedPools.remove(pool);
	}
}

package org.hyperledger.indy.sdk.pool;

import org.hyperledger.indy.sdk.ErrorCode;
import org.hyperledger.indy.sdk.ErrorCodeMatcher;
import org.hyperledger.indy.sdk.IndyException;
import org.hyperledger.indy.sdk.IndyIntegrationTest;
import org.hyperledger.indy.sdk.utils.PoolUtils;
import org.junit.Test;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

import static org.junit.Assert.assertNotNull;

public class ClosePoolTest extends IndyIntegrationTest {

	@Test
	public void testClosePoolWorks() throws IndyException, ExecutionException, InterruptedException, IOException {
		Pool pool = PoolUtils.createAndOpenPoolLedger();
		assertNotNull(pool);
		openedPools.add(pool);

		pool.closePoolLedger().get();
		openedPools.remove(pool);
	}

	@Test
	public void testClosePoolWorksForTwice() throws IndyException, ExecutionException, InterruptedException, IOException {
		thrown.expectCause(new ErrorCodeMatcher(ErrorCode.PoolLedgerInvalidPoolHandle));

		Pool pool = PoolUtils.createAndOpenPoolLedger();
		assertNotNull(pool);
		openedPools.add(pool);

		pool.closePoolLedger().get();
		openedPools.remove(pool);
		pool.closePoolLedger().get();
	}

	@Test
	public void testClosePoolWorksForReopenAfterClose() throws IndyException, ExecutionException, InterruptedException, IOException {
		String poolName = PoolUtils.createPoolLedgerConfig();

		Pool pool = Pool.openPoolLedger(poolName, null).get();
		assertNotNull(pool);
		openedPools.add(pool);

		pool.closePoolLedger().get();

		Pool.openPoolLedger(poolName, null).get();
	}
}

Add more tests for ClosePool.

[java] Add more tests for ClosePool.


package net.bettyluke.tracinstant.data;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import net.bettyluke.tracinstant.prefs.SiteSettings;

public final class AuthenticatedHttpRequester {
    private AuthenticatedHttpRequester() {}

    public static InputStream getInputStream(SiteSettings settings, URL url) throws IOException {
        URLConnection uc = url.openConnection();

        if (!settings.getUsername().isEmpty()) {
            String userpass = settings.getUsername() + ":" + settings.getPassword();
            String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(
                    userpass.getBytes());
            uc.setRequestProperty ("Authorization", basicAuth);
        }

        return uc.getInputStream();
    }
}

package net.bettyluke.tracinstant.data;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import net.bettyluke.tracinstant.prefs.SiteSettings;

public final class AuthenticatedHttpRequester {
    private AuthenticatedHttpRequester() {}

    public static InputStream getInputStream(SiteSettings settings, URL url) throws IOException {
        URLConnection uc = url.openConnection();

        if (!settings.getUsername().isEmpty()) {
            String userpass = settings.getUsername() + ":" + settings.getPassword();
            String basicAuth = "Basic " +
                    javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes());

// Note: change to the following when moving to Java 8, as the above will stop working in Java 9.
//                    Base64.getEncoder().encodeToString(userpass.getBytes());
            uc.setRequestProperty ("Authorization", basicAuth);
        }

        return uc.getInputStream();
    }
}

Comment how to port to new Base64 encoder in Java 8 and 9


package io.jasonsparc.chemistry.util;

import android.support.annotation.AnyRes;
import android.support.v7.widget.RecyclerView;

import io.jasonsparc.chemistry.ViewType;

/**
 * Created by jason on 11/07/2016.
 */
@UtilityClass
public final class ViewTypes {

	/**
	 * An invalid view type, disguised to be valid. The value is equivalent to
	 * {@link RecyclerView#INVALID_TYPE}.
	 * <p>
	 * This can be used in situations where an invalid view type is actually intended but is
	 * restricted to use only valid view types. This variable however disregards such restrictions.
	 */
	@ViewType
	@AnyRes
	public static final int INVALID = invalid();

	public static void validateArgument(int viewType) {
		if (viewType < ValidRes.MIN_RES_ID) {
			throw new IllegalArgumentException("Invalid view type! Must be a resource identifier.");
		}
	}

	public static void validateForState(int viewType) {
		if (viewType < ValidRes.MIN_RES_ID) {
			throw new IllegalStateException("Invalid view type! Must be a resource identifier.");
		}
	}

	// Internals

	@SuppressWarnings("Range")
	@ViewType
	@AnyRes
	private static int invalid() {
		return RecyclerView.INVALID_TYPE;
	}
}

package io.jasonsparc.chemistry.util;

import android.support.annotation.AnyRes;
import android.support.v7.widget.RecyclerView;

import io.jasonsparc.chemistry.ViewType;

/**
 * Created by jason on 11/07/2016.
 */
@UtilityClass
public final class ViewTypes {

	/**
	 * An invalid view type, disguised to be valid. The value is equivalent to
	 * {@link RecyclerView#INVALID_TYPE}.
	 * <p>
	 * This can be used in situations where an invalid view type is actually intended but is
	 * restricted to use only valid view types. This variable however disregards such restrictions.
	 */
	@ViewType
	@AnyRes
	public static final int INVALID = invalid();

	public static boolean isValid(int viewType) {
		return viewType >= ValidRes.MIN_RES_ID;
	}

	public static void validateArgument(int viewType) {
		if (viewType < ValidRes.MIN_RES_ID) {
			throw new IllegalArgumentException("Invalid view type! Must be a resource identifier.");
		}
	}

	public static void validateForState(int viewType) {
		if (viewType < ValidRes.MIN_RES_ID) {
			throw new IllegalStateException("Invalid view type! Must be a resource identifier.");
		}
	}

	// Internals

	@SuppressWarnings("Range")
	@ViewType
	@AnyRes
	private static int invalid() {
		return RecyclerView.INVALID_TYPE;
	}
}

Add a utility for checking valid view types


package org.ehcache.build.conventions;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.tasks.testing.Test;
import org.gradle.testing.jacoco.plugins.JacocoPlugin;
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension;
import org.gradle.testing.jacoco.tasks.JacocoReport;

public class JacocoConvention implements Plugin<Project> {

  @Override
  public void apply(Project project) {
    project.getPlugins().apply(JacocoPlugin.class);

    project.getTasks().withType(JacocoReport.class).configureEach(jacocoReport -> {
      jacocoReport.getReports().configureEach(report -> {
        report.getRequired().set(false);
      });
    });

    project.getTasks().withType(Test.class).configureEach(test -> {
      test.getExtensions().configure(JacocoTaskExtension.class, jacoco -> {
        jacoco.getExcludes().add("org.terracotta.tripwire.*");
      });
    });
  }
}

package org.ehcache.build.conventions;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.tasks.testing.Test;
import org.gradle.testing.jacoco.plugins.JacocoPlugin;
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension;
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension;
import org.gradle.testing.jacoco.tasks.JacocoReport;

public class JacocoConvention implements Plugin<Project> {

  @Override
  public void apply(Project project) {
    project.getPlugins().apply(JacocoPlugin.class);

    project.getExtensions().configure(JacocoPluginExtension.class, jacoco -> {
      jacoco.setToolVersion("0.8.8");
    });

    project.getTasks().withType(JacocoReport.class).configureEach(jacocoReport -> {
      jacocoReport.getReports().configureEach(report -> {
        report.getRequired().set(false);
      });
    });

    project.getTasks().withType(Test.class).configureEach(test -> {
      test.getExtensions().configure(JacocoTaskExtension.class, jacoco -> {
        jacoco.getExcludes().add("org.terracotta.tripwire.*");
      });
    });
  }
}

Upgrade to Jacoco 0.8.8 for Java 18 compatibility.


// ========================================================================
// Copyright 2010 NEXCOM Systems
// ------------------------------------------------------------------------
// 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.cipango.diameter.router;

import java.util.Hashtable;
import java.util.Map;

import org.cipango.diameter.node.DiameterRequest;
import org.cipango.diameter.node.Node;
import org.cipango.diameter.node.Peer;

public class DefaultRouter implements DiameterRouter
{

	private Map<String, Peer> _peers = new Hashtable<String, Peer>();

	public Peer getRoute(DiameterRequest request)
	{
		return _peers.get(request.getDestinationHost());
	}

	public void peerAdded(Peer peer)
	{
		_peers.put(peer.getHost(), peer);
	}

	public void peerRemoved(Peer peer)
	{
		_peers.remove(peer.getHost());
	}

}

// ========================================================================
// Copyright 2010 NEXCOM Systems
// ------------------------------------------------------------------------
// 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.cipango.diameter.router;

import java.util.Hashtable;
import java.util.Map;

import org.cipango.diameter.node.DiameterRequest;
import org.cipango.diameter.node.Peer;

public class DefaultRouter implements DiameterRouter
{

	private Map<String, Peer> _peers = new Hashtable<String, Peer>();

	public Peer getRoute(DiameterRequest request)
	{
		if (request.getDestinationHost() == null)
			return null;
		return _peers.get(request.getDestinationHost());
	}

	public void peerAdded(Peer peer)
	{
		_peers.put(peer.getHost(), peer);
	}

	public void peerRemoved(Peer peer)
	{
		_peers.remove(peer.getHost());
	}

}

Fix CIPANGO-99: Creating a DiameterServletRequest without specifying the destinationhost field leads to a null pointer exception when sending a the request


/*
 * Hibernate Validator, declare and validate application constraints
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
 */

// $Id:$
package org.hibernate.validator.constraints;

/**
 * The Enum {@code CompositionType} which is used as argument to the annotation {@code ConstraintComposition}.
 */
public enum CompositionType {
	/**
	 * Used to indicate the disjunction of all constraints it is applied to.
	 */
	OR,

	/**
	 * Used to indicate the conjunction of all the constraints it is applied to.
	 */
	AND,

	/**
	 * ALL_FALSE is a generalisation of the usual NOT operator, which is applied to
	 * a list of conditions rather than just one element.
	 * When the annotation it is used on is composed of a single constraint annotation, then it is equivalent to NOT.
	 */
	ALL_FALSE
}

/*
 * Hibernate Validator, declare and validate application constraints
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
 */

package org.hibernate.validator.constraints;

/**
 * The Enum {@code CompositionType} which is used as argument to the annotation {@code ConstraintComposition}.
 */
public enum CompositionType {
	/**
	 * Used to indicate the disjunction of all constraints it is applied to.
	 */
	OR,

	/**
	 * Used to indicate the conjunction of all the constraints it is applied to.
	 */
	AND,

	/**
	 * ALL_FALSE is a generalisation of the usual NOT operator, which is applied to
	 * a list of conditions rather than just one element.
	 * When the annotation it is used on is composed of a single constraint annotation, then it is equivalent to NOT.
	 */
	ALL_FALSE
}

Remove a remaining $Id:$ marker

Remove a remaining $Id:$ marker