package net.idlesoft.android.hubroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Dashboard extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dashboard);

		((Button)findViewById(R.id.btn_dashboard_newsfeed)).setOnClickListener(new OnClickListener() {
			public void onClick(View v)
			{
				startActivity(new Intent(Dashboard.this, NewsFeed.class));
			}
		});
	}
}

package net.idlesoft.android.hubroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

public class Dashboard extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dashboard);

		((ImageButton)findViewById(R.id.btn_search)).setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                startActivity(new Intent(Dashboard.this, Search.class));
            }
        });
		((Button)findViewById(R.id.btn_dashboard_newsfeed)).setOnClickListener(new OnClickListener() {
			public void onClick(View v)
			{
				startActivity(new Intent(Dashboard.this, NewsFeed.class));
			}
		});
	}
}

Add code to handle the search button


/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.cities;

import org.terasology.cities.settlements.Settlement;
import org.terasology.entitySystem.Component;

/**
 * Indicates a settlement.
 */
public final class SettlementComponent implements Component {

    public Settlement settlement;

    public SettlementComponent(Settlement settlement) {
        this.settlement = settlement;
    }
}

/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.cities;

import org.terasology.cities.settlements.Settlement;
import org.terasology.entitySystem.Component;

/**
 * Indicates a settlement.
 */
public final class SettlementComponent implements Component {

    public Settlement settlement;

    public SettlementComponent() {
    }

    public SettlementComponent(Settlement settlement) {
        this.settlement = settlement;
    }
}

Fix the error caused by missing default constructor that is used when copying components internally.


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

package com.freshplanet.ane.AirAACPlayer;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREExtension;

public class Extension implements FREExtension
{
	public static final String TAG = "AirAACPlayer";
    public static ExtensionContext context;

    @Override
    public FREContext createContext(String arg0)
    {
        context = new ExtensionContext();
        return context;
    }

    @Override
    public void dispose()
    {
        context = null;
    }

    @Override
    public void initialize() { }

    public static void log(String message)
    {
        context.dispatchStatusEventAsync("LOGGING", message);
    }
}

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

package com.freshplanet.ane.AirAACPlayer;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREExtension;

public class Extension implements FREExtension
{
	public static final String TAG = "AirAACPlayer";
    private ExtensionContext context;

    @Override
    public FREContext createContext(String arg0)
    {
        context = new ExtensionContext();
        return context;
    }

    @Override
    public void dispose()
    { }

    @Override
    public void initialize() { }

    public void log(String message)
    {
        context.dispatchStatusEventAsync("LOGGING", message);
    }
}

Convert extension to be instantiable


package me.dreamteam.tardis;

import java.awt.Canvas;
import java.awt.image.BufferStrategy;

/**
Main Class
 */

public class Game extends Canvas {

	/**
	 * Begin the game parameters that will allow us to define certain elements.
	 */

	private BufferStrategy strategy;
	// This provides hardware acceleration

	private boolean isRunning = true;
	// Is the game running or not?

}

package me.dreamteam.tardis;

import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferStrategy;

import javax.swing.JFrame;
import javax.swing.JPanel;

/**
Main Class
 */

public class Game extends Canvas {

	/**
	 * Begin the game parameters that will allow us to define certain elements.
	 */

	private BufferStrategy strategy;
	// This provides hardware acceleration

	private boolean isRunning = true;
	// Is the game running or not?

	private String gameName = "Codename TARDIS ";
	private String build = "Alpha ";
	private String version = "0.1";
	// Version set up so that we can see where we are at

	public Game() {
		// create a frame to contain our game
		JFrame container = new JFrame(gameName + "- " + build + version);

		// get hold the content of the frame and set up the resolution of the game
		JPanel panel = (JPanel) container.getContentPane();
		panel.setPreferredSize(new Dimension(500,650));
		// Katie feel free to change this to the dimensions as given in the photoshop document
		panel.setLayout(null);

		// setup our canvas size and put it into the content of the frame
		setBounds(0,0,500,650);
		panel.add(this);

		// Tell AWT not to bother repainting our canvas since we're
		// going to do that our self in accelerated mode
		setIgnoreRepaint(true);

		// finally make the window visible
		container.pack();
		container.setResizable(false);
		container.setVisible(true);

		// add a listener to respond to the user closing the window. If they
		// do we'd like to exit the game
		container.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
	}

	/**
	 * Garbage collection and looping
	 */
	private void startGame() {

	}

	public void gameLoop() {
		long lastLoopTime = System.currentTimeMillis();

		while (isRunning) {
			long delta = System.currentTimeMillis() - lastLoopTime;
			lastLoopTime = System.currentTimeMillis();

		}
	}

	/**
	 * Game Start
	 */
	public static void main(String argv[]) {
		Game g =new Game();

		// Start the main game loop
		g.gameLoop();
	}

}

Build the canvas, add more params, game loop, main!!!


package xyz.igorgee.shapejs;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class ShapeJS {

    private static final MediaType MEDIA_TYPE_JPG = MediaType.parse("image/jpg");
    private static final String ENDPOINT = "http://52.90.86.247/image";
    public static final String SHAPE_JS_IMAGE_KEY = "shapeJS_img";

    private final OkHttpClient client = new OkHttpClient();

    public InputStream uploadImage(File image) throws IOException {
        RequestBody requestBody = new MultipartBody.Builder()
                .setType(MultipartBody.FORM)
                .addFormDataPart(SHAPE_JS_IMAGE_KEY, image.getName(),
                        RequestBody.create(MEDIA_TYPE_JPG, image))
                .build();

        Request request = new Request.Builder()
                .url(ENDPOINT)
                .post(requestBody)
                .build();

        Response response = client.newCall(request).execute();
        return response.body().byteStream();
    }
}

package xyz.igorgee.shapejs;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.TimeUnit;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class ShapeJS {

    private static final MediaType MEDIA_TYPE_JPG = MediaType.parse("image/jpg");
    private static final String ENDPOINT = "http://52.90.86.247/image";
    public static final String SHAPE_JS_IMAGE_KEY = "shapeJS_img";

    private final OkHttpClient client = new OkHttpClient.Builder()
            .readTimeout(20, TimeUnit.SECONDS)
            .build();

    public InputStream uploadImage(File image) throws IOException {
        RequestBody requestBody = new MultipartBody.Builder()
                .setType(MultipartBody.FORM)
                .addFormDataPart(SHAPE_JS_IMAGE_KEY, image.getName(),
                        RequestBody.create(MEDIA_TYPE_JPG, image))
                .build();

        Request request = new Request.Builder()
                .url(ENDPOINT)
                .post(requestBody)
                .build();

        Response response = client.newCall(request).execute();

        if (!response.isSuccessful()) throw new IOException("Unsuccessful response");

        return response.body().byteStream();
    }
}

Increase timeout for intense images


package feedmeyoutubecrawler;

/* Copyright (C) 2015 Robert Lehmann <lehmrob@gmail.com>
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

import feedmeyoutubecrawler.crawler.Crawler;
import feedmeyoutubecore.Version;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Main class which runs the main application.
 * @author Robert Lehmann
 * @since 1.0
 */
public class Main
{
    private static final Logger LOG = LoggerFactory.getLogger(Main.class);

    public static void main(String[] arg)
    {
        LOG.debug("Starting App in Version {}", Version.VERSION);
        final Crawler crawler;
        try {
            crawler = new Crawler();
            crawler.crawl();
        } catch (final IOException ex) {
            LOG.error("Error during the initialisation of the crawler", ex);
        }
    }
}

package feedmeyoutubecrawler;

/* Copyright (C) 2015 Robert Lehmann <lehmrob@gmail.com>
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

import feedmeyoutubecore.Version;
import feedmeyoutubecore.obj.YouTubeVideo;
import feedmeyoutubecrawler.crawler.VideoCrawler;
import feedmeyoutubecrawler.crawler.YouTubeConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;

/**
 * Main class which runs the main application.
 * @author Robert Lehmann
 * @since 1.0
 */
public class Main
{
    private static final Logger LOG = LoggerFactory.getLogger(Main.class);

    public static void main(String[] arg)
    {
        LOG.debug("Starting App in Version {}", Version.VERSION);

        try {
            final VideoCrawler vc = new VideoCrawler(new YouTubeConnection());
            if (vc.hasNext()) {
                List<YouTubeVideo> videos = vc.getNextVideos();
                LOG.info("Size of video list {}", videos.size());
                videos.stream().forEach(video -> LOG.info("Video info {}", video.VideoId));
            }
        } catch (final IOException e) {
            LOG.error("Can't connect to youtube", e);
        }
    }
}

Remove usage of Crawler class


package heufybot.core;

public class User
{
	private String nickname;
	private String login;
	private String hostmask;

	public User(String nickname, String login, String hostmask)
	{
		this.nickname = nickname;
		this.login = login;
		this.hostmask = hostmask;
	}

	public User(String nickname)
	{
		this.nickname = nickname;
	}

	public String getNickname()
	{
		return nickname;
	}

	public String getLogin()
	{
		return login;
	}

	public String getHostmask()
	{
		return hostmask;
	}

	public void setNickname(String nickname)
	{
		this.nickname = nickname;
	}

	public void setLogin(String login)
	{
		this.login = login;
	}

	public void setHostmask(String hostmask)
	{
		this.hostmask = hostmask;
	}
}

package heufybot.core;

public class User
{
	private String nickname;
	private String login;
	private String hostmask;
	private String realname;
	private boolean isOper;

	public User(String nickname, String login, String hostmask)
	{
		this.nickname = nickname;
		this.login = login;
		this.hostmask = hostmask;
	}

	public User(String nickname)
	{
		this.nickname = nickname;
	}

	public String getNickname()
	{
		return nickname;
	}

	public String getLogin()
	{
		return login;
	}

	public String getHostmask()
	{
		return hostmask;
	}

	public void setNickname(String nickname)
	{
		this.nickname = nickname;
	}

	public void setLogin(String login)
	{
		this.login = login;
	}

	public void setHostmask(String hostmask)
	{
		this.hostmask = hostmask;
	}

	public String getRealname()
	{
		return realname;
	}

	public void setRealname(String realname)
	{
		this.realname = realname;
	}

	public boolean isOper()
	{
		return isOper;
	}

	public void setOper(boolean isOper)
	{
		this.isOper = isOper;
	}
}

Add more information that will be saved upon receiving a /WHO reply


/*
 * Created on 04-Feb-2004
 *
 * (c) 2003-2004 ThoughtWorks
 *
 * See license.txt for licence details
 */
package com.thoughtworks.proxy.toys.delegate;

import com.thoughtworks.proxy.ProxyFactory;
import com.thoughtworks.proxy.factory.StandardProxyFactory;

/**
 * @author Dan North
 */
public class Delegating {
    /** delegate must implement the method's interface */
    public static final boolean STATIC_TYPING = DelegatingInvoker.EXACT_METHOD;
    /** delegate must have method with matching signature - not necessarily the same */
    public static final boolean DYNAMIC_TYPING = DelegatingInvoker.SAME_SIGNATURE_METHOD;

    public static Object object(Class type, Object delegate) {
        return object(type, delegate, new StandardProxyFactory());
    }

    public static Object object(Class type, Object delegate, ProxyFactory factory) {
        return factory.createProxy(new Class[] {type}, new DelegatingInvoker(delegate));
    }

    /** It's a factory, stupid */
    private Delegating(){}
}

/*
 * Created on 04-Feb-2004
 *
 * (c) 2003-2004 ThoughtWorks
 *
 * See license.txt for licence details
 */
package com.thoughtworks.proxy.toys.delegate;

import com.thoughtworks.proxy.ProxyFactory;
import com.thoughtworks.proxy.factory.StandardProxyFactory;

/**
 * @author Dan North
 */
public class Delegating {
    /** delegate must implement the method's interface */
    public static final boolean STATIC_TYPING = DelegatingInvoker.EXACT_METHOD;
    /** delegate must have method with matching signature - not necessarily the same */
    public static final boolean DYNAMIC_TYPING = DelegatingInvoker.SAME_SIGNATURE_METHOD;

    public static Object object(Class type, Object delegate) {
        return object(type, delegate, new StandardProxyFactory());
    }

    public static Object object(Class type, Object delegate, ProxyFactory factory) {
        return factory.createProxy(
                new Class[] {type},
                new DelegatingInvoker(factory, new SimpleReference(delegate), DYNAMIC_TYPING));
    }

    /** It's a factory, stupid */
    private Delegating(){}
}

Fix possible mix of ProxyFactory instances.


package com.github.culmat.easyjdbc.beans;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.dbutils.BeanProcessor;

public class XBeanProcessor extends BeanProcessor {

  public static interface PostProcessor<T> {
    public T postProcess(T value);
    public Class<T> registerTo();
  }

  Map<Class<?>, PostProcessor<?>> postProcessors = new HashMap<Class<?>, XBeanProcessor.PostProcessor<?>>();

  public XBeanProcessor() {
    super();
  }

  public XBeanProcessor(Map<String, String> columnToPropertyOverrides) {
    super(columnToPropertyOverrides);
  }

  public XBeanProcessor addPostProcessor(PostProcessor<?> processor) {
    postProcessors.put(processor.registerTo(), processor);
    return this;
  }

  @SuppressWarnings("unchecked")
  protected Object processColumn(ResultSet rs, int index, Class<?> propType) throws SQLException {
    final Object ret = super.processColumn(rs, index, propType);
    @SuppressWarnings("rawtypes")
    PostProcessor postProc = postProcessors.get(propType);
    return postProc == null ? ret : postProc.postProcess(ret);
  }

}

package com.github.culmat.easyjdbc.beans;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.dbutils.BeanProcessor;

public class XBeanProcessor extends BeanProcessor {

  public static interface PostProcessor<T> {
    public T postProcess(T value);
    public Class<?> registerTo();
  }

  Map<Class<?>, PostProcessor<?>> postProcessors = new HashMap<Class<?>, XBeanProcessor.PostProcessor<?>>();

  public XBeanProcessor() {
    super();
  }

  public XBeanProcessor(Map<String, String> columnToPropertyOverrides) {
    super(columnToPropertyOverrides);
  }

  public XBeanProcessor addPostProcessor(PostProcessor<?> processor) {
    postProcessors.put(processor.registerTo(), processor);
    return this;
  }

  @SuppressWarnings("unchecked")
  protected Object processColumn(ResultSet rs, int index, Class<?> propType) throws SQLException {
    final Object ret = super.processColumn(rs, index, propType);
    @SuppressWarnings("rawtypes")
    PostProcessor postProc = postProcessors.get(propType);
    return postProc == null ? ret : postProc.postProcess(ret);
  }

}

Allow registered and processed classes to differ as BeanProcessor does internal conversation. Useful i.e. for enum types.


package fr.insee.pogues.webservice.rest;

/**
 * Created by acordier on 04/07/17.
 */
public class PoguesException extends Exception {

    private int status;
    private String details;

    /**
     *
     * @param status
     * @param message
     * @param details
     */
    public PoguesException(int status, String message, String details) {
        super(message);
        this.status = status;
        this.details = details;
    }

    public RestMessage toRestMessage(){
        return new RestMessage(this.status, this.getMessage(), this.details);
    }
}

package fr.insee.pogues.webservice.rest;

import java.io.IOException;

/**
 * Created by acordier on 04/07/17.
 */
public class PoguesException extends IOException {

    private int status;
    private String details;

    /**
     *
     * @param status
     * @param message
     * @param details
     */
    public PoguesException(int status, String message, String details) {
        super(message);
        this.status = status;
        this.details = details;
    }

    public RestMessage toRestMessage(){
        return new RestMessage(this.status, this.getMessage(), this.details);
    }
}

Make pogues exception usable in authorization filter


// Get JAFFE database from http://www.kasrl.org/jaffe_info.html
// Extract pics in folder named "jaffe"
// package image_test;

import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class svq {

    public static void main(String[] args) {
        // read image
        BufferedImage input = null;
        try {
            input = ImageIO.read(new File("jaffe/KA.AN1.39.tiff.bmp"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        // to byte array
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            ImageIO.write( input, "bmp", baos );
            baos.flush();
        } catch (IOException e) {

        }
        byte[] bytearray = baos.toByteArray();

        System.out.println("Done!");
    }
}

// Get JAFFE database from http://www.kasrl.org/jaffe_info.html
// Extract pics in folder named "jaffe"
// package image_test;

import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class svq {

    public static void main(String[] args) {
        // read image
        BufferedImage input = null;
        try {
            input = ImageIO.read(new File("jaffe/KA.AN1.39.tiff.bmp"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        // to byte array
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            ImageIO.write( input, "bmp", baos );
            baos.flush();
        } catch (IOException e) {

        }
        byte[] bytearray = baos.toByteArray();

        // to BufferedImage
        ByteArrayInputStream bais = new ByteArrayInputStream(bytearray);
        BufferedImage output = null;
        try {
            output = ImageIO.read(bais);
            bais.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        System.out.println("Done!");
    }
}

Convert byte array to buffered image


package com.github.ayltai.newspaper;

import android.app.Application;

import com.facebook.common.logging.FLog;
import com.facebook.stetho.Stetho;
import com.github.ayltai.newspaper.util.TestUtils;
import com.squareup.leakcanary.LeakCanary;

public abstract class BaseApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        if (!TestUtils.isRunningInstrumentalTest()) {
            if (!LeakCanary.isInAnalyzerProcess(this)) LeakCanary.install(this);

            FLog.setMinimumLoggingLevel(FLog.WARN);
            Stetho.initializeWithDefaults(this);
        }
    }
}

package com.github.ayltai.newspaper;

import android.app.Application;

import com.facebook.common.logging.FLog;
import com.facebook.stetho.Stetho;
import com.github.ayltai.newspaper.util.TestUtils;
import com.squareup.leakcanary.LeakCanary;

public abstract class BaseApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        if (!TestUtils.isRunningUnitTest() && !TestUtils.isRunningInstrumentalTest()) {
            if (!LeakCanary.isInAnalyzerProcess(this)) LeakCanary.install(this);

            FLog.setMinimumLoggingLevel(FLog.WARN);
            Stetho.initializeWithDefaults(this);
        }
    }
}

Disable Facebook Stetho in tests


package app.android.gambit.local;

public class DbException extends RuntimeException
{
	public DbException() {
	}

	public DbException(String detailMessage) {
		super(detailMessage);
	}
}

package app.android.gambit.local;

class DbException extends RuntimeException
{
	public DbException() {
	}

	public DbException(String detailMessage) {
		super(detailMessage);
	}
}

Change visibility of database exception.


/*
 * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

package org.gluu.model;

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

import org.gluu.persist.annotation.AttributeEnum;

/**
 * Specify type of script location
 *
 * @author Yuriy Movchan Date: 10/07/2015
 */
public enum ScriptLocationType implements AttributeEnum {

    DB("db", "Database"), FILE("file", "File");

    private String value;
    private String displayName;

    private static Map<String, ScriptLocationType> MAP_BY_VALUES = new HashMap<String, ScriptLocationType>();

    static {
        for (ScriptLocationType enumType : values()) {
            MAP_BY_VALUES.put(enumType.getValue(), enumType);
        }
    }

    ScriptLocationType(String value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    public String getValue() {
        return value;
    }

    public String getDisplayName() {
        return displayName;
    }

    public static ScriptLocationType getByValue(String value) {
        return MAP_BY_VALUES.get(value);
    }

    public Enum<? extends AttributeEnum> resolveByValue(String value) {
        return getByValue(value);
    }

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

}

/*
 * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

package org.gluu.model;

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

import org.gluu.persist.annotation.AttributeEnum;

/**
 * Specify type of script location
 *
 * @author Yuriy Movchan Date: 10/07/2015
 */
public enum ScriptLocationType implements AttributeEnum {

    LDAP("ldap", "Database"), FILE("file", "File");

    private String value;
    private String displayName;

    private static Map<String, ScriptLocationType> MAP_BY_VALUES = new HashMap<String, ScriptLocationType>();

    static {
        for (ScriptLocationType enumType : values()) {
            MAP_BY_VALUES.put(enumType.getValue(), enumType);
        }
    }

    ScriptLocationType(String value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    public String getValue() {
        return value;
    }

    public String getDisplayName() {
        return displayName;
    }

    public static ScriptLocationType getByValue(String value) {
        return MAP_BY_VALUES.get(value);
    }

    public Enum<? extends AttributeEnum> resolveByValue(String value) {
        return getByValue(value);
    }

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

}

Replace LDAP displayName only enum with Database


/*
 * Copyright 2015, Yahoo Inc.
 * Copyrights licensed under the Apache 2.0 License.
 * See the accompanying LICENSE file for terms.
 */
package com.yahoo.squidb.processor.data;

import com.yahoo.aptutils.model.DeclaredTypeName;

/**
 * Tuple class to hold logged error info, to be written by the
 * {@link com.yahoo.squidb.processor.plugins.defaults.ErrorLoggingPlugin}.
 */
public final class ErrorInfo {

    public final DeclaredTypeName errorClass; // The class on which to log the error
    public final String element; // The specific element on which to log the error (or null/empty to log on the class)
    public final String message; // The error message to log

    public ErrorInfo(DeclaredTypeName errorClass, String element, String message) {
        this.errorClass = errorClass;
        this.element = element;
        this.message = message;
    }
}

/*
 * Copyright 2015, Yahoo Inc.
 * Copyrights licensed under the Apache 2.0 License.
 * See the accompanying LICENSE file for terms.
 */
package com.yahoo.squidb.processor.data;

import com.yahoo.aptutils.model.DeclaredTypeName;

/**
 * Tuple class to hold logged error info, to be written by the
 * {@link com.yahoo.squidb.processor.plugins.defaults.ErrorLoggingPlugin}.
 */
public final class ErrorInfo {

    /**
     * The class on which to log the error
     */
    public final DeclaredTypeName errorClass;

    /**
     * The specific element on which to log the error (or null/empty to log on the class)
     */
    public final String element;

    /**
     * The error message to log
     */
    public final String message;

    public ErrorInfo(DeclaredTypeName errorClass, String element, String message) {
        this.errorClass = errorClass;
        this.element = element;
        this.message = message;
    }
}

Move comments to public javadocs


package controllers;

import play.mvc.Controller;
import services.configuration.ConfigurationService;
import utils.json.JsonHelper;

import com.google.inject.Singleton;

@Singleton
public class AbstractController extends Controller {

    protected static final String _TITLE = "Reactive AngularApp's - Elasticsearch 1.4.1";

    protected final ConfigurationService configurationService;
    protected final String hostName;

    protected AbstractController(ConfigurationService configurationService) {
        this.configurationService = configurationService;
        this.hostName = configurationService.getHostName();
    }

    protected Status _internalServerError(String key) {
        return internalServerError(
                JsonHelper.toResultExceptionModel(key));
    }

    protected Status _preconditionFailed(String key) {
        return status(PRECONDITION_FAILED,
                JsonHelper.toResultExceptionModel(key));
    }

    protected void clearSession() {
        session().clear();
    }

    protected void flashSuccess(String message) {
        flash("success", message);
    }
}

package controllers;

import play.mvc.Controller;
import services.configuration.ConfigurationService;
import utils.json.JsonHelper;

import com.google.inject.Singleton;

@Singleton
public class AbstractController extends Controller {

    protected static final String _TITLE = "Reactive AngularApp's - Elasticsearch 1.4.1";

    protected final ConfigurationService configurationService;
    protected final String hostName;

    protected AbstractController(ConfigurationService configurationService) {
        this.configurationService = configurationService;
        this.hostName = configurationService.getHostName();
    }

    protected static Status _internalServerError(String key) {
        return internalServerError(
                JsonHelper.toResultExceptionModel(key));
    }

    protected static Status _preconditionFailed(String key) {
        return status(PRECONDITION_FAILED,
                JsonHelper.toResultExceptionModel(key));
    }

    protected void clearSession() {
        session().clear();
    }

    protected void flashSuccess(String message) {
        flash("success", message);
    }
}

Fix ./activator dist for the scaladoc


package com.stripe.model;

public final class SourceRedirectFlow extends StripeObject {
	String url;
	String returnUrl;
	String status;

	public String getURL() {
		return url;
	}

	public void setURL(String url) {
		this.url = url;
	}

	public String getReturnURL() {
		return returnUrl;
	}

	public void setReturnURL(String returnUrl) {
		this.returnUrl = returnUrl;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
}

package com.stripe.model;

public final class SourceRedirectFlow extends StripeObject {
	String failureReason;
	String returnUrl;
	String status;
	String url;

	public String getFailureReason() {
		return failureReason;
	}

	public void setFailureReason(String failureReason) {
		this.failureReason = failureReason;
	}

	public String getReturnURL() {
		return returnUrl;
	}

	public void setReturnURL(String returnUrl) {
		this.returnUrl = returnUrl;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getURL() {
		return url;
	}

	public void setURL(String url) {
		this.url = url;
	}
}

Support for new failure_reason attribute


package revert.Entities;

import java.awt.Point;

import revert.AI.EnemyAi;
import revert.MainScene.World;

public class EnemyFactory {

	Point[] spawnPoints;
	World world;

	public EnemyFactory(World world, Point... spawns)
	{
		this.spawnPoints = spawns;
		this.world = world;
	}

	/**
	 * Create a data set array
	 * @param size
	 * @return
	 */
	public int[][] createWave(int size)
	{
		int[][] wave = new int[size][];

		for (int i = 0; i < size; i++)
		{
			Point loc = spawnPoints[(int)(Math.random()*spawnPoints.length)];

			int[] n = {loc.x, loc.y, (int)(Math.random()*3)};

			wave[i] = n;
		}

		return wave;
	}

	public Enemy generateEnemy(int type)
	{
		Enemy e = new Enemy(world, world.getPlayer());
		EnemyAi ai = null;
		if (type == 0)
		{
			//ai = new PassiveAi();
		}
		else
		{
			System.out.println("No enemy type corresponds to value: " + type + ".  Instantiating basic enemy");
		}

		e.setAI(ai);

		return e;
	}
}

package revert.Entities;

import java.awt.Point;

import com.kgp.util.Vector2;

import revert.AI.EnemyAi;
import revert.MainScene.World;

public class EnemyFactory {

	Vector2[] spawnPoints;
	World world;

	public EnemyFactory(World world, Vector2... spawns)
	{
		this.spawnPoints = spawns;
		this.world = world;
	}

	/**
	 * Create a data set array
	 * @param size
	 * @return
	 */
	public int[][] createWave(int size)
	{
		int[][] wave = new int[size][];

		for (int i = 0; i < size; i++)
		{
			Vector2 loc = spawnPoints[(int)(Math.random()*spawnPoints.length)];

			int[] n = {(int)loc.x, (int)loc.y, (int)(Math.random()*3)};

			wave[i] = n;
		}

		return wave;
	}

	public Enemy generateEnemy(int type)
	{
		Enemy e = new Enemy(world, world.getPlayer());
		EnemyAi ai = null;
		if (type == 0)
		{
			//ai = new PassiveAi();
		}
		else
		{
			System.out.println("No enemy type corresponds to value: " + type + ".  Instantiating basic enemy");
		}

		e.setAI(ai);

		return e;
	}
}

Fix enemy factory since world is now using vector2


package cgeo.geocaching;

import junit.framework.TestCase;

public class LogTemplateProviderTest extends TestCase {

    public static void testApplyTemplates() {
        final String noTemplates = " no templates ";
        assertEquals(noTemplates, LogTemplateProvider.applyTemplates(noTemplates, true));
        assertTrue(LogTemplateProvider.applyTemplates("[DATE]", true).contains("."));
    }

}

package cgeo.geocaching;

import java.util.Calendar;

import junit.framework.TestCase;

public class LogTemplateProviderTest extends TestCase {

    public static void testApplyTemplates() {
        final String noTemplates = " no templates ";
        assertEquals(noTemplates, LogTemplateProvider.applyTemplates(noTemplates, true));

        // This test can occasionally fail if the current year changes right after the next line.
        final String currentYear = Integer.toString(Calendar.YEAR);
        assertTrue(LogTemplateProvider.applyTemplates("[DATE]", true).contains(currentYear));
    }

}

Fix text by requiring the current year to be present in output


package us.myles.ViaVersion.api;

/**
 * Created by Hugo on 22/03/2016.
 */
public interface ViaVersionConfig {

    /**
     * Obtain if global debug is enabled
     *
     * @return true if debug is enabled
     */
    boolean isDebug();

    /**
     * Obtain if collision preventing for players is enabled
     *
     * @return true if collision preventing is enabled
     */
    boolean isPreventCollision();

    boolean isNewEffectIndicator();

    boolean isSuppressMetadataErrors();

    boolean isShieldBlocking();

    boolean isHologramPatch();

    boolean isBossbarPatch();

    boolean isBossbarAntiflicker();

    boolean isUnknownEntitiesSuppressed();

    double getHologramYOffset();

    boolean isAutoTeam();
}

package us.myles.ViaVersion.api;

public interface ViaVersionConfig {

    /**
     * Obtain if global debug is enabled
     *
     * @return true if debug is enabled
     */
    boolean isDebug();

    /**
     * Obtain if collision preventing for players is enabled
     *
     * @return true if collision preventing is enabled
     */
    boolean isPreventCollision();

    /**
     * Obtain if 1.9 clients are shown the new effect indicator in the top-right corner
     *
     * @return true if the using of the new effect indicator is enabled
     */
    boolean isNewEffectIndicator();

    /**
     * Obtain if metadata errors will be suppressed
     *
     * @return true if metadata errors suppression is enabled
     */
    boolean isSuppressMetadataErrors();

    /**
     * Obtain if blocking in 1.9 appears as a player holding a shield
     *
     * @return true if shield blocking is enabled
     */
    boolean isShieldBlocking();

    /**
     * Obtain if armor stand positions are fixed so holograms show up at the correct height in 1.9
     *
     * @return true if hologram patching is enabled
     */
    boolean isHologramPatch();

    /**
     * Obtain if boss bars are fixed for 1.9 clients
     *
     * @return true if boss bar patching is enabled
     */
    boolean isBossbarPatch();

    /**
     * Obtain if the boss bars for 1.9 clients are being stopped from flickering
     * This will keep all boss bars on 100% (not recommended)
     *
     * @return true if boss bar anti flickering is enabled
     */
    boolean isBossbarAntiflicker();

    /**
     * Obtain if unknown entity errors will be suppressed
     *
     * @return true if boss bar patching is enabled
     */
    boolean isUnknownEntitiesSuppressed();

    /**
     * Obtain the vertical offset armor stands are being moved with when the hologram patch is enabled
     *
     * @return the vertical offset holograms will be moved with
     */
    double getHologramYOffset();

    /**
     * Obtain if players will be automatically put in the same team when collision preventing is enabled
     *
     * @return true if automatic teaming is enabled
     */
    boolean isAutoTeam();
}

Add descriptions for the new Config API


package com.pqbyte.coherence;

public final class Constants {
  private static final boolean DEBUG = true;

  public static boolean isDebug() {
    return DEBUG;
  }

  public static final int WORLD_WIDTH = 160;
  public static final int WORLD_HEIGHT = 90;

  /* Mask flags for Box2D filters. */
  public static final short PHYSICS_ENTITY = 0x1;
  public static final short WORLD_ENTITY = 0x2;
}

package com.pqbyte.coherence;

public final class Constants {
  private static final boolean DEBUG = true;

  public static boolean isDebug() {
    return DEBUG;
  }

  public static final int WORLD_WIDTH = 100;
  public static final int WORLD_HEIGHT = 100;

  /* Mask flags for Box2D filters. */
  public static final short PHYSICS_ENTITY = 0x1;
  public static final short WORLD_ENTITY = 0x2;
}

Change world size to 100x100


package access;

import config.MvcConfiguration;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

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

/**
 * Created by Vladyslav Dovhopol on 4/27/17.
 * Test Greeting Controller.
 */
@RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = MvcConfiguration.class)
public class AccessControllerTest {

    private MockMvc mockMvc;

    @Autowired
    private WebApplicationContext webApplicationContext;

    @Before
    public void setUp() {
        mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
    }

    @Test
    public void GET_NoPayload_Success() throws Exception {
        ResultActions result = mockMvc.perform(get("/greeting"));
        result.andExpect(status().isOk());
    }
}

package access;

import config.MvcConfiguration;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

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

/**
 * Created by Vladyslav Dovhopol on 4/27/17.
 * Test Greeting Controller.
 */
@RunWith(SpringRunner.class)
@WebAppConfiguration(value = "source/config")
@ContextConfiguration(classes = MvcConfiguration.class)
public class AccessControllerTest {

    private MockMvc mockMvc;

    @Autowired
    private WebApplicationContext webApplicationContext;

    @Before
    public void setUp() {
        mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
    }

    @Test
    public void GET_NoPayload_Success() throws Exception {
        ResultActions result = mockMvc.perform(get("/greeting"));
        result.andExpect(status().isOk());
    }
}

Set value to annotation @WebAppConfiguration in tests.


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

package org.chromium.sdk.internal.tools.v8;

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

/**
 * Known V8 VM debugger commands and events.
 */
public enum DebuggerCommand {
  CONTINUE("continue"),
  EVALUATE("evaluate"),
  BACKTRACE("backtrace"),
  FRAME("frame"),
  SCRIPTS("scripts"),
  SOURCE("source"),
  SETBREAKPOINT("setbreakpoint"),
  CHANGEBREAKPOINT("changebreakpoint"),
  CLEARBREAKPOINT("clearbreakpoint"),
  LOOKUP("lookup"),

  // Events
  BREAK("break"),
  EXCEPTION("exception"),
  AFTER_COMPILE("afterCompile"),
  ;

  public final String value;

  DebuggerCommand(String value) {
    this.value = value;
  }

  private static final Map<String, DebuggerCommand> valueToCommandMap =
      new HashMap<String, DebuggerCommand>();

  static {
    for (DebuggerCommand c : values()) {
      valueToCommandMap.put(c.value, c);
    }
  }

  /**
   * @param value the DebuggerCommand string value
   * @return the DebuggerCommand instance or null if none corresponds to value
   */
  public static DebuggerCommand forString(String value) {
    if (value == null) {
      return null;
    }
    return valueToCommandMap.get(value);
  }

}

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

package org.chromium.sdk.internal.tools.v8;

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

/**
 * Known V8 VM debugger commands and events.
 */
public enum DebuggerCommand {
  CONTINUE("continue"),
  EVALUATE("evaluate"),
  BACKTRACE("backtrace"),
  FRAME("frame"),
  SCRIPTS("scripts"),
  SOURCE("source"),
  SCOPE("scope"),
  SETBREAKPOINT("setbreakpoint"),
  CHANGEBREAKPOINT("changebreakpoint"),
  CLEARBREAKPOINT("clearbreakpoint"),
  LOOKUP("lookup"),

  // Events
  BREAK("break"),
  EXCEPTION("exception"),
  AFTER_COMPILE("afterCompile"),
  ;

  public final String value;

  DebuggerCommand(String value) {
    this.value = value;
  }

  private static final Map<String, DebuggerCommand> valueToCommandMap =
      new HashMap<String, DebuggerCommand>();

  static {
    for (DebuggerCommand c : values()) {
      valueToCommandMap.put(c.value, c);
    }
  }

  /**
   * @param value the DebuggerCommand string value
   * @return the DebuggerCommand instance or null if none corresponds to value
   */
  public static DebuggerCommand forString(String value) {
    if (value == null) {
      return null;
    }
    return valueToCommandMap.get(value);
  }

}

Add scopes to test framework


package org.cocos2dx.breakout;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;

import android.os.Bundle;
import android.widget.EditText;

public class BreakoutCocos2Dx extends Cocos2dxActivity{
	private Cocos2dxGLSurfaceView mGLView;

	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);

		// get the packageName,it's used to set the resource path
		String packageName = getApplication().getPackageName();
		super.setPackageName(packageName);

		setContentView(R.layout.game_demo);
        mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.game_gl_surfaceview);
        mGLView.setTextField((EditText)findViewById(R.id.textField));

        // Get the size of the mGLView after the layout happens
        mGLView.post(new Runnable() {

            @Override
            public void run() {
                Cocos2dxActivity.screenHeight = mGLView.getHeight();
                Cocos2dxActivity.screenWidth = mGLView.getWidth();
            }
        });
	}

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

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

     static {
    	 System.loadLibrary("cocos2d");
    	 System.loadLibrary("cocosdenshion");
         System.loadLibrary("game");
     }
}

package org.cocos2dx.breakout;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;

import android.os.Bundle;
import android.widget.EditText;

public class BreakoutCocos2Dx extends Cocos2dxActivity{
	private Cocos2dxGLSurfaceView mGLView;

	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);

		// get the packageName,it's used to set the resource path
		String packageName = getApplication().getPackageName();
		super.setPackageName(packageName);

		setContentView(R.layout.game_demo);
        mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.game_gl_surfaceview);
        mGLView.setTextField((EditText)findViewById(R.id.textField));

        // Get the size of the mGLView after the layout happens
        mGLView.post(new Runnable() {

            @Override
            public void run() {
                Cocos2dxActivity.screenHeight = mGLView.getHeight();
                Cocos2dxActivity.screenWidth = mGLView.getWidth();
            }
        });
	}

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

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

     static {
    	 System.loadLibrary("box2d");
    	 System.loadLibrary("cocos2d");
    	 System.loadLibrary("cocosdenshion");
         System.loadLibrary("game");
     }
}

Load box2d library in JNI


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.belocraft;

import com.belocraft.network.Runner;
import java.io.IOException;

/**
 *
 * @author Eugene
 */
public class Main {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws IOException {
        Runner runner;

        String adress = "127.0.0.1";
        int port = 25;

        if (args.length > 1) {
            adress = args[0];
            port = Integer.parseInt(args[1]);
        }else
        {
            System.out.println("Run with standart constants " +adress+":"+port);
        }

        runner = new Runner();

        if (runner.connect(adress, port)) {
            runner.run();
        }
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.belocraft;

import com.belocraft.network.Runner;
import java.io.IOException;

/**
 *
 * @author Eugene
 */
public class Main {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws IOException, Exception {
        Runner runner;

        String adress = "127.0.0.1";
        int port = 25;

        if (args.length > 1) {
            adress = args[0];
            port = Integer.parseInt(args[1]);
        }
        if (args.length == 1)
        {
            throw new Exception("Not enougth parametrs, need two parametrs adress and port");
        }

        runner = new Runner();

        if (runner.connect(adress, port)) {
            runner.run();
        }
    }
}

Add exception in strategy from not enought args


package com.twu.biblioteca;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.StringBuilder;
import java.util.List;
import java.util.ArrayList;

public class BibliotecaAppTest {

    @Test
    public void testBibliotecaStartup() {
        List<String> bookList = new ArrayList<String>();
        bookList.add("Test-Driven Development By Example");
        bookList.add("The Agile Samurai");
        bookList.add("Head First Java");
        bookList.add("Don't Make Me Think, Revisited: A Common Sense Approach to Web Usability");

        StringBuilder startupOutput = new StringBuilder();
        startupOutput.append("Welcome to Biblioteca!\n");
        startupOutput.append("Book list:\n");
        for (String book : bookList) {
            startupOutput.append(book + "\n");
        }

        ByteArrayOutputStream outContent = new ByteArrayOutputStream();
        System.setOut(new PrintStream(outContent));
        BibliotecaApp.main(new String[] {});

        assertEquals(startupOutput.toString(), outContent.toString());
    }
}

package com.twu.biblioteca;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.StringBuilder;
import java.util.List;
import java.util.ArrayList;
import java.util.Formatter;

public class BibliotecaAppTest {

    @Test
    public void testBibliotecaStartup() {
        StringBuilder expectedOutput = new StringBuilder();

        expectedOutput.append("Welcome to Biblioteca!\n");
        expectedOutput.append(printBookList());

        ByteArrayOutputStream outContent = new ByteArrayOutputStream();
        System.setOut(new PrintStream(outContent));
        BibliotecaApp.main(new String[] {});

        assertEquals(expectedOutput.toString(), outContent.toString());
    }

    private String printBookList() {
        List<Book> bookList = generateBookList();
        StringBuilder output = new StringBuilder();
        output.append("Book List:");

        String leftAlignFormat = "%-32s | %-32s | %-4d\n";
        output.append(String.format(leftAlignFormat, "Title", "Author", "Year Published"));
        for (List<Book> book : bookList) {
            output.append(String.format(leftAlignFormat, book.getTitle(), book.getAuthor(), book.getYearPublished()));
        }
        return output.toString();
    }

    private List<Book> generateBookList() {
        List<Book> bookList = new ArrayList<Book>();
        bookList.add(new Book("Test-Driven Development By Example", "Kent Beck", 2003));
        bookList.add(new Book("The Agile Samurai", "Jonathan Rasmusson", 2010));
        bookList.add(new Book("Head First Java", "Kathy Sierra & Bert Bates", 2005));
        bookList.add(new Book("Don't Make Me Think, Revisited: A Common Sense Approach to Web Usability", "Steve Krug", 2014));
        return bookList;
    }
}

Test printing book list with author and publish year


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

import playn.core.PlayN;
import playn.java.JavaPlatform;

import playn.tests.core.TestsGame;

public class TestsGameJava {

  public static void main(String[] args) {
    JavaPlatform.Config config = new JavaPlatform.Config();
    if (args.length > 0) {
      config.scaleFactor = Float.parseFloat(args[0]);
    }
    JavaPlatform platform = JavaPlatform.register(config);
    platform.setTitle("Tests");
    PlayN.run(new TestsGame());
  }
}

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

import playn.core.PlayN;
import playn.java.JavaPlatform;

import playn.tests.core.TestsGame;

public class TestsGameJava {

  public static void main(String[] args) {
    JavaPlatform.Config config = new JavaPlatform.Config();
    if (args.length > 0) {
      config.scaleFactor = Float.parseFloat(args[0]);
    }
    config.width = 800;
    config.height = 600;
    JavaPlatform platform = JavaPlatform.register(config);
    platform.setTitle("Tests");
    PlayN.run(new TestsGame());
  }
}

Make the test window bigger in Java.


package dmillerw.sound.core.item;

import dmillerw.sound.client.sound.SoundHelper;
import dmillerw.sound.client.sound.SoundReplaced;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.SoundCategory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

/**
 * @author dmillerw
 */
public class ItemBrokenEarmuffs extends ItemMagicalEarmuffs {

    public static int cooldown = 0;

    public ItemBrokenEarmuffs() {
        super();

        setUnlocalizedName("brokenEarmuffs");
    }

    @Override
    public boolean hasEffect(ItemStack itemStack, int pass) {
        return true;
    }

    @Override
    public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
        return itemStack;
    }

    @Override
    public ISound getMuffledSound(ItemStack itemStack, String name, ISound sound, SoundCategory soundCategory) {
        // Fire a random sound once per 5 sounds
        if (cooldown == 0) {
            cooldown = 5;
            return SoundHelper.getRandomSound(sound, soundCategory);
        } else {
            cooldown--;
            return new SoundReplaced(sound, sound.getPositionedSoundLocation());
        }
    }
}

package dmillerw.sound.core.item;

import dmillerw.sound.client.sound.SoundHelper;
import dmillerw.sound.client.sound.SoundReplaced;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.SoundCategory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

/**
 * @author dmillerw
 */
public class ItemBrokenEarmuffs extends ItemMagicalEarmuffs {

    public static int cooldown = 0;

    public ItemBrokenEarmuffs() {
        super();

        setUnlocalizedName("brokenEarmuffs");
    }

    @Override
    public boolean hasEffect(ItemStack itemStack, int pass) {
        return true;
    }

    @Override
    public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
        return itemStack;
    }

    @Override
    public ISound getMuffledSound(ItemStack itemStack, String name, ISound sound, SoundCategory soundCategory) {
        // Fire a random sound every other sound
        if (cooldown == 0) {
            cooldown = 1;
            return SoundHelper.getRandomSound(sound, soundCategory);
        } else {
            cooldown--;
            return new SoundReplaced(sound, sound.getPositionedSoundLocation());
        }
    }
}

Increase rate of random sounds with broken earmuffs


package com.aragaer.jtt;

public class JTTHour {
    public static final String Glyphs[] = { "酉", "戌", "亥", "子", "丑", "寅", "卯",
            "辰", "巳", "午", "未", "申" };

    public static final int ticks = 6;
    public static final int subs = 100;

    public boolean isNight;
    public int num; // 0 to 11, where 0 is hour of Cock and 11 is hour of Monkey
    public int strikes;
    public int fraction; // 0 to 99

    private static final int num_to_strikes(int num) {
        return 9 - ((num - 3) % ticks);
    }

    public JTTHour(int num) {
        this(num, 0);
    }

    public JTTHour(int n, int f) {
        this.setTo(n, f);
    }

    // Instead of reallocation, reuse existing object
    public void setTo(int n, int f) {
        num = n;
        isNight = n < ticks;
        strikes = num_to_strikes(n);
        fraction = f;
    }
}

package com.aragaer.jtt;

public class JTTHour {
    public static final String Glyphs[] = "酉戌亥子丑寅卯辰巳午未申".split("(?!^)");

    public static final int ticks = 6;
    public static final int subs = 100;

    public boolean isNight;
    public int num; // 0 to 11, where 0 is hour of Cock and 11 is hour of Monkey
    public int strikes;
    public int fraction; // 0 to 99

    private static final int num_to_strikes(int num) {
        return 9 - ((num - 3) % ticks);
    }

    public JTTHour(int num) {
        this(num, 0);
    }

    public JTTHour(int n, int f) {
        this.setTo(n, f);
    }

    // Instead of reallocation, reuse existing object
    public void setTo(int n, int f) {
        num = n;
        isNight = n < ticks;
        strikes = num_to_strikes(n);
        fraction = f;
    }
}

Replace array of glyphs with a single string and split


package com.btk5h.skriptmirror;

import ch.njol.skript.Skript;

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.List;

public class LibraryLoader {
  private static ClassLoader classLoader = LibraryLoader.class.getClassLoader();

  private static final PathMatcher MATCHER =
      FileSystems.getDefault().getPathMatcher("glob:**/*.jar");

  private static class LibraryVisitor extends SimpleFileVisitor<Path> {
    private List<URL> urls = new ArrayList<>();

    @Override
    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
      if (MATCHER.matches(file)) {
        Skript.info("Loaded external library " + file.getFileName());
        urls.add(file.toUri().toURL());
      }
      return super.visitFile(file, attrs);
    }

    public URL[] getUrls() {
      return urls.toArray(new URL[urls.size()]);
    }
  }

  public static void loadLibraries() throws IOException {
    Path dataFolder = SkriptMirror.getInstance().getDataFolder().toPath();
    if (Files.isDirectory(dataFolder)) {
      LibraryVisitor visitor = new LibraryVisitor();
      Files.walkFileTree(dataFolder, visitor);
      classLoader = new URLClassLoader(visitor.getUrls(), LibraryLoader.class.getClassLoader());
    }
  }

  public static ClassLoader getClassLoader() {
    return classLoader;
  }
}

package com.btk5h.skriptmirror;

import ch.njol.skript.Skript;

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.List;

public class LibraryLoader {
  private static ClassLoader classLoader = LibraryLoader.class.getClassLoader();

  private static final PathMatcher MATCHER =
      FileSystems.getDefault().getPathMatcher("glob:**/*.jar");

  private static class LibraryVisitor extends SimpleFileVisitor<Path> {
    private List<URL> urls = new ArrayList<>();

    @Override
    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
      if (MATCHER.matches(file)) {
        Skript.info("Loaded external library " + file.getFileName());
        urls.add(file.toUri().toURL());
      }
      return super.visitFile(file, attrs);
    }

    public URL[] getUrls() {
      return urls.toArray(new URL[urls.size()]);
    }
  }

  public static void loadLibraries() throws IOException {
    Path dataFolder = SkriptMirror.getInstance().getDataFolder().toPath();
    if (Files.isDirectory(dataFolder)) {
      LibraryVisitor visitor = new LibraryVisitor();
      Files.walkFileTree(dataFolder, visitor);
      classLoader = new URLClassLoader(visitor.getUrls(), LibraryLoader.class.getClassLoader());
    } else {
      Files.createDirectory(dataFolder);
    }
  }

  public static ClassLoader getClassLoader() {
    return classLoader;
  }
}

Create skript-mirror data folder by default


package com.vaadin.components.gwt.polymer.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.vaadin.components.gwt.polymer.client.sampler.Sampler;
import com.vaadin.polymer.Polymer;
import com.vaadin.polymer.elemental.Function;

public class Demo implements EntryPoint {

    public void onModuleLoad() {
        Polymer.importHref("paper-styles/paper-styles.html");
        Polymer.importHref("paper-styles/demo-pages.html");
        Polymer.importHref("iron-icons/iron-icons.html", new Function() {
            public Object call(Object arg) {
                RootPanel.get().add(new Sampler());
                return null;
            }
        });
    }
}

package com.vaadin.components.gwt.polymer.client;

import java.util.Arrays;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.vaadin.components.gwt.polymer.client.sampler.iron.IronCollapseSample;
import com.vaadin.polymer.Polymer;
import com.vaadin.polymer.elemental.Function;

public class Demo implements EntryPoint {

    public void onModuleLoad() {
        // Although gwt-polymer-elements takes care of dynamic loading of components
        // if they are created using Polymer.createElement or Polymer Widgets,
        // there are certain features which must be loaded previously to start
        // the application. Hence you have to add import tags to your host page or
        // import those additional features dynamically, in this case it might be
        // necessary to wait until the components are ready.
        // The `Polymer` utility class provide a set of methods for facilitating it,
        // you can pass tag-names for standard component locations (tag-name/tag-name.html)
        // or relative urls otherwise. Also you can pass success and error call-backs.

        // Paper applications must always import paper-styles
        Polymer.importHref("paper-styles");

        // Styles for paper examples
        Polymer.importHref("paper-styles/demo-pages.html");

        // Icon sets must be loaded before using any component depending on them
        // Iron comes with the collections:
        // communication, device, editor, hardware, image, iron, maps, notifications, social.
        Polymer.importHref(Arrays.asList(
                "iron-icons/iron-icons.html",
                "iron-icons/communication-icons.html"
                ), new Function() {
            public Object call(Object arg) {
                // The app is executed when all imports succeed.
                RootPanel.get().add(new IronCollapseSample());
                return null;
            }
        });
    }
}

Document needed imports before the app starts


package de.gurkenlabs.litiengine;

import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class UpdateLoop extends Thread implements ILoop {
  private static final Logger log = Logger.getLogger(UpdateLoop.class.getName());
  private final Set<IUpdateable> updatables;

  protected UpdateLoop() {
    this.updatables = Collections.newSetFromMap(new ConcurrentHashMap<IUpdateable, Boolean>());
  }

  @Override
  public void run() {
    // nothing to do for now in the base implementation
  }

  @Override
  public void attach(final IUpdateable updatable) {
    if (updatable == null) {
      return;
    }

    if (this.updatables.contains(updatable)) {
      log.log(Level.FINE, "Updatable {0} already registered for update!", new Object[] { updatable });
      return;
    }

    this.updatables.add(updatable);
  }

  @Override
  public void detach(final IUpdateable updatable) {
    this.updatables.remove(updatable);
  }

  protected Set<IUpdateable> getUpdatables() {
    return this.updatables;
  }

  protected void update() {
    for (IUpdateable updatable : this.getUpdatables()) {
      try {
        if (updatable != null) {
          updatable.update();
        }
      } catch (final Exception e) {
        log.log(Level.SEVERE, e.getMessage(), e);
      }
    }
  }
}

package de.gurkenlabs.litiengine;

import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class UpdateLoop extends Thread implements ILoop {
  private static final Logger log = Logger.getLogger(UpdateLoop.class.getName());
  private final Set<IUpdateable> updatables;

  protected UpdateLoop() {
    this.updatables = Collections.newSetFromMap(new ConcurrentHashMap<IUpdateable, Boolean>());
  }

  @Override
  public void run() {
    // nothing to do for now in the base implementation
  }

  @Override
  public void attach(final IUpdateable updatable) {
    if (updatable == null) {
      return;
    }

    if (!this.updatables.add(updatable)) {
      log.log(Level.FINE, "Updatable {0} already registered for update!", new Object[] { updatable });
      return;
    }
  }

  @Override
  public void detach(final IUpdateable updatable) {
    this.updatables.remove(updatable);
  }

  protected Set<IUpdateable> getUpdatables() {
    return this.updatables;
  }

  protected void update() {
    for (IUpdateable updatable : this.getUpdatables()) {
      try {
        if (updatable != null) {
          updatable.update();
        }
      } catch (final Exception e) {
        log.log(Level.SEVERE, e.getMessage(), e);
      }
    }
  }
}

Improve implementation: add returns a boolean


package com.tisawesomeness.minecord.debug;

import com.google.common.cache.CacheStats;
import lombok.NonNull;

/**
 * Debugs a Guava {@link com.google.common.cache.LoadingCache}.
 */
public abstract class CacheDebugOption implements DebugOption {
    public @NonNull String debug() {
        CacheStats stats = getCacheStats();
        return String.format("**%s Stats**\n", getName()) +
                String.format("Hits: `%s/%s %.2f%%`\n", stats.hitCount(), stats.requestCount(), stats.hitRate()) +
                String.format("Load Exceptions: `%s/%s %.2f%%`\n", stats.loadExceptionCount(), stats.loadCount(), 100*stats.loadExceptionRate()) +
                String.format("Eviction Count: `%s`\n", stats.evictionCount()) +
                String.format("Average Load Penalty: `%.3fms`", stats.averageLoadPenalty() / 1_000_000);
    }
    /**
     * @return The cache stats to be used in {@link #debug()}.
     */
    public abstract @NonNull CacheStats getCacheStats();
}

package com.tisawesomeness.minecord.debug;

import com.google.common.cache.CacheStats;
import lombok.NonNull;

/**
 * Debugs a Guava {@link com.google.common.cache.LoadingCache}.
 */
public abstract class CacheDebugOption implements DebugOption {

    public @NonNull String debug() {
        CacheStats stats = getCacheStats();
        return String.format("**%s Stats**\n", getName()) +
                String.format("Hits: `%s/%s %.2f%%`\n", stats.hitCount(), stats.requestCount(), stats.hitRate()) +
                String.format("Load Exceptions: `%s/%s %.2f%%`\n", stats.loadExceptionCount(), stats.loadCount(), 100*stats.loadExceptionRate()) +
                String.format("Eviction Count: `%s`\n", stats.evictionCount()) +
                String.format("Average Load Penalty: `%.3fms`\n", stats.averageLoadPenalty() / 1_000_000) +
                String.format("Total Load Time: `%sms`", stats.totalLoadTime() / 1_000_000);
    }
    /**
     * @return The cache stats to be used in {@link #debug()}.
     */
    public abstract @NonNull CacheStats getCacheStats();
}

Add total load time to cache debug options


public class TestaMenorPreco {

  public static void main(String[] args) {

    Produto produtos[] = new Produto[5];
    produtos[0] = new Produto("Lamborghini", 1000000);
    produtos[1] = new Produto("Jipe", 46000);
    produtos[2] = new Produto("Brasília", 16000);
    produtos[3] = new Produto("Smart", 46000);
    produtos[4] = new Produto("Fusca", 17000);

    int maisBarato = 0;

    for(int atual = 0; atual <= 4; atual++) {
      if(produtos[atual].getPreco() < produtos[maisBarato].getPreco()) {
        maisBarato = atual;
      }
    }

    System.out.println(maisBarato);
    System.out.println("O carro " + produtos[maisBarato].getNome()
                        + " é o mais barato, e custa "
                        + produtos[maisBarato].getPreco());

  }

}

public class TestaMenorPreco {

  public static void main(String[] args) {

    Produto produtos[] = {
      new Produto("Lamborghini", 1000000),
      new Produto("Jipe", 46000),
      new Produto("Brasília", 16000),
      new Produto("Smart", 46000),
      new Produto("Fusca", 17000)
    };

    int maisBarato = 0;

    for(int atual = 0; atual <= 4; atual++) {
      if(produtos[atual].getPreco() < produtos[maisBarato].getPreco()) {
        maisBarato = atual;
      }
    }

    System.out.println(maisBarato);
    System.out.println("O carro " + produtos[maisBarato].getNome()
                        + " é o mais barato, e custa "
                        + produtos[maisBarato].getPreco());

  }

}

Insert new files, Alura, Projeto de Algoritmos 1, Aula 10


/*
 * Created on Nov 11, 2005
 */
package uk.org.ponder.rsf.uitype;

public class BooleanUIType implements UIType {
  public static final BooleanUIType instance = new BooleanUIType();
  public Boolean PLACEHOLDER = new Boolean(false);
  public Object getPlaceholder() {
    return PLACEHOLDER;
  }
  public String getName() {
    return "boolean";
  }
  public boolean valueUnchanged(Object oldvalue, Object newvalue) {
    return oldvalue.equals(newvalue);
  }
}

/*
 * Created on Nov 11, 2005
 */
package uk.org.ponder.rsf.uitype;

public class BooleanUIType implements UIType {
  public static final BooleanUIType instance = new BooleanUIType();
  public Boolean PLACEHOLDER = Boolean.FALSE;
  public Object getPlaceholder() {
    return PLACEHOLDER;
  }
  public String getName() {
    return "boolean";
  }
  public boolean valueUnchanged(Object oldvalue, Object newvalue) {
    return oldvalue.equals(newvalue);
  }
}

Use constant to generate Boolean


package parrot;

public class Parrot {

    private ParrotTypeEnum type;
    private int numberOfCoconuts;
    private double voltage;
    private boolean isNailed;

    public Parrot(ParrotTypeEnum _type, int numberOfCoconuts, double voltage, boolean isNailed) {
        this.type = _type;
        this.numberOfCoconuts = numberOfCoconuts;
        this.voltage = voltage;
        this.isNailed = isNailed;
    }

    public double getSpeed() {
        switch (type) {
            case EUROPEAN:
                return getBaseSpeed();
            case AFRICAN:
                return Math.max(0, getBaseSpeed() - getLoadFactor() * numberOfCoconuts);
            case NORWEGIAN_BLUE:
                return (isNailed) ? 0 : getBaseSpeed(voltage);
            default:
                throw new RuntimeException("Should be unreachable");
        }
    }

    private double getBaseSpeed(double voltage) {
        return Math.min(24.0, voltage * getBaseSpeed());
    }

    private double getLoadFactor() {
        return 9.0;
    }

    private double getBaseSpeed() {
        return 12.0;
    }

}

package parrot;

public class Parrot {

    private ParrotTypeEnum type;
    private int numberOfCoconuts;
    private double voltage;
    private boolean isNailed;

    public Parrot(ParrotTypeEnum type, int numberOfCoconuts, double voltage, boolean isNailed) {
        this.type = type;
        this.numberOfCoconuts = numberOfCoconuts;
        this.voltage = voltage;
        this.isNailed = isNailed;
    }

    public double getSpeed() {
        switch (type) {
            case EUROPEAN:
                return getBaseSpeed();
            case AFRICAN:
                return Math.max(0, getBaseSpeed() - getLoadFactor() * numberOfCoconuts);
            case NORWEGIAN_BLUE:
                return (isNailed) ? 0 : getBaseSpeed(voltage);
            default:
                throw new RuntimeException("Should be unreachable");
        }
    }

    private double getBaseSpeed(double voltage) {
        return Math.min(24.0, voltage * getBaseSpeed());
    }

    private double getLoadFactor() {
        return 9.0;
    }

    private double getBaseSpeed() {
        return 12.0;
    }

}

Rename _type to type according naming conventions.


package de.gymnew.sudoku.model;

import java.util.Set;

public class Field {

	private byte value; // 0 = undefined
	private Set<Byte> notes;
	private Row row;
	private Column col;
	private Block block;

}

package de.gymnew.sudoku.model;

import java.util.Set;

public class Field {

	private byte value; // 0 = undefined
	private Set<Byte> notes;
	private Row row;
	private Column col;
	private Block block;

	public byte getValue() {
		return value;
	}
	public void setValue(byte value) {
		this.value = value;
	}

}

Add getter and setter for "value"


package com.frameworkium.core.ui.driver.drivers;

import com.frameworkium.core.common.properties.Property;
import com.frameworkium.core.ui.driver.AbstractDriver;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;

public class FirefoxImpl extends AbstractDriver {

    @Override
    public FirefoxOptions getCapabilities() {
        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.setHeadless(Property.isHeadlessRun());
        return firefoxOptions;
    }

    @Override
    public WebDriver getWebDriver(Capabilities capabilities) {
        final FirefoxOptions firefoxOptions;
        if (capabilities instanceof FirefoxOptions) {
            firefoxOptions = (FirefoxOptions) capabilities;
        } else {
            firefoxOptions = new FirefoxOptions().merge(capabilities);
        }
        return new FirefoxDriver(firefoxOptions);
    }
}

package com.frameworkium.core.ui.driver.drivers;

import com.frameworkium.core.common.properties.Property;
import com.frameworkium.core.ui.driver.AbstractDriver;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;

public class FirefoxImpl extends AbstractDriver {

    @Override
    public FirefoxOptions getCapabilities() {
        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.setHeadless(Property.isHeadlessRun());
        firefoxOptions.setLogLevel(FirefoxDriverLogLevel.INFO);
        return firefoxOptions;
    }

    @Override
    public WebDriver getWebDriver(Capabilities capabilities) {
        final FirefoxOptions firefoxOptions;
        if (capabilities instanceof FirefoxOptions) {
            firefoxOptions = (FirefoxOptions) capabilities;
        } else {
            firefoxOptions = new FirefoxOptions().merge(capabilities);
        }
        return new FirefoxDriver(firefoxOptions);
    }
}

Reduce geckodriver logs to INFO


/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
 * 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 org.mozilla.focus;

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

import org.mozilla.focus.search.SearchEngineManager;
import org.mozilla.focus.telemetry.TelemetryWrapper;
import org.mozilla.focus.utils.AdjustHelper;
import org.mozilla.focus.utils.AppConstants;

public class FocusApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        enableStrictMode();

        PreferenceManager.setDefaultValues(this, R.xml.settings, false);

        SearchEngineManager.getInstance().init(this);

        TelemetryWrapper.init(this);
        AdjustHelper.setupAdjustIfNeeded(this);
    }

    private void enableStrictMode() {
        if (AppConstants.isReleaseBuild()) {
            return;
        }

        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectAll()
                .penaltyDeath()
                .build());

        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectAll()
                .penaltyDeath()
                .build());
    }
}

/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
 * 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 org.mozilla.focus;

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

import org.mozilla.focus.search.SearchEngineManager;
import org.mozilla.focus.telemetry.TelemetryWrapper;
import org.mozilla.focus.utils.AdjustHelper;
import org.mozilla.focus.utils.AppConstants;

public class FocusApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        PreferenceManager.setDefaultValues(this, R.xml.settings, false);

        enableStrictMode();

        SearchEngineManager.getInstance().init(this);

        TelemetryWrapper.init(this);
        AdjustHelper.setupAdjustIfNeeded(this);
    }

    private void enableStrictMode() {
        if (AppConstants.isReleaseBuild()) {
            return;
        }

        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectAll()
                .penaltyDeath()
                .build());

        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectAll()
                .penaltyDeath()
                .build());
    }
}

Enable strict mode after setting default preferences values.


package im.delight.android.ddp;

/*
 * Copyright (c) delight.im <info@delight.im>
 *
 * 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.
 */

public interface ResultListener extends Listener {

	public void onSuccess(String result);
	public void onError(String error, String reason, String details);

}

package im.delight.android.ddp;

/*
 * Copyright (c) delight.im <info@delight.im>
 *
 * 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.
 */

public interface ResultListener extends Listener {

	void onSuccess(String result);

	void onError(String error, String reason, String details);

}

Remove unnecessary visibility modifiers in interface


package org.perfclipse.wizards;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.perfclipse.core.logging.Logger;

/**
 * The activator class controls the plug-in life cycle
 */
public class Activator extends AbstractUIPlugin {

	private Logger logger;

	// The plug-in ID
	public static final String PLUGIN_ID = "org.perfclipse.wizards"; //$NON-NLS-1$

	// The shared instance
	private static Activator plugin;

	/**
	 * The constructor
	 */
	public Activator() {
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;

	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static Activator getDefault() {
		return plugin;
	}

	public Logger getLogger() {
		return logger;
	}

}

package org.perfclipse.wizards;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.perfclipse.core.logging.Logger;

/**
 * The activator class controls the plug-in life cycle
 */
public class Activator extends AbstractUIPlugin {

	private Logger logger;

	// The plug-in ID
	public static final String PLUGIN_ID = "org.perfclipse.wizards"; //$NON-NLS-1$

	// The shared instance
	private static Activator plugin;

	/**
	 * The constructor
	 */
	public Activator() {
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
		logger = new Logger(getLog(), PLUGIN_ID);

	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static Activator getDefault() {
		return plugin;
	}

	public Logger getLogger() {
		return logger;
	}

}

Fix initializing logger in wizards plugin


package org.opensuse.tserong.geeko;

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

public class MainActivity extends Activity {

    private GeekoView mGeekoView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mGeekoView = new GeekoView(this);
        setContentView(mGeekoView);

    }

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

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

}

package org.opensuse.tserong.geeko;

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

public class MainActivity extends Activity {

    private GeekoView mGeekoView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mGeekoView = new GeekoView(this);
        setContentView(mGeekoView);
        // TODO: Somehow it stops drawing if the screen blanks (i.e. it doesn't start again
        // afer you unblank the screen)
    }

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

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

}

Add note about screen blank killing drawing


package pro.beam.api.resource.tetris;

import java.net.InetSocketAddress;

public class RobotInfo {
    public InetSocketAddress address;
    public String authkey;
}

package pro.beam.api.resource.tetris;

import java.net.InetSocketAddress;

public class RobotInfo {
    public InetSocketAddress address;
    public String key;
}

Update field "authkey" to "key"


package br.usp.each.saeg.jaguar.model;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * This class represents the Line Requirement.
 *
 * Created by henrique on 7/9/17.
 */
@XmlRootElement(name = "lineRequirement")
public class LineRequirement extends Requirement {

    @Override
    public Type getType() {
        return Type.LINE;
    }

    @Override
    public String toString() {
        return "LineRequirement{" +
                "Type='" + getType() + '\'' +
                ", location='" + location + '\'' +
                ", position=" + position +
                ", suspiciousValue=" + suspiciousValue +
                ", cef=" + cef +
                ", cep=" + cep +
                ", cnf=" + cnf +
                ", cnp=" + cnp +
                '}';
    }
}

package br.usp.each.saeg.jaguar.model;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * This class represents the Line Requirement.
 *
 * Created by henrique on 7/9/17.
 */
@XmlRootElement(name = "lineRequirement")
public class LineRequirement extends Requirement {

    @Override
    public Type getType() {
        return Type.LINE;
    }

    @Override
    public String toString() {
        return "LineRequirement{" +
                "location='" + location + '\'' +
                ", position=" + position +
                ", suspiciousValue=" + suspiciousValue +
                ", cef=" + cef +
                ", cep=" + cep +
                ", cnf=" + cnf +
                ", cnp=" + cnp +
                '}';
    }
}

Remove type in toString, the name says the type already


package com.uwetrottmann.trakt.v2.entities;

public abstract class BaseEntity {

    public String title;
    public Images images;

}

package com.uwetrottmann.trakt.v2.entities;

import java.util.List;

public abstract class BaseEntity {

    public String title;
    public Images images;
    public List<String> available_translations;

}

Add "available_translations" property to base entities.


package de.infonautika.postman.task;

import com.moowork.gradle.node.NodeExtension;
import com.moowork.gradle.node.task.NpmSetupTask;
import com.moowork.gradle.node.task.NpmTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.OutputDirectory;

import java.io.File;

import static de.infonautika.postman.PostmanRunnerPlugin.GROUP_NAME;
import static java.util.Collections.singletonList;

public class InstallNewmanTask extends NpmTask {
    public final static String NAME = "installNewman";

    public InstallNewmanTask() {
        this.setGroup(GROUP_NAME);
        this.setDescription("Install newman packages");
        setNpmCommand("install");
        setArgs(singletonList("newman" + getNewmanVersionString()));
        dependsOn(NpmSetupTask.NAME);
    }

    @OutputDirectory
    public File getNewmanOutputDir() {
        return new File(getProject().getExtensions().getByType(NodeExtension.class).getNodeModulesDir(),
                "node_modules/newman");
    }

    @Input
    public String getNewmanVersionString() {
        // TODO: 29.11.16 make version configurable
        return "";
    }
}

package de.infonautika.postman.task;

import com.moowork.gradle.node.NodeExtension;
import com.moowork.gradle.node.npm.NpmSetupTask;
import com.moowork.gradle.node.npm.NpmTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.OutputDirectory;

import java.io.File;

import static de.infonautika.postman.PostmanRunnerPlugin.GROUP_NAME;
import static java.util.Collections.singletonList;

public class InstallNewmanTask extends NpmTask {
    public final static String NAME = "installNewman";

    public InstallNewmanTask() {
        this.setGroup(GROUP_NAME);
        this.setDescription("Install newman packages");
        setNpmCommand("install");
        setArgs(singletonList("newman" + getNewmanVersionString()));
        dependsOn(NpmSetupTask.NAME);
    }

    @OutputDirectory
    public File getNewmanOutputDir() {
        return new File(getProject().getExtensions().getByType(NodeExtension.class).getNodeModulesDir(),
                "node_modules/newman");
    }

    @Input
    public String getNewmanVersionString() {
        // TODO: 29.11.16 make version configurable
        return "";
    }
}

Upgrade gradle-node-plugin dependcy to 1.2.0


package com.ingotpowered.api.plugins;

import java.io.File;

public abstract class Plugin {

    private String name;
    private String author;
    private String description;
    private String jarFilePath;
    private File pluginDirectory;

    public abstract void onEnable();

    public abstract void onDisable();

    public final String getName() {
        return name;
    }

    public String getAuthor() {
        return author;
    }

    public final String getDescription() {
        return description;
    }

    public final String getJarFilePath() {
        return jarFilePath;
    }

    public File getPluginDirectory() {
        return pluginDirectory;
    }
}

package com.ingotpowered.api.plugins;

import java.io.File;

public abstract class Plugin {

    private String name;
    private String author;
    private String description;
    private String jarFilePath;
    private File pluginDirectory;

    public abstract void onEnable();

    public abstract void onDisable();

    public final String getName() {
        return name;
    }

    public String getAuthor() {
        return author;
    }

    public final String getDescription() {
        return description;
    }

    public final String getJarFilePath() {
        return jarFilePath;
    }

    public File getPluginDirectory() {
        return pluginDirectory;
    }

    public void handleException(Exception ex){
    }
}

Allow for error reporting back to the plugin on a plugin to plugin basis, for use for remote error reporting.


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

import playn.core.Keyboard;
import playn.core.PlayN;
import playn.core.util.Callback;

class IOSKeyboard implements Keyboard
{
  @Override
  public void setListener(Listener listener) {
    PlayN.log().warn("Keyboard not (currently) supported on iOS.");
  }

  @Override
  public boolean hasHardwareKeyboard() {
    return false;
  }

  @Override
  public void getText(TextType textType, String label, String initVal, Callback<String> callback) {
    callback.onFailure(new UnsupportedOperationException("Not yet implemented."));
  }
}

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

import playn.core.Keyboard;
import playn.core.PlayN;
import playn.core.util.Callback;

class IOSKeyboard implements Keyboard
{
  @Override
  public void setListener(Listener listener) {
    PlayN.log().warn("iOS cannot generate keyboard events. Use Keyboard.getText() instead");
  }

  @Override
  public boolean hasHardwareKeyboard() {
    return false;
  }

  @Override
  public void getText(TextType textType, String label, String initVal, Callback<String> callback) {
    callback.onFailure(new UnsupportedOperationException("Not yet implemented."));
  }
}

Update setListener() warning for iOS.


package org.jvirtanen.parity.net;

import java.io.IOException;

public class ProtocolException extends IOException {

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

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

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

}

package org.jvirtanen.parity.net;

import java.io.IOException;

/**
 * Indicates a protocol error.
 */
public class ProtocolException extends IOException {

    /**
     * Construct an instance with the specified detail message.
     *
     * @param message the detail message
     */
    public ProtocolException(String message) {
        super(message);
    }

    /**
     * Construct an instance with the specified detail message and cause.
     *
     * @param message the detail message
     * @param cause the cause
     */
    public ProtocolException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * Construct an instance with the specified cause.
     *
     * @param cause the cause
     */
    public ProtocolException(Throwable cause) {
        super(cause);
    }

}

Add documentation for protocol exception in network protocols


/*
 * Copyright 2015-2018 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v20.html
 */

package example;

// tag::external_MethodSource_example[]
import java.util.stream.Stream;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

class ExternalMethodSourceDemo {

	@ParameterizedTest
	@MethodSource("example.StringsProviders#blankStrings")
	void testWithExternalMethodSource(String blankString) {
		// test with blank string
	}
}

class StringsProviders {

	static Stream<String> blankStrings() {
		return Stream.of("", " ", " \n ");
	}
}
// end::external_MethodSource_example[]

/*
 * Copyright 2015-2018 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v20.html
 */

package example;

// tag::external_MethodSource_example[]
import java.util.stream.Stream;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

class ExternalMethodSourceDemo {

	@ParameterizedTest
	@MethodSource("example.StringsProviders#tinyStrings")
	void testWithExternalMethodSource(String tinyString) {
		// test with tiny string
	}
}

class StringsProviders {

	static Stream<String> tinyStrings() {
		return Stream.of(".", "oo", "OOO");
	}
}
// end::external_MethodSource_example[]

Use non-blank string values as demo arguments