/**
 * Copyright (c) Anton Johansson <antoon.johansson@gmail.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.antonjohansson.lprs.controller.token;

import com.antonjohansson.lprs.model.User;

/**
 * {@link ITokenSender} implementation that prints the token to the console.
 */
class ConsoleTokenSender implements ITokenSender
{
    @Override
    public void send(User user, String token)
    {
        System.out.println("Generated token '" + token + "'.");
    }
}

/**
 * Copyright (c) Anton Johansson <antoon.johansson@gmail.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.antonjohansson.lprs.controller.token;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.antonjohansson.lprs.model.User;

/**
 * {@link ITokenSender} implementation that prints the token to the console.
 */
class ConsoleTokenSender implements ITokenSender
{
    private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleTokenSender.class);

    @Override
    public void send(User user, String token)
    {
        LOGGER.info("Generated token '{}'", token);
    }
}

Use logger instead of system out

Use logger instead of system out


package com.codingchili.router;

import com.codingchili.router.configuration.ListenerSettings;
import com.codingchili.router.configuration.RouterContext;
import com.codingchili.router.controller.RouterHandler;
import com.codingchili.router.controller.transport.*;
import io.vertx.core.*;

import com.codingchili.core.protocol.ClusterNode;

/**
 * @author Robin Duda
 *         root game server, deploys realmName servers.
 */
public class Service extends ClusterNode {
    private RouterContext context;

    public Service(RouterContext context) {
        this.context = context;
    }

    @Override
    public void init(Vertx vertx, Context context) {
        super.init(vertx, context);

        if (context == null) {
            this.context = new RouterContext(vertx);
        }
    }

    @Override
    public void start(Future<Void> start) {
        for (int i = 0; i < settings.getHandlers(); i++) {

            for (ListenerSettings listener : context.transports()) {
                RouterHandler<RouterContext> handler = new RouterHandler<>(context);

                switch (listener.getType()) {
                    case UDP:
                        context.deploy(new UdpListener(handler));
                        break;
                    case TCP:
                        context.deploy(new TcpListener(handler));
                        break;
                    case WEBSOCKET:
                        context.deploy(new WebsocketListener(handler));
                        break;
                    case REST:
                        context.deploy(new RestListener(handler));
                        break;
                }
            }
        }
        start.complete();
    }
}

package com.codingchili.router;

import com.codingchili.router.configuration.ListenerSettings;
import com.codingchili.router.configuration.RouterContext;
import com.codingchili.router.controller.RouterHandler;
import com.codingchili.router.controller.transport.*;
import io.vertx.core.*;

import com.codingchili.core.protocol.ClusterNode;

/**
 * @author Robin Duda
 *         root game server, deploys realmName servers.
 */
public class Service extends ClusterNode {
    private RouterContext context;

    public Service(RouterContext context) {
        this.context = context;
    }

    @Override
    public void init(Vertx vertx, Context context) {
        super.init(vertx, context);

        if (context == null) {
            this.context = new RouterContext(vertx);
        }
    }

    @Override
    public void start(Future<Void> start) {
        for (ListenerSettings listener : context.transports()) {
            RouterHandler<RouterContext> handler = new RouterHandler<>(context);

            for (int i = 0; i < settings.getHandlers(); i++) {
                boolean singleHandlerOnly = false;
                Future<String> future = Future.future();

                switch (listener.getType()) {
                    case UDP:
                        context.deploy(new UdpListener(handler), future);
                        singleHandlerOnly = true;
                        break;
                    case TCP:
                        context.deploy(new TcpListener(handler));
                        break;
                    case WEBSOCKET:
                        context.deploy(new WebsocketListener(handler));
                        break;
                    case REST:
                        context.deploy(new RestListener(handler));
                        break;
                }
                if (singleHandlerOnly) {
                    break;
                }
            }
        }
        start.complete();
    }
}

Deploy a single listener for UDP as port reuse is not supported.


package com.intuso.housemate.client.v1_0.rest;

import com.intuso.housemate.client.v1_0.api.object.System;
import com.intuso.housemate.client.v1_0.rest.model.Page;

import javax.ws.rs.*;

/**
 * Created by tomc on 21/01/17.
 */
@Path("/power")
public interface PowerResource {

    @GET
    @Produces("application/json")
    Page<System.Data> list(@QueryParam("offset") @DefaultValue("0") int offset, @QueryParam("limit") @DefaultValue("20") int limit);

    @GET
    @Path("/{id}")
    boolean isOn(@PathParam("id") String id);

    @POST
    @Path("/{id}/on")
    void turnOn(@PathParam("id") String id);

    @POST
    @Path("/{id}/off")
    void turnOff(@PathParam("id") String id);
}

package com.intuso.housemate.client.v1_0.rest;

import com.intuso.housemate.client.v1_0.api.object.Device;
import com.intuso.housemate.client.v1_0.rest.model.Page;

import javax.ws.rs.*;

/**
 * Created by tomc on 21/01/17.
 */
@Path("/power")
public interface PowerResource {

    @GET
    @Produces("application/json")
    Page<Device.Data> list(@QueryParam("offset") @DefaultValue("0") int offset, @QueryParam("limit") @DefaultValue("20") int limit);

    @GET
    @Path("/{id}")
    boolean isOn(@PathParam("id") String id);

    @POST
    @Path("/{id}/on")
    void turnOn(@PathParam("id") String id);

    @POST
    @Path("/{id}/off")
    void turnOff(@PathParam("id") String id);
}

Add session utility functions. Re-implement power resource so it loads devices instead of systems


package com.chanryma.fetchtopactivity;

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

public class ActivityB extends Activity {

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

    public void onButtonClick(View view) {
        Intent intent = new Intent(MyApplication.getInstance().getApplicationContext(), ActivityC.class);
        MyApplication.getInstance().getCurrentActivity().startActivity(intent);
    }
}

package com.chanryma.fetchtopactivity;

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

public class ActivityB extends Activity {

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

    public void onButtonClick(View view) {
//        Intent intent = new Intent(MyApplication.getInstance().getApplicationContext(), ActivityC.class);
//        MyApplication.getInstance().getCurrentActivity().startActivity(intent);

        Intent intent = new Intent(ActivityB.this, ActivityC.class);
        startActivity(intent);
    }
}

Change the way to start ActivityC

Change the way to start ActivityC


package org.realityforge.arez.annotations;

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

/**
 * Methods marked with this annotation are invoked in an Arez transaction.
 */
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
public @interface Action
{
  /**
   * Does the action mutate state or not.
   *
   * @return true if method should be wrapped in READ_WRITE transaction, false if it should it should be wrapped in READ_ONLY transaction.
   */
  boolean mutation() default true;
}

package org.realityforge.arez.annotations;

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

/**
 * Methods marked with this annotation are invoked in an Arez transaction.
 */
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
public @interface Action
{
  /**
   * Return the name of the Action relative to the container.
   *
   * @return the name of the Action relative to the container.
   */
  String name() default "";

  /**
   * Does the action mutate state or not.
   *
   * @return true if method should be wrapped in READ_WRITE transaction, false if it should it should be wrapped in READ_ONLY transaction.
   */
  boolean mutation() default true;
}

Add ability to name actions

Add ability to name actions


/*
 * Copyright (c) 2014 Ushahidi.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program in the file LICENSE-AGPL. If not, see
 * https://www.gnu.org/licenses/agpl-3.0.html
 */

package com.ushahidi.android.ui.view;

/**
 * @author Ushahidi Team <team@ushahidi.com>
 */
public interface IDeploymentListView {

}

/*
 * Copyright (c) 2014 Ushahidi.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program in the file LICENSE-AGPL. If not, see
 * https://www.gnu.org/licenses/agpl-3.0.html
 */

package com.ushahidi.android.ui.view;

import com.ushahidi.android.model.DeploymentModel;

import java.util.List;

/**
 * Renders deployment list views
 *
 * @author Ushahidi Team <team@ushahidi.com>
 */
public interface IDeploymentListView extends ILoadViewData {

    /**
     * Render a deployment list in the UI.
     *
     * @param deploymentModel The collection of {@link DeploymentModel} that will be shown.
     */
    void renderUserList(List<DeploymentModel> deploymentModel);
}

Define renderer for deployment list view


package org.neuralnetwork.synapse;

public abstract class AbstractSynapse<InputType, ValueType> {
	private final InputType input;

	public AbstractSynapse(InputType input) {
		this.input = input;
	}

	abstract protected ValueType readValueFrom(InputType input);

	public ValueType getValue() {
		return readValueFrom(input);
	}
}

package org.neuralnetwork.synapse;

public abstract class AbstractSynapse<InputType, ValueType> {
	private final InputType input;

	public AbstractSynapse(InputType input) {
		this.input = input;
	}

	abstract protected ValueType readValueFrom(InputType input);

	public ValueType getValue() {
		return readValueFrom(input);
	}

	public InputType getInput() {
		return input;
	}
}

Add a getter for the synapses input.

Add a getter for the synapses input.


package cucumber.runtime.java.test;

import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

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

import static org.junit.Assert.assertEquals;

public class SubstitutionStepdefs {
    private static final Map<String, String> ROLES = new HashMap<String, String>() {{
        put("Manager", "now able to manage your employee accounts");
        put("Admin", "able to manage any user account on the system");
    }};

    private String name;
    private String role;
    private String details;

    @Given("^I have a user account with my name \"([^\"]*)\"$")
    public void I_have_a_user_account_with_my_name(String name) throws Throwable {
        this.name = name;
    }

    @When("^an Admin grants me (.+) rights$")
    public void an_Admin_grants_me_role_rights(String role) throws Throwable {
        this.role = role;
        this.details = ROLES.get(role);
    }

    @Then("^I should receive an email with the body:$")
    public void I_should_receive_an_email_with_the_body(String body) throws Throwable {
        String expected = String.format("Dear %s,\n" +
                "You have been granted %s rights.  You are %s. Please be responsible.\n" +
                "-The Admins", name, role, details);
        assertEquals(expected, body);
    }
}

package cucumber.runtime.java.test;

import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

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

import static org.junit.Assert.assertEquals;

public class SubstitutionStepdefs {
    private static final Map<String, String> ROLES = new HashMap<String, String>() {{
        put("Manager", "now able to manage your employee accounts");
        put("Admin", "able to manage any user account on the system");
    }};

    private String name;
    private String role;
    private String details;

    @Given("^I have a user account with my name \"([^\"]*)\"$")
    public void I_have_a_user_account_with_my_name(String name) throws Throwable {
        this.name = name;
    }

    @When("^an Admin grants me (.+) rights$")
    public void an_Admin_grants_me_role_rights(String role) throws Throwable {
        this.role = role;
        this.details = ROLES.get(role);
    }

    @Then("^I should receive an email with the body:$")
    public void I_should_receive_an_email_with_the_body(String body) throws Throwable {
        String expected = String.format("Dear %s,%n" +
                "You have been granted %s rights.  You are %s. Please be responsible.%n" +
                "-The Admins", name, role, details);
        assertEquals(expected, body);
    }
}

Replace \n with %n so that tests work on Windows.


package ch.tkuhn.nanopub.server;

public class NanopubServerUtils extends org.nanopub.extra.server.NanopubServerUtils {

	// Version numbers have the form MAJOR.MINOR (for example, 0.12 is a newer version than 0.9!)

	public static final String protocolVersion = "0.3";
	public static final int protocolVersionValue = getVersionValue(protocolVersion);

	public static final String journalVersion = "0.3";
	public static final int journalVersionValue = getVersionValue(journalVersion);

}

package ch.tkuhn.nanopub.server;

public class NanopubServerUtils extends org.nanopub.extra.server.NanopubServerUtils {

	// Version numbers have the form MAJOR.MINOR (for example, 0.12 is a newer version than 0.9!)

	public static final String protocolVersion = "0.4";
	public static final int protocolVersionValue = getVersionValue(protocolVersion);

	public static final String journalVersion = "0.3";
	public static final int journalVersionValue = getVersionValue(journalVersion);

}

Increase protocol version number (enforcing UTF-8 now)


package com.gmail.nossr50.commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;

public class McnotifyCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        switch (args.length) {
            case 0:
                McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);

                if (mcMMOPlayer.useChatNotifications()) {
                    sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
                }
                else {
                    sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
                }

                mcMMOPlayer.toggleChatNotifications();
                return true;

            default:
                return false;
        }
    }
}

package com.gmail.nossr50.commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;

public class McnotifyCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        switch (args.length) {
            case 0:
                McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());

                if (mcMMOPlayer.useChatNotifications()) {
                    sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
                }
                else {
                    sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
                }

                mcMMOPlayer.toggleChatNotifications();
                return true;

            default:
                return false;
        }
    }
}

Make /mcnotify match the process of the other commands for getting the mcMMOPlayer object.


package com.jayseeofficial.marvel.rest.model;

import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;

public class Image implements Serializable {
    private String path;
    private String extension;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

}

package com.jayseeofficial.marvel.rest.model;

import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;

public class Image implements Serializable {

    public static final String NOT_FOUND_PATH="https://i.annihil.us/u/prod/marvel/i/mg/b/40/image_not_available";
    public static final String NOT_FOUND_EXTENTION="jpg";

    private String path;
    private String extension;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

}

Add constants that can be used for an image when there isn't one avalable.


package org.kefirsf.tk;

import twitter4j.Twitter;
import twitter4j.TwitterException;

/**
 * Utilities for twitter.
 * @author Vitalii Samolovskikh aka Kefir
 */
public final class TwitterUtils {
    public static boolean validate(Twitter twitter){
        boolean flag = false;
        if(twitter!=null){
            try {
                twitter.verifyCredentials();
                flag = true;
            } catch (TwitterException e) {
                // Nothing!
            }
        }
        return flag;
    }

    /**
     * Prevent class initialization.
     */
    private TwitterUtils() {
    }
}

package org.kefirsf.tk;

import twitter4j.Twitter;

/**
 * Utilities for twitter.
 * @author Vitalii Samolovskikh aka Kefir
 */
public final class TwitterUtils {
    public static boolean validate(Twitter twitter){
        boolean flag = false;
        if(twitter!=null){
            try {
                twitter.verifyCredentials();
                flag = true;
            } catch (Throwable e) {
                // Nothing!
            }
        }
        return flag;
    }

    /**
     * Prevent class initialization.
     */
    private TwitterUtils() {
    }
}

Resolve bug with twitter authorization.

Resolve bug with twitter authorization.


package org.geotools.ysld.validate;

import org.geotools.filter.text.cql2.CQLException;
import org.geotools.filter.text.ecql.ECQL;
import org.opengis.filter.Filter;
import org.yaml.snakeyaml.events.ScalarEvent;

public class FilterValidator extends ScalarValidator {
    @Override
    protected String validate(String value, ScalarEvent evt, YsldValidateContext context) {
        try {
            ECQL.toFilter(value);
            return null;
        } catch (CQLException e) {
            return "Invalid filter: " + e.getMessage();
        }
    }
}

package org.geotools.ysld.validate;

import org.geotools.filter.text.cql2.CQLException;
import org.geotools.filter.text.ecql.ECQL;
import org.opengis.filter.Filter;
import org.yaml.snakeyaml.events.ScalarEvent;

public class FilterValidator extends ScalarValidator {
    @Override
    protected String validate(String value, ScalarEvent evt, YsldValidateContext context) {
        try {
            ECQL.toFilter(value);
            return null;
        } catch (CQLException e) {
            return e.getSyntaxError();
        }
    }
}

Use syntax error when validating

Use syntax error when validating


package me.nallar.patched;

import net.minecraft.network.TcpConnection;
import net.minecraft.server.ThreadMinecraftServer;
import net.minecraft.util.AxisAlignedBB;

public abstract class PatchTcpReaderThread extends ThreadMinecraftServer {
	final TcpConnection tcpConnection;

	public PatchTcpReaderThread(TcpConnection tcpConnection, String name) {
		super(null, name);
		this.tcpConnection = tcpConnection;
	}

	@Override
	public void run() {
		TcpConnection.field_74471_a.getAndIncrement();

		try {
			while (tcpConnection.isRunning()) {
				while (true) {
					if (!tcpConnection.readNetworkPacket()) {
						AxisAlignedBB.getAABBPool().cleanPool();
						try {
							sleep(2L);
						} catch (InterruptedException ignored) {
						}
					}
				}
			}
		} finally {
			TcpConnection.field_74471_a.getAndDecrement();
		}
	}
}

package me.nallar.patched;

import net.minecraft.network.TcpConnection;
import net.minecraft.server.ThreadMinecraftServer;
import net.minecraft.util.AxisAlignedBB;

public abstract class PatchTcpReaderThread extends ThreadMinecraftServer {
	int count;
	final TcpConnection tcpConnection;

	public PatchTcpReaderThread(TcpConnection tcpConnection, String name) {
		super(null, name);
		this.tcpConnection = tcpConnection;
	}

	@Override
	public void run() {
		TcpConnection.field_74471_a.getAndIncrement();

		try {
			while (tcpConnection.isRunning()) {
				while (true) {
					if (!tcpConnection.readNetworkPacket()) {
						try {
							sleep(2L);
						} catch (InterruptedException ignored) {
						}
					}
					if (count++ % 30 == 0) {
						AxisAlignedBB.getAABBPool().cleanPool();
					}
				}
			}
		} finally {
			TcpConnection.field_74471_a.getAndDecrement();
		}
	}
}

Change AABB pool cleanup timing

Change AABB pool cleanup timing

Signed-off-by: Ross Allan <ca2c77e14df1e7ee673215c1ef658354e220f471@gmail.com>


package org.springframework.security.ui;

import org.springframework.core.Ordered;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.servlet.FilterChain;
import javax.servlet.ServletResponse;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.Filter;
import java.io.IOException;

/**
 * Implements Ordered interface as required by security namespace configuration and implements unused filter
 * lifecycle methods and performs casting of request and response to http versions in doFilter method.
 *
 * @author Luke Taylor
 * @version $Id$
 */
public abstract class SpringSecurityFilter implements Filter, Ordered {

    /**
     * Does nothing. We use IoC container lifecycle services instead.
     *
     * @param filterConfig ignored
     * @throws ServletException ignored
     */
    public void init(FilterConfig filterConfig) throws ServletException {
    }

    /**
     * Does nothing. We use IoC container lifecycle services instead.
     */
    public void destroy() {
    }

    public final void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        // Do we really need the checks on the types in practice ?
        if (!(request instanceof HttpServletRequest)) {
            throw new ServletException("Can only process HttpServletRequest");
        }

        if (!(response instanceof HttpServletResponse)) {
            throw new ServletException("Can only process HttpServletResponse");
        }

        doFilterHttp((HttpServletRequest)request, (HttpServletResponse)response, chain);
    }

    protected abstract void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException;
}

package org.springframework.security.ui;

import org.springframework.core.Ordered;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.servlet.FilterChain;
import javax.servlet.ServletResponse;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.Filter;
import java.io.IOException;

/**
 * Implements Ordered interface as required by security namespace configuration and implements unused filter
 * lifecycle methods and performs casting of request and response to http versions in doFilter method.
 *
 * @author Luke Taylor
 * @version $Id$
 */
public abstract class SpringSecurityFilter implements Filter, Ordered {

    /**
     * Does nothing. We use IoC container lifecycle services instead.
     *
     * @param filterConfig ignored
     * @throws ServletException ignored
     */
    public final void init(FilterConfig filterConfig) throws ServletException {
    }

    /**
     * Does nothing. We use IoC container lifecycle services instead.
     */
    public final void destroy() {
    }

    public final void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        // Do we really need the checks on the types in practice ?
        if (!(request instanceof HttpServletRequest)) {
            throw new ServletException("Can only process HttpServletRequest");
        }

        if (!(response instanceof HttpServletResponse)) {
            throw new ServletException("Can only process HttpServletResponse");
        }

        doFilterHttp((HttpServletRequest)request, (HttpServletResponse)response, chain);
    }

    protected abstract void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException;
}

Mark the unused Servlet Container callback methods as final to ensure subclasses do not rely upon them.


package com.scoopit.example;

import com.scoopit.client.ScoopApiExecutionException;
import com.scoopit.client.ScoopClient;
import com.scoopit.model.Post;
import com.scoopit.model.Topic;
import com.scoopit.model.User;

public class GetTopicAndUser {
    public static void main(String[] args) throws ScoopApiExecutionException {
        // get yours on https://www.scoop.it/dev/apps
        ScoopClient scoopit = new ScoopClient("<youapikey>", "<youapisecret>");

        System.out.println("============******===========");
        Topic t = scoopit.getTopic(9014);
        System.out.println(t);
        for (Post p : t.curatedPosts) {
            System.out.println(p);
        }
        System.out.println("============******===========");
        User u = scoopit.getUser(0l);
        System.out.println(u);

        System.out.println("============******===========");
        System.out.println(scoopit.resolveId("fixies", Type.Topic));
        try {
            System.out.println(scoopit.resolveId("some-topic-that-should-,not-exists", Type.Topic));
        } catch (ScoopApiExecutionException e) {
            if (e.response.getCode() == 404) {
                System.out.println("=> not found!");
            }
        }

    }
}

package com.scoopit.example;

import com.scoopit.client.ScoopApiExecutionException;
import com.scoopit.client.ScoopClient;
import com.scoopit.model.Post;
import com.scoopit.model.Topic;
import com.scoopit.model.User;

public class GetTopicAndUser {
    public static void main(String[] args) throws ScoopApiExecutionException {
        // get yours on https://www.scoop.it/dev/apps
        ScoopClient scoopit = new ScoopClient("<youapikey>", "<youapisecret>");

        System.out.println("============******===========");
        Topic t = scoopit.getTopic(9014);
        System.out.println(t);
        for (Post p : t.curatedPosts) {
            System.out.println(p);
        }
        System.out.println("============******===========");
        User u = scoopit.getUser(0l);
        System.out.println(u);

        System.out.println("============******===========");
        System.out.println(scoopit.resolveId("fixies", Type.Topic));
        try {
            System.out.println(scoopit.resolveId("some-topic-that-should-,not-exists", Type.Topic));
        } catch (ScoopApiExecutionException e) {
            if (e.response.getCode() == 404) {
                System.out.println("=> not found!");
            } else {
                throw e;
            }
        }

    }
}

Throw the execution error of not a 404

Throw the execution error of not a 404


package com.inepex.ineFrame.client.page;

import java.util.Map;

import com.google.gwt.user.client.ui.Widget;
import com.inepex.ineFrame.client.misc.HandlerAwareLayoutPanel;
import com.inepex.ineFrame.client.navigation.InePlace;

public class LayoutPanelBasedPage extends HandlerAwareLayoutPanel implements InePage{

	protected InePlace currentPlace;

	public LayoutPanelBasedPage() {}

	@Override
	public void setCurrentPlace(InePlace place) {
		this.currentPlace = place;
	}

	@Override
	public void setUrlParameters(Map<String, String> urlParams,
			UrlParamsParsedCallback callback) throws Exception {
		callback.onUrlParamsParsed();
	}

	@Override
	public void onShow() {
		// TODO Auto-generated method stub

	}

	@Override
	public Widget asWidget() {
		return this;
	}

	public InePlace getCurrentPlace() {
		return currentPlace;
	}
}

package com.inepex.ineFrame.client.page;

import java.util.Map;

import org.apache.tools.ant.taskdefs.condition.IsFileSelected;

import com.google.gwt.user.client.ui.Widget;
import com.inepex.ineFrame.client.misc.HandlerAwareLayoutPanel;
import com.inepex.ineFrame.client.navigation.InePlace;

public class LayoutPanelBasedPage extends HandlerAwareLayoutPanel implements InePage{

	protected InePlace currentPlace;
	protected Boolean isFirstShow = true;

	public LayoutPanelBasedPage() {}

	@Override
	public void setCurrentPlace(InePlace place) {
		this.currentPlace = place;
	}

	@Override
	public void setUrlParameters(Map<String, String> urlParams,
			UrlParamsParsedCallback callback) throws Exception {
		callback.onUrlParamsParsed();
	}

	@Override
	public void onShow() {
		if(isFirstShow){
			isFirstShow = false;
			onShow(true);
		}else{
			onShow(false);
		}

	}

	@Override
	public Widget asWidget() {
		return this;
	}

	public InePlace getCurrentPlace() {
		return currentPlace;
	}
	public void onShow(boolean isfirstShow){

	}
}

Add method onShow(boolean) to LayoutPanelbased page. It indicates the first show of the page.

git-svn-id: 1119f77b1e9a9b65230954af94f4d37570a443ef@918 7ef67a20-634e-90e6-9ab5-3f2075439470


package org.kie.server.swarm.ml;

import java.util.Arrays;

import org.kie.server.swarm.AbstractKieServerMain;
import org.wildfly.swarm.Swarm;
import org.wildfly.swarm.jaxrs.JAXRSArchive;

public class KieServerMain extends AbstractKieServerMain {

    public static void main(String[] args) throws Exception {
    	Swarm container = new Swarm();

        System.out.println("\tBuilding kie server deployable...");
        JAXRSArchive deployment = createDeployment(container);

        System.out.println("\tStaring Wildfly Swarm....");
        container.start();

        System.out.println("\tConfiguring kjars to be auto deployed to server " + Arrays.toString(args));
        installKJars(args);

        System.out.println("\tDeploying kie server ....");
        container.deploy(deployment);
    }
}

package org.kie.server.swarm.ml;

import java.util.Arrays;
import java.util.HashMap;

import org.kie.server.swarm.AbstractKieServerMain;
import org.wildfly.swarm.Swarm;
import org.wildfly.swarm.config.logging.Level;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import org.wildfly.swarm.logging.LoggingFraction;

public class KieServerMain extends AbstractKieServerMain {

    public static void main(String[] args) throws Exception {
    	Swarm container = new Swarm();

        System.out.println("\tBuilding kie server deployable...");
        JAXRSArchive deployment = createDeployment(container);

        container.fraction(
            new LoggingFraction()
                .consoleHandler("CONSOLE", c -> {
                    c.level(Level.INFO);
                    c.formatter("%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n");
                })
                .rootLogger(Level.INFO, "CONSOLE")
        );

        System.out.println("\tStaring Wildfly Swarm....");
        container.start();

        System.out.println("\tConfiguring kjars to be auto deployed to server " + Arrays.toString(args));
        installKJars(args);

        System.out.println("\tDeploying kie server ....");
        container.deploy(deployment);
    }
}

Add Logging configuration into Kie-ML server


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

package org.elasticsearch.action;

import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.test.ESTestCase;

public class DocWriteResponseTests extends ESTestCase {
    public void testGetLocation() {
        DocWriteResponse response = new DocWriteResponse(new ShardId("index", "uuid", 0), "type", "id", 0) {
            // DocWriteResponse is abstract so we have to sneak a subclass in here to test it.
        };
        assertEquals("/index/type/id", response.getLocation(null));
        assertEquals("/index/type/id?routing=test_routing", response.getLocation("test_routing"));
    }
}

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

package org.elasticsearch.action;

import org.elasticsearch.action.DocWriteResponse.Operation;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.test.ESTestCase;

public class DocWriteResponseTests extends ESTestCase {
    public void testGetLocation() {
        DocWriteResponse response = new DocWriteResponse(new ShardId("index", "uuid", 0), "type", "id", 0, Operation.CREATE) {
            // DocWriteResponse is abstract so we have to sneak a subclass in here to test it.
        };
        assertEquals("/index/type/id", response.getLocation(null));
        assertEquals("/index/type/id?routing=test_routing", response.getLocation("test_routing"));
    }
}

Fix unit test build failure

Fix unit test build failure

We didn't catch the failure because we tested against the fork instead
of master. I think.


package carpentersblocks.renderer;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class BlockHandlerCarpentersPressurePlate extends BlockHandlerBase {

    @Override
    public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderBlocks)
    {
        renderBlocks.setRenderBounds(0.0F, 0.4375F, 0.0F, 1.0F, 0.5625F, 1.0F);
        super.renderInventoryBlock(block, metadata, modelID, renderBlocks);
    }

}

package carpentersblocks.renderer;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class BlockHandlerCarpentersPressurePlate extends BlockHandlerBase {

    @Override
    public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderBlocks)
    {
        renderBlocks.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
        Tessellator.instance.addTranslation(0.0F, 0.4365F, 0.0F);
        super.renderInventoryBlock(block, metadata, modelID, renderBlocks);
        Tessellator.instance.addTranslation(0.0F, -0.4365F, 0.0F);
    }

}

Tweak pressure plate inventory rendering.


package org.osgi.service.jaxrs.runtime.dto;

import org.osgi.dto.DTO;

/**
 * Represents information about a JAX-RS resource method.
 *
 * @NotThreadSafe
 * @author $Id$
 */
public class ResourceMethodInfoDTO extends DTO {

	/**
	 * The HTTP verb being handled, for example GET, DELETE, PUT, POST, HEAD,
	 * OPTIONS
	 */
	String	method;

	/**
	 * The mime-type(s) consumed by this resource method, null if not defined
	 */
	String[]	consumingMimeType;

	/**
	 * The mime-type(s) produced by this resource method, null if not defined
	 */
	String[]	producingMimeType;

	/**
	 * The URI of this sub-resource, null if this is not a sub-resource method
	 */
	String	uri;
}

package org.osgi.service.jaxrs.runtime.dto;

import org.osgi.dto.DTO;

/**
 * Represents information about a JAX-RS resource method.
 *
 * @NotThreadSafe
 * @author $Id$
 */
public class ResourceMethodInfoDTO extends DTO {

	/**
	 * The HTTP verb being handled, for example GET, DELETE, PUT, POST, HEAD,
	 * OPTIONS
	 */
	public String	method;

	/**
	 * The mime-type(s) consumed by this resource method, null if not defined
	 */
	public String[]	consumingMimeType;

	/**
	 * The mime-type(s) produced by this resource method, null if not defined
	 */
	public String[]	producingMimeType;

	/**
	 * The URI of this sub-resource, null if this is not a sub-resource method
	 */
	public String	uri;
}

[JAX-RS] Fix visibility of fields in the ResourceMethodInfo DTO


package org.redline_rpm.header;

public enum Architecture {

	NOARCH,
	I386,
	ALPHA,
	SPARC,
	MIPS,
	PPC,
	M68K,
	IP,
	RS6000,
	IA64,
	SPARC64,
	MIPSEL,
	ARM,
	MK68KMINT,
	S390,
	S390X,
	PPC64,
	SH,
	XTENSA,
	X86_64,
	PPC64LE
}

package org.redline_rpm.header;

public enum Architecture {

	NOARCH,
	I386,
	ALPHA,
	SPARC,
	MIPS,
	PPC,
	M68K,
	IP,
	RS6000,
	IA64,
	SPARC64,
	MIPSEL,
	ARM,
	MK68KMINT,
	S390,
	S390X,
	PPC64,
	SH,
	XTENSA,
	X86_64,
	PPC64LE,
	AARCH64
}

Add AARCH64 as an architecture to support Arm64 platform

We failed to generate aarch64 rpm when using the nebula ospackage
plugin. Adding aarch64 as a supported arch should fix the issue.


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

package com.centurylink.cloud.sdk.tests.mocks;

import com.centurylink.cloud.sdk.tests.TestModule;
import org.mockito.Spy;

import java.lang.reflect.Field;
import java.util.stream.Stream;

/**
 * @author Ilya Drabenia
 */
public class BindSpiesModule extends TestModule {
    private final Object target;

    public BindSpiesModule(Object target) {
        this.target = target;
    }

    @Override
    protected void configure() {
        overrideSpyBinding();
    }

    private void overrideSpyBinding() {
        Stream
            .of(declaredFields())
            .filter(f -> f.isAnnotationPresent(Spy.class))
            .forEach(f ->
                bind(f.getType()).toProvider(new SpyProvider(f.getType())
            )
        );
    }

    private Field[] declaredFields() {
        return target
            .getClass()
            .getDeclaredFields();
    }

}

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

package com.centurylink.cloud.sdk.tests.mocks;

import com.centurylink.cloud.sdk.tests.TestModule;
import org.mockito.Spy;

import java.lang.reflect.Field;
import java.util.stream.Stream;

/**
 * @author Ilya Drabenia
 */
public class BindSpiesModule extends TestModule {
    private final Object target;

    public BindSpiesModule(Object target) {
        this.target = target;
    }

    @Override
    protected void configure() {
        overrideSpyBinding();
    }

    @SuppressWarnings("unchecked")
    private void overrideSpyBinding() {
        Stream
            .of(declaredFields())
            .filter(f -> f.isAnnotationPresent(Spy.class))
            .forEach(f ->
                bind(f.getType()).toProvider(new SpyProvider(f.getType())
            )
        );
    }

    private Field[] declaredFields() {
        return target
            .getClass()
            .getDeclaredFields();
    }

}

Fix compilation issue on not latest JDKs


package com.marklogic.hector;

import com.marklogic.spring.batch.columnmap.ColumnMapSerializer;
import org.apache.commons.lang3.StringEscapeUtils;

import java.util.Map;

public class XmlStringColumnMapSerializer implements ColumnMapSerializer {

    @Override
    public String serializeColumnMap(Map<String, Object> columnMap, String rootLocalName) {
        String content = "";
        String rootName = rootLocalName.length() == 0 ? "record" : rootLocalName;
        content = "<" + rootName + ">\n";

        for (Map.Entry<String, Object> entry : transformColumnMap(columnMap).entrySet()) {
            String elName = entry.getKey().replaceAll("[^A-Za-z0-9]", "");
            content += "<" + elName + ">" + StringEscapeUtils.escapeXml11(entry.getValue().toString()) + "</" + elName + ">\n";
        }

        content += "</" + rootName + ">";
        return content;
    }

    //The strategy is to extend this class and overwrite this method.
    protected Map<String, Object> transformColumnMap(Map<String, Object> columnMap) {
        return columnMap;
    }

}

package com.marklogic.hector;

import com.marklogic.spring.batch.columnmap.ColumnMapSerializer;
import org.apache.commons.lang3.StringEscapeUtils;

import java.util.Map;

public class XmlStringColumnMapSerializer implements ColumnMapSerializer {

    @Override
    public String serializeColumnMap(Map<String, Object> columnMap, String rootLocalName) {
        String content = "";
        String rootName = rootLocalName.length() == 0 ? "record" : rootLocalName;
        content = "<" + rootName + ">\n";

        for (Map.Entry<String, Object> entry : transformColumnMap(columnMap).entrySet()) {
            String elName = entry.getKey().replaceAll("[^A-Za-z0-9\\_\\-]", "");
            content += "<" + elName + ">" + StringEscapeUtils.escapeXml11(entry.getValue().toString()) + "</" + elName + ">\n";
        }

        content += "</" + rootName + ">";
        return content;
    }

    //The strategy is to extend this class and overwrite this method.
    protected Map<String, Object> transformColumnMap(Map<String, Object> columnMap) {
        return columnMap;
    }

}

Allow underscores and dashes in element names


package org.ingrahamrobotics.robottables.api;

public enum UpdateAction {
    /**
     * Used when a key is assigned a value for the first time in this client
     */
    NEW,
    /**
     * Used when a key is already known to the client, and is updated
     */
    UPDATE,
    /**
     * Used when a key is deleted
     */
    DELETE;
}

package org.ingrahamrobotics.robottables.api;

public enum UpdateAction {
    /**
     * Used when a key is assigned a value for the first time in this client
     */
    NEW,
    /**
     * Used when a key is already known to the client, and is updated
     */
    UPDATE,
    /**
     * Used when a key is deleted
     */
    DELETE,
}

Remove semicolon! minor, minor, and even more minor.


/*
 * Copyright 2000-2011 JetBrains s.r.o.
 *
 * 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.intellij.ide.macro;

import com.intellij.openapi.actionSystem.DataContext;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * @author Eugene Zhuravlev
 */
public abstract class PromptingMacro extends Macro{

  @Override
  public final String expand(@NotNull DataContext dataContext) throws ExecutionCancelledException {
    final String userInput = promptUser(dataContext);
    if (userInput == null) {
      throw new ExecutionCancelledException();
    }
    return userInput;
  }

  /**
   * Called from expand() method
   *
   * @param dataContext
   * @return user input. If null is returned, ExecutionCancelledException is thrown by expand() method
   */
  @Nullable
  protected abstract String promptUser(DataContext dataContext);
}

// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.macro;

import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Ref;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * @author Eugene Zhuravlev
 */
public abstract class PromptingMacro extends Macro{

  @Override
  public final String expand(@NotNull DataContext dataContext) throws ExecutionCancelledException {
    Ref<String> userInput = Ref.create();
    ApplicationManager.getApplication().invokeAndWait(() -> userInput.set(promptUser(dataContext)));
    if (userInput.isNull()) {
      throw new ExecutionCancelledException();
    }
    return userInput.get();
  }

  /**
   * Called from expand() method
   *
   * @param dataContext
   * @return user input. If null is returned, ExecutionCancelledException is thrown by expand() method
   */
  @Nullable
  protected abstract String promptUser(DataContext dataContext);
}

Support expanding prompting macro not from EDT (GO-9289)

GitOrigin-RevId: fdded0455fbeb18873b49c90e2084b6fc2ecf487


// Copyright (c) 2012 Microsoft Corporation.  All rights reserved.

package tlc2.tool.fp;

import java.io.IOException;

import tlc2.tool.fp.DiskFPSet;
import tlc2.tool.fp.FPSet;
import tlc2.tool.fp.MSBDiskFPSet;

public class MultiThreadedMSBDiskFPSetTest extends MultiThreadedFPSetTest {

	/* (non-Javadoc)
	 * @see tlc2.tool.fp.AbstractFPSetTest#getFPSet(long)
	 */
	@Override
	protected FPSet getFPSet(long freeMemoryInBytes) throws IOException {
		long maxInMemoryCapacity = freeMemoryInBytes / (long) DiskFPSet.LongSize;
		return new MSBDiskFPSet(maxInMemoryCapacity >> 10);
	}
}

// Copyright (c) 2012 Microsoft Corporation.  All rights reserved.

package tlc2.tool.fp;

import java.io.IOException;

import tlc2.tool.fp.DiskFPSet;
import tlc2.tool.fp.FPSet;
import tlc2.tool.fp.MSBDiskFPSet;

public class MultiThreadedMSBDiskFPSetTest extends MultiThreadedFPSetTest {

	/* (non-Javadoc)
	 * @see tlc2.tool.fp.AbstractFPSetTest#getFPSet(long)
	 */
	@Override
	protected FPSet getFPSet(long freeMemoryInBytes) throws IOException {
		long maxInMemoryCapacity = freeMemoryInBytes / (long) DiskFPSet.LongSize;
		return new MSBDiskFPSet(maxInMemoryCapacity);
	}
}

Remove accidentally committed div by 1024 added for debugging purpose only


package com.basgeekball.awesomevalidation.utility;

public class RegexTemplate {

    public static final String TELEPHONE = "(^\\+)?[0-9()-]*";

    private RegexTemplate() {
        throw new AssertionError();
    }
}

package com.basgeekball.awesomevalidation.utility;

public class RegexTemplate {

    public static final String NOT_EMPTY = "^(?=\\s*\\S).*$";
    public static final String TELEPHONE = "(^\\+)?[0-9()-]*";

    private RegexTemplate() {
        throw new AssertionError();
    }
}

Add a regex constant for checking empty field.


package com.gh4a.model;

import io.reactivex.Single;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Path;

public interface GitHubFeedService {
    @GET("{url}")
    Single<Response<GitHubFeed>> getFeed(@Path(value = "url", encoded = true) String url);

    @GET("https://github.blog/feed/atom/")
    Single<Response<GitHubFeed>> getBlogFeed();
}

package com.gh4a.model;

import io.reactivex.Single;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Path;

public interface GitHubFeedService {
    @GET("{url}")
    Single<Response<GitHubFeed>> getFeed(@Path(value = "url", encoded = true) String url);

    @GET("https://github.blog/all.atom")
    Single<Response<GitHubFeed>> getBlogFeed();
}

Revert "Update GitHub blog feed URL"

Revert "Update GitHub blog feed URL"

This reverts commit 5b7a1ba116731b0e7302ff27b385504876ddd04e.


package net.squanchy.about;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;

import net.squanchy.R;
import net.squanchy.fonts.TypefaceStyleableActivity;
import net.squanchy.navigation.Navigator;

public class AboutActivity extends TypefaceStyleableActivity {

    private static final String SQUANCHY_WEBSITE = "https://squanchy.net";
    private static final String SQUANCHY_GITHUB = "https://github.com/rock3r/squanchy";

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

        setContentView(R.layout.activity_about);

        setupToolbar();

        Navigator navigator = AboutInjector.obtain(this)
                .navigator();

        findViewById(R.id.website_button).setOnClickListener(
                view -> navigator.toExternalUrl(SQUANCHY_WEBSITE)
        );

        findViewById(R.id.github_button).setOnClickListener(
                view -> navigator.toExternalUrl(SQUANCHY_GITHUB)
        );

        findViewById(R.id.foss_button).setOnClickListener(
                view -> navigator.toFossLicenses()
        );
    }

    private void setupToolbar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
}

package net.squanchy.about;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;

import net.squanchy.R;
import net.squanchy.fonts.TypefaceStyleableActivity;
import net.squanchy.navigation.Navigator;

public class AboutActivity extends TypefaceStyleableActivity {

    private static final String SQUANCHY_WEBSITE = "https://squanchy.net";
    private static final String SQUANCHY_GITHUB = "https://github.com/rock3r/squanchy";

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

        setContentView(R.layout.activity_about);

        setupToolbar();

        Navigator navigator = AboutInjector.obtain(this)
                .navigator();

        findViewById(R.id.website_button).setOnClickListener(
                view -> navigator.toExternalUrl(SQUANCHY_WEBSITE)
        );

        findViewById(R.id.github_button).setOnClickListener(
                view -> navigator.toExternalUrl(SQUANCHY_GITHUB)
        );

        findViewById(R.id.foss_button).setOnClickListener(
                view -> navigator.toFossLicenses()
        );
    }

    private void setupToolbar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

Handle up button in about screen toolbar


package com.fabricio.vergal.RNWorkers;

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

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

public class RNWorkersPackage implements ReactPackage {

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

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

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(
            new RNWorkersModule(reactContext)
        );
    }
}

package com.fabricio.vergal.RNWorkers;

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

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

public class RNWorkersPackage implements ReactPackage {

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

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(
            new RNWorkersModule(reactContext)
        );
    }
}

Breaking: Remove `@Override` of `createJSModules()`, removed in RN 0.47


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

package android.support.design.widget;

import android.content.Context;
import android.support.v7.widget.AppCompatImageButton;
import android.util.AttributeSet;

class VisibilityAwareImageButton extends AppCompatImageButton {

    private int mUserSetVisibility;

    public VisibilityAwareImageButton(Context context) {
        this(context, null);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mUserSetVisibility = getVisibility();
    }

    @Override
    public void setVisibility(int visibility) {
        internalSetVisibility(visibility, true);
    }

    final void internalSetVisibility(int visibility, boolean fromUser) {
        super.setVisibility(visibility);
        if (fromUser) {
            mUserSetVisibility = visibility;
        }
    }

    final int getUserSetVisibility() {
        return mUserSetVisibility;
    }
}

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

package android.support.design.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageButton;

class VisibilityAwareImageButton extends ImageButton {

    private int mUserSetVisibility;

    public VisibilityAwareImageButton(Context context) {
        this(context, null);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mUserSetVisibility = getVisibility();
    }

    @Override
    public void setVisibility(int visibility) {
        internalSetVisibility(visibility, true);
    }

    final void internalSetVisibility(int visibility, boolean fromUser) {
        super.setVisibility(visibility);
        if (fromUser) {
            mUserSetVisibility = visibility;
        }
    }

    final int getUserSetVisibility() {
        return mUserSetVisibility;
    }
}

Fix crash in FAB background tint
am: 9d42ab847a

* commit '9d42ab847a9187fe54c53553a0593fad0aea9263':
  Fix crash in FAB background tint


package edu.columbia.cs.psl.test.phosphor;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class LambdaIntTagITCase {
	@Test
	public void testCollectors() throws Exception{
		List<String> givenList = Arrays.asList("a", "bb", "ccc", "dd");
		givenList.stream().collect(Collectors.toList());

	}
	@Test
	public void testEmptyLambda() throws Exception {
		Runnable r = () -> {
		};
	}

	@Test
	public void testIntStreamsDontCrash() throws Exception {
		int sum = IntStream.of(1, 2, 3, 4, 5).sum(); //creates a bunch of lambdas
	}

	@Test
	public void testSupplier() throws Exception {
		Supplier<double[]> supplier = () -> new double[3];
		double[] d = supplier.get();
	}
}

package edu.columbia.cs.psl.test.phosphor;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class LambdaIntTagITCase {

	// This is known to not work correctly on int tags. It may never be possible to make it work completely on int tags, because
	// we need to add a fake parameter to every modified constructor to make sure that it is unique. But, we can't do that
	// for cases where INVOKEDYNAMIC binds a constructor to a non-constructor call (although maybe we can fix this, not enough
	// time to look into it now)
//	@Test
//	public void testCollectors() throws Exception{
//		List<String> givenList = Arrays.asList("a", "bb", "ccc", "dd");
//		givenList.stream().collect(Collectors.toList());
//
//	}
	@Test
	public void testEmptyLambda() throws Exception {
		Runnable r = () -> {
		};
	}

	@Test
	public void testIntStreamsDontCrash() throws Exception {
		int sum = IntStream.of(1, 2, 3, 4, 5).sum(); //creates a bunch of lambdas
	}

	@Test
	public void testSupplier() throws Exception {
		Supplier<double[]> supplier = () -> new double[3];
		double[] d = supplier.get();
	}
}

Disable int tag collectors test

Disable int tag collectors test


package com.salvadordalvik.something;

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

/**
 * Created by matthewshepard on 1/31/14.
 */
public class LoginActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_activity);
        setTitle(R.string.login_activity_title);
    }
}

package com.salvadordalvik.something;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

/**
 * Created by matthewshepard on 1/31/14.
 */
public class LoginActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_activity);
        setTitle(R.string.login_activity_title);
    }
}

Update log inactivity to match fragment support.


package org.zalando.nakadi.service.subscription.state;

import org.zalando.nakadi.service.subscription.StreamingContext;

import javax.annotation.Nullable;
import java.io.IOException;

public class CleanupState extends State {
    private final Exception exception;

    public CleanupState(@Nullable final Exception e) {
        this.exception = e;
    }

    CleanupState() {
        this(null);
    }

    @Override
    public void onEnter() {
        try {
            getContext().unregisterAuthorizationUpdates();
        } catch (final RuntimeException ex) {
            getLog().error("Unexpected fail during removing callback for registration updates", ex);
        }
        try {
            if (null != exception) {
                getOut().onException(exception);
            }
        } finally {
            try {
                getContext().unregisterSession();

            } finally {
                switchState(StreamingContext.DEAD_STATE);
            }

            try {
                getContext().getZkClient().close();
            } catch (final IOException e) {
                getLog().error("Unexpected fail to release zk connection", e);
            }
            getContext().getCurrentSpan().finish();
        }
    }
}

package org.zalando.nakadi.service.subscription.state;

import org.zalando.nakadi.service.subscription.StreamingContext;

import javax.annotation.Nullable;
import java.io.IOException;

public class CleanupState extends State {
    private final Exception exception;

    public CleanupState(@Nullable final Exception e) {
        this.exception = e;
    }

    CleanupState() {
        this(null);
    }

    @Override
    public void onEnter() {
        try {
            getContext().unregisterAuthorizationUpdates();
        } catch (final RuntimeException ex) {
            getLog().error("Unexpected fail during removing callback for registration updates", ex);
        }
        try {
            if (null != exception) {
                getOut().onException(exception);
            }
        } finally {
            try {
                getContext().unregisterSession();

            } finally {
                if (null != exception) {
                    getContext().switchStateImmediately(StreamingContext.DEAD_STATE);
                } else{
                    switchState(StreamingContext.DEAD_STATE);
                }
            }

            try {
                getContext().getZkClient().close();
            } catch (final IOException e) {
                getLog().error("Unexpected fail to release zk connection", e);
            }
            getContext().getCurrentSpan().finish();
        }
    }
}

Switch state immediately to DEAD state/do not schedule it


package com.example.android.sunshine.app;

import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.widget.TextView;

public class MainActivity extends Activity {

    private TextView mTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
        stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
            @Override
            public void onLayoutInflated(WatchViewStub stub) {
                mTextView = (TextView) stub.findViewById(R.id.text);
            }
        });
    }
}

package com.example.android.sunshine.app;

import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.widget.TextView;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class MainActivity extends Activity {

    private TextView mTime;
    private TextView mDate;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
        stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
            @Override
            public void onLayoutInflated(WatchViewStub stub) {
                mTime = (TextView) stub.findViewById(R.id.time);
                mDate = (TextView) stub.findViewById(R.id.date);

                mTime.setText(getCurrentTime());
                mDate.setText(getCurrentDate());
            }
        });
    }

    private String getCurrentTime() {
        Calendar cal = Calendar.getInstance();
        DateFormat date = new SimpleDateFormat("HH:mm");
        date.setTimeZone(cal.getTimeZone());
        return date.format(cal.getTime());
    }

    private String getCurrentDate() {
        Calendar cal = Calendar.getInstance();
        DateFormat date = new SimpleDateFormat("EEE, MMM dd yyyy");
        date.setTimeZone(cal.getTimeZone());
        return date.format(cal.getTime()).toUpperCase();
    }
}

Set current time and date

Set current time and date


/* This file is part of RentalRooms for Bukkit, licensed under the MIT License (MIT).
 *
 * Copyright (c) JCThePants (www.jcwhatever.com)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.jcwhatever.bukkit.rental;

import com.jcwhatever.bukkit.generic.language.LanguageManager;
import com.jcwhatever.bukkit.generic.language.Localized;

public class Lang {

    private Lang() {}

    private static LanguageManager _languageManager = new LanguageManager();

    @Localized
    public static String get(String text, Object... params) {
        return _languageManager.get(RentalRooms.getInstance(), text, params);
    }

}

/* This file is part of RentalRooms for Bukkit, licensed under the MIT License (MIT).
 *
 * Copyright (c) JCThePants (www.jcwhatever.com)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.jcwhatever.bukkit.rental;

import com.jcwhatever.bukkit.generic.language.Localized;

public class Lang {

    private Lang() {}

    @Localized
    public static String get(String text, Object... params) {
        return RentalRooms.getInstance().getLanguageManager().get(text, params);
    }

}

Implement localization and fix existing localization to match changes


package com.elmakers.mine.bukkit.magic;

import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.elmakers.mine.bukkit.api.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;

public class MageParameters extends ParameterizedConfiguration {
    private static Set<String> attributes;
    private final @Nonnull
    Mage mage;

    public MageParameters(Mage mage, String context) {
        super(context);
        this.mage = mage;
    }

    public MageParameters(MageParameters copy) {
        super(copy);
        this.mage = copy.mage;
    }

    protected MageController getController() {
        return mage.getController();
    }

    protected Mage getMage() {
        return mage;
    }

    public static void initializeAttributes(Set<String> attrs) {
        attributes = new HashSet<>(attrs);
    }

    @Override
    @Nullable
    protected Double evaluate(String expression) {
        if (mage.isPlayer()) {
            expression = getController().setPlaceholders(mage.getPlayer(), expression);
        }
        return super.evaluate(expression);
    }

    @Override
    protected double getParameter(String parameter) {
        Double value = mage.getAttribute(parameter);
        return value == null || Double.isNaN(value) || Double.isInfinite(value) ? 0 : value;
    }

    @Override
    protected Set<String> getParameters() {
        return attributes;
    }
}

package com.elmakers.mine.bukkit.magic;

import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;

import com.elmakers.mine.bukkit.api.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;

public class MageParameters extends ParameterizedConfiguration {
    private static Set<String> attributes;
    private final @Nullable
    Mage mage;

    public MageParameters(Mage mage, String context) {
        super(context);
        this.mage = mage;
    }

    public MageParameters(MageParameters copy) {
        super(copy);
        this.mage = copy.mage;
    }

    @Nullable
    protected MageController getController() {
        return mage == null ? null : mage.getController();
    }

    @Nullable
    protected Mage getMage() {
        return mage;
    }

    public static void initializeAttributes(Set<String> attrs) {
        attributes = new HashSet<>(attrs);
    }

    @Override
    @Nullable
    protected Double evaluate(String expression) {
        if (mage != null && mage.isPlayer()) {
            expression = mage.getController().setPlaceholders(mage.getPlayer(), expression);
        }
        return super.evaluate(expression);
    }

    @Override
    protected double getParameter(String parameter) {
        Double value = mage == null ? null : mage.getAttribute(parameter);
        return value == null || Double.isNaN(value) || Double.isInfinite(value) ? 0 : value;
    }

    @Override
    protected Set<String> getParameters() {
        return attributes;
    }
}

Fix evaluating complex spell properties on load


// Copyright 2015-present 650 Industries. All rights reserved.

package host.exp.exponent.branch;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;

import host.exp.exponent.ABIVersion;
import host.exp.exponent.RNObject;
import io.branch.referral.Branch;

public class BranchManager {
  public static boolean isEnabled(Context context) {
    try {
      final ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
          context.getPackageName(),
          PackageManager.GET_META_DATA);
      if (ai.metaData != null) {
        return ai.metaData.getString("io.branch.sdk.BranchKey") != null;
      }
    } catch (final PackageManager.NameNotFoundException ignore) {}

    return false;
  }

  public static void initialize(Application application) {
    if (!isEnabled(application)) {
      return;
    }
    Branch.getAutoInstance(application);
  }

  public static void handleLink(Activity activity, String uri, String sdkVersion) {
    RNObject branchModule = new RNObject("host.exp.exponent.modules.api.standalone.branch.RNBranchModule");
    branchModule.loadVersion(sdkVersion);
    branchModule.callStatic("initSession", Uri.parse(uri), activity);
  }
}

// Copyright 2015-present 650 Industries. All rights reserved.

package host.exp.exponent.branch;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;

import host.exp.exponent.RNObject;
import io.branch.referral.Branch;

public class BranchManager {
  public static boolean isEnabled(Context context) {
    try {
      final ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
          context.getPackageName(),
          PackageManager.GET_META_DATA);
      if (ai.metaData != null) {
        return ai.metaData.getString("io.branch.sdk.BranchKey") != null;
      }
    } catch (final PackageManager.NameNotFoundException ignore) {
    }

    return false;
  }

  public static void initialize(Application application) {
    if (!isEnabled(application)) {
      return;
    }
    Branch.getAutoInstance(application);
  }

  public static void handleLink(Activity activity, String uri, String sdkVersion) {
    if (!isEnabled(activity)) {
      return;
    }
    RNObject branchModule = new RNObject("host.exp.exponent.modules.api.standalone.branch.RNBranchModule");
    branchModule.loadVersion(sdkVersion);
    branchModule.callStatic("initSession", Uri.parse(uri), activity);
  }
}

[android] Fix Android Expo Client crash when opening old experiences


package net.kencochrane.raven;

import org.testng.annotations.Test;

import java.util.ServiceLoader;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.instanceOf;

public class DefaultRavenFactoryTest {
    @Test
    public void checkServiceLoaderProvidesFactory(){
        ServiceLoader<RavenFactory> ravenFactories = ServiceLoader.load(RavenFactory.class);

        assertThat(ravenFactories, contains(instanceOf(DefaultRavenFactory.class)));
    }
}

package net.kencochrane.raven;

import org.hamcrest.Matchers;
import org.testng.annotations.Test;

import java.util.ServiceLoader;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;

public class DefaultRavenFactoryTest {
    @Test
    public void checkServiceLoaderProvidesFactory() {
        ServiceLoader<RavenFactory> ravenFactories = ServiceLoader.load(RavenFactory.class);

        assertThat(ravenFactories, Matchers.<RavenFactory>hasItem(instanceOf(DefaultRavenFactory.class)));
    }
}

Use hasItem rather than contains

Use hasItem rather than contains


/*
 * #%L
 * Simmetrics Core
 * %%
 * Copyright (C) 2014 - 2015 Simmetrics 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.
 * #L%
 */

package org.simmetrics.tokenizers;

import org.simmetrics.tokenizers.Tokenizer;

@SuppressWarnings({"javadoc","deprecation"})
public class WhitespaceTokenizerTest extends TokenizerTest {

	@Override
	protected Tokenizer getTokenizer() {
		return new Whitespace();
	}

	@Override
	protected T[] getTests() {

		return new T[] {
				new T(""),
				new T(" "),
				new T(" A","A"),
				new T("A B C", "A", "B", "C"),
				new T("A   B  C", "A", "B", "C"),
				new T("A\nB", "A", "B"),
				new T("A\tB", "A", "B"),
				new T("A\t\nB", "A", "B"),
		};
	}
}

/*
 * #%L
 * Simmetrics Core
 * %%
 * Copyright (C) 2014 - 2015 Simmetrics 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.
 * #L%
 */

package org.simmetrics.tokenizers;

import org.simmetrics.tokenizers.Tokenizer;

@SuppressWarnings("javadoc")
@Deprecated
public class WhitespaceTokenizerTest extends TokenizerTest {

	@Override
	protected Tokenizer getTokenizer() {
		return new Whitespace();
	}

	@Override
	protected T[] getTests() {

		return new T[] {
				new T(""),
				new T(" "),
				new T(" A","A"),
				new T("A B C", "A", "B", "C"),
				new T("A   B  C", "A", "B", "C"),
				new T("A\nB", "A", "B"),
				new T("A\tB", "A", "B"),
				new T("A\t\nB", "A", "B"),
		};
	}
}

Swap deprecation warnings for deprecation


package com.epam.cdp.jee.todo.jms.listener;

import lombok.extern.slf4j.Slf4j;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@MessageDriven(name = "TaskQueueMDB", activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType",
                propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "destination",
                propertyValue = "java:jboss/exported/jms/queue/task") })
@Slf4j
public class TaskMessageListener implements MessageListener {

    @Override
    public void onMessage(final Message message) {
        log.info("Message was received: '{}'", message);
    }
}

package com.epam.cdp.jee.todo.jms.listener;

import lombok.extern.slf4j.Slf4j;

import java.util.Date;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.inject.Inject;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.joda.time.DateTime;

import com.epam.cdp.jee.todo.persistence.Jpa;
import com.epam.cdp.jee.todo.persistence.entity.Task;
import com.epam.cdp.jee.todo.persistence.repository.TaskRepository;

@MessageDriven(name = "TaskQueueMDB", activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType",
                propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "destination",
                propertyValue = "java:jboss/exported/jms/queue/task")})
@Slf4j
public class TaskMessageListener implements MessageListener {

    @Inject
    @Jpa
    private TaskRepository taskRepository;

    @Override
    public void onMessage(final Message message) {
        TextMessage textMessage = (TextMessage) message;
        try {
            String taskName = textMessage.getText();
            Task task = new Task(new Date().getTime(), taskName, new DateTime());
            taskRepository.add(task);
        } catch (JMSException e) {
            log.error("Unable to process JMS message", e);
        }
    }
}

Add task creation through JMS

Add task creation through JMS


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

import org.apache.logging.log4j.spi.LoggerContext;

/**
 *
 */
public class SimpleLoggerContext implements LoggerContext {
    private Logger logger = new SimpleLogger();

    public Logger getLogger(String name) {
        return logger;
    }

    public boolean hasLogger(String name) {
        return false;
    }
}

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

import org.apache.logging.log4j.spi.LoggerContext;

/**
 *
 */
public class SimpleLoggerContext implements LoggerContext {
    private Logger logger = new SimpleLogger();

    public Logger getLogger(String name) {
        return logger;
    }

    public boolean hasLogger(String name) {
        return false;
    }

    public Object getExternalContext() {
        return null;
    }
}

Update test class with getExternalContext.

git-svn-id: 1a1fa68050bcaed5349a5b70a2a7ea3fbc73e3e8@949908 13f79535-47bb-0310-9956-ffa450edef68


/*
 * Copyright 2015-2017 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 v1.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 */

package com.example.project;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;

import static org.junit.jupiter.api.Assertions.assertEquals;

@DisplayName("Nested test classes")
public class NestedTest {

    private Calculator calculator = new Calculator();

    @Nested
    @Tag("negative")
    class TestAddingNegativeNumber {

        @BeforeEach
        void setUp(TestInfo testInfo) {
            System.out.println("Executing: " + testInfo.getDisplayName());
        }

        @Test
        @DisplayName("Tests adding zero")
        void addZero() {
            assertEquals(-2, calculator.add(-2, 0));
        }

        @Test
        @DisplayName("Tests adding two negative numbers")
        void addNegativeNumber() {
            assertEquals(-3, calculator.add(-1, -2));
        }

    }

}

/*
 * Copyright 2015-2017 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 v1.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 */

package com.example.project;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;

import static org.junit.jupiter.api.Assertions.assertEquals;

@DisplayName("Nested test classes")
public class NestedTest {

    private Calculator calculator = new Calculator();

    @Nested
    @Tag("negative")
    class TestAddingNegativeNumber {

        @BeforeEach
        void setUp(TestInfo testInfo) {
            System.out.println("Executing: " + testInfo.getDisplayName());
        }

        @Test
        @DisplayName("Tests adding zero")
        void testAddingZero() {
            assertEquals(-2, calculator.add(-2, 0));
        }

        @Test
        @DisplayName("Tests adding two negative numbers")
        void testAddingNegative() {
            assertEquals(-3, calculator.add(-1, -2));
        }

    }

}

Revert "Remove "test" prefix from test methods for consistency"

This reverts commit 815ef75aa72e0af0998f27663ddb6c38d6afc5ba.


package net.chibidevteam.apiversioning.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import net.chibidevteam.apiversioning.annotation.ValidApiVersion;

@RestController
@Validated
public class ApiVersionFallbackController {

    @Value("${net.chibidevteam.apiversioning.path.varname}")
    private final String apiPathVarname = "";

    @RequestMapping("${net.chibidevteam.apiversioning.path.api}/**")
    @ResponseStatus(code = HttpStatus.NOT_IMPLEMENTED, reason = "This endpoint is not implemented for the given version")
    public void pathFallback(@ValidApiVersion @PathVariable(apiPathVarname) String apiVersion) {
        // It only makes difference between not supported versions and non implemented endpoints.
        // It always leads to a HTTP error
    }

}

package net.chibidevteam.apiversioning.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import net.chibidevteam.apiversioning.annotation.ValidApiVersion;

@RestController
@Validated
public class ApiVersionFallbackController {

    @Value("${net.chibidevteam.apiversioning.path.varname}")
    private final String apiPathVarname = "";

    @RequestMapping("${net.chibidevteam.apiversioning.path.api}/**")
    @ResponseStatus(code = HttpStatus.NOT_FOUND, reason = "This endpoint is not implemented for the given version")
    public void pathFallback(@ValidApiVersion @PathVariable(apiPathVarname) String apiVersion) {
        // It only makes difference between not supported versions and non implemented endpoints.
        // It always leads to a HTTP error
    }
}

Change HTTP error for fallback: did not match standards.


package org.jetbrains.plugins.scala.refactoring.introduceVariable;

import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.Sdk;
import junit.framework.Test;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.plugins.scala.base.ScalaLibraryLoader;
import org.jetbrains.plugins.scala.util.TestUtils;
import scala.Option$;

/**
 * @author Alexander Podkhalyuzin
 */
public class IntroduceVariableTest extends AbstractIntroduceVariableTestBase {
  @NonNls
  private static final String DATA_PATH = "/introduceVariable/data";

  public IntroduceVariableTest() {
    super(TestUtils.getTestDataPath() + DATA_PATH);
  }

  public static Test suite() {
    return new IntroduceVariableTest();
  }

  @Override
  protected void setUp(Project project) {
    super.setUp(project);
    Module[] modules = ModuleManager.getInstance(project).getModules();
    Sdk sdk = JavaSdk.getInstance().createJdk("java sdk", TestUtils.getMockJdk(), false);
    ScalaLibraryLoader loader = new ScalaLibraryLoader(project, modules[0], null, false, false, Option$.MODULE$.apply(sdk));
    loader.loadLibrary(TestUtils.DEFAULT_SCALA_SDK_VERSION);
  }
}

package org.jetbrains.plugins.scala.refactoring.introduceVariable;

import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
import junit.framework.Test;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.plugins.scala.base.ScalaLibraryLoader;
import org.jetbrains.plugins.scala.util.TestUtils;
import scala.Option$;

/**
 * @author Alexander Podkhalyuzin
 */
public class IntroduceVariableTest extends AbstractIntroduceVariableTestBase {
  @NonNls
  private static final String DATA_PATH = "/introduceVariable/data";

  public IntroduceVariableTest() {
    super(TestUtils.getTestDataPath() + DATA_PATH);
  }

  public static Test suite() {
    return new IntroduceVariableTest();
  }

  @Override
  protected void setUp(Project project) {
    super.setUp(project);
    Module[] modules = ModuleManager.getInstance(project).getModules();
    String mockJdk = TestUtils.getMockJdk();
    VfsRootAccess.allowRootAccess(mockJdk);
    Sdk sdk = JavaSdk.getInstance().createJdk("java sdk", mockJdk, false);
    ScalaLibraryLoader loader = new ScalaLibraryLoader(project, modules[0], null, false, false, Option$.MODULE$.apply(sdk));
    loader.loadLibrary(TestUtils.DEFAULT_SCALA_SDK_VERSION);
  }
}

Allow root access for mock jdk in introduce variable test


package mib.microservice.commons.kafka;

import mib.microservice.commons.events.IEventConsumer;
import mib.microservice.commons.events.base.EventBase;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import kafka.message.MessageAndMetadata;

public class Consumer<K, V extends EventBase<?>> implements Runnable {
	private KafkaStream<K, V> stream;
	private IEventConsumer<K, V> command;

	public Consumer(KafkaStream<K, V> stream, IEventConsumer<K, V> command) {
		this.stream = stream;
		this.command = command;
	}

	@Override
	public void run() {
		ConsumerIterator<K, V> it = this.stream.iterator();
		while (it.hasNext()) {
			MessageAndMetadata<K, V> msg = it.next();

			System.out.println("p" + msg.partition() + " @" + msg.offset());

			this.command.execute(msg.key(), msg.message());
		}
	}
}

package mib.microservice.commons.kafka;

import kafka.consumer.KafkaStream;
import kafka.message.MessageAndMetadata;
import mib.microservice.commons.events.IEventConsumer;
import mib.microservice.commons.events.base.EventBase;

public class Consumer<K, V extends EventBase<?>> implements Runnable {
	private KafkaStream<K, V> stream;
	private IEventConsumer<K, V> command;

	public Consumer(KafkaStream<K, V> stream, IEventConsumer<K, V> command) {
		this.stream = stream;
		this.command = command;
	}

	@Override
	public void run() {
		for (MessageAndMetadata<K, V> msg : this.stream) {
			System.out.println("p" + msg.partition() + " @" + msg.offset());

			this.command.execute(msg.key(), msg.message());
		}
	}
}

Use for-loop instead of while+iterator

Use for-loop instead of while+iterator


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

package org.gluu.oxtrust.service;

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

import javax.ws.rs.core.Application;
import javax.ws.rs.ext.Provider;

import org.gluu.oxtrust.ws.rs.scim2.BulkWebService;
import org.gluu.oxtrust.ws.rs.scim2.GroupWebService;
import org.gluu.oxtrust.ws.rs.scim2.ResourceTypeWS;
import org.gluu.oxtrust.ws.rs.scim2.SchemaWebService;
import org.gluu.oxtrust.ws.rs.scim2.ServiceProviderConfigWS;
import org.gluu.oxtrust.ws.rs.scim2.UserWebService;

/**
 * Integration with Resteasy
 *
 * @author Yuriy Movchan
 * @version June 6, 2017
 */
@Provider
public class TestResteasyInitializer extends Application {

    @Override
    public Set<Class<?>> getClasses() {
        HashSet<Class<?>> classes = new HashSet<Class<?>>();
        classes.add(GroupWebService.class);
        classes.add(UserWebService.class);
        classes.add(BulkWebService.class);
        classes.add(ResourceTypeWS.class);
        classes.add(SchemaWebService.class);
        classes.add(ServiceProviderConfigWS.class);

        return classes;
    }

}

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

package org.gluu.oxtrust.service;

import org.gluu.oxtrust.ws.rs.scim2.UserWebService;

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

import javax.ws.rs.core.Application;
import javax.ws.rs.ext.Provider;

/**
 * Integration with Resteasy
 *
 * @author Yuriy Movchan
 * @version June 6, 2017
 */
@Provider
public class TestResteasyInitializer extends Application {

    @Override
    public Set<Class<?>> getClasses() {
        HashSet<Class<?>> classes = new HashSet<Class<?>>();
        classes.add(UserWebService.class);
        /*
        classes.add(GroupWebService.class);
        classes.add(BulkWebService.class);
        classes.add(ResourceTypeWS.class);
        classes.add(SchemaWebService.class);
        classes.add(ServiceProviderConfigWS.class);
*/
        return classes;
    }

}

Disable services except Userwebservice temporarily