package com.cisco.oss.foundation.logging.transactions;

import org.slf4j.Logger;

/**
 * Created by Nuna on 10/01/2016.
 */
public class ReportLogger extends SchedulerLogger {

    public static void start(final Logger logger, final Logger auditor, final String reportName) {
        if(!createLoggingAction(logger, auditor, new ReportLogger())) {
            return;
        }

        ReportLogger reportLogger = (ReportLogger) getInstance();
        if (reportLogger == null) {
            return;
        }

        reportLogger.startInstance(reportName);
    }

    @Override
    protected void addPropertiesStart(String reportName) {
        super.addPropertiesStart("Report", "ReportName", reportName);
    }

    public static void success(String reportBody) {
        ReportLogger logger = (ReportLogger) getInstance();
        if (logger == null) {
            return;
        }

        addProperty("ReportBody", reportBody);

        logger.successInstance();

    }
}

package com.cisco.oss.foundation.logging.transactions;

import org.slf4j.Logger;

/**
 * Created by Nuna on 10/01/2016.
 */
public class ReportLogger extends SchedulerLogger {

    static private String reportNameFieldName = "ReportName";
    static private String reportBodyFieldName = "ReportBody";

    static public void  setIvpFieldNames(String reportNameFieldName, String reportBodyFieldName) {
        ReportLogger.reportNameFieldName = reportNameFieldName;
        ReportLogger.reportBodyFieldName = reportBodyFieldName;
    }

    public static void start(final Logger logger, final Logger auditor, final String reportName) {
        if(!createLoggingAction(logger, auditor, new ReportLogger())) {
            return;
        }

        ReportLogger reportLogger = (ReportLogger) getInstance();
        if (reportLogger == null) {
            return;
        }

        reportLogger.startInstance(reportName);
    }

    @Override
    protected void addPropertiesStart(String reportName) {
        super.addPropertiesStart("Report", reportNameFieldName, reportName);
    }

    public static void success(String reportBody) {
        ReportLogger logger = (ReportLogger) getInstance();
        if (logger == null) {
            return;
        }

        addProperty(reportBodyFieldName, reportBody);

        logger.successInstance();

    }
}

Allow chaning report field names


package seedu.scheduler.model.entry;

import seedu.scheduler.commons.exceptions.IllegalValueException;

/**
 * Represents an Entry's name in the scheduler.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS = "Entry names should be spaces or alphanumeric characters";
    public static final String NAME_VALIDATION_REGEX = "[\\p{Alnum} ]+";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        name = name.trim();
        if (!isValidName(name)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = name;
    }

    /**
     * Returns true if a given string is a valid entry name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX);
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Name // instanceof handles nulls
                && this.fullName.equals(((Name) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

package seedu.scheduler.model.entry;

import seedu.scheduler.commons.exceptions.IllegalValueException;

/**
 * Represents an Entry's name in the scheduler.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS = "Entry names should be spaces or alphanumeric characters";
    //@@author A0126090N
    public static final String NAME_VALIDATION_REGEX = "[\\p{Alnum}\' ]+";
    //@@author

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        name = name.trim();
        if (!isValidName(name)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = name;
    }

    /**
     * Returns true if a given string is a valid entry name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX);
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Name // instanceof handles nulls
                && this.fullName.equals(((Name) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

Add function can now have the ' character


package net.sf.jabref.logic.formatter;

import net.sf.jabref.logic.formatter.bibtexfields.*;

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

public class BibtexFieldFormatters {
    public static final PageNumbersFormatter PAGE_NUMBERS = new PageNumbersFormatter();
    public static final SuperscriptFormatter SUPERSCRIPTS = new SuperscriptFormatter();
    public static final DateFormatter DATE = new DateFormatter();
    public static final MonthFormatter MONTH_FORMATTER = new MonthFormatter();
    public static final AuthorsFormatter AUTHORS_FORMATTER = new AuthorsFormatter();
    public static final LatexFormatter LATEX_FORMATTER = new LatexFormatter();
    public static final UnitFormatter UNIT_FORMATTER = new UnitFormatter();

    public static final List<Formatter> ALL = Arrays.asList(PAGE_NUMBERS, SUPERSCRIPTS, DATE, AUTHORS_FORMATTER, LATEX_FORMATTER, MONTH_FORMATTER, UNIT_FORMATTER);
}

package net.sf.jabref.logic.formatter;

import net.sf.jabref.logic.formatter.bibtexfields.*;

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

public class BibtexFieldFormatters {
    public static final PageNumbersFormatter PAGE_NUMBERS = new PageNumbersFormatter();
    public static final SuperscriptFormatter SUPERSCRIPTS = new SuperscriptFormatter();
    public static final DateFormatter DATE = new DateFormatter();
    public static final MonthFormatter MONTH_FORMATTER = new MonthFormatter();
    public static final AuthorsFormatter AUTHORS_FORMATTER = new AuthorsFormatter();
    public static final LatexFormatter LATEX_FORMATTER = new LatexFormatter();
    public static final UnitFormatter UNIT_FORMATTER = new UnitFormatter();
    public static final TrimFormatter TRIM_FORMATTER = new TrimFormatter();
    public static final RemoveBracesFormatter REMOVE_BRACES_FORMATTER = new RemoveBracesFormatter();

    public static final List<Formatter> ALL = Arrays.asList(PAGE_NUMBERS, SUPERSCRIPTS, DATE, AUTHORS_FORMATTER, LATEX_FORMATTER, MONTH_FORMATTER, UNIT_FORMATTER, TRIM_FORMATTER, REMOVE_BRACES_FORMATTER);
}

Add TrimFormatter and RemoveBracesFormatter to save actions


package net.md_5.bungee.command;

import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ChatColor;
import net.md_5.bungee.Permission;
import net.md_5.bungee.UserConnection;

public class CommandAlert extends Command
{

    @Override
    public void execute(CommandSender sender, String[] args)
    {
        if (getPermission(sender) != Permission.ADMIN)
        {
            sender.sendMessage(ChatColor.RED + "You do not have permission to execute this command!");
            return;
        }
        if (args.length == 0)
        {
            sender.sendMessage(ChatColor.RED + "You must supply a message.");
        } else
        {
            StringBuilder builder = new StringBuilder();
            if (!args[0].contains("&h")) //They want to hide the alert prefix
            {
                builder.append(ChatColor.DARK_PURPLE);
                builder.append("[Alert] "); //No space at start.
            } else
            {
                args[0].replaceAll("&h", ""); //Remove hide control code from message
            }

            for (String s : args)
            {

                builder.append(ChatColor.translateAlternateColorCodes('&', s)); //Allow custom colours
                builder.append(" ");
            }
            String message = builder.substring(0, builder.length() - 1);
            for (UserConnection con : BungeeCord.instance.connections.values())
            {
                con.sendMessage(message);
            }
        }
    }
}

package net.md_5.bungee.command;

import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ChatColor;
import net.md_5.bungee.Permission;
import net.md_5.bungee.UserConnection;

public class CommandAlert extends Command
{

    @Override
    public void execute(CommandSender sender, String[] args)
    {
        if (getPermission(sender) != Permission.ADMIN)
        {
            sender.sendMessage(ChatColor.RED + "You do not have permission to execute this command!");
            return;
        }
        if (args.length == 0)
        {
            sender.sendMessage(ChatColor.RED + "You must supply a message.");
        } else
        {
            StringBuilder builder = new StringBuilder();
            if (!args[0].contains("&h")) //They want to hide the alert prefix
            {
            builder.append(ChatColor.DARK_PURPLE);
            builder.append("[Alert] "); //No space at start.
            }

            for (String s : args)
            {
                s = s.replaceAll("&h", ""); //Fix replace
                builder.append(ChatColor.translateAlternateColorCodes('&', s)); //Allow custom colours
                builder.append(" ");
            }

            String message = builder.substring(0, builder.length() - 1);
            for (UserConnection con : BungeeCord.instance.connections.values())
            {
                con.sendMessage(message);
            }
        }
    }
}

Fix &h not being removed from the message properly


package chap3CoreJavaAPIs;

import java.util.Calendar;
import java.time.Month;
import java.time.*;

class Dates{
	public static void main(String... args){
		// Be careful, old API Calendar starts at 0, new Month starts at 1
		System.out.println(Calendar.APRIL);
		System.out.println(Month.APRIL);
		System.out.println(LocalDate.of(2015, Month.APRIL, 1));
		System.out.println(LocalDate.of(2015, Calendar.APRIL, 1));
		System.out.println(LocalDate.of(2015, Calendar.MAY, 1).equals(LocalDate.of(2015, Month.APRIL, 1)));

		System.out.println(Period.ofMonths(1));
		System.out.println(Period.ofMonths(1).ofDays(2));
		System.out.println(Period.ofDays(2));
	}
}

package chap3CoreJavaAPIs;

import java.util.Calendar;
import java.time.Month;
import java.time.*;

class Dates {

	public void createDateFromString() {
		Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2012-05-20T09:00:00.000Z");
		String formattedDate = new SimpleDateFormat("yyyy-MM-dd'T'HHmmss").format(date);
		System.out.println(formattedDate);
	}

	public static void main(String... args) {
		// Be careful, old API Calendar starts at 0, new Month starts at 1
		System.out.println(Calendar.APRIL);
		System.out.println(Month.APRIL);
		System.out.println(LocalDate.of(2015, Month.APRIL, 1));
		System.out.println(LocalDate.of(2015, Calendar.APRIL, 1));
		System.out.println(LocalDate.of(2015, Calendar.MAY, 1).equals(LocalDate.of(2015, Month.APRIL, 1)));

		System.out.println(Period.ofMonths(1));
		System.out.println(Period.ofMonths(1).ofDays(2));
		System.out.println(Period.ofDays(2));
	}
}

Create a date object from a string representing a date


package com.github.rmsy.bukkitpotdebug;

import org.bukkit.Bukkit;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;

import java.util.Collection;

public class PotDebugPlugin extends JavaPlugin implements Listener {
    @Override
    public void onDisable() {
        HandlerList.unregisterAll((JavaPlugin) this);
    }

    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onPotionSplash(final PotionSplashEvent event) {
        ThrownPotion potion = event.getPotion();
        Collection<PotionEffect> effects = potion.getEffects();
        Bukkit.broadcastMessage("A " + event.getEntity().getType().getName() + " splashed a potion with " + effects.size() + " effects attached:");
        for (PotionEffect effect : effects) {
            Bukkit.broadcastMessage("Type: " + effect.getType().getName() + ", Level: " + (effect.getAmplifier() + 1) + ", Duration: " + effect.getDuration());
        }
    }
}

package com.github.rmsy.bukkitpotdebug;

import org.bukkit.Bukkit;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;

import java.util.Collection;

public class PotDebugPlugin extends JavaPlugin implements Listener {
    @Override
    public void onDisable() {
        HandlerList.unregisterAll((JavaPlugin) this);
    }

    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onPotionSplash(final PotionSplashEvent event) {
        ThrownPotion potion = event.getPotion();
        Collection<PotionEffect> effects = ((PotionMeta) potion.getItem().getItemMeta()).getCustomEffects();
        Bukkit.broadcastMessage("A " + event.getEntity().getType().getName() + " splashed a potion with " + effects.size() + " effects attached:");
        for (PotionEffect effect : effects) {
            Bukkit.broadcastMessage("Type: " + effect.getType().getName() + ", Level: " + (effect.getAmplifier() + 1) + ", Duration: " + effect.getDuration());
        }
    }
}

Use PotionMeta instead of ThrownPotion


package io.github.achtern.AchternEngine.core.rendering.generator;

import io.github.achtern.AchternEngine.core.math.Vector2f;
import io.github.achtern.AchternEngine.core.rendering.Color;

import java.awt.*;
import java.awt.image.BufferedImage;

public class ImageGenerator {

    public static BufferedImage fromColor(Color color) {
        return fromColor(new Vector2f(1, 1), color);
    }

    public static BufferedImage fromColor(Vector2f dimensions, Color color) {
        BufferedImage image = new BufferedImage((int) dimensions.getX(), (int) dimensions.getY(), BufferedImage.TYPE_INT_RGB);

        Graphics2D g = image.createGraphics();

        g.setPaint(color.toAwt());
        g.fillRect(0, 0, (int) dimensions.getX(), (int) dimensions.getY());

        g.dispose();

        return image;
    }

}

package io.github.achtern.AchternEngine.core.rendering.generator;

import io.github.achtern.AchternEngine.core.math.Vector2f;
import io.github.achtern.AchternEngine.core.rendering.Color;
import io.github.achtern.AchternEngine.core.util.UBuffer;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;

public class ImageGenerator {

    public static BufferedImage fromColor(Color color) {
        return fromColor(new Vector2f(1, 1), color);
    }

    public static BufferedImage fromColor(Vector2f dimensions, Color color) {
        BufferedImage image = new BufferedImage((int) dimensions.getX(), (int) dimensions.getY(), BufferedImage.TYPE_INT_RGB);

        Graphics2D g = image.createGraphics();

        g.setPaint(color.toAwt());
        g.fillRect(0, 0, (int) dimensions.getX(), (int) dimensions.getY());

        g.dispose();

        return image;
    }

    public static ByteBuffer bytesFromColor(Color color) {
        return bytesFromColor(new Vector2f(1, 1), color);
    }

    public static ByteBuffer bytesFromColor(Vector2f dimensions, Color color) {
        ByteBuffer buffer = UBuffer.createByteBuffer((int) (dimensions.getX() * dimensions.getY() * 4));

        for(int y = 0; y < dimensions.getY(); y++) {
            for(int x = 0; x < dimensions.getX(); x++) {

                int pixel = color.toInt();

                buffer.put((byte)((pixel) & 0xFF)); // R
                buffer.put((byte)((pixel >> 8) & 0xFF)); // G
                buffer.put((byte)((pixel >> 16) & 0xFF)); // B
                buffer.put((byte)((pixel >> 24) & 0xFF)); // Alpha

            }
        }

        buffer.flip();

        return buffer;
    }

}

Create ByteBuffers for Textures from Color


import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;

/**
 * Displays all knowledge base (KB) articles and a search bar
 */
public class KB_IndexController extends BaseController {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        super.doGet(request, response);

        Issue_DBWrapper issueWrapper = this.getPortalBean().getIssues();

        issueWrapper.reset();

        List<Issue> issues = Arrays.asList(issueWrapper.getIssues());

        request.setAttribute("issues", issues);

        request.getRequestDispatcher("/WEB-INF/jsp/kb/index.jsp").forward(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        super.doPost(request, response);
    }
}

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;

/**
 * Displays all knowledge base (KB) articles and a search bar
 */
public class KB_IndexController extends BaseController {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        super.doGet(request, response);

        Category_DBWrapper categoryWrapper = this.getPortalBean().getCategories();

        categoryWrapper.reset();

        List<Category> categories = Arrays.asList(categoryWrapper.getCategories());

        request.setAttribute("categories", categories);

        request.getRequestDispatcher("/WEB-INF/jsp/kb/index.jsp").forward(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        super.doPost(request, response);
    }
}

Change issues to sending categories


package durianhln.polymorph;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import durianhln.polymorph.Polymorph;

public class AndroidLauncher extends AndroidApplication {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        initialize(new Polymorph(), config);
    }
}

package durianhln.polymorph;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import durianhln.polymorph.Polymorph;

public class AndroidLauncher extends AndroidApplication {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        config.useImmersiveMode = true;
        initialize(new Polymorph(), config);
    }
}

Change Android to immersive mode


package org.keycloak.admin.client.resource;

import org.keycloak.representations.idm.UserRepresentation;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;

public interface UsersResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<UserRepresentation> search(@QueryParam("username") String username,
                                           @QueryParam("firstName") String firstName,
                                           @QueryParam("lastName") String lastName,
                                           @QueryParam("email") String email,
                                           @QueryParam("first") Integer firstResult,
                                           @QueryParam("max") Integer maxResults);

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<UserRepresentation> search(@QueryParam("search") String search,
                                           @QueryParam("first") Integer firstResult,
                                           @QueryParam("max") Integer maxResults);

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    Response create(UserRepresentation userRepresentation);

    @Path("{username}")
    public UserResource get(@PathParam("username") String username);

}

package org.keycloak.admin.client.resource;

import org.keycloak.representations.idm.UserRepresentation;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;

public interface UsersResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    List<UserRepresentation> search(@QueryParam("username") String username,
                                           @QueryParam("firstName") String firstName,
                                           @QueryParam("lastName") String lastName,
                                           @QueryParam("email") String email,
                                           @QueryParam("first") Integer firstResult,
                                           @QueryParam("max") Integer maxResults);

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    List<UserRepresentation> search(@QueryParam("search") String search,
                                           @QueryParam("first") Integer firstResult,
                                           @QueryParam("max") Integer maxResults);

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    Response create(UserRepresentation userRepresentation);

    @Path("{id}")
    UserResource get(@PathParam("id") String id);

}

Fix admin-api to show that users are retrieved by ip, not username


package de.christinecoenen.code.zapp.app.mediathek.controller;

import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class DownloadReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();

		if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) {
			context.startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS));
		}
	}
}

package de.christinecoenen.code.zapp.app.mediathek.controller;

import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class DownloadReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();

		if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) {
			Intent downloadManagerIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
			downloadManagerIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(downloadManagerIntent);
		}
	}
}

Fix crash on api level 23 when clicking download notification


// Copyright 2019 Google LLC
//
// 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
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.sps.data;

import com.google.common.collect.ImmutableList;

/** Wrapper class for infromation sent on a search servlet doGet request. */
public class SearchServletResponse {
  private final ImmutableList<Receipt> matchingReceipts;
  private final String encodedCursor;

  public SearchServletResponse(ImmutableList<Receipt> matchingReceipts, String encodedCursor) {
    this.matchingReceipts = ImmutableList.copyOf(matchingReceipts);
    this.encodedCursor = encodedCursor;
  }
}

// Copyright 2019 Google LLC
//
// 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
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.sps.data;

import com.google.common.collect.ImmutableList;

/** Wrapper class for information sent on a search servlet doGet response. */
public class SearchServletResponse {
  private final ImmutableList<Receipt> matchingReceipts;
  private final String encodedCursor;

  public SearchServletResponse(ImmutableList<Receipt> matchingReceipts, String encodedCursor) {
    this.matchingReceipts = ImmutableList.copyOf(matchingReceipts);
    this.encodedCursor = encodedCursor;
  }
}

Fix comment for response class


package com.opera.core.systems.scope.services;

public interface ISelftest {
	/**
	 * Run the selftest for the specified modules
	 *
	 * @param modules The names of the modules to test
	 * @return The test output
	 */
	/* XXX: Might be a better idea to return some kind of structured object
	 * here, instead of a bare string. First order of business is getting this
	 * damn thing working though.
	 */
	public void runSelftests(String... modules);
}

package com.opera.core.systems.scope.services;

public interface ISelftest {
	/**
	 * Run the selftests for the specified modules.
	 *
	 * @param modules The names of the modules to test
	 * @return The test output
	 */
	public void runSelftests(String... modules);
}

Remove obsolete comment, minor doc tweak.


//
// $Id: SceneService.java,v 1.6 2002/04/15 16:28:03 shaper Exp $

package com.threerings.whirled.client;

import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationDirector;

import com.threerings.whirled.Log;
import com.threerings.whirled.data.SceneCodes;

/**
 * The scene service class provides the client interface to the scene
 * related invocation services (e.g. moving from scene to scene).
 */
public class SceneService implements SceneCodes
{
    /**
     * Requests that that this client's body be moved to the specified
     * scene.
     *
     * @param sceneId the scene id to which we want to move.
     * @param sceneVers the version number of the scene object that we
     * have in our local repository.
     */
    public static void moveTo (Client client, int sceneId,
                               int sceneVers, SceneDirector rsptarget)
    {
        InvocationDirector invdir = client.getInvocationDirector();
        Object[] args = new Object[] {
            new Integer(sceneId), new Integer(sceneVers) };
        invdir.invoke(MODULE_NAME, MOVE_TO_REQUEST, args, rsptarget);
        Log.info("Sent moveTo request [scene=" + sceneId +
                 ", version=" + sceneVers + "].");
    }
}

//
// $Id: SceneService.java,v 1.7 2002/04/26 00:07:05 ray Exp $

package com.threerings.whirled.client;

import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationDirector;

import com.threerings.whirled.Log;
import com.threerings.whirled.data.SceneCodes;

/**
 * The scene service class provides the client interface to the scene
 * related invocation services (e.g. moving from scene to scene).
 */
public class SceneService implements SceneCodes
{
    /**
     * Requests that that this client's body be moved to the specified
     * scene.
     *
     * @param sceneId the scene id to which we want to move.
     * @param sceneVers the version number of the scene object that we
     * have in our local repository.
     */
    public static void moveTo (Client client, int sceneId,
                               int sceneVers, Object rsptarget)
    {
        InvocationDirector invdir = client.getInvocationDirector();
        Object[] args = new Object[] {
            new Integer(sceneId), new Integer(sceneVers) };
        invdir.invoke(MODULE_NAME, MOVE_TO_REQUEST, args, rsptarget);
        Log.info("Sent moveTo request [scene=" + sceneId +
                 ", version=" + sceneVers + "].");
    }
}

Allow any object to be used as the response target for a moveTo request.


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

package org.apache.jorphan.test;

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

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

package org.apache.jorphan.test;

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

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


package com.evollu.react.fa;

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.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class FIRAnalyticsPackage implements ReactPackage {

    public FIRAnalyticsPackage() {
    }

    @Override
    public List<NativeModule> createNativeModules(
            ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new FIRAnalyticsModule(reactContext));
        return modules;
    }

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

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

package com.evollu.react.fa;

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.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class FIRAnalyticsPackage implements ReactPackage {

    public FIRAnalyticsPackage() {
    }

    @Override
    public List<NativeModule> createNativeModules(
            ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new FIRAnalyticsModule(reactContext));
        return modules;
    }

    // Deprecated RN 0.47
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

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

Remove depreciated createJSModules @ovveride marker


package com.enot.cmd.core;

import org.zeroturnaround.exec.ProcessExecutor;
import org.zeroturnaround.exec.ProcessResult;
import org.zeroturnaround.exec.StartedProcess;

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

final class BaseCommand implements Command {
    private final ProcessExecutor processExecutor;

    BaseCommand(ProcessExecutor processExecutor) {
        this.processExecutor = processExecutor;
    }

    /**
     * See {@link ProcessExecutor#execute()}
     */
    @Override
    public ProcessResult execute() throws IOException, TimeoutException, InterruptedException {
        return processExecutor.execute();
    }

    /**
     * See {@link ProcessExecutor#executeNoTimeout()}
     */
    @Override
    public ProcessResult executeNoTimeout() throws IOException, InterruptedException {
        return processExecutor.executeNoTimeout();
    }

    /**
     * See {@link ProcessExecutor#start()}
     */
    @Override
    public StartedProcess start() throws IOException {
        return processExecutor.start();
    }

    /**
     * Get the command line as a string
     * @return
     */
    @Override
    public String toString() {
        return String.join(" ", processExecutor.getCommand());
    }
}

package com.enot.cmd.core;

import org.zeroturnaround.exec.ProcessExecutor;
import org.zeroturnaround.exec.ProcessResult;
import org.zeroturnaround.exec.StartedProcess;

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

final class BaseCommand implements Command {
    private final ProcessExecutor processExecutor;

    BaseCommand(ProcessExecutor processExecutor) {
        this.processExecutor = processExecutor;
    }

    /**
     * See {@link ProcessExecutor#execute()}
     */
    @Override
    public ProcessResult execute() throws IOException, TimeoutException, InterruptedException {
        return processExecutor.execute();
    }

    /**
     * See {@link ProcessExecutor#executeNoTimeout()}
     */
    @Override
    public ProcessResult executeNoTimeout() throws IOException, InterruptedException {
        return processExecutor.executeNoTimeout();
    }

    /**
     * See {@link ProcessExecutor#start()}
     */
    @Override
    public StartedProcess start() throws IOException {
        return processExecutor.start();
    }
}

Revert "Get the command line as a string"


package org.codefx.demo.junit5;

import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.runner.SelectPackages;
import org.junit.runner.RunWith;

@RunWith(JUnitPlatform.class)
@SelectPackages({ "org.codefx.demo.junit5" })
public class TestWithJUnit5 { }

package org.codefx.demo.junit5;

import org.junit.platform.runner.IncludeClassNamePattern;
import org.junit.platform.runner.IncludeEngines;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.runner.SelectPackages;
import org.junit.runner.RunWith;

@RunWith(JUnitPlatform.class)
@SelectPackages({ "org.codefx.demo.junit5" })
@IncludeClassNamePattern(".*Tests?")
@IncludeEngines("junit-jupiter")
public class TestWithJUnit5 { }

Add more stuff to JUnit-5-in-4-test suite


/*
 * 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.jena.sparql.exec;

import org.apache.jena.sparql.core.DatasetGraph;
import org.apache.jena.update.UpdateProcessor;

public interface UpdateExec extends UpdateProcessor
{
    public static UpdateExecBuilder dataset(DatasetGraph dataset) {
        return UpdateExecDatasetBuilder.create().dataset(dataset);
    }

    public static UpdateExecDatasetBuilder newBuilder() {
        return UpdateExecDatasetBuilder.create();
    }

    /** Execute */
    @Override
    public void execute();
}

/*
 * 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.jena.sparql.exec;

import org.apache.jena.sparql.core.DatasetGraph;
import org.apache.jena.sparql.exec.http.UpdateExecHTTP;
import org.apache.jena.update.UpdateProcessor;

public interface UpdateExec extends UpdateProcessor
{
    /** Create a {@link UpdateExecBuilder} for a dataset. */
    public static UpdateExecBuilder dataset(DatasetGraph dataset) {
        return UpdateExecDatasetBuilder.create().dataset(dataset);
    }

    /** Create a {@link UpdateExecBuilder} for a remote endpoint. */
    public static UpdateExecBuilder service(String serviceURL) {
        return UpdateExecHTTP.newBuilder().endpoint(serviceURL);
    }

    public static UpdateExecDatasetBuilder newBuilder() {
        return UpdateExecDatasetBuilder.create();
    }

    /** Execute */
    @Override
    public void execute();
}

Add update builder starting point 'service(URL)'


package roart.common.util;

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

import org.apache.commons.io.IOUtils;

public class IOUtil {
    public static byte[] toByteArray(InputStream is) throws IOException {
        return IOUtils.toByteArray(is, Integer.MAX_VALUE);
    }
}

package roart.common.util;

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

import org.apache.commons.io.IOUtils;

public class IOUtil {
    public static byte[] toByteArray(InputStream is) throws IOException {
        return is.readNBytes(Integer.MAX_VALUE - 8);
    }
}

Fix for big string limit (I47).


package net.simpvp.Portals;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;

public class Portals extends JavaPlugin {

	public static JavaPlugin instance;

	public static List<UUID> justTeleportedEntities = new ArrayList<UUID>();

	public void onEnable() {
		instance = this;

		/* Check if this plugin's directory exists, if not create it */
		File dir = new File("plugins/Portals");
		if ( !dir.exists() ) {
			dir.mkdir();
		}

		getServer().getPluginManager().registerEvents(new BlockBreak(), this);
		getServer().getPluginManager().registerEvents(new BlockPlace(), this);
		getServer().getPluginManager().registerEvents(new PlayerDeath(), this);
		getServer().getPluginManager().registerEvents(new PlayerToggleSneak(), this);

		/* Remove comment to enable minecart detection through portals */
		/* getServer().getPluginManager().registerEvents(new BlockRedstone(), this); */

		SQLite.connect();
	}

	public void onDisable() {
		SQLite.close();
	}

}

package net.simpvp.Portals;

import java.io.File;
import java.util.UUID;
import java.util.HashSet;

import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;

public class Portals extends JavaPlugin {

	public static JavaPlugin instance;

	public static HashSet<UUID> justTeleportedEntities = new HashSet<UUID>();

	public void onEnable() {
		instance = this;

		/* Check if this plugin's directory exists, if not create it */
		File dir = new File("plugins/Portals");
		if ( !dir.exists() ) {
			dir.mkdir();
		}

		getServer().getPluginManager().registerEvents(new BlockBreak(), this);
		getServer().getPluginManager().registerEvents(new BlockPlace(), this);
		getServer().getPluginManager().registerEvents(new PlayerDeath(), this);
		getServer().getPluginManager().registerEvents(new PlayerToggleSneak(), this);

		/* Remove comment to enable minecart detection through portals */
		/* getServer().getPluginManager().registerEvents(new BlockRedstone(), this); */

		SQLite.connect();
	}

	public void onDisable() {
		SQLite.close();
	}

}

Make justTeleportedEntities a HashSet instead of ArrayList


/*
 * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */package org.xdi.model.custom.script.type.client;

import java.util.Map;

import org.xdi.model.SimpleCustomProperty;

/**
 * Dummy implementation of interface ClientRegistrationType
 *
 * @author Yuriy Movchan Date: 11/11/2014
 */
public class DummyClientRegistrationType implements ClientRegistrationType {

    @Override
    public boolean init(Map<String, SimpleCustomProperty> configurationAttributes) {
        return true;
    }

    @Override
    public boolean destroy(Map<String, SimpleCustomProperty> configurationAttributes) {
        return true;
    }

    @Override
    public int getApiVersion() {
        return 1;
    }

    @Override
    public boolean updateClient(Object registerRequest, Object client, Map<String, SimpleCustomProperty> configurationAttributes) {
        return false;
    }

}

/*
 * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */package org.xdi.model.custom.script.type.client;

import java.util.Map;

import org.xdi.model.SimpleCustomProperty;

/**
 * Dummy implementation of interface ClientRegistrationType
 *
 * @author Yuriy Movchan Date: 11/11/2014
 */
public class DummyClientRegistrationType implements ClientRegistrationType {

	@Override
	public boolean init(Map<String, SimpleCustomProperty> configurationAttributes) {
		return true;
	}

	@Override
	public boolean destroy(Map<String, SimpleCustomProperty> configurationAttributes) {
		return true;
	}

	@Override
	public int getApiVersion() {
		return 1;
	}

	@Override
	public boolean createClient(Object registerRequest, Object client, Map<String, SimpleCustomProperty> configurationAttributes) {
		return false;
	}

	@Override
	public boolean updateClient(Object registerRequest, Object client, Map<String, SimpleCustomProperty> configurationAttributes) {
		return false;
	}

}

Update default client registration implementation


package org.azavea.otm.filters;

import org.azavea.otm.R;

import android.view.View;
import android.widget.ToggleButton;

public class BooleanFilter extends MapFilter {
	public boolean active;

	public BooleanFilter(String key, String label) {
		initialize(key, label, false);
	}

	public BooleanFilter(String key, String label, boolean active) {
		initialize(key, label, active);
	}

	private void initialize(String key, String label, boolean active) {
		this.key = key;
		this.active = active;
		this.label = label;
	}

	@Override
	public String toQueryStringParam() {
		return key + "=" + Boolean.toString(active);
	}

	@Override
	public void updateFromView(View view) {
		this.active = ((ToggleButton)view.findViewById(R.id.active)).isChecked();
	}

	@Override
	public boolean isActive() {
		return this.active;
	}
}

package org.azavea.otm.filters;

import org.azavea.otm.R;

import android.view.View;
import android.widget.ToggleButton;

public class BooleanFilter extends BaseFilter {
	public boolean active;

	public BooleanFilter(String key, String label) {
		initialize(key, label, false);
	}

	public BooleanFilter(String key, String label, boolean active) {
		initialize(key, label, active);
	}

	private void initialize(String key, String label, boolean active) {
		this.key = key;
		this.active = active;
		this.label = label;
	}

	@Override
	public String toQueryStringParam() {
		return key + "=" + Boolean.toString(active);
	}

	@Override
	public void updateFromView(View view) {
		this.active = ((ToggleButton)view.findViewById(R.id.active)).isChecked();
	}

	@Override
	public boolean isActive() {
		return this.active;
	}

	@Override
	public void clear() {
		active = false;
	}
}

Update base filter name and implment overrides


package com.edinarobotics.zephyr.autonomous;

import com.edinarobotics.utils.autonomous.*;
import com.edinarobotics.zephyr.Zephyr;

/**
 *
 */
public class AutonomousStepFactory {
    private Zephyr robot;

    public AutonomousStepFactory(Zephyr robot){
        this.robot = robot;
    }

    public AutonomousStep getShooterFireStep(double shooterSpeed, int numShots){
        final double PISTON_SET_DELAY = 0.5;
        //Steps to bring the piston up and down
        AutonomousStep[] fireSteps = new AutonomousStep[4];
        fireSteps[0] = new ShooterPistonControlStep(true, robot);
        fireSteps[1] = new IdleWaitStep(PISTON_SET_DELAY, robot);
        fireSteps[2] = new ShooterPistonControlStep(false, robot);
        fireSteps[3] = new IdleWaitStep(PISTON_SET_DELAY, robot);

        AutonomousStep[] steps = new AutonomousStep[3];
        //Start the shooter
        steps[0] = new SetShooterSpeedStep(shooterSpeed, robot);
        //Fire the piston several times
        steps[1] = new ForLoopStep(new SequentialAutonomousStepGroup(fireSteps), numShots);
        //Stop the shooter
        steps[2] = new SetShooterSpeedStep(0, robot);

        return new SequentialAutonomousStepGroup(steps);
    }
}

package com.edinarobotics.zephyr.autonomous;

import com.edinarobotics.utils.autonomous.*;
import com.edinarobotics.zephyr.Zephyr;

/**
 *
 */
public class AutonomousStepFactory {
    private Zephyr robot;

    public AutonomousStepFactory(Zephyr robot){
        this.robot = robot;
    }

    public AutonomousStep getShooterFireStep(double shooterSpeed, int numShots){
        final double PISTON_SET_DELAY = 0.5;
        final double BALL_LOAD_DELAY = 1;
        //Steps to bring the piston up and down
        AutonomousStep[] fireSteps = new AutonomousStep[7];
        fireSteps[0] = new ShooterPistonControlStep(true, robot);
        fireSteps[1] = new IdleWaitStep(PISTON_SET_DELAY, robot);
        fireSteps[2] = new ShooterPistonControlStep(false, robot);
        fireSteps[3] = new IdleWaitStep(PISTON_SET_DELAY, robot);
        fireSteps[4] = new SetConveyorStep(true, robot);
        fireSteps[5] = new IdleWaitStep(BALL_LOAD_DELAY, robot);
        fireSteps[6] = new SetConveyorStep(false, robot);

        AutonomousStep[] steps = new AutonomousStep[3];
        //Start the shooter
        steps[0] = new SetShooterSpeedStep(shooterSpeed, robot);
        //Fire the piston several times
        steps[1] = new ForLoopStep(new SequentialAutonomousStepGroup(fireSteps), numShots);
        //Stop the shooter
        steps[2] = new SetShooterSpeedStep(0, robot);

        return new SequentialAutonomousStepGroup(steps);
    }
}

Add ball loading in Autonomous.


package com.consol.citrus.admin.websocket;

import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Martin.Maher@consol.de on 19/06/15.
 */
public class LoggingWebSocketCreator implements WebSocketCreator {

    @Autowired
    private LoggingWebSocket loggingWebSocket;

    @Override
    public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) {
        return loggingWebSocket;
    }

}

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

package com.consol.citrus.admin.websocket;

import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Martin Maher
 * @since 2.2.1
 */
public class LoggingWebSocketCreator implements WebSocketCreator {

    @Autowired
    private LoggingWebSocket loggingWebSocket;

    @Override
    public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) {
        return loggingWebSocket;
    }

}

Update copyright Apache license for file


/*
 * 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.wicket.core.request.handler;

import org.apache.wicket.core.request.handler.StatelessPageWithQueuedComponents.CustomLabel;
import org.apache.wicket.util.tester.WicketTestCase;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

public class PageAndComponentProviderTest extends WicketTestCase
{

	@Test
	public void statelessComponentQueued() throws Exception
	{
		PageAndComponentProvider provider = new PageAndComponentProvider(StatelessPageWithQueuedComponents.class, "container:label");

		CustomLabel component = (CustomLabel)provider.getComponent();

		assertFalse(component.hasBeenConfigured());

	}
}

/*
 * 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.wicket.core.request.handler;

import org.apache.wicket.core.request.handler.StatelessPageWithQueuedComponents.CustomLabel;
import org.apache.wicket.util.tester.WicketTestCase;
import org.junit.Test;

public class PageAndComponentProviderTest extends WicketTestCase
{

	@Test
	public void statelessComponentQueued() throws Exception
	{
		PageAndComponentProvider provider = new PageAndComponentProvider(StatelessPageWithQueuedComponents.class, "container:label");

		CustomLabel component = (CustomLabel)provider.getComponent();

		assertFalse(component.hasBeenConfigured());

	}
}

Revert "Fixed unit test package problem"


package org.ovirt.engine.core.dao;

import static org.mockito.Mockito.mock;

import org.junit.Before;
import org.junit.Test;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.compat.NotImplementedException;

/**
 * A sparse test case for {@link NetworkDAOHibernateImpl}
 * intended to fail once we start implementing actual methods
 */
public class NetworkDAOHibernateImplTest {
    /** The DAO to test */
    private NetworkDAOHibernateImpl dao;

    @Before
    public void setUp() {
        dao = new NetworkDAOHibernateImpl();
    }

    @Test(expected = NotImplementedException.class)
    public void testUnimplementedMethods() {
        dao.getAllForCluster(mock(Guid.class), mock(Guid.class), true);
    }
}

package org.ovirt.engine.core.dao;

import static org.mockito.Mockito.mock;

import org.apache.commons.lang.NotImplementedException;
import org.junit.Before;
import org.junit.Test;
import org.ovirt.engine.core.compat.Guid;

/**
 * A sparse test case for {@link NetworkDAOHibernateImpl}
 * intended to fail once we start implementing actual methods
 */
public class NetworkDAOHibernateImplTest {
    /** The DAO to test */
    private NetworkDAOHibernateImpl dao;

    @Before
    public void setUp() {
        dao = new NetworkDAOHibernateImpl();
    }

    @Test(expected = NotImplementedException.class)
    public void testUnimplementedMethods() {
        dao.getAllForCluster(mock(Guid.class), mock(Guid.class), true);
    }
}

Modify excepted exception to match impl


/*
 * 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 com.example.android.bluetoothchat;

/**
 * Defines several constants used between {@link BluetoothChatService} and the UI.
 */
public interface Constants {

    // Message types sent from the BluetoothChatService Handler
    public static final int MESSAGE_STATE_CHANGE = 1;
    public static final int MESSAGE_READ = 2;
    public static final int MESSAGE_WRITE = 3;
    public static final int MESSAGE_DEVICE_NAME = 4;
    public static final int MESSAGE_TOAST = 5;

    // Key names received from the BluetoothChatService Handler
    public static final String DEVICE_NAME = "device_name";
    public static final String TOAST = "toast";

}

/*
 * 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 com.example.android.bluetoothchat;

/**
 * Defines several constants used between {@link BluetoothChatService} and the UI.
 */
public interface Constants {

    // Message types sent from the BluetoothChatService Handler
    public static final int MESSAGE_STATE_CHANGE = 1;
    public static final int MESSAGE_READ = 2;
    public static final int MESSAGE_WRITE = 3;
    public static final int MESSAGE_DEVICE_NAME = 4;
    public static final int MESSAGE_TOAST = 5;

    // Key names received from the BluetoothChatService Handler
    public static final String DEVICE_NAME = "device_name";
    public static final String TOAST = "toast";
	//check this code for bluetooth chat application, which is very easy and don't need any network as such

}

Revert "Revert "Testing git commit""


import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.net.URL;

public class CourseCodeTableCrawler {
    public static Elements get(String courseCode) {
        String url = "https://stars.bilkent.edu.tr/homepage/ajax/plainOfferings.php?SEMESTER=20142&COURSE_CODE=" + courseCode.toUpperCase();

        try {
            Document doc = Jsoup.parse(new URL(url), 10000);
            Element table = doc.getElementById("poTable");
            Elements rows = table.getElementsByTag("tr");
            return rows;
        } catch (Exception e) {
            e.printStackTrace();
            return new Elements();
        }
    }
}

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.net.URL;

public class CourseCodeTableCrawler {
    public static Elements get(String courseCode) {
        String url = "https://stars.bilkent.edu.tr/homepage/ajax/plainOfferings.php?SEMESTER=20151&COURSE_CODE=" + courseCode.toUpperCase();

        try {
            Document doc = Jsoup.parse(new URL(url), 10000);
            Element table = doc.getElementById("poTable");
            Elements rows = table.getElementsByTag("tr");
            return rows;
        } catch (Exception e) {
            e.printStackTrace();
            return new Elements();
        }
    }
}

Update for Fall 2015-16 semester


package de.linkvt.bachelor.features.annotations.ontology.owl;

import de.linkvt.bachelor.features.Feature;
import de.linkvt.bachelor.features.FeatureCategory;

import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLLiteral;
import org.springframework.stereotype.Component;

@Component
public class OwlAnnotationPropertyFeature extends Feature {

  @Override
  public void addToOntology() {
    OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(IRI.create("customAnnotationProperty"));
    addAxiomToOntology(factory.getOWLDeclarationAxiom(annotationProperty));

    OWLLiteral annotationValue = factory.getOWLLiteral("Custom Annotation Value");
    OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, annotationValue);

    OWLClass owlClass = featurePool.getReusableClass();
    addAxiomToOntology(factory.getOWLDeclarationAxiom(owlClass));
    addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(owlClass.getIRI(), annotation));
  }

  @Override
  public String getName() {
    return "owl:AnnotationProperty";
  }

  @Override
  public String getToken() {
    return "annotationproperty";
  }

  @Override
  public FeatureCategory getCategory() {
    return FeatureCategory.ANNOTATIONS;
  }
}

package de.linkvt.bachelor.features.annotations.ontology.owl;

import de.linkvt.bachelor.features.Feature;
import de.linkvt.bachelor.features.FeatureCategory;

import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLLiteral;
import org.springframework.stereotype.Component;

@Component
public class OwlAnnotationPropertyFeature extends Feature {

  @Override
  public void addToOntology() {
    String ontologyIri = ontology.getOntologyID().getOntologyIRI().get().toString();
    OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(IRI.create(ontologyIri + "customAnnotationProperty"));
    addAxiomToOntology(factory.getOWLDeclarationAxiom(annotationProperty));

    OWLLiteral annotationValue = factory.getOWLLiteral("Custom Annotation Value");
    OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, annotationValue);

    OWLClass owlClass = featurePool.getReusableClass();
    addAxiomToOntology(factory.getOWLDeclarationAxiom(owlClass));
    addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(owlClass.getIRI(), annotation));
  }

  @Override
  public String getName() {
    return "owl:AnnotationProperty";
  }

  @Override
  public String getToken() {
    return "annotationproperty";
  }

  @Override
  public FeatureCategory getCategory() {
    return FeatureCategory.ANNOTATIONS;
  }
}

Use complete iri for annotation property declaration


package edu.pdx.cs410J.whitlock.client;

import edu.pdx.cs410J.AbstractAppointment;

import java.util.Date;

public class Appointment extends AbstractAppointment
{
    @Override
    public String getBeginTimeString()
    {
        return "START " + getBeginTime();
    }

    @Override
    public String getEndTimeString()
    {
        return "END + " + getEndTime();
    }

    @Override
    public Date getEndTime()
    {
        return new Date();
    }

    @Override
    public String getDescription()
    {
        return "My description";
    }

    @Override
    public Date getBeginTime()
    {
        return new Date();
    }
}

package edu.pdx.cs410J.whitlock.client;

import com.google.gwt.i18n.client.DateTimeFormat;
import edu.pdx.cs410J.AbstractAppointment;

import java.util.Date;

public class Appointment extends AbstractAppointment
{
    @Override
    public String getBeginTimeString()
    {
        return "START " + getBeginTime();
    }

    @Override
    public String getEndTimeString()
    {
        return "END + " + formatDate(getEndTime());
    }

    private String formatDate(Date date) {
        String pattern = "yyyy/MM/dd hh:mm a";
        return DateTimeFormat.getFormat(pattern).format(date);
    }

    @Override
    public Date getEndTime()
    {
        return new Date();
    }

    @Override
    public String getDescription()
    {
        return "My description";
    }

    @Override
    public Date getBeginTime()
    {
        return new Date();
    }
}

Use the GWT date/time formatter.


package to.etc.domuidemo.pages.overview.allcomponents;

import to.etc.domui.component.upload.FileUpload2;
import to.etc.domui.component.upload.FileUploadMultiple;
import to.etc.domui.component2.form4.FormBuilder;
import to.etc.domui.dom.html.Div;
import to.etc.domui.dom.html.HTag;

/**
 * @author Frits Jalvingh
 * Created on 14-11-17.
 */
public class FileUploadFragment extends Div {
	@Override public void createContent() throws Exception {
		add(new HTag(2, "File upload component").css("ui-header"));

		FormBuilder fb = new FormBuilder(this);
		FileUpload2 u1 = new FileUpload2("png", "jpg", "gif", "jpeg");
		fb.label("Select an image").item(u1);

		FileUploadMultiple u2 = new FileUploadMultiple("png", "jpg", "gif", "jpeg");
		fb.label("Select multiple").item(u2);

		//FileUpload u2 = new FileUpload("png", "jpg", "gif", "jpeg");
		//fb.label("OLD").item(u2);

	}
}

package to.etc.domuidemo.pages.overview.allcomponents;

import to.etc.domui.component.layout.ContentPanel;
import to.etc.domui.component.upload.FileUpload2;
import to.etc.domui.component.upload.FileUploadMultiple;
import to.etc.domui.component2.form4.FormBuilder;
import to.etc.domui.dom.html.Div;
import to.etc.domui.dom.html.HTag;

/**
 * @author Frits Jalvingh
 * Created on 14-11-17.
 */
public class FileUploadFragment extends Div {
	@Override public void createContent() throws Exception {
		add(new HTag(2, "File upload component").css("ui-header"));

		ContentPanel cp = new ContentPanel();
		add(cp);

		FormBuilder fb = new FormBuilder(cp);
		FileUpload2 u1 = new FileUpload2("png", "jpg", "gif", "jpeg");
		fb.label("Select an image").item(u1);

		FileUploadMultiple u2 = new FileUploadMultiple("png", "jpg", "gif", "jpeg");
		fb.label("Select multiple").item(u2);

		//FileUpload u2 = new FileUpload("png", "jpg", "gif", "jpeg");
		//fb.label("OLD").item(u2);

	}
}

Fix spacing in demo for FileUpload.


package org.apollo.tools;

import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;

/**
 * An RSA key generator.
 *
 * @author Graham
 * @author Major
 */
public final class RsaKeyGenerator {

	/**
	 * The bit count. Strongly recommended to be at least 2,048.
	 */
	private static final int BIT_COUNT = 2_048;

	/**
	 * The entry point of the RsaKeyGenerator.
	 *
	 * @param args The application arguments.
	 */
	public static void main(String[] args) {
		Random random = new SecureRandom();

		BigInteger publicKey = BigInteger.valueOf(65535);
		BigInteger p, q, phi, modulus, privateKey;

		do {
			p = BigInteger.probablePrime(BIT_COUNT / 2, random);
			q = BigInteger.probablePrime(BIT_COUNT / 2, random);
			phi = (p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE));

			modulus = p.multiply(q);
			privateKey = publicKey.modInverse(phi);
		} while (modulus.bitLength() != BIT_COUNT || privateKey.bitLength() != BIT_COUNT
				|| !phi.gcd(publicKey).equals(BigInteger.ONE));

		System.out.println("modulus: " + modulus);
		System.out.println("public key: " + publicKey);
		System.out.println("private key: " + privateKey);
	}

}

package org.apollo.tools;

import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;

/**
 * An RSA key generator.
 *
 * @author Graham
 * @author Major
 */
public final class RsaKeyGenerator {

	/**
	 * The bit count. Strongly recommended to be at least 2,048.
	 */
	private static final int BIT_COUNT = 2_048;

	/**
	 * The entry point of the RsaKeyGenerator.
	 *
	 * @param args The application arguments.
	 */
	public static void main(String[] args) {
		Random random = new SecureRandom();

		BigInteger publicKey = BigInteger.valueOf(65_537);
		BigInteger p, q, phi, modulus, privateKey;

		do {
			p = BigInteger.probablePrime(BIT_COUNT / 2, random);
			q = BigInteger.probablePrime(BIT_COUNT / 2, random);
			phi = (p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE));

			modulus = p.multiply(q);
			privateKey = publicKey.modInverse(phi);
		} while (modulus.bitLength() != BIT_COUNT || privateKey.bitLength() != BIT_COUNT
				|| !phi.gcd(publicKey).equals(BigInteger.ONE));

		System.out.println("modulus: " + modulus);
		System.out.println("public key: " + publicKey);
		System.out.println("private key: " + privateKey);
	}

}

Change RSA public key to 65537 (thanks Lmctruck).


package org.pikater.shared;

public class FieldVerifier
{
	public static boolean isStringNullOrEmpty(String arg)
	{
		return (arg == null) || arg.isEmpty();
	}
}

package org.pikater.shared;

public class FieldVerifier
{
	public static boolean isStringNullOrEmpty(String arg)
	{
		return (arg == null) || arg.isEmpty();
	}

	public static boolean isValidEmail(String email)
	{
		boolean result = false;
		if(!isStringNullOrEmpty(email))
		{
			String[] splitted = email.split("@");
			if(splitted.length == 2)
			{
				// max email length: 64@255
				if((splitted[0].length() <= 64) && (splitted[1].length() <= 255) && splitted[1].contains("."))
				{
					result = true;
				}
			}
		}
		return result;
	}
}

Revert "Custom email validation won't be needed after all."


/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.security.auditlog;

import static org.testng.AssertJUnit.assertEquals;

import org.testng.annotations.Test;

/**
 *
 */
@Test
public class DuplicateFilteringAuditLoggerTest {

  public void testDuplicateFiltering() throws InterruptedException {
    InMemoryAuditLogger memoryLogger = new InMemoryAuditLogger();
    DuplicateFilteringAuditLogger filteringLogger = new DuplicateFilteringAuditLogger(memoryLogger, 1000, 1);

    log5Messages(filteringLogger);
    assertEquals(5, memoryLogger.getMessages().size());

    log5Messages(filteringLogger);
    assertEquals(5, memoryLogger.getMessages().size());

    Thread.sleep(1500);

    log5Messages(filteringLogger);
    assertEquals(10, memoryLogger.getMessages().size());

    log5Messages(filteringLogger);
    assertEquals(10, memoryLogger.getMessages().size());
  }

  private void log5Messages(DuplicateFilteringAuditLogger filteringLogger) {
    filteringLogger.log("alice", "obj1", "op1", true);
    filteringLogger.log("lisa", "obj1", "op1", true);
    filteringLogger.log("alice", "obj2", "op1", true);
    filteringLogger.log("alice", "obj1", "op2", true);
    filteringLogger.log("alice", "obj1", "op1", false);
  }

}

/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.security.auditlog;

import static org.testng.AssertJUnit.assertEquals;

import org.testng.annotations.Test;

/**
 *
 */
@Test(invocationCount = 4)
public class DuplicateFilteringAuditLoggerTest {

  public void testDuplicateFiltering() throws InterruptedException {
    InMemoryAuditLogger memoryLogger = new InMemoryAuditLogger();

    int seconds = 3; //Big enough to make sure writes complete, short enough that we can wait for timeout

    DuplicateFilteringAuditLogger filteringLogger = new DuplicateFilteringAuditLogger(memoryLogger, 1000, seconds);

    log5Messages(filteringLogger);
    assertEquals(5, memoryLogger.getMessages().size());

    log5Messages(filteringLogger);
    assertEquals(5, memoryLogger.getMessages().size());

    Thread.sleep(seconds * 2 * 1000); //Long enough to expire everything

    log5Messages(filteringLogger);
    assertEquals(10, memoryLogger.getMessages().size());

    log5Messages(filteringLogger);
    assertEquals(10, memoryLogger.getMessages().size());
  }

  private void log5Messages(DuplicateFilteringAuditLogger filteringLogger) {
    filteringLogger.log("alice", "obj1", "op1", true);
    filteringLogger.log("lisa", "obj1", "op1", true);
    filteringLogger.log("alice", "obj2", "op1", true);
    filteringLogger.log("alice", "obj1", "op2", true);
    filteringLogger.log("alice", "obj1", "op1", false);
  }

}

Increase the periods in this test to avoid intermittent failures


package org.opennms.netmgt.threshd;

import org.opennms.netmgt.config.DatabaseConnectionFactory;
import org.opennms.netmgt.mock.MockDatabase;
import org.opennms.netmgt.mock.MockUtil;

import junit.framework.TestCase;

public class ThreshdTest extends TestCase {

    public static void main(String[] args) {
        junit.textui.TestRunner.run(ThreshdTest.class);
    }

    protected void setUp() throws Exception {
        super.setUp();
        MockUtil.setupLogging();
        MockDatabase db = new MockDatabase();
        DatabaseConnectionFactory.setInstance(db);

    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void xtestthreshd() {
        Threshd threshd = new Threshd();

        threshd.init();
        threshd.start();
        threshd.stop();
    }
}

package org.opennms.netmgt.threshd;

import org.opennms.netmgt.config.DatabaseConnectionFactory;
import org.opennms.netmgt.mock.MockDatabase;
import org.opennms.netmgt.mock.MockUtil;

import junit.framework.TestCase;

public class ThreshdTest extends TestCase {

    public static void main(String[] args) {
        junit.textui.TestRunner.run(ThreshdTest.class);
    }

    protected void setUp() throws Exception {
        super.setUp();
        MockUtil.setupLogging();
        MockDatabase db = new MockDatabase();
        DatabaseConnectionFactory.setInstance(db);

    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void xtestthreshd() {
        Threshd threshd = new Threshd();

        threshd.init();
        threshd.start();
        threshd.stop();
    }

    public void testDoNothing() {

    }
}

Add empty tests to the build doesn't complain


/*
 * Copyright 2016 Datalogics Inc.
 */

package com.datalogics.pdf.security;

import java.security.Key;
import java.security.cert.Certificate;

/**
 * The basic interface for logging into a HSM machine.
 */
public interface HsmManager {

    /**
     * Performs a login operation to the HSM device.
     *
     * @param parms the parameters needed to login to the device
     * @return a boolean indicating if the login was successful
     * @throws IllegalArgumentException if an argument was invalid
     */
    boolean hsmLogin(final HsmLoginParameters parms);

    /**
     * Logs out of the default session with the HSM device.
     *
     * <p>
     * This method should be called only if you have called {@link hsmLogin} to establish a login session.
     */
    void hsmLogout();

    /**
     * Determines if logged in to the HSM Device.
     *
     * @return boolean
     */
    boolean isLoggedIn();

    /**
     * Get the Key object for the HSM device.
     *
     * @param password the password for recovering the key
     * @param keyLabel the given alias associated with the key
     * @return key
     */
    Key getKey(final String password, final String keyLabel);

    /**
     * Get an array of Certificates for the HSM device.
     *
     * @param certLabel the given alias associated with the certificate
     * @return Certificate[]
     */
    Certificate[] getCertificateChain(final String certLabel);

    /**
     * Get the provider name installed by this HSM.
     *
     * @return the provider name
     */
    String getProviderName();

}

/*
 * Copyright 2016 Datalogics Inc.
 */

package com.datalogics.pdf.security;

import java.security.Key;
import java.security.cert.Certificate;

/**
 * The basic interface for logging into a HSM machine.
 */
public interface HsmManager {

    /**
     * Performs a login operation to the HSM device.
     *
     * @param parms the parameters needed to login to the device
     * @return a boolean indicating if the login was successful
     * @throws IllegalArgumentException if an argument was invalid
     */
    boolean hsmLogin(final HsmLoginParameters parms);

    /**
     * Logs out of the default session with the HSM device.
     *
     * <p>
     * This method should be called only if you have called {@link HsmManager#hsmLogin(HsmLoginParameters)} to establish
     * a login session.
     */
    void hsmLogout();

    /**
     * Determines if logged in to the HSM Device.
     *
     * @return boolean
     */
    boolean isLoggedIn();

    /**
     * Get the Key object for the HSM device.
     *
     * @param password the password for recovering the key
     * @param keyLabel the given alias associated with the key
     * @return key
     */
    Key getKey(final String password, final String keyLabel);

    /**
     * Get an array of Certificates for the HSM device.
     *
     * @param certLabel the given alias associated with the certificate
     * @return Certificate[]
     */
    Certificate[] getCertificateChain(final String certLabel);

    /**
     * Get the provider name installed by this HSM.
     *
     * @return the provider name
     */
    String getProviderName();

}

Correct link to fix Javadoc warnings


package ch.heigvd.quaris.config;

import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Fabien Salathe on 26.01.17.
 */
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class CorsFilter extends OncePerRequestFilter {

    /**
     * Enable CORS
     *
     * @param request
     * @param response
     * @param filterChain
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        response.addHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
        response.addHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept, Access-Control-Request-Method, Authorization");
        response.addHeader("Access-Control-Expose-Headers", "Origin, Content-Type, Accept, Access-Control-Request-Method, Authorization");
        response.addHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE");

        filterChain.doFilter(request, response);
    }

}

package ch.heigvd.quaris.config;

import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Fabien Salathe on 26.01.17.
 */
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class CorsFilter extends OncePerRequestFilter {

    /**
     * Enable CORS
     *
     * @param request
     * @param response
     * @param filterChain
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        response.addHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
        response.addHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept, Access-Control-Request-Method, Authorization");
        response.addHeader("Access-Control-Expose-Headers", "Origin, Content-Type, Accept, Access-Control-Request-Method, Authorization");
        response.addHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE");

        if (!request.getMethod().equals("OPTIONS")) {
            filterChain.doFilter(request, response);
        }
    }

}

Fix preflights for all rules


package net.ltgt.gwt.maven;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

@Mojo(name = "enforce-encoding", defaultPhase = LifecyclePhase.INITIALIZE)
public class EnforceEncodingMojo extends AbstractMojo {

  @Parameter(defaultValue = "${project}", required = true, readonly = true)
  private MavenProject project;

  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    String encoding = project.getProperties().getProperty("project.build.sourceEncoding");
    if (encoding == null) {
      getLog().info("Setting project.build.sourceEncoding to UTF-8");
    } else if (!encoding.equalsIgnoreCase("UTF-8")) {
      getLog().warn("Encoding was set to " + encoding + "; forcing it to UTF-8");
    }
    project.getProperties().setProperty("project.build.sourceEncoding", "UTF-8");
  }
}

package net.ltgt.gwt.maven;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

@Mojo(name = "enforce-encoding", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true)
public class EnforceEncodingMojo extends AbstractMojo {

  @Parameter(defaultValue = "${project}", required = true, readonly = true)
  private MavenProject project;

  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    String encoding = project.getProperties().getProperty("project.build.sourceEncoding");
    if (encoding == null) {
      getLog().info("Setting project.build.sourceEncoding to UTF-8");
    } else if (!encoding.equalsIgnoreCase("UTF-8")) {
      getLog().warn("Encoding was set to " + encoding + "; forcing it to UTF-8");
    }
    project.getProperties().setProperty("project.build.sourceEncoding", "UTF-8");
  }
}

Mark enforce-encoding mojo as threadSafe


package sg.ncl.service.user;

import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.test.context.ContextConfiguration;

import javax.sql.DataSource;

/**
 * @author Christopher Zhong
 */
@ContextConfiguration(classes = App.class)
public class TestConfig {

    @Bean
    DataSource dataSource() {
        return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
    }

}

package sg.ncl.service.user;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;

import javax.sql.DataSource;

/**
 * @author Christopher Zhong
 */
@Configuration
public class TestConfig {

    @Bean
    DataSource dataSource() {
        return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
    }

}

Resolve incorrect annotation use (DEV-100)


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.tls;

import java.security.GeneralSecurityException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;

/**
 * @author bjorncs
 */
public class KeyUtils {
    private KeyUtils() {}

    public static KeyPair generateKeypair(KeyAlgorithm algorithm, int keySize) {
        try {
            KeyPairGenerator keyGen = KeyPairGenerator.getInstance(algorithm.getAlgorithmName());
            keyGen.initialize(keySize);
            return keyGen.genKeyPair();
        } catch (GeneralSecurityException e) {
            throw new RuntimeException(e);
        }
    }
}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.tls;

import java.security.GeneralSecurityException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;

/**
 * @author bjorncs
 */
public class KeyUtils {
    private KeyUtils() {}

    public static KeyPair generateKeypair(KeyAlgorithm algorithm, int keySize) {
        try {
            KeyPairGenerator keyGen = KeyPairGenerator.getInstance(algorithm.getAlgorithmName());
            if (keySize != -1) {
                keyGen.initialize(keySize);
            }
            return keyGen.genKeyPair();
        } catch (GeneralSecurityException e) {
            throw new RuntimeException(e);
        }
    }

    public static KeyPair generateKeypair(KeyAlgorithm algorithm) {
        return generateKeypair(algorithm, -1);
    }
}

Add method for creating keypair with default size


package nu.studer.gradle.jooq;

/**
 * jOOQ comes in different editions, which are published
 * under different group ids. The artifact names and versions
 * are the same for all editions.
 */
public enum JooqEdition {

    OSS("org.jooq"),
    PRO("org.jooq.pro"),
    PRO_JAVA_6("org.jooq.pro-java-6"),
    TRIAL("org.jooq.trial");

    private final String groupId;

    JooqEdition(String groupId) {
        this.groupId = groupId;
    }

    public String getGroupId() {
        return groupId;
    }

}

package nu.studer.gradle.jooq;

/**
 * jOOQ comes in different editions, which are published
 * under different group ids. The artifact names and versions
 * are the same for all editions.
 */
public enum JooqEdition {

    OSS("org.jooq"),
    PRO("org.jooq.pro"),
    PRO_JAVA_8("org.jooq.pro-java-8"),
    PRO_JAVA_6("org.jooq.pro-java-6"),
    TRIAL("org.jooq.trial"),
    TRIAL_JAVA_8("org.jooq.trial-java-8"),
    TRIAL_JAVA_6("org.jooq.trial-java-6");

    private final String groupId;

    JooqEdition(String groupId) {
        this.groupId = groupId;
    }

    public String getGroupId() {
        return groupId;
    }

}

Add support for more recent jOOQ distributions


package uk.ac.ebi.spot.goci.curation.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

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

/**
 * Created by emma on 14/10/2015.
 *
 * @author emma
 *         <p>
 *         Unit test for HomeController based on http://spring.io/guides/gs/spring-boot/
 */
@RunWith(MockitoJUnitRunner.class)
public class HomeControllerTest {

    private HomeController homeController;

    private MockMvc mockMvc;

    @Before
    public void setUp() throws Exception {
        homeController = new HomeController();
        mockMvc = MockMvcBuilders.standaloneSetup(homeController).build();
    }

    @Test
    public void getHome() throws Exception {
        mockMvc.perform(get("/").accept(MediaType.TEXT_HTML_VALUE))
                .andExpect(status().is3xxRedirection())
                .andExpect(redirectedUrl("/login"));
    }
}

package uk.ac.ebi.spot.goci.curation.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

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

/**
 * Created by emma on 14/10/2015.
 *
 * @author emma
 *         <p>
 *         Unit test for HomeController based on http://spring.io/guides/gs/spring-boot/
 */
@RunWith(MockitoJUnitRunner.class)
public class HomeControllerTest {

    private MockMvc mockMvc;

    @Before
    public void setUp() throws Exception {
        HomeController homeController = new HomeController();
        mockMvc = MockMvcBuilders.standaloneSetup(homeController).build();
    }

    @Test
    public void getHome() throws Exception {
        mockMvc.perform(get("/").accept(MediaType.TEXT_HTML_VALUE))
                .andExpect(status().is3xxRedirection())
                .andExpect(redirectedUrl("/login"));
    }
}

Update how mockMvc is created


package com.tmitim.twittercli.commands;

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

import javax.inject.Inject;

import com.github.rvesse.airline.annotations.Arguments;
import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;
import com.github.rvesse.airline.annotations.help.BashCompletion;
import com.github.rvesse.airline.help.cli.bash.CompletionBehaviour;
import com.github.rvesse.airline.model.GlobalMetadata;

@Command(name = "help", description = "Get Help")
public class Help implements Runnable {

	@Inject
	private GlobalMetadata<Runnable> global;

	@Arguments(description = "Provides the name of the commands you want to provide help for")
	@BashCompletion(behaviour = CompletionBehaviour.CLI_COMMANDS)
	private List<String> commandNames = new ArrayList<String>();

	@Option(name = { "-v", "--version" }, description = "twittercli version")
	private boolean getVersion;

	@Override
	public void run() {
		try {
			if (getVersion) {
				String version = this.getClass().getPackage().getImplementationVersion();
				System.out.println(String.format("TwitterCLI4j: %s", version));
			} else {
				com.github.rvesse.airline.help.Help.help(global, commandNames);
			}

		} catch (IOException e) {
			System.err.println("Failed to output help: " + e.getMessage());
			e.printStackTrace(System.err);
		}
	}

}

package com.tmitim.twittercli.commands;

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

import javax.inject.Inject;

import com.github.rvesse.airline.annotations.Arguments;
import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.help.BashCompletion;
import com.github.rvesse.airline.help.cli.bash.CompletionBehaviour;
import com.github.rvesse.airline.model.GlobalMetadata;

@Command(name = "help", description = "Get Help")
public class Help implements Runnable {

	@Inject
	private GlobalMetadata<Runnable> global;

	@Arguments(description = "Provides the name of the commands you want to provide help for")
	@BashCompletion(behaviour = CompletionBehaviour.CLI_COMMANDS)
	private List<String> commandNames = new ArrayList<String>();

	@Override
	public void run() {
		try {
			com.github.rvesse.airline.help.Help.help(global, commandNames);
		} catch (IOException e) {
			System.err.println("Failed to output help: " + e.getMessage());
			e.printStackTrace(System.err);
		}
	}

}

Remove redundant version flag in help


package com.samsung.sec.dexter.executor.peerreview.cli;

import com.samsung.sec.dexter.core.util.DexterServerConfig;
import com.samsung.sec.dexter.core.util.IDexterClient;

public class HomeJsonCLIServerCheckState implements IHomeJsonCLIState {

	@Override
	public void doAction(PeerReviewHomeJsonCLI homeJsonCLI) {
		IDexterClient dexterClient = homeJsonCLI.createDexterClient();

		System.out.print("Connecting server...");

		if (dexterClient.isServerAlive("test")) {
			System.out.println("\rCompleted.");
			homeJsonCLI.setState(new HomeJsonCLIHomeState());
		} else {
			System.out.println("\rCan't connect server (" +
					dexterClient.getServerHost() + ":" + dexterClient.getServerPort() + ")");
			homeJsonCLI.setState(new HomeJsonCLIHostnameState());
		}
	}

}

package com.samsung.sec.dexter.executor.peerreview.cli;

import com.samsung.sec.dexter.core.util.DexterServerConfig;
import com.samsung.sec.dexter.core.util.IDexterClient;

public class HomeJsonCLIServerCheckState implements IHomeJsonCLIState {

	@Override
	public void doAction(PeerReviewHomeJsonCLI homeJsonCLI) {
		IDexterClient dexterClient = homeJsonCLI.createDexterClient();

		System.out.print("Connecting server...");

		if (dexterClient.isServerAlive("test")) {
			System.out.println("\rCompleted to connect server.");
			homeJsonCLI.setState(new HomeJsonCLIHomeState());
		} else {
			System.out.println("\rCan't connect server (" +
					dexterClient.getServerHost() + ":" + dexterClient.getServerPort() + ")");
			homeJsonCLI.setState(new HomeJsonCLIHostnameState());
		}
	}

}

Change the message on completion to connect server.


package io.paymenthighway.model.response;

import com.fasterxml.jackson.annotation.JsonProperty;

public class MobilePayStatusResponse extends Response {
  @JsonProperty("status") private String status;
  @JsonProperty("transaction-id") private String transactionId;
  @JsonProperty("valid-until") private String validUntil;

  public String getStatus() {
    return status;
  }

  public String getTransactionId() {
    return transactionId;
  }

  public String getValidUntil() {
    return validUntil;
  }
}

package io.paymenthighway.model.response;

import com.fasterxml.jackson.annotation.JsonProperty;

public class MobilePayStatusResponse extends Response {
  @JsonProperty("status") private String status;
  @JsonProperty("transaction_id") private String transactionId;
  @JsonProperty("valid_until") private String validUntil;

  public String getStatus() {
    return status;
  }

  public String getTransactionId() {
    return transactionId;
  }

  public String getValidUntil() {
    return validUntil;
  }
}

Use snake_case for json keys.


package io.dropwizard.request.logging.async;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.core.AsyncAppenderBase;
import io.dropwizard.logging.async.AsyncAppenderFactory;

/**
 * An implementation of {@link AsyncAppenderFactory} for {@link IAccessEvent}.
 */
public class AsyncAccessEventAppenderFactory implements AsyncAppenderFactory<IAccessEvent> {

    /**
     * Creates an {@link AsyncAppenderFactory} of type {@link IAccessEvent} that prepares events
     * for deferred processing
     * @return the {@link AsyncAppenderFactory}
     */
    @Override
    public AsyncAppenderBase<IAccessEvent> build() {
        return new AsyncAppenderBase<IAccessEvent>() {
            @Override
            protected void preprocess(IAccessEvent event) {
                event.prepareForDeferredProcessing();
            }
        };
    }
}

package io.dropwizard.request.logging.async;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.core.AsyncAppenderBase;
import io.dropwizard.logging.async.AsyncAppenderFactory;

/**
 * An implementation of {@link AsyncAppenderFactory} for {@link IAccessEvent}.
 */
public class AsyncAccessEventAppenderFactory implements AsyncAppenderFactory<IAccessEvent> {

    /**
     * Creates an {@link AsyncAppenderBase} of type {@link IAccessEvent}.
     * @return the {@link AsyncAppenderBase}
     */
    @Override
    public AsyncAppenderBase<IAccessEvent> build() {
        return new AsyncAppenderBase<IAccessEvent>();
    }
}

Fix request attribute-related race condition in Logback request logging