package org.szegedi.spring.web.jsflow;

import javax.servlet.http.HttpServletRequest;

/**
 * Interface for objects that select a script for a particular initial HTTP
 * request.
 * @author Attila Szegedi
 * @version $Id: $
 */
public interface ScriptSelectionStrategy
{
    /**
     * Returns the pathname of the script that should run for a particular
     * initial HTTP request.
     * @param request the HTTP request
     * @return the path of the script. null can be returned to indicate that
     * this strategy is unable to select a script (i.e. because some data is
     * missing in the request). The controller will respond to this by sending
     * back a HTTP 400 "Bad Request" status.
     */
    public String getScriptPath(HttpServletRequest request);
}

package org.szegedi.spring.web.jsflow;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.ModelAndViewDefiningException;

/**
 * Interface for objects that select a script for a particular initial HTTP
 * request.
 * @author Attila Szegedi
 * @version $Id: $
 */
public interface ScriptSelectionStrategy
{
    /**
     * Returns the pathname of the script that should run for a particular
     * initial HTTP request.
     * @param request the HTTP request
     * @return the path of the script. null can be returned to indicate that
     * this strategy is unable to select a script (i.e. because some data is
     * missing in the request). The controller will respond to this by sending
     * back a HTTP 400 "Bad Request" status. Alternatively, the strategy can
     * throw an instance of {@link ModelAndViewDefiningException}.
     */
    public String getScriptPath(HttpServletRequest request)
    throws ModelAndViewDefiningException;
}

Allow it to throw a ModelAndViewDefiningException


package Data;

import java.util.List;

import engine.gridobject.person.Player;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;

public class WorldDataManager {
	public WorldDataManager() {}

	public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
		WorldData worldData = wd;

        if (worldData == null)	 {
        	System.out.println("worldData is null");
        }
		PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();
		List<Weapon> wList = player.getWeaponList();
		System.out.println("weaponlist.size" + wList.size());
		String [] weaponListName = new String[wList.size()];
		int wCounter = 0;
		for (Weapon wep : wList) {
			String wepName = wep.toString();
			weaponListName[wCounter] = wepName;
			wCounter++;
		}

		worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListName);
		DataManager dm = new DataManager();
		dm.setWorldData(fileName, worldData);
		dm.saveWorldDataToFile(fileName);
	}

}

package Data;

import java.util.List;

import engine.gridobject.person.Player;
import engine.item.Item;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;

public class WorldDataManager {
	public WorldDataManager() {}

	public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
		WorldData worldData = wd;

        if (worldData == null) {
        	return;
        }
		PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();
		List<Weapon> wList = player.getWeaponList();
		String [] weaponListNames = new String[wList.size()];
		int wCounter = 0;
		for (Weapon wep : wList) {
			String wepName = wep.toString();
			weaponListNames[wCounter] = wepName;
			wCounter++;
		}
		List<Item> itemList = player.getItems();
		String [] itemListNames = new String[itemList.size()];
		int iCounter = 0;
		for (Item item : itemList) {
			String itemName = item.toString();
			itemListNames[iCounter] = itemName;
			iCounter++;
		}
		worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListNames);
		worldData.getMap(mapDataKey).getPlayData().setItems(itemListNames);
		DataManager dm = new DataManager();
		dm.setWorldData(fileName, worldData);
		dm.saveWorldDataToFile(fileName);
	}

}

Save items and weapons in PlayerData


package de.stephanlindauer.criticalmaps.vo.chat;

import com.squareup.okhttp.internal.Util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;

import de.stephanlindauer.criticalmaps.utils.AeSimpleSHA1;
import de.stephanlindauer.criticalmaps.interfaces.IChatMessage;

public class OutgoingChatMessage implements IChatMessage {

    private final Date timestamp;
    private final String urlEncodedMessage;
    private final String identifier;
    private final String message;

    public OutgoingChatMessage(String message) {
        this.message = message;
        this.urlEncodedMessage = urlEncodeMessage(message);
        this.timestamp = new Date();
        this.identifier = AeSimpleSHA1.SHA1(message + Math.random());
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public String getUrlEncodedMessage() {
        return urlEncodedMessage;
    }

    public String getMessage() {
        return message;
    }

    public String getIdentifier() {
        return identifier;
    }

    private String urlEncodeMessage(String messageToEncode) {
        try {
            return URLEncoder.encode(messageToEncode, Util.UTF_8.name());
        } catch (UnsupportedEncodingException e) {
        }
        return "";
    }
}

package de.stephanlindauer.criticalmaps.vo.chat;

import com.squareup.okhttp.internal.Util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;

import de.stephanlindauer.criticalmaps.utils.AeSimpleSHA1;
import de.stephanlindauer.criticalmaps.interfaces.IChatMessage;

public class OutgoingChatMessage implements IChatMessage {

    private final Date timestamp;
    private final String urlEncodedMessage;
    private final String identifier;
    private final String message;

    public OutgoingChatMessage(String message) {
        this.message = message;
        this.urlEncodedMessage = urlEncodeMessage(message);
        this.timestamp = new Date();
        this.identifier = AeSimpleSHA1.SHA1(message + Math.random());
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public String getUrlEncodedMessage() {
        return urlEncodedMessage;
    }

    public String getMessage() {
        return message;
    }

    public String getIdentifier() {
        return identifier;
    }

    private String urlEncodeMessage(String messageToEncode) {
        try {
            return URLEncoder.encode(messageToEncode, Util.UTF_8.name());
        } catch (UnsupportedEncodingException e) {
            return "";
        }
    }
}

Return empty at the right place


/*
 * Copyright 2017 Martin Kamp Jensen
 *
 * 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.github.mkjensen.tv.ondemand;

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

public class PlaybackActivity extends FragmentActivity {

  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    if (savedInstanceState == null) {
      getSupportFragmentManager().beginTransaction()
          .add(android.R.id.content, new PlaybackFragment())
          .commit();
    }
  }
}

/*
 * Copyright 2017 Martin Kamp Jensen
 *
 * 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.github.mkjensen.tv.ondemand;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.WindowManager;

public class PlaybackActivity extends FragmentActivity {

  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    if (savedInstanceState == null) {
      getSupportFragmentManager().beginTransaction()
          .add(android.R.id.content, new PlaybackFragment())
          .commit();
    }
  }
}

Disable screensaver when playing videos


/*
 * (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
 *
 * 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 io.github.bonigarcia;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;

import org.junit.jupiter.api.Test;

public class PublicRestServicesTest {

    @Test
    void testEchoService() {
        String title = "foo";
        String content = "bar";
        given().when()
                .get("http://echo.jsontest.com/title/" + title + "/content/"
                        + content)
                .then().assertThat().statusCode(200)
                .body("title", equalTo(title))
                .body("content", equalTo(content));
    }

    @Test
    void testCountryService() {
        given().when()
                .get("http://services.groupkt.com/country/get/iso2code/ES")
                .then().assertThat().statusCode(200)
                .body("RestResponse.result.name", equalTo("Spain"));
    }

}

/*
 * (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
 *
 * 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 io.github.bonigarcia;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;

import org.junit.jupiter.api.Test;

public class PublicRestServicesTest {

    @Test
    void testEchoService() {
        String key = "foo";
        String value = "bar";
        given().when().get("http://echo.jsontest.com/" + key + "/" + value)
                .then().assertThat().statusCode(200).body(key, equalTo(value));
    }

    @Test
    void testCountryService() {
        given().when()
                .get("http://services.groupkt.com/country/get/iso2code/ES")
                .then().assertThat().statusCode(200)
                .body("RestResponse.result.name", equalTo("Spain"));
    }

}

Simplify request in test in junit5-rest-assured project


package com.rpaisley.example.osgi.xml.impl;

import javax.xml.XMLConstants;
import javax.xml.validation.SchemaFactory;

public class XMLServiceImpl {
	public XMLServiceImpl() {
		System.out.println(this.getClass().getName() + " starting");
		try {
			SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
			System.out.println("Lookup of schema: " + XMLConstants.W3C_XML_SCHEMA_NS_URI
					+ " yielded factory: " + factory.getClass().getName());
		} catch (Throwable t) {
			System.out.println("Failed to lookup schema: " + t);

		}
	}
}

package com.rpaisley.example.osgi.xml.impl;

import javax.xml.XMLConstants;
import javax.xml.validation.SchemaFactory;

public class XMLServiceImpl {
	public XMLServiceImpl() {
		System.out.println(this.getClass().getName() + " starting");
		try {
			ClassLoader original = Thread.currentThread().getContextClassLoader();
			try {
				Thread.currentThread().setContextClassLoader(XMLServiceImpl.class.getClassLoader());
				SchemaFactory factory = SchemaFactory
						.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
				System.out.println("Lookup of schema: " + XMLConstants.W3C_XML_SCHEMA_NS_URI
						+ " yielded factory: " + factory.getClass().getName());
			} finally {
				Thread.currentThread().setContextClassLoader(original);
			}
		} catch (Throwable t) {
			System.out.println("Failed to lookup schema: " + t);

		}
	}
}

Use Thread Context Class Loader for schema lookup


package info.sitebricks.example.web;

import com.google.sitebricks.At;
import com.google.sitebricks.Visible;
import com.google.sitebricks.http.Get;

/**
 * The home page that our users will see at the top level URI "/".
 *

 * This page is created once per request and has "no scope" in Guice
 * terminology. See the Guice wiki
 * for details.
 *
 * @author dhanji@gmail.com (Dhanji R. Prasanna)
 */
@At("/")
public class HomePage {

  @Visible
  String message;

  @Get
  void showHome() {
    // This is where you would normally fetch stuff from a database, for example.
    message = "Hello from Sitebricks!";
  }

  public boolean getShouldShow() {
    // Always show our message.
    return true;
  }
}

package info.sitebricks.example.web;

import com.google.sitebricks.At;
import com.google.sitebricks.Visible;
import com.google.sitebricks.http.Get;

/**
 * The home page that our users will see at the top level URI "/".
 *

 * This page is created once per request and has "no scope" in Guice
 * terminology. See the Guice wiki
 * for details.
 *
 * @author dhanji@gmail.com (Dhanji R. Prasanna)
 */
@At("/")
public class HomePage {

  @Visible
  String message;

  @Get
  void showHome() {
    // This is where you would normally fetch stuff from a database, for example.
    message = "Hello from Sitebricks!";
  }

  /**
   * TODO This getter should be removed when @Visible annotation processing by mvel will be fixed.
   */
  public String getMessage() {
      return message;
  }

  public boolean getShouldShow() {
    // Always show our message.
    return true;
  }
}

Add temporary accessor to make the helloworld application work again with @Visible


package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.AbstractionObject;
import com.laytonsmith.abstraction.entities.MCEnderDragon;
import com.laytonsmith.abstraction.enums.MCEnderDragonPhase;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCEnderDragonPhase;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;

public class BukkitMCEnderDragon extends BukkitMCComplexLivingEntity implements MCEnderDragon {

	EnderDragon ed;

	public BukkitMCEnderDragon(Entity ent) {
		super(ent);
		ed = (EnderDragon) ent;
	}

	public BukkitMCEnderDragon(AbstractionObject ao) {
		this((EnderDragon) ao.getHandle());
	}

	@Override
	public EnderDragon getHandle() {
		return ed;
	}

	@Override
	public MCEnderDragonPhase getPhase() {
		return BukkitMCEnderDragonPhase.getConvertor().getAbstractedEnum(ed.getPhase());
	}

	@Override
	public void setPhase(MCEnderDragonPhase phase) {
		try {
			ed.setPhase(BukkitMCEnderDragonPhase.getConvertor().getConcreteEnum(phase));
		} catch(NoSuchMethodError ex) {
			// probably prior to 1.9.2
		}
	}
}

package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.AbstractionObject;
import com.laytonsmith.abstraction.entities.MCEnderDragon;
import com.laytonsmith.abstraction.enums.MCEnderDragonPhase;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCEnderDragonPhase;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;

public class BukkitMCEnderDragon extends BukkitMCComplexLivingEntity implements MCEnderDragon {

	EnderDragon ed;

	public BukkitMCEnderDragon(Entity ent) {
		super(ent);
		ed = (EnderDragon) ent;
	}

	public BukkitMCEnderDragon(AbstractionObject ao) {
		this((EnderDragon) ao.getHandle());
	}

	@Override
	public EnderDragon getHandle() {
		return ed;
	}

	@Override
	public MCEnderDragonPhase getPhase() {
		return MCEnderDragonPhase.valueOf(ed.getPhase().name());
	}

	@Override
	public void setPhase(MCEnderDragonPhase phase) {
		try {
			ed.setPhase(BukkitMCEnderDragonPhase.getConvertor().getConcreteEnum(phase));
		} catch(NoSuchMethodError ex) {
			// probably prior to 1.9.2
		}
	}
}

Fix support for versions prior to 1.9


package in.twizmwaz.cardinal.module.modules.filter.type.logic;

import in.twizmwaz.cardinal.module.ModuleCollection;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;

import static in.twizmwaz.cardinal.module.modules.filter.FilterState.ALLOW;

public class AnyFilter extends FilterModule {

    private final ModuleCollection<FilterModule> children;

    public AnyFilter(final String name, final ModuleCollection<FilterModule> children) {
        super(name);
        this.children = children;
    }

    @Override
    public FilterState evaluate(final Object object) {
        for (FilterModule child : children) {
            if (child.evaluate(object).equals(ALLOW)) return ALLOW;
        }
        return ALLOW;
    }

}

package in.twizmwaz.cardinal.module.modules.filter.type.logic;

import in.twizmwaz.cardinal.module.ModuleCollection;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;

import static in.twizmwaz.cardinal.module.modules.filter.FilterState.ALLOW;
import static in.twizmwaz.cardinal.module.modules.filter.FilterState.DENY;

public class AnyFilter extends FilterModule {

    private final ModuleCollection<FilterModule> children;

    public AnyFilter(final String name, final ModuleCollection<FilterModule> children) {
        super(name);
        this.children = children;
    }

    @Override
    public FilterState evaluate(final Object object) {
        for (FilterModule child : children) {
            if (child.evaluate(object).equals(ALLOW)) return ALLOW;
        }
        return DENY;
    }

}

Fix logic in any logic filter


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

package org.immutables.criteria.nested;

import org.immutables.criteria.Criteria;
import org.immutables.value.Value;

/**
 * Criteria generation for inner classes
 */
public class Inners {

  @Value.Immutable
  @Criteria
  @Criteria.Repository
  interface Inner1 { }

  @Value.Immutable
  @Criteria
  @Criteria.Repository
  interface Inner2 {
    String value();
  }
}

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

package org.immutables.criteria.nested;

import org.immutables.criteria.Criteria;
import org.immutables.value.Value;

import javax.annotation.Nullable;
import java.util.List;
import java.util.Optional;

/**
 * Criteria generation for inner classes
 */
public class Inners {

  @Value.Immutable
  @Criteria
  @Criteria.Repository
  interface Inner1 {
    // reference a different inner criteria
    Inner2 inner2();
    @Nullable Inner2 nullableInner2();
    Optional<Inner2> optionalInner2();
    List<Inner2> listInner2();
  }

  @Value.Immutable
  @Criteria
  @Criteria.Repository
  interface Inner2 {
    String value();
  }
}

Add test for inner criteria referencing another inner criteria


package me.proxer.library.enums;

import com.squareup.moshi.Json;

/**
 * Enum holding the available types.
 *
 * @author Ruben Gees
 */
public enum IndustryType {
    @Json(name = "publisher")PUBLISHER,
    @Json(name = "studio")STUDIO,
    @Json(name = "producer")PRODUCER,
    @Json(name = "record_label")RECORD_LABEL,
    @Json(name = "talent_agent")TALENT_AGENT,
    @Json(name = "streaming")STREAMING,
    @Json(name = "developer")DEVELOPER
}

package me.proxer.library.enums;

import com.squareup.moshi.Json;

/**
 * Enum holding the available types.
 *
 * @author Ruben Gees
 */
public enum IndustryType {
    @Json(name = "publisher")PUBLISHER,
    @Json(name = "studio")STUDIO,
    @Json(name = "producer")PRODUCER,
    @Json(name = "record_label")RECORD_LABEL,
    @Json(name = "talent_agent")TALENT_AGENT,
    @Json(name = "streaming")STREAMING,
    @Json(name = "developer") DEVELOPER,
    @Json(name = "tv") TV
}

Add new "tv" industry type


package forager.events;

import java.io.IOException;

import galileo.event.Event;
import galileo.serialization.SerializationInputStream;
import galileo.serialization.SerializationOutputStream;

public class TaskSpec implements Event {

    public int taskId;
    public String[] command;

    public TaskSpec(int taskId, String[] command) {
    private List<NetworkDestination> assignments = new ArrayList<>();
        this.taskId = taskId;
        this.command = command;
    }

    public void addAssignment(NetworkDestination host) {
        assignments.add(host);
    }

    public void removeAssignment(NetworkDestination host) {
        assignments.remove(host);
    }

    /**
     * Determine whether the Task associated with this TaskSpec has been
     * assigned to any resources yet.
     *
     * @return true if the Task has been assigned, false otherwise.
     */
    public boolean isAssigned() {
        return assignments.isEmpty() == false;
    }

    public String toString() {
        String str = "[" + taskId + "] ";
        for (String s : command) {
            str += s + " ";
        }
        return str;
    }

    @Deserialize
    public TaskSpec(SerializationInputStream in)
    throws IOException {
        taskId = in.readInt();
        int numArgs = in.readInt();
        command = new String[numArgs];
        for (int i = 0; i < numArgs; ++i) {
            command[i] = in.readString();
        }
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeInt(taskId);
        out.writeInt(command.length);
        for (String s : command) {
            out.writeString(s);
        }
    }
}

package forager.events;

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

import galileo.event.Event;
import galileo.net.NetworkDestination;
import galileo.serialization.SerializationInputStream;
import galileo.serialization.SerializationOutputStream;

public class TaskSpec implements Event {

    public long taskId;
    public String command;

    private List<NetworkDestination> assignments = new ArrayList<>();

    public TaskSpec(long taskId, String command) {
        this.taskId = taskId;
        this.command = command;
    }

    public void addAssignment(NetworkDestination host) {
        assignments.add(host);
    }

    public void removeAssignment(NetworkDestination host) {
        assignments.remove(host);
    }

    /**
     * Determine whether the Task associated with this TaskSpec has been
     * assigned to any resources yet.
     *
     * @return true if the Task has been assigned, false otherwise.
     */
    public boolean isAssigned() {
        return assignments.isEmpty() == false;
    }

    public String toString() {
        return "[" + taskId + "] " + command;
    }

    @Deserialize
    public TaskSpec(SerializationInputStream in)
    throws IOException {
        taskId = in.readLong();
        command = in.readString();
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeLong(taskId);
        out.writeString(command);
    }
}

Switch to single-string commands and long ids


package com.opensymphony.workflow.designer.editor;

import javax.swing.*;

import com.opensymphony.workflow.designer.WorkflowCell;
import com.opensymphony.workflow.designer.WorkflowEdge;

/**
 * @author Hani Suleiman (hani@formicary.net)
 * Date: May 20, 2003
 * Time: 10:27:26 AM
 */
public abstract class DetailPanel extends JPanel
{
  private WorkflowCell cell;
  private WorkflowEdge edge;

  private boolean componentsInited = false;

  public WorkflowCell getCell()
  {
    return cell;
  }

  public WorkflowEdge getEdge()
  {
    return edge;
  }

  protected void viewClosed()
  {
  }

  public final void closeView()
  {
    viewClosed();
  }

  public final void setCell(WorkflowCell cell)
  {
    if(!componentsInited) initComponents();
    this.cell = cell;
    setName(cell.getClass().getName());
    updateView();
  }

  protected abstract void initComponents();

  protected abstract void updateView();

  public String getTitle()
  {
    return "Details";
  }

  public void setEdge(WorkflowEdge edge)
  {
    if(!componentsInited) initComponents();
    this.edge = edge;
    setName(edge.getClass().getName());
    updateView();
  }
}

package com.opensymphony.workflow.designer.editor;

import javax.swing.*;

import com.opensymphony.workflow.designer.WorkflowCell;
import com.opensymphony.workflow.designer.WorkflowEdge;

/**
 * @author Hani Suleiman (hani@formicary.net)
 * Date: May 20, 2003
 * Time: 10:27:26 AM
 */
public abstract class DetailPanel extends JPanel
{
  private WorkflowCell cell;
  private WorkflowEdge edge;

  private boolean componentsInited = false;

  public WorkflowCell getCell()
  {
    return cell;
  }

  public WorkflowEdge getEdge()
  {
    return edge;
  }

  protected void viewClosed()
  {
  }

  public final void closeView()
  {
    viewClosed();
  }

  public final void setCell(WorkflowCell cell)
  {
    if(!componentsInited)
    {
      initComponents();
      componentsInited = true;
    }
    this.cell = cell;
    setName(cell.getClass().getName());
    updateView();
  }

  protected abstract void initComponents();

  protected abstract void updateView();

  public String getTitle()
  {
    return "Details";
  }

  public void setEdge(WorkflowEdge edge)
  {
    if(!componentsInited)
    {
      initComponents();
      componentsInited = true;
    }
    componentsInited = true;
    this.edge = edge;
    setName(edge.getClass().getName());
    updateView();
  }
}

Set componentsInited once they get inited


package com.pturpin.quickcheck.junit4;

import com.pturpin.quickcheck.identifier.ClassIdentifier;
import com.pturpin.quickcheck.registry.Registries;
import com.pturpin.quickcheck.registry.Registry;

import static com.pturpin.quickcheck.generator.Numbers.doubleGen;

/**
 * Created by turpif on 28/04/17.
 */
final class DefaultRegistryFactory implements RandomRunner.RegistryFactory {

  public DefaultRegistryFactory() {
    // nothing
  }

  @Override
  public Registry create() {
    return Registries.builder()
        .put(new ClassIdentifier<>(double.class), doubleGen())
        .put(new ClassIdentifier<>(Double.class), doubleGen())
        .build();
  }
}

package com.pturpin.quickcheck.junit4;

import com.pturpin.quickcheck.base.Ranges;
import com.pturpin.quickcheck.base.Ranges.Range;
import com.pturpin.quickcheck.identifier.ClassIdentifier;
import com.pturpin.quickcheck.registry.Registries;
import com.pturpin.quickcheck.registry.Registry;

import java.math.BigDecimal;
import java.math.BigInteger;

import static com.pturpin.quickcheck.generator.Numbers.*;

/**
 * Created by turpif on 28/04/17.
 */
final class DefaultRegistryFactory implements RandomRunner.RegistryFactory {

  public DefaultRegistryFactory() {
    // nothing
  }

  @Override
  public Registry create() {
    Range<BigInteger> bigIntegerRange = Ranges.closed(
        BigInteger.valueOf(Long.MIN_VALUE).multiply(BigInteger.valueOf(1000)),
        BigInteger.valueOf(Long.MIN_VALUE).multiply(BigInteger.valueOf(1000)));

    Range<BigDecimal> bigDecimalRange = Ranges.closed(
        BigDecimal.valueOf(-Double.MAX_VALUE).multiply(BigDecimal.valueOf(1000)),
        BigDecimal.valueOf(Double.MIN_VALUE).multiply(BigDecimal.valueOf(1000)));

    return Registries.builder()
        .put(new ClassIdentifier<>(double.class), doubleGen())
        .put(new ClassIdentifier<>(Double.class), doubleGen())
        .put(new ClassIdentifier<>(int.class), integerGen())
        .put(new ClassIdentifier<>(Integer.class), integerGen())
        .put(new ClassIdentifier<>(long.class), longGen())
        .put(new ClassIdentifier<>(Long.class), longGen())
        .put(new ClassIdentifier<>(BigInteger.class), bigIntegerGen(bigIntegerRange))
        .put(new ClassIdentifier<>(BigDecimal.class), bigDecimalGen(bigDecimalRange))
        .build();
  }
}

Complete default registry with promitive generators


package com.stephenramthun.algorithms.sorting;

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

import org.junit.jupiter.api.Test;

class BubbleSortTest {

    @Test
    void testSorting() {
        int n = 1000;
        int r = 10;

        for (int i = 0; i < r; i++) {
            int[] array = Utility.randomArray(n);
            BubbleSort.sort(array);
            assertTrue(Utility.isSorted(array));
        }
    }

    @Test
    void testPermutation() {
        int n = 1000;
        int r = 10;

        for (int i = 0; i < r; i++) {
            int[] a = Utility.randomArray(n);
            int[] b = Utility.copy(a);

            BubbleSort.sort(a);
            assertTrue(Utility.arePermutations(a, b));
        }
    }
}

package com.stephenramthun.algorithms.sorting;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;

import org.junit.jupiter.api.Test;

class BubbleSortTest {

    @Test
    void testSorting() {
        int n = 1000;
        int r = 10;

        for (int i = 0; i < r; i++) {
            int[] array = Utility.randomArray(n);
            BubbleSort.sort(array);
            assertTrue(Utility.isSorted(array));
        }

        String[] strings = {"cbc", "abc", "bbc", "ccd", "ccb", "bbc", "aab"};
        assertFalse(Utility.isSorted(strings));
        BubbleSort.sort(strings);
        assertTrue(Utility.isSorted(strings));
    }

    @Test
    void testPermutation() {
        int n = 1000;
        int r = 10;

        for (int i = 0; i < r; i++) {
            int[] a = Utility.randomArray(n);
            int[] b = Utility.copy(a);

            BubbleSort.sort(a);
            assertTrue(Utility.arePermutations(a, b));
        }
    }
}

Add tests for arrays of Comparable objects.


package com.questionanswer.controller;

import com.questionanswer.config.Routes;
import com.questionanswer.model.User;
import com.questionanswer.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
@RequestMapping(value = Routes.API_BASE_ROUTE + "/authentication")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping(value = "/currentuser", method = { RequestMethod.GET })
    public Principal currentUser(Principal user) {
        return user;
    }

    @RequestMapping(value = "/register", method = { RequestMethod.POST })
    public HttpEntity<User> Register(@RequestBody User user) {
        User savedUser = this.userService.save(user);
        return new ResponseEntity<User>(savedUser, HttpStatus.CREATED);
    }
}

package com.questionanswer.controller;

import com.questionanswer.config.Routes;
import com.questionanswer.model.User;
import com.questionanswer.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
@RequestMapping(value = Routes.API_BASE_ROUTE + "/authentication")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping(value = "/currentuser", method = { RequestMethod.GET })
    public Principal currentUser(Principal user) {
        return user;
    }

    @RequestMapping(value = "/register", method = { RequestMethod.POST })
    public HttpEntity<?> Register(@RequestBody User user) {

        if (this.userService.loadUserByUsername(user.getEmail()) != null) {
            return new ResponseEntity<>("User with the same email already exists!", HttpStatus.BAD_REQUEST);
        }

        try {
            User savedUser = this.userService.save(user);
            return new ResponseEntity<User>(savedUser, HttpStatus.CREATED);
        } catch (DataIntegrityViolationException ex) {
            return prepareExceptionResponce(ex);
        }
    }

    private HttpEntity<?> prepareExceptionResponce(Exception ex) {
        String errorMessage;
        errorMessage = ex + " <== error";
        return new ResponseEntity<>(errorMessage, HttpStatus.BAD_REQUEST);
    }
}

Add some error handling during the register user action


package com.cloudera.data.hdfs;

import java.io.File;
import java.io.IOException;

import org.apache.avro.Schema;
import org.apache.avro.Schema.Type;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.google.common.io.Files;

public class TestHDFSDatasetWriter {

  private File testDirectory;
  private FileSystem fileSystem;

  @Before
  public void setUp() throws IOException {
    testDirectory = Files.createTempDir();

    Configuration conf = new Configuration();

    conf.set("fs.default.name", "file:///");
    fileSystem = FileSystem.get(conf);
  }

  @After
  public void tearDown() throws IOException {
    fileSystem.delete(new Path(testDirectory.getAbsolutePath()), true);
  }

  @Test
  public void testWrite() throws IOException {
    HDFSDatasetWriter<String> writer = new HDFSDatasetWriter<String>(
        fileSystem, new Path(testDirectory.getAbsolutePath(), "write-1.avro"),
        Schema.create(Type.STRING));

    writer.open();

    for (int i = 0; i < 10; i++) {
      writer.write("entry " + i);
    }

    writer.close();
  }

}

package com.cloudera.data.hdfs;

import java.io.File;
import java.io.IOException;

import org.apache.avro.Schema;
import org.apache.avro.Schema.Type;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.google.common.io.Files;

public class TestHDFSDatasetWriter {

  private File testDirectory;
  private FileSystem fileSystem;

  @Before
  public void setUp() throws IOException {
    testDirectory = Files.createTempDir();

    Configuration conf = new Configuration();

    conf.set("fs.default.name", "file:///");
    fileSystem = FileSystem.get(conf);
  }

  @After
  public void tearDown() throws IOException {
    fileSystem.delete(new Path(testDirectory.getAbsolutePath()), true);
  }

  @Test
  public void testWrite() throws IOException {
    HDFSDatasetWriter<String> writer = new HDFSDatasetWriter<String>(
        fileSystem, new Path(testDirectory.getAbsolutePath(), "write-1.avro"),
        Schema.create(Type.STRING));

    writer.open();

    for (int i = 0; i < 100; i++) {
      writer.write("entry " + i);

      if (i % 10 == 0) {
        writer.flush();
      }
    }

    writer.close();
  }

}

Write 100 records and flush every 10 during HDFSDatasetWriter write test.


package hex.schemas;

import hex.tree.SharedTreeModel;
import water.api.API;
import water.api.ModelOutputSchema;
import water.api.ModelSchema;
import water.api.TwoDimTableBase;

public class SharedTreeModelV3<M extends SharedTreeModel<M, P, O>,
                                        S extends SharedTreeModelV3<M, S, P, PS, O, OS>,
                                        P extends SharedTreeModel.SharedTreeParameters,
                                        PS extends SharedTreeV3.SharedTreeParametersV3<P, PS>,
                                        O extends SharedTreeModel.SharedTreeOutput,
                                        OS extends SharedTreeModelV3.SharedTreeModelOutputV3<O,OS>>
        extends ModelSchema<M, S, P, PS, O, OS> {

  public static class SharedTreeModelOutputV3<O extends SharedTreeModel.SharedTreeOutput, SO extends SharedTreeModelOutputV3<O,SO>> extends ModelOutputSchema<O, SO> {
    @API(help="Variable Importances", direction=API.Direction.OUTPUT)
    TwoDimTableBase variable_importances;

    @API(help="The Intercept term, the initial predicted value to which trees make adjustments", direction=API.Direction.OUTPUT)
    double initF;
  }
}

package hex.schemas;

import hex.tree.SharedTreeModel;
import water.api.API;
import water.api.ModelOutputSchema;
import water.api.ModelSchema;
import water.api.TwoDimTableBase;

public class SharedTreeModelV3<M extends SharedTreeModel<M, P, O>,
                                        S extends SharedTreeModelV3<M, S, P, PS, O, OS>,
                                        P extends SharedTreeModel.SharedTreeParameters,
                                        PS extends SharedTreeV3.SharedTreeParametersV3<P, PS>,
                                        O extends SharedTreeModel.SharedTreeOutput,
                                        OS extends SharedTreeModelV3.SharedTreeModelOutputV3<O,OS>>
        extends ModelSchema<M, S, P, PS, O, OS> {

  public static class SharedTreeModelOutputV3<O extends SharedTreeModel.SharedTreeOutput, SO extends SharedTreeModelOutputV3<O,SO>> extends ModelOutputSchema<O, SO> {
    @API(help="Variable Importances", direction=API.Direction.OUTPUT)
    TwoDimTableBase variable_importances;

    @API(help="The Intercept term, the initial model function value to which trees make adjustments", direction=API.Direction.OUTPUT)
    double initF;
  }
}

Update description of intercept term.


package net.rodrigoamaral.logging;

import java.util.logging.*;

public class SPSPLogger {

    public static final Logger logger = Logger.getLogger(SPSPLogger.class.getName());

    static {
        config();
    }

    private static void config() {
        LogManager manager = LogManager.getLogManager();

        manager.reset();
        logger.setLevel(Level.ALL);

        ConsoleHandler ch = new ConsoleHandler();
        ch.setLevel(Level.INFO);
        ch.setFormatter(new SPSPLogFormatter());
        logger.addHandler(ch);

        // TODO: Implement a log file handler
    }

    public static void info(String msg) {
        logger.info(msg);
    }

    public static void warning(String msg) {
        logger.warning(msg);
    }

    public static void severe(String msg) {
        logger.severe(msg);
    }
}

package net.rodrigoamaral.logging;

import java.util.logging.*;

public class SPSPLogger {

    public static final Logger logger = Logger.getLogger(SPSPLogger.class.getName());

    static {
        config();
    }

    private static void config() {
        LogManager manager = LogManager.getLogManager();

        manager.reset();
        logger.setLevel(Level.ALL);

        ConsoleHandler ch = new ConsoleHandler();
        ch.setLevel(Level.FINE);
        ch.setFormatter(new SPSPLogFormatter());
        logger.addHandler(ch);

        // TODO: Implement a log file handler
    }

    public static void trace(String msg) {
        logger.finer(msg);
    }

    public static void debug(String msg) {
        logger.fine(msg);
    }

    public static void info(String msg) {
        logger.info(msg);
    }

    public static void warning(String msg) {
        logger.warning(msg);
    }

    public static void error(String msg) {
        logger.severe(msg);
    }
}

Set logging to a more detailed level


package org.mcphoton.impl.network;

import java.util.Collection;
import org.mcphoton.network.Packet;

public final class PacketSending {

	public final Packet packet;
	public final Collection<PhotonClient> clients;

	public PacketSending(Packet packet, Collection<PhotonClient> clients) {
		this.packet = packet;
		this.clients = clients;
	}

}

package org.mcphoton.impl.network;

import java.util.Collection;
import java.util.Collections;
import org.mcphoton.network.Packet;

public final class PacketSending {

	public final Packet packet;
	public final Collection<PhotonClient> clients;

	public PacketSending(Packet packet, PhotonClient client) {
		this.packet = packet;
		this.clients = Collections.singletonList(client);
	}

	public PacketSending(Packet packet, Collection<PhotonClient> clients) {
		this.packet = packet;
		this.clients = clients;
	}

}

Add a constructor for a single PhotonClient


/*
 * Created on Dec 26, 2006
 */
package org.griphyn.vdl.karajan.lib.swiftscript;

import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.workflow.ExecutionException;
import org.griphyn.vdl.karajan.lib.VDLFunction;
import org.griphyn.vdl.mapping.DSHandle;
import org.griphyn.vdl.mapping.RootDataNode;
import org.griphyn.vdl.type.Types;

public class FileNames extends VDLFunction {
	static {
		setArguments(FileNames.class, new Arg[] { PA_VAR });
	}

	public Object function(VariableStack stack) throws ExecutionException {
		String[] f = filename(stack);
		DSHandle[] h = new DSHandle[f.length];
		for (int i = 0; i < f.length; i++) {
			h[i] = RootDataNode.newNode(Types.STRING, relativize(f[i]));
		}
		return h;
	}
}

/*
 * Created on Dec 26, 2006
 */
package org.griphyn.vdl.karajan.lib.swiftscript;

import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.workflow.ExecutionException;
import org.griphyn.vdl.karajan.lib.VDLFunction;
import org.griphyn.vdl.mapping.DSHandle;
import org.griphyn.vdl.mapping.InvalidPathException;
import org.griphyn.vdl.mapping.Path;
import org.griphyn.vdl.mapping.RootDataNode;
import org.griphyn.vdl.mapping.RootArrayDataNode;
import org.griphyn.vdl.type.Types;

public class FileNames extends VDLFunction {
	static {
		setArguments(FileNames.class, new Arg[] { PA_VAR });
	}

	public Object function(VariableStack stack) throws ExecutionException {
		String[] f = filename(stack);
		DSHandle returnArray = new RootArrayDataNode(Types.STRING.arrayType());
		try {
			for (int i = 0; i < f.length; i++) {
				Path p = parsePath("["+i+"]", stack);
				DSHandle h = returnArray.getField(p);
				h.setValue(relativize(f[i]));
			}
		} catch (InvalidPathException e) {
			throw new ExecutionException("Unexpected invalid path exception",e);
		}
		return returnArray;
	}
}

Make @filenames return a DSHandle representing an array of strings, rather than a (Java level) array containing DSHandles representing strings.


package info.u_team.u_team_test.init;

import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.biome.BasicBiome;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.*;

public class TestBiomes {

	public static final DeferredRegister<Biome> BLOCKS = DeferredRegister.create(ForgeRegistries.BIOMES, TestMod.MODID);

	public static final RegistryObject<BasicBiome> BASIC = BLOCKS.register("basic", () -> {
		System.out.println("CREATE BIOME");
		return new BasicBiome("basic");
	});

	public static void register(IEventBus bus) {
		BLOCKS.register(bus);
	}
}

package info.u_team.u_team_test.init;

import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.biome.BasicBiome;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.*;

public class TestBiomes {

	public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, TestMod.MODID);

	public static final RegistryObject<BasicBiome> BASIC = BIOMES.register("basic", () -> {
		System.out.println("CREATE BIOME");
		return new BasicBiome("basic");
	});

	public static void register(IEventBus bus) {
		BIOMES.register(bus);
	}
}

Fix wrong field name for the register


package com.loyaltyplant.test.domain.operation;

import com.loyaltyplant.test.domain.BalanceOperation;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

/**
 * @author Maksim Zakharov
 * @since 1.0
 */
@Entity
@Table(name = "loyalty_order")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "operation_type")
public abstract class AbstractOperation implements BalanceOperation {

    @Id
    @GeneratedValue
    private Integer id;

    public Integer getId() {
        return id;
    }

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

package com.loyaltyplant.test.domain.operation;

import com.loyaltyplant.test.domain.BalanceOperation;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

/**
 * @author Maksim Zakharov
 * @since 1.0
 */
@Entity
@Table(name = "loyalty_operation")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "operation_type")
public abstract class AbstractOperation implements BalanceOperation {

    @Id
    @GeneratedValue
    private Integer id;

    public Integer getId() {
        return id;
    }

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

Fix Operations table (copy/pasted, blame me..)


package io.cattle.platform.iaas.api.auth;

import io.cattle.platform.archaius.util.ArchaiusUtil;
import io.cattle.platform.core.model.Setting;
import io.cattle.platform.deferred.util.DeferredUtils;
import io.cattle.platform.object.ObjectManager;

import javax.inject.Inject;

public class SettingsUtils {

    @Inject
    ObjectManager objectManager;

    public void changeSetting(String name, Object value) {
        if (name == null) {
            return;
        }
        Setting setting = objectManager.findOne(Setting.class, "name", name);
        if (setting == null) {
            objectManager.create(Setting.class, "name", name, "value", value);
        } else {
            objectManager.setFields(setting, "value", value);
        }

        DeferredUtils.defer(new Runnable() {

            @Override
            public void run() {
                ArchaiusUtil.refresh();
            }
        });
    }
}

package io.cattle.platform.iaas.api.auth;

import io.cattle.platform.archaius.util.ArchaiusUtil;
import io.cattle.platform.core.model.Setting;
import io.cattle.platform.deferred.util.DeferredUtils;
import io.cattle.platform.object.ObjectManager;

import javax.inject.Inject;

public class SettingsUtils {

    @Inject
    ObjectManager objectManager;

    public void changeSetting(String name, Object value) {
        if (name == null) {
            return;
        }

        if (value == null) {
            value = "";
        }

        Setting setting = objectManager.findOne(Setting.class, "name", name);

        if (setting == null) {
            objectManager.create(Setting.class, "name", name, "value", value);
        } else {
            objectManager.setFields(setting, "value", value);
        }

        DeferredUtils.defer(new Runnable() {

            @Override
            public void run() {
                ArchaiusUtil.refresh();
            }
        });
    }
}

Check value is not null before creating setting.


package org.eclipse.scanning.api.event.core;

import java.util.Map;

import org.eclipse.scanning.api.event.EventException;

public interface ITopicConnection extends IURIConnection {

	/**
	 * The string topic to publish events on for this manager.
	 * The events will be beans which serialize to JSON.
	 *
	 * @return
	 */
	public String getTopicName();

	/**
	 * Sets the scan topic, causing the connection to be made to that topic and throwing an
	 * exception if the connection cannot be made.
	 * @param topic
	 * @throws EventException
	 */
	public void setTopicName(String topic) throws EventException;

	/**
	 * Call to disconnect all publishers and subscribers when the connection goes down.
	 * @throws EventException
	 */
	public void disconnect() throws EventException;

}

package org.eclipse.scanning.api.event.core;

import org.eclipse.scanning.api.event.EventException;

public interface ITopicConnection extends IURIConnection {

	/**
	 * The string topic to publish events on for this manager.
	 * The events will be beans which serialize to JSON.
	 *
	 * @return
	 */
	public String getTopicName();

	/**
	 * Sets the scan topic, causing the connection to be made to that topic and throwing an
	 * exception if the connection cannot be made.
	 * @param topic
	 * @throws EventException
	 */
	public void setTopicName(String topic) throws EventException;

	/**
	 * Call to disconnect this publisher or subscriber. Typically used in a try-finally block.
	 * @throws EventException
	 */
	public void disconnect() throws EventException;

}

Correct Java Doc on disconnect() method


package com.elmakers.mine.bukkit.protection;

import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

public class MultiverseManager implements PVPManager {

    private boolean enabled = false;
    private MultiverseCore mv = null;

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public boolean isEnabled() {
        return enabled && mv != null;
    }

    public void initialize(Plugin plugin) {
        if (enabled) {
            try {
                Plugin mvPlugin = plugin.getServer().getPluginManager().getPlugin("Multiverse-Core");
                if (mvPlugin instanceof MultiverseCore) {
                    mv = (MultiverseCore)mvPlugin;
                }
            } catch (Throwable ex) {
            }

            if (mv != null) {
                plugin.getLogger().info("Multiverse-Core found, will respect PVP settings");
            }
        } else {
            mv = null;
        }
    }

    @Override
    public boolean isPVPAllowed(Player player, Location location) {
        if (!enabled || mv == null || location == null) return true;
        World world = location.getWorld();
        if (world == null) return true;
        return mv.getMVWorldManager().getMVWorld(world).isPVPEnabled();
    }
}

package com.elmakers.mine.bukkit.protection;

import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

public class MultiverseManager implements PVPManager {

    private boolean enabled = false;
    private MultiverseCore mv = null;

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public boolean isEnabled() {
        return enabled && mv != null;
    }

    public void initialize(Plugin plugin) {
        if (enabled) {
            try {
                Plugin mvPlugin = plugin.getServer().getPluginManager().getPlugin("Multiverse-Core");
                if (mvPlugin instanceof MultiverseCore) {
                    mv = (MultiverseCore)mvPlugin;
                }
            } catch (Throwable ex) {
            }

            if (mv != null) {
                plugin.getLogger().info("Multiverse-Core found, will respect PVP settings");
            }
        } else {
            mv = null;
        }
    }

    @Override
    public boolean isPVPAllowed(Player player, Location location) {
        if (!enabled || mv == null || location == null) return true;
        World world = location.getWorld();
        if (world == null) return true;
        MVWorldManager manager = mv.getMVWorldManager();
        if (manager == null) return true;
        MultiverseWorld mvWorld = manager.getMVWorld(world);
        if (mvWorld == null) return true;
;       return mvWorld.isPVPEnabled();
    }
}

Add some protection against a failed load of Multiverse


package de.bmoth.parser.ast.nodes.ltl;

public class BuechiAutomaton {

    public String new_name() {
        return "place holder";
    }

    public BuechiAutomatonNode nodeIsInNodeSet(BuechiAutomatonNode node, BuechiAutomatonNode[] nodesSet) {
        BuechiAutomatonNode foundNode = null;
        for (BuechiAutomatonNode nodeInSet: nodesSet) {
            if ((nodeInSet.processed == node.processed) && (nodeInSet.next == node.next)) {
                foundNode = nodeInSet;
                break;
            }
        }
        return foundNode;
    }

    public BuechiAutomatonNode[] expand(BuechiAutomatonNode node, BuechiAutomatonNode[] nodesSet) {
        if (node.nonprocessed.length == 0) {
            if (nodeIsInNodeSet(node, nodesSet) != null) {
                return nodesSet;
            }
        }
        return nodesSet;
    }

    public BuechiAutomatonNode[] create_graph(LTLFormula formula) {
        String[] initIncoming = {"init"};
        BuechiAutomatonNode[] nodes_set={};
        return expand(new BuechiAutomatonNode(new_name(), initIncoming, new LTLFormula[]{formula},
            new LTLFormula[]{}, new LTLFormula[]{}), nodes_set);
    }
}

package de.bmoth.parser.ast.nodes.ltl;

import org.apache.commons.lang3.ArrayUtils;

public class BuechiAutomaton {

    public String new_name() {
        return "place holder";
    }

    public BuechiAutomatonNode nodeIsInNodeSet(BuechiAutomatonNode node, BuechiAutomatonNode[] nodesSet) {
        BuechiAutomatonNode foundNode = null;
        for (BuechiAutomatonNode nodeInSet: nodesSet) {
            if ((nodeInSet.processed == node.processed) && (nodeInSet.next == node.next)) {
                foundNode = nodeInSet;
                break;
            }
        }
        return foundNode;
    }

    public BuechiAutomatonNode[] expand(BuechiAutomatonNode node, BuechiAutomatonNode[] nodesSet) {
        if (node.nonprocessed.length == 0) {
            BuechiAutomatonNode nodeInSet = nodeIsInNodeSet(node, nodesSet);
            if (nodeInSet != null) {
                node.incoming = ArrayUtils.addAll(node.incoming, nodeInSet.incoming);
                return nodesSet;
            } else {
                return expand(new BuechiAutomatonNode(new_name(), new String[]{node.name}, node.next,
                    new LTLFormula[]{}, new LTLFormula[]{}), nodesSet);
            }
        }
        return nodesSet;
    }

    public BuechiAutomatonNode[] create_graph(LTLFormula formula) {
        String[] initIncoming = {"init"};
        BuechiAutomatonNode[] nodes_set={};
        return expand(new BuechiAutomatonNode(new_name(), initIncoming, new LTLFormula[]{formula},
            new LTLFormula[]{}, new LTLFormula[]{}), nodes_set);
    }
}

Handle both cases of a finished node


/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */
package wherehows.models.view;

public class DatasetValidation {

  private String tier;

  private float score;

  private String description;

  private float weight;

  private String validator;

  public DatasetValidation(String tier, float score, String description, float weight, String validator) {
    this.tier = tier;
    this.score = score;
    this.description = description;
    this.weight = weight;
    this.validator = validator;
  }
}

/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */
package wherehows.models.view;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public class DatasetValidation {

  private String tier;

  private float score;

  private String description;

  private float weight;

  private String validator;
}

Use constructor for datasetvalidation class


package dao;

import java.math.BigInteger;
import java.util.List;
import java.util.Map;

import model.Info;
import model.Nodo;

public interface AmigoDataAccessObject {

  public int quantidadeAmigos();

  public void comparaTabelas();

  public List<Info> listaAmigosPorGenero(String sex);

  public List<Nodo> listaRelacoes();

  public int primeiroId(String nomeId, String nomeTabela);

  public Map<BigInteger, BigInteger> mapeiaRelacoes();

}

package dao;

import java.math.BigInteger;
import java.util.List;
import java.util.Map;

import model.Info;
import model.Vertice;

public interface AmigoDataAccessObject {

  public int quantidadeAmigos();

  public void comparaTabelas();

  public List<Info> listaAmigosPorGenero(String sex);

  public List<Vertice> listaRelacoes();

  public int primeiroId(String nomeId, String nomeTabela);

  public Map<BigInteger, BigInteger> mapeiaRelacoes();

}

Add public Map<BigInteger, BigInteger> mapeiaRelacoes()


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

import org.matrix.androidsdk.data.RoomState;

/**
 * Class representing the objects returned by /publicRooms call.
 */
public class PublicRoom extends RoomState implements java.io.Serializable {
    public int numJoinedMembers;

}

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

import org.matrix.androidsdk.data.RoomState;

/**
 * Class representing the objects returned by /publicRooms call.
 */
public class PublicRoom extends RoomState implements java.io.Serializable {

    // number of members which have joined the room (the members list is not provided)
    public int numJoinedMembers;

    // the server name
    public String serverName;

    // true when the room history is visible (room preview)
    public Boolean worldReadable;

    // a guest can join the room
    public Boolean guestCanJoin;
}

Add some missing fields (serverName, worldReadable, guestCanJoin);


package space.gatt.magicaproject.managers;

import org.bukkit.Bukkit;
import space.gatt.magicaproject.MagicaMain;
import space.gatt.magicaproject.objects.MagicaBlock;

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

public class BlockManager {

	private List<MagicaBlock> runningBlocks = new ArrayList<>();

	public BlockManager() {
		Bukkit.getScheduler().runTaskTimer(MagicaMain.getMagicaMain(), ()->{
			for (MagicaBlock mb : runningBlocks){
				mb.runParticles();
			}
		}, 10, 10);
	}

	public void registerBlock(MagicaBlock mb){
		if (!runningBlocks.contains(mb)){
			runningBlocks.add(mb);
		}
	}
}

package space.gatt.magicaproject.managers;

import org.bukkit.Bukkit;
import space.gatt.magicaproject.MagicaMain;
import space.gatt.magicaproject.objects.MagicCrafter;
import space.gatt.magicaproject.objects.MagicaBlock;

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

public class BlockManager {

	private List<MagicaBlock> runningBlocks = new ArrayList<>();

	public BlockManager() {
		Bukkit.getScheduler().runTaskTimer(MagicaMain.getMagicaMain(), ()->{
			for (MagicaBlock mb : runningBlocks){
				mb.runParticles();
			}
		}, 10, 10);
	}

	public void registerBlock(MagicaBlock mb){
		if (!runningBlocks.contains(mb)){
			runningBlocks.add(mb);
		}
	}

	public void shutdown(){
		for (MagicaBlock mb : runningBlocks){
			if (mb instanceof Saveable){
				((Saveable)mb).shutdownCall();
			}
		}
	}
}

Call for all blocks to save


package router;

import org.skyve.metadata.router.UxUi;

public class UxUis {
	public static final UxUi PHONE = UxUi.newPrimeFaces("phone", "editorial", "nova-light");
	public static final UxUi TABLET = UxUi.newPrimeFaces("tablet", "editorial", "nova-light");
	public static final UxUi DESKTOP = UxUi.newSmartClient("desktop", "Tahoe", "casablanca");
	public static final UxUi EXTERNAL = UxUi.newPrimeFaces("external", "editorial", "nova-light");
	public static final UxUi STARTUP = UxUi.newPrimeFaces("startup", "editorial", "nova-light");
}

package router;

import org.skyve.metadata.router.UxUi;

// Only change theme attributes here.
// Declare new UxUis in the DefaultUxUiSelector.
public class UxUis {
	public static final UxUi PHONE = UxUi.newPrimeFaces("phone", "editorial", "nova-light");
	public static final UxUi TABLET = UxUi.newPrimeFaces("tablet", "editorial", "nova-light");
	public static final UxUi DESKTOP = UxUi.newSmartClient("desktop", "Tahoe", "casablanca");
	public static final UxUi EXTERNAL = UxUi.newPrimeFaces("external", "editorial", "nova-light");
	public static final UxUi STARTUP = UxUi.newPrimeFaces("startup", "editorial", "nova-light");
}

Add comment to UxUi in case of assemble.


package beaform.utilities;

import java.util.Date;

public class SystemTime {

	private static final TimeSource defaultSrc = new TimeSource(){
		@Override
		public long getSystemTime() {
			return System.currentTimeMillis();
		}

	};

	private static volatile TimeSource source;

	public static void reset() {
		source = null;
	}

	public static long getAsLong() {
		return getCurrentTimeSource().getSystemTime();
	}

	public static Date getAsDate() {
		return new Date(getAsLong());
	}

	private static TimeSource getCurrentTimeSource() {
		if (source != null) {
			return source;
		}
		return defaultSrc;
	}

	public static void setTimeSource(TimeSource timeSource) {
		source = timeSource;
	}
}

package beaform.utilities;

import java.util.Date;

public class SystemTime {

	private static final TimeSource defaultSrc = new TimeSource(){
		@Override
		public long getSystemTime() {
			return System.currentTimeMillis();
		}

	};

	private static volatile TimeSource source;

	public static void reset() {
		source = null;
	}

	public static long getAsLong() {
		return getCurrentTimeSource().getSystemTime();
	}

	public static Date getAsDate() {
		return new Date(getAsLong());
	}

	private static TimeSource getCurrentTimeSource() {
		if (source != null) {
			return source;
		}
		return defaultSrc;
	}

	public static void setTimeSource(TimeSource timeSource) {
		source = timeSource;
	}

	private SystemTime() {
		// Utility classes don't need public constructors.
	}
}

Hide default public constructor of this utility class


package fr.insee.rmes.api.utils;

import javax.ws.rs.core.MediaType;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;

public class ResponseUtils {

	private static Logger logger = LogManager.getLogger(ResponseUtils.class);

	public static String produceResponse(Object obj, String header) {
		ObjectMapper mapper;
		String response = "";
		if (header == null || header.equals(MediaType.APPLICATION_JSON)) {
			mapper = new ObjectMapper();
		}
		else {
			mapper = new XmlMapper();
		}
		try {
			response = mapper.writeValueAsString(obj);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return response;
	}

}

package fr.insee.rmes.api.utils;

import javax.ws.rs.core.MediaType;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;

public class ResponseUtils {

	private static Logger logger = LogManager.getLogger(ResponseUtils.class);

	public static String produceResponse(Object obj, String header) {
		ObjectMapper mapper = new ObjectMapper();;
		String response = "";
		if (header != null && header.equals(MediaType.APPLICATION_XML)) {
			mapper = new XmlMapper();
		}
		else {
			mapper = new ObjectMapper();
		}
		try {
			response = mapper.writeValueAsString(obj);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return response;
	}

}

Set default accept header to json


package arez.doc.examples.at_memoize2;

import arez.ComputableValue;
import arez.annotations.Action;
import arez.annotations.ArezComponent;
import arez.annotations.ComputableValueRef;
import arez.annotations.DepType;
import arez.annotations.Memoize;
import arez.annotations.OnActivate;
import arez.annotations.OnDeactivate;
import akasha.Global;
import akasha.EventListener;

@ArezComponent
public abstract class NetworkStatus
{
  private final EventListener _listener = e -> updateOnlineStatus();

  // Specify depType so can explicitly trigger a recalculation
  // of method using reportPossiblyChanged()
  @Memoize( depType = DepType.AREZ_OR_EXTERNAL )
  public boolean isOnLine()
  {
    return Global.navigator().onLine();
  }

  @ComputableValueRef
  abstract ComputableValue<Boolean> getOnLineComputableValue();

  @OnActivate
  void onOnLineActivate()
  {
    DomGlobal.window.addEventListener( "online", _listener );
    DomGlobal.window.addEventListener( "offline", _listener );
  }

  @OnDeactivate
  void onOnLineDeactivate()
  {
    DomGlobal.window.removeEventListener( "online", _listener );
    DomGlobal.window.removeEventListener( "offline", _listener );
  }

  @Action
  void updateOnlineStatus()
  {
    // Explicitly trigger a recalculation of the OnLine value
    getOnLineComputableValue().reportPossiblyChanged();
  }
}

package arez.doc.examples.at_memoize2;

import akasha.EventListener;
import akasha.Global;
import arez.ComputableValue;
import arez.annotations.Action;
import arez.annotations.ArezComponent;
import arez.annotations.ComputableValueRef;
import arez.annotations.DepType;
import arez.annotations.Memoize;
import arez.annotations.OnActivate;
import arez.annotations.OnDeactivate;

@ArezComponent
public abstract class NetworkStatus
{
  private final EventListener _listener = e -> updateOnlineStatus();

  // Specify depType so can explicitly trigger a recalculation
  // of method using reportPossiblyChanged()
  @Memoize( depType = DepType.AREZ_OR_EXTERNAL )
  public boolean isOnLine()
  {
    return Global.navigator().onLine();
  }

  @ComputableValueRef
  abstract ComputableValue<Boolean> getOnLineComputableValue();

  @OnActivate
  void onOnLineActivate()
  {
    Global.addOnlineListener( _listener );
    Global.addOfflineListener( _listener );
  }

  @OnDeactivate
  void onOnLineDeactivate()
  {
    Global.removeOnlineListener( _listener );
    Global.removeOfflineListener( _listener );
  }

  @Action
  void updateOnlineStatus()
  {
    // Explicitly trigger a recalculation of the OnLine value
    getOnLineComputableValue().reportPossiblyChanged();
  }
}

Remove Elemental2 usage from doc example


package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan
@EnableAutoConfiguration
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

package hello;

import org.apache.catalina.session.FileStore;
import org.apache.catalina.session.PersistentManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.io.File;
import java.util.Arrays;

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {
    private Log log = LogFactory.getLog(Application.class);

    @Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return factory -> {
            TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
            containerFactory.setTomcatContextCustomizers(Arrays.asList(context -> {
                final PersistentManager persistentManager = new PersistentManager();
                final FileStore store = new FileStore();

                final String sessionDirectory = makeSessionDirectory();
                log.info("Writing sessions to " + sessionDirectory);
                store.setDirectory(sessionDirectory);

                persistentManager.setStore(store);
                context.setManager(persistentManager);
            }));
        };
    }

    private String makeSessionDirectory() {
        final String cwd = System.getProperty("user.dir");
        return cwd + File.separator + "sessions";
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

Use persistent file based sessions that survive application restarts.


package com.theupswell.appengine.counter.service;

import junit.framework.TestCase;

public class ShardedCounterServiceImplTest extends TestCase
{

	public void setUp() throws Exception
	{
		super.setUp();

	}

	public void testGetCounter() throws Exception
	{

	}

	public void testUpdateCounterDetails() throws Exception
	{

	}

	public void testIncrement() throws Exception
	{

	}

	public void testIncrement1() throws Exception
	{

	}

	public void testIncrement2() throws Exception
	{

	}

	public void testDecrement() throws Exception
	{

	}

	public void testDecrement1() throws Exception
	{

	}

	public void testDelete() throws Exception
	{

	}

	public void testOnTaskQueueCounterDeletion() throws Exception
	{

	}

	public void testGetOrCreateCounterData() throws Exception
	{

	}

	public void testIncrementMemcacheAtomic() throws Exception
	{

	}

	public void testAssembleCounterKeyforMemcache() throws Exception
	{

	}

	public void testIsMemcacheAvailable() throws Exception
	{

	}

	public void testGetLogger() throws Exception
	{

	}

	public void testAssertCounterAmountMutatable() throws Exception
	{

	}
}

package com.theupswell.appengine.counter.service;

import junit.framework.TestCase;

public class ShardedCounterServiceImplTest extends TestCase
{

	public void setUp() throws Exception
	{
		super.setUp();

	}

	public void testGetCounter() throws Exception
	{
		fail();
	}

	public void testUpdateCounterDetails() throws Exception
	{
		fail();

	}

	public void testOnTaskQueueCounterDeletion() throws Exception
	{
		fail();

	}

	public void testGetOrCreateCounterData() throws Exception
	{
		fail();

	}

	public void testIncrementMemcacheAtomic() throws Exception
	{
		fail();

	}

	public void testAssembleCounterKeyforMemcache() throws Exception
	{
		fail();

	}

	public void testIsMemcacheAvailable() throws Exception
	{
		fail();

	}

	public void testGetLogger() throws Exception
	{
		fail();

	}

	public void testAssertCounterAmountMutatable() throws Exception
	{
		fail();

	}
}

Add Tests for existing functionality of ShardedCounterServiceImpl


package org.opennms.netmgt.dao.support;

import java.io.IOException;

import org.opennms.netmgt.dao.ResourceDao;
import org.opennms.netmgt.dao.support.DefaultResourceDao;
import org.opennms.netmgt.dao.support.ResponseTimeResourceType;

import junit.framework.TestCase;

public class ResponseTimeResourceTypeTest extends TestCase {
    public void testGetResourcesUsingDao() throws IOException {
        ResourceDao resourceDao = new DefaultResourceDao();

        ResponseTimeResourceType r = new ResponseTimeResourceType(resourceDao, null);

        r.getResourcesForNode(1);
    }
}

package org.opennms.netmgt.dao.support;

import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import java.io.IOException;

import org.opennms.netmgt.dao.NodeDao;
import org.opennms.netmgt.dao.ResourceDao;
import org.opennms.netmgt.dao.support.DefaultResourceDao;
import org.opennms.netmgt.dao.support.ResponseTimeResourceType;
import org.opennms.netmgt.model.OnmsNode;

import junit.framework.TestCase;

public class ResponseTimeResourceTypeTest extends TestCase {
    public void testGetResourcesUsingDao() throws IOException {
        ResourceDao resourceDao = new DefaultResourceDao();
        NodeDao nodeDao = createMock(NodeDao.class);

        expect(nodeDao.get(1)).andReturn(new OnmsNode());

        ResponseTimeResourceType r = new ResponseTimeResourceType(resourceDao, nodeDao);

        replay(nodeDao);
        r.getResourcesForNode(1);
        verify(nodeDao);
    }
}

Fix failing test by mocking up NodeDao


package uk.ac.ebi.quickgo.webservice.definitions;

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

/**
 * @Author Tony Wardell
 * Date: 22/06/2015
 * Time: 09:01
 * Created with IntelliJ IDEA.
 */
public enum FilterParameter {

	Exact("exact"),
	Ancestor("ancestor"),
	Slim("slim"),
	I("i"),
	IPO("ipo"),
	IPOR("ipor");

	private String lc;
	private static Map<String,FilterParameter> map = new HashMap<>();

	static {
		for(FilterParameter aParm:FilterParameter.values()){
			map.put(aParm.getLowerCase(),aParm);
		}
	}

	FilterParameter(String lowerCase) {
		this.lc = lowerCase;
	}

	public String getLowerCase() {
		return lc;
	}

	public static FilterParameter lookup(String value){
		return map.get(value);
	}
}

package uk.ac.ebi.quickgo.webservice.definitions;

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

/**
 * @Author Tony Wardell
 * Date: 22/06/2015
 * Time: 09:01
 * Created with IntelliJ IDEA.
 */
public enum FilterParameter {

	Exact("exact"),
	Ancestor("ancestor"),
	Slim("slim"),
	I("i"),
	IPO("ipo"),
	IPOR("ipor");

	private String lc;
	private static Map<String,FilterParameter> map = new HashMap<>();

	static {
		for(FilterParameter aParm:FilterParameter.values()){
			map.put(aParm.toLowerCase(),aParm);
		}
	}

	FilterParameter(String lowerCase) {
		this.lc = lowerCase;
	}

	public String toLowerCase() {
		return lc;
	}

	public static FilterParameter lookup(String value){
		return map.get(value);
	}
}

Change the name of the method for getting lower case values.


package org.buddycloud.channelserver.channel.node.configuration.field;

public class Advertise extends Field {
  public static final String FIELD_NAME = "buddycloud#advertise_node";
  public static final String DEFAULT_VALUE = Advertise.models.TRUE.toString();

  public Advertise() {
    name = FIELD_NAME;
  }

  public enum models {
    TRUE("true"), FALSE("false");
    String model = null;

    private models(String model) {
      this.model = model;
    }

    public String toString() {
      return model;
    }
  }

  public boolean isValid() {
    return (getValue().equals(Advertise.models.TRUE.toString()) || getValue().equals(
        Advertise.models.FALSE.toString()));
  }
}

package org.buddycloud.channelserver.channel.node.configuration.field;

public class Advertise extends Field {
  public static final String FIELD_NAME = "buddycloud#advertise_node";
  public static final String DEFAULT_VALUE = Advertise.models.TRUE.toString();

  public Advertise() {
    name = FIELD_NAME;
  }

  public enum models {
    TRUE("true"), FALSE("false"), JOINABLE("joinable"), LOCALLY("locally");
    String model = null;

    private models(String model) {
      this.model = model;
    }

    public String toString() {
      return model;
    }
  }

  public boolean isValid() {
    return (getValue().equals(Advertise.models.TRUE.toString()) ||
            getValue().equals(Advertise.models.FALSE.toString()) ||
            getValue().equals(Advertise.models.JOINABLE.toString()) ||
            getValue().equals(Advertise.models.LOCALLY.toString())
    );
  }
}

Add new advertise values to validation


package in.twizmwaz.cardinal.module.modules.mob;

import in.twizmwaz.cardinal.match.Match;
import in.twizmwaz.cardinal.module.ModuleBuilder;
import in.twizmwaz.cardinal.module.ModuleCollection;
import in.twizmwaz.cardinal.module.modules.filter.FilterModuleBuilder;

public class MobModuleBuilder implements ModuleBuilder {
    @Override
    public ModuleCollection load(Match match) {
        ModuleCollection<MobModule> results = new ModuleCollection<MobModule>();
        if (match.getDocument().getRootElement().getChild("mob") != null) {
            results.add(new MobModule(FilterModuleBuilder.getFilter(match.getDocument().getRootElement().getChild("mob").getChild("filter"))));
        } else results.add(new MobModule(FilterModuleBuilder.getFilter("deny-all")));
        return results;
    }
}

package in.twizmwaz.cardinal.module.modules.mob;

import in.twizmwaz.cardinal.match.Match;
import in.twizmwaz.cardinal.module.ModuleBuilder;
import in.twizmwaz.cardinal.module.ModuleCollection;
import in.twizmwaz.cardinal.module.modules.filter.FilterModuleBuilder;

public class MobModuleBuilder implements ModuleBuilder {
    @Override
    public ModuleCollection load(Match match) {
        ModuleCollection<MobModule> results = new ModuleCollection<MobModule>();
        if (match.getDocument().getRootElement().getChild("mobs") != null) {
            results.add(new MobModule(FilterModuleBuilder.getFilter(match.getDocument().getRootElement().getChild("mobs").getChild("filter"))));
        } else results.add(new MobModule(FilterModuleBuilder.getFilter("deny-all")));
        return results;
    }
}

Change 'mob' to 'mobs' to comply with PGM docs


/*
 * 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.osgi;

import org.apache.jena.system.JenaSubsystemRegistry;
import org.apache.jena.system.JenaSubsystemRegistryBasic;
import org.apache.jena.system.JenaSystem;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

// Sample bundle activator explicitly calling the static Jena initialization.
public class Activator implements BundleActivator {

	public void start(BundleContext context) throws Exception {

		JenaSubsystemRegistry r = new JenaSubsystemRegistryBasic() {
			@Override
			public void load() {
				super.load();
			}
		};
		JenaSystem.setSubsystemRegistry(r);
		JenaSystem.DEBUG_INIT = true;
		JenaSystem.init();
		System.out.println("Jena-OSGi bundle configuration done!");
	}

	public void stop(BundleContext context) throws Exception {

	}
}

/*
 * 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.osgi;

import org.apache.jena.system.JenaSystem;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

// Sample bundle activator explicitly calling the static Jena initialization.
public class Activator implements BundleActivator {

	@Override
    public void start(BundleContext context) throws Exception {
		JenaSystem.init();
	}

	@Override
    public void stop(BundleContext context) throws Exception {

	}
}

Remove logging. Remove extended JenaSubsystemRegistryBasic


/*
 * 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.sunshine.app;

import ndroid.test.suitebuilder.TestSuiteBuilder;

import junit.framework.Test;
import junit.framework.TestSuite;

public class FullTestSuite extends TestSuite {
    public static Test suite() {
        return new TestSuiteBuilder(FullTestSuite.class)
                .includeAllPackagesUnderHere().build();
    }

    public FullTestSuite() {
        super();
    }
}

/*
 * 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.sunshine.app;

import android.test.suitebuilder.TestSuiteBuilder;

import junit.framework.Test;
import junit.framework.TestSuite;

public class FullTestSuite extends TestSuite {
    public static Test suite() {
        return new TestSuiteBuilder(FullTestSuite.class)
                .includeAllPackagesUnderHere().build();
    }

    public FullTestSuite() {
        super();
    }
}

Fix typo in import statement


package org.cytoscape.task.internal.export;

import java.io.IOException;
import java.io.OutputStream;

public class DelegatingOutputStream extends OutputStream {

	private OutputStream delegate = nullOutputStream();

	public void setDelegate(OutputStream o) {
		this.delegate = o == null ? nullOutputStream() : o;
	}

	@Override
	public void write(int b) throws IOException {
		delegate.write(b);
	}

	@Override
	public void flush() throws IOException {
		delegate.flush();
	}

	@Override
	public void close() throws IOException {
		delegate.close();
	}
}

package org.cytoscape.task.internal.export;

import java.io.IOException;
import java.io.OutputStream;

public class DelegatingOutputStream extends OutputStream {

	private OutputStream delegate = nullOutputStream();

	public void setDelegate(OutputStream o) {
		this.delegate = o == null ? nullOutputStream() : o;
	}

	@Override
	public void write(int b) throws IOException {
		delegate.write(b);
	}

	@Override
	public void write(byte[] b) throws IOException {
		delegate.write(b);
	}

	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		delegate.write(b, off, len);
	}

	@Override
	public void flush() throws IOException {
		delegate.flush();
	}

	@Override
	public void close() throws IOException {
		delegate.close();
	}
}

Fix performance issue when exporting


package com.nirima.jenkins.plugins.docker;

import hudson.Extension;
import jenkins.model.GlobalConfiguration;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest;

@Extension
public class DockerPluginConfiguration extends GlobalConfiguration {

    /**
     * Work around option.
     */
    public Boolean pullFix;

    /**
     * Returns this singleton instance.
     *
     * @return the singleton.
     */
    public static DockerPluginConfiguration get() {
        return GlobalConfiguration.all().get(DockerPluginConfiguration.class);
    }

    public DockerPluginConfiguration() {
        load();
    }

    @Override
    public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
        req.bindJSON(this, json);
        return true;
    }

    public final boolean getPullFix() {
        if( pullFix == null )
            pullFix = true;
        return pullFix;
    }

    @DataBoundSetter
    public final void setPullFix(boolean pullFix) {
        this.pullFix = pullFix;
    }

}

package com.nirima.jenkins.plugins.docker;

import hudson.Extension;
import jenkins.model.GlobalConfiguration;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest;

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

@Extension
public class DockerPluginConfiguration extends GlobalConfiguration {

    /**
     * Work around option.
     */
    private Boolean pullFix;

    /**
     * List of registries
     */
    private List<DockerRegistry> registryList = Collections.emptyList();

    /**
     * Returns this singleton instance.
     *
     * @return the singleton.
     */
    public static DockerPluginConfiguration get() {
        return GlobalConfiguration.all().get(DockerPluginConfiguration.class);
    }

    public DockerPluginConfiguration() {
        load();
    }

    @Override
    public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
        req.bindJSON(this,json);
        return true;
    }

    public final boolean getPullFix() {
        if( pullFix == null )
            pullFix = true;
        return pullFix;
    }

    public DockerRegistry getRegistryByName(String registryName) {
        for(DockerRegistry registry : registryList) {
            if( registry.registry.equalsIgnoreCase(registryName))
                return registry;
        }
        // Not found
        return null;
    }

    public final void setPullFix(boolean pullFix) {
        this.pullFix = pullFix;
        save();
    }

    public void setRegistryList(List<DockerRegistry> registryList) {
        this.registryList = registryList;
        save();
    }

    public List<DockerRegistry> getRegistryList() {
        return registryList;
    }
}

Add list of registries into the docker config.


package com.team254.frc2013.commands;

/**
 * Checks the auton timer and blocks if there is not enough time left
 *
 * @author pat@team254.com (Patrick Fairbank)
 */
public class CheckAutonTimerCommand extends CommandBase {
  private double timeRequiredSec;

  public CheckAutonTimerCommand(double timeRequiredSec) {
    this.timeRequiredSec = timeRequiredSec;
  }

  protected void initialize() {
  }

  protected void execute() {
  }

  protected boolean isFinished() {
    return 15 - autonTimer.get() > timeRequiredSec;
  }

  protected void end() {
  }

  protected void interrupted() {
  }
}

package com.team254.frc2013.commands;

import edu.wpi.first.wpilibj.DriverStation;

/**
 * Checks the auton timer and blocks if there is not enough time left.
 *
 * @author pat@team254.com (Patrick Fairbank)
 */
public class CheckAutonTimerCommand extends CommandBase {
  private double timeRequiredSec;

  public CheckAutonTimerCommand(double timeRequiredSec) {
    this.timeRequiredSec = timeRequiredSec;
  }

  protected void initialize() {
  }

  protected void execute() {
  }

  protected boolean isFinished() {
    return !DriverStation.getInstance().isAutonomous() || (15 - autonTimer.get() > timeRequiredSec);
  }

  protected void end() {
  }

  protected void interrupted() {
  }
}

Make CheckAutonTimer only apply to autonomous mode


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

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

import playn.tests.core.TestsGame;

public class TestsGameJava {

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

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

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

import playn.tests.core.TestsGame;

public class TestsGameJava {

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

Make the test window bigger in Java.


package com.zyeeda.framework.entities.base;

import javax.validation.constraints.NotNull;

@javax.persistence.MappedSuperclass
public class SimpleDomainEntity extends DomainEntity {

    private static final long serialVersionUID = -2200108673372668900L;

    private String name;
    private String description;

    @javax.persistence.Basic
    @javax.persistence.Column(name = "F_NAME")
    @NotNull
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }

    @javax.persistence.Basic
    @javax.persistence.Column(name = "F_DESC", length = 2000)
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }

}

package com.zyeeda.framework.entities.base;

import javax.validation.constraints.NotNull;

@javax.persistence.MappedSuperclass
public class SimpleDomainEntity extends DomainEntity {

    private static final long serialVersionUID = -2200108673372668900L;

    private String name;
    private String description;

    @javax.persistence.Basic
    @javax.persistence.Column(name = "F_NAME")
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }

    @javax.persistence.Basic
    @javax.persistence.Column(name = "F_DESC", length = 2000)
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }

}

Remove @NotNull annotation to name field.


package org.multibit.hd.ui.views;

import org.multibit.hd.ui.views.components.Images;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 *
Java AWT Frame to provide the following to startup sequence:

 *

 *
A quick rendering splash screen image

 *

 *
 * @since 0.0.8
 *
 */
public class SplashScreen extends Frame {

  private final transient Image image;

  public SplashScreen() throws HeadlessException {

    setLayout(new FlowLayout());
    setUndecorated(true);

    image = Images.newSplashScreenIconImage();
    setSize(image.getWidth(null), image.getHeight(null));

    setLocationRelativeTo(null);

    addWindowListener(
      new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }
      });

    setVisible(true);

  }

  @Override
  public void paint(Graphics g) {
    super.paint(g);
    g.drawImage(image, 0, 0, this);
  }
}

package org.multibit.hd.ui.views;

import org.multibit.hd.ui.views.components.Images;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.io.InputStream;

/**
 *
Java AWT Frame to provide the following to startup sequence:

 *

 *
A quick rendering splash screen image

 *

 *
 * @since 0.0.8
 *
 */
public class SplashScreen extends Frame {

  private final transient Image image;

  public SplashScreen() throws HeadlessException {

    setLayout(new FlowLayout());
    setUndecorated(true);

    // Inline the image access to avoid a Swing EDT violation during construction
    try (InputStream is = Images.class.getResourceAsStream("/assets/images/splash-screen.png")) {

      // Transform the mask color into the current themed text
      image = ImageIO.read(is);

    } catch (IOException e) {
      throw new IllegalStateException("The splash screen image is missing");
    }

    setSize(image.getWidth(null), image.getHeight(null));

    setLocationRelativeTo(null);

    addWindowListener(
      new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }
      });

    setVisible(true);

  }

  @Override
  public void paint(Graphics g) {
    super.paint(g);
    g.drawImage(image, 0, 0, this);
  }
}

Fix issue with EDT violation occurring during FEST tests